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.

20489 lines
543KB

  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. @end table
  759. @subsection Examples
  760. @itemize
  761. @item
  762. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  763. @example
  764. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  765. @end example
  766. @end itemize
  767. @anchor{aformat}
  768. @section aformat
  769. Set output format constraints for the input audio. The framework will
  770. negotiate the most appropriate format to minimize conversions.
  771. It accepts the following parameters:
  772. @table @option
  773. @item sample_fmts
  774. A '|'-separated list of requested sample formats.
  775. @item sample_rates
  776. A '|'-separated list of requested sample rates.
  777. @item channel_layouts
  778. A '|'-separated list of requested channel layouts.
  779. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  780. for the required syntax.
  781. @end table
  782. If a parameter is omitted, all values are allowed.
  783. Force the output to either unsigned 8-bit or signed 16-bit stereo
  784. @example
  785. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  786. @end example
  787. @section agate
  788. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  789. processing reduces disturbing noise between useful signals.
  790. Gating is done by detecting the volume below a chosen level @var{threshold}
  791. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  792. floor is set via @var{range}. Because an exact manipulation of the signal
  793. would cause distortion of the waveform the reduction can be levelled over
  794. time. This is done by setting @var{attack} and @var{release}.
  795. @var{attack} determines how long the signal has to fall below the threshold
  796. before any reduction will occur and @var{release} sets the time the signal
  797. has to rise above the threshold to reduce the reduction again.
  798. Shorter signals than the chosen attack time will be left untouched.
  799. @table @option
  800. @item level_in
  801. Set input level before filtering.
  802. Default is 1. Allowed range is from 0.015625 to 64.
  803. @item range
  804. Set the level of gain reduction when the signal is below the threshold.
  805. Default is 0.06125. Allowed range is from 0 to 1.
  806. @item threshold
  807. If a signal rises above this level the gain reduction is released.
  808. Default is 0.125. Allowed range is from 0 to 1.
  809. @item ratio
  810. Set a ratio by which the signal is reduced.
  811. Default is 2. Allowed range is from 1 to 9000.
  812. @item attack
  813. Amount of milliseconds the signal has to rise above the threshold before gain
  814. reduction stops.
  815. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  816. @item release
  817. Amount of milliseconds the signal has to fall below the threshold before the
  818. reduction is increased again. Default is 250 milliseconds.
  819. Allowed range is from 0.01 to 9000.
  820. @item makeup
  821. Set amount of amplification of signal after processing.
  822. Default is 1. Allowed range is from 1 to 64.
  823. @item knee
  824. Curve the sharp knee around the threshold to enter gain reduction more softly.
  825. Default is 2.828427125. Allowed range is from 1 to 8.
  826. @item detection
  827. Choose if exact signal should be taken for detection or an RMS like one.
  828. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  829. @item link
  830. Choose if the average level between all channels or the louder channel affects
  831. the reduction.
  832. Default is @code{average}. Can be @code{average} or @code{maximum}.
  833. @end table
  834. @section aiir
  835. Apply an arbitrary Infinite Impulse Response filter.
  836. It accepts the following parameters:
  837. @table @option
  838. @item z
  839. Set numerator/zeros coefficients.
  840. @item p
  841. Set denominator/poles coefficients.
  842. @item k
  843. Set channels gains.
  844. @item dry_gain
  845. Set input gain.
  846. @item wet_gain
  847. Set output gain.
  848. @item f
  849. Set coefficients format.
  850. @table @samp
  851. @item tf
  852. transfer function
  853. @item zp
  854. Z-plane zeros/poles, cartesian (default)
  855. @item pr
  856. Z-plane zeros/poles, polar radians
  857. @item pd
  858. Z-plane zeros/poles, polar degrees
  859. @end table
  860. @item r
  861. Set kind of processing.
  862. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  863. @item e
  864. Set filtering precision.
  865. @table @samp
  866. @item dbl
  867. double-precision floating-point (default)
  868. @item flt
  869. single-precision floating-point
  870. @item i32
  871. 32-bit integers
  872. @item i16
  873. 16-bit integers
  874. @end table
  875. @end table
  876. Coefficients in @code{tf} format are separated by spaces and are in ascending
  877. order.
  878. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  879. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  880. imaginary unit.
  881. Different coefficients and gains can be provided for every channel, in such case
  882. use '|' to separate coefficients or gains. Last provided coefficients will be
  883. used for all remaining channels.
  884. @subsection Examples
  885. @itemize
  886. @item
  887. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  888. @example
  889. 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
  890. @end example
  891. @item
  892. Same as above but in @code{zp} format:
  893. @example
  894. 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
  895. @end example
  896. @end itemize
  897. @section alimiter
  898. The limiter prevents an input signal from rising over a desired threshold.
  899. This limiter uses lookahead technology to prevent your signal from distorting.
  900. It means that there is a small delay after the signal is processed. Keep in mind
  901. that the delay it produces is the attack time you set.
  902. The filter accepts the following options:
  903. @table @option
  904. @item level_in
  905. Set input gain. Default is 1.
  906. @item level_out
  907. Set output gain. Default is 1.
  908. @item limit
  909. Don't let signals above this level pass the limiter. Default is 1.
  910. @item attack
  911. The limiter will reach its attenuation level in this amount of time in
  912. milliseconds. Default is 5 milliseconds.
  913. @item release
  914. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  915. Default is 50 milliseconds.
  916. @item asc
  917. When gain reduction is always needed ASC takes care of releasing to an
  918. average reduction level rather than reaching a reduction of 0 in the release
  919. time.
  920. @item asc_level
  921. Select how much the release time is affected by ASC, 0 means nearly no changes
  922. in release time while 1 produces higher release times.
  923. @item level
  924. Auto level output signal. Default is enabled.
  925. This normalizes audio back to 0dB if enabled.
  926. @end table
  927. Depending on picked setting it is recommended to upsample input 2x or 4x times
  928. with @ref{aresample} before applying this filter.
  929. @section allpass
  930. Apply a two-pole all-pass filter with central frequency (in Hz)
  931. @var{frequency}, and filter-width @var{width}.
  932. An all-pass filter changes the audio's frequency to phase relationship
  933. without changing its frequency to amplitude relationship.
  934. The filter accepts the following options:
  935. @table @option
  936. @item frequency, f
  937. Set frequency in Hz.
  938. @item width_type, t
  939. Set method to specify band-width of filter.
  940. @table @option
  941. @item h
  942. Hz
  943. @item q
  944. Q-Factor
  945. @item o
  946. octave
  947. @item s
  948. slope
  949. @item k
  950. kHz
  951. @end table
  952. @item width, w
  953. Specify the band-width of a filter in width_type units.
  954. @item channels, c
  955. Specify which channels to filter, by default all available are filtered.
  956. @end table
  957. @subsection Commands
  958. This filter supports the following commands:
  959. @table @option
  960. @item frequency, f
  961. Change allpass frequency.
  962. Syntax for the command is : "@var{frequency}"
  963. @item width_type, t
  964. Change allpass width_type.
  965. Syntax for the command is : "@var{width_type}"
  966. @item width, w
  967. Change allpass width.
  968. Syntax for the command is : "@var{width}"
  969. @end table
  970. @section aloop
  971. Loop audio samples.
  972. The filter accepts the following options:
  973. @table @option
  974. @item loop
  975. Set the number of loops. Setting this value to -1 will result in infinite loops.
  976. Default is 0.
  977. @item size
  978. Set maximal number of samples. Default is 0.
  979. @item start
  980. Set first sample of loop. Default is 0.
  981. @end table
  982. @anchor{amerge}
  983. @section amerge
  984. Merge two or more audio streams into a single multi-channel stream.
  985. The filter accepts the following options:
  986. @table @option
  987. @item inputs
  988. Set the number of inputs. Default is 2.
  989. @end table
  990. If the channel layouts of the inputs are disjoint, and therefore compatible,
  991. the channel layout of the output will be set accordingly and the channels
  992. will be reordered as necessary. If the channel layouts of the inputs are not
  993. disjoint, the output will have all the channels of the first input then all
  994. the channels of the second input, in that order, and the channel layout of
  995. the output will be the default value corresponding to the total number of
  996. channels.
  997. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  998. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  999. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1000. first input, b1 is the first channel of the second input).
  1001. On the other hand, if both input are in stereo, the output channels will be
  1002. in the default order: a1, a2, b1, b2, and the channel layout will be
  1003. arbitrarily set to 4.0, which may or may not be the expected value.
  1004. All inputs must have the same sample rate, and format.
  1005. If inputs do not have the same duration, the output will stop with the
  1006. shortest.
  1007. @subsection Examples
  1008. @itemize
  1009. @item
  1010. Merge two mono files into a stereo stream:
  1011. @example
  1012. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1013. @end example
  1014. @item
  1015. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1016. @example
  1017. 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
  1018. @end example
  1019. @end itemize
  1020. @section amix
  1021. Mixes multiple audio inputs into a single output.
  1022. Note that this filter only supports float samples (the @var{amerge}
  1023. and @var{pan} audio filters support many formats). If the @var{amix}
  1024. input has integer samples then @ref{aresample} will be automatically
  1025. inserted to perform the conversion to float samples.
  1026. For example
  1027. @example
  1028. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1029. @end example
  1030. will mix 3 input audio streams to a single output with the same duration as the
  1031. first input and a dropout transition time of 3 seconds.
  1032. It accepts the following parameters:
  1033. @table @option
  1034. @item inputs
  1035. The number of inputs. If unspecified, it defaults to 2.
  1036. @item duration
  1037. How to determine the end-of-stream.
  1038. @table @option
  1039. @item longest
  1040. The duration of the longest input. (default)
  1041. @item shortest
  1042. The duration of the shortest input.
  1043. @item first
  1044. The duration of the first input.
  1045. @end table
  1046. @item dropout_transition
  1047. The transition time, in seconds, for volume renormalization when an input
  1048. stream ends. The default value is 2 seconds.
  1049. @item weights
  1050. Specify weight of each input audio stream as sequence.
  1051. Each weight is separated by space. By default all inputs have same weight.
  1052. @end table
  1053. @section anequalizer
  1054. High-order parametric multiband equalizer for each channel.
  1055. It accepts the following parameters:
  1056. @table @option
  1057. @item params
  1058. This option string is in format:
  1059. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1060. Each equalizer band is separated by '|'.
  1061. @table @option
  1062. @item chn
  1063. Set channel number to which equalization will be applied.
  1064. If input doesn't have that channel the entry is ignored.
  1065. @item f
  1066. Set central frequency for band.
  1067. If input doesn't have that frequency the entry is ignored.
  1068. @item w
  1069. Set band width in hertz.
  1070. @item g
  1071. Set band gain in dB.
  1072. @item t
  1073. Set filter type for band, optional, can be:
  1074. @table @samp
  1075. @item 0
  1076. Butterworth, this is default.
  1077. @item 1
  1078. Chebyshev type 1.
  1079. @item 2
  1080. Chebyshev type 2.
  1081. @end table
  1082. @end table
  1083. @item curves
  1084. With this option activated frequency response of anequalizer is displayed
  1085. in video stream.
  1086. @item size
  1087. Set video stream size. Only useful if curves option is activated.
  1088. @item mgain
  1089. Set max gain that will be displayed. Only useful if curves option is activated.
  1090. Setting this to a reasonable value makes it possible to display gain which is derived from
  1091. neighbour bands which are too close to each other and thus produce higher gain
  1092. when both are activated.
  1093. @item fscale
  1094. Set frequency scale used to draw frequency response in video output.
  1095. Can be linear or logarithmic. Default is logarithmic.
  1096. @item colors
  1097. Set color for each channel curve which is going to be displayed in video stream.
  1098. This is list of color names separated by space or by '|'.
  1099. Unrecognised or missing colors will be replaced by white color.
  1100. @end table
  1101. @subsection Examples
  1102. @itemize
  1103. @item
  1104. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1105. for first 2 channels using Chebyshev type 1 filter:
  1106. @example
  1107. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1108. @end example
  1109. @end itemize
  1110. @subsection Commands
  1111. This filter supports the following commands:
  1112. @table @option
  1113. @item change
  1114. Alter existing filter parameters.
  1115. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1116. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1117. error is returned.
  1118. @var{freq} set new frequency parameter.
  1119. @var{width} set new width parameter in herz.
  1120. @var{gain} set new gain parameter in dB.
  1121. Full filter invocation with asendcmd may look like this:
  1122. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1123. @end table
  1124. @section anull
  1125. Pass the audio source unchanged to the output.
  1126. @section apad
  1127. Pad the end of an audio stream with silence.
  1128. This can be used together with @command{ffmpeg} @option{-shortest} to
  1129. extend audio streams to the same length as the video stream.
  1130. A description of the accepted options follows.
  1131. @table @option
  1132. @item packet_size
  1133. Set silence packet size. Default value is 4096.
  1134. @item pad_len
  1135. Set the number of samples of silence to add to the end. After the
  1136. value is reached, the stream is terminated. This option is mutually
  1137. exclusive with @option{whole_len}.
  1138. @item whole_len
  1139. Set the minimum total number of samples in the output audio stream. If
  1140. the value is longer than the input audio length, silence is added to
  1141. the end, until the value is reached. This option is mutually exclusive
  1142. with @option{pad_len}.
  1143. @end table
  1144. If neither the @option{pad_len} nor the @option{whole_len} option is
  1145. set, the filter will add silence to the end of the input stream
  1146. indefinitely.
  1147. @subsection Examples
  1148. @itemize
  1149. @item
  1150. Add 1024 samples of silence to the end of the input:
  1151. @example
  1152. apad=pad_len=1024
  1153. @end example
  1154. @item
  1155. Make sure the audio output will contain at least 10000 samples, pad
  1156. the input with silence if required:
  1157. @example
  1158. apad=whole_len=10000
  1159. @end example
  1160. @item
  1161. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1162. video stream will always result the shortest and will be converted
  1163. until the end in the output file when using the @option{shortest}
  1164. option:
  1165. @example
  1166. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1167. @end example
  1168. @end itemize
  1169. @section aphaser
  1170. Add a phasing effect to the input audio.
  1171. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1172. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1173. A description of the accepted parameters follows.
  1174. @table @option
  1175. @item in_gain
  1176. Set input gain. Default is 0.4.
  1177. @item out_gain
  1178. Set output gain. Default is 0.74
  1179. @item delay
  1180. Set delay in milliseconds. Default is 3.0.
  1181. @item decay
  1182. Set decay. Default is 0.4.
  1183. @item speed
  1184. Set modulation speed in Hz. Default is 0.5.
  1185. @item type
  1186. Set modulation type. Default is triangular.
  1187. It accepts the following values:
  1188. @table @samp
  1189. @item triangular, t
  1190. @item sinusoidal, s
  1191. @end table
  1192. @end table
  1193. @section apulsator
  1194. Audio pulsator is something between an autopanner and a tremolo.
  1195. But it can produce funny stereo effects as well. Pulsator changes the volume
  1196. of the left and right channel based on a LFO (low frequency oscillator) with
  1197. different waveforms and shifted phases.
  1198. This filter have the ability to define an offset between left and right
  1199. channel. An offset of 0 means that both LFO shapes match each other.
  1200. The left and right channel are altered equally - a conventional tremolo.
  1201. An offset of 50% means that the shape of the right channel is exactly shifted
  1202. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1203. an autopanner. At 1 both curves match again. Every setting in between moves the
  1204. phase shift gapless between all stages and produces some "bypassing" sounds with
  1205. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1206. the 0.5) the faster the signal passes from the left to the right speaker.
  1207. The filter accepts the following options:
  1208. @table @option
  1209. @item level_in
  1210. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1211. @item level_out
  1212. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1213. @item mode
  1214. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1215. sawup or sawdown. Default is sine.
  1216. @item amount
  1217. Set modulation. Define how much of original signal is affected by the LFO.
  1218. @item offset_l
  1219. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1220. @item offset_r
  1221. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1222. @item width
  1223. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1224. @item timing
  1225. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1226. @item bpm
  1227. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1228. is set to bpm.
  1229. @item ms
  1230. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1231. is set to ms.
  1232. @item hz
  1233. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1234. if timing is set to hz.
  1235. @end table
  1236. @anchor{aresample}
  1237. @section aresample
  1238. Resample the input audio to the specified parameters, using the
  1239. libswresample library. If none are specified then the filter will
  1240. automatically convert between its input and output.
  1241. This filter is also able to stretch/squeeze the audio data to make it match
  1242. the timestamps or to inject silence / cut out audio to make it match the
  1243. timestamps, do a combination of both or do neither.
  1244. The filter accepts the syntax
  1245. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1246. expresses a sample rate and @var{resampler_options} is a list of
  1247. @var{key}=@var{value} pairs, separated by ":". See the
  1248. @ref{Resampler Options,,"Resampler Options" section in the
  1249. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1250. for the complete list of supported options.
  1251. @subsection Examples
  1252. @itemize
  1253. @item
  1254. Resample the input audio to 44100Hz:
  1255. @example
  1256. aresample=44100
  1257. @end example
  1258. @item
  1259. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1260. samples per second compensation:
  1261. @example
  1262. aresample=async=1000
  1263. @end example
  1264. @end itemize
  1265. @section areverse
  1266. Reverse an audio clip.
  1267. Warning: This filter requires memory to buffer the entire clip, so trimming
  1268. is suggested.
  1269. @subsection Examples
  1270. @itemize
  1271. @item
  1272. Take the first 5 seconds of a clip, and reverse it.
  1273. @example
  1274. atrim=end=5,areverse
  1275. @end example
  1276. @end itemize
  1277. @section asetnsamples
  1278. Set the number of samples per each output audio frame.
  1279. The last output packet may contain a different number of samples, as
  1280. the filter will flush all the remaining samples when the input audio
  1281. signals its end.
  1282. The filter accepts the following options:
  1283. @table @option
  1284. @item nb_out_samples, n
  1285. Set the number of frames per each output audio frame. The number is
  1286. intended as the number of samples @emph{per each channel}.
  1287. Default value is 1024.
  1288. @item pad, p
  1289. If set to 1, the filter will pad the last audio frame with zeroes, so
  1290. that the last frame will contain the same number of samples as the
  1291. previous ones. Default value is 1.
  1292. @end table
  1293. For example, to set the number of per-frame samples to 1234 and
  1294. disable padding for the last frame, use:
  1295. @example
  1296. asetnsamples=n=1234:p=0
  1297. @end example
  1298. @section asetrate
  1299. Set the sample rate without altering the PCM data.
  1300. This will result in a change of speed and pitch.
  1301. The filter accepts the following options:
  1302. @table @option
  1303. @item sample_rate, r
  1304. Set the output sample rate. Default is 44100 Hz.
  1305. @end table
  1306. @section ashowinfo
  1307. Show a line containing various information for each input audio frame.
  1308. The input audio is not modified.
  1309. The shown line contains a sequence of key/value pairs of the form
  1310. @var{key}:@var{value}.
  1311. The following values are shown in the output:
  1312. @table @option
  1313. @item n
  1314. The (sequential) number of the input frame, starting from 0.
  1315. @item pts
  1316. The presentation timestamp of the input frame, in time base units; the time base
  1317. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1318. @item pts_time
  1319. The presentation timestamp of the input frame in seconds.
  1320. @item pos
  1321. position of the frame in the input stream, -1 if this information in
  1322. unavailable and/or meaningless (for example in case of synthetic audio)
  1323. @item fmt
  1324. The sample format.
  1325. @item chlayout
  1326. The channel layout.
  1327. @item rate
  1328. The sample rate for the audio frame.
  1329. @item nb_samples
  1330. The number of samples (per channel) in the frame.
  1331. @item checksum
  1332. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1333. audio, the data is treated as if all the planes were concatenated.
  1334. @item plane_checksums
  1335. A list of Adler-32 checksums for each data plane.
  1336. @end table
  1337. @anchor{astats}
  1338. @section astats
  1339. Display time domain statistical information about the audio channels.
  1340. Statistics are calculated and displayed for each audio channel and,
  1341. where applicable, an overall figure is also given.
  1342. It accepts the following option:
  1343. @table @option
  1344. @item length
  1345. Short window length in seconds, used for peak and trough RMS measurement.
  1346. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1347. @item metadata
  1348. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1349. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1350. disabled.
  1351. Available keys for each channel are:
  1352. DC_offset
  1353. Min_level
  1354. Max_level
  1355. Min_difference
  1356. Max_difference
  1357. Mean_difference
  1358. RMS_difference
  1359. Peak_level
  1360. RMS_peak
  1361. RMS_trough
  1362. Crest_factor
  1363. Flat_factor
  1364. Peak_count
  1365. Bit_depth
  1366. Dynamic_range
  1367. and for Overall:
  1368. DC_offset
  1369. Min_level
  1370. Max_level
  1371. Min_difference
  1372. Max_difference
  1373. Mean_difference
  1374. RMS_difference
  1375. Peak_level
  1376. RMS_level
  1377. RMS_peak
  1378. RMS_trough
  1379. Flat_factor
  1380. Peak_count
  1381. Bit_depth
  1382. Number_of_samples
  1383. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1384. this @code{lavfi.astats.Overall.Peak_count}.
  1385. For description what each key means read below.
  1386. @item reset
  1387. Set number of frame after which stats are going to be recalculated.
  1388. Default is disabled.
  1389. @end table
  1390. A description of each shown parameter follows:
  1391. @table @option
  1392. @item DC offset
  1393. Mean amplitude displacement from zero.
  1394. @item Min level
  1395. Minimal sample level.
  1396. @item Max level
  1397. Maximal sample level.
  1398. @item Min difference
  1399. Minimal difference between two consecutive samples.
  1400. @item Max difference
  1401. Maximal difference between two consecutive samples.
  1402. @item Mean difference
  1403. Mean difference between two consecutive samples.
  1404. The average of each difference between two consecutive samples.
  1405. @item RMS difference
  1406. Root Mean Square difference between two consecutive samples.
  1407. @item Peak level dB
  1408. @item RMS level dB
  1409. Standard peak and RMS level measured in dBFS.
  1410. @item RMS peak dB
  1411. @item RMS trough dB
  1412. Peak and trough values for RMS level measured over a short window.
  1413. @item Crest factor
  1414. Standard ratio of peak to RMS level (note: not in dB).
  1415. @item Flat factor
  1416. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1417. (i.e. either @var{Min level} or @var{Max level}).
  1418. @item Peak count
  1419. Number of occasions (not the number of samples) that the signal attained either
  1420. @var{Min level} or @var{Max level}.
  1421. @item Bit depth
  1422. Overall bit depth of audio. Number of bits used for each sample.
  1423. @item Dynamic range
  1424. Measured dynamic range of audio in dB.
  1425. @end table
  1426. @section atempo
  1427. Adjust audio tempo.
  1428. The filter accepts exactly one parameter, the audio tempo. If not
  1429. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1430. be in the [0.5, 2.0] range.
  1431. @subsection Examples
  1432. @itemize
  1433. @item
  1434. Slow down audio to 80% tempo:
  1435. @example
  1436. atempo=0.8
  1437. @end example
  1438. @item
  1439. To speed up audio to 125% tempo:
  1440. @example
  1441. atempo=1.25
  1442. @end example
  1443. @end itemize
  1444. @section atrim
  1445. Trim the input so that the output contains one continuous subpart of the input.
  1446. It accepts the following parameters:
  1447. @table @option
  1448. @item start
  1449. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1450. sample with the timestamp @var{start} will be the first sample in the output.
  1451. @item end
  1452. Specify time of the first audio sample that will be dropped, i.e. the
  1453. audio sample immediately preceding the one with the timestamp @var{end} will be
  1454. the last sample in the output.
  1455. @item start_pts
  1456. Same as @var{start}, except this option sets the start timestamp in samples
  1457. instead of seconds.
  1458. @item end_pts
  1459. Same as @var{end}, except this option sets the end timestamp in samples instead
  1460. of seconds.
  1461. @item duration
  1462. The maximum duration of the output in seconds.
  1463. @item start_sample
  1464. The number of the first sample that should be output.
  1465. @item end_sample
  1466. The number of the first sample that should be dropped.
  1467. @end table
  1468. @option{start}, @option{end}, and @option{duration} are expressed as time
  1469. duration specifications; see
  1470. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1471. Note that the first two sets of the start/end options and the @option{duration}
  1472. option look at the frame timestamp, while the _sample options simply count the
  1473. samples that pass through the filter. So start/end_pts and start/end_sample will
  1474. give different results when the timestamps are wrong, inexact or do not start at
  1475. zero. Also note that this filter does not modify the timestamps. If you wish
  1476. to have the output timestamps start at zero, insert the asetpts filter after the
  1477. atrim filter.
  1478. If multiple start or end options are set, this filter tries to be greedy and
  1479. keep all samples that match at least one of the specified constraints. To keep
  1480. only the part that matches all the constraints at once, chain multiple atrim
  1481. filters.
  1482. The defaults are such that all the input is kept. So it is possible to set e.g.
  1483. just the end values to keep everything before the specified time.
  1484. Examples:
  1485. @itemize
  1486. @item
  1487. Drop everything except the second minute of input:
  1488. @example
  1489. ffmpeg -i INPUT -af atrim=60:120
  1490. @end example
  1491. @item
  1492. Keep only the first 1000 samples:
  1493. @example
  1494. ffmpeg -i INPUT -af atrim=end_sample=1000
  1495. @end example
  1496. @end itemize
  1497. @section bandpass
  1498. Apply a two-pole Butterworth band-pass filter with central
  1499. frequency @var{frequency}, and (3dB-point) band-width width.
  1500. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1501. instead of the default: constant 0dB peak gain.
  1502. The filter roll off at 6dB per octave (20dB per decade).
  1503. The filter accepts the following options:
  1504. @table @option
  1505. @item frequency, f
  1506. Set the filter's central frequency. Default is @code{3000}.
  1507. @item csg
  1508. Constant skirt gain if set to 1. Defaults to 0.
  1509. @item width_type, t
  1510. Set method to specify band-width of filter.
  1511. @table @option
  1512. @item h
  1513. Hz
  1514. @item q
  1515. Q-Factor
  1516. @item o
  1517. octave
  1518. @item s
  1519. slope
  1520. @item k
  1521. kHz
  1522. @end table
  1523. @item width, w
  1524. Specify the band-width of a filter in width_type units.
  1525. @item channels, c
  1526. Specify which channels to filter, by default all available are filtered.
  1527. @end table
  1528. @subsection Commands
  1529. This filter supports the following commands:
  1530. @table @option
  1531. @item frequency, f
  1532. Change bandpass frequency.
  1533. Syntax for the command is : "@var{frequency}"
  1534. @item width_type, t
  1535. Change bandpass width_type.
  1536. Syntax for the command is : "@var{width_type}"
  1537. @item width, w
  1538. Change bandpass width.
  1539. Syntax for the command is : "@var{width}"
  1540. @end table
  1541. @section bandreject
  1542. Apply a two-pole Butterworth band-reject filter with central
  1543. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1544. The filter roll off at 6dB per octave (20dB per decade).
  1545. The filter accepts the following options:
  1546. @table @option
  1547. @item frequency, f
  1548. Set the filter's central frequency. Default is @code{3000}.
  1549. @item width_type, t
  1550. Set method to specify band-width of filter.
  1551. @table @option
  1552. @item h
  1553. Hz
  1554. @item q
  1555. Q-Factor
  1556. @item o
  1557. octave
  1558. @item s
  1559. slope
  1560. @item k
  1561. kHz
  1562. @end table
  1563. @item width, w
  1564. Specify the band-width of a filter in width_type units.
  1565. @item channels, c
  1566. Specify which channels to filter, by default all available are filtered.
  1567. @end table
  1568. @subsection Commands
  1569. This filter supports the following commands:
  1570. @table @option
  1571. @item frequency, f
  1572. Change bandreject frequency.
  1573. Syntax for the command is : "@var{frequency}"
  1574. @item width_type, t
  1575. Change bandreject width_type.
  1576. Syntax for the command is : "@var{width_type}"
  1577. @item width, w
  1578. Change bandreject width.
  1579. Syntax for the command is : "@var{width}"
  1580. @end table
  1581. @section bass
  1582. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1583. shelving filter with a response similar to that of a standard
  1584. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1585. The filter accepts the following options:
  1586. @table @option
  1587. @item gain, g
  1588. Give the gain at 0 Hz. Its useful range is about -20
  1589. (for a large cut) to +20 (for a large boost).
  1590. Beware of clipping when using a positive gain.
  1591. @item frequency, f
  1592. Set the filter's central frequency and so can be used
  1593. to extend or reduce the frequency range to be boosted or cut.
  1594. The default value is @code{100} Hz.
  1595. @item width_type, t
  1596. Set method to specify band-width of filter.
  1597. @table @option
  1598. @item h
  1599. Hz
  1600. @item q
  1601. Q-Factor
  1602. @item o
  1603. octave
  1604. @item s
  1605. slope
  1606. @item k
  1607. kHz
  1608. @end table
  1609. @item width, w
  1610. Determine how steep is the filter's shelf transition.
  1611. @item channels, c
  1612. Specify which channels to filter, by default all available are filtered.
  1613. @end table
  1614. @subsection Commands
  1615. This filter supports the following commands:
  1616. @table @option
  1617. @item frequency, f
  1618. Change bass frequency.
  1619. Syntax for the command is : "@var{frequency}"
  1620. @item width_type, t
  1621. Change bass width_type.
  1622. Syntax for the command is : "@var{width_type}"
  1623. @item width, w
  1624. Change bass width.
  1625. Syntax for the command is : "@var{width}"
  1626. @item gain, g
  1627. Change bass gain.
  1628. Syntax for the command is : "@var{gain}"
  1629. @end table
  1630. @section biquad
  1631. Apply a biquad IIR filter with the given coefficients.
  1632. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1633. are the numerator and denominator coefficients respectively.
  1634. and @var{channels}, @var{c} specify which channels to filter, by default all
  1635. available are filtered.
  1636. @subsection Commands
  1637. This filter supports the following commands:
  1638. @table @option
  1639. @item a0
  1640. @item a1
  1641. @item a2
  1642. @item b0
  1643. @item b1
  1644. @item b2
  1645. Change biquad parameter.
  1646. Syntax for the command is : "@var{value}"
  1647. @end table
  1648. @section bs2b
  1649. Bauer stereo to binaural transformation, which improves headphone listening of
  1650. stereo audio records.
  1651. To enable compilation of this filter you need to configure FFmpeg with
  1652. @code{--enable-libbs2b}.
  1653. It accepts the following parameters:
  1654. @table @option
  1655. @item profile
  1656. Pre-defined crossfeed level.
  1657. @table @option
  1658. @item default
  1659. Default level (fcut=700, feed=50).
  1660. @item cmoy
  1661. Chu Moy circuit (fcut=700, feed=60).
  1662. @item jmeier
  1663. Jan Meier circuit (fcut=650, feed=95).
  1664. @end table
  1665. @item fcut
  1666. Cut frequency (in Hz).
  1667. @item feed
  1668. Feed level (in Hz).
  1669. @end table
  1670. @section channelmap
  1671. Remap input channels to new locations.
  1672. It accepts the following parameters:
  1673. @table @option
  1674. @item map
  1675. Map channels from input to output. The argument is a '|'-separated list of
  1676. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1677. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1678. channel (e.g. FL for front left) or its index in the input channel layout.
  1679. @var{out_channel} is the name of the output channel or its index in the output
  1680. channel layout. If @var{out_channel} is not given then it is implicitly an
  1681. index, starting with zero and increasing by one for each mapping.
  1682. @item channel_layout
  1683. The channel layout of the output stream.
  1684. @end table
  1685. If no mapping is present, the filter will implicitly map input channels to
  1686. output channels, preserving indices.
  1687. @subsection Examples
  1688. @itemize
  1689. @item
  1690. For example, assuming a 5.1+downmix input MOV file,
  1691. @example
  1692. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1693. @end example
  1694. will create an output WAV file tagged as stereo from the downmix channels of
  1695. the input.
  1696. @item
  1697. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1698. @example
  1699. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1700. @end example
  1701. @end itemize
  1702. @section channelsplit
  1703. Split each channel from an input audio stream into a separate output stream.
  1704. It accepts the following parameters:
  1705. @table @option
  1706. @item channel_layout
  1707. The channel layout of the input stream. The default is "stereo".
  1708. @item channels
  1709. A channel layout describing the channels to be extracted as separate output streams
  1710. or "all" to extract each input channel as a separate stream. The default is "all".
  1711. Choosing channels not present in channel layout in the input will result in an error.
  1712. @end table
  1713. @subsection Examples
  1714. @itemize
  1715. @item
  1716. For example, assuming a stereo input MP3 file,
  1717. @example
  1718. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1719. @end example
  1720. will create an output Matroska file with two audio streams, one containing only
  1721. the left channel and the other the right channel.
  1722. @item
  1723. Split a 5.1 WAV file into per-channel files:
  1724. @example
  1725. ffmpeg -i in.wav -filter_complex
  1726. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1727. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1728. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1729. side_right.wav
  1730. @end example
  1731. @item
  1732. Extract only LFE from a 5.1 WAV file:
  1733. @example
  1734. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1735. -map '[LFE]' lfe.wav
  1736. @end example
  1737. @end itemize
  1738. @section chorus
  1739. Add a chorus effect to the audio.
  1740. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1741. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1742. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1743. The modulation depth defines the range the modulated delay is played before or after
  1744. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1745. sound tuned around the original one, like in a chorus where some vocals are slightly
  1746. off key.
  1747. It accepts the following parameters:
  1748. @table @option
  1749. @item in_gain
  1750. Set input gain. Default is 0.4.
  1751. @item out_gain
  1752. Set output gain. Default is 0.4.
  1753. @item delays
  1754. Set delays. A typical delay is around 40ms to 60ms.
  1755. @item decays
  1756. Set decays.
  1757. @item speeds
  1758. Set speeds.
  1759. @item depths
  1760. Set depths.
  1761. @end table
  1762. @subsection Examples
  1763. @itemize
  1764. @item
  1765. A single delay:
  1766. @example
  1767. chorus=0.7:0.9:55:0.4:0.25:2
  1768. @end example
  1769. @item
  1770. Two delays:
  1771. @example
  1772. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1773. @end example
  1774. @item
  1775. Fuller sounding chorus with three delays:
  1776. @example
  1777. 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
  1778. @end example
  1779. @end itemize
  1780. @section compand
  1781. Compress or expand the audio's dynamic range.
  1782. It accepts the following parameters:
  1783. @table @option
  1784. @item attacks
  1785. @item decays
  1786. A list of times in seconds for each channel over which the instantaneous level
  1787. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1788. increase of volume and @var{decays} refers to decrease of volume. For most
  1789. situations, the attack time (response to the audio getting louder) should be
  1790. shorter than the decay time, because the human ear is more sensitive to sudden
  1791. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1792. a typical value for decay is 0.8 seconds.
  1793. If specified number of attacks & decays is lower than number of channels, the last
  1794. set attack/decay will be used for all remaining channels.
  1795. @item points
  1796. A list of points for the transfer function, specified in dB relative to the
  1797. maximum possible signal amplitude. Each key points list must be defined using
  1798. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1799. @code{x0/y0 x1/y1 x2/y2 ....}
  1800. The input values must be in strictly increasing order but the transfer function
  1801. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1802. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1803. function are @code{-70/-70|-60/-20|1/0}.
  1804. @item soft-knee
  1805. Set the curve radius in dB for all joints. It defaults to 0.01.
  1806. @item gain
  1807. Set the additional gain in dB to be applied at all points on the transfer
  1808. function. This allows for easy adjustment of the overall gain.
  1809. It defaults to 0.
  1810. @item volume
  1811. Set an initial volume, in dB, to be assumed for each channel when filtering
  1812. starts. This permits the user to supply a nominal level initially, so that, for
  1813. example, a very large gain is not applied to initial signal levels before the
  1814. companding has begun to operate. A typical value for audio which is initially
  1815. quiet is -90 dB. It defaults to 0.
  1816. @item delay
  1817. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1818. delayed before being fed to the volume adjuster. Specifying a delay
  1819. approximately equal to the attack/decay times allows the filter to effectively
  1820. operate in predictive rather than reactive mode. It defaults to 0.
  1821. @end table
  1822. @subsection Examples
  1823. @itemize
  1824. @item
  1825. Make music with both quiet and loud passages suitable for listening to in a
  1826. noisy environment:
  1827. @example
  1828. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1829. @end example
  1830. Another example for audio with whisper and explosion parts:
  1831. @example
  1832. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1833. @end example
  1834. @item
  1835. A noise gate for when the noise is at a lower level than the signal:
  1836. @example
  1837. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1838. @end example
  1839. @item
  1840. Here is another noise gate, this time for when the noise is at a higher level
  1841. than the signal (making it, in some ways, similar to squelch):
  1842. @example
  1843. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1844. @end example
  1845. @item
  1846. 2:1 compression starting at -6dB:
  1847. @example
  1848. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1849. @end example
  1850. @item
  1851. 2:1 compression starting at -9dB:
  1852. @example
  1853. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1854. @end example
  1855. @item
  1856. 2:1 compression starting at -12dB:
  1857. @example
  1858. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1859. @end example
  1860. @item
  1861. 2:1 compression starting at -18dB:
  1862. @example
  1863. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1864. @end example
  1865. @item
  1866. 3:1 compression starting at -15dB:
  1867. @example
  1868. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1869. @end example
  1870. @item
  1871. Compressor/Gate:
  1872. @example
  1873. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1874. @end example
  1875. @item
  1876. Expander:
  1877. @example
  1878. 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
  1879. @end example
  1880. @item
  1881. Hard limiter at -6dB:
  1882. @example
  1883. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1884. @end example
  1885. @item
  1886. Hard limiter at -12dB:
  1887. @example
  1888. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1889. @end example
  1890. @item
  1891. Hard noise gate at -35 dB:
  1892. @example
  1893. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1894. @end example
  1895. @item
  1896. Soft limiter:
  1897. @example
  1898. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1899. @end example
  1900. @end itemize
  1901. @section compensationdelay
  1902. Compensation Delay Line is a metric based delay to compensate differing
  1903. positions of microphones or speakers.
  1904. For example, you have recorded guitar with two microphones placed in
  1905. different location. Because the front of sound wave has fixed speed in
  1906. normal conditions, the phasing of microphones can vary and depends on
  1907. their location and interposition. The best sound mix can be achieved when
  1908. these microphones are in phase (synchronized). Note that distance of
  1909. ~30 cm between microphones makes one microphone to capture signal in
  1910. antiphase to another microphone. That makes the final mix sounding moody.
  1911. This filter helps to solve phasing problems by adding different delays
  1912. to each microphone track and make them synchronized.
  1913. The best result can be reached when you take one track as base and
  1914. synchronize other tracks one by one with it.
  1915. Remember that synchronization/delay tolerance depends on sample rate, too.
  1916. Higher sample rates will give more tolerance.
  1917. It accepts the following parameters:
  1918. @table @option
  1919. @item mm
  1920. Set millimeters distance. This is compensation distance for fine tuning.
  1921. Default is 0.
  1922. @item cm
  1923. Set cm distance. This is compensation distance for tightening distance setup.
  1924. Default is 0.
  1925. @item m
  1926. Set meters distance. This is compensation distance for hard distance setup.
  1927. Default is 0.
  1928. @item dry
  1929. Set dry amount. Amount of unprocessed (dry) signal.
  1930. Default is 0.
  1931. @item wet
  1932. Set wet amount. Amount of processed (wet) signal.
  1933. Default is 1.
  1934. @item temp
  1935. Set temperature degree in Celsius. This is the temperature of the environment.
  1936. Default is 20.
  1937. @end table
  1938. @section crossfeed
  1939. Apply headphone crossfeed filter.
  1940. Crossfeed is the process of blending the left and right channels of stereo
  1941. audio recording.
  1942. It is mainly used to reduce extreme stereo separation of low frequencies.
  1943. The intent is to produce more speaker like sound to the listener.
  1944. The filter accepts the following options:
  1945. @table @option
  1946. @item strength
  1947. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1948. This sets gain of low shelf filter for side part of stereo image.
  1949. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1950. @item range
  1951. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1952. This sets cut off frequency of low shelf filter. Default is cut off near
  1953. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1954. @item level_in
  1955. Set input gain. Default is 0.9.
  1956. @item level_out
  1957. Set output gain. Default is 1.
  1958. @end table
  1959. @section crystalizer
  1960. Simple algorithm to expand audio dynamic range.
  1961. The filter accepts the following options:
  1962. @table @option
  1963. @item i
  1964. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1965. (unchanged sound) to 10.0 (maximum effect).
  1966. @item c
  1967. Enable clipping. By default is enabled.
  1968. @end table
  1969. @section dcshift
  1970. Apply a DC shift to the audio.
  1971. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1972. in the recording chain) from the audio. The effect of a DC offset is reduced
  1973. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1974. a signal has a DC offset.
  1975. @table @option
  1976. @item shift
  1977. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1978. the audio.
  1979. @item limitergain
  1980. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1981. used to prevent clipping.
  1982. @end table
  1983. @section drmeter
  1984. Measure audio dynamic range.
  1985. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  1986. is found in transition material. And anything less that 8 have very poor dynamics
  1987. and is very compressed.
  1988. The filter accepts the following options:
  1989. @table @option
  1990. @item length
  1991. Set window length in seconds used to split audio into segments of equal length.
  1992. Default is 3 seconds.
  1993. @end table
  1994. @section dynaudnorm
  1995. Dynamic Audio Normalizer.
  1996. This filter applies a certain amount of gain to the input audio in order
  1997. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1998. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1999. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2000. This allows for applying extra gain to the "quiet" sections of the audio
  2001. while avoiding distortions or clipping the "loud" sections. In other words:
  2002. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2003. sections, in the sense that the volume of each section is brought to the
  2004. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2005. this goal *without* applying "dynamic range compressing". It will retain 100%
  2006. of the dynamic range *within* each section of the audio file.
  2007. @table @option
  2008. @item f
  2009. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2010. Default is 500 milliseconds.
  2011. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2012. referred to as frames. This is required, because a peak magnitude has no
  2013. meaning for just a single sample value. Instead, we need to determine the
  2014. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2015. normalizer would simply use the peak magnitude of the complete file, the
  2016. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2017. frame. The length of a frame is specified in milliseconds. By default, the
  2018. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2019. been found to give good results with most files.
  2020. Note that the exact frame length, in number of samples, will be determined
  2021. automatically, based on the sampling rate of the individual input audio file.
  2022. @item g
  2023. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2024. number. Default is 31.
  2025. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2026. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2027. is specified in frames, centered around the current frame. For the sake of
  2028. simplicity, this must be an odd number. Consequently, the default value of 31
  2029. takes into account the current frame, as well as the 15 preceding frames and
  2030. the 15 subsequent frames. Using a larger window results in a stronger
  2031. smoothing effect and thus in less gain variation, i.e. slower gain
  2032. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2033. effect and thus in more gain variation, i.e. faster gain adaptation.
  2034. In other words, the more you increase this value, the more the Dynamic Audio
  2035. Normalizer will behave like a "traditional" normalization filter. On the
  2036. contrary, the more you decrease this value, the more the Dynamic Audio
  2037. Normalizer will behave like a dynamic range compressor.
  2038. @item p
  2039. Set the target peak value. This specifies the highest permissible magnitude
  2040. level for the normalized audio input. This filter will try to approach the
  2041. target peak magnitude as closely as possible, but at the same time it also
  2042. makes sure that the normalized signal will never exceed the peak magnitude.
  2043. A frame's maximum local gain factor is imposed directly by the target peak
  2044. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2045. It is not recommended to go above this value.
  2046. @item m
  2047. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2048. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2049. factor for each input frame, i.e. the maximum gain factor that does not
  2050. result in clipping or distortion. The maximum gain factor is determined by
  2051. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2052. additionally bounds the frame's maximum gain factor by a predetermined
  2053. (global) maximum gain factor. This is done in order to avoid excessive gain
  2054. factors in "silent" or almost silent frames. By default, the maximum gain
  2055. factor is 10.0, For most inputs the default value should be sufficient and
  2056. it usually is not recommended to increase this value. Though, for input
  2057. with an extremely low overall volume level, it may be necessary to allow even
  2058. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2059. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2060. Instead, a "sigmoid" threshold function will be applied. This way, the
  2061. gain factors will smoothly approach the threshold value, but never exceed that
  2062. value.
  2063. @item r
  2064. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2065. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2066. This means that the maximum local gain factor for each frame is defined
  2067. (only) by the frame's highest magnitude sample. This way, the samples can
  2068. be amplified as much as possible without exceeding the maximum signal
  2069. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2070. Normalizer can also take into account the frame's root mean square,
  2071. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2072. determine the power of a time-varying signal. It is therefore considered
  2073. that the RMS is a better approximation of the "perceived loudness" than
  2074. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2075. frames to a constant RMS value, a uniform "perceived loudness" can be
  2076. established. If a target RMS value has been specified, a frame's local gain
  2077. factor is defined as the factor that would result in exactly that RMS value.
  2078. Note, however, that the maximum local gain factor is still restricted by the
  2079. frame's highest magnitude sample, in order to prevent clipping.
  2080. @item n
  2081. Enable channels coupling. By default is enabled.
  2082. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2083. amount. This means the same gain factor will be applied to all channels, i.e.
  2084. the maximum possible gain factor is determined by the "loudest" channel.
  2085. However, in some recordings, it may happen that the volume of the different
  2086. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2087. In this case, this option can be used to disable the channel coupling. This way,
  2088. the gain factor will be determined independently for each channel, depending
  2089. only on the individual channel's highest magnitude sample. This allows for
  2090. harmonizing the volume of the different channels.
  2091. @item c
  2092. Enable DC bias correction. By default is disabled.
  2093. An audio signal (in the time domain) is a sequence of sample values.
  2094. In the Dynamic Audio Normalizer these sample values are represented in the
  2095. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2096. audio signal, or "waveform", should be centered around the zero point.
  2097. That means if we calculate the mean value of all samples in a file, or in a
  2098. single frame, then the result should be 0.0 or at least very close to that
  2099. value. If, however, there is a significant deviation of the mean value from
  2100. 0.0, in either positive or negative direction, this is referred to as a
  2101. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2102. Audio Normalizer provides optional DC bias correction.
  2103. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2104. the mean value, or "DC correction" offset, of each input frame and subtract
  2105. that value from all of the frame's sample values which ensures those samples
  2106. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2107. boundaries, the DC correction offset values will be interpolated smoothly
  2108. between neighbouring frames.
  2109. @item b
  2110. Enable alternative boundary mode. By default is disabled.
  2111. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2112. around each frame. This includes the preceding frames as well as the
  2113. subsequent frames. However, for the "boundary" frames, located at the very
  2114. beginning and at the very end of the audio file, not all neighbouring
  2115. frames are available. In particular, for the first few frames in the audio
  2116. file, the preceding frames are not known. And, similarly, for the last few
  2117. frames in the audio file, the subsequent frames are not known. Thus, the
  2118. question arises which gain factors should be assumed for the missing frames
  2119. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2120. to deal with this situation. The default boundary mode assumes a gain factor
  2121. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2122. "fade out" at the beginning and at the end of the input, respectively.
  2123. @item s
  2124. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2125. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2126. compression. This means that signal peaks will not be pruned and thus the
  2127. full dynamic range will be retained within each local neighbourhood. However,
  2128. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2129. normalization algorithm with a more "traditional" compression.
  2130. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2131. (thresholding) function. If (and only if) the compression feature is enabled,
  2132. all input frames will be processed by a soft knee thresholding function prior
  2133. to the actual normalization process. Put simply, the thresholding function is
  2134. going to prune all samples whose magnitude exceeds a certain threshold value.
  2135. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2136. value. Instead, the threshold value will be adjusted for each individual
  2137. frame.
  2138. In general, smaller parameters result in stronger compression, and vice versa.
  2139. Values below 3.0 are not recommended, because audible distortion may appear.
  2140. @end table
  2141. @section earwax
  2142. Make audio easier to listen to on headphones.
  2143. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2144. so that when listened to on headphones the stereo image is moved from
  2145. inside your head (standard for headphones) to outside and in front of
  2146. the listener (standard for speakers).
  2147. Ported from SoX.
  2148. @section equalizer
  2149. Apply a two-pole peaking equalisation (EQ) filter. With this
  2150. filter, the signal-level at and around a selected frequency can
  2151. be increased or decreased, whilst (unlike bandpass and bandreject
  2152. filters) that at all other frequencies is unchanged.
  2153. In order to produce complex equalisation curves, this filter can
  2154. be given several times, each with a different central frequency.
  2155. The filter accepts the following options:
  2156. @table @option
  2157. @item frequency, f
  2158. Set the filter's central frequency in Hz.
  2159. @item width_type, t
  2160. Set method to specify band-width of filter.
  2161. @table @option
  2162. @item h
  2163. Hz
  2164. @item q
  2165. Q-Factor
  2166. @item o
  2167. octave
  2168. @item s
  2169. slope
  2170. @item k
  2171. kHz
  2172. @end table
  2173. @item width, w
  2174. Specify the band-width of a filter in width_type units.
  2175. @item gain, g
  2176. Set the required gain or attenuation in dB.
  2177. Beware of clipping when using a positive gain.
  2178. @item channels, c
  2179. Specify which channels to filter, by default all available are filtered.
  2180. @end table
  2181. @subsection Examples
  2182. @itemize
  2183. @item
  2184. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2185. @example
  2186. equalizer=f=1000:t=h:width=200:g=-10
  2187. @end example
  2188. @item
  2189. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2190. @example
  2191. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2192. @end example
  2193. @end itemize
  2194. @subsection Commands
  2195. This filter supports the following commands:
  2196. @table @option
  2197. @item frequency, f
  2198. Change equalizer frequency.
  2199. Syntax for the command is : "@var{frequency}"
  2200. @item width_type, t
  2201. Change equalizer width_type.
  2202. Syntax for the command is : "@var{width_type}"
  2203. @item width, w
  2204. Change equalizer width.
  2205. Syntax for the command is : "@var{width}"
  2206. @item gain, g
  2207. Change equalizer gain.
  2208. Syntax for the command is : "@var{gain}"
  2209. @end table
  2210. @section extrastereo
  2211. Linearly increases the difference between left and right channels which
  2212. adds some sort of "live" effect to playback.
  2213. The filter accepts the following options:
  2214. @table @option
  2215. @item m
  2216. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2217. (average of both channels), with 1.0 sound will be unchanged, with
  2218. -1.0 left and right channels will be swapped.
  2219. @item c
  2220. Enable clipping. By default is enabled.
  2221. @end table
  2222. @section firequalizer
  2223. Apply FIR Equalization using arbitrary frequency response.
  2224. The filter accepts the following option:
  2225. @table @option
  2226. @item gain
  2227. Set gain curve equation (in dB). The expression can contain variables:
  2228. @table @option
  2229. @item f
  2230. the evaluated frequency
  2231. @item sr
  2232. sample rate
  2233. @item ch
  2234. channel number, set to 0 when multichannels evaluation is disabled
  2235. @item chid
  2236. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2237. multichannels evaluation is disabled
  2238. @item chs
  2239. number of channels
  2240. @item chlayout
  2241. channel_layout, see libavutil/channel_layout.h
  2242. @end table
  2243. and functions:
  2244. @table @option
  2245. @item gain_interpolate(f)
  2246. interpolate gain on frequency f based on gain_entry
  2247. @item cubic_interpolate(f)
  2248. same as gain_interpolate, but smoother
  2249. @end table
  2250. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2251. @item gain_entry
  2252. Set gain entry for gain_interpolate function. The expression can
  2253. contain functions:
  2254. @table @option
  2255. @item entry(f, g)
  2256. store gain entry at frequency f with value g
  2257. @end table
  2258. This option is also available as command.
  2259. @item delay
  2260. Set filter delay in seconds. Higher value means more accurate.
  2261. Default is @code{0.01}.
  2262. @item accuracy
  2263. Set filter accuracy in Hz. Lower value means more accurate.
  2264. Default is @code{5}.
  2265. @item wfunc
  2266. Set window function. Acceptable values are:
  2267. @table @option
  2268. @item rectangular
  2269. rectangular window, useful when gain curve is already smooth
  2270. @item hann
  2271. hann window (default)
  2272. @item hamming
  2273. hamming window
  2274. @item blackman
  2275. blackman window
  2276. @item nuttall3
  2277. 3-terms continuous 1st derivative nuttall window
  2278. @item mnuttall3
  2279. minimum 3-terms discontinuous nuttall window
  2280. @item nuttall
  2281. 4-terms continuous 1st derivative nuttall window
  2282. @item bnuttall
  2283. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2284. @item bharris
  2285. blackman-harris window
  2286. @item tukey
  2287. tukey window
  2288. @end table
  2289. @item fixed
  2290. If enabled, use fixed number of audio samples. This improves speed when
  2291. filtering with large delay. Default is disabled.
  2292. @item multi
  2293. Enable multichannels evaluation on gain. Default is disabled.
  2294. @item zero_phase
  2295. Enable zero phase mode by subtracting timestamp to compensate delay.
  2296. Default is disabled.
  2297. @item scale
  2298. Set scale used by gain. Acceptable values are:
  2299. @table @option
  2300. @item linlin
  2301. linear frequency, linear gain
  2302. @item linlog
  2303. linear frequency, logarithmic (in dB) gain (default)
  2304. @item loglin
  2305. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2306. @item loglog
  2307. logarithmic frequency, logarithmic gain
  2308. @end table
  2309. @item dumpfile
  2310. Set file for dumping, suitable for gnuplot.
  2311. @item dumpscale
  2312. Set scale for dumpfile. Acceptable values are same with scale option.
  2313. Default is linlog.
  2314. @item fft2
  2315. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2316. Default is disabled.
  2317. @item min_phase
  2318. Enable minimum phase impulse response. Default is disabled.
  2319. @end table
  2320. @subsection Examples
  2321. @itemize
  2322. @item
  2323. lowpass at 1000 Hz:
  2324. @example
  2325. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2326. @end example
  2327. @item
  2328. lowpass at 1000 Hz with gain_entry:
  2329. @example
  2330. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2331. @end example
  2332. @item
  2333. custom equalization:
  2334. @example
  2335. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2336. @end example
  2337. @item
  2338. higher delay with zero phase to compensate delay:
  2339. @example
  2340. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2341. @end example
  2342. @item
  2343. lowpass on left channel, highpass on right channel:
  2344. @example
  2345. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2346. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2347. @end example
  2348. @end itemize
  2349. @section flanger
  2350. Apply a flanging effect to the audio.
  2351. The filter accepts the following options:
  2352. @table @option
  2353. @item delay
  2354. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2355. @item depth
  2356. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2357. @item regen
  2358. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2359. Default value is 0.
  2360. @item width
  2361. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2362. Default value is 71.
  2363. @item speed
  2364. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2365. @item shape
  2366. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2367. Default value is @var{sinusoidal}.
  2368. @item phase
  2369. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2370. Default value is 25.
  2371. @item interp
  2372. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2373. Default is @var{linear}.
  2374. @end table
  2375. @section haas
  2376. Apply Haas effect to audio.
  2377. Note that this makes most sense to apply on mono signals.
  2378. With this filter applied to mono signals it give some directionality and
  2379. stretches its stereo image.
  2380. The filter accepts the following options:
  2381. @table @option
  2382. @item level_in
  2383. Set input level. By default is @var{1}, or 0dB
  2384. @item level_out
  2385. Set output level. By default is @var{1}, or 0dB.
  2386. @item side_gain
  2387. Set gain applied to side part of signal. By default is @var{1}.
  2388. @item middle_source
  2389. Set kind of middle source. Can be one of the following:
  2390. @table @samp
  2391. @item left
  2392. Pick left channel.
  2393. @item right
  2394. Pick right channel.
  2395. @item mid
  2396. Pick middle part signal of stereo image.
  2397. @item side
  2398. Pick side part signal of stereo image.
  2399. @end table
  2400. @item middle_phase
  2401. Change middle phase. By default is disabled.
  2402. @item left_delay
  2403. Set left channel delay. By default is @var{2.05} milliseconds.
  2404. @item left_balance
  2405. Set left channel balance. By default is @var{-1}.
  2406. @item left_gain
  2407. Set left channel gain. By default is @var{1}.
  2408. @item left_phase
  2409. Change left phase. By default is disabled.
  2410. @item right_delay
  2411. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2412. @item right_balance
  2413. Set right channel balance. By default is @var{1}.
  2414. @item right_gain
  2415. Set right channel gain. By default is @var{1}.
  2416. @item right_phase
  2417. Change right phase. By default is enabled.
  2418. @end table
  2419. @section hdcd
  2420. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2421. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2422. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2423. of HDCD, and detects the Transient Filter flag.
  2424. @example
  2425. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2426. @end example
  2427. When using the filter with wav, note the default encoding for wav is 16-bit,
  2428. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2429. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2430. @example
  2431. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2432. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2433. @end example
  2434. The filter accepts the following options:
  2435. @table @option
  2436. @item disable_autoconvert
  2437. Disable any automatic format conversion or resampling in the filter graph.
  2438. @item process_stereo
  2439. Process the stereo channels together. If target_gain does not match between
  2440. channels, consider it invalid and use the last valid target_gain.
  2441. @item cdt_ms
  2442. Set the code detect timer period in ms.
  2443. @item force_pe
  2444. Always extend peaks above -3dBFS even if PE isn't signaled.
  2445. @item analyze_mode
  2446. Replace audio with a solid tone and adjust the amplitude to signal some
  2447. specific aspect of the decoding process. The output file can be loaded in
  2448. an audio editor alongside the original to aid analysis.
  2449. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2450. Modes are:
  2451. @table @samp
  2452. @item 0, off
  2453. Disabled
  2454. @item 1, lle
  2455. Gain adjustment level at each sample
  2456. @item 2, pe
  2457. Samples where peak extend occurs
  2458. @item 3, cdt
  2459. Samples where the code detect timer is active
  2460. @item 4, tgm
  2461. Samples where the target gain does not match between channels
  2462. @end table
  2463. @end table
  2464. @section headphone
  2465. Apply head-related transfer functions (HRTFs) to create virtual
  2466. loudspeakers around the user for binaural listening via headphones.
  2467. The HRIRs are provided via additional streams, for each channel
  2468. one stereo input stream is needed.
  2469. The filter accepts the following options:
  2470. @table @option
  2471. @item map
  2472. Set mapping of input streams for convolution.
  2473. The argument is a '|'-separated list of channel names in order as they
  2474. are given as additional stream inputs for filter.
  2475. This also specify number of input streams. Number of input streams
  2476. must be not less than number of channels in first stream plus one.
  2477. @item gain
  2478. Set gain applied to audio. Value is in dB. Default is 0.
  2479. @item type
  2480. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2481. processing audio in time domain which is slow.
  2482. @var{freq} is processing audio in frequency domain which is fast.
  2483. Default is @var{freq}.
  2484. @item lfe
  2485. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2486. @end table
  2487. @subsection Examples
  2488. @itemize
  2489. @item
  2490. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2491. each amovie filter use stereo file with IR coefficients as input.
  2492. The files give coefficients for each position of virtual loudspeaker:
  2493. @example
  2494. 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"
  2495. output.wav
  2496. @end example
  2497. @end itemize
  2498. @section highpass
  2499. Apply a high-pass filter with 3dB point frequency.
  2500. The filter can be either single-pole, or double-pole (the default).
  2501. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2502. The filter accepts the following options:
  2503. @table @option
  2504. @item frequency, f
  2505. Set frequency in Hz. Default is 3000.
  2506. @item poles, p
  2507. Set number of poles. Default is 2.
  2508. @item width_type, t
  2509. Set method to specify band-width of filter.
  2510. @table @option
  2511. @item h
  2512. Hz
  2513. @item q
  2514. Q-Factor
  2515. @item o
  2516. octave
  2517. @item s
  2518. slope
  2519. @item k
  2520. kHz
  2521. @end table
  2522. @item width, w
  2523. Specify the band-width of a filter in width_type units.
  2524. Applies only to double-pole filter.
  2525. The default is 0.707q and gives a Butterworth response.
  2526. @item channels, c
  2527. Specify which channels to filter, by default all available are filtered.
  2528. @end table
  2529. @subsection Commands
  2530. This filter supports the following commands:
  2531. @table @option
  2532. @item frequency, f
  2533. Change highpass frequency.
  2534. Syntax for the command is : "@var{frequency}"
  2535. @item width_type, t
  2536. Change highpass width_type.
  2537. Syntax for the command is : "@var{width_type}"
  2538. @item width, w
  2539. Change highpass width.
  2540. Syntax for the command is : "@var{width}"
  2541. @end table
  2542. @section join
  2543. Join multiple input streams into one multi-channel stream.
  2544. It accepts the following parameters:
  2545. @table @option
  2546. @item inputs
  2547. The number of input streams. It defaults to 2.
  2548. @item channel_layout
  2549. The desired output channel layout. It defaults to stereo.
  2550. @item map
  2551. Map channels from inputs to output. The argument is a '|'-separated list of
  2552. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2553. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2554. can be either the name of the input channel (e.g. FL for front left) or its
  2555. index in the specified input stream. @var{out_channel} is the name of the output
  2556. channel.
  2557. @end table
  2558. The filter will attempt to guess the mappings when they are not specified
  2559. explicitly. It does so by first trying to find an unused matching input channel
  2560. and if that fails it picks the first unused input channel.
  2561. Join 3 inputs (with properly set channel layouts):
  2562. @example
  2563. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2564. @end example
  2565. Build a 5.1 output from 6 single-channel streams:
  2566. @example
  2567. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2568. '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'
  2569. out
  2570. @end example
  2571. @section ladspa
  2572. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2573. To enable compilation of this filter you need to configure FFmpeg with
  2574. @code{--enable-ladspa}.
  2575. @table @option
  2576. @item file, f
  2577. Specifies the name of LADSPA plugin library to load. If the environment
  2578. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2579. each one of the directories specified by the colon separated list in
  2580. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2581. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2582. @file{/usr/lib/ladspa/}.
  2583. @item plugin, p
  2584. Specifies the plugin within the library. Some libraries contain only
  2585. one plugin, but others contain many of them. If this is not set filter
  2586. will list all available plugins within the specified library.
  2587. @item controls, c
  2588. Set the '|' separated list of controls which are zero or more floating point
  2589. values that determine the behavior of the loaded plugin (for example delay,
  2590. threshold or gain).
  2591. Controls need to be defined using the following syntax:
  2592. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2593. @var{valuei} is the value set on the @var{i}-th control.
  2594. Alternatively they can be also defined using the following syntax:
  2595. @var{value0}|@var{value1}|@var{value2}|..., where
  2596. @var{valuei} is the value set on the @var{i}-th control.
  2597. If @option{controls} is set to @code{help}, all available controls and
  2598. their valid ranges are printed.
  2599. @item sample_rate, s
  2600. Specify the sample rate, default to 44100. Only used if plugin have
  2601. zero inputs.
  2602. @item nb_samples, n
  2603. Set the number of samples per channel per each output frame, default
  2604. is 1024. Only used if plugin have zero inputs.
  2605. @item duration, d
  2606. Set the minimum duration of the sourced audio. See
  2607. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2608. for the accepted syntax.
  2609. Note that the resulting duration may be greater than the specified duration,
  2610. as the generated audio is always cut at the end of a complete frame.
  2611. If not specified, or the expressed duration is negative, the audio is
  2612. supposed to be generated forever.
  2613. Only used if plugin have zero inputs.
  2614. @end table
  2615. @subsection Examples
  2616. @itemize
  2617. @item
  2618. List all available plugins within amp (LADSPA example plugin) library:
  2619. @example
  2620. ladspa=file=amp
  2621. @end example
  2622. @item
  2623. List all available controls and their valid ranges for @code{vcf_notch}
  2624. plugin from @code{VCF} library:
  2625. @example
  2626. ladspa=f=vcf:p=vcf_notch:c=help
  2627. @end example
  2628. @item
  2629. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2630. plugin library:
  2631. @example
  2632. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2633. @end example
  2634. @item
  2635. Add reverberation to the audio using TAP-plugins
  2636. (Tom's Audio Processing plugins):
  2637. @example
  2638. ladspa=file=tap_reverb:tap_reverb
  2639. @end example
  2640. @item
  2641. Generate white noise, with 0.2 amplitude:
  2642. @example
  2643. ladspa=file=cmt:noise_source_white:c=c0=.2
  2644. @end example
  2645. @item
  2646. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2647. @code{C* Audio Plugin Suite} (CAPS) library:
  2648. @example
  2649. ladspa=file=caps:Click:c=c1=20'
  2650. @end example
  2651. @item
  2652. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2653. @example
  2654. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2655. @end example
  2656. @item
  2657. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2658. @code{SWH Plugins} collection:
  2659. @example
  2660. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2661. @end example
  2662. @item
  2663. Attenuate low frequencies using Multiband EQ from Steve Harris
  2664. @code{SWH Plugins} collection:
  2665. @example
  2666. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2667. @end example
  2668. @item
  2669. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2670. (CAPS) library:
  2671. @example
  2672. ladspa=caps:Narrower
  2673. @end example
  2674. @item
  2675. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2676. @example
  2677. ladspa=caps:White:.2
  2678. @end example
  2679. @item
  2680. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2681. @example
  2682. ladspa=caps:Fractal:c=c1=1
  2683. @end example
  2684. @item
  2685. Dynamic volume normalization using @code{VLevel} plugin:
  2686. @example
  2687. ladspa=vlevel-ladspa:vlevel_mono
  2688. @end example
  2689. @end itemize
  2690. @subsection Commands
  2691. This filter supports the following commands:
  2692. @table @option
  2693. @item cN
  2694. Modify the @var{N}-th control value.
  2695. If the specified value is not valid, it is ignored and prior one is kept.
  2696. @end table
  2697. @section loudnorm
  2698. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2699. Support for both single pass (livestreams, files) and double pass (files) modes.
  2700. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2701. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2702. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2703. The filter accepts the following options:
  2704. @table @option
  2705. @item I, i
  2706. Set integrated loudness target.
  2707. Range is -70.0 - -5.0. Default value is -24.0.
  2708. @item LRA, lra
  2709. Set loudness range target.
  2710. Range is 1.0 - 20.0. Default value is 7.0.
  2711. @item TP, tp
  2712. Set maximum true peak.
  2713. Range is -9.0 - +0.0. Default value is -2.0.
  2714. @item measured_I, measured_i
  2715. Measured IL of input file.
  2716. Range is -99.0 - +0.0.
  2717. @item measured_LRA, measured_lra
  2718. Measured LRA of input file.
  2719. Range is 0.0 - 99.0.
  2720. @item measured_TP, measured_tp
  2721. Measured true peak of input file.
  2722. Range is -99.0 - +99.0.
  2723. @item measured_thresh
  2724. Measured threshold of input file.
  2725. Range is -99.0 - +0.0.
  2726. @item offset
  2727. Set offset gain. Gain is applied before the true-peak limiter.
  2728. Range is -99.0 - +99.0. Default is +0.0.
  2729. @item linear
  2730. Normalize linearly if possible.
  2731. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2732. to be specified in order to use this mode.
  2733. Options are true or false. Default is true.
  2734. @item dual_mono
  2735. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2736. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2737. If set to @code{true}, this option will compensate for this effect.
  2738. Multi-channel input files are not affected by this option.
  2739. Options are true or false. Default is false.
  2740. @item print_format
  2741. Set print format for stats. Options are summary, json, or none.
  2742. Default value is none.
  2743. @end table
  2744. @section lowpass
  2745. Apply a low-pass filter with 3dB point frequency.
  2746. The filter can be either single-pole or double-pole (the default).
  2747. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2748. The filter accepts the following options:
  2749. @table @option
  2750. @item frequency, f
  2751. Set frequency in Hz. Default is 500.
  2752. @item poles, p
  2753. Set number of poles. Default is 2.
  2754. @item width_type, t
  2755. Set method to specify band-width of filter.
  2756. @table @option
  2757. @item h
  2758. Hz
  2759. @item q
  2760. Q-Factor
  2761. @item o
  2762. octave
  2763. @item s
  2764. slope
  2765. @item k
  2766. kHz
  2767. @end table
  2768. @item width, w
  2769. Specify the band-width of a filter in width_type units.
  2770. Applies only to double-pole filter.
  2771. The default is 0.707q and gives a Butterworth response.
  2772. @item channels, c
  2773. Specify which channels to filter, by default all available are filtered.
  2774. @end table
  2775. @subsection Examples
  2776. @itemize
  2777. @item
  2778. Lowpass only LFE channel, it LFE is not present it does nothing:
  2779. @example
  2780. lowpass=c=LFE
  2781. @end example
  2782. @end itemize
  2783. @subsection Commands
  2784. This filter supports the following commands:
  2785. @table @option
  2786. @item frequency, f
  2787. Change lowpass frequency.
  2788. Syntax for the command is : "@var{frequency}"
  2789. @item width_type, t
  2790. Change lowpass width_type.
  2791. Syntax for the command is : "@var{width_type}"
  2792. @item width, w
  2793. Change lowpass width.
  2794. Syntax for the command is : "@var{width}"
  2795. @end table
  2796. @section lv2
  2797. Load a LV2 (LADSPA Version 2) plugin.
  2798. To enable compilation of this filter you need to configure FFmpeg with
  2799. @code{--enable-lv2}.
  2800. @table @option
  2801. @item plugin, p
  2802. Specifies the plugin URI. You may need to escape ':'.
  2803. @item controls, c
  2804. Set the '|' separated list of controls which are zero or more floating point
  2805. values that determine the behavior of the loaded plugin (for example delay,
  2806. threshold or gain).
  2807. If @option{controls} is set to @code{help}, all available controls and
  2808. their valid ranges are printed.
  2809. @item sample_rate, s
  2810. Specify the sample rate, default to 44100. Only used if plugin have
  2811. zero inputs.
  2812. @item nb_samples, n
  2813. Set the number of samples per channel per each output frame, default
  2814. is 1024. Only used if plugin have zero inputs.
  2815. @item duration, d
  2816. Set the minimum duration of the sourced audio. See
  2817. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2818. for the accepted syntax.
  2819. Note that the resulting duration may be greater than the specified duration,
  2820. as the generated audio is always cut at the end of a complete frame.
  2821. If not specified, or the expressed duration is negative, the audio is
  2822. supposed to be generated forever.
  2823. Only used if plugin have zero inputs.
  2824. @end table
  2825. @subsection Examples
  2826. @itemize
  2827. @item
  2828. Apply bass enhancer plugin from Calf:
  2829. @example
  2830. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2831. @end example
  2832. @item
  2833. Apply vinyl plugin from Calf:
  2834. @example
  2835. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2836. @end example
  2837. @item
  2838. Apply bit crusher plugin from ArtyFX:
  2839. @example
  2840. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2841. @end example
  2842. @end itemize
  2843. @section mcompand
  2844. Multiband Compress or expand the audio's dynamic range.
  2845. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2846. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2847. response when absent compander action.
  2848. It accepts the following parameters:
  2849. @table @option
  2850. @item args
  2851. This option syntax is:
  2852. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2853. For explanation of each item refer to compand filter documentation.
  2854. @end table
  2855. @anchor{pan}
  2856. @section pan
  2857. Mix channels with specific gain levels. The filter accepts the output
  2858. channel layout followed by a set of channels definitions.
  2859. This filter is also designed to efficiently remap the channels of an audio
  2860. stream.
  2861. The filter accepts parameters of the form:
  2862. "@var{l}|@var{outdef}|@var{outdef}|..."
  2863. @table @option
  2864. @item l
  2865. output channel layout or number of channels
  2866. @item outdef
  2867. output channel specification, of the form:
  2868. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2869. @item out_name
  2870. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2871. number (c0, c1, etc.)
  2872. @item gain
  2873. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2874. @item in_name
  2875. input channel to use, see out_name for details; it is not possible to mix
  2876. named and numbered input channels
  2877. @end table
  2878. If the `=' in a channel specification is replaced by `<', then the gains for
  2879. that specification will be renormalized so that the total is 1, thus
  2880. avoiding clipping noise.
  2881. @subsection Mixing examples
  2882. For example, if you want to down-mix from stereo to mono, but with a bigger
  2883. factor for the left channel:
  2884. @example
  2885. pan=1c|c0=0.9*c0+0.1*c1
  2886. @end example
  2887. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2888. 7-channels surround:
  2889. @example
  2890. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2891. @end example
  2892. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2893. that should be preferred (see "-ac" option) unless you have very specific
  2894. needs.
  2895. @subsection Remapping examples
  2896. The channel remapping will be effective if, and only if:
  2897. @itemize
  2898. @item gain coefficients are zeroes or ones,
  2899. @item only one input per channel output,
  2900. @end itemize
  2901. If all these conditions are satisfied, the filter will notify the user ("Pure
  2902. channel mapping detected"), and use an optimized and lossless method to do the
  2903. remapping.
  2904. For example, if you have a 5.1 source and want a stereo audio stream by
  2905. dropping the extra channels:
  2906. @example
  2907. pan="stereo| c0=FL | c1=FR"
  2908. @end example
  2909. Given the same source, you can also switch front left and front right channels
  2910. and keep the input channel layout:
  2911. @example
  2912. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2913. @end example
  2914. If the input is a stereo audio stream, you can mute the front left channel (and
  2915. still keep the stereo channel layout) with:
  2916. @example
  2917. pan="stereo|c1=c1"
  2918. @end example
  2919. Still with a stereo audio stream input, you can copy the right channel in both
  2920. front left and right:
  2921. @example
  2922. pan="stereo| c0=FR | c1=FR"
  2923. @end example
  2924. @section replaygain
  2925. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2926. outputs it unchanged.
  2927. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2928. @section resample
  2929. Convert the audio sample format, sample rate and channel layout. It is
  2930. not meant to be used directly.
  2931. @section rubberband
  2932. Apply time-stretching and pitch-shifting with librubberband.
  2933. The filter accepts the following options:
  2934. @table @option
  2935. @item tempo
  2936. Set tempo scale factor.
  2937. @item pitch
  2938. Set pitch scale factor.
  2939. @item transients
  2940. Set transients detector.
  2941. Possible values are:
  2942. @table @var
  2943. @item crisp
  2944. @item mixed
  2945. @item smooth
  2946. @end table
  2947. @item detector
  2948. Set detector.
  2949. Possible values are:
  2950. @table @var
  2951. @item compound
  2952. @item percussive
  2953. @item soft
  2954. @end table
  2955. @item phase
  2956. Set phase.
  2957. Possible values are:
  2958. @table @var
  2959. @item laminar
  2960. @item independent
  2961. @end table
  2962. @item window
  2963. Set processing window size.
  2964. Possible values are:
  2965. @table @var
  2966. @item standard
  2967. @item short
  2968. @item long
  2969. @end table
  2970. @item smoothing
  2971. Set smoothing.
  2972. Possible values are:
  2973. @table @var
  2974. @item off
  2975. @item on
  2976. @end table
  2977. @item formant
  2978. Enable formant preservation when shift pitching.
  2979. Possible values are:
  2980. @table @var
  2981. @item shifted
  2982. @item preserved
  2983. @end table
  2984. @item pitchq
  2985. Set pitch quality.
  2986. Possible values are:
  2987. @table @var
  2988. @item quality
  2989. @item speed
  2990. @item consistency
  2991. @end table
  2992. @item channels
  2993. Set channels.
  2994. Possible values are:
  2995. @table @var
  2996. @item apart
  2997. @item together
  2998. @end table
  2999. @end table
  3000. @section sidechaincompress
  3001. This filter acts like normal compressor but has the ability to compress
  3002. detected signal using second input signal.
  3003. It needs two input streams and returns one output stream.
  3004. First input stream will be processed depending on second stream signal.
  3005. The filtered signal then can be filtered with other filters in later stages of
  3006. processing. See @ref{pan} and @ref{amerge} filter.
  3007. The filter accepts the following options:
  3008. @table @option
  3009. @item level_in
  3010. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3011. @item threshold
  3012. If a signal of second stream raises above this level it will affect the gain
  3013. reduction of first stream.
  3014. By default is 0.125. Range is between 0.00097563 and 1.
  3015. @item ratio
  3016. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3017. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3018. Default is 2. Range is between 1 and 20.
  3019. @item attack
  3020. Amount of milliseconds the signal has to rise above the threshold before gain
  3021. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3022. @item release
  3023. Amount of milliseconds the signal has to fall below the threshold before
  3024. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3025. @item makeup
  3026. Set the amount by how much signal will be amplified after processing.
  3027. Default is 1. Range is from 1 to 64.
  3028. @item knee
  3029. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3030. Default is 2.82843. Range is between 1 and 8.
  3031. @item link
  3032. Choose if the @code{average} level between all channels of side-chain stream
  3033. or the louder(@code{maximum}) channel of side-chain stream affects the
  3034. reduction. Default is @code{average}.
  3035. @item detection
  3036. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3037. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3038. @item level_sc
  3039. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3040. @item mix
  3041. How much to use compressed signal in output. Default is 1.
  3042. Range is between 0 and 1.
  3043. @end table
  3044. @subsection Examples
  3045. @itemize
  3046. @item
  3047. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3048. depending on the signal of 2nd input and later compressed signal to be
  3049. merged with 2nd input:
  3050. @example
  3051. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3052. @end example
  3053. @end itemize
  3054. @section sidechaingate
  3055. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3056. filter the detected signal before sending it to the gain reduction stage.
  3057. Normally a gate uses the full range signal to detect a level above the
  3058. threshold.
  3059. For example: If you cut all lower frequencies from your sidechain signal
  3060. the gate will decrease the volume of your track only if not enough highs
  3061. appear. With this technique you are able to reduce the resonation of a
  3062. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3063. guitar.
  3064. It needs two input streams and returns one output stream.
  3065. First input stream will be processed depending on second stream signal.
  3066. The filter accepts the following options:
  3067. @table @option
  3068. @item level_in
  3069. Set input level before filtering.
  3070. Default is 1. Allowed range is from 0.015625 to 64.
  3071. @item range
  3072. Set the level of gain reduction when the signal is below the threshold.
  3073. Default is 0.06125. Allowed range is from 0 to 1.
  3074. @item threshold
  3075. If a signal rises above this level the gain reduction is released.
  3076. Default is 0.125. Allowed range is from 0 to 1.
  3077. @item ratio
  3078. Set a ratio about which the signal is reduced.
  3079. Default is 2. Allowed range is from 1 to 9000.
  3080. @item attack
  3081. Amount of milliseconds the signal has to rise above the threshold before gain
  3082. reduction stops.
  3083. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3084. @item release
  3085. Amount of milliseconds the signal has to fall below the threshold before the
  3086. reduction is increased again. Default is 250 milliseconds.
  3087. Allowed range is from 0.01 to 9000.
  3088. @item makeup
  3089. Set amount of amplification of signal after processing.
  3090. Default is 1. Allowed range is from 1 to 64.
  3091. @item knee
  3092. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3093. Default is 2.828427125. Allowed range is from 1 to 8.
  3094. @item detection
  3095. Choose if exact signal should be taken for detection or an RMS like one.
  3096. Default is rms. Can be peak or rms.
  3097. @item link
  3098. Choose if the average level between all channels or the louder channel affects
  3099. the reduction.
  3100. Default is average. Can be average or maximum.
  3101. @item level_sc
  3102. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3103. @end table
  3104. @section silencedetect
  3105. Detect silence in an audio stream.
  3106. This filter logs a message when it detects that the input audio volume is less
  3107. or equal to a noise tolerance value for a duration greater or equal to the
  3108. minimum detected noise duration.
  3109. The printed times and duration are expressed in seconds.
  3110. The filter accepts the following options:
  3111. @table @option
  3112. @item duration, d
  3113. Set silence duration until notification (default is 2 seconds).
  3114. @item noise, n
  3115. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3116. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3117. @end table
  3118. @subsection Examples
  3119. @itemize
  3120. @item
  3121. Detect 5 seconds of silence with -50dB noise tolerance:
  3122. @example
  3123. silencedetect=n=-50dB:d=5
  3124. @end example
  3125. @item
  3126. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3127. tolerance in @file{silence.mp3}:
  3128. @example
  3129. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3130. @end example
  3131. @end itemize
  3132. @section silenceremove
  3133. Remove silence from the beginning, middle or end of the audio.
  3134. The filter accepts the following options:
  3135. @table @option
  3136. @item start_periods
  3137. This value is used to indicate if audio should be trimmed at beginning of
  3138. the audio. A value of zero indicates no silence should be trimmed from the
  3139. beginning. When specifying a non-zero value, it trims audio up until it
  3140. finds non-silence. Normally, when trimming silence from beginning of audio
  3141. the @var{start_periods} will be @code{1} but it can be increased to higher
  3142. values to trim all audio up to specific count of non-silence periods.
  3143. Default value is @code{0}.
  3144. @item start_duration
  3145. Specify the amount of time that non-silence must be detected before it stops
  3146. trimming audio. By increasing the duration, bursts of noises can be treated
  3147. as silence and trimmed off. Default value is @code{0}.
  3148. @item start_threshold
  3149. This indicates what sample value should be treated as silence. For digital
  3150. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3151. you may wish to increase the value to account for background noise.
  3152. Can be specified in dB (in case "dB" is appended to the specified value)
  3153. or amplitude ratio. Default value is @code{0}.
  3154. @item stop_periods
  3155. Set the count for trimming silence from the end of audio.
  3156. To remove silence from the middle of a file, specify a @var{stop_periods}
  3157. that is negative. This value is then treated as a positive value and is
  3158. used to indicate the effect should restart processing as specified by
  3159. @var{start_periods}, making it suitable for removing periods of silence
  3160. in the middle of the audio.
  3161. Default value is @code{0}.
  3162. @item stop_duration
  3163. Specify a duration of silence that must exist before audio is not copied any
  3164. more. By specifying a higher duration, silence that is wanted can be left in
  3165. the audio.
  3166. Default value is @code{0}.
  3167. @item stop_threshold
  3168. This is the same as @option{start_threshold} but for trimming silence from
  3169. the end of audio.
  3170. Can be specified in dB (in case "dB" is appended to the specified value)
  3171. or amplitude ratio. Default value is @code{0}.
  3172. @item leave_silence
  3173. This indicates that @var{stop_duration} length of audio should be left intact
  3174. at the beginning of each period of silence.
  3175. For example, if you want to remove long pauses between words but do not want
  3176. to remove the pauses completely. Default value is @code{0}.
  3177. @item detection
  3178. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3179. and works better with digital silence which is exactly 0.
  3180. Default value is @code{rms}.
  3181. @item window
  3182. Set ratio used to calculate size of window for detecting silence.
  3183. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3184. @end table
  3185. @subsection Examples
  3186. @itemize
  3187. @item
  3188. The following example shows how this filter can be used to start a recording
  3189. that does not contain the delay at the start which usually occurs between
  3190. pressing the record button and the start of the performance:
  3191. @example
  3192. silenceremove=1:5:0.02
  3193. @end example
  3194. @item
  3195. Trim all silence encountered from beginning to end where there is more than 1
  3196. second of silence in audio:
  3197. @example
  3198. silenceremove=0:0:0:-1:1:-90dB
  3199. @end example
  3200. @end itemize
  3201. @section sofalizer
  3202. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3203. loudspeakers around the user for binaural listening via headphones (audio
  3204. formats up to 9 channels supported).
  3205. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3206. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3207. Austrian Academy of Sciences.
  3208. To enable compilation of this filter you need to configure FFmpeg with
  3209. @code{--enable-libmysofa}.
  3210. The filter accepts the following options:
  3211. @table @option
  3212. @item sofa
  3213. Set the SOFA file used for rendering.
  3214. @item gain
  3215. Set gain applied to audio. Value is in dB. Default is 0.
  3216. @item rotation
  3217. Set rotation of virtual loudspeakers in deg. Default is 0.
  3218. @item elevation
  3219. Set elevation of virtual speakers in deg. Default is 0.
  3220. @item radius
  3221. Set distance in meters between loudspeakers and the listener with near-field
  3222. HRTFs. Default is 1.
  3223. @item type
  3224. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3225. processing audio in time domain which is slow.
  3226. @var{freq} is processing audio in frequency domain which is fast.
  3227. Default is @var{freq}.
  3228. @item speakers
  3229. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3230. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3231. Each virtual loudspeaker is described with short channel name following with
  3232. azimuth and elevation in degrees.
  3233. Each virtual loudspeaker description is separated by '|'.
  3234. For example to override front left and front right channel positions use:
  3235. 'speakers=FL 45 15|FR 345 15'.
  3236. Descriptions with unrecognised channel names are ignored.
  3237. @item lfegain
  3238. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3239. @end table
  3240. @subsection Examples
  3241. @itemize
  3242. @item
  3243. Using ClubFritz6 sofa file:
  3244. @example
  3245. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3246. @end example
  3247. @item
  3248. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3249. @example
  3250. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3251. @end example
  3252. @item
  3253. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3254. and also with custom gain:
  3255. @example
  3256. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3257. @end example
  3258. @end itemize
  3259. @section stereotools
  3260. This filter has some handy utilities to manage stereo signals, for converting
  3261. M/S stereo recordings to L/R signal while having control over the parameters
  3262. or spreading the stereo image of master track.
  3263. The filter accepts the following options:
  3264. @table @option
  3265. @item level_in
  3266. Set input level before filtering for both channels. Defaults is 1.
  3267. Allowed range is from 0.015625 to 64.
  3268. @item level_out
  3269. Set output level after filtering for both channels. Defaults is 1.
  3270. Allowed range is from 0.015625 to 64.
  3271. @item balance_in
  3272. Set input balance between both channels. Default is 0.
  3273. Allowed range is from -1 to 1.
  3274. @item balance_out
  3275. Set output balance between both channels. Default is 0.
  3276. Allowed range is from -1 to 1.
  3277. @item softclip
  3278. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3279. clipping. Disabled by default.
  3280. @item mutel
  3281. Mute the left channel. Disabled by default.
  3282. @item muter
  3283. Mute the right channel. Disabled by default.
  3284. @item phasel
  3285. Change the phase of the left channel. Disabled by default.
  3286. @item phaser
  3287. Change the phase of the right channel. Disabled by default.
  3288. @item mode
  3289. Set stereo mode. Available values are:
  3290. @table @samp
  3291. @item lr>lr
  3292. Left/Right to Left/Right, this is default.
  3293. @item lr>ms
  3294. Left/Right to Mid/Side.
  3295. @item ms>lr
  3296. Mid/Side to Left/Right.
  3297. @item lr>ll
  3298. Left/Right to Left/Left.
  3299. @item lr>rr
  3300. Left/Right to Right/Right.
  3301. @item lr>l+r
  3302. Left/Right to Left + Right.
  3303. @item lr>rl
  3304. Left/Right to Right/Left.
  3305. @item ms>ll
  3306. Mid/Side to Left/Left.
  3307. @item ms>rr
  3308. Mid/Side to Right/Right.
  3309. @end table
  3310. @item slev
  3311. Set level of side signal. Default is 1.
  3312. Allowed range is from 0.015625 to 64.
  3313. @item sbal
  3314. Set balance of side signal. Default is 0.
  3315. Allowed range is from -1 to 1.
  3316. @item mlev
  3317. Set level of the middle signal. Default is 1.
  3318. Allowed range is from 0.015625 to 64.
  3319. @item mpan
  3320. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3321. @item base
  3322. Set stereo base between mono and inversed channels. Default is 0.
  3323. Allowed range is from -1 to 1.
  3324. @item delay
  3325. Set delay in milliseconds how much to delay left from right channel and
  3326. vice versa. Default is 0. Allowed range is from -20 to 20.
  3327. @item sclevel
  3328. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3329. @item phase
  3330. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3331. @item bmode_in, bmode_out
  3332. Set balance mode for balance_in/balance_out option.
  3333. Can be one of the following:
  3334. @table @samp
  3335. @item balance
  3336. Classic balance mode. Attenuate one channel at time.
  3337. Gain is raised up to 1.
  3338. @item amplitude
  3339. Similar as classic mode above but gain is raised up to 2.
  3340. @item power
  3341. Equal power distribution, from -6dB to +6dB range.
  3342. @end table
  3343. @end table
  3344. @subsection Examples
  3345. @itemize
  3346. @item
  3347. Apply karaoke like effect:
  3348. @example
  3349. stereotools=mlev=0.015625
  3350. @end example
  3351. @item
  3352. Convert M/S signal to L/R:
  3353. @example
  3354. "stereotools=mode=ms>lr"
  3355. @end example
  3356. @end itemize
  3357. @section stereowiden
  3358. This filter enhance the stereo effect by suppressing signal common to both
  3359. channels and by delaying the signal of left into right and vice versa,
  3360. thereby widening the stereo effect.
  3361. The filter accepts the following options:
  3362. @table @option
  3363. @item delay
  3364. Time in milliseconds of the delay of left signal into right and vice versa.
  3365. Default is 20 milliseconds.
  3366. @item feedback
  3367. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3368. effect of left signal in right output and vice versa which gives widening
  3369. effect. Default is 0.3.
  3370. @item crossfeed
  3371. Cross feed of left into right with inverted phase. This helps in suppressing
  3372. the mono. If the value is 1 it will cancel all the signal common to both
  3373. channels. Default is 0.3.
  3374. @item drymix
  3375. Set level of input signal of original channel. Default is 0.8.
  3376. @end table
  3377. @section superequalizer
  3378. Apply 18 band equalizer.
  3379. The filter accepts the following options:
  3380. @table @option
  3381. @item 1b
  3382. Set 65Hz band gain.
  3383. @item 2b
  3384. Set 92Hz band gain.
  3385. @item 3b
  3386. Set 131Hz band gain.
  3387. @item 4b
  3388. Set 185Hz band gain.
  3389. @item 5b
  3390. Set 262Hz band gain.
  3391. @item 6b
  3392. Set 370Hz band gain.
  3393. @item 7b
  3394. Set 523Hz band gain.
  3395. @item 8b
  3396. Set 740Hz band gain.
  3397. @item 9b
  3398. Set 1047Hz band gain.
  3399. @item 10b
  3400. Set 1480Hz band gain.
  3401. @item 11b
  3402. Set 2093Hz band gain.
  3403. @item 12b
  3404. Set 2960Hz band gain.
  3405. @item 13b
  3406. Set 4186Hz band gain.
  3407. @item 14b
  3408. Set 5920Hz band gain.
  3409. @item 15b
  3410. Set 8372Hz band gain.
  3411. @item 16b
  3412. Set 11840Hz band gain.
  3413. @item 17b
  3414. Set 16744Hz band gain.
  3415. @item 18b
  3416. Set 20000Hz band gain.
  3417. @end table
  3418. @section surround
  3419. Apply audio surround upmix filter.
  3420. This filter allows to produce multichannel output from audio stream.
  3421. The filter accepts the following options:
  3422. @table @option
  3423. @item chl_out
  3424. Set output channel layout. By default, this is @var{5.1}.
  3425. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3426. for the required syntax.
  3427. @item chl_in
  3428. Set input channel layout. By default, this is @var{stereo}.
  3429. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3430. for the required syntax.
  3431. @item level_in
  3432. Set input volume level. By default, this is @var{1}.
  3433. @item level_out
  3434. Set output volume level. By default, this is @var{1}.
  3435. @item lfe
  3436. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3437. @item lfe_low
  3438. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3439. @item lfe_high
  3440. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3441. @item fc_in
  3442. Set front center input volume. By default, this is @var{1}.
  3443. @item fc_out
  3444. Set front center output volume. By default, this is @var{1}.
  3445. @item lfe_in
  3446. Set LFE input volume. By default, this is @var{1}.
  3447. @item lfe_out
  3448. Set LFE output volume. By default, this is @var{1}.
  3449. @end table
  3450. @section treble
  3451. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3452. shelving filter with a response similar to that of a standard
  3453. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3454. The filter accepts the following options:
  3455. @table @option
  3456. @item gain, g
  3457. Give the gain at whichever is the lower of ~22 kHz and the
  3458. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3459. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3460. @item frequency, f
  3461. Set the filter's central frequency and so can be used
  3462. to extend or reduce the frequency range to be boosted or cut.
  3463. The default value is @code{3000} Hz.
  3464. @item width_type, t
  3465. Set method to specify band-width of filter.
  3466. @table @option
  3467. @item h
  3468. Hz
  3469. @item q
  3470. Q-Factor
  3471. @item o
  3472. octave
  3473. @item s
  3474. slope
  3475. @item k
  3476. kHz
  3477. @end table
  3478. @item width, w
  3479. Determine how steep is the filter's shelf transition.
  3480. @item channels, c
  3481. Specify which channels to filter, by default all available are filtered.
  3482. @end table
  3483. @subsection Commands
  3484. This filter supports the following commands:
  3485. @table @option
  3486. @item frequency, f
  3487. Change treble frequency.
  3488. Syntax for the command is : "@var{frequency}"
  3489. @item width_type, t
  3490. Change treble width_type.
  3491. Syntax for the command is : "@var{width_type}"
  3492. @item width, w
  3493. Change treble width.
  3494. Syntax for the command is : "@var{width}"
  3495. @item gain, g
  3496. Change treble gain.
  3497. Syntax for the command is : "@var{gain}"
  3498. @end table
  3499. @section tremolo
  3500. Sinusoidal amplitude modulation.
  3501. The filter accepts the following options:
  3502. @table @option
  3503. @item f
  3504. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3505. (20 Hz or lower) will result in a tremolo effect.
  3506. This filter may also be used as a ring modulator by specifying
  3507. a modulation frequency higher than 20 Hz.
  3508. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3509. @item d
  3510. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3511. Default value is 0.5.
  3512. @end table
  3513. @section vibrato
  3514. Sinusoidal phase modulation.
  3515. The filter accepts the following options:
  3516. @table @option
  3517. @item f
  3518. Modulation frequency in Hertz.
  3519. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3520. @item d
  3521. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3522. Default value is 0.5.
  3523. @end table
  3524. @section volume
  3525. Adjust the input audio volume.
  3526. It accepts the following parameters:
  3527. @table @option
  3528. @item volume
  3529. Set audio volume expression.
  3530. Output values are clipped to the maximum value.
  3531. The output audio volume is given by the relation:
  3532. @example
  3533. @var{output_volume} = @var{volume} * @var{input_volume}
  3534. @end example
  3535. The default value for @var{volume} is "1.0".
  3536. @item precision
  3537. This parameter represents the mathematical precision.
  3538. It determines which input sample formats will be allowed, which affects the
  3539. precision of the volume scaling.
  3540. @table @option
  3541. @item fixed
  3542. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3543. @item float
  3544. 32-bit floating-point; this limits input sample format to FLT. (default)
  3545. @item double
  3546. 64-bit floating-point; this limits input sample format to DBL.
  3547. @end table
  3548. @item replaygain
  3549. Choose the behaviour on encountering ReplayGain side data in input frames.
  3550. @table @option
  3551. @item drop
  3552. Remove ReplayGain side data, ignoring its contents (the default).
  3553. @item ignore
  3554. Ignore ReplayGain side data, but leave it in the frame.
  3555. @item track
  3556. Prefer the track gain, if present.
  3557. @item album
  3558. Prefer the album gain, if present.
  3559. @end table
  3560. @item replaygain_preamp
  3561. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3562. Default value for @var{replaygain_preamp} is 0.0.
  3563. @item eval
  3564. Set when the volume expression is evaluated.
  3565. It accepts the following values:
  3566. @table @samp
  3567. @item once
  3568. only evaluate expression once during the filter initialization, or
  3569. when the @samp{volume} command is sent
  3570. @item frame
  3571. evaluate expression for each incoming frame
  3572. @end table
  3573. Default value is @samp{once}.
  3574. @end table
  3575. The volume expression can contain the following parameters.
  3576. @table @option
  3577. @item n
  3578. frame number (starting at zero)
  3579. @item nb_channels
  3580. number of channels
  3581. @item nb_consumed_samples
  3582. number of samples consumed by the filter
  3583. @item nb_samples
  3584. number of samples in the current frame
  3585. @item pos
  3586. original frame position in the file
  3587. @item pts
  3588. frame PTS
  3589. @item sample_rate
  3590. sample rate
  3591. @item startpts
  3592. PTS at start of stream
  3593. @item startt
  3594. time at start of stream
  3595. @item t
  3596. frame time
  3597. @item tb
  3598. timestamp timebase
  3599. @item volume
  3600. last set volume value
  3601. @end table
  3602. Note that when @option{eval} is set to @samp{once} only the
  3603. @var{sample_rate} and @var{tb} variables are available, all other
  3604. variables will evaluate to NAN.
  3605. @subsection Commands
  3606. This filter supports the following commands:
  3607. @table @option
  3608. @item volume
  3609. Modify the volume expression.
  3610. The command accepts the same syntax of the corresponding option.
  3611. If the specified expression is not valid, it is kept at its current
  3612. value.
  3613. @item replaygain_noclip
  3614. Prevent clipping by limiting the gain applied.
  3615. Default value for @var{replaygain_noclip} is 1.
  3616. @end table
  3617. @subsection Examples
  3618. @itemize
  3619. @item
  3620. Halve the input audio volume:
  3621. @example
  3622. volume=volume=0.5
  3623. volume=volume=1/2
  3624. volume=volume=-6.0206dB
  3625. @end example
  3626. In all the above example the named key for @option{volume} can be
  3627. omitted, for example like in:
  3628. @example
  3629. volume=0.5
  3630. @end example
  3631. @item
  3632. Increase input audio power by 6 decibels using fixed-point precision:
  3633. @example
  3634. volume=volume=6dB:precision=fixed
  3635. @end example
  3636. @item
  3637. Fade volume after time 10 with an annihilation period of 5 seconds:
  3638. @example
  3639. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3640. @end example
  3641. @end itemize
  3642. @section volumedetect
  3643. Detect the volume of the input video.
  3644. The filter has no parameters. The input is not modified. Statistics about
  3645. the volume will be printed in the log when the input stream end is reached.
  3646. In particular it will show the mean volume (root mean square), maximum
  3647. volume (on a per-sample basis), and the beginning of a histogram of the
  3648. registered volume values (from the maximum value to a cumulated 1/1000 of
  3649. the samples).
  3650. All volumes are in decibels relative to the maximum PCM value.
  3651. @subsection Examples
  3652. Here is an excerpt of the output:
  3653. @example
  3654. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3655. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3656. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3657. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3658. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3659. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3660. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3661. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3662. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3663. @end example
  3664. It means that:
  3665. @itemize
  3666. @item
  3667. The mean square energy is approximately -27 dB, or 10^-2.7.
  3668. @item
  3669. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3670. @item
  3671. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3672. @end itemize
  3673. In other words, raising the volume by +4 dB does not cause any clipping,
  3674. raising it by +5 dB causes clipping for 6 samples, etc.
  3675. @c man end AUDIO FILTERS
  3676. @chapter Audio Sources
  3677. @c man begin AUDIO SOURCES
  3678. Below is a description of the currently available audio sources.
  3679. @section abuffer
  3680. Buffer audio frames, and make them available to the filter chain.
  3681. This source is mainly intended for a programmatic use, in particular
  3682. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3683. It accepts the following parameters:
  3684. @table @option
  3685. @item time_base
  3686. The timebase which will be used for timestamps of submitted frames. It must be
  3687. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3688. @item sample_rate
  3689. The sample rate of the incoming audio buffers.
  3690. @item sample_fmt
  3691. The sample format of the incoming audio buffers.
  3692. Either a sample format name or its corresponding integer representation from
  3693. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3694. @item channel_layout
  3695. The channel layout of the incoming audio buffers.
  3696. Either a channel layout name from channel_layout_map in
  3697. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3698. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3699. @item channels
  3700. The number of channels of the incoming audio buffers.
  3701. If both @var{channels} and @var{channel_layout} are specified, then they
  3702. must be consistent.
  3703. @end table
  3704. @subsection Examples
  3705. @example
  3706. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3707. @end example
  3708. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3709. Since the sample format with name "s16p" corresponds to the number
  3710. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3711. equivalent to:
  3712. @example
  3713. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3714. @end example
  3715. @section aevalsrc
  3716. Generate an audio signal specified by an expression.
  3717. This source accepts in input one or more expressions (one for each
  3718. channel), which are evaluated and used to generate a corresponding
  3719. audio signal.
  3720. This source accepts the following options:
  3721. @table @option
  3722. @item exprs
  3723. Set the '|'-separated expressions list for each separate channel. In case the
  3724. @option{channel_layout} option is not specified, the selected channel layout
  3725. depends on the number of provided expressions. Otherwise the last
  3726. specified expression is applied to the remaining output channels.
  3727. @item channel_layout, c
  3728. Set the channel layout. The number of channels in the specified layout
  3729. must be equal to the number of specified expressions.
  3730. @item duration, d
  3731. Set the minimum duration of the sourced audio. See
  3732. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3733. for the accepted syntax.
  3734. Note that the resulting duration may be greater than the specified
  3735. duration, as the generated audio is always cut at the end of a
  3736. complete frame.
  3737. If not specified, or the expressed duration is negative, the audio is
  3738. supposed to be generated forever.
  3739. @item nb_samples, n
  3740. Set the number of samples per channel per each output frame,
  3741. default to 1024.
  3742. @item sample_rate, s
  3743. Specify the sample rate, default to 44100.
  3744. @end table
  3745. Each expression in @var{exprs} can contain the following constants:
  3746. @table @option
  3747. @item n
  3748. number of the evaluated sample, starting from 0
  3749. @item t
  3750. time of the evaluated sample expressed in seconds, starting from 0
  3751. @item s
  3752. sample rate
  3753. @end table
  3754. @subsection Examples
  3755. @itemize
  3756. @item
  3757. Generate silence:
  3758. @example
  3759. aevalsrc=0
  3760. @end example
  3761. @item
  3762. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3763. 8000 Hz:
  3764. @example
  3765. aevalsrc="sin(440*2*PI*t):s=8000"
  3766. @end example
  3767. @item
  3768. Generate a two channels signal, specify the channel layout (Front
  3769. Center + Back Center) explicitly:
  3770. @example
  3771. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3772. @end example
  3773. @item
  3774. Generate white noise:
  3775. @example
  3776. aevalsrc="-2+random(0)"
  3777. @end example
  3778. @item
  3779. Generate an amplitude modulated signal:
  3780. @example
  3781. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3782. @end example
  3783. @item
  3784. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3785. @example
  3786. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3787. @end example
  3788. @end itemize
  3789. @section anullsrc
  3790. The null audio source, return unprocessed audio frames. It is mainly useful
  3791. as a template and to be employed in analysis / debugging tools, or as
  3792. the source for filters which ignore the input data (for example the sox
  3793. synth filter).
  3794. This source accepts the following options:
  3795. @table @option
  3796. @item channel_layout, cl
  3797. Specifies the channel layout, and can be either an integer or a string
  3798. representing a channel layout. The default value of @var{channel_layout}
  3799. is "stereo".
  3800. Check the channel_layout_map definition in
  3801. @file{libavutil/channel_layout.c} for the mapping between strings and
  3802. channel layout values.
  3803. @item sample_rate, r
  3804. Specifies the sample rate, and defaults to 44100.
  3805. @item nb_samples, n
  3806. Set the number of samples per requested frames.
  3807. @end table
  3808. @subsection Examples
  3809. @itemize
  3810. @item
  3811. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3812. @example
  3813. anullsrc=r=48000:cl=4
  3814. @end example
  3815. @item
  3816. Do the same operation with a more obvious syntax:
  3817. @example
  3818. anullsrc=r=48000:cl=mono
  3819. @end example
  3820. @end itemize
  3821. All the parameters need to be explicitly defined.
  3822. @section flite
  3823. Synthesize a voice utterance using the libflite library.
  3824. To enable compilation of this filter you need to configure FFmpeg with
  3825. @code{--enable-libflite}.
  3826. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3827. The filter accepts the following options:
  3828. @table @option
  3829. @item list_voices
  3830. If set to 1, list the names of the available voices and exit
  3831. immediately. Default value is 0.
  3832. @item nb_samples, n
  3833. Set the maximum number of samples per frame. Default value is 512.
  3834. @item textfile
  3835. Set the filename containing the text to speak.
  3836. @item text
  3837. Set the text to speak.
  3838. @item voice, v
  3839. Set the voice to use for the speech synthesis. Default value is
  3840. @code{kal}. See also the @var{list_voices} option.
  3841. @end table
  3842. @subsection Examples
  3843. @itemize
  3844. @item
  3845. Read from file @file{speech.txt}, and synthesize the text using the
  3846. standard flite voice:
  3847. @example
  3848. flite=textfile=speech.txt
  3849. @end example
  3850. @item
  3851. Read the specified text selecting the @code{slt} voice:
  3852. @example
  3853. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3854. @end example
  3855. @item
  3856. Input text to ffmpeg:
  3857. @example
  3858. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3859. @end example
  3860. @item
  3861. Make @file{ffplay} speak the specified text, using @code{flite} and
  3862. the @code{lavfi} device:
  3863. @example
  3864. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3865. @end example
  3866. @end itemize
  3867. For more information about libflite, check:
  3868. @url{http://www.festvox.org/flite/}
  3869. @section anoisesrc
  3870. Generate a noise audio signal.
  3871. The filter accepts the following options:
  3872. @table @option
  3873. @item sample_rate, r
  3874. Specify the sample rate. Default value is 48000 Hz.
  3875. @item amplitude, a
  3876. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3877. is 1.0.
  3878. @item duration, d
  3879. Specify the duration of the generated audio stream. Not specifying this option
  3880. results in noise with an infinite length.
  3881. @item color, colour, c
  3882. Specify the color of noise. Available noise colors are white, pink, brown,
  3883. blue and violet. Default color is white.
  3884. @item seed, s
  3885. Specify a value used to seed the PRNG.
  3886. @item nb_samples, n
  3887. Set the number of samples per each output frame, default is 1024.
  3888. @end table
  3889. @subsection Examples
  3890. @itemize
  3891. @item
  3892. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3893. @example
  3894. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3895. @end example
  3896. @end itemize
  3897. @section hilbert
  3898. Generate odd-tap Hilbert transform FIR coefficients.
  3899. The resulting stream can be used with @ref{afir} filter for phase-shifting
  3900. the signal by 90 degrees.
  3901. This is used in many matrix coding schemes and for analytic signal generation.
  3902. The process is often written as a multiplication by i (or j), the imaginary unit.
  3903. The filter accepts the following options:
  3904. @table @option
  3905. @item sample_rate, s
  3906. Set sample rate, default is 44100.
  3907. @item taps, t
  3908. Set length of FIR filter, default is 22051.
  3909. @item nb_samples, n
  3910. Set number of samples per each frame.
  3911. @item win_func, w
  3912. Set window function to be used when generating FIR coefficients.
  3913. @end table
  3914. @section sine
  3915. Generate an audio signal made of a sine wave with amplitude 1/8.
  3916. The audio signal is bit-exact.
  3917. The filter accepts the following options:
  3918. @table @option
  3919. @item frequency, f
  3920. Set the carrier frequency. Default is 440 Hz.
  3921. @item beep_factor, b
  3922. Enable a periodic beep every second with frequency @var{beep_factor} times
  3923. the carrier frequency. Default is 0, meaning the beep is disabled.
  3924. @item sample_rate, r
  3925. Specify the sample rate, default is 44100.
  3926. @item duration, d
  3927. Specify the duration of the generated audio stream.
  3928. @item samples_per_frame
  3929. Set the number of samples per output frame.
  3930. The expression can contain the following constants:
  3931. @table @option
  3932. @item n
  3933. The (sequential) number of the output audio frame, starting from 0.
  3934. @item pts
  3935. The PTS (Presentation TimeStamp) of the output audio frame,
  3936. expressed in @var{TB} units.
  3937. @item t
  3938. The PTS of the output audio frame, expressed in seconds.
  3939. @item TB
  3940. The timebase of the output audio frames.
  3941. @end table
  3942. Default is @code{1024}.
  3943. @end table
  3944. @subsection Examples
  3945. @itemize
  3946. @item
  3947. Generate a simple 440 Hz sine wave:
  3948. @example
  3949. sine
  3950. @end example
  3951. @item
  3952. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3953. @example
  3954. sine=220:4:d=5
  3955. sine=f=220:b=4:d=5
  3956. sine=frequency=220:beep_factor=4:duration=5
  3957. @end example
  3958. @item
  3959. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3960. pattern:
  3961. @example
  3962. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3963. @end example
  3964. @end itemize
  3965. @c man end AUDIO SOURCES
  3966. @chapter Audio Sinks
  3967. @c man begin AUDIO SINKS
  3968. Below is a description of the currently available audio sinks.
  3969. @section abuffersink
  3970. Buffer audio frames, and make them available to the end of filter chain.
  3971. This sink is mainly intended for programmatic use, in particular
  3972. through the interface defined in @file{libavfilter/buffersink.h}
  3973. or the options system.
  3974. It accepts a pointer to an AVABufferSinkContext structure, which
  3975. defines the incoming buffers' formats, to be passed as the opaque
  3976. parameter to @code{avfilter_init_filter} for initialization.
  3977. @section anullsink
  3978. Null audio sink; do absolutely nothing with the input audio. It is
  3979. mainly useful as a template and for use in analysis / debugging
  3980. tools.
  3981. @c man end AUDIO SINKS
  3982. @chapter Video Filters
  3983. @c man begin VIDEO FILTERS
  3984. When you configure your FFmpeg build, you can disable any of the
  3985. existing filters using @code{--disable-filters}.
  3986. The configure output will show the video filters included in your
  3987. build.
  3988. Below is a description of the currently available video filters.
  3989. @section alphaextract
  3990. Extract the alpha component from the input as a grayscale video. This
  3991. is especially useful with the @var{alphamerge} filter.
  3992. @section alphamerge
  3993. Add or replace the alpha component of the primary input with the
  3994. grayscale value of a second input. This is intended for use with
  3995. @var{alphaextract} to allow the transmission or storage of frame
  3996. sequences that have alpha in a format that doesn't support an alpha
  3997. channel.
  3998. For example, to reconstruct full frames from a normal YUV-encoded video
  3999. and a separate video created with @var{alphaextract}, you might use:
  4000. @example
  4001. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4002. @end example
  4003. Since this filter is designed for reconstruction, it operates on frame
  4004. sequences without considering timestamps, and terminates when either
  4005. input reaches end of stream. This will cause problems if your encoding
  4006. pipeline drops frames. If you're trying to apply an image as an
  4007. overlay to a video stream, consider the @var{overlay} filter instead.
  4008. @section ass
  4009. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4010. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4011. Substation Alpha) subtitles files.
  4012. This filter accepts the following option in addition to the common options from
  4013. the @ref{subtitles} filter:
  4014. @table @option
  4015. @item shaping
  4016. Set the shaping engine
  4017. Available values are:
  4018. @table @samp
  4019. @item auto
  4020. The default libass shaping engine, which is the best available.
  4021. @item simple
  4022. Fast, font-agnostic shaper that can do only substitutions
  4023. @item complex
  4024. Slower shaper using OpenType for substitutions and positioning
  4025. @end table
  4026. The default is @code{auto}.
  4027. @end table
  4028. @section atadenoise
  4029. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4030. The filter accepts the following options:
  4031. @table @option
  4032. @item 0a
  4033. Set threshold A for 1st plane. Default is 0.02.
  4034. Valid range is 0 to 0.3.
  4035. @item 0b
  4036. Set threshold B for 1st plane. Default is 0.04.
  4037. Valid range is 0 to 5.
  4038. @item 1a
  4039. Set threshold A for 2nd plane. Default is 0.02.
  4040. Valid range is 0 to 0.3.
  4041. @item 1b
  4042. Set threshold B for 2nd plane. Default is 0.04.
  4043. Valid range is 0 to 5.
  4044. @item 2a
  4045. Set threshold A for 3rd plane. Default is 0.02.
  4046. Valid range is 0 to 0.3.
  4047. @item 2b
  4048. Set threshold B for 3rd plane. Default is 0.04.
  4049. Valid range is 0 to 5.
  4050. Threshold A is designed to react on abrupt changes in the input signal and
  4051. threshold B is designed to react on continuous changes in the input signal.
  4052. @item s
  4053. Set number of frames filter will use for averaging. Default is 33. Must be odd
  4054. number in range [5, 129].
  4055. @item p
  4056. Set what planes of frame filter will use for averaging. Default is all.
  4057. @end table
  4058. @section avgblur
  4059. Apply average blur filter.
  4060. The filter accepts the following options:
  4061. @table @option
  4062. @item sizeX
  4063. Set horizontal kernel size.
  4064. @item planes
  4065. Set which planes to filter. By default all planes are filtered.
  4066. @item sizeY
  4067. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  4068. Default is @code{0}.
  4069. @end table
  4070. @section bbox
  4071. Compute the bounding box for the non-black pixels in the input frame
  4072. luminance plane.
  4073. This filter computes the bounding box containing all the pixels with a
  4074. luminance value greater than the minimum allowed value.
  4075. The parameters describing the bounding box are printed on the filter
  4076. log.
  4077. The filter accepts the following option:
  4078. @table @option
  4079. @item min_val
  4080. Set the minimal luminance value. Default is @code{16}.
  4081. @end table
  4082. @section bitplanenoise
  4083. Show and measure bit plane noise.
  4084. The filter accepts the following options:
  4085. @table @option
  4086. @item bitplane
  4087. Set which plane to analyze. Default is @code{1}.
  4088. @item filter
  4089. Filter out noisy pixels from @code{bitplane} set above.
  4090. Default is disabled.
  4091. @end table
  4092. @section blackdetect
  4093. Detect video intervals that are (almost) completely black. Can be
  4094. useful to detect chapter transitions, commercials, or invalid
  4095. recordings. Output lines contains the time for the start, end and
  4096. duration of the detected black interval expressed in seconds.
  4097. In order to display the output lines, you need to set the loglevel at
  4098. least to the AV_LOG_INFO value.
  4099. The filter accepts the following options:
  4100. @table @option
  4101. @item black_min_duration, d
  4102. Set the minimum detected black duration expressed in seconds. It must
  4103. be a non-negative floating point number.
  4104. Default value is 2.0.
  4105. @item picture_black_ratio_th, pic_th
  4106. Set the threshold for considering a picture "black".
  4107. Express the minimum value for the ratio:
  4108. @example
  4109. @var{nb_black_pixels} / @var{nb_pixels}
  4110. @end example
  4111. for which a picture is considered black.
  4112. Default value is 0.98.
  4113. @item pixel_black_th, pix_th
  4114. Set the threshold for considering a pixel "black".
  4115. The threshold expresses the maximum pixel luminance value for which a
  4116. pixel is considered "black". The provided value is scaled according to
  4117. the following equation:
  4118. @example
  4119. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4120. @end example
  4121. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4122. the input video format, the range is [0-255] for YUV full-range
  4123. formats and [16-235] for YUV non full-range formats.
  4124. Default value is 0.10.
  4125. @end table
  4126. The following example sets the maximum pixel threshold to the minimum
  4127. value, and detects only black intervals of 2 or more seconds:
  4128. @example
  4129. blackdetect=d=2:pix_th=0.00
  4130. @end example
  4131. @section blackframe
  4132. Detect frames that are (almost) completely black. Can be useful to
  4133. detect chapter transitions or commercials. Output lines consist of
  4134. the frame number of the detected frame, the percentage of blackness,
  4135. the position in the file if known or -1 and the timestamp in seconds.
  4136. In order to display the output lines, you need to set the loglevel at
  4137. least to the AV_LOG_INFO value.
  4138. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4139. The value represents the percentage of pixels in the picture that
  4140. are below the threshold value.
  4141. It accepts the following parameters:
  4142. @table @option
  4143. @item amount
  4144. The percentage of the pixels that have to be below the threshold; it defaults to
  4145. @code{98}.
  4146. @item threshold, thresh
  4147. The threshold below which a pixel value is considered black; it defaults to
  4148. @code{32}.
  4149. @end table
  4150. @section blend, tblend
  4151. Blend two video frames into each other.
  4152. The @code{blend} filter takes two input streams and outputs one
  4153. stream, the first input is the "top" layer and second input is
  4154. "bottom" layer. By default, the output terminates when the longest input terminates.
  4155. The @code{tblend} (time blend) filter takes two consecutive frames
  4156. from one single stream, and outputs the result obtained by blending
  4157. the new frame on top of the old frame.
  4158. A description of the accepted options follows.
  4159. @table @option
  4160. @item c0_mode
  4161. @item c1_mode
  4162. @item c2_mode
  4163. @item c3_mode
  4164. @item all_mode
  4165. Set blend mode for specific pixel component or all pixel components in case
  4166. of @var{all_mode}. Default value is @code{normal}.
  4167. Available values for component modes are:
  4168. @table @samp
  4169. @item addition
  4170. @item grainmerge
  4171. @item and
  4172. @item average
  4173. @item burn
  4174. @item darken
  4175. @item difference
  4176. @item grainextract
  4177. @item divide
  4178. @item dodge
  4179. @item freeze
  4180. @item exclusion
  4181. @item extremity
  4182. @item glow
  4183. @item hardlight
  4184. @item hardmix
  4185. @item heat
  4186. @item lighten
  4187. @item linearlight
  4188. @item multiply
  4189. @item multiply128
  4190. @item negation
  4191. @item normal
  4192. @item or
  4193. @item overlay
  4194. @item phoenix
  4195. @item pinlight
  4196. @item reflect
  4197. @item screen
  4198. @item softlight
  4199. @item subtract
  4200. @item vividlight
  4201. @item xor
  4202. @end table
  4203. @item c0_opacity
  4204. @item c1_opacity
  4205. @item c2_opacity
  4206. @item c3_opacity
  4207. @item all_opacity
  4208. Set blend opacity for specific pixel component or all pixel components in case
  4209. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4210. @item c0_expr
  4211. @item c1_expr
  4212. @item c2_expr
  4213. @item c3_expr
  4214. @item all_expr
  4215. Set blend expression for specific pixel component or all pixel components in case
  4216. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4217. The expressions can use the following variables:
  4218. @table @option
  4219. @item N
  4220. The sequential number of the filtered frame, starting from @code{0}.
  4221. @item X
  4222. @item Y
  4223. the coordinates of the current sample
  4224. @item W
  4225. @item H
  4226. the width and height of currently filtered plane
  4227. @item SW
  4228. @item SH
  4229. Width and height scale depending on the currently filtered plane. It is the
  4230. ratio between the corresponding luma plane number of pixels and the current
  4231. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4232. @code{0.5,0.5} for chroma planes.
  4233. @item T
  4234. Time of the current frame, expressed in seconds.
  4235. @item TOP, A
  4236. Value of pixel component at current location for first video frame (top layer).
  4237. @item BOTTOM, B
  4238. Value of pixel component at current location for second video frame (bottom layer).
  4239. @end table
  4240. @end table
  4241. The @code{blend} filter also supports the @ref{framesync} options.
  4242. @subsection Examples
  4243. @itemize
  4244. @item
  4245. Apply transition from bottom layer to top layer in first 10 seconds:
  4246. @example
  4247. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4248. @end example
  4249. @item
  4250. Apply linear horizontal transition from top layer to bottom layer:
  4251. @example
  4252. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4253. @end example
  4254. @item
  4255. Apply 1x1 checkerboard effect:
  4256. @example
  4257. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4258. @end example
  4259. @item
  4260. Apply uncover left effect:
  4261. @example
  4262. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4263. @end example
  4264. @item
  4265. Apply uncover down effect:
  4266. @example
  4267. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4268. @end example
  4269. @item
  4270. Apply uncover up-left effect:
  4271. @example
  4272. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4273. @end example
  4274. @item
  4275. Split diagonally video and shows top and bottom layer on each side:
  4276. @example
  4277. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4278. @end example
  4279. @item
  4280. Display differences between the current and the previous frame:
  4281. @example
  4282. tblend=all_mode=grainextract
  4283. @end example
  4284. @end itemize
  4285. @section boxblur
  4286. Apply a boxblur algorithm to the input video.
  4287. It accepts the following parameters:
  4288. @table @option
  4289. @item luma_radius, lr
  4290. @item luma_power, lp
  4291. @item chroma_radius, cr
  4292. @item chroma_power, cp
  4293. @item alpha_radius, ar
  4294. @item alpha_power, ap
  4295. @end table
  4296. A description of the accepted options follows.
  4297. @table @option
  4298. @item luma_radius, lr
  4299. @item chroma_radius, cr
  4300. @item alpha_radius, ar
  4301. Set an expression for the box radius in pixels used for blurring the
  4302. corresponding input plane.
  4303. The radius value must be a non-negative number, and must not be
  4304. greater than the value of the expression @code{min(w,h)/2} for the
  4305. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4306. planes.
  4307. Default value for @option{luma_radius} is "2". If not specified,
  4308. @option{chroma_radius} and @option{alpha_radius} default to the
  4309. corresponding value set for @option{luma_radius}.
  4310. The expressions can contain the following constants:
  4311. @table @option
  4312. @item w
  4313. @item h
  4314. The input width and height in pixels.
  4315. @item cw
  4316. @item ch
  4317. The input chroma image width and height in pixels.
  4318. @item hsub
  4319. @item vsub
  4320. The horizontal and vertical chroma subsample values. For example, for the
  4321. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4322. @end table
  4323. @item luma_power, lp
  4324. @item chroma_power, cp
  4325. @item alpha_power, ap
  4326. Specify how many times the boxblur filter is applied to the
  4327. corresponding plane.
  4328. Default value for @option{luma_power} is 2. If not specified,
  4329. @option{chroma_power} and @option{alpha_power} default to the
  4330. corresponding value set for @option{luma_power}.
  4331. A value of 0 will disable the effect.
  4332. @end table
  4333. @subsection Examples
  4334. @itemize
  4335. @item
  4336. Apply a boxblur filter with the luma, chroma, and alpha radii
  4337. set to 2:
  4338. @example
  4339. boxblur=luma_radius=2:luma_power=1
  4340. boxblur=2:1
  4341. @end example
  4342. @item
  4343. Set the luma radius to 2, and alpha and chroma radius to 0:
  4344. @example
  4345. boxblur=2:1:cr=0:ar=0
  4346. @end example
  4347. @item
  4348. Set the luma and chroma radii to a fraction of the video dimension:
  4349. @example
  4350. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4351. @end example
  4352. @end itemize
  4353. @section bwdif
  4354. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4355. Deinterlacing Filter").
  4356. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4357. interpolation algorithms.
  4358. It accepts the following parameters:
  4359. @table @option
  4360. @item mode
  4361. The interlacing mode to adopt. It accepts one of the following values:
  4362. @table @option
  4363. @item 0, send_frame
  4364. Output one frame for each frame.
  4365. @item 1, send_field
  4366. Output one frame for each field.
  4367. @end table
  4368. The default value is @code{send_field}.
  4369. @item parity
  4370. The picture field parity assumed for the input interlaced video. It accepts one
  4371. of the following values:
  4372. @table @option
  4373. @item 0, tff
  4374. Assume the top field is first.
  4375. @item 1, bff
  4376. Assume the bottom field is first.
  4377. @item -1, auto
  4378. Enable automatic detection of field parity.
  4379. @end table
  4380. The default value is @code{auto}.
  4381. If the interlacing is unknown or the decoder does not export this information,
  4382. top field first will be assumed.
  4383. @item deint
  4384. Specify which frames to deinterlace. Accept one of the following
  4385. values:
  4386. @table @option
  4387. @item 0, all
  4388. Deinterlace all frames.
  4389. @item 1, interlaced
  4390. Only deinterlace frames marked as interlaced.
  4391. @end table
  4392. The default value is @code{all}.
  4393. @end table
  4394. @section chromakey
  4395. YUV colorspace color/chroma keying.
  4396. The filter accepts the following options:
  4397. @table @option
  4398. @item color
  4399. The color which will be replaced with transparency.
  4400. @item similarity
  4401. Similarity percentage with the key color.
  4402. 0.01 matches only the exact key color, while 1.0 matches everything.
  4403. @item blend
  4404. Blend percentage.
  4405. 0.0 makes pixels either fully transparent, or not transparent at all.
  4406. Higher values result in semi-transparent pixels, with a higher transparency
  4407. the more similar the pixels color is to the key color.
  4408. @item yuv
  4409. Signals that the color passed is already in YUV instead of RGB.
  4410. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4411. This can be used to pass exact YUV values as hexadecimal numbers.
  4412. @end table
  4413. @subsection Examples
  4414. @itemize
  4415. @item
  4416. Make every green pixel in the input image transparent:
  4417. @example
  4418. ffmpeg -i input.png -vf chromakey=green out.png
  4419. @end example
  4420. @item
  4421. Overlay a greenscreen-video on top of a static black background.
  4422. @example
  4423. 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
  4424. @end example
  4425. @end itemize
  4426. @section ciescope
  4427. Display CIE color diagram with pixels overlaid onto it.
  4428. The filter accepts the following options:
  4429. @table @option
  4430. @item system
  4431. Set color system.
  4432. @table @samp
  4433. @item ntsc, 470m
  4434. @item ebu, 470bg
  4435. @item smpte
  4436. @item 240m
  4437. @item apple
  4438. @item widergb
  4439. @item cie1931
  4440. @item rec709, hdtv
  4441. @item uhdtv, rec2020
  4442. @end table
  4443. @item cie
  4444. Set CIE system.
  4445. @table @samp
  4446. @item xyy
  4447. @item ucs
  4448. @item luv
  4449. @end table
  4450. @item gamuts
  4451. Set what gamuts to draw.
  4452. See @code{system} option for available values.
  4453. @item size, s
  4454. Set ciescope size, by default set to 512.
  4455. @item intensity, i
  4456. Set intensity used to map input pixel values to CIE diagram.
  4457. @item contrast
  4458. Set contrast used to draw tongue colors that are out of active color system gamut.
  4459. @item corrgamma
  4460. Correct gamma displayed on scope, by default enabled.
  4461. @item showwhite
  4462. Show white point on CIE diagram, by default disabled.
  4463. @item gamma
  4464. Set input gamma. Used only with XYZ input color space.
  4465. @end table
  4466. @section codecview
  4467. Visualize information exported by some codecs.
  4468. Some codecs can export information through frames using side-data or other
  4469. means. For example, some MPEG based codecs export motion vectors through the
  4470. @var{export_mvs} flag in the codec @option{flags2} option.
  4471. The filter accepts the following option:
  4472. @table @option
  4473. @item mv
  4474. Set motion vectors to visualize.
  4475. Available flags for @var{mv} are:
  4476. @table @samp
  4477. @item pf
  4478. forward predicted MVs of P-frames
  4479. @item bf
  4480. forward predicted MVs of B-frames
  4481. @item bb
  4482. backward predicted MVs of B-frames
  4483. @end table
  4484. @item qp
  4485. Display quantization parameters using the chroma planes.
  4486. @item mv_type, mvt
  4487. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4488. Available flags for @var{mv_type} are:
  4489. @table @samp
  4490. @item fp
  4491. forward predicted MVs
  4492. @item bp
  4493. backward predicted MVs
  4494. @end table
  4495. @item frame_type, ft
  4496. Set frame type to visualize motion vectors of.
  4497. Available flags for @var{frame_type} are:
  4498. @table @samp
  4499. @item if
  4500. intra-coded frames (I-frames)
  4501. @item pf
  4502. predicted frames (P-frames)
  4503. @item bf
  4504. bi-directionally predicted frames (B-frames)
  4505. @end table
  4506. @end table
  4507. @subsection Examples
  4508. @itemize
  4509. @item
  4510. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4511. @example
  4512. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4513. @end example
  4514. @item
  4515. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4516. @example
  4517. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4518. @end example
  4519. @end itemize
  4520. @section colorbalance
  4521. Modify intensity of primary colors (red, green and blue) of input frames.
  4522. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4523. regions for the red-cyan, green-magenta or blue-yellow balance.
  4524. A positive adjustment value shifts the balance towards the primary color, a negative
  4525. value towards the complementary color.
  4526. The filter accepts the following options:
  4527. @table @option
  4528. @item rs
  4529. @item gs
  4530. @item bs
  4531. Adjust red, green and blue shadows (darkest pixels).
  4532. @item rm
  4533. @item gm
  4534. @item bm
  4535. Adjust red, green and blue midtones (medium pixels).
  4536. @item rh
  4537. @item gh
  4538. @item bh
  4539. Adjust red, green and blue highlights (brightest pixels).
  4540. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4541. @end table
  4542. @subsection Examples
  4543. @itemize
  4544. @item
  4545. Add red color cast to shadows:
  4546. @example
  4547. colorbalance=rs=.3
  4548. @end example
  4549. @end itemize
  4550. @section colorkey
  4551. RGB colorspace color keying.
  4552. The filter accepts the following options:
  4553. @table @option
  4554. @item color
  4555. The color which will be replaced with transparency.
  4556. @item similarity
  4557. Similarity percentage with the key color.
  4558. 0.01 matches only the exact key color, while 1.0 matches everything.
  4559. @item blend
  4560. Blend percentage.
  4561. 0.0 makes pixels either fully transparent, or not transparent at all.
  4562. Higher values result in semi-transparent pixels, with a higher transparency
  4563. the more similar the pixels color is to the key color.
  4564. @end table
  4565. @subsection Examples
  4566. @itemize
  4567. @item
  4568. Make every green pixel in the input image transparent:
  4569. @example
  4570. ffmpeg -i input.png -vf colorkey=green out.png
  4571. @end example
  4572. @item
  4573. Overlay a greenscreen-video on top of a static background image.
  4574. @example
  4575. 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
  4576. @end example
  4577. @end itemize
  4578. @section colorlevels
  4579. Adjust video input frames using levels.
  4580. The filter accepts the following options:
  4581. @table @option
  4582. @item rimin
  4583. @item gimin
  4584. @item bimin
  4585. @item aimin
  4586. Adjust red, green, blue and alpha input black point.
  4587. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4588. @item rimax
  4589. @item gimax
  4590. @item bimax
  4591. @item aimax
  4592. Adjust red, green, blue and alpha input white point.
  4593. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4594. Input levels are used to lighten highlights (bright tones), darken shadows
  4595. (dark tones), change the balance of bright and dark tones.
  4596. @item romin
  4597. @item gomin
  4598. @item bomin
  4599. @item aomin
  4600. Adjust red, green, blue and alpha output black point.
  4601. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4602. @item romax
  4603. @item gomax
  4604. @item bomax
  4605. @item aomax
  4606. Adjust red, green, blue and alpha output white point.
  4607. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4608. Output levels allows manual selection of a constrained output level range.
  4609. @end table
  4610. @subsection Examples
  4611. @itemize
  4612. @item
  4613. Make video output darker:
  4614. @example
  4615. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4616. @end example
  4617. @item
  4618. Increase contrast:
  4619. @example
  4620. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4621. @end example
  4622. @item
  4623. Make video output lighter:
  4624. @example
  4625. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4626. @end example
  4627. @item
  4628. Increase brightness:
  4629. @example
  4630. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4631. @end example
  4632. @end itemize
  4633. @section colorchannelmixer
  4634. Adjust video input frames by re-mixing color channels.
  4635. This filter modifies a color channel by adding the values associated to
  4636. the other channels of the same pixels. For example if the value to
  4637. modify is red, the output value will be:
  4638. @example
  4639. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4640. @end example
  4641. The filter accepts the following options:
  4642. @table @option
  4643. @item rr
  4644. @item rg
  4645. @item rb
  4646. @item ra
  4647. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4648. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4649. @item gr
  4650. @item gg
  4651. @item gb
  4652. @item ga
  4653. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4654. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4655. @item br
  4656. @item bg
  4657. @item bb
  4658. @item ba
  4659. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4660. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4661. @item ar
  4662. @item ag
  4663. @item ab
  4664. @item aa
  4665. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4666. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4667. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4668. @end table
  4669. @subsection Examples
  4670. @itemize
  4671. @item
  4672. Convert source to grayscale:
  4673. @example
  4674. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4675. @end example
  4676. @item
  4677. Simulate sepia tones:
  4678. @example
  4679. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4680. @end example
  4681. @end itemize
  4682. @section colormatrix
  4683. Convert color matrix.
  4684. The filter accepts the following options:
  4685. @table @option
  4686. @item src
  4687. @item dst
  4688. Specify the source and destination color matrix. Both values must be
  4689. specified.
  4690. The accepted values are:
  4691. @table @samp
  4692. @item bt709
  4693. BT.709
  4694. @item fcc
  4695. FCC
  4696. @item bt601
  4697. BT.601
  4698. @item bt470
  4699. BT.470
  4700. @item bt470bg
  4701. BT.470BG
  4702. @item smpte170m
  4703. SMPTE-170M
  4704. @item smpte240m
  4705. SMPTE-240M
  4706. @item bt2020
  4707. BT.2020
  4708. @end table
  4709. @end table
  4710. For example to convert from BT.601 to SMPTE-240M, use the command:
  4711. @example
  4712. colormatrix=bt601:smpte240m
  4713. @end example
  4714. @section colorspace
  4715. Convert colorspace, transfer characteristics or color primaries.
  4716. Input video needs to have an even size.
  4717. The filter accepts the following options:
  4718. @table @option
  4719. @anchor{all}
  4720. @item all
  4721. Specify all color properties at once.
  4722. The accepted values are:
  4723. @table @samp
  4724. @item bt470m
  4725. BT.470M
  4726. @item bt470bg
  4727. BT.470BG
  4728. @item bt601-6-525
  4729. BT.601-6 525
  4730. @item bt601-6-625
  4731. BT.601-6 625
  4732. @item bt709
  4733. BT.709
  4734. @item smpte170m
  4735. SMPTE-170M
  4736. @item smpte240m
  4737. SMPTE-240M
  4738. @item bt2020
  4739. BT.2020
  4740. @end table
  4741. @anchor{space}
  4742. @item space
  4743. Specify output colorspace.
  4744. The accepted values are:
  4745. @table @samp
  4746. @item bt709
  4747. BT.709
  4748. @item fcc
  4749. FCC
  4750. @item bt470bg
  4751. BT.470BG or BT.601-6 625
  4752. @item smpte170m
  4753. SMPTE-170M or BT.601-6 525
  4754. @item smpte240m
  4755. SMPTE-240M
  4756. @item ycgco
  4757. YCgCo
  4758. @item bt2020ncl
  4759. BT.2020 with non-constant luminance
  4760. @end table
  4761. @anchor{trc}
  4762. @item trc
  4763. Specify output transfer characteristics.
  4764. The accepted values are:
  4765. @table @samp
  4766. @item bt709
  4767. BT.709
  4768. @item bt470m
  4769. BT.470M
  4770. @item bt470bg
  4771. BT.470BG
  4772. @item gamma22
  4773. Constant gamma of 2.2
  4774. @item gamma28
  4775. Constant gamma of 2.8
  4776. @item smpte170m
  4777. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4778. @item smpte240m
  4779. SMPTE-240M
  4780. @item srgb
  4781. SRGB
  4782. @item iec61966-2-1
  4783. iec61966-2-1
  4784. @item iec61966-2-4
  4785. iec61966-2-4
  4786. @item xvycc
  4787. xvycc
  4788. @item bt2020-10
  4789. BT.2020 for 10-bits content
  4790. @item bt2020-12
  4791. BT.2020 for 12-bits content
  4792. @end table
  4793. @anchor{primaries}
  4794. @item primaries
  4795. Specify output color primaries.
  4796. The accepted values are:
  4797. @table @samp
  4798. @item bt709
  4799. BT.709
  4800. @item bt470m
  4801. BT.470M
  4802. @item bt470bg
  4803. BT.470BG or BT.601-6 625
  4804. @item smpte170m
  4805. SMPTE-170M or BT.601-6 525
  4806. @item smpte240m
  4807. SMPTE-240M
  4808. @item film
  4809. film
  4810. @item smpte431
  4811. SMPTE-431
  4812. @item smpte432
  4813. SMPTE-432
  4814. @item bt2020
  4815. BT.2020
  4816. @item jedec-p22
  4817. JEDEC P22 phosphors
  4818. @end table
  4819. @anchor{range}
  4820. @item range
  4821. Specify output color range.
  4822. The accepted values are:
  4823. @table @samp
  4824. @item tv
  4825. TV (restricted) range
  4826. @item mpeg
  4827. MPEG (restricted) range
  4828. @item pc
  4829. PC (full) range
  4830. @item jpeg
  4831. JPEG (full) range
  4832. @end table
  4833. @item format
  4834. Specify output color format.
  4835. The accepted values are:
  4836. @table @samp
  4837. @item yuv420p
  4838. YUV 4:2:0 planar 8-bits
  4839. @item yuv420p10
  4840. YUV 4:2:0 planar 10-bits
  4841. @item yuv420p12
  4842. YUV 4:2:0 planar 12-bits
  4843. @item yuv422p
  4844. YUV 4:2:2 planar 8-bits
  4845. @item yuv422p10
  4846. YUV 4:2:2 planar 10-bits
  4847. @item yuv422p12
  4848. YUV 4:2:2 planar 12-bits
  4849. @item yuv444p
  4850. YUV 4:4:4 planar 8-bits
  4851. @item yuv444p10
  4852. YUV 4:4:4 planar 10-bits
  4853. @item yuv444p12
  4854. YUV 4:4:4 planar 12-bits
  4855. @end table
  4856. @item fast
  4857. Do a fast conversion, which skips gamma/primary correction. This will take
  4858. significantly less CPU, but will be mathematically incorrect. To get output
  4859. compatible with that produced by the colormatrix filter, use fast=1.
  4860. @item dither
  4861. Specify dithering mode.
  4862. The accepted values are:
  4863. @table @samp
  4864. @item none
  4865. No dithering
  4866. @item fsb
  4867. Floyd-Steinberg dithering
  4868. @end table
  4869. @item wpadapt
  4870. Whitepoint adaptation mode.
  4871. The accepted values are:
  4872. @table @samp
  4873. @item bradford
  4874. Bradford whitepoint adaptation
  4875. @item vonkries
  4876. von Kries whitepoint adaptation
  4877. @item identity
  4878. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4879. @end table
  4880. @item iall
  4881. Override all input properties at once. Same accepted values as @ref{all}.
  4882. @item ispace
  4883. Override input colorspace. Same accepted values as @ref{space}.
  4884. @item iprimaries
  4885. Override input color primaries. Same accepted values as @ref{primaries}.
  4886. @item itrc
  4887. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4888. @item irange
  4889. Override input color range. Same accepted values as @ref{range}.
  4890. @end table
  4891. The filter converts the transfer characteristics, color space and color
  4892. primaries to the specified user values. The output value, if not specified,
  4893. is set to a default value based on the "all" property. If that property is
  4894. also not specified, the filter will log an error. The output color range and
  4895. format default to the same value as the input color range and format. The
  4896. input transfer characteristics, color space, color primaries and color range
  4897. should be set on the input data. If any of these are missing, the filter will
  4898. log an error and no conversion will take place.
  4899. For example to convert the input to SMPTE-240M, use the command:
  4900. @example
  4901. colorspace=smpte240m
  4902. @end example
  4903. @section convolution
  4904. Apply convolution 3x3, 5x5 or 7x7 filter.
  4905. The filter accepts the following options:
  4906. @table @option
  4907. @item 0m
  4908. @item 1m
  4909. @item 2m
  4910. @item 3m
  4911. Set matrix for each plane.
  4912. Matrix is sequence of 9, 25 or 49 signed integers.
  4913. @item 0rdiv
  4914. @item 1rdiv
  4915. @item 2rdiv
  4916. @item 3rdiv
  4917. Set multiplier for calculated value for each plane.
  4918. @item 0bias
  4919. @item 1bias
  4920. @item 2bias
  4921. @item 3bias
  4922. Set bias for each plane. This value is added to the result of the multiplication.
  4923. Useful for making the overall image brighter or darker. Default is 0.0.
  4924. @end table
  4925. @subsection Examples
  4926. @itemize
  4927. @item
  4928. Apply sharpen:
  4929. @example
  4930. 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"
  4931. @end example
  4932. @item
  4933. Apply blur:
  4934. @example
  4935. 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"
  4936. @end example
  4937. @item
  4938. Apply edge enhance:
  4939. @example
  4940. 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"
  4941. @end example
  4942. @item
  4943. Apply edge detect:
  4944. @example
  4945. 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"
  4946. @end example
  4947. @item
  4948. Apply laplacian edge detector which includes diagonals:
  4949. @example
  4950. 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"
  4951. @end example
  4952. @item
  4953. Apply emboss:
  4954. @example
  4955. 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"
  4956. @end example
  4957. @end itemize
  4958. @section convolve
  4959. Apply 2D convolution of video stream in frequency domain using second stream
  4960. as impulse.
  4961. The filter accepts the following options:
  4962. @table @option
  4963. @item planes
  4964. Set which planes to process.
  4965. @item impulse
  4966. Set which impulse video frames will be processed, can be @var{first}
  4967. or @var{all}. Default is @var{all}.
  4968. @end table
  4969. The @code{convolve} filter also supports the @ref{framesync} options.
  4970. @section copy
  4971. Copy the input video source unchanged to the output. This is mainly useful for
  4972. testing purposes.
  4973. @anchor{coreimage}
  4974. @section coreimage
  4975. Video filtering on GPU using Apple's CoreImage API on OSX.
  4976. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4977. processed by video hardware. However, software-based OpenGL implementations
  4978. exist which means there is no guarantee for hardware processing. It depends on
  4979. the respective OSX.
  4980. There are many filters and image generators provided by Apple that come with a
  4981. large variety of options. The filter has to be referenced by its name along
  4982. with its options.
  4983. The coreimage filter accepts the following options:
  4984. @table @option
  4985. @item list_filters
  4986. List all available filters and generators along with all their respective
  4987. options as well as possible minimum and maximum values along with the default
  4988. values.
  4989. @example
  4990. list_filters=true
  4991. @end example
  4992. @item filter
  4993. Specify all filters by their respective name and options.
  4994. Use @var{list_filters} to determine all valid filter names and options.
  4995. Numerical options are specified by a float value and are automatically clamped
  4996. to their respective value range. Vector and color options have to be specified
  4997. by a list of space separated float values. Character escaping has to be done.
  4998. A special option name @code{default} is available to use default options for a
  4999. filter.
  5000. It is required to specify either @code{default} or at least one of the filter options.
  5001. All omitted options are used with their default values.
  5002. The syntax of the filter string is as follows:
  5003. @example
  5004. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5005. @end example
  5006. @item output_rect
  5007. Specify a rectangle where the output of the filter chain is copied into the
  5008. input image. It is given by a list of space separated float values:
  5009. @example
  5010. output_rect=x\ y\ width\ height
  5011. @end example
  5012. If not given, the output rectangle equals the dimensions of the input image.
  5013. The output rectangle is automatically cropped at the borders of the input
  5014. image. Negative values are valid for each component.
  5015. @example
  5016. output_rect=25\ 25\ 100\ 100
  5017. @end example
  5018. @end table
  5019. Several filters can be chained for successive processing without GPU-HOST
  5020. transfers allowing for fast processing of complex filter chains.
  5021. Currently, only filters with zero (generators) or exactly one (filters) input
  5022. image and one output image are supported. Also, transition filters are not yet
  5023. usable as intended.
  5024. Some filters generate output images with additional padding depending on the
  5025. respective filter kernel. The padding is automatically removed to ensure the
  5026. filter output has the same size as the input image.
  5027. For image generators, the size of the output image is determined by the
  5028. previous output image of the filter chain or the input image of the whole
  5029. filterchain, respectively. The generators do not use the pixel information of
  5030. this image to generate their output. However, the generated output is
  5031. blended onto this image, resulting in partial or complete coverage of the
  5032. output image.
  5033. The @ref{coreimagesrc} video source can be used for generating input images
  5034. which are directly fed into the filter chain. By using it, providing input
  5035. images by another video source or an input video is not required.
  5036. @subsection Examples
  5037. @itemize
  5038. @item
  5039. List all filters available:
  5040. @example
  5041. coreimage=list_filters=true
  5042. @end example
  5043. @item
  5044. Use the CIBoxBlur filter with default options to blur an image:
  5045. @example
  5046. coreimage=filter=CIBoxBlur@@default
  5047. @end example
  5048. @item
  5049. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5050. its center at 100x100 and a radius of 50 pixels:
  5051. @example
  5052. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5053. @end example
  5054. @item
  5055. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5056. given as complete and escaped command-line for Apple's standard bash shell:
  5057. @example
  5058. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5059. @end example
  5060. @end itemize
  5061. @section crop
  5062. Crop the input video to given dimensions.
  5063. It accepts the following parameters:
  5064. @table @option
  5065. @item w, out_w
  5066. The width of the output video. It defaults to @code{iw}.
  5067. This expression is evaluated only once during the filter
  5068. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5069. @item h, out_h
  5070. The height of the output video. It defaults to @code{ih}.
  5071. This expression is evaluated only once during the filter
  5072. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5073. @item x
  5074. The horizontal position, in the input video, of the left edge of the output
  5075. video. It defaults to @code{(in_w-out_w)/2}.
  5076. This expression is evaluated per-frame.
  5077. @item y
  5078. The vertical position, in the input video, of the top edge of the output video.
  5079. It defaults to @code{(in_h-out_h)/2}.
  5080. This expression is evaluated per-frame.
  5081. @item keep_aspect
  5082. If set to 1 will force the output display aspect ratio
  5083. to be the same of the input, by changing the output sample aspect
  5084. ratio. It defaults to 0.
  5085. @item exact
  5086. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5087. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5088. It defaults to 0.
  5089. @end table
  5090. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5091. expressions containing the following constants:
  5092. @table @option
  5093. @item x
  5094. @item y
  5095. The computed values for @var{x} and @var{y}. They are evaluated for
  5096. each new frame.
  5097. @item in_w
  5098. @item in_h
  5099. The input width and height.
  5100. @item iw
  5101. @item ih
  5102. These are the same as @var{in_w} and @var{in_h}.
  5103. @item out_w
  5104. @item out_h
  5105. The output (cropped) width and height.
  5106. @item ow
  5107. @item oh
  5108. These are the same as @var{out_w} and @var{out_h}.
  5109. @item a
  5110. same as @var{iw} / @var{ih}
  5111. @item sar
  5112. input sample aspect ratio
  5113. @item dar
  5114. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5115. @item hsub
  5116. @item vsub
  5117. horizontal and vertical chroma subsample values. For example for the
  5118. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5119. @item n
  5120. The number of the input frame, starting from 0.
  5121. @item pos
  5122. the position in the file of the input frame, NAN if unknown
  5123. @item t
  5124. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5125. @end table
  5126. The expression for @var{out_w} may depend on the value of @var{out_h},
  5127. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5128. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5129. evaluated after @var{out_w} and @var{out_h}.
  5130. The @var{x} and @var{y} parameters specify the expressions for the
  5131. position of the top-left corner of the output (non-cropped) area. They
  5132. are evaluated for each frame. If the evaluated value is not valid, it
  5133. is approximated to the nearest valid value.
  5134. The expression for @var{x} may depend on @var{y}, and the expression
  5135. for @var{y} may depend on @var{x}.
  5136. @subsection Examples
  5137. @itemize
  5138. @item
  5139. Crop area with size 100x100 at position (12,34).
  5140. @example
  5141. crop=100:100:12:34
  5142. @end example
  5143. Using named options, the example above becomes:
  5144. @example
  5145. crop=w=100:h=100:x=12:y=34
  5146. @end example
  5147. @item
  5148. Crop the central input area with size 100x100:
  5149. @example
  5150. crop=100:100
  5151. @end example
  5152. @item
  5153. Crop the central input area with size 2/3 of the input video:
  5154. @example
  5155. crop=2/3*in_w:2/3*in_h
  5156. @end example
  5157. @item
  5158. Crop the input video central square:
  5159. @example
  5160. crop=out_w=in_h
  5161. crop=in_h
  5162. @end example
  5163. @item
  5164. Delimit the rectangle with the top-left corner placed at position
  5165. 100:100 and the right-bottom corner corresponding to the right-bottom
  5166. corner of the input image.
  5167. @example
  5168. crop=in_w-100:in_h-100:100:100
  5169. @end example
  5170. @item
  5171. Crop 10 pixels from the left and right borders, and 20 pixels from
  5172. the top and bottom borders
  5173. @example
  5174. crop=in_w-2*10:in_h-2*20
  5175. @end example
  5176. @item
  5177. Keep only the bottom right quarter of the input image:
  5178. @example
  5179. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5180. @end example
  5181. @item
  5182. Crop height for getting Greek harmony:
  5183. @example
  5184. crop=in_w:1/PHI*in_w
  5185. @end example
  5186. @item
  5187. Apply trembling effect:
  5188. @example
  5189. 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)
  5190. @end example
  5191. @item
  5192. Apply erratic camera effect depending on timestamp:
  5193. @example
  5194. 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)"
  5195. @end example
  5196. @item
  5197. Set x depending on the value of y:
  5198. @example
  5199. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5200. @end example
  5201. @end itemize
  5202. @subsection Commands
  5203. This filter supports the following commands:
  5204. @table @option
  5205. @item w, out_w
  5206. @item h, out_h
  5207. @item x
  5208. @item y
  5209. Set width/height of the output video and the horizontal/vertical position
  5210. in the input video.
  5211. The command accepts the same syntax of the corresponding option.
  5212. If the specified expression is not valid, it is kept at its current
  5213. value.
  5214. @end table
  5215. @section cropdetect
  5216. Auto-detect the crop size.
  5217. It calculates the necessary cropping parameters and prints the
  5218. recommended parameters via the logging system. The detected dimensions
  5219. correspond to the non-black area of the input video.
  5220. It accepts the following parameters:
  5221. @table @option
  5222. @item limit
  5223. Set higher black value threshold, which can be optionally specified
  5224. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5225. value greater to the set value is considered non-black. It defaults to 24.
  5226. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5227. on the bitdepth of the pixel format.
  5228. @item round
  5229. The value which the width/height should be divisible by. It defaults to
  5230. 16. The offset is automatically adjusted to center the video. Use 2 to
  5231. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5232. encoding to most video codecs.
  5233. @item reset_count, reset
  5234. Set the counter that determines after how many frames cropdetect will
  5235. reset the previously detected largest video area and start over to
  5236. detect the current optimal crop area. Default value is 0.
  5237. This can be useful when channel logos distort the video area. 0
  5238. indicates 'never reset', and returns the largest area encountered during
  5239. playback.
  5240. @end table
  5241. @anchor{curves}
  5242. @section curves
  5243. Apply color adjustments using curves.
  5244. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5245. component (red, green and blue) has its values defined by @var{N} key points
  5246. tied from each other using a smooth curve. The x-axis represents the pixel
  5247. values from the input frame, and the y-axis the new pixel values to be set for
  5248. the output frame.
  5249. By default, a component curve is defined by the two points @var{(0;0)} and
  5250. @var{(1;1)}. This creates a straight line where each original pixel value is
  5251. "adjusted" to its own value, which means no change to the image.
  5252. The filter allows you to redefine these two points and add some more. A new
  5253. curve (using a natural cubic spline interpolation) will be define to pass
  5254. smoothly through all these new coordinates. The new defined points needs to be
  5255. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5256. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5257. the vector spaces, the values will be clipped accordingly.
  5258. The filter accepts the following options:
  5259. @table @option
  5260. @item preset
  5261. Select one of the available color presets. This option can be used in addition
  5262. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5263. options takes priority on the preset values.
  5264. Available presets are:
  5265. @table @samp
  5266. @item none
  5267. @item color_negative
  5268. @item cross_process
  5269. @item darker
  5270. @item increase_contrast
  5271. @item lighter
  5272. @item linear_contrast
  5273. @item medium_contrast
  5274. @item negative
  5275. @item strong_contrast
  5276. @item vintage
  5277. @end table
  5278. Default is @code{none}.
  5279. @item master, m
  5280. Set the master key points. These points will define a second pass mapping. It
  5281. is sometimes called a "luminance" or "value" mapping. It can be used with
  5282. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5283. post-processing LUT.
  5284. @item red, r
  5285. Set the key points for the red component.
  5286. @item green, g
  5287. Set the key points for the green component.
  5288. @item blue, b
  5289. Set the key points for the blue component.
  5290. @item all
  5291. Set the key points for all components (not including master).
  5292. Can be used in addition to the other key points component
  5293. options. In this case, the unset component(s) will fallback on this
  5294. @option{all} setting.
  5295. @item psfile
  5296. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5297. @item plot
  5298. Save Gnuplot script of the curves in specified file.
  5299. @end table
  5300. To avoid some filtergraph syntax conflicts, each key points list need to be
  5301. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5302. @subsection Examples
  5303. @itemize
  5304. @item
  5305. Increase slightly the middle level of blue:
  5306. @example
  5307. curves=blue='0/0 0.5/0.58 1/1'
  5308. @end example
  5309. @item
  5310. Vintage effect:
  5311. @example
  5312. 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'
  5313. @end example
  5314. Here we obtain the following coordinates for each components:
  5315. @table @var
  5316. @item red
  5317. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5318. @item green
  5319. @code{(0;0) (0.50;0.48) (1;1)}
  5320. @item blue
  5321. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5322. @end table
  5323. @item
  5324. The previous example can also be achieved with the associated built-in preset:
  5325. @example
  5326. curves=preset=vintage
  5327. @end example
  5328. @item
  5329. Or simply:
  5330. @example
  5331. curves=vintage
  5332. @end example
  5333. @item
  5334. Use a Photoshop preset and redefine the points of the green component:
  5335. @example
  5336. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5337. @end example
  5338. @item
  5339. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5340. and @command{gnuplot}:
  5341. @example
  5342. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5343. gnuplot -p /tmp/curves.plt
  5344. @end example
  5345. @end itemize
  5346. @section datascope
  5347. Video data analysis filter.
  5348. This filter shows hexadecimal pixel values of part of video.
  5349. The filter accepts the following options:
  5350. @table @option
  5351. @item size, s
  5352. Set output video size.
  5353. @item x
  5354. Set x offset from where to pick pixels.
  5355. @item y
  5356. Set y offset from where to pick pixels.
  5357. @item mode
  5358. Set scope mode, can be one of the following:
  5359. @table @samp
  5360. @item mono
  5361. Draw hexadecimal pixel values with white color on black background.
  5362. @item color
  5363. Draw hexadecimal pixel values with input video pixel color on black
  5364. background.
  5365. @item color2
  5366. Draw hexadecimal pixel values on color background picked from input video,
  5367. the text color is picked in such way so its always visible.
  5368. @end table
  5369. @item axis
  5370. Draw rows and columns numbers on left and top of video.
  5371. @item opacity
  5372. Set background opacity.
  5373. @end table
  5374. @section dctdnoiz
  5375. Denoise frames using 2D DCT (frequency domain filtering).
  5376. This filter is not designed for real time.
  5377. The filter accepts the following options:
  5378. @table @option
  5379. @item sigma, s
  5380. Set the noise sigma constant.
  5381. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5382. coefficient (absolute value) below this threshold with be dropped.
  5383. If you need a more advanced filtering, see @option{expr}.
  5384. Default is @code{0}.
  5385. @item overlap
  5386. Set number overlapping pixels for each block. Since the filter can be slow, you
  5387. may want to reduce this value, at the cost of a less effective filter and the
  5388. risk of various artefacts.
  5389. If the overlapping value doesn't permit processing the whole input width or
  5390. height, a warning will be displayed and according borders won't be denoised.
  5391. Default value is @var{blocksize}-1, which is the best possible setting.
  5392. @item expr, e
  5393. Set the coefficient factor expression.
  5394. For each coefficient of a DCT block, this expression will be evaluated as a
  5395. multiplier value for the coefficient.
  5396. If this is option is set, the @option{sigma} option will be ignored.
  5397. The absolute value of the coefficient can be accessed through the @var{c}
  5398. variable.
  5399. @item n
  5400. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5401. @var{blocksize}, which is the width and height of the processed blocks.
  5402. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5403. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5404. on the speed processing. Also, a larger block size does not necessarily means a
  5405. better de-noising.
  5406. @end table
  5407. @subsection Examples
  5408. Apply a denoise with a @option{sigma} of @code{4.5}:
  5409. @example
  5410. dctdnoiz=4.5
  5411. @end example
  5412. The same operation can be achieved using the expression system:
  5413. @example
  5414. dctdnoiz=e='gte(c, 4.5*3)'
  5415. @end example
  5416. Violent denoise using a block size of @code{16x16}:
  5417. @example
  5418. dctdnoiz=15:n=4
  5419. @end example
  5420. @section deband
  5421. Remove banding artifacts from input video.
  5422. It works by replacing banded pixels with average value of referenced pixels.
  5423. The filter accepts the following options:
  5424. @table @option
  5425. @item 1thr
  5426. @item 2thr
  5427. @item 3thr
  5428. @item 4thr
  5429. Set banding detection threshold for each plane. Default is 0.02.
  5430. Valid range is 0.00003 to 0.5.
  5431. If difference between current pixel and reference pixel is less than threshold,
  5432. it will be considered as banded.
  5433. @item range, r
  5434. Banding detection range in pixels. Default is 16. If positive, random number
  5435. in range 0 to set value will be used. If negative, exact absolute value
  5436. will be used.
  5437. The range defines square of four pixels around current pixel.
  5438. @item direction, d
  5439. Set direction in radians from which four pixel will be compared. If positive,
  5440. random direction from 0 to set direction will be picked. If negative, exact of
  5441. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5442. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5443. column.
  5444. @item blur, b
  5445. If enabled, current pixel is compared with average value of all four
  5446. surrounding pixels. The default is enabled. If disabled current pixel is
  5447. compared with all four surrounding pixels. The pixel is considered banded
  5448. if only all four differences with surrounding pixels are less than threshold.
  5449. @item coupling, c
  5450. If enabled, current pixel is changed if and only if all pixel components are banded,
  5451. e.g. banding detection threshold is triggered for all color components.
  5452. The default is disabled.
  5453. @end table
  5454. @anchor{decimate}
  5455. @section decimate
  5456. Drop duplicated frames at regular intervals.
  5457. The filter accepts the following options:
  5458. @table @option
  5459. @item cycle
  5460. Set the number of frames from which one will be dropped. Setting this to
  5461. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5462. Default is @code{5}.
  5463. @item dupthresh
  5464. Set the threshold for duplicate detection. If the difference metric for a frame
  5465. is less than or equal to this value, then it is declared as duplicate. Default
  5466. is @code{1.1}
  5467. @item scthresh
  5468. Set scene change threshold. Default is @code{15}.
  5469. @item blockx
  5470. @item blocky
  5471. Set the size of the x and y-axis blocks used during metric calculations.
  5472. Larger blocks give better noise suppression, but also give worse detection of
  5473. small movements. Must be a power of two. Default is @code{32}.
  5474. @item ppsrc
  5475. Mark main input as a pre-processed input and activate clean source input
  5476. stream. This allows the input to be pre-processed with various filters to help
  5477. the metrics calculation while keeping the frame selection lossless. When set to
  5478. @code{1}, the first stream is for the pre-processed input, and the second
  5479. stream is the clean source from where the kept frames are chosen. Default is
  5480. @code{0}.
  5481. @item chroma
  5482. Set whether or not chroma is considered in the metric calculations. Default is
  5483. @code{1}.
  5484. @end table
  5485. @section deconvolve
  5486. Apply 2D deconvolution of video stream in frequency domain using second stream
  5487. as impulse.
  5488. The filter accepts the following options:
  5489. @table @option
  5490. @item planes
  5491. Set which planes to process.
  5492. @item impulse
  5493. Set which impulse video frames will be processed, can be @var{first}
  5494. or @var{all}. Default is @var{all}.
  5495. @item noise
  5496. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5497. and height are not same and not power of 2 or if stream prior to convolving
  5498. had noise.
  5499. @end table
  5500. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5501. @section deflate
  5502. Apply deflate effect to the video.
  5503. This filter replaces the pixel by the local(3x3) average by taking into account
  5504. only values lower than the pixel.
  5505. It accepts the following options:
  5506. @table @option
  5507. @item threshold0
  5508. @item threshold1
  5509. @item threshold2
  5510. @item threshold3
  5511. Limit the maximum change for each plane, default is 65535.
  5512. If 0, plane will remain unchanged.
  5513. @end table
  5514. @section deflicker
  5515. Remove temporal frame luminance variations.
  5516. It accepts the following options:
  5517. @table @option
  5518. @item size, s
  5519. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5520. @item mode, m
  5521. Set averaging mode to smooth temporal luminance variations.
  5522. Available values are:
  5523. @table @samp
  5524. @item am
  5525. Arithmetic mean
  5526. @item gm
  5527. Geometric mean
  5528. @item hm
  5529. Harmonic mean
  5530. @item qm
  5531. Quadratic mean
  5532. @item cm
  5533. Cubic mean
  5534. @item pm
  5535. Power mean
  5536. @item median
  5537. Median
  5538. @end table
  5539. @item bypass
  5540. Do not actually modify frame. Useful when one only wants metadata.
  5541. @end table
  5542. @section dejudder
  5543. Remove judder produced by partially interlaced telecined content.
  5544. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5545. source was partially telecined content then the output of @code{pullup,dejudder}
  5546. will have a variable frame rate. May change the recorded frame rate of the
  5547. container. Aside from that change, this filter will not affect constant frame
  5548. rate video.
  5549. The option available in this filter is:
  5550. @table @option
  5551. @item cycle
  5552. Specify the length of the window over which the judder repeats.
  5553. Accepts any integer greater than 1. Useful values are:
  5554. @table @samp
  5555. @item 4
  5556. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5557. @item 5
  5558. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5559. @item 20
  5560. If a mixture of the two.
  5561. @end table
  5562. The default is @samp{4}.
  5563. @end table
  5564. @section delogo
  5565. Suppress a TV station logo by a simple interpolation of the surrounding
  5566. pixels. Just set a rectangle covering the logo and watch it disappear
  5567. (and sometimes something even uglier appear - your mileage may vary).
  5568. It accepts the following parameters:
  5569. @table @option
  5570. @item x
  5571. @item y
  5572. Specify the top left corner coordinates of the logo. They must be
  5573. specified.
  5574. @item w
  5575. @item h
  5576. Specify the width and height of the logo to clear. They must be
  5577. specified.
  5578. @item band, t
  5579. Specify the thickness of the fuzzy edge of the rectangle (added to
  5580. @var{w} and @var{h}). The default value is 1. This option is
  5581. deprecated, setting higher values should no longer be necessary and
  5582. is not recommended.
  5583. @item show
  5584. When set to 1, a green rectangle is drawn on the screen to simplify
  5585. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5586. The default value is 0.
  5587. The rectangle is drawn on the outermost pixels which will be (partly)
  5588. replaced with interpolated values. The values of the next pixels
  5589. immediately outside this rectangle in each direction will be used to
  5590. compute the interpolated pixel values inside the rectangle.
  5591. @end table
  5592. @subsection Examples
  5593. @itemize
  5594. @item
  5595. Set a rectangle covering the area with top left corner coordinates 0,0
  5596. and size 100x77, and a band of size 10:
  5597. @example
  5598. delogo=x=0:y=0:w=100:h=77:band=10
  5599. @end example
  5600. @end itemize
  5601. @section deshake
  5602. Attempt to fix small changes in horizontal and/or vertical shift. This
  5603. filter helps remove camera shake from hand-holding a camera, bumping a
  5604. tripod, moving on a vehicle, etc.
  5605. The filter accepts the following options:
  5606. @table @option
  5607. @item x
  5608. @item y
  5609. @item w
  5610. @item h
  5611. Specify a rectangular area where to limit the search for motion
  5612. vectors.
  5613. If desired the search for motion vectors can be limited to a
  5614. rectangular area of the frame defined by its top left corner, width
  5615. and height. These parameters have the same meaning as the drawbox
  5616. filter which can be used to visualise the position of the bounding
  5617. box.
  5618. This is useful when simultaneous movement of subjects within the frame
  5619. might be confused for camera motion by the motion vector search.
  5620. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5621. then the full frame is used. This allows later options to be set
  5622. without specifying the bounding box for the motion vector search.
  5623. Default - search the whole frame.
  5624. @item rx
  5625. @item ry
  5626. Specify the maximum extent of movement in x and y directions in the
  5627. range 0-64 pixels. Default 16.
  5628. @item edge
  5629. Specify how to generate pixels to fill blanks at the edge of the
  5630. frame. Available values are:
  5631. @table @samp
  5632. @item blank, 0
  5633. Fill zeroes at blank locations
  5634. @item original, 1
  5635. Original image at blank locations
  5636. @item clamp, 2
  5637. Extruded edge value at blank locations
  5638. @item mirror, 3
  5639. Mirrored edge at blank locations
  5640. @end table
  5641. Default value is @samp{mirror}.
  5642. @item blocksize
  5643. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5644. default 8.
  5645. @item contrast
  5646. Specify the contrast threshold for blocks. Only blocks with more than
  5647. the specified contrast (difference between darkest and lightest
  5648. pixels) will be considered. Range 1-255, default 125.
  5649. @item search
  5650. Specify the search strategy. Available values are:
  5651. @table @samp
  5652. @item exhaustive, 0
  5653. Set exhaustive search
  5654. @item less, 1
  5655. Set less exhaustive search.
  5656. @end table
  5657. Default value is @samp{exhaustive}.
  5658. @item filename
  5659. If set then a detailed log of the motion search is written to the
  5660. specified file.
  5661. @end table
  5662. @section despill
  5663. Remove unwanted contamination of foreground colors, caused by reflected color of
  5664. greenscreen or bluescreen.
  5665. This filter accepts the following options:
  5666. @table @option
  5667. @item type
  5668. Set what type of despill to use.
  5669. @item mix
  5670. Set how spillmap will be generated.
  5671. @item expand
  5672. Set how much to get rid of still remaining spill.
  5673. @item red
  5674. Controls amount of red in spill area.
  5675. @item green
  5676. Controls amount of green in spill area.
  5677. Should be -1 for greenscreen.
  5678. @item blue
  5679. Controls amount of blue in spill area.
  5680. Should be -1 for bluescreen.
  5681. @item brightness
  5682. Controls brightness of spill area, preserving colors.
  5683. @item alpha
  5684. Modify alpha from generated spillmap.
  5685. @end table
  5686. @section detelecine
  5687. Apply an exact inverse of the telecine operation. It requires a predefined
  5688. pattern specified using the pattern option which must be the same as that passed
  5689. to the telecine filter.
  5690. This filter accepts the following options:
  5691. @table @option
  5692. @item first_field
  5693. @table @samp
  5694. @item top, t
  5695. top field first
  5696. @item bottom, b
  5697. bottom field first
  5698. The default value is @code{top}.
  5699. @end table
  5700. @item pattern
  5701. A string of numbers representing the pulldown pattern you wish to apply.
  5702. The default value is @code{23}.
  5703. @item start_frame
  5704. A number representing position of the first frame with respect to the telecine
  5705. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5706. @end table
  5707. @section dilation
  5708. Apply dilation effect to the video.
  5709. This filter replaces the pixel by the local(3x3) maximum.
  5710. It accepts the following options:
  5711. @table @option
  5712. @item threshold0
  5713. @item threshold1
  5714. @item threshold2
  5715. @item threshold3
  5716. Limit the maximum change for each plane, default is 65535.
  5717. If 0, plane will remain unchanged.
  5718. @item coordinates
  5719. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5720. pixels are used.
  5721. Flags to local 3x3 coordinates maps like this:
  5722. 1 2 3
  5723. 4 5
  5724. 6 7 8
  5725. @end table
  5726. @section displace
  5727. Displace pixels as indicated by second and third input stream.
  5728. It takes three input streams and outputs one stream, the first input is the
  5729. source, and second and third input are displacement maps.
  5730. The second input specifies how much to displace pixels along the
  5731. x-axis, while the third input specifies how much to displace pixels
  5732. along the y-axis.
  5733. If one of displacement map streams terminates, last frame from that
  5734. displacement map will be used.
  5735. Note that once generated, displacements maps can be reused over and over again.
  5736. A description of the accepted options follows.
  5737. @table @option
  5738. @item edge
  5739. Set displace behavior for pixels that are out of range.
  5740. Available values are:
  5741. @table @samp
  5742. @item blank
  5743. Missing pixels are replaced by black pixels.
  5744. @item smear
  5745. Adjacent pixels will spread out to replace missing pixels.
  5746. @item wrap
  5747. Out of range pixels are wrapped so they point to pixels of other side.
  5748. @item mirror
  5749. Out of range pixels will be replaced with mirrored pixels.
  5750. @end table
  5751. Default is @samp{smear}.
  5752. @end table
  5753. @subsection Examples
  5754. @itemize
  5755. @item
  5756. Add ripple effect to rgb input of video size hd720:
  5757. @example
  5758. 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
  5759. @end example
  5760. @item
  5761. Add wave effect to rgb input of video size hd720:
  5762. @example
  5763. 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
  5764. @end example
  5765. @end itemize
  5766. @section drawbox
  5767. Draw a colored box on the input image.
  5768. It accepts the following parameters:
  5769. @table @option
  5770. @item x
  5771. @item y
  5772. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5773. @item width, w
  5774. @item height, h
  5775. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5776. the input width and height. It defaults to 0.
  5777. @item color, c
  5778. Specify the color of the box to write. For the general syntax of this option,
  5779. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5780. value @code{invert} is used, the box edge color is the same as the
  5781. video with inverted luma.
  5782. @item thickness, t
  5783. The expression which sets the thickness of the box edge.
  5784. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5785. See below for the list of accepted constants.
  5786. @item replace
  5787. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5788. will overwrite the video's color and alpha pixels.
  5789. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5790. @end table
  5791. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5792. following constants:
  5793. @table @option
  5794. @item dar
  5795. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5796. @item hsub
  5797. @item vsub
  5798. horizontal and vertical chroma subsample values. For example for the
  5799. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5800. @item in_h, ih
  5801. @item in_w, iw
  5802. The input width and height.
  5803. @item sar
  5804. The input sample aspect ratio.
  5805. @item x
  5806. @item y
  5807. The x and y offset coordinates where the box is drawn.
  5808. @item w
  5809. @item h
  5810. The width and height of the drawn box.
  5811. @item t
  5812. The thickness of the drawn box.
  5813. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5814. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5815. @end table
  5816. @subsection Examples
  5817. @itemize
  5818. @item
  5819. Draw a black box around the edge of the input image:
  5820. @example
  5821. drawbox
  5822. @end example
  5823. @item
  5824. Draw a box with color red and an opacity of 50%:
  5825. @example
  5826. drawbox=10:20:200:60:red@@0.5
  5827. @end example
  5828. The previous example can be specified as:
  5829. @example
  5830. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5831. @end example
  5832. @item
  5833. Fill the box with pink color:
  5834. @example
  5835. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5836. @end example
  5837. @item
  5838. Draw a 2-pixel red 2.40:1 mask:
  5839. @example
  5840. 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
  5841. @end example
  5842. @end itemize
  5843. @section drawgrid
  5844. Draw a grid on the input image.
  5845. It accepts the following parameters:
  5846. @table @option
  5847. @item x
  5848. @item y
  5849. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5850. @item width, w
  5851. @item height, h
  5852. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5853. input width and height, respectively, minus @code{thickness}, so image gets
  5854. framed. Default to 0.
  5855. @item color, c
  5856. Specify the color of the grid. For the general syntax of this option,
  5857. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5858. value @code{invert} is used, the grid color is the same as the
  5859. video with inverted luma.
  5860. @item thickness, t
  5861. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5862. See below for the list of accepted constants.
  5863. @item replace
  5864. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5865. will overwrite the video's color and alpha pixels.
  5866. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5867. @end table
  5868. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5869. following constants:
  5870. @table @option
  5871. @item dar
  5872. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5873. @item hsub
  5874. @item vsub
  5875. horizontal and vertical chroma subsample values. For example for the
  5876. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5877. @item in_h, ih
  5878. @item in_w, iw
  5879. The input grid cell width and height.
  5880. @item sar
  5881. The input sample aspect ratio.
  5882. @item x
  5883. @item y
  5884. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5885. @item w
  5886. @item h
  5887. The width and height of the drawn cell.
  5888. @item t
  5889. The thickness of the drawn cell.
  5890. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5891. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5892. @end table
  5893. @subsection Examples
  5894. @itemize
  5895. @item
  5896. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5897. @example
  5898. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5899. @end example
  5900. @item
  5901. Draw a white 3x3 grid with an opacity of 50%:
  5902. @example
  5903. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5904. @end example
  5905. @end itemize
  5906. @anchor{drawtext}
  5907. @section drawtext
  5908. Draw a text string or text from a specified file on top of a video, using the
  5909. libfreetype library.
  5910. To enable compilation of this filter, you need to configure FFmpeg with
  5911. @code{--enable-libfreetype}.
  5912. To enable default font fallback and the @var{font} option you need to
  5913. configure FFmpeg with @code{--enable-libfontconfig}.
  5914. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5915. @code{--enable-libfribidi}.
  5916. @subsection Syntax
  5917. It accepts the following parameters:
  5918. @table @option
  5919. @item box
  5920. Used to draw a box around text using the background color.
  5921. The value must be either 1 (enable) or 0 (disable).
  5922. The default value of @var{box} is 0.
  5923. @item boxborderw
  5924. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5925. The default value of @var{boxborderw} is 0.
  5926. @item boxcolor
  5927. The color to be used for drawing box around text. For the syntax of this
  5928. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5929. The default value of @var{boxcolor} is "white".
  5930. @item line_spacing
  5931. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5932. The default value of @var{line_spacing} is 0.
  5933. @item borderw
  5934. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5935. The default value of @var{borderw} is 0.
  5936. @item bordercolor
  5937. Set the color to be used for drawing border around text. For the syntax of this
  5938. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5939. The default value of @var{bordercolor} is "black".
  5940. @item expansion
  5941. Select how the @var{text} is expanded. Can be either @code{none},
  5942. @code{strftime} (deprecated) or
  5943. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5944. below for details.
  5945. @item basetime
  5946. Set a start time for the count. Value is in microseconds. Only applied
  5947. in the deprecated strftime expansion mode. To emulate in normal expansion
  5948. mode use the @code{pts} function, supplying the start time (in seconds)
  5949. as the second argument.
  5950. @item fix_bounds
  5951. If true, check and fix text coords to avoid clipping.
  5952. @item fontcolor
  5953. The color to be used for drawing fonts. For the syntax of this option, check
  5954. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5955. The default value of @var{fontcolor} is "black".
  5956. @item fontcolor_expr
  5957. String which is expanded the same way as @var{text} to obtain dynamic
  5958. @var{fontcolor} value. By default this option has empty value and is not
  5959. processed. When this option is set, it overrides @var{fontcolor} option.
  5960. @item font
  5961. The font family to be used for drawing text. By default Sans.
  5962. @item fontfile
  5963. The font file to be used for drawing text. The path must be included.
  5964. This parameter is mandatory if the fontconfig support is disabled.
  5965. @item alpha
  5966. Draw the text applying alpha blending. The value can
  5967. be a number between 0.0 and 1.0.
  5968. The expression accepts the same variables @var{x, y} as well.
  5969. The default value is 1.
  5970. Please see @var{fontcolor_expr}.
  5971. @item fontsize
  5972. The font size to be used for drawing text.
  5973. The default value of @var{fontsize} is 16.
  5974. @item text_shaping
  5975. If set to 1, attempt to shape the text (for example, reverse the order of
  5976. right-to-left text and join Arabic characters) before drawing it.
  5977. Otherwise, just draw the text exactly as given.
  5978. By default 1 (if supported).
  5979. @item ft_load_flags
  5980. The flags to be used for loading the fonts.
  5981. The flags map the corresponding flags supported by libfreetype, and are
  5982. a combination of the following values:
  5983. @table @var
  5984. @item default
  5985. @item no_scale
  5986. @item no_hinting
  5987. @item render
  5988. @item no_bitmap
  5989. @item vertical_layout
  5990. @item force_autohint
  5991. @item crop_bitmap
  5992. @item pedantic
  5993. @item ignore_global_advance_width
  5994. @item no_recurse
  5995. @item ignore_transform
  5996. @item monochrome
  5997. @item linear_design
  5998. @item no_autohint
  5999. @end table
  6000. Default value is "default".
  6001. For more information consult the documentation for the FT_LOAD_*
  6002. libfreetype flags.
  6003. @item shadowcolor
  6004. The color to be used for drawing a shadow behind the drawn text. For the
  6005. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6006. ffmpeg-utils manual,ffmpeg-utils}.
  6007. The default value of @var{shadowcolor} is "black".
  6008. @item shadowx
  6009. @item shadowy
  6010. The x and y offsets for the text shadow position with respect to the
  6011. position of the text. They can be either positive or negative
  6012. values. The default value for both is "0".
  6013. @item start_number
  6014. The starting frame number for the n/frame_num variable. The default value
  6015. is "0".
  6016. @item tabsize
  6017. The size in number of spaces to use for rendering the tab.
  6018. Default value is 4.
  6019. @item timecode
  6020. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6021. format. It can be used with or without text parameter. @var{timecode_rate}
  6022. option must be specified.
  6023. @item timecode_rate, rate, r
  6024. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6025. integer. Minimum value is "1".
  6026. Drop-frame timecode is supported for frame rates 30 & 60.
  6027. @item tc24hmax
  6028. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6029. Default is 0 (disabled).
  6030. @item text
  6031. The text string to be drawn. The text must be a sequence of UTF-8
  6032. encoded characters.
  6033. This parameter is mandatory if no file is specified with the parameter
  6034. @var{textfile}.
  6035. @item textfile
  6036. A text file containing text to be drawn. The text must be a sequence
  6037. of UTF-8 encoded characters.
  6038. This parameter is mandatory if no text string is specified with the
  6039. parameter @var{text}.
  6040. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6041. @item reload
  6042. If set to 1, the @var{textfile} will be reloaded before each frame.
  6043. Be sure to update it atomically, or it may be read partially, or even fail.
  6044. @item x
  6045. @item y
  6046. The expressions which specify the offsets where text will be drawn
  6047. within the video frame. They are relative to the top/left border of the
  6048. output image.
  6049. The default value of @var{x} and @var{y} is "0".
  6050. See below for the list of accepted constants and functions.
  6051. @end table
  6052. The parameters for @var{x} and @var{y} are expressions containing the
  6053. following constants and functions:
  6054. @table @option
  6055. @item dar
  6056. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6057. @item hsub
  6058. @item vsub
  6059. horizontal and vertical chroma subsample values. For example for the
  6060. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6061. @item line_h, lh
  6062. the height of each text line
  6063. @item main_h, h, H
  6064. the input height
  6065. @item main_w, w, W
  6066. the input width
  6067. @item max_glyph_a, ascent
  6068. the maximum distance from the baseline to the highest/upper grid
  6069. coordinate used to place a glyph outline point, for all the rendered
  6070. glyphs.
  6071. It is a positive value, due to the grid's orientation with the Y axis
  6072. upwards.
  6073. @item max_glyph_d, descent
  6074. the maximum distance from the baseline to the lowest grid coordinate
  6075. used to place a glyph outline point, for all the rendered glyphs.
  6076. This is a negative value, due to the grid's orientation, with the Y axis
  6077. upwards.
  6078. @item max_glyph_h
  6079. maximum glyph height, that is the maximum height for all the glyphs
  6080. contained in the rendered text, it is equivalent to @var{ascent} -
  6081. @var{descent}.
  6082. @item max_glyph_w
  6083. maximum glyph width, that is the maximum width for all the glyphs
  6084. contained in the rendered text
  6085. @item n
  6086. the number of input frame, starting from 0
  6087. @item rand(min, max)
  6088. return a random number included between @var{min} and @var{max}
  6089. @item sar
  6090. The input sample aspect ratio.
  6091. @item t
  6092. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6093. @item text_h, th
  6094. the height of the rendered text
  6095. @item text_w, tw
  6096. the width of the rendered text
  6097. @item x
  6098. @item y
  6099. the x and y offset coordinates where the text is drawn.
  6100. These parameters allow the @var{x} and @var{y} expressions to refer
  6101. each other, so you can for example specify @code{y=x/dar}.
  6102. @end table
  6103. @anchor{drawtext_expansion}
  6104. @subsection Text expansion
  6105. If @option{expansion} is set to @code{strftime},
  6106. the filter recognizes strftime() sequences in the provided text and
  6107. expands them accordingly. Check the documentation of strftime(). This
  6108. feature is deprecated.
  6109. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6110. If @option{expansion} is set to @code{normal} (which is the default),
  6111. the following expansion mechanism is used.
  6112. The backslash character @samp{\}, followed by any character, always expands to
  6113. the second character.
  6114. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6115. braces is a function name, possibly followed by arguments separated by ':'.
  6116. If the arguments contain special characters or delimiters (':' or '@}'),
  6117. they should be escaped.
  6118. Note that they probably must also be escaped as the value for the
  6119. @option{text} option in the filter argument string and as the filter
  6120. argument in the filtergraph description, and possibly also for the shell,
  6121. that makes up to four levels of escaping; using a text file avoids these
  6122. problems.
  6123. The following functions are available:
  6124. @table @command
  6125. @item expr, e
  6126. The expression evaluation result.
  6127. It must take one argument specifying the expression to be evaluated,
  6128. which accepts the same constants and functions as the @var{x} and
  6129. @var{y} values. Note that not all constants should be used, for
  6130. example the text size is not known when evaluating the expression, so
  6131. the constants @var{text_w} and @var{text_h} will have an undefined
  6132. value.
  6133. @item expr_int_format, eif
  6134. Evaluate the expression's value and output as formatted integer.
  6135. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6136. The second argument specifies the output format. Allowed values are @samp{x},
  6137. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6138. @code{printf} function.
  6139. The third parameter is optional and sets the number of positions taken by the output.
  6140. It can be used to add padding with zeros from the left.
  6141. @item gmtime
  6142. The time at which the filter is running, expressed in UTC.
  6143. It can accept an argument: a strftime() format string.
  6144. @item localtime
  6145. The time at which the filter is running, expressed in the local time zone.
  6146. It can accept an argument: a strftime() format string.
  6147. @item metadata
  6148. Frame metadata. Takes one or two arguments.
  6149. The first argument is mandatory and specifies the metadata key.
  6150. The second argument is optional and specifies a default value, used when the
  6151. metadata key is not found or empty.
  6152. @item n, frame_num
  6153. The frame number, starting from 0.
  6154. @item pict_type
  6155. A 1 character description of the current picture type.
  6156. @item pts
  6157. The timestamp of the current frame.
  6158. It can take up to three arguments.
  6159. The first argument is the format of the timestamp; it defaults to @code{flt}
  6160. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6161. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6162. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6163. @code{localtime} stands for the timestamp of the frame formatted as
  6164. local time zone time.
  6165. The second argument is an offset added to the timestamp.
  6166. If the format is set to @code{localtime} or @code{gmtime},
  6167. a third argument may be supplied: a strftime() format string.
  6168. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6169. @end table
  6170. @subsection Examples
  6171. @itemize
  6172. @item
  6173. Draw "Test Text" with font FreeSerif, using the default values for the
  6174. optional parameters.
  6175. @example
  6176. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6177. @end example
  6178. @item
  6179. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6180. and y=50 (counting from the top-left corner of the screen), text is
  6181. yellow with a red box around it. Both the text and the box have an
  6182. opacity of 20%.
  6183. @example
  6184. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6185. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6186. @end example
  6187. Note that the double quotes are not necessary if spaces are not used
  6188. within the parameter list.
  6189. @item
  6190. Show the text at the center of the video frame:
  6191. @example
  6192. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6193. @end example
  6194. @item
  6195. Show the text at a random position, switching to a new position every 30 seconds:
  6196. @example
  6197. 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)"
  6198. @end example
  6199. @item
  6200. Show a text line sliding from right to left in the last row of the video
  6201. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6202. with no newlines.
  6203. @example
  6204. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6205. @end example
  6206. @item
  6207. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6208. @example
  6209. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6210. @end example
  6211. @item
  6212. Draw a single green letter "g", at the center of the input video.
  6213. The glyph baseline is placed at half screen height.
  6214. @example
  6215. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6216. @end example
  6217. @item
  6218. Show text for 1 second every 3 seconds:
  6219. @example
  6220. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6221. @end example
  6222. @item
  6223. Use fontconfig to set the font. Note that the colons need to be escaped.
  6224. @example
  6225. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6226. @end example
  6227. @item
  6228. Print the date of a real-time encoding (see strftime(3)):
  6229. @example
  6230. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6231. @end example
  6232. @item
  6233. Show text fading in and out (appearing/disappearing):
  6234. @example
  6235. #!/bin/sh
  6236. DS=1.0 # display start
  6237. DE=10.0 # display end
  6238. FID=1.5 # fade in duration
  6239. FOD=5 # fade out duration
  6240. 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 @}"
  6241. @end example
  6242. @item
  6243. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6244. and the @option{fontsize} value are included in the @option{y} offset.
  6245. @example
  6246. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6247. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6248. @end example
  6249. @end itemize
  6250. For more information about libfreetype, check:
  6251. @url{http://www.freetype.org/}.
  6252. For more information about fontconfig, check:
  6253. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6254. For more information about libfribidi, check:
  6255. @url{http://fribidi.org/}.
  6256. @section edgedetect
  6257. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6258. The filter accepts the following options:
  6259. @table @option
  6260. @item low
  6261. @item high
  6262. Set low and high threshold values used by the Canny thresholding
  6263. algorithm.
  6264. The high threshold selects the "strong" edge pixels, which are then
  6265. connected through 8-connectivity with the "weak" edge pixels selected
  6266. by the low threshold.
  6267. @var{low} and @var{high} threshold values must be chosen in the range
  6268. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6269. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6270. is @code{50/255}.
  6271. @item mode
  6272. Define the drawing mode.
  6273. @table @samp
  6274. @item wires
  6275. Draw white/gray wires on black background.
  6276. @item colormix
  6277. Mix the colors to create a paint/cartoon effect.
  6278. @end table
  6279. Default value is @var{wires}.
  6280. @end table
  6281. @subsection Examples
  6282. @itemize
  6283. @item
  6284. Standard edge detection with custom values for the hysteresis thresholding:
  6285. @example
  6286. edgedetect=low=0.1:high=0.4
  6287. @end example
  6288. @item
  6289. Painting effect without thresholding:
  6290. @example
  6291. edgedetect=mode=colormix:high=0
  6292. @end example
  6293. @end itemize
  6294. @section eq
  6295. Set brightness, contrast, saturation and approximate gamma adjustment.
  6296. The filter accepts the following options:
  6297. @table @option
  6298. @item contrast
  6299. Set the contrast expression. The value must be a float value in range
  6300. @code{-2.0} to @code{2.0}. The default value is "1".
  6301. @item brightness
  6302. Set the brightness expression. The value must be a float value in
  6303. range @code{-1.0} to @code{1.0}. The default value is "0".
  6304. @item saturation
  6305. Set the saturation expression. The value must be a float in
  6306. range @code{0.0} to @code{3.0}. The default value is "1".
  6307. @item gamma
  6308. Set the gamma expression. The value must be a float in range
  6309. @code{0.1} to @code{10.0}. The default value is "1".
  6310. @item gamma_r
  6311. Set the gamma expression for red. The value must be a float in
  6312. range @code{0.1} to @code{10.0}. The default value is "1".
  6313. @item gamma_g
  6314. Set the gamma expression for green. The value must be a float in range
  6315. @code{0.1} to @code{10.0}. The default value is "1".
  6316. @item gamma_b
  6317. Set the gamma expression for blue. The value must be a float in range
  6318. @code{0.1} to @code{10.0}. The default value is "1".
  6319. @item gamma_weight
  6320. Set the gamma weight expression. It can be used to reduce the effect
  6321. of a high gamma value on bright image areas, e.g. keep them from
  6322. getting overamplified and just plain white. The value must be a float
  6323. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6324. gamma correction all the way down while @code{1.0} leaves it at its
  6325. full strength. Default is "1".
  6326. @item eval
  6327. Set when the expressions for brightness, contrast, saturation and
  6328. gamma expressions are evaluated.
  6329. It accepts the following values:
  6330. @table @samp
  6331. @item init
  6332. only evaluate expressions once during the filter initialization or
  6333. when a command is processed
  6334. @item frame
  6335. evaluate expressions for each incoming frame
  6336. @end table
  6337. Default value is @samp{init}.
  6338. @end table
  6339. The expressions accept the following parameters:
  6340. @table @option
  6341. @item n
  6342. frame count of the input frame starting from 0
  6343. @item pos
  6344. byte position of the corresponding packet in the input file, NAN if
  6345. unspecified
  6346. @item r
  6347. frame rate of the input video, NAN if the input frame rate is unknown
  6348. @item t
  6349. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6350. @end table
  6351. @subsection Commands
  6352. The filter supports the following commands:
  6353. @table @option
  6354. @item contrast
  6355. Set the contrast expression.
  6356. @item brightness
  6357. Set the brightness expression.
  6358. @item saturation
  6359. Set the saturation expression.
  6360. @item gamma
  6361. Set the gamma expression.
  6362. @item gamma_r
  6363. Set the gamma_r expression.
  6364. @item gamma_g
  6365. Set gamma_g expression.
  6366. @item gamma_b
  6367. Set gamma_b expression.
  6368. @item gamma_weight
  6369. Set gamma_weight expression.
  6370. The command accepts the same syntax of the corresponding option.
  6371. If the specified expression is not valid, it is kept at its current
  6372. value.
  6373. @end table
  6374. @section erosion
  6375. Apply erosion effect to the video.
  6376. This filter replaces the pixel by the local(3x3) minimum.
  6377. It accepts the following options:
  6378. @table @option
  6379. @item threshold0
  6380. @item threshold1
  6381. @item threshold2
  6382. @item threshold3
  6383. Limit the maximum change for each plane, default is 65535.
  6384. If 0, plane will remain unchanged.
  6385. @item coordinates
  6386. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6387. pixels are used.
  6388. Flags to local 3x3 coordinates maps like this:
  6389. 1 2 3
  6390. 4 5
  6391. 6 7 8
  6392. @end table
  6393. @section extractplanes
  6394. Extract color channel components from input video stream into
  6395. separate grayscale video streams.
  6396. The filter accepts the following option:
  6397. @table @option
  6398. @item planes
  6399. Set plane(s) to extract.
  6400. Available values for planes are:
  6401. @table @samp
  6402. @item y
  6403. @item u
  6404. @item v
  6405. @item a
  6406. @item r
  6407. @item g
  6408. @item b
  6409. @end table
  6410. Choosing planes not available in the input will result in an error.
  6411. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6412. with @code{y}, @code{u}, @code{v} planes at same time.
  6413. @end table
  6414. @subsection Examples
  6415. @itemize
  6416. @item
  6417. Extract luma, u and v color channel component from input video frame
  6418. into 3 grayscale outputs:
  6419. @example
  6420. 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
  6421. @end example
  6422. @end itemize
  6423. @section elbg
  6424. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6425. For each input image, the filter will compute the optimal mapping from
  6426. the input to the output given the codebook length, that is the number
  6427. of distinct output colors.
  6428. This filter accepts the following options.
  6429. @table @option
  6430. @item codebook_length, l
  6431. Set codebook length. The value must be a positive integer, and
  6432. represents the number of distinct output colors. Default value is 256.
  6433. @item nb_steps, n
  6434. Set the maximum number of iterations to apply for computing the optimal
  6435. mapping. The higher the value the better the result and the higher the
  6436. computation time. Default value is 1.
  6437. @item seed, s
  6438. Set a random seed, must be an integer included between 0 and
  6439. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6440. will try to use a good random seed on a best effort basis.
  6441. @item pal8
  6442. Set pal8 output pixel format. This option does not work with codebook
  6443. length greater than 256.
  6444. @end table
  6445. @section entropy
  6446. Measure graylevel entropy in histogram of color channels of video frames.
  6447. It accepts the following parameters:
  6448. @table @option
  6449. @item mode
  6450. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6451. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6452. between neighbour histogram values.
  6453. @end table
  6454. @section fade
  6455. Apply a fade-in/out effect to the input video.
  6456. It accepts the following parameters:
  6457. @table @option
  6458. @item type, t
  6459. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6460. effect.
  6461. Default is @code{in}.
  6462. @item start_frame, s
  6463. Specify the number of the frame to start applying the fade
  6464. effect at. Default is 0.
  6465. @item nb_frames, n
  6466. The number of frames that the fade effect lasts. At the end of the
  6467. fade-in effect, the output video will have the same intensity as the input video.
  6468. At the end of the fade-out transition, the output video will be filled with the
  6469. selected @option{color}.
  6470. Default is 25.
  6471. @item alpha
  6472. If set to 1, fade only alpha channel, if one exists on the input.
  6473. Default value is 0.
  6474. @item start_time, st
  6475. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6476. effect. If both start_frame and start_time are specified, the fade will start at
  6477. whichever comes last. Default is 0.
  6478. @item duration, d
  6479. The number of seconds for which the fade effect has to last. At the end of the
  6480. fade-in effect the output video will have the same intensity as the input video,
  6481. at the end of the fade-out transition the output video will be filled with the
  6482. selected @option{color}.
  6483. If both duration and nb_frames are specified, duration is used. Default is 0
  6484. (nb_frames is used by default).
  6485. @item color, c
  6486. Specify the color of the fade. Default is "black".
  6487. @end table
  6488. @subsection Examples
  6489. @itemize
  6490. @item
  6491. Fade in the first 30 frames of video:
  6492. @example
  6493. fade=in:0:30
  6494. @end example
  6495. The command above is equivalent to:
  6496. @example
  6497. fade=t=in:s=0:n=30
  6498. @end example
  6499. @item
  6500. Fade out the last 45 frames of a 200-frame video:
  6501. @example
  6502. fade=out:155:45
  6503. fade=type=out:start_frame=155:nb_frames=45
  6504. @end example
  6505. @item
  6506. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6507. @example
  6508. fade=in:0:25, fade=out:975:25
  6509. @end example
  6510. @item
  6511. Make the first 5 frames yellow, then fade in from frame 5-24:
  6512. @example
  6513. fade=in:5:20:color=yellow
  6514. @end example
  6515. @item
  6516. Fade in alpha over first 25 frames of video:
  6517. @example
  6518. fade=in:0:25:alpha=1
  6519. @end example
  6520. @item
  6521. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6522. @example
  6523. fade=t=in:st=5.5:d=0.5
  6524. @end example
  6525. @end itemize
  6526. @section fftfilt
  6527. Apply arbitrary expressions to samples in frequency domain
  6528. @table @option
  6529. @item dc_Y
  6530. Adjust the dc value (gain) of the luma plane of the image. The filter
  6531. accepts an integer value in range @code{0} to @code{1000}. The default
  6532. value is set to @code{0}.
  6533. @item dc_U
  6534. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6535. filter accepts an integer value in range @code{0} to @code{1000}. The
  6536. default value is set to @code{0}.
  6537. @item dc_V
  6538. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6539. filter accepts an integer value in range @code{0} to @code{1000}. The
  6540. default value is set to @code{0}.
  6541. @item weight_Y
  6542. Set the frequency domain weight expression for the luma plane.
  6543. @item weight_U
  6544. Set the frequency domain weight expression for the 1st chroma plane.
  6545. @item weight_V
  6546. Set the frequency domain weight expression for the 2nd chroma plane.
  6547. @item eval
  6548. Set when the expressions are evaluated.
  6549. It accepts the following values:
  6550. @table @samp
  6551. @item init
  6552. Only evaluate expressions once during the filter initialization.
  6553. @item frame
  6554. Evaluate expressions for each incoming frame.
  6555. @end table
  6556. Default value is @samp{init}.
  6557. The filter accepts the following variables:
  6558. @item X
  6559. @item Y
  6560. The coordinates of the current sample.
  6561. @item W
  6562. @item H
  6563. The width and height of the image.
  6564. @item N
  6565. The number of input frame, starting from 0.
  6566. @end table
  6567. @subsection Examples
  6568. @itemize
  6569. @item
  6570. High-pass:
  6571. @example
  6572. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6573. @end example
  6574. @item
  6575. Low-pass:
  6576. @example
  6577. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6578. @end example
  6579. @item
  6580. Sharpen:
  6581. @example
  6582. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6583. @end example
  6584. @item
  6585. Blur:
  6586. @example
  6587. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6588. @end example
  6589. @end itemize
  6590. @section field
  6591. Extract a single field from an interlaced image using stride
  6592. arithmetic to avoid wasting CPU time. The output frames are marked as
  6593. non-interlaced.
  6594. The filter accepts the following options:
  6595. @table @option
  6596. @item type
  6597. Specify whether to extract the top (if the value is @code{0} or
  6598. @code{top}) or the bottom field (if the value is @code{1} or
  6599. @code{bottom}).
  6600. @end table
  6601. @section fieldhint
  6602. Create new frames by copying the top and bottom fields from surrounding frames
  6603. supplied as numbers by the hint file.
  6604. @table @option
  6605. @item hint
  6606. Set file containing hints: absolute/relative frame numbers.
  6607. There must be one line for each frame in a clip. Each line must contain two
  6608. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6609. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6610. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6611. for @code{relative} mode. First number tells from which frame to pick up top
  6612. field and second number tells from which frame to pick up bottom field.
  6613. If optionally followed by @code{+} output frame will be marked as interlaced,
  6614. else if followed by @code{-} output frame will be marked as progressive, else
  6615. it will be marked same as input frame.
  6616. If line starts with @code{#} or @code{;} that line is skipped.
  6617. @item mode
  6618. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6619. @end table
  6620. Example of first several lines of @code{hint} file for @code{relative} mode:
  6621. @example
  6622. 0,0 - # first frame
  6623. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6624. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6625. 1,0 -
  6626. 0,0 -
  6627. 0,0 -
  6628. 1,0 -
  6629. 1,0 -
  6630. 1,0 -
  6631. 0,0 -
  6632. 0,0 -
  6633. 1,0 -
  6634. 1,0 -
  6635. 1,0 -
  6636. 0,0 -
  6637. @end example
  6638. @section fieldmatch
  6639. Field matching filter for inverse telecine. It is meant to reconstruct the
  6640. progressive frames from a telecined stream. The filter does not drop duplicated
  6641. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6642. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6643. The separation of the field matching and the decimation is notably motivated by
  6644. the possibility of inserting a de-interlacing filter fallback between the two.
  6645. If the source has mixed telecined and real interlaced content,
  6646. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6647. But these remaining combed frames will be marked as interlaced, and thus can be
  6648. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6649. In addition to the various configuration options, @code{fieldmatch} can take an
  6650. optional second stream, activated through the @option{ppsrc} option. If
  6651. enabled, the frames reconstruction will be based on the fields and frames from
  6652. this second stream. This allows the first input to be pre-processed in order to
  6653. help the various algorithms of the filter, while keeping the output lossless
  6654. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6655. or brightness/contrast adjustments can help.
  6656. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6657. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6658. which @code{fieldmatch} is based on. While the semantic and usage are very
  6659. close, some behaviour and options names can differ.
  6660. The @ref{decimate} filter currently only works for constant frame rate input.
  6661. If your input has mixed telecined (30fps) and progressive content with a lower
  6662. framerate like 24fps use the following filterchain to produce the necessary cfr
  6663. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6664. The filter accepts the following options:
  6665. @table @option
  6666. @item order
  6667. Specify the assumed field order of the input stream. Available values are:
  6668. @table @samp
  6669. @item auto
  6670. Auto detect parity (use FFmpeg's internal parity value).
  6671. @item bff
  6672. Assume bottom field first.
  6673. @item tff
  6674. Assume top field first.
  6675. @end table
  6676. Note that it is sometimes recommended not to trust the parity announced by the
  6677. stream.
  6678. Default value is @var{auto}.
  6679. @item mode
  6680. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6681. sense that it won't risk creating jerkiness due to duplicate frames when
  6682. possible, but if there are bad edits or blended fields it will end up
  6683. outputting combed frames when a good match might actually exist. On the other
  6684. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6685. but will almost always find a good frame if there is one. The other values are
  6686. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6687. jerkiness and creating duplicate frames versus finding good matches in sections
  6688. with bad edits, orphaned fields, blended fields, etc.
  6689. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6690. Available values are:
  6691. @table @samp
  6692. @item pc
  6693. 2-way matching (p/c)
  6694. @item pc_n
  6695. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6696. @item pc_u
  6697. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6698. @item pc_n_ub
  6699. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6700. still combed (p/c + n + u/b)
  6701. @item pcn
  6702. 3-way matching (p/c/n)
  6703. @item pcn_ub
  6704. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6705. detected as combed (p/c/n + u/b)
  6706. @end table
  6707. The parenthesis at the end indicate the matches that would be used for that
  6708. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6709. @var{top}).
  6710. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6711. the slowest.
  6712. Default value is @var{pc_n}.
  6713. @item ppsrc
  6714. Mark the main input stream as a pre-processed input, and enable the secondary
  6715. input stream as the clean source to pick the fields from. See the filter
  6716. introduction for more details. It is similar to the @option{clip2} feature from
  6717. VFM/TFM.
  6718. Default value is @code{0} (disabled).
  6719. @item field
  6720. Set the field to match from. It is recommended to set this to the same value as
  6721. @option{order} unless you experience matching failures with that setting. In
  6722. certain circumstances changing the field that is used to match from can have a
  6723. large impact on matching performance. Available values are:
  6724. @table @samp
  6725. @item auto
  6726. Automatic (same value as @option{order}).
  6727. @item bottom
  6728. Match from the bottom field.
  6729. @item top
  6730. Match from the top field.
  6731. @end table
  6732. Default value is @var{auto}.
  6733. @item mchroma
  6734. Set whether or not chroma is included during the match comparisons. In most
  6735. cases it is recommended to leave this enabled. You should set this to @code{0}
  6736. only if your clip has bad chroma problems such as heavy rainbowing or other
  6737. artifacts. Setting this to @code{0} could also be used to speed things up at
  6738. the cost of some accuracy.
  6739. Default value is @code{1}.
  6740. @item y0
  6741. @item y1
  6742. These define an exclusion band which excludes the lines between @option{y0} and
  6743. @option{y1} from being included in the field matching decision. An exclusion
  6744. band can be used to ignore subtitles, a logo, or other things that may
  6745. interfere with the matching. @option{y0} sets the starting scan line and
  6746. @option{y1} sets the ending line; all lines in between @option{y0} and
  6747. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6748. @option{y0} and @option{y1} to the same value will disable the feature.
  6749. @option{y0} and @option{y1} defaults to @code{0}.
  6750. @item scthresh
  6751. Set the scene change detection threshold as a percentage of maximum change on
  6752. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6753. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6754. @option{scthresh} is @code{[0.0, 100.0]}.
  6755. Default value is @code{12.0}.
  6756. @item combmatch
  6757. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6758. account the combed scores of matches when deciding what match to use as the
  6759. final match. Available values are:
  6760. @table @samp
  6761. @item none
  6762. No final matching based on combed scores.
  6763. @item sc
  6764. Combed scores are only used when a scene change is detected.
  6765. @item full
  6766. Use combed scores all the time.
  6767. @end table
  6768. Default is @var{sc}.
  6769. @item combdbg
  6770. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6771. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6772. Available values are:
  6773. @table @samp
  6774. @item none
  6775. No forced calculation.
  6776. @item pcn
  6777. Force p/c/n calculations.
  6778. @item pcnub
  6779. Force p/c/n/u/b calculations.
  6780. @end table
  6781. Default value is @var{none}.
  6782. @item cthresh
  6783. This is the area combing threshold used for combed frame detection. This
  6784. essentially controls how "strong" or "visible" combing must be to be detected.
  6785. Larger values mean combing must be more visible and smaller values mean combing
  6786. can be less visible or strong and still be detected. Valid settings are from
  6787. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6788. be detected as combed). This is basically a pixel difference value. A good
  6789. range is @code{[8, 12]}.
  6790. Default value is @code{9}.
  6791. @item chroma
  6792. Sets whether or not chroma is considered in the combed frame decision. Only
  6793. disable this if your source has chroma problems (rainbowing, etc.) that are
  6794. causing problems for the combed frame detection with chroma enabled. Actually,
  6795. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6796. where there is chroma only combing in the source.
  6797. Default value is @code{0}.
  6798. @item blockx
  6799. @item blocky
  6800. Respectively set the x-axis and y-axis size of the window used during combed
  6801. frame detection. This has to do with the size of the area in which
  6802. @option{combpel} pixels are required to be detected as combed for a frame to be
  6803. declared combed. See the @option{combpel} parameter description for more info.
  6804. Possible values are any number that is a power of 2 starting at 4 and going up
  6805. to 512.
  6806. Default value is @code{16}.
  6807. @item combpel
  6808. The number of combed pixels inside any of the @option{blocky} by
  6809. @option{blockx} size blocks on the frame for the frame to be detected as
  6810. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6811. setting controls "how much" combing there must be in any localized area (a
  6812. window defined by the @option{blockx} and @option{blocky} settings) on the
  6813. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6814. which point no frames will ever be detected as combed). This setting is known
  6815. as @option{MI} in TFM/VFM vocabulary.
  6816. Default value is @code{80}.
  6817. @end table
  6818. @anchor{p/c/n/u/b meaning}
  6819. @subsection p/c/n/u/b meaning
  6820. @subsubsection p/c/n
  6821. We assume the following telecined stream:
  6822. @example
  6823. Top fields: 1 2 2 3 4
  6824. Bottom fields: 1 2 3 4 4
  6825. @end example
  6826. The numbers correspond to the progressive frame the fields relate to. Here, the
  6827. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6828. When @code{fieldmatch} is configured to run a matching from bottom
  6829. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6830. @example
  6831. Input stream:
  6832. T 1 2 2 3 4
  6833. B 1 2 3 4 4 <-- matching reference
  6834. Matches: c c n n c
  6835. Output stream:
  6836. T 1 2 3 4 4
  6837. B 1 2 3 4 4
  6838. @end example
  6839. As a result of the field matching, we can see that some frames get duplicated.
  6840. To perform a complete inverse telecine, you need to rely on a decimation filter
  6841. after this operation. See for instance the @ref{decimate} filter.
  6842. The same operation now matching from top fields (@option{field}=@var{top})
  6843. looks like this:
  6844. @example
  6845. Input stream:
  6846. T 1 2 2 3 4 <-- matching reference
  6847. B 1 2 3 4 4
  6848. Matches: c c p p c
  6849. Output stream:
  6850. T 1 2 2 3 4
  6851. B 1 2 2 3 4
  6852. @end example
  6853. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6854. basically, they refer to the frame and field of the opposite parity:
  6855. @itemize
  6856. @item @var{p} matches the field of the opposite parity in the previous frame
  6857. @item @var{c} matches the field of the opposite parity in the current frame
  6858. @item @var{n} matches the field of the opposite parity in the next frame
  6859. @end itemize
  6860. @subsubsection u/b
  6861. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6862. from the opposite parity flag. In the following examples, we assume that we are
  6863. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6864. 'x' is placed above and below each matched fields.
  6865. With bottom matching (@option{field}=@var{bottom}):
  6866. @example
  6867. Match: c p n b u
  6868. x x x x x
  6869. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6870. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6871. x x x x x
  6872. Output frames:
  6873. 2 1 2 2 2
  6874. 2 2 2 1 3
  6875. @end example
  6876. With top matching (@option{field}=@var{top}):
  6877. @example
  6878. Match: c p n b u
  6879. x x x x x
  6880. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6881. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6882. x x x x x
  6883. Output frames:
  6884. 2 2 2 1 2
  6885. 2 1 3 2 2
  6886. @end example
  6887. @subsection Examples
  6888. Simple IVTC of a top field first telecined stream:
  6889. @example
  6890. fieldmatch=order=tff:combmatch=none, decimate
  6891. @end example
  6892. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6893. @example
  6894. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6895. @end example
  6896. @section fieldorder
  6897. Transform the field order of the input video.
  6898. It accepts the following parameters:
  6899. @table @option
  6900. @item order
  6901. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6902. for bottom field first.
  6903. @end table
  6904. The default value is @samp{tff}.
  6905. The transformation is done by shifting the picture content up or down
  6906. by one line, and filling the remaining line with appropriate picture content.
  6907. This method is consistent with most broadcast field order converters.
  6908. If the input video is not flagged as being interlaced, or it is already
  6909. flagged as being of the required output field order, then this filter does
  6910. not alter the incoming video.
  6911. It is very useful when converting to or from PAL DV material,
  6912. which is bottom field first.
  6913. For example:
  6914. @example
  6915. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6916. @end example
  6917. @section fifo, afifo
  6918. Buffer input images and send them when they are requested.
  6919. It is mainly useful when auto-inserted by the libavfilter
  6920. framework.
  6921. It does not take parameters.
  6922. @section fillborders
  6923. Fill borders of the input video, without changing video stream dimensions.
  6924. Sometimes video can have garbage at the four edges and you may not want to
  6925. crop video input to keep size multiple of some number.
  6926. This filter accepts the following options:
  6927. @table @option
  6928. @item left
  6929. Number of pixels to fill from left border.
  6930. @item right
  6931. Number of pixels to fill from right border.
  6932. @item top
  6933. Number of pixels to fill from top border.
  6934. @item bottom
  6935. Number of pixels to fill from bottom border.
  6936. @item mode
  6937. Set fill mode.
  6938. It accepts the following values:
  6939. @table @samp
  6940. @item smear
  6941. fill pixels using outermost pixels
  6942. @item mirror
  6943. fill pixels using mirroring
  6944. @item fixed
  6945. fill pixels with constant value
  6946. @end table
  6947. Default is @var{smear}.
  6948. @item color
  6949. Set color for pixels in fixed mode. Default is @var{black}.
  6950. @end table
  6951. @section find_rect
  6952. Find a rectangular object
  6953. It accepts the following options:
  6954. @table @option
  6955. @item object
  6956. Filepath of the object image, needs to be in gray8.
  6957. @item threshold
  6958. Detection threshold, default is 0.5.
  6959. @item mipmaps
  6960. Number of mipmaps, default is 3.
  6961. @item xmin, ymin, xmax, ymax
  6962. Specifies the rectangle in which to search.
  6963. @end table
  6964. @subsection Examples
  6965. @itemize
  6966. @item
  6967. Generate a representative palette of a given video using @command{ffmpeg}:
  6968. @example
  6969. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6970. @end example
  6971. @end itemize
  6972. @section cover_rect
  6973. Cover a rectangular object
  6974. It accepts the following options:
  6975. @table @option
  6976. @item cover
  6977. Filepath of the optional cover image, needs to be in yuv420.
  6978. @item mode
  6979. Set covering mode.
  6980. It accepts the following values:
  6981. @table @samp
  6982. @item cover
  6983. cover it by the supplied image
  6984. @item blur
  6985. cover it by interpolating the surrounding pixels
  6986. @end table
  6987. Default value is @var{blur}.
  6988. @end table
  6989. @subsection Examples
  6990. @itemize
  6991. @item
  6992. Generate a representative palette of a given video using @command{ffmpeg}:
  6993. @example
  6994. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6995. @end example
  6996. @end itemize
  6997. @section floodfill
  6998. Flood area with values of same pixel components with another values.
  6999. It accepts the following options:
  7000. @table @option
  7001. @item x
  7002. Set pixel x coordinate.
  7003. @item y
  7004. Set pixel y coordinate.
  7005. @item s0
  7006. Set source #0 component value.
  7007. @item s1
  7008. Set source #1 component value.
  7009. @item s2
  7010. Set source #2 component value.
  7011. @item s3
  7012. Set source #3 component value.
  7013. @item d0
  7014. Set destination #0 component value.
  7015. @item d1
  7016. Set destination #1 component value.
  7017. @item d2
  7018. Set destination #2 component value.
  7019. @item d3
  7020. Set destination #3 component value.
  7021. @end table
  7022. @anchor{format}
  7023. @section format
  7024. Convert the input video to one of the specified pixel formats.
  7025. Libavfilter will try to pick one that is suitable as input to
  7026. the next filter.
  7027. It accepts the following parameters:
  7028. @table @option
  7029. @item pix_fmts
  7030. A '|'-separated list of pixel format names, such as
  7031. "pix_fmts=yuv420p|monow|rgb24".
  7032. @end table
  7033. @subsection Examples
  7034. @itemize
  7035. @item
  7036. Convert the input video to the @var{yuv420p} format
  7037. @example
  7038. format=pix_fmts=yuv420p
  7039. @end example
  7040. Convert the input video to any of the formats in the list
  7041. @example
  7042. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7043. @end example
  7044. @end itemize
  7045. @anchor{fps}
  7046. @section fps
  7047. Convert the video to specified constant frame rate by duplicating or dropping
  7048. frames as necessary.
  7049. It accepts the following parameters:
  7050. @table @option
  7051. @item fps
  7052. The desired output frame rate. The default is @code{25}.
  7053. @item start_time
  7054. Assume the first PTS should be the given value, in seconds. This allows for
  7055. padding/trimming at the start of stream. By default, no assumption is made
  7056. about the first frame's expected PTS, so no padding or trimming is done.
  7057. For example, this could be set to 0 to pad the beginning with duplicates of
  7058. the first frame if a video stream starts after the audio stream or to trim any
  7059. frames with a negative PTS.
  7060. @item round
  7061. Timestamp (PTS) rounding method.
  7062. Possible values are:
  7063. @table @option
  7064. @item zero
  7065. round towards 0
  7066. @item inf
  7067. round away from 0
  7068. @item down
  7069. round towards -infinity
  7070. @item up
  7071. round towards +infinity
  7072. @item near
  7073. round to nearest
  7074. @end table
  7075. The default is @code{near}.
  7076. @item eof_action
  7077. Action performed when reading the last frame.
  7078. Possible values are:
  7079. @table @option
  7080. @item round
  7081. Use same timestamp rounding method as used for other frames.
  7082. @item pass
  7083. Pass through last frame if input duration has not been reached yet.
  7084. @end table
  7085. The default is @code{round}.
  7086. @end table
  7087. Alternatively, the options can be specified as a flat string:
  7088. @var{fps}[:@var{start_time}[:@var{round}]].
  7089. See also the @ref{setpts} filter.
  7090. @subsection Examples
  7091. @itemize
  7092. @item
  7093. A typical usage in order to set the fps to 25:
  7094. @example
  7095. fps=fps=25
  7096. @end example
  7097. @item
  7098. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7099. @example
  7100. fps=fps=film:round=near
  7101. @end example
  7102. @end itemize
  7103. @section framepack
  7104. Pack two different video streams into a stereoscopic video, setting proper
  7105. metadata on supported codecs. The two views should have the same size and
  7106. framerate and processing will stop when the shorter video ends. Please note
  7107. that you may conveniently adjust view properties with the @ref{scale} and
  7108. @ref{fps} filters.
  7109. It accepts the following parameters:
  7110. @table @option
  7111. @item format
  7112. The desired packing format. Supported values are:
  7113. @table @option
  7114. @item sbs
  7115. The views are next to each other (default).
  7116. @item tab
  7117. The views are on top of each other.
  7118. @item lines
  7119. The views are packed by line.
  7120. @item columns
  7121. The views are packed by column.
  7122. @item frameseq
  7123. The views are temporally interleaved.
  7124. @end table
  7125. @end table
  7126. Some examples:
  7127. @example
  7128. # Convert left and right views into a frame-sequential video
  7129. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7130. # Convert views into a side-by-side video with the same output resolution as the input
  7131. 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
  7132. @end example
  7133. @section framerate
  7134. Change the frame rate by interpolating new video output frames from the source
  7135. frames.
  7136. This filter is not designed to function correctly with interlaced media. If
  7137. you wish to change the frame rate of interlaced media then you are required
  7138. to deinterlace before this filter and re-interlace after this filter.
  7139. A description of the accepted options follows.
  7140. @table @option
  7141. @item fps
  7142. Specify the output frames per second. This option can also be specified
  7143. as a value alone. The default is @code{50}.
  7144. @item interp_start
  7145. Specify the start of a range where the output frame will be created as a
  7146. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7147. the default is @code{15}.
  7148. @item interp_end
  7149. Specify the end of a range where the output frame will be created as a
  7150. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7151. the default is @code{240}.
  7152. @item scene
  7153. Specify the level at which a scene change is detected as a value between
  7154. 0 and 100 to indicate a new scene; a low value reflects a low
  7155. probability for the current frame to introduce a new scene, while a higher
  7156. value means the current frame is more likely to be one.
  7157. The default is @code{8.2}.
  7158. @item flags
  7159. Specify flags influencing the filter process.
  7160. Available value for @var{flags} is:
  7161. @table @option
  7162. @item scene_change_detect, scd
  7163. Enable scene change detection using the value of the option @var{scene}.
  7164. This flag is enabled by default.
  7165. @end table
  7166. @end table
  7167. @section framestep
  7168. Select one frame every N-th frame.
  7169. This filter accepts the following option:
  7170. @table @option
  7171. @item step
  7172. Select frame after every @code{step} frames.
  7173. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7174. @end table
  7175. @anchor{frei0r}
  7176. @section frei0r
  7177. Apply a frei0r effect to the input video.
  7178. To enable the compilation of this filter, you need to install the frei0r
  7179. header and configure FFmpeg with @code{--enable-frei0r}.
  7180. It accepts the following parameters:
  7181. @table @option
  7182. @item filter_name
  7183. The name of the frei0r effect to load. If the environment variable
  7184. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7185. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7186. Otherwise, the standard frei0r paths are searched, in this order:
  7187. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7188. @file{/usr/lib/frei0r-1/}.
  7189. @item filter_params
  7190. A '|'-separated list of parameters to pass to the frei0r effect.
  7191. @end table
  7192. A frei0r effect parameter can be a boolean (its value is either
  7193. "y" or "n"), a double, a color (specified as
  7194. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7195. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7196. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7197. a position (specified as @var{X}/@var{Y}, where
  7198. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7199. The number and types of parameters depend on the loaded effect. If an
  7200. effect parameter is not specified, the default value is set.
  7201. @subsection Examples
  7202. @itemize
  7203. @item
  7204. Apply the distort0r effect, setting the first two double parameters:
  7205. @example
  7206. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7207. @end example
  7208. @item
  7209. Apply the colordistance effect, taking a color as the first parameter:
  7210. @example
  7211. frei0r=colordistance:0.2/0.3/0.4
  7212. frei0r=colordistance:violet
  7213. frei0r=colordistance:0x112233
  7214. @end example
  7215. @item
  7216. Apply the perspective effect, specifying the top left and top right image
  7217. positions:
  7218. @example
  7219. frei0r=perspective:0.2/0.2|0.8/0.2
  7220. @end example
  7221. @end itemize
  7222. For more information, see
  7223. @url{http://frei0r.dyne.org}
  7224. @section fspp
  7225. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7226. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7227. processing filter, one of them is performed once per block, not per pixel.
  7228. This allows for much higher speed.
  7229. The filter accepts the following options:
  7230. @table @option
  7231. @item quality
  7232. Set quality. This option defines the number of levels for averaging. It accepts
  7233. an integer in the range 4-5. Default value is @code{4}.
  7234. @item qp
  7235. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7236. If not set, the filter will use the QP from the video stream (if available).
  7237. @item strength
  7238. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7239. more details but also more artifacts, while higher values make the image smoother
  7240. but also blurrier. Default value is @code{0} − PSNR optimal.
  7241. @item use_bframe_qp
  7242. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7243. option may cause flicker since the B-Frames have often larger QP. Default is
  7244. @code{0} (not enabled).
  7245. @end table
  7246. @section gblur
  7247. Apply Gaussian blur filter.
  7248. The filter accepts the following options:
  7249. @table @option
  7250. @item sigma
  7251. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7252. @item steps
  7253. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7254. @item planes
  7255. Set which planes to filter. By default all planes are filtered.
  7256. @item sigmaV
  7257. Set vertical sigma, if negative it will be same as @code{sigma}.
  7258. Default is @code{-1}.
  7259. @end table
  7260. @section geq
  7261. The filter accepts the following options:
  7262. @table @option
  7263. @item lum_expr, lum
  7264. Set the luminance expression.
  7265. @item cb_expr, cb
  7266. Set the chrominance blue expression.
  7267. @item cr_expr, cr
  7268. Set the chrominance red expression.
  7269. @item alpha_expr, a
  7270. Set the alpha expression.
  7271. @item red_expr, r
  7272. Set the red expression.
  7273. @item green_expr, g
  7274. Set the green expression.
  7275. @item blue_expr, b
  7276. Set the blue expression.
  7277. @end table
  7278. The colorspace is selected according to the specified options. If one
  7279. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7280. options is specified, the filter will automatically select a YCbCr
  7281. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7282. @option{blue_expr} options is specified, it will select an RGB
  7283. colorspace.
  7284. If one of the chrominance expression is not defined, it falls back on the other
  7285. one. If no alpha expression is specified it will evaluate to opaque value.
  7286. If none of chrominance expressions are specified, they will evaluate
  7287. to the luminance expression.
  7288. The expressions can use the following variables and functions:
  7289. @table @option
  7290. @item N
  7291. The sequential number of the filtered frame, starting from @code{0}.
  7292. @item X
  7293. @item Y
  7294. The coordinates of the current sample.
  7295. @item W
  7296. @item H
  7297. The width and height of the image.
  7298. @item SW
  7299. @item SH
  7300. Width and height scale depending on the currently filtered plane. It is the
  7301. ratio between the corresponding luma plane number of pixels and the current
  7302. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7303. @code{0.5,0.5} for chroma planes.
  7304. @item T
  7305. Time of the current frame, expressed in seconds.
  7306. @item p(x, y)
  7307. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7308. plane.
  7309. @item lum(x, y)
  7310. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7311. plane.
  7312. @item cb(x, y)
  7313. Return the value of the pixel at location (@var{x},@var{y}) of the
  7314. blue-difference chroma plane. Return 0 if there is no such plane.
  7315. @item cr(x, y)
  7316. Return the value of the pixel at location (@var{x},@var{y}) of the
  7317. red-difference chroma plane. Return 0 if there is no such plane.
  7318. @item r(x, y)
  7319. @item g(x, y)
  7320. @item b(x, y)
  7321. Return the value of the pixel at location (@var{x},@var{y}) of the
  7322. red/green/blue component. Return 0 if there is no such component.
  7323. @item alpha(x, y)
  7324. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7325. plane. Return 0 if there is no such plane.
  7326. @end table
  7327. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7328. automatically clipped to the closer edge.
  7329. @subsection Examples
  7330. @itemize
  7331. @item
  7332. Flip the image horizontally:
  7333. @example
  7334. geq=p(W-X\,Y)
  7335. @end example
  7336. @item
  7337. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7338. wavelength of 100 pixels:
  7339. @example
  7340. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7341. @end example
  7342. @item
  7343. Generate a fancy enigmatic moving light:
  7344. @example
  7345. 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
  7346. @end example
  7347. @item
  7348. Generate a quick emboss effect:
  7349. @example
  7350. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7351. @end example
  7352. @item
  7353. Modify RGB components depending on pixel position:
  7354. @example
  7355. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7356. @end example
  7357. @item
  7358. Create a radial gradient that is the same size as the input (also see
  7359. the @ref{vignette} filter):
  7360. @example
  7361. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7362. @end example
  7363. @end itemize
  7364. @section gradfun
  7365. Fix the banding artifacts that are sometimes introduced into nearly flat
  7366. regions by truncation to 8-bit color depth.
  7367. Interpolate the gradients that should go where the bands are, and
  7368. dither them.
  7369. It is designed for playback only. Do not use it prior to
  7370. lossy compression, because compression tends to lose the dither and
  7371. bring back the bands.
  7372. It accepts the following parameters:
  7373. @table @option
  7374. @item strength
  7375. The maximum amount by which the filter will change any one pixel. This is also
  7376. the threshold for detecting nearly flat regions. Acceptable values range from
  7377. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7378. valid range.
  7379. @item radius
  7380. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7381. gradients, but also prevents the filter from modifying the pixels near detailed
  7382. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7383. values will be clipped to the valid range.
  7384. @end table
  7385. Alternatively, the options can be specified as a flat string:
  7386. @var{strength}[:@var{radius}]
  7387. @subsection Examples
  7388. @itemize
  7389. @item
  7390. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7391. @example
  7392. gradfun=3.5:8
  7393. @end example
  7394. @item
  7395. Specify radius, omitting the strength (which will fall-back to the default
  7396. value):
  7397. @example
  7398. gradfun=radius=8
  7399. @end example
  7400. @end itemize
  7401. @anchor{haldclut}
  7402. @section haldclut
  7403. Apply a Hald CLUT to a video stream.
  7404. First input is the video stream to process, and second one is the Hald CLUT.
  7405. The Hald CLUT input can be a simple picture or a complete video stream.
  7406. The filter accepts the following options:
  7407. @table @option
  7408. @item shortest
  7409. Force termination when the shortest input terminates. Default is @code{0}.
  7410. @item repeatlast
  7411. Continue applying the last CLUT after the end of the stream. A value of
  7412. @code{0} disable the filter after the last frame of the CLUT is reached.
  7413. Default is @code{1}.
  7414. @end table
  7415. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7416. filters share the same internals).
  7417. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7418. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7419. @subsection Workflow examples
  7420. @subsubsection Hald CLUT video stream
  7421. Generate an identity Hald CLUT stream altered with various effects:
  7422. @example
  7423. 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
  7424. @end example
  7425. Note: make sure you use a lossless codec.
  7426. Then use it with @code{haldclut} to apply it on some random stream:
  7427. @example
  7428. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7429. @end example
  7430. The Hald CLUT will be applied to the 10 first seconds (duration of
  7431. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7432. to the remaining frames of the @code{mandelbrot} stream.
  7433. @subsubsection Hald CLUT with preview
  7434. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7435. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7436. biggest possible square starting at the top left of the picture. The remaining
  7437. padding pixels (bottom or right) will be ignored. This area can be used to add
  7438. a preview of the Hald CLUT.
  7439. Typically, the following generated Hald CLUT will be supported by the
  7440. @code{haldclut} filter:
  7441. @example
  7442. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7443. pad=iw+320 [padded_clut];
  7444. smptebars=s=320x256, split [a][b];
  7445. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7446. [main][b] overlay=W-320" -frames:v 1 clut.png
  7447. @end example
  7448. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7449. bars are displayed on the right-top, and below the same color bars processed by
  7450. the color changes.
  7451. Then, the effect of this Hald CLUT can be visualized with:
  7452. @example
  7453. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7454. @end example
  7455. @section hflip
  7456. Flip the input video horizontally.
  7457. For example, to horizontally flip the input video with @command{ffmpeg}:
  7458. @example
  7459. ffmpeg -i in.avi -vf "hflip" out.avi
  7460. @end example
  7461. @section histeq
  7462. This filter applies a global color histogram equalization on a
  7463. per-frame basis.
  7464. It can be used to correct video that has a compressed range of pixel
  7465. intensities. The filter redistributes the pixel intensities to
  7466. equalize their distribution across the intensity range. It may be
  7467. viewed as an "automatically adjusting contrast filter". This filter is
  7468. useful only for correcting degraded or poorly captured source
  7469. video.
  7470. The filter accepts the following options:
  7471. @table @option
  7472. @item strength
  7473. Determine the amount of equalization to be applied. As the strength
  7474. is reduced, the distribution of pixel intensities more-and-more
  7475. approaches that of the input frame. The value must be a float number
  7476. in the range [0,1] and defaults to 0.200.
  7477. @item intensity
  7478. Set the maximum intensity that can generated and scale the output
  7479. values appropriately. The strength should be set as desired and then
  7480. the intensity can be limited if needed to avoid washing-out. The value
  7481. must be a float number in the range [0,1] and defaults to 0.210.
  7482. @item antibanding
  7483. Set the antibanding level. If enabled the filter will randomly vary
  7484. the luminance of output pixels by a small amount to avoid banding of
  7485. the histogram. Possible values are @code{none}, @code{weak} or
  7486. @code{strong}. It defaults to @code{none}.
  7487. @end table
  7488. @section histogram
  7489. Compute and draw a color distribution histogram for the input video.
  7490. The computed histogram is a representation of the color component
  7491. distribution in an image.
  7492. Standard histogram displays the color components distribution in an image.
  7493. Displays color graph for each color component. Shows distribution of
  7494. the Y, U, V, A or R, G, B components, depending on input format, in the
  7495. current frame. Below each graph a color component scale meter is shown.
  7496. The filter accepts the following options:
  7497. @table @option
  7498. @item level_height
  7499. Set height of level. Default value is @code{200}.
  7500. Allowed range is [50, 2048].
  7501. @item scale_height
  7502. Set height of color scale. Default value is @code{12}.
  7503. Allowed range is [0, 40].
  7504. @item display_mode
  7505. Set display mode.
  7506. It accepts the following values:
  7507. @table @samp
  7508. @item stack
  7509. Per color component graphs are placed below each other.
  7510. @item parade
  7511. Per color component graphs are placed side by side.
  7512. @item overlay
  7513. Presents information identical to that in the @code{parade}, except
  7514. that the graphs representing color components are superimposed directly
  7515. over one another.
  7516. @end table
  7517. Default is @code{stack}.
  7518. @item levels_mode
  7519. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7520. Default is @code{linear}.
  7521. @item components
  7522. Set what color components to display.
  7523. Default is @code{7}.
  7524. @item fgopacity
  7525. Set foreground opacity. Default is @code{0.7}.
  7526. @item bgopacity
  7527. Set background opacity. Default is @code{0.5}.
  7528. @end table
  7529. @subsection Examples
  7530. @itemize
  7531. @item
  7532. Calculate and draw histogram:
  7533. @example
  7534. ffplay -i input -vf histogram
  7535. @end example
  7536. @end itemize
  7537. @anchor{hqdn3d}
  7538. @section hqdn3d
  7539. This is a high precision/quality 3d denoise filter. It aims to reduce
  7540. image noise, producing smooth images and making still images really
  7541. still. It should enhance compressibility.
  7542. It accepts the following optional parameters:
  7543. @table @option
  7544. @item luma_spatial
  7545. A non-negative floating point number which specifies spatial luma strength.
  7546. It defaults to 4.0.
  7547. @item chroma_spatial
  7548. A non-negative floating point number which specifies spatial chroma strength.
  7549. It defaults to 3.0*@var{luma_spatial}/4.0.
  7550. @item luma_tmp
  7551. A floating point number which specifies luma temporal strength. It defaults to
  7552. 6.0*@var{luma_spatial}/4.0.
  7553. @item chroma_tmp
  7554. A floating point number which specifies chroma temporal strength. It defaults to
  7555. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7556. @end table
  7557. @section hwdownload
  7558. Download hardware frames to system memory.
  7559. The input must be in hardware frames, and the output a non-hardware format.
  7560. Not all formats will be supported on the output - it may be necessary to insert
  7561. an additional @option{format} filter immediately following in the graph to get
  7562. the output in a supported format.
  7563. @section hwmap
  7564. Map hardware frames to system memory or to another device.
  7565. This filter has several different modes of operation; which one is used depends
  7566. on the input and output formats:
  7567. @itemize
  7568. @item
  7569. Hardware frame input, normal frame output
  7570. Map the input frames to system memory and pass them to the output. If the
  7571. original hardware frame is later required (for example, after overlaying
  7572. something else on part of it), the @option{hwmap} filter can be used again
  7573. in the next mode to retrieve it.
  7574. @item
  7575. Normal frame input, hardware frame output
  7576. If the input is actually a software-mapped hardware frame, then unmap it -
  7577. that is, return the original hardware frame.
  7578. Otherwise, a device must be provided. Create new hardware surfaces on that
  7579. device for the output, then map them back to the software format at the input
  7580. and give those frames to the preceding filter. This will then act like the
  7581. @option{hwupload} filter, but may be able to avoid an additional copy when
  7582. the input is already in a compatible format.
  7583. @item
  7584. Hardware frame input and output
  7585. A device must be supplied for the output, either directly or with the
  7586. @option{derive_device} option. The input and output devices must be of
  7587. different types and compatible - the exact meaning of this is
  7588. system-dependent, but typically it means that they must refer to the same
  7589. underlying hardware context (for example, refer to the same graphics card).
  7590. If the input frames were originally created on the output device, then unmap
  7591. to retrieve the original frames.
  7592. Otherwise, map the frames to the output device - create new hardware frames
  7593. on the output corresponding to the frames on the input.
  7594. @end itemize
  7595. The following additional parameters are accepted:
  7596. @table @option
  7597. @item mode
  7598. Set the frame mapping mode. Some combination of:
  7599. @table @var
  7600. @item read
  7601. The mapped frame should be readable.
  7602. @item write
  7603. The mapped frame should be writeable.
  7604. @item overwrite
  7605. The mapping will always overwrite the entire frame.
  7606. This may improve performance in some cases, as the original contents of the
  7607. frame need not be loaded.
  7608. @item direct
  7609. The mapping must not involve any copying.
  7610. Indirect mappings to copies of frames are created in some cases where either
  7611. direct mapping is not possible or it would have unexpected properties.
  7612. Setting this flag ensures that the mapping is direct and will fail if that is
  7613. not possible.
  7614. @end table
  7615. Defaults to @var{read+write} if not specified.
  7616. @item derive_device @var{type}
  7617. Rather than using the device supplied at initialisation, instead derive a new
  7618. device of type @var{type} from the device the input frames exist on.
  7619. @item reverse
  7620. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7621. and map them back to the source. This may be necessary in some cases where
  7622. a mapping in one direction is required but only the opposite direction is
  7623. supported by the devices being used.
  7624. This option is dangerous - it may break the preceding filter in undefined
  7625. ways if there are any additional constraints on that filter's output.
  7626. Do not use it without fully understanding the implications of its use.
  7627. @end table
  7628. @section hwupload
  7629. Upload system memory frames to hardware surfaces.
  7630. The device to upload to must be supplied when the filter is initialised. If
  7631. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7632. option.
  7633. @anchor{hwupload_cuda}
  7634. @section hwupload_cuda
  7635. Upload system memory frames to a CUDA device.
  7636. It accepts the following optional parameters:
  7637. @table @option
  7638. @item device
  7639. The number of the CUDA device to use
  7640. @end table
  7641. @section hqx
  7642. Apply a high-quality magnification filter designed for pixel art. This filter
  7643. was originally created by Maxim Stepin.
  7644. It accepts the following option:
  7645. @table @option
  7646. @item n
  7647. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7648. @code{hq3x} and @code{4} for @code{hq4x}.
  7649. Default is @code{3}.
  7650. @end table
  7651. @section hstack
  7652. Stack input videos horizontally.
  7653. All streams must be of same pixel format and of same height.
  7654. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7655. to create same output.
  7656. The filter accept the following option:
  7657. @table @option
  7658. @item inputs
  7659. Set number of input streams. Default is 2.
  7660. @item shortest
  7661. If set to 1, force the output to terminate when the shortest input
  7662. terminates. Default value is 0.
  7663. @end table
  7664. @section hue
  7665. Modify the hue and/or the saturation of the input.
  7666. It accepts the following parameters:
  7667. @table @option
  7668. @item h
  7669. Specify the hue angle as a number of degrees. It accepts an expression,
  7670. and defaults to "0".
  7671. @item s
  7672. Specify the saturation in the [-10,10] range. It accepts an expression and
  7673. defaults to "1".
  7674. @item H
  7675. Specify the hue angle as a number of radians. It accepts an
  7676. expression, and defaults to "0".
  7677. @item b
  7678. Specify the brightness in the [-10,10] range. It accepts an expression and
  7679. defaults to "0".
  7680. @end table
  7681. @option{h} and @option{H} are mutually exclusive, and can't be
  7682. specified at the same time.
  7683. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7684. expressions containing the following constants:
  7685. @table @option
  7686. @item n
  7687. frame count of the input frame starting from 0
  7688. @item pts
  7689. presentation timestamp of the input frame expressed in time base units
  7690. @item r
  7691. frame rate of the input video, NAN if the input frame rate is unknown
  7692. @item t
  7693. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7694. @item tb
  7695. time base of the input video
  7696. @end table
  7697. @subsection Examples
  7698. @itemize
  7699. @item
  7700. Set the hue to 90 degrees and the saturation to 1.0:
  7701. @example
  7702. hue=h=90:s=1
  7703. @end example
  7704. @item
  7705. Same command but expressing the hue in radians:
  7706. @example
  7707. hue=H=PI/2:s=1
  7708. @end example
  7709. @item
  7710. Rotate hue and make the saturation swing between 0
  7711. and 2 over a period of 1 second:
  7712. @example
  7713. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7714. @end example
  7715. @item
  7716. Apply a 3 seconds saturation fade-in effect starting at 0:
  7717. @example
  7718. hue="s=min(t/3\,1)"
  7719. @end example
  7720. The general fade-in expression can be written as:
  7721. @example
  7722. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7723. @end example
  7724. @item
  7725. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7726. @example
  7727. hue="s=max(0\, min(1\, (8-t)/3))"
  7728. @end example
  7729. The general fade-out expression can be written as:
  7730. @example
  7731. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7732. @end example
  7733. @end itemize
  7734. @subsection Commands
  7735. This filter supports the following commands:
  7736. @table @option
  7737. @item b
  7738. @item s
  7739. @item h
  7740. @item H
  7741. Modify the hue and/or the saturation and/or brightness of the input video.
  7742. The command accepts the same syntax of the corresponding option.
  7743. If the specified expression is not valid, it is kept at its current
  7744. value.
  7745. @end table
  7746. @section hysteresis
  7747. Grow first stream into second stream by connecting components.
  7748. This makes it possible to build more robust edge masks.
  7749. This filter accepts the following options:
  7750. @table @option
  7751. @item planes
  7752. Set which planes will be processed as bitmap, unprocessed planes will be
  7753. copied from first stream.
  7754. By default value 0xf, all planes will be processed.
  7755. @item threshold
  7756. Set threshold which is used in filtering. If pixel component value is higher than
  7757. this value filter algorithm for connecting components is activated.
  7758. By default value is 0.
  7759. @end table
  7760. @section idet
  7761. Detect video interlacing type.
  7762. This filter tries to detect if the input frames are interlaced, progressive,
  7763. top or bottom field first. It will also try to detect fields that are
  7764. repeated between adjacent frames (a sign of telecine).
  7765. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7766. Multiple frame detection incorporates the classification history of previous frames.
  7767. The filter will log these metadata values:
  7768. @table @option
  7769. @item single.current_frame
  7770. Detected type of current frame using single-frame detection. One of:
  7771. ``tff'' (top field first), ``bff'' (bottom field first),
  7772. ``progressive'', or ``undetermined''
  7773. @item single.tff
  7774. Cumulative number of frames detected as top field first using single-frame detection.
  7775. @item multiple.tff
  7776. Cumulative number of frames detected as top field first using multiple-frame detection.
  7777. @item single.bff
  7778. Cumulative number of frames detected as bottom field first using single-frame detection.
  7779. @item multiple.current_frame
  7780. Detected type of current frame using multiple-frame detection. One of:
  7781. ``tff'' (top field first), ``bff'' (bottom field first),
  7782. ``progressive'', or ``undetermined''
  7783. @item multiple.bff
  7784. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7785. @item single.progressive
  7786. Cumulative number of frames detected as progressive using single-frame detection.
  7787. @item multiple.progressive
  7788. Cumulative number of frames detected as progressive using multiple-frame detection.
  7789. @item single.undetermined
  7790. Cumulative number of frames that could not be classified using single-frame detection.
  7791. @item multiple.undetermined
  7792. Cumulative number of frames that could not be classified using multiple-frame detection.
  7793. @item repeated.current_frame
  7794. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7795. @item repeated.neither
  7796. Cumulative number of frames with no repeated field.
  7797. @item repeated.top
  7798. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7799. @item repeated.bottom
  7800. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7801. @end table
  7802. The filter accepts the following options:
  7803. @table @option
  7804. @item intl_thres
  7805. Set interlacing threshold.
  7806. @item prog_thres
  7807. Set progressive threshold.
  7808. @item rep_thres
  7809. Threshold for repeated field detection.
  7810. @item half_life
  7811. Number of frames after which a given frame's contribution to the
  7812. statistics is halved (i.e., it contributes only 0.5 to its
  7813. classification). The default of 0 means that all frames seen are given
  7814. full weight of 1.0 forever.
  7815. @item analyze_interlaced_flag
  7816. When this is not 0 then idet will use the specified number of frames to determine
  7817. if the interlaced flag is accurate, it will not count undetermined frames.
  7818. If the flag is found to be accurate it will be used without any further
  7819. computations, if it is found to be inaccurate it will be cleared without any
  7820. further computations. This allows inserting the idet filter as a low computational
  7821. method to clean up the interlaced flag
  7822. @end table
  7823. @section il
  7824. Deinterleave or interleave fields.
  7825. This filter allows one to process interlaced images fields without
  7826. deinterlacing them. Deinterleaving splits the input frame into 2
  7827. fields (so called half pictures). Odd lines are moved to the top
  7828. half of the output image, even lines to the bottom half.
  7829. You can process (filter) them independently and then re-interleave them.
  7830. The filter accepts the following options:
  7831. @table @option
  7832. @item luma_mode, l
  7833. @item chroma_mode, c
  7834. @item alpha_mode, a
  7835. Available values for @var{luma_mode}, @var{chroma_mode} and
  7836. @var{alpha_mode} are:
  7837. @table @samp
  7838. @item none
  7839. Do nothing.
  7840. @item deinterleave, d
  7841. Deinterleave fields, placing one above the other.
  7842. @item interleave, i
  7843. Interleave fields. Reverse the effect of deinterleaving.
  7844. @end table
  7845. Default value is @code{none}.
  7846. @item luma_swap, ls
  7847. @item chroma_swap, cs
  7848. @item alpha_swap, as
  7849. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7850. @end table
  7851. @section inflate
  7852. Apply inflate effect to the video.
  7853. This filter replaces the pixel by the local(3x3) average by taking into account
  7854. only values higher than the pixel.
  7855. It accepts the following options:
  7856. @table @option
  7857. @item threshold0
  7858. @item threshold1
  7859. @item threshold2
  7860. @item threshold3
  7861. Limit the maximum change for each plane, default is 65535.
  7862. If 0, plane will remain unchanged.
  7863. @end table
  7864. @section interlace
  7865. Simple interlacing filter from progressive contents. This interleaves upper (or
  7866. lower) lines from odd frames with lower (or upper) lines from even frames,
  7867. halving the frame rate and preserving image height.
  7868. @example
  7869. Original Original New Frame
  7870. Frame 'j' Frame 'j+1' (tff)
  7871. ========== =========== ==================
  7872. Line 0 --------------------> Frame 'j' Line 0
  7873. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7874. Line 2 ---------------------> Frame 'j' Line 2
  7875. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7876. ... ... ...
  7877. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7878. @end example
  7879. It accepts the following optional parameters:
  7880. @table @option
  7881. @item scan
  7882. This determines whether the interlaced frame is taken from the even
  7883. (tff - default) or odd (bff) lines of the progressive frame.
  7884. @item lowpass
  7885. Vertical lowpass filter to avoid twitter interlacing and
  7886. reduce moire patterns.
  7887. @table @samp
  7888. @item 0, off
  7889. Disable vertical lowpass filter
  7890. @item 1, linear
  7891. Enable linear filter (default)
  7892. @item 2, complex
  7893. Enable complex filter. This will slightly less reduce twitter and moire
  7894. but better retain detail and subjective sharpness impression.
  7895. @end table
  7896. @end table
  7897. @section kerndeint
  7898. Deinterlace input video by applying Donald Graft's adaptive kernel
  7899. deinterling. Work on interlaced parts of a video to produce
  7900. progressive frames.
  7901. The description of the accepted parameters follows.
  7902. @table @option
  7903. @item thresh
  7904. Set the threshold which affects the filter's tolerance when
  7905. determining if a pixel line must be processed. It must be an integer
  7906. in the range [0,255] and defaults to 10. A value of 0 will result in
  7907. applying the process on every pixels.
  7908. @item map
  7909. Paint pixels exceeding the threshold value to white if set to 1.
  7910. Default is 0.
  7911. @item order
  7912. Set the fields order. Swap fields if set to 1, leave fields alone if
  7913. 0. Default is 0.
  7914. @item sharp
  7915. Enable additional sharpening if set to 1. Default is 0.
  7916. @item twoway
  7917. Enable twoway sharpening if set to 1. Default is 0.
  7918. @end table
  7919. @subsection Examples
  7920. @itemize
  7921. @item
  7922. Apply default values:
  7923. @example
  7924. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7925. @end example
  7926. @item
  7927. Enable additional sharpening:
  7928. @example
  7929. kerndeint=sharp=1
  7930. @end example
  7931. @item
  7932. Paint processed pixels in white:
  7933. @example
  7934. kerndeint=map=1
  7935. @end example
  7936. @end itemize
  7937. @section lenscorrection
  7938. Correct radial lens distortion
  7939. This filter can be used to correct for radial distortion as can result from the use
  7940. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7941. one can use tools available for example as part of opencv or simply trial-and-error.
  7942. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7943. and extract the k1 and k2 coefficients from the resulting matrix.
  7944. Note that effectively the same filter is available in the open-source tools Krita and
  7945. Digikam from the KDE project.
  7946. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7947. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7948. brightness distribution, so you may want to use both filters together in certain
  7949. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7950. be applied before or after lens correction.
  7951. @subsection Options
  7952. The filter accepts the following options:
  7953. @table @option
  7954. @item cx
  7955. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7956. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7957. width. Default is 0.5.
  7958. @item cy
  7959. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7960. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7961. height. Default is 0.5.
  7962. @item k1
  7963. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  7964. no correction. Default is 0.
  7965. @item k2
  7966. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  7967. 0 means no correction. Default is 0.
  7968. @end table
  7969. The formula that generates the correction is:
  7970. @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)
  7971. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7972. distances from the focal point in the source and target images, respectively.
  7973. @section libvmaf
  7974. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7975. score between two input videos.
  7976. The obtained VMAF score is printed through the logging system.
  7977. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7978. After installing the library it can be enabled using:
  7979. @code{./configure --enable-libvmaf}.
  7980. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7981. The filter has following options:
  7982. @table @option
  7983. @item model_path
  7984. Set the model path which is to be used for SVM.
  7985. Default value: @code{"vmaf_v0.6.1.pkl"}
  7986. @item log_path
  7987. Set the file path to be used to store logs.
  7988. @item log_fmt
  7989. Set the format of the log file (xml or json).
  7990. @item enable_transform
  7991. Enables transform for computing vmaf.
  7992. @item phone_model
  7993. Invokes the phone model which will generate VMAF scores higher than in the
  7994. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7995. @item psnr
  7996. Enables computing psnr along with vmaf.
  7997. @item ssim
  7998. Enables computing ssim along with vmaf.
  7999. @item ms_ssim
  8000. Enables computing ms_ssim along with vmaf.
  8001. @item pool
  8002. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8003. @end table
  8004. This filter also supports the @ref{framesync} options.
  8005. On the below examples the input file @file{main.mpg} being processed is
  8006. compared with the reference file @file{ref.mpg}.
  8007. @example
  8008. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8009. @end example
  8010. Example with options:
  8011. @example
  8012. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8013. @end example
  8014. @section limiter
  8015. Limits the pixel components values to the specified range [min, max].
  8016. The filter accepts the following options:
  8017. @table @option
  8018. @item min
  8019. Lower bound. Defaults to the lowest allowed value for the input.
  8020. @item max
  8021. Upper bound. Defaults to the highest allowed value for the input.
  8022. @item planes
  8023. Specify which planes will be processed. Defaults to all available.
  8024. @end table
  8025. @section loop
  8026. Loop video frames.
  8027. The filter accepts the following options:
  8028. @table @option
  8029. @item loop
  8030. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8031. Default is 0.
  8032. @item size
  8033. Set maximal size in number of frames. Default is 0.
  8034. @item start
  8035. Set first frame of loop. Default is 0.
  8036. @end table
  8037. @anchor{lut3d}
  8038. @section lut3d
  8039. Apply a 3D LUT to an input video.
  8040. The filter accepts the following options:
  8041. @table @option
  8042. @item file
  8043. Set the 3D LUT file name.
  8044. Currently supported formats:
  8045. @table @samp
  8046. @item 3dl
  8047. AfterEffects
  8048. @item cube
  8049. Iridas
  8050. @item dat
  8051. DaVinci
  8052. @item m3d
  8053. Pandora
  8054. @end table
  8055. @item interp
  8056. Select interpolation mode.
  8057. Available values are:
  8058. @table @samp
  8059. @item nearest
  8060. Use values from the nearest defined point.
  8061. @item trilinear
  8062. Interpolate values using the 8 points defining a cube.
  8063. @item tetrahedral
  8064. Interpolate values using a tetrahedron.
  8065. @end table
  8066. @end table
  8067. This filter also supports the @ref{framesync} options.
  8068. @section lumakey
  8069. Turn certain luma values into transparency.
  8070. The filter accepts the following options:
  8071. @table @option
  8072. @item threshold
  8073. Set the luma which will be used as base for transparency.
  8074. Default value is @code{0}.
  8075. @item tolerance
  8076. Set the range of luma values to be keyed out.
  8077. Default value is @code{0}.
  8078. @item softness
  8079. Set the range of softness. Default value is @code{0}.
  8080. Use this to control gradual transition from zero to full transparency.
  8081. @end table
  8082. @section lut, lutrgb, lutyuv
  8083. Compute a look-up table for binding each pixel component input value
  8084. to an output value, and apply it to the input video.
  8085. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8086. to an RGB input video.
  8087. These filters accept the following parameters:
  8088. @table @option
  8089. @item c0
  8090. set first pixel component expression
  8091. @item c1
  8092. set second pixel component expression
  8093. @item c2
  8094. set third pixel component expression
  8095. @item c3
  8096. set fourth pixel component expression, corresponds to the alpha component
  8097. @item r
  8098. set red component expression
  8099. @item g
  8100. set green component expression
  8101. @item b
  8102. set blue component expression
  8103. @item a
  8104. alpha component expression
  8105. @item y
  8106. set Y/luminance component expression
  8107. @item u
  8108. set U/Cb component expression
  8109. @item v
  8110. set V/Cr component expression
  8111. @end table
  8112. Each of them specifies the expression to use for computing the lookup table for
  8113. the corresponding pixel component values.
  8114. The exact component associated to each of the @var{c*} options depends on the
  8115. format in input.
  8116. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8117. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8118. The expressions can contain the following constants and functions:
  8119. @table @option
  8120. @item w
  8121. @item h
  8122. The input width and height.
  8123. @item val
  8124. The input value for the pixel component.
  8125. @item clipval
  8126. The input value, clipped to the @var{minval}-@var{maxval} range.
  8127. @item maxval
  8128. The maximum value for the pixel component.
  8129. @item minval
  8130. The minimum value for the pixel component.
  8131. @item negval
  8132. The negated value for the pixel component value, clipped to the
  8133. @var{minval}-@var{maxval} range; it corresponds to the expression
  8134. "maxval-clipval+minval".
  8135. @item clip(val)
  8136. The computed value in @var{val}, clipped to the
  8137. @var{minval}-@var{maxval} range.
  8138. @item gammaval(gamma)
  8139. The computed gamma correction value of the pixel component value,
  8140. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8141. expression
  8142. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8143. @end table
  8144. All expressions default to "val".
  8145. @subsection Examples
  8146. @itemize
  8147. @item
  8148. Negate input video:
  8149. @example
  8150. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8151. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8152. @end example
  8153. The above is the same as:
  8154. @example
  8155. lutrgb="r=negval:g=negval:b=negval"
  8156. lutyuv="y=negval:u=negval:v=negval"
  8157. @end example
  8158. @item
  8159. Negate luminance:
  8160. @example
  8161. lutyuv=y=negval
  8162. @end example
  8163. @item
  8164. Remove chroma components, turning the video into a graytone image:
  8165. @example
  8166. lutyuv="u=128:v=128"
  8167. @end example
  8168. @item
  8169. Apply a luma burning effect:
  8170. @example
  8171. lutyuv="y=2*val"
  8172. @end example
  8173. @item
  8174. Remove green and blue components:
  8175. @example
  8176. lutrgb="g=0:b=0"
  8177. @end example
  8178. @item
  8179. Set a constant alpha channel value on input:
  8180. @example
  8181. format=rgba,lutrgb=a="maxval-minval/2"
  8182. @end example
  8183. @item
  8184. Correct luminance gamma by a factor of 0.5:
  8185. @example
  8186. lutyuv=y=gammaval(0.5)
  8187. @end example
  8188. @item
  8189. Discard least significant bits of luma:
  8190. @example
  8191. lutyuv=y='bitand(val, 128+64+32)'
  8192. @end example
  8193. @item
  8194. Technicolor like effect:
  8195. @example
  8196. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8197. @end example
  8198. @end itemize
  8199. @section lut2, tlut2
  8200. The @code{lut2} filter takes two input streams and outputs one
  8201. stream.
  8202. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8203. from one single stream.
  8204. This filter accepts the following parameters:
  8205. @table @option
  8206. @item c0
  8207. set first pixel component expression
  8208. @item c1
  8209. set second pixel component expression
  8210. @item c2
  8211. set third pixel component expression
  8212. @item c3
  8213. set fourth pixel component expression, corresponds to the alpha component
  8214. @end table
  8215. Each of them specifies the expression to use for computing the lookup table for
  8216. the corresponding pixel component values.
  8217. The exact component associated to each of the @var{c*} options depends on the
  8218. format in inputs.
  8219. The expressions can contain the following constants:
  8220. @table @option
  8221. @item w
  8222. @item h
  8223. The input width and height.
  8224. @item x
  8225. The first input value for the pixel component.
  8226. @item y
  8227. The second input value for the pixel component.
  8228. @item bdx
  8229. The first input video bit depth.
  8230. @item bdy
  8231. The second input video bit depth.
  8232. @end table
  8233. All expressions default to "x".
  8234. @subsection Examples
  8235. @itemize
  8236. @item
  8237. Highlight differences between two RGB video streams:
  8238. @example
  8239. 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)'
  8240. @end example
  8241. @item
  8242. Highlight differences between two YUV video streams:
  8243. @example
  8244. 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)'
  8245. @end example
  8246. @item
  8247. Show max difference between two video streams:
  8248. @example
  8249. 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)))'
  8250. @end example
  8251. @end itemize
  8252. @section maskedclamp
  8253. Clamp the first input stream with the second input and third input stream.
  8254. Returns the value of first stream to be between second input
  8255. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8256. This filter accepts the following options:
  8257. @table @option
  8258. @item undershoot
  8259. Default value is @code{0}.
  8260. @item overshoot
  8261. Default value is @code{0}.
  8262. @item planes
  8263. Set which planes will be processed as bitmap, unprocessed planes will be
  8264. copied from first stream.
  8265. By default value 0xf, all planes will be processed.
  8266. @end table
  8267. @section maskedmerge
  8268. Merge the first input stream with the second input stream using per pixel
  8269. weights in the third input stream.
  8270. A value of 0 in the third stream pixel component means that pixel component
  8271. from first stream is returned unchanged, while maximum value (eg. 255 for
  8272. 8-bit videos) means that pixel component from second stream is returned
  8273. unchanged. Intermediate values define the amount of merging between both
  8274. input stream's pixel components.
  8275. This filter accepts the following options:
  8276. @table @option
  8277. @item planes
  8278. Set which planes will be processed as bitmap, unprocessed planes will be
  8279. copied from first stream.
  8280. By default value 0xf, all planes will be processed.
  8281. @end table
  8282. @section mcdeint
  8283. Apply motion-compensation deinterlacing.
  8284. It needs one field per frame as input and must thus be used together
  8285. with yadif=1/3 or equivalent.
  8286. This filter accepts the following options:
  8287. @table @option
  8288. @item mode
  8289. Set the deinterlacing mode.
  8290. It accepts one of the following values:
  8291. @table @samp
  8292. @item fast
  8293. @item medium
  8294. @item slow
  8295. use iterative motion estimation
  8296. @item extra_slow
  8297. like @samp{slow}, but use multiple reference frames.
  8298. @end table
  8299. Default value is @samp{fast}.
  8300. @item parity
  8301. Set the picture field parity assumed for the input video. It must be
  8302. one of the following values:
  8303. @table @samp
  8304. @item 0, tff
  8305. assume top field first
  8306. @item 1, bff
  8307. assume bottom field first
  8308. @end table
  8309. Default value is @samp{bff}.
  8310. @item qp
  8311. Set per-block quantization parameter (QP) used by the internal
  8312. encoder.
  8313. Higher values should result in a smoother motion vector field but less
  8314. optimal individual vectors. Default value is 1.
  8315. @end table
  8316. @section mergeplanes
  8317. Merge color channel components from several video streams.
  8318. The filter accepts up to 4 input streams, and merge selected input
  8319. planes to the output video.
  8320. This filter accepts the following options:
  8321. @table @option
  8322. @item mapping
  8323. Set input to output plane mapping. Default is @code{0}.
  8324. The mappings is specified as a bitmap. It should be specified as a
  8325. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8326. mapping for the first plane of the output stream. 'A' sets the number of
  8327. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8328. corresponding input to use (from 0 to 3). The rest of the mappings is
  8329. similar, 'Bb' describes the mapping for the output stream second
  8330. plane, 'Cc' describes the mapping for the output stream third plane and
  8331. 'Dd' describes the mapping for the output stream fourth plane.
  8332. @item format
  8333. Set output pixel format. Default is @code{yuva444p}.
  8334. @end table
  8335. @subsection Examples
  8336. @itemize
  8337. @item
  8338. Merge three gray video streams of same width and height into single video stream:
  8339. @example
  8340. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8341. @end example
  8342. @item
  8343. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8344. @example
  8345. [a0][a1]mergeplanes=0x00010210:yuva444p
  8346. @end example
  8347. @item
  8348. Swap Y and A plane in yuva444p stream:
  8349. @example
  8350. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8351. @end example
  8352. @item
  8353. Swap U and V plane in yuv420p stream:
  8354. @example
  8355. format=yuv420p,mergeplanes=0x000201:yuv420p
  8356. @end example
  8357. @item
  8358. Cast a rgb24 clip to yuv444p:
  8359. @example
  8360. format=rgb24,mergeplanes=0x000102:yuv444p
  8361. @end example
  8362. @end itemize
  8363. @section mestimate
  8364. Estimate and export motion vectors using block matching algorithms.
  8365. Motion vectors are stored in frame side data to be used by other filters.
  8366. This filter accepts the following options:
  8367. @table @option
  8368. @item method
  8369. Specify the motion estimation method. Accepts one of the following values:
  8370. @table @samp
  8371. @item esa
  8372. Exhaustive search algorithm.
  8373. @item tss
  8374. Three step search algorithm.
  8375. @item tdls
  8376. Two dimensional logarithmic search algorithm.
  8377. @item ntss
  8378. New three step search algorithm.
  8379. @item fss
  8380. Four step search algorithm.
  8381. @item ds
  8382. Diamond search algorithm.
  8383. @item hexbs
  8384. Hexagon-based search algorithm.
  8385. @item epzs
  8386. Enhanced predictive zonal search algorithm.
  8387. @item umh
  8388. Uneven multi-hexagon search algorithm.
  8389. @end table
  8390. Default value is @samp{esa}.
  8391. @item mb_size
  8392. Macroblock size. Default @code{16}.
  8393. @item search_param
  8394. Search parameter. Default @code{7}.
  8395. @end table
  8396. @section midequalizer
  8397. Apply Midway Image Equalization effect using two video streams.
  8398. Midway Image Equalization adjusts a pair of images to have the same
  8399. histogram, while maintaining their dynamics as much as possible. It's
  8400. useful for e.g. matching exposures from a pair of stereo cameras.
  8401. This filter has two inputs and one output, which must be of same pixel format, but
  8402. may be of different sizes. The output of filter is first input adjusted with
  8403. midway histogram of both inputs.
  8404. This filter accepts the following option:
  8405. @table @option
  8406. @item planes
  8407. Set which planes to process. Default is @code{15}, which is all available planes.
  8408. @end table
  8409. @section minterpolate
  8410. Convert the video to specified frame rate using motion interpolation.
  8411. This filter accepts the following options:
  8412. @table @option
  8413. @item fps
  8414. 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}.
  8415. @item mi_mode
  8416. Motion interpolation mode. Following values are accepted:
  8417. @table @samp
  8418. @item dup
  8419. Duplicate previous or next frame for interpolating new ones.
  8420. @item blend
  8421. Blend source frames. Interpolated frame is mean of previous and next frames.
  8422. @item mci
  8423. Motion compensated interpolation. Following options are effective when this mode is selected:
  8424. @table @samp
  8425. @item mc_mode
  8426. Motion compensation mode. Following values are accepted:
  8427. @table @samp
  8428. @item obmc
  8429. Overlapped block motion compensation.
  8430. @item aobmc
  8431. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8432. @end table
  8433. Default mode is @samp{obmc}.
  8434. @item me_mode
  8435. Motion estimation mode. Following values are accepted:
  8436. @table @samp
  8437. @item bidir
  8438. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8439. @item bilat
  8440. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8441. @end table
  8442. Default mode is @samp{bilat}.
  8443. @item me
  8444. The algorithm to be used for motion estimation. Following values are accepted:
  8445. @table @samp
  8446. @item esa
  8447. Exhaustive search algorithm.
  8448. @item tss
  8449. Three step search algorithm.
  8450. @item tdls
  8451. Two dimensional logarithmic search algorithm.
  8452. @item ntss
  8453. New three step search algorithm.
  8454. @item fss
  8455. Four step search algorithm.
  8456. @item ds
  8457. Diamond search algorithm.
  8458. @item hexbs
  8459. Hexagon-based search algorithm.
  8460. @item epzs
  8461. Enhanced predictive zonal search algorithm.
  8462. @item umh
  8463. Uneven multi-hexagon search algorithm.
  8464. @end table
  8465. Default algorithm is @samp{epzs}.
  8466. @item mb_size
  8467. Macroblock size. Default @code{16}.
  8468. @item search_param
  8469. Motion estimation search parameter. Default @code{32}.
  8470. @item vsbmc
  8471. 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).
  8472. @end table
  8473. @end table
  8474. @item scd
  8475. 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:
  8476. @table @samp
  8477. @item none
  8478. Disable scene change detection.
  8479. @item fdiff
  8480. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8481. @end table
  8482. Default method is @samp{fdiff}.
  8483. @item scd_threshold
  8484. Scene change detection threshold. Default is @code{5.0}.
  8485. @end table
  8486. @section mix
  8487. Mix several video input streams into one video stream.
  8488. A description of the accepted options follows.
  8489. @table @option
  8490. @item nb_inputs
  8491. The number of inputs. If unspecified, it defaults to 2.
  8492. @item weights
  8493. Specify weight of each input video stream as sequence.
  8494. Each weight is separated by space.
  8495. @item duration
  8496. Specify how end of stream is determined.
  8497. @table @samp
  8498. @item longest
  8499. The duration of the longest input. (default)
  8500. @item shortest
  8501. The duration of the shortest input.
  8502. @item first
  8503. The duration of the first input.
  8504. @end table
  8505. @end table
  8506. @section mpdecimate
  8507. Drop frames that do not differ greatly from the previous frame in
  8508. order to reduce frame rate.
  8509. The main use of this filter is for very-low-bitrate encoding
  8510. (e.g. streaming over dialup modem), but it could in theory be used for
  8511. fixing movies that were inverse-telecined incorrectly.
  8512. A description of the accepted options follows.
  8513. @table @option
  8514. @item max
  8515. Set the maximum number of consecutive frames which can be dropped (if
  8516. positive), or the minimum interval between dropped frames (if
  8517. negative). If the value is 0, the frame is dropped disregarding the
  8518. number of previous sequentially dropped frames.
  8519. Default value is 0.
  8520. @item hi
  8521. @item lo
  8522. @item frac
  8523. Set the dropping threshold values.
  8524. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8525. represent actual pixel value differences, so a threshold of 64
  8526. corresponds to 1 unit of difference for each pixel, or the same spread
  8527. out differently over the block.
  8528. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8529. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8530. meaning the whole image) differ by more than a threshold of @option{lo}.
  8531. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8532. 64*5, and default value for @option{frac} is 0.33.
  8533. @end table
  8534. @section negate
  8535. Negate input video.
  8536. It accepts an integer in input; if non-zero it negates the
  8537. alpha component (if available). The default value in input is 0.
  8538. @section nlmeans
  8539. Denoise frames using Non-Local Means algorithm.
  8540. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8541. context similarity is defined by comparing their surrounding patches of size
  8542. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8543. around the pixel.
  8544. Note that the research area defines centers for patches, which means some
  8545. patches will be made of pixels outside that research area.
  8546. The filter accepts the following options.
  8547. @table @option
  8548. @item s
  8549. Set denoising strength.
  8550. @item p
  8551. Set patch size.
  8552. @item pc
  8553. Same as @option{p} but for chroma planes.
  8554. The default value is @var{0} and means automatic.
  8555. @item r
  8556. Set research size.
  8557. @item rc
  8558. Same as @option{r} but for chroma planes.
  8559. The default value is @var{0} and means automatic.
  8560. @end table
  8561. @section nnedi
  8562. Deinterlace video using neural network edge directed interpolation.
  8563. This filter accepts the following options:
  8564. @table @option
  8565. @item weights
  8566. Mandatory option, without binary file filter can not work.
  8567. Currently file can be found here:
  8568. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8569. @item deint
  8570. Set which frames to deinterlace, by default it is @code{all}.
  8571. Can be @code{all} or @code{interlaced}.
  8572. @item field
  8573. Set mode of operation.
  8574. Can be one of the following:
  8575. @table @samp
  8576. @item af
  8577. Use frame flags, both fields.
  8578. @item a
  8579. Use frame flags, single field.
  8580. @item t
  8581. Use top field only.
  8582. @item b
  8583. Use bottom field only.
  8584. @item tf
  8585. Use both fields, top first.
  8586. @item bf
  8587. Use both fields, bottom first.
  8588. @end table
  8589. @item planes
  8590. Set which planes to process, by default filter process all frames.
  8591. @item nsize
  8592. Set size of local neighborhood around each pixel, used by the predictor neural
  8593. network.
  8594. Can be one of the following:
  8595. @table @samp
  8596. @item s8x6
  8597. @item s16x6
  8598. @item s32x6
  8599. @item s48x6
  8600. @item s8x4
  8601. @item s16x4
  8602. @item s32x4
  8603. @end table
  8604. @item nns
  8605. Set the number of neurons in predictor neural network.
  8606. Can be one of the following:
  8607. @table @samp
  8608. @item n16
  8609. @item n32
  8610. @item n64
  8611. @item n128
  8612. @item n256
  8613. @end table
  8614. @item qual
  8615. Controls the number of different neural network predictions that are blended
  8616. together to compute the final output value. Can be @code{fast}, default or
  8617. @code{slow}.
  8618. @item etype
  8619. Set which set of weights to use in the predictor.
  8620. Can be one of the following:
  8621. @table @samp
  8622. @item a
  8623. weights trained to minimize absolute error
  8624. @item s
  8625. weights trained to minimize squared error
  8626. @end table
  8627. @item pscrn
  8628. Controls whether or not the prescreener neural network is used to decide
  8629. which pixels should be processed by the predictor neural network and which
  8630. can be handled by simple cubic interpolation.
  8631. The prescreener is trained to know whether cubic interpolation will be
  8632. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8633. The computational complexity of the prescreener nn is much less than that of
  8634. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8635. using the prescreener generally results in much faster processing.
  8636. The prescreener is pretty accurate, so the difference between using it and not
  8637. using it is almost always unnoticeable.
  8638. Can be one of the following:
  8639. @table @samp
  8640. @item none
  8641. @item original
  8642. @item new
  8643. @end table
  8644. Default is @code{new}.
  8645. @item fapprox
  8646. Set various debugging flags.
  8647. @end table
  8648. @section noformat
  8649. Force libavfilter not to use any of the specified pixel formats for the
  8650. input to the next filter.
  8651. It accepts the following parameters:
  8652. @table @option
  8653. @item pix_fmts
  8654. A '|'-separated list of pixel format names, such as
  8655. pix_fmts=yuv420p|monow|rgb24".
  8656. @end table
  8657. @subsection Examples
  8658. @itemize
  8659. @item
  8660. Force libavfilter to use a format different from @var{yuv420p} for the
  8661. input to the vflip filter:
  8662. @example
  8663. noformat=pix_fmts=yuv420p,vflip
  8664. @end example
  8665. @item
  8666. Convert the input video to any of the formats not contained in the list:
  8667. @example
  8668. noformat=yuv420p|yuv444p|yuv410p
  8669. @end example
  8670. @end itemize
  8671. @section noise
  8672. Add noise on video input frame.
  8673. The filter accepts the following options:
  8674. @table @option
  8675. @item all_seed
  8676. @item c0_seed
  8677. @item c1_seed
  8678. @item c2_seed
  8679. @item c3_seed
  8680. Set noise seed for specific pixel component or all pixel components in case
  8681. of @var{all_seed}. Default value is @code{123457}.
  8682. @item all_strength, alls
  8683. @item c0_strength, c0s
  8684. @item c1_strength, c1s
  8685. @item c2_strength, c2s
  8686. @item c3_strength, c3s
  8687. Set noise strength for specific pixel component or all pixel components in case
  8688. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8689. @item all_flags, allf
  8690. @item c0_flags, c0f
  8691. @item c1_flags, c1f
  8692. @item c2_flags, c2f
  8693. @item c3_flags, c3f
  8694. Set pixel component flags or set flags for all components if @var{all_flags}.
  8695. Available values for component flags are:
  8696. @table @samp
  8697. @item a
  8698. averaged temporal noise (smoother)
  8699. @item p
  8700. mix random noise with a (semi)regular pattern
  8701. @item t
  8702. temporal noise (noise pattern changes between frames)
  8703. @item u
  8704. uniform noise (gaussian otherwise)
  8705. @end table
  8706. @end table
  8707. @subsection Examples
  8708. Add temporal and uniform noise to input video:
  8709. @example
  8710. noise=alls=20:allf=t+u
  8711. @end example
  8712. @section normalize
  8713. Normalize RGB video (aka histogram stretching, contrast stretching).
  8714. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8715. For each channel of each frame, the filter computes the input range and maps
  8716. it linearly to the user-specified output range. The output range defaults
  8717. to the full dynamic range from pure black to pure white.
  8718. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8719. changes in brightness) caused when small dark or bright objects enter or leave
  8720. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8721. video camera, and, like a video camera, it may cause a period of over- or
  8722. under-exposure of the video.
  8723. The R,G,B channels can be normalized independently, which may cause some
  8724. color shifting, or linked together as a single channel, which prevents
  8725. color shifting. Linked normalization preserves hue. Independent normalization
  8726. does not, so it can be used to remove some color casts. Independent and linked
  8727. normalization can be combined in any ratio.
  8728. The normalize filter accepts the following options:
  8729. @table @option
  8730. @item blackpt
  8731. @item whitept
  8732. Colors which define the output range. The minimum input value is mapped to
  8733. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8734. The defaults are black and white respectively. Specifying white for
  8735. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8736. normalized video. Shades of grey can be used to reduce the dynamic range
  8737. (contrast). Specifying saturated colors here can create some interesting
  8738. effects.
  8739. @item smoothing
  8740. The number of previous frames to use for temporal smoothing. The input range
  8741. of each channel is smoothed using a rolling average over the current frame
  8742. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8743. smoothing).
  8744. @item independence
  8745. Controls the ratio of independent (color shifting) channel normalization to
  8746. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8747. independent. Defaults to 1.0 (fully independent).
  8748. @item strength
  8749. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8750. expensive no-op. Defaults to 1.0 (full strength).
  8751. @end table
  8752. @subsection Examples
  8753. Stretch video contrast to use the full dynamic range, with no temporal
  8754. smoothing; may flicker depending on the source content:
  8755. @example
  8756. normalize=blackpt=black:whitept=white:smoothing=0
  8757. @end example
  8758. As above, but with 50 frames of temporal smoothing; flicker should be
  8759. reduced, depending on the source content:
  8760. @example
  8761. normalize=blackpt=black:whitept=white:smoothing=50
  8762. @end example
  8763. As above, but with hue-preserving linked channel normalization:
  8764. @example
  8765. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8766. @end example
  8767. As above, but with half strength:
  8768. @example
  8769. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8770. @end example
  8771. Map the darkest input color to red, the brightest input color to cyan:
  8772. @example
  8773. normalize=blackpt=red:whitept=cyan
  8774. @end example
  8775. @section null
  8776. Pass the video source unchanged to the output.
  8777. @section ocr
  8778. Optical Character Recognition
  8779. This filter uses Tesseract for optical character recognition.
  8780. It accepts the following options:
  8781. @table @option
  8782. @item datapath
  8783. Set datapath to tesseract data. Default is to use whatever was
  8784. set at installation.
  8785. @item language
  8786. Set language, default is "eng".
  8787. @item whitelist
  8788. Set character whitelist.
  8789. @item blacklist
  8790. Set character blacklist.
  8791. @end table
  8792. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8793. @section ocv
  8794. Apply a video transform using libopencv.
  8795. To enable this filter, install the libopencv library and headers and
  8796. configure FFmpeg with @code{--enable-libopencv}.
  8797. It accepts the following parameters:
  8798. @table @option
  8799. @item filter_name
  8800. The name of the libopencv filter to apply.
  8801. @item filter_params
  8802. The parameters to pass to the libopencv filter. If not specified, the default
  8803. values are assumed.
  8804. @end table
  8805. Refer to the official libopencv documentation for more precise
  8806. information:
  8807. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8808. Several libopencv filters are supported; see the following subsections.
  8809. @anchor{dilate}
  8810. @subsection dilate
  8811. Dilate an image by using a specific structuring element.
  8812. It corresponds to the libopencv function @code{cvDilate}.
  8813. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8814. @var{struct_el} represents a structuring element, and has the syntax:
  8815. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8816. @var{cols} and @var{rows} represent the number of columns and rows of
  8817. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8818. point, and @var{shape} the shape for the structuring element. @var{shape}
  8819. must be "rect", "cross", "ellipse", or "custom".
  8820. If the value for @var{shape} is "custom", it must be followed by a
  8821. string of the form "=@var{filename}". The file with name
  8822. @var{filename} is assumed to represent a binary image, with each
  8823. printable character corresponding to a bright pixel. When a custom
  8824. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8825. or columns and rows of the read file are assumed instead.
  8826. The default value for @var{struct_el} is "3x3+0x0/rect".
  8827. @var{nb_iterations} specifies the number of times the transform is
  8828. applied to the image, and defaults to 1.
  8829. Some examples:
  8830. @example
  8831. # Use the default values
  8832. ocv=dilate
  8833. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8834. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8835. # Read the shape from the file diamond.shape, iterating two times.
  8836. # The file diamond.shape may contain a pattern of characters like this
  8837. # *
  8838. # ***
  8839. # *****
  8840. # ***
  8841. # *
  8842. # The specified columns and rows are ignored
  8843. # but the anchor point coordinates are not
  8844. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8845. @end example
  8846. @subsection erode
  8847. Erode an image by using a specific structuring element.
  8848. It corresponds to the libopencv function @code{cvErode}.
  8849. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8850. with the same syntax and semantics as the @ref{dilate} filter.
  8851. @subsection smooth
  8852. Smooth the input video.
  8853. The filter takes the following parameters:
  8854. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8855. @var{type} is the type of smooth filter to apply, and must be one of
  8856. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8857. or "bilateral". The default value is "gaussian".
  8858. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8859. depend on the smooth type. @var{param1} and
  8860. @var{param2} accept integer positive values or 0. @var{param3} and
  8861. @var{param4} accept floating point values.
  8862. The default value for @var{param1} is 3. The default value for the
  8863. other parameters is 0.
  8864. These parameters correspond to the parameters assigned to the
  8865. libopencv function @code{cvSmooth}.
  8866. @section oscilloscope
  8867. 2D Video Oscilloscope.
  8868. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8869. It accepts the following parameters:
  8870. @table @option
  8871. @item x
  8872. Set scope center x position.
  8873. @item y
  8874. Set scope center y position.
  8875. @item s
  8876. Set scope size, relative to frame diagonal.
  8877. @item t
  8878. Set scope tilt/rotation.
  8879. @item o
  8880. Set trace opacity.
  8881. @item tx
  8882. Set trace center x position.
  8883. @item ty
  8884. Set trace center y position.
  8885. @item tw
  8886. Set trace width, relative to width of frame.
  8887. @item th
  8888. Set trace height, relative to height of frame.
  8889. @item c
  8890. Set which components to trace. By default it traces first three components.
  8891. @item g
  8892. Draw trace grid. By default is enabled.
  8893. @item st
  8894. Draw some statistics. By default is enabled.
  8895. @item sc
  8896. Draw scope. By default is enabled.
  8897. @end table
  8898. @subsection Examples
  8899. @itemize
  8900. @item
  8901. Inspect full first row of video frame.
  8902. @example
  8903. oscilloscope=x=0.5:y=0:s=1
  8904. @end example
  8905. @item
  8906. Inspect full last row of video frame.
  8907. @example
  8908. oscilloscope=x=0.5:y=1:s=1
  8909. @end example
  8910. @item
  8911. Inspect full 5th line of video frame of height 1080.
  8912. @example
  8913. oscilloscope=x=0.5:y=5/1080:s=1
  8914. @end example
  8915. @item
  8916. Inspect full last column of video frame.
  8917. @example
  8918. oscilloscope=x=1:y=0.5:s=1:t=1
  8919. @end example
  8920. @end itemize
  8921. @anchor{overlay}
  8922. @section overlay
  8923. Overlay one video on top of another.
  8924. It takes two inputs and has one output. The first input is the "main"
  8925. video on which the second input is overlaid.
  8926. It accepts the following parameters:
  8927. A description of the accepted options follows.
  8928. @table @option
  8929. @item x
  8930. @item y
  8931. Set the expression for the x and y coordinates of the overlaid video
  8932. on the main video. Default value is "0" for both expressions. In case
  8933. the expression is invalid, it is set to a huge value (meaning that the
  8934. overlay will not be displayed within the output visible area).
  8935. @item eof_action
  8936. See @ref{framesync}.
  8937. @item eval
  8938. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8939. It accepts the following values:
  8940. @table @samp
  8941. @item init
  8942. only evaluate expressions once during the filter initialization or
  8943. when a command is processed
  8944. @item frame
  8945. evaluate expressions for each incoming frame
  8946. @end table
  8947. Default value is @samp{frame}.
  8948. @item shortest
  8949. See @ref{framesync}.
  8950. @item format
  8951. Set the format for the output video.
  8952. It accepts the following values:
  8953. @table @samp
  8954. @item yuv420
  8955. force YUV420 output
  8956. @item yuv422
  8957. force YUV422 output
  8958. @item yuv444
  8959. force YUV444 output
  8960. @item rgb
  8961. force packed RGB output
  8962. @item gbrp
  8963. force planar RGB output
  8964. @item auto
  8965. automatically pick format
  8966. @end table
  8967. Default value is @samp{yuv420}.
  8968. @item repeatlast
  8969. See @ref{framesync}.
  8970. @item alpha
  8971. Set format of alpha of the overlaid video, it can be @var{straight} or
  8972. @var{premultiplied}. Default is @var{straight}.
  8973. @end table
  8974. The @option{x}, and @option{y} expressions can contain the following
  8975. parameters.
  8976. @table @option
  8977. @item main_w, W
  8978. @item main_h, H
  8979. The main input width and height.
  8980. @item overlay_w, w
  8981. @item overlay_h, h
  8982. The overlay input width and height.
  8983. @item x
  8984. @item y
  8985. The computed values for @var{x} and @var{y}. They are evaluated for
  8986. each new frame.
  8987. @item hsub
  8988. @item vsub
  8989. horizontal and vertical chroma subsample values of the output
  8990. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8991. @var{vsub} is 1.
  8992. @item n
  8993. the number of input frame, starting from 0
  8994. @item pos
  8995. the position in the file of the input frame, NAN if unknown
  8996. @item t
  8997. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8998. @end table
  8999. This filter also supports the @ref{framesync} options.
  9000. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9001. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9002. when @option{eval} is set to @samp{init}.
  9003. Be aware that frames are taken from each input video in timestamp
  9004. order, hence, if their initial timestamps differ, it is a good idea
  9005. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9006. have them begin in the same zero timestamp, as the example for
  9007. the @var{movie} filter does.
  9008. You can chain together more overlays but you should test the
  9009. efficiency of such approach.
  9010. @subsection Commands
  9011. This filter supports the following commands:
  9012. @table @option
  9013. @item x
  9014. @item y
  9015. Modify the x and y of the overlay input.
  9016. The command accepts the same syntax of the corresponding option.
  9017. If the specified expression is not valid, it is kept at its current
  9018. value.
  9019. @end table
  9020. @subsection Examples
  9021. @itemize
  9022. @item
  9023. Draw the overlay at 10 pixels from the bottom right corner of the main
  9024. video:
  9025. @example
  9026. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9027. @end example
  9028. Using named options the example above becomes:
  9029. @example
  9030. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9031. @end example
  9032. @item
  9033. Insert a transparent PNG logo in the bottom left corner of the input,
  9034. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9035. @example
  9036. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9037. @end example
  9038. @item
  9039. Insert 2 different transparent PNG logos (second logo on bottom
  9040. right corner) using the @command{ffmpeg} tool:
  9041. @example
  9042. 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
  9043. @end example
  9044. @item
  9045. Add a transparent color layer on top of the main video; @code{WxH}
  9046. must specify the size of the main input to the overlay filter:
  9047. @example
  9048. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9049. @end example
  9050. @item
  9051. Play an original video and a filtered version (here with the deshake
  9052. filter) side by side using the @command{ffplay} tool:
  9053. @example
  9054. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9055. @end example
  9056. The above command is the same as:
  9057. @example
  9058. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9059. @end example
  9060. @item
  9061. Make a sliding overlay appearing from the left to the right top part of the
  9062. screen starting since time 2:
  9063. @example
  9064. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9065. @end example
  9066. @item
  9067. Compose output by putting two input videos side to side:
  9068. @example
  9069. ffmpeg -i left.avi -i right.avi -filter_complex "
  9070. nullsrc=size=200x100 [background];
  9071. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9072. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9073. [background][left] overlay=shortest=1 [background+left];
  9074. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9075. "
  9076. @end example
  9077. @item
  9078. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9079. @example
  9080. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9081. -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]'
  9082. masked.avi
  9083. @end example
  9084. @item
  9085. Chain several overlays in cascade:
  9086. @example
  9087. nullsrc=s=200x200 [bg];
  9088. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9089. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9090. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9091. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9092. [in3] null, [mid2] overlay=100:100 [out0]
  9093. @end example
  9094. @end itemize
  9095. @section owdenoise
  9096. Apply Overcomplete Wavelet denoiser.
  9097. The filter accepts the following options:
  9098. @table @option
  9099. @item depth
  9100. Set depth.
  9101. Larger depth values will denoise lower frequency components more, but
  9102. slow down filtering.
  9103. Must be an int in the range 8-16, default is @code{8}.
  9104. @item luma_strength, ls
  9105. Set luma strength.
  9106. Must be a double value in the range 0-1000, default is @code{1.0}.
  9107. @item chroma_strength, cs
  9108. Set chroma strength.
  9109. Must be a double value in the range 0-1000, default is @code{1.0}.
  9110. @end table
  9111. @anchor{pad}
  9112. @section pad
  9113. Add paddings to the input image, and place the original input at the
  9114. provided @var{x}, @var{y} coordinates.
  9115. It accepts the following parameters:
  9116. @table @option
  9117. @item width, w
  9118. @item height, h
  9119. Specify an expression for the size of the output image with the
  9120. paddings added. If the value for @var{width} or @var{height} is 0, the
  9121. corresponding input size is used for the output.
  9122. The @var{width} expression can reference the value set by the
  9123. @var{height} expression, and vice versa.
  9124. The default value of @var{width} and @var{height} is 0.
  9125. @item x
  9126. @item y
  9127. Specify the offsets to place the input image at within the padded area,
  9128. with respect to the top/left border of the output image.
  9129. The @var{x} expression can reference the value set by the @var{y}
  9130. expression, and vice versa.
  9131. The default value of @var{x} and @var{y} is 0.
  9132. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9133. so the input image is centered on the padded area.
  9134. @item color
  9135. Specify the color of the padded area. For the syntax of this option,
  9136. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9137. manual,ffmpeg-utils}.
  9138. The default value of @var{color} is "black".
  9139. @item eval
  9140. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9141. It accepts the following values:
  9142. @table @samp
  9143. @item init
  9144. Only evaluate expressions once during the filter initialization or when
  9145. a command is processed.
  9146. @item frame
  9147. Evaluate expressions for each incoming frame.
  9148. @end table
  9149. Default value is @samp{init}.
  9150. @item aspect
  9151. Pad to aspect instead to a resolution.
  9152. @end table
  9153. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9154. options are expressions containing the following constants:
  9155. @table @option
  9156. @item in_w
  9157. @item in_h
  9158. The input video width and height.
  9159. @item iw
  9160. @item ih
  9161. These are the same as @var{in_w} and @var{in_h}.
  9162. @item out_w
  9163. @item out_h
  9164. The output width and height (the size of the padded area), as
  9165. specified by the @var{width} and @var{height} expressions.
  9166. @item ow
  9167. @item oh
  9168. These are the same as @var{out_w} and @var{out_h}.
  9169. @item x
  9170. @item y
  9171. The x and y offsets as specified by the @var{x} and @var{y}
  9172. expressions, or NAN if not yet specified.
  9173. @item a
  9174. same as @var{iw} / @var{ih}
  9175. @item sar
  9176. input sample aspect ratio
  9177. @item dar
  9178. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9179. @item hsub
  9180. @item vsub
  9181. The horizontal and vertical chroma subsample values. For example for the
  9182. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9183. @end table
  9184. @subsection Examples
  9185. @itemize
  9186. @item
  9187. Add paddings with the color "violet" to the input video. The output video
  9188. size is 640x480, and the top-left corner of the input video is placed at
  9189. column 0, row 40
  9190. @example
  9191. pad=640:480:0:40:violet
  9192. @end example
  9193. The example above is equivalent to the following command:
  9194. @example
  9195. pad=width=640:height=480:x=0:y=40:color=violet
  9196. @end example
  9197. @item
  9198. Pad the input to get an output with dimensions increased by 3/2,
  9199. and put the input video at the center of the padded area:
  9200. @example
  9201. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9202. @end example
  9203. @item
  9204. Pad the input to get a squared output with size equal to the maximum
  9205. value between the input width and height, and put the input video at
  9206. the center of the padded area:
  9207. @example
  9208. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9209. @end example
  9210. @item
  9211. Pad the input to get a final w/h ratio of 16:9:
  9212. @example
  9213. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9214. @end example
  9215. @item
  9216. In case of anamorphic video, in order to set the output display aspect
  9217. correctly, it is necessary to use @var{sar} in the expression,
  9218. according to the relation:
  9219. @example
  9220. (ih * X / ih) * sar = output_dar
  9221. X = output_dar / sar
  9222. @end example
  9223. Thus the previous example needs to be modified to:
  9224. @example
  9225. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9226. @end example
  9227. @item
  9228. Double the output size and put the input video in the bottom-right
  9229. corner of the output padded area:
  9230. @example
  9231. pad="2*iw:2*ih:ow-iw:oh-ih"
  9232. @end example
  9233. @end itemize
  9234. @anchor{palettegen}
  9235. @section palettegen
  9236. Generate one palette for a whole video stream.
  9237. It accepts the following options:
  9238. @table @option
  9239. @item max_colors
  9240. Set the maximum number of colors to quantize in the palette.
  9241. Note: the palette will still contain 256 colors; the unused palette entries
  9242. will be black.
  9243. @item reserve_transparent
  9244. Create a palette of 255 colors maximum and reserve the last one for
  9245. transparency. Reserving the transparency color is useful for GIF optimization.
  9246. If not set, the maximum of colors in the palette will be 256. You probably want
  9247. to disable this option for a standalone image.
  9248. Set by default.
  9249. @item transparency_color
  9250. Set the color that will be used as background for transparency.
  9251. @item stats_mode
  9252. Set statistics mode.
  9253. It accepts the following values:
  9254. @table @samp
  9255. @item full
  9256. Compute full frame histograms.
  9257. @item diff
  9258. Compute histograms only for the part that differs from previous frame. This
  9259. might be relevant to give more importance to the moving part of your input if
  9260. the background is static.
  9261. @item single
  9262. Compute new histogram for each frame.
  9263. @end table
  9264. Default value is @var{full}.
  9265. @end table
  9266. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9267. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9268. color quantization of the palette. This information is also visible at
  9269. @var{info} logging level.
  9270. @subsection Examples
  9271. @itemize
  9272. @item
  9273. Generate a representative palette of a given video using @command{ffmpeg}:
  9274. @example
  9275. ffmpeg -i input.mkv -vf palettegen palette.png
  9276. @end example
  9277. @end itemize
  9278. @section paletteuse
  9279. Use a palette to downsample an input video stream.
  9280. The filter takes two inputs: one video stream and a palette. The palette must
  9281. be a 256 pixels image.
  9282. It accepts the following options:
  9283. @table @option
  9284. @item dither
  9285. Select dithering mode. Available algorithms are:
  9286. @table @samp
  9287. @item bayer
  9288. Ordered 8x8 bayer dithering (deterministic)
  9289. @item heckbert
  9290. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9291. Note: this dithering is sometimes considered "wrong" and is included as a
  9292. reference.
  9293. @item floyd_steinberg
  9294. Floyd and Steingberg dithering (error diffusion)
  9295. @item sierra2
  9296. Frankie Sierra dithering v2 (error diffusion)
  9297. @item sierra2_4a
  9298. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9299. @end table
  9300. Default is @var{sierra2_4a}.
  9301. @item bayer_scale
  9302. When @var{bayer} dithering is selected, this option defines the scale of the
  9303. pattern (how much the crosshatch pattern is visible). A low value means more
  9304. visible pattern for less banding, and higher value means less visible pattern
  9305. at the cost of more banding.
  9306. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9307. @item diff_mode
  9308. If set, define the zone to process
  9309. @table @samp
  9310. @item rectangle
  9311. Only the changing rectangle will be reprocessed. This is similar to GIF
  9312. cropping/offsetting compression mechanism. This option can be useful for speed
  9313. if only a part of the image is changing, and has use cases such as limiting the
  9314. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9315. moving scene (it leads to more deterministic output if the scene doesn't change
  9316. much, and as a result less moving noise and better GIF compression).
  9317. @end table
  9318. Default is @var{none}.
  9319. @item new
  9320. Take new palette for each output frame.
  9321. @item alpha_threshold
  9322. Sets the alpha threshold for transparency. Alpha values above this threshold
  9323. will be treated as completely opaque, and values below this threshold will be
  9324. treated as completely transparent.
  9325. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9326. @end table
  9327. @subsection Examples
  9328. @itemize
  9329. @item
  9330. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9331. using @command{ffmpeg}:
  9332. @example
  9333. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9334. @end example
  9335. @end itemize
  9336. @section perspective
  9337. Correct perspective of video not recorded perpendicular to the screen.
  9338. A description of the accepted parameters follows.
  9339. @table @option
  9340. @item x0
  9341. @item y0
  9342. @item x1
  9343. @item y1
  9344. @item x2
  9345. @item y2
  9346. @item x3
  9347. @item y3
  9348. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9349. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9350. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9351. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9352. then the corners of the source will be sent to the specified coordinates.
  9353. The expressions can use the following variables:
  9354. @table @option
  9355. @item W
  9356. @item H
  9357. the width and height of video frame.
  9358. @item in
  9359. Input frame count.
  9360. @item on
  9361. Output frame count.
  9362. @end table
  9363. @item interpolation
  9364. Set interpolation for perspective correction.
  9365. It accepts the following values:
  9366. @table @samp
  9367. @item linear
  9368. @item cubic
  9369. @end table
  9370. Default value is @samp{linear}.
  9371. @item sense
  9372. Set interpretation of coordinate options.
  9373. It accepts the following values:
  9374. @table @samp
  9375. @item 0, source
  9376. Send point in the source specified by the given coordinates to
  9377. the corners of the destination.
  9378. @item 1, destination
  9379. Send the corners of the source to the point in the destination specified
  9380. by the given coordinates.
  9381. Default value is @samp{source}.
  9382. @end table
  9383. @item eval
  9384. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9385. It accepts the following values:
  9386. @table @samp
  9387. @item init
  9388. only evaluate expressions once during the filter initialization or
  9389. when a command is processed
  9390. @item frame
  9391. evaluate expressions for each incoming frame
  9392. @end table
  9393. Default value is @samp{init}.
  9394. @end table
  9395. @section phase
  9396. Delay interlaced video by one field time so that the field order changes.
  9397. The intended use is to fix PAL movies that have been captured with the
  9398. opposite field order to the film-to-video transfer.
  9399. A description of the accepted parameters follows.
  9400. @table @option
  9401. @item mode
  9402. Set phase mode.
  9403. It accepts the following values:
  9404. @table @samp
  9405. @item t
  9406. Capture field order top-first, transfer bottom-first.
  9407. Filter will delay the bottom field.
  9408. @item b
  9409. Capture field order bottom-first, transfer top-first.
  9410. Filter will delay the top field.
  9411. @item p
  9412. Capture and transfer with the same field order. This mode only exists
  9413. for the documentation of the other options to refer to, but if you
  9414. actually select it, the filter will faithfully do nothing.
  9415. @item a
  9416. Capture field order determined automatically by field flags, transfer
  9417. opposite.
  9418. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9419. basis using field flags. If no field information is available,
  9420. then this works just like @samp{u}.
  9421. @item u
  9422. Capture unknown or varying, transfer opposite.
  9423. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9424. analyzing the images and selecting the alternative that produces best
  9425. match between the fields.
  9426. @item T
  9427. Capture top-first, transfer unknown or varying.
  9428. Filter selects among @samp{t} and @samp{p} using image analysis.
  9429. @item B
  9430. Capture bottom-first, transfer unknown or varying.
  9431. Filter selects among @samp{b} and @samp{p} using image analysis.
  9432. @item A
  9433. Capture determined by field flags, transfer unknown or varying.
  9434. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9435. image analysis. If no field information is available, then this works just
  9436. like @samp{U}. This is the default mode.
  9437. @item U
  9438. Both capture and transfer unknown or varying.
  9439. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9440. @end table
  9441. @end table
  9442. @section pixdesctest
  9443. Pixel format descriptor test filter, mainly useful for internal
  9444. testing. The output video should be equal to the input video.
  9445. For example:
  9446. @example
  9447. format=monow, pixdesctest
  9448. @end example
  9449. can be used to test the monowhite pixel format descriptor definition.
  9450. @section pixscope
  9451. Display sample values of color channels. Mainly useful for checking color
  9452. and levels. Minimum supported resolution is 640x480.
  9453. The filters accept the following options:
  9454. @table @option
  9455. @item x
  9456. Set scope X position, relative offset on X axis.
  9457. @item y
  9458. Set scope Y position, relative offset on Y axis.
  9459. @item w
  9460. Set scope width.
  9461. @item h
  9462. Set scope height.
  9463. @item o
  9464. Set window opacity. This window also holds statistics about pixel area.
  9465. @item wx
  9466. Set window X position, relative offset on X axis.
  9467. @item wy
  9468. Set window Y position, relative offset on Y axis.
  9469. @end table
  9470. @section pp
  9471. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9472. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9473. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9474. Each subfilter and some options have a short and a long name that can be used
  9475. interchangeably, i.e. dr/dering are the same.
  9476. The filters accept the following options:
  9477. @table @option
  9478. @item subfilters
  9479. Set postprocessing subfilters string.
  9480. @end table
  9481. All subfilters share common options to determine their scope:
  9482. @table @option
  9483. @item a/autoq
  9484. Honor the quality commands for this subfilter.
  9485. @item c/chrom
  9486. Do chrominance filtering, too (default).
  9487. @item y/nochrom
  9488. Do luminance filtering only (no chrominance).
  9489. @item n/noluma
  9490. Do chrominance filtering only (no luminance).
  9491. @end table
  9492. These options can be appended after the subfilter name, separated by a '|'.
  9493. Available subfilters are:
  9494. @table @option
  9495. @item hb/hdeblock[|difference[|flatness]]
  9496. Horizontal deblocking filter
  9497. @table @option
  9498. @item difference
  9499. Difference factor where higher values mean more deblocking (default: @code{32}).
  9500. @item flatness
  9501. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9502. @end table
  9503. @item vb/vdeblock[|difference[|flatness]]
  9504. Vertical deblocking filter
  9505. @table @option
  9506. @item difference
  9507. Difference factor where higher values mean more deblocking (default: @code{32}).
  9508. @item flatness
  9509. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9510. @end table
  9511. @item ha/hadeblock[|difference[|flatness]]
  9512. Accurate horizontal deblocking filter
  9513. @table @option
  9514. @item difference
  9515. Difference factor where higher values mean more deblocking (default: @code{32}).
  9516. @item flatness
  9517. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9518. @end table
  9519. @item va/vadeblock[|difference[|flatness]]
  9520. Accurate vertical deblocking filter
  9521. @table @option
  9522. @item difference
  9523. Difference factor where higher values mean more deblocking (default: @code{32}).
  9524. @item flatness
  9525. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9526. @end table
  9527. @end table
  9528. The horizontal and vertical deblocking filters share the difference and
  9529. flatness values so you cannot set different horizontal and vertical
  9530. thresholds.
  9531. @table @option
  9532. @item h1/x1hdeblock
  9533. Experimental horizontal deblocking filter
  9534. @item v1/x1vdeblock
  9535. Experimental vertical deblocking filter
  9536. @item dr/dering
  9537. Deringing filter
  9538. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9539. @table @option
  9540. @item threshold1
  9541. larger -> stronger filtering
  9542. @item threshold2
  9543. larger -> stronger filtering
  9544. @item threshold3
  9545. larger -> stronger filtering
  9546. @end table
  9547. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9548. @table @option
  9549. @item f/fullyrange
  9550. Stretch luminance to @code{0-255}.
  9551. @end table
  9552. @item lb/linblenddeint
  9553. Linear blend deinterlacing filter that deinterlaces the given block by
  9554. filtering all lines with a @code{(1 2 1)} filter.
  9555. @item li/linipoldeint
  9556. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9557. linearly interpolating every second line.
  9558. @item ci/cubicipoldeint
  9559. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9560. cubically interpolating every second line.
  9561. @item md/mediandeint
  9562. Median deinterlacing filter that deinterlaces the given block by applying a
  9563. median filter to every second line.
  9564. @item fd/ffmpegdeint
  9565. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9566. second line with a @code{(-1 4 2 4 -1)} filter.
  9567. @item l5/lowpass5
  9568. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9569. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9570. @item fq/forceQuant[|quantizer]
  9571. Overrides the quantizer table from the input with the constant quantizer you
  9572. specify.
  9573. @table @option
  9574. @item quantizer
  9575. Quantizer to use
  9576. @end table
  9577. @item de/default
  9578. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9579. @item fa/fast
  9580. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9581. @item ac
  9582. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9583. @end table
  9584. @subsection Examples
  9585. @itemize
  9586. @item
  9587. Apply horizontal and vertical deblocking, deringing and automatic
  9588. brightness/contrast:
  9589. @example
  9590. pp=hb/vb/dr/al
  9591. @end example
  9592. @item
  9593. Apply default filters without brightness/contrast correction:
  9594. @example
  9595. pp=de/-al
  9596. @end example
  9597. @item
  9598. Apply default filters and temporal denoiser:
  9599. @example
  9600. pp=default/tmpnoise|1|2|3
  9601. @end example
  9602. @item
  9603. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9604. automatically depending on available CPU time:
  9605. @example
  9606. pp=hb|y/vb|a
  9607. @end example
  9608. @end itemize
  9609. @section pp7
  9610. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9611. similar to spp = 6 with 7 point DCT, where only the center sample is
  9612. used after IDCT.
  9613. The filter accepts the following options:
  9614. @table @option
  9615. @item qp
  9616. Force a constant quantization parameter. It accepts an integer in range
  9617. 0 to 63. If not set, the filter will use the QP from the video stream
  9618. (if available).
  9619. @item mode
  9620. Set thresholding mode. Available modes are:
  9621. @table @samp
  9622. @item hard
  9623. Set hard thresholding.
  9624. @item soft
  9625. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9626. @item medium
  9627. Set medium thresholding (good results, default).
  9628. @end table
  9629. @end table
  9630. @section premultiply
  9631. Apply alpha premultiply effect to input video stream using first plane
  9632. of second stream as alpha.
  9633. Both streams must have same dimensions and same pixel format.
  9634. The filter accepts the following option:
  9635. @table @option
  9636. @item planes
  9637. Set which planes will be processed, unprocessed planes will be copied.
  9638. By default value 0xf, all planes will be processed.
  9639. @item inplace
  9640. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9641. @end table
  9642. @section prewitt
  9643. Apply prewitt operator to input video stream.
  9644. The filter accepts the following option:
  9645. @table @option
  9646. @item planes
  9647. Set which planes will be processed, unprocessed planes will be copied.
  9648. By default value 0xf, all planes will be processed.
  9649. @item scale
  9650. Set value which will be multiplied with filtered result.
  9651. @item delta
  9652. Set value which will be added to filtered result.
  9653. @end table
  9654. @anchor{program_opencl}
  9655. @section program_opencl
  9656. Filter video using an OpenCL program.
  9657. @table @option
  9658. @item source
  9659. OpenCL program source file.
  9660. @item kernel
  9661. Kernel name in program.
  9662. @item inputs
  9663. Number of inputs to the filter. Defaults to 1.
  9664. @item size, s
  9665. Size of output frames. Defaults to the same as the first input.
  9666. @end table
  9667. The program source file must contain a kernel function with the given name,
  9668. which will be run once for each plane of the output. Each run on a plane
  9669. gets enqueued as a separate 2D global NDRange with one work-item for each
  9670. pixel to be generated. The global ID offset for each work-item is therefore
  9671. the coordinates of a pixel in the destination image.
  9672. The kernel function needs to take the following arguments:
  9673. @itemize
  9674. @item
  9675. Destination image, @var{__write_only image2d_t}.
  9676. This image will become the output; the kernel should write all of it.
  9677. @item
  9678. Frame index, @var{unsigned int}.
  9679. This is a counter starting from zero and increasing by one for each frame.
  9680. @item
  9681. Source images, @var{__read_only image2d_t}.
  9682. These are the most recent images on each input. The kernel may read from
  9683. them to generate the output, but they can't be written to.
  9684. @end itemize
  9685. Example programs:
  9686. @itemize
  9687. @item
  9688. Copy the input to the output (output must be the same size as the input).
  9689. @verbatim
  9690. __kernel void copy(__write_only image2d_t destination,
  9691. unsigned int index,
  9692. __read_only image2d_t source)
  9693. {
  9694. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  9695. int2 location = (int2)(get_global_id(0), get_global_id(1));
  9696. float4 value = read_imagef(source, sampler, location);
  9697. write_imagef(destination, location, value);
  9698. }
  9699. @end verbatim
  9700. @item
  9701. Apply a simple transformation, rotating the input by an amount increasing
  9702. with the index counter. Pixel values are linearly interpolated by the
  9703. sampler, and the output need not have the same dimensions as the input.
  9704. @verbatim
  9705. __kernel void rotate_image(__write_only image2d_t dst,
  9706. unsigned int index,
  9707. __read_only image2d_t src)
  9708. {
  9709. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9710. CLK_FILTER_LINEAR);
  9711. float angle = (float)index / 100.0f;
  9712. float2 dst_dim = convert_float2(get_image_dim(dst));
  9713. float2 src_dim = convert_float2(get_image_dim(src));
  9714. float2 dst_cen = dst_dim / 2.0f;
  9715. float2 src_cen = src_dim / 2.0f;
  9716. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9717. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  9718. float2 src_pos = {
  9719. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  9720. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  9721. };
  9722. src_pos = src_pos * src_dim / dst_dim;
  9723. float2 src_loc = src_pos + src_cen;
  9724. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  9725. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  9726. write_imagef(dst, dst_loc, 0.5f);
  9727. else
  9728. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  9729. }
  9730. @end verbatim
  9731. @item
  9732. Blend two inputs together, with the amount of each input used varying
  9733. with the index counter.
  9734. @verbatim
  9735. __kernel void blend_images(__write_only image2d_t dst,
  9736. unsigned int index,
  9737. __read_only image2d_t src1,
  9738. __read_only image2d_t src2)
  9739. {
  9740. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9741. CLK_FILTER_LINEAR);
  9742. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  9743. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9744. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  9745. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  9746. float4 val1 = read_imagef(src1, sampler, src1_loc);
  9747. float4 val2 = read_imagef(src2, sampler, src2_loc);
  9748. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  9749. }
  9750. @end verbatim
  9751. @end itemize
  9752. @section pseudocolor
  9753. Alter frame colors in video with pseudocolors.
  9754. This filter accept the following options:
  9755. @table @option
  9756. @item c0
  9757. set pixel first component expression
  9758. @item c1
  9759. set pixel second component expression
  9760. @item c2
  9761. set pixel third component expression
  9762. @item c3
  9763. set pixel fourth component expression, corresponds to the alpha component
  9764. @item i
  9765. set component to use as base for altering colors
  9766. @end table
  9767. Each of them specifies the expression to use for computing the lookup table for
  9768. the corresponding pixel component values.
  9769. The expressions can contain the following constants and functions:
  9770. @table @option
  9771. @item w
  9772. @item h
  9773. The input width and height.
  9774. @item val
  9775. The input value for the pixel component.
  9776. @item ymin, umin, vmin, amin
  9777. The minimum allowed component value.
  9778. @item ymax, umax, vmax, amax
  9779. The maximum allowed component value.
  9780. @end table
  9781. All expressions default to "val".
  9782. @subsection Examples
  9783. @itemize
  9784. @item
  9785. Change too high luma values to gradient:
  9786. @example
  9787. 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'"
  9788. @end example
  9789. @end itemize
  9790. @section psnr
  9791. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9792. Ratio) between two input videos.
  9793. This filter takes in input two input videos, the first input is
  9794. considered the "main" source and is passed unchanged to the
  9795. output. The second input is used as a "reference" video for computing
  9796. the PSNR.
  9797. Both video inputs must have the same resolution and pixel format for
  9798. this filter to work correctly. Also it assumes that both inputs
  9799. have the same number of frames, which are compared one by one.
  9800. The obtained average PSNR is printed through the logging system.
  9801. The filter stores the accumulated MSE (mean squared error) of each
  9802. frame, and at the end of the processing it is averaged across all frames
  9803. equally, and the following formula is applied to obtain the PSNR:
  9804. @example
  9805. PSNR = 10*log10(MAX^2/MSE)
  9806. @end example
  9807. Where MAX is the average of the maximum values of each component of the
  9808. image.
  9809. The description of the accepted parameters follows.
  9810. @table @option
  9811. @item stats_file, f
  9812. If specified the filter will use the named file to save the PSNR of
  9813. each individual frame. When filename equals "-" the data is sent to
  9814. standard output.
  9815. @item stats_version
  9816. Specifies which version of the stats file format to use. Details of
  9817. each format are written below.
  9818. Default value is 1.
  9819. @item stats_add_max
  9820. Determines whether the max value is output to the stats log.
  9821. Default value is 0.
  9822. Requires stats_version >= 2. If this is set and stats_version < 2,
  9823. the filter will return an error.
  9824. @end table
  9825. This filter also supports the @ref{framesync} options.
  9826. The file printed if @var{stats_file} is selected, contains a sequence of
  9827. key/value pairs of the form @var{key}:@var{value} for each compared
  9828. couple of frames.
  9829. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9830. the list of per-frame-pair stats, with key value pairs following the frame
  9831. format with the following parameters:
  9832. @table @option
  9833. @item psnr_log_version
  9834. The version of the log file format. Will match @var{stats_version}.
  9835. @item fields
  9836. A comma separated list of the per-frame-pair parameters included in
  9837. the log.
  9838. @end table
  9839. A description of each shown per-frame-pair parameter follows:
  9840. @table @option
  9841. @item n
  9842. sequential number of the input frame, starting from 1
  9843. @item mse_avg
  9844. Mean Square Error pixel-by-pixel average difference of the compared
  9845. frames, averaged over all the image components.
  9846. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  9847. Mean Square Error pixel-by-pixel average difference of the compared
  9848. frames for the component specified by the suffix.
  9849. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9850. Peak Signal to Noise ratio of the compared frames for the component
  9851. specified by the suffix.
  9852. @item max_avg, max_y, max_u, max_v
  9853. Maximum allowed value for each channel, and average over all
  9854. channels.
  9855. @end table
  9856. For example:
  9857. @example
  9858. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9859. [main][ref] psnr="stats_file=stats.log" [out]
  9860. @end example
  9861. On this example the input file being processed is compared with the
  9862. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9863. is stored in @file{stats.log}.
  9864. @anchor{pullup}
  9865. @section pullup
  9866. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9867. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9868. content.
  9869. The pullup filter is designed to take advantage of future context in making
  9870. its decisions. This filter is stateless in the sense that it does not lock
  9871. onto a pattern to follow, but it instead looks forward to the following
  9872. fields in order to identify matches and rebuild progressive frames.
  9873. To produce content with an even framerate, insert the fps filter after
  9874. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9875. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9876. The filter accepts the following options:
  9877. @table @option
  9878. @item jl
  9879. @item jr
  9880. @item jt
  9881. @item jb
  9882. These options set the amount of "junk" to ignore at the left, right, top, and
  9883. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9884. while top and bottom are in units of 2 lines.
  9885. The default is 8 pixels on each side.
  9886. @item sb
  9887. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9888. filter generating an occasional mismatched frame, but it may also cause an
  9889. excessive number of frames to be dropped during high motion sequences.
  9890. Conversely, setting it to -1 will make filter match fields more easily.
  9891. This may help processing of video where there is slight blurring between
  9892. the fields, but may also cause there to be interlaced frames in the output.
  9893. Default value is @code{0}.
  9894. @item mp
  9895. Set the metric plane to use. It accepts the following values:
  9896. @table @samp
  9897. @item l
  9898. Use luma plane.
  9899. @item u
  9900. Use chroma blue plane.
  9901. @item v
  9902. Use chroma red plane.
  9903. @end table
  9904. This option may be set to use chroma plane instead of the default luma plane
  9905. for doing filter's computations. This may improve accuracy on very clean
  9906. source material, but more likely will decrease accuracy, especially if there
  9907. is chroma noise (rainbow effect) or any grayscale video.
  9908. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9909. load and make pullup usable in realtime on slow machines.
  9910. @end table
  9911. For best results (without duplicated frames in the output file) it is
  9912. necessary to change the output frame rate. For example, to inverse
  9913. telecine NTSC input:
  9914. @example
  9915. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9916. @end example
  9917. @section qp
  9918. Change video quantization parameters (QP).
  9919. The filter accepts the following option:
  9920. @table @option
  9921. @item qp
  9922. Set expression for quantization parameter.
  9923. @end table
  9924. The expression is evaluated through the eval API and can contain, among others,
  9925. the following constants:
  9926. @table @var
  9927. @item known
  9928. 1 if index is not 129, 0 otherwise.
  9929. @item qp
  9930. Sequential index starting from -129 to 128.
  9931. @end table
  9932. @subsection Examples
  9933. @itemize
  9934. @item
  9935. Some equation like:
  9936. @example
  9937. qp=2+2*sin(PI*qp)
  9938. @end example
  9939. @end itemize
  9940. @section random
  9941. Flush video frames from internal cache of frames into a random order.
  9942. No frame is discarded.
  9943. Inspired by @ref{frei0r} nervous filter.
  9944. @table @option
  9945. @item frames
  9946. Set size in number of frames of internal cache, in range from @code{2} to
  9947. @code{512}. Default is @code{30}.
  9948. @item seed
  9949. Set seed for random number generator, must be an integer included between
  9950. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9951. less than @code{0}, the filter will try to use a good random seed on a
  9952. best effort basis.
  9953. @end table
  9954. @section readeia608
  9955. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9956. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9957. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9958. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9959. @table @option
  9960. @item lavfi.readeia608.X.cc
  9961. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9962. @item lavfi.readeia608.X.line
  9963. The number of the line on which the EIA-608 data was identified and read.
  9964. @end table
  9965. This filter accepts the following options:
  9966. @table @option
  9967. @item scan_min
  9968. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9969. @item scan_max
  9970. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9971. @item mac
  9972. Set minimal acceptable amplitude change for sync codes detection.
  9973. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9974. @item spw
  9975. Set the ratio of width reserved for sync code detection.
  9976. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9977. @item mhd
  9978. Set the max peaks height difference for sync code detection.
  9979. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9980. @item mpd
  9981. Set max peaks period difference for sync code detection.
  9982. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9983. @item msd
  9984. Set the first two max start code bits differences.
  9985. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9986. @item bhd
  9987. Set the minimum ratio of bits height compared to 3rd start code bit.
  9988. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9989. @item th_w
  9990. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9991. @item th_b
  9992. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9993. @item chp
  9994. Enable checking the parity bit. In the event of a parity error, the filter will output
  9995. @code{0x00} for that character. Default is false.
  9996. @end table
  9997. @subsection Examples
  9998. @itemize
  9999. @item
  10000. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10001. @example
  10002. 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
  10003. @end example
  10004. @end itemize
  10005. @section readvitc
  10006. Read vertical interval timecode (VITC) information from the top lines of a
  10007. video frame.
  10008. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10009. timecode value, if a valid timecode has been detected. Further metadata key
  10010. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10011. timecode data has been found or not.
  10012. This filter accepts the following options:
  10013. @table @option
  10014. @item scan_max
  10015. Set the maximum number of lines to scan for VITC data. If the value is set to
  10016. @code{-1} the full video frame is scanned. Default is @code{45}.
  10017. @item thr_b
  10018. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10019. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10020. @item thr_w
  10021. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10022. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10023. @end table
  10024. @subsection Examples
  10025. @itemize
  10026. @item
  10027. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10028. draw @code{--:--:--:--} as a placeholder:
  10029. @example
  10030. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10031. @end example
  10032. @end itemize
  10033. @section remap
  10034. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10035. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10036. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10037. value for pixel will be used for destination pixel.
  10038. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10039. will have Xmap/Ymap video stream dimensions.
  10040. Xmap and Ymap input video streams are 16bit depth, single channel.
  10041. @section removegrain
  10042. The removegrain filter is a spatial denoiser for progressive video.
  10043. @table @option
  10044. @item m0
  10045. Set mode for the first plane.
  10046. @item m1
  10047. Set mode for the second plane.
  10048. @item m2
  10049. Set mode for the third plane.
  10050. @item m3
  10051. Set mode for the fourth plane.
  10052. @end table
  10053. Range of mode is from 0 to 24. Description of each mode follows:
  10054. @table @var
  10055. @item 0
  10056. Leave input plane unchanged. Default.
  10057. @item 1
  10058. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10059. @item 2
  10060. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10061. @item 3
  10062. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10063. @item 4
  10064. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10065. This is equivalent to a median filter.
  10066. @item 5
  10067. Line-sensitive clipping giving the minimal change.
  10068. @item 6
  10069. Line-sensitive clipping, intermediate.
  10070. @item 7
  10071. Line-sensitive clipping, intermediate.
  10072. @item 8
  10073. Line-sensitive clipping, intermediate.
  10074. @item 9
  10075. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10076. @item 10
  10077. Replaces the target pixel with the closest neighbour.
  10078. @item 11
  10079. [1 2 1] horizontal and vertical kernel blur.
  10080. @item 12
  10081. Same as mode 11.
  10082. @item 13
  10083. Bob mode, interpolates top field from the line where the neighbours
  10084. pixels are the closest.
  10085. @item 14
  10086. Bob mode, interpolates bottom field from the line where the neighbours
  10087. pixels are the closest.
  10088. @item 15
  10089. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10090. interpolation formula.
  10091. @item 16
  10092. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10093. interpolation formula.
  10094. @item 17
  10095. Clips the pixel with the minimum and maximum of respectively the maximum and
  10096. minimum of each pair of opposite neighbour pixels.
  10097. @item 18
  10098. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10099. the current pixel is minimal.
  10100. @item 19
  10101. Replaces the pixel with the average of its 8 neighbours.
  10102. @item 20
  10103. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10104. @item 21
  10105. Clips pixels using the averages of opposite neighbour.
  10106. @item 22
  10107. Same as mode 21 but simpler and faster.
  10108. @item 23
  10109. Small edge and halo removal, but reputed useless.
  10110. @item 24
  10111. Similar as 23.
  10112. @end table
  10113. @section removelogo
  10114. Suppress a TV station logo, using an image file to determine which
  10115. pixels comprise the logo. It works by filling in the pixels that
  10116. comprise the logo with neighboring pixels.
  10117. The filter accepts the following options:
  10118. @table @option
  10119. @item filename, f
  10120. Set the filter bitmap file, which can be any image format supported by
  10121. libavformat. The width and height of the image file must match those of the
  10122. video stream being processed.
  10123. @end table
  10124. Pixels in the provided bitmap image with a value of zero are not
  10125. considered part of the logo, non-zero pixels are considered part of
  10126. the logo. If you use white (255) for the logo and black (0) for the
  10127. rest, you will be safe. For making the filter bitmap, it is
  10128. recommended to take a screen capture of a black frame with the logo
  10129. visible, and then using a threshold filter followed by the erode
  10130. filter once or twice.
  10131. If needed, little splotches can be fixed manually. Remember that if
  10132. logo pixels are not covered, the filter quality will be much
  10133. reduced. Marking too many pixels as part of the logo does not hurt as
  10134. much, but it will increase the amount of blurring needed to cover over
  10135. the image and will destroy more information than necessary, and extra
  10136. pixels will slow things down on a large logo.
  10137. @section repeatfields
  10138. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10139. fields based on its value.
  10140. @section reverse
  10141. Reverse a video clip.
  10142. Warning: This filter requires memory to buffer the entire clip, so trimming
  10143. is suggested.
  10144. @subsection Examples
  10145. @itemize
  10146. @item
  10147. Take the first 5 seconds of a clip, and reverse it.
  10148. @example
  10149. trim=end=5,reverse
  10150. @end example
  10151. @end itemize
  10152. @section roberts
  10153. Apply roberts cross operator to input video stream.
  10154. The filter accepts the following option:
  10155. @table @option
  10156. @item planes
  10157. Set which planes will be processed, unprocessed planes will be copied.
  10158. By default value 0xf, all planes will be processed.
  10159. @item scale
  10160. Set value which will be multiplied with filtered result.
  10161. @item delta
  10162. Set value which will be added to filtered result.
  10163. @end table
  10164. @section rotate
  10165. Rotate video by an arbitrary angle expressed in radians.
  10166. The filter accepts the following options:
  10167. A description of the optional parameters follows.
  10168. @table @option
  10169. @item angle, a
  10170. Set an expression for the angle by which to rotate the input video
  10171. clockwise, expressed as a number of radians. A negative value will
  10172. result in a counter-clockwise rotation. By default it is set to "0".
  10173. This expression is evaluated for each frame.
  10174. @item out_w, ow
  10175. Set the output width expression, default value is "iw".
  10176. This expression is evaluated just once during configuration.
  10177. @item out_h, oh
  10178. Set the output height expression, default value is "ih".
  10179. This expression is evaluated just once during configuration.
  10180. @item bilinear
  10181. Enable bilinear interpolation if set to 1, a value of 0 disables
  10182. it. Default value is 1.
  10183. @item fillcolor, c
  10184. Set the color used to fill the output area not covered by the rotated
  10185. image. For the general syntax of this option, check the
  10186. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10187. If the special value "none" is selected then no
  10188. background is printed (useful for example if the background is never shown).
  10189. Default value is "black".
  10190. @end table
  10191. The expressions for the angle and the output size can contain the
  10192. following constants and functions:
  10193. @table @option
  10194. @item n
  10195. sequential number of the input frame, starting from 0. It is always NAN
  10196. before the first frame is filtered.
  10197. @item t
  10198. time in seconds of the input frame, it is set to 0 when the filter is
  10199. configured. It is always NAN before the first frame is filtered.
  10200. @item hsub
  10201. @item vsub
  10202. horizontal and vertical chroma subsample values. For example for the
  10203. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10204. @item in_w, iw
  10205. @item in_h, ih
  10206. the input video width and height
  10207. @item out_w, ow
  10208. @item out_h, oh
  10209. the output width and height, that is the size of the padded area as
  10210. specified by the @var{width} and @var{height} expressions
  10211. @item rotw(a)
  10212. @item roth(a)
  10213. the minimal width/height required for completely containing the input
  10214. video rotated by @var{a} radians.
  10215. These are only available when computing the @option{out_w} and
  10216. @option{out_h} expressions.
  10217. @end table
  10218. @subsection Examples
  10219. @itemize
  10220. @item
  10221. Rotate the input by PI/6 radians clockwise:
  10222. @example
  10223. rotate=PI/6
  10224. @end example
  10225. @item
  10226. Rotate the input by PI/6 radians counter-clockwise:
  10227. @example
  10228. rotate=-PI/6
  10229. @end example
  10230. @item
  10231. Rotate the input by 45 degrees clockwise:
  10232. @example
  10233. rotate=45*PI/180
  10234. @end example
  10235. @item
  10236. Apply a constant rotation with period T, starting from an angle of PI/3:
  10237. @example
  10238. rotate=PI/3+2*PI*t/T
  10239. @end example
  10240. @item
  10241. Make the input video rotation oscillating with a period of T
  10242. seconds and an amplitude of A radians:
  10243. @example
  10244. rotate=A*sin(2*PI/T*t)
  10245. @end example
  10246. @item
  10247. Rotate the video, output size is chosen so that the whole rotating
  10248. input video is always completely contained in the output:
  10249. @example
  10250. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10251. @end example
  10252. @item
  10253. Rotate the video, reduce the output size so that no background is ever
  10254. shown:
  10255. @example
  10256. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10257. @end example
  10258. @end itemize
  10259. @subsection Commands
  10260. The filter supports the following commands:
  10261. @table @option
  10262. @item a, angle
  10263. Set the angle expression.
  10264. The command accepts the same syntax of the corresponding option.
  10265. If the specified expression is not valid, it is kept at its current
  10266. value.
  10267. @end table
  10268. @section sab
  10269. Apply Shape Adaptive Blur.
  10270. The filter accepts the following options:
  10271. @table @option
  10272. @item luma_radius, lr
  10273. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10274. value is 1.0. A greater value will result in a more blurred image, and
  10275. in slower processing.
  10276. @item luma_pre_filter_radius, lpfr
  10277. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10278. value is 1.0.
  10279. @item luma_strength, ls
  10280. Set luma maximum difference between pixels to still be considered, must
  10281. be a value in the 0.1-100.0 range, default value is 1.0.
  10282. @item chroma_radius, cr
  10283. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10284. greater value will result in a more blurred image, and in slower
  10285. processing.
  10286. @item chroma_pre_filter_radius, cpfr
  10287. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10288. @item chroma_strength, cs
  10289. Set chroma maximum difference between pixels to still be considered,
  10290. must be a value in the -0.9-100.0 range.
  10291. @end table
  10292. Each chroma option value, if not explicitly specified, is set to the
  10293. corresponding luma option value.
  10294. @anchor{scale}
  10295. @section scale
  10296. Scale (resize) the input video, using the libswscale library.
  10297. The scale filter forces the output display aspect ratio to be the same
  10298. of the input, by changing the output sample aspect ratio.
  10299. If the input image format is different from the format requested by
  10300. the next filter, the scale filter will convert the input to the
  10301. requested format.
  10302. @subsection Options
  10303. The filter accepts the following options, or any of the options
  10304. supported by the libswscale scaler.
  10305. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10306. the complete list of scaler options.
  10307. @table @option
  10308. @item width, w
  10309. @item height, h
  10310. Set the output video dimension expression. Default value is the input
  10311. dimension.
  10312. If the @var{width} or @var{w} value is 0, the input width is used for
  10313. the output. If the @var{height} or @var{h} value is 0, the input height
  10314. is used for the output.
  10315. If one and only one of the values is -n with n >= 1, the scale filter
  10316. will use a value that maintains the aspect ratio of the input image,
  10317. calculated from the other specified dimension. After that it will,
  10318. however, make sure that the calculated dimension is divisible by n and
  10319. adjust the value if necessary.
  10320. If both values are -n with n >= 1, the behavior will be identical to
  10321. both values being set to 0 as previously detailed.
  10322. See below for the list of accepted constants for use in the dimension
  10323. expression.
  10324. @item eval
  10325. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10326. @table @samp
  10327. @item init
  10328. Only evaluate expressions once during the filter initialization or when a command is processed.
  10329. @item frame
  10330. Evaluate expressions for each incoming frame.
  10331. @end table
  10332. Default value is @samp{init}.
  10333. @item interl
  10334. Set the interlacing mode. It accepts the following values:
  10335. @table @samp
  10336. @item 1
  10337. Force interlaced aware scaling.
  10338. @item 0
  10339. Do not apply interlaced scaling.
  10340. @item -1
  10341. Select interlaced aware scaling depending on whether the source frames
  10342. are flagged as interlaced or not.
  10343. @end table
  10344. Default value is @samp{0}.
  10345. @item flags
  10346. Set libswscale scaling flags. See
  10347. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10348. complete list of values. If not explicitly specified the filter applies
  10349. the default flags.
  10350. @item param0, param1
  10351. Set libswscale input parameters for scaling algorithms that need them. See
  10352. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10353. complete documentation. If not explicitly specified the filter applies
  10354. empty parameters.
  10355. @item size, s
  10356. Set the video size. For the syntax of this option, check the
  10357. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10358. @item in_color_matrix
  10359. @item out_color_matrix
  10360. Set in/output YCbCr color space type.
  10361. This allows the autodetected value to be overridden as well as allows forcing
  10362. a specific value used for the output and encoder.
  10363. If not specified, the color space type depends on the pixel format.
  10364. Possible values:
  10365. @table @samp
  10366. @item auto
  10367. Choose automatically.
  10368. @item bt709
  10369. Format conforming to International Telecommunication Union (ITU)
  10370. Recommendation BT.709.
  10371. @item fcc
  10372. Set color space conforming to the United States Federal Communications
  10373. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10374. @item bt601
  10375. Set color space conforming to:
  10376. @itemize
  10377. @item
  10378. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10379. @item
  10380. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10381. @item
  10382. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10383. @end itemize
  10384. @item smpte240m
  10385. Set color space conforming to SMPTE ST 240:1999.
  10386. @end table
  10387. @item in_range
  10388. @item out_range
  10389. Set in/output YCbCr sample range.
  10390. This allows the autodetected value to be overridden as well as allows forcing
  10391. a specific value used for the output and encoder. If not specified, the
  10392. range depends on the pixel format. Possible values:
  10393. @table @samp
  10394. @item auto/unknown
  10395. Choose automatically.
  10396. @item jpeg/full/pc
  10397. Set full range (0-255 in case of 8-bit luma).
  10398. @item mpeg/limited/tv
  10399. Set "MPEG" range (16-235 in case of 8-bit luma).
  10400. @end table
  10401. @item force_original_aspect_ratio
  10402. Enable decreasing or increasing output video width or height if necessary to
  10403. keep the original aspect ratio. Possible values:
  10404. @table @samp
  10405. @item disable
  10406. Scale the video as specified and disable this feature.
  10407. @item decrease
  10408. The output video dimensions will automatically be decreased if needed.
  10409. @item increase
  10410. The output video dimensions will automatically be increased if needed.
  10411. @end table
  10412. One useful instance of this option is that when you know a specific device's
  10413. maximum allowed resolution, you can use this to limit the output video to
  10414. that, while retaining the aspect ratio. For example, device A allows
  10415. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10416. decrease) and specifying 1280x720 to the command line makes the output
  10417. 1280x533.
  10418. Please note that this is a different thing than specifying -1 for @option{w}
  10419. or @option{h}, you still need to specify the output resolution for this option
  10420. to work.
  10421. @end table
  10422. The values of the @option{w} and @option{h} options are expressions
  10423. containing the following constants:
  10424. @table @var
  10425. @item in_w
  10426. @item in_h
  10427. The input width and height
  10428. @item iw
  10429. @item ih
  10430. These are the same as @var{in_w} and @var{in_h}.
  10431. @item out_w
  10432. @item out_h
  10433. The output (scaled) width and height
  10434. @item ow
  10435. @item oh
  10436. These are the same as @var{out_w} and @var{out_h}
  10437. @item a
  10438. The same as @var{iw} / @var{ih}
  10439. @item sar
  10440. input sample aspect ratio
  10441. @item dar
  10442. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10443. @item hsub
  10444. @item vsub
  10445. horizontal and vertical input chroma subsample values. For example for the
  10446. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10447. @item ohsub
  10448. @item ovsub
  10449. horizontal and vertical output chroma subsample values. For example for the
  10450. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10451. @end table
  10452. @subsection Examples
  10453. @itemize
  10454. @item
  10455. Scale the input video to a size of 200x100
  10456. @example
  10457. scale=w=200:h=100
  10458. @end example
  10459. This is equivalent to:
  10460. @example
  10461. scale=200:100
  10462. @end example
  10463. or:
  10464. @example
  10465. scale=200x100
  10466. @end example
  10467. @item
  10468. Specify a size abbreviation for the output size:
  10469. @example
  10470. scale=qcif
  10471. @end example
  10472. which can also be written as:
  10473. @example
  10474. scale=size=qcif
  10475. @end example
  10476. @item
  10477. Scale the input to 2x:
  10478. @example
  10479. scale=w=2*iw:h=2*ih
  10480. @end example
  10481. @item
  10482. The above is the same as:
  10483. @example
  10484. scale=2*in_w:2*in_h
  10485. @end example
  10486. @item
  10487. Scale the input to 2x with forced interlaced scaling:
  10488. @example
  10489. scale=2*iw:2*ih:interl=1
  10490. @end example
  10491. @item
  10492. Scale the input to half size:
  10493. @example
  10494. scale=w=iw/2:h=ih/2
  10495. @end example
  10496. @item
  10497. Increase the width, and set the height to the same size:
  10498. @example
  10499. scale=3/2*iw:ow
  10500. @end example
  10501. @item
  10502. Seek Greek harmony:
  10503. @example
  10504. scale=iw:1/PHI*iw
  10505. scale=ih*PHI:ih
  10506. @end example
  10507. @item
  10508. Increase the height, and set the width to 3/2 of the height:
  10509. @example
  10510. scale=w=3/2*oh:h=3/5*ih
  10511. @end example
  10512. @item
  10513. Increase the size, making the size a multiple of the chroma
  10514. subsample values:
  10515. @example
  10516. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10517. @end example
  10518. @item
  10519. Increase the width to a maximum of 500 pixels,
  10520. keeping the same aspect ratio as the input:
  10521. @example
  10522. scale=w='min(500\, iw*3/2):h=-1'
  10523. @end example
  10524. @item
  10525. Make pixels square by combining scale and setsar:
  10526. @example
  10527. scale='trunc(ih*dar):ih',setsar=1/1
  10528. @end example
  10529. @item
  10530. Make pixels square by combining scale and setsar,
  10531. making sure the resulting resolution is even (required by some codecs):
  10532. @example
  10533. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10534. @end example
  10535. @end itemize
  10536. @subsection Commands
  10537. This filter supports the following commands:
  10538. @table @option
  10539. @item width, w
  10540. @item height, h
  10541. Set the output video dimension expression.
  10542. The command accepts the same syntax of the corresponding option.
  10543. If the specified expression is not valid, it is kept at its current
  10544. value.
  10545. @end table
  10546. @section scale_npp
  10547. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10548. format conversion on CUDA video frames. Setting the output width and height
  10549. works in the same way as for the @var{scale} filter.
  10550. The following additional options are accepted:
  10551. @table @option
  10552. @item format
  10553. The pixel format of the output CUDA frames. If set to the string "same" (the
  10554. default), the input format will be kept. Note that automatic format negotiation
  10555. and conversion is not yet supported for hardware frames
  10556. @item interp_algo
  10557. The interpolation algorithm used for resizing. One of the following:
  10558. @table @option
  10559. @item nn
  10560. Nearest neighbour.
  10561. @item linear
  10562. @item cubic
  10563. @item cubic2p_bspline
  10564. 2-parameter cubic (B=1, C=0)
  10565. @item cubic2p_catmullrom
  10566. 2-parameter cubic (B=0, C=1/2)
  10567. @item cubic2p_b05c03
  10568. 2-parameter cubic (B=1/2, C=3/10)
  10569. @item super
  10570. Supersampling
  10571. @item lanczos
  10572. @end table
  10573. @end table
  10574. @section scale2ref
  10575. Scale (resize) the input video, based on a reference video.
  10576. See the scale filter for available options, scale2ref supports the same but
  10577. uses the reference video instead of the main input as basis. scale2ref also
  10578. supports the following additional constants for the @option{w} and
  10579. @option{h} options:
  10580. @table @var
  10581. @item main_w
  10582. @item main_h
  10583. The main input video's width and height
  10584. @item main_a
  10585. The same as @var{main_w} / @var{main_h}
  10586. @item main_sar
  10587. The main input video's sample aspect ratio
  10588. @item main_dar, mdar
  10589. The main input video's display aspect ratio. Calculated from
  10590. @code{(main_w / main_h) * main_sar}.
  10591. @item main_hsub
  10592. @item main_vsub
  10593. The main input video's horizontal and vertical chroma subsample values.
  10594. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10595. is 1.
  10596. @end table
  10597. @subsection Examples
  10598. @itemize
  10599. @item
  10600. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10601. @example
  10602. 'scale2ref[b][a];[a][b]overlay'
  10603. @end example
  10604. @end itemize
  10605. @anchor{selectivecolor}
  10606. @section selectivecolor
  10607. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10608. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10609. by the "purity" of the color (that is, how saturated it already is).
  10610. This filter is similar to the Adobe Photoshop Selective Color tool.
  10611. The filter accepts the following options:
  10612. @table @option
  10613. @item correction_method
  10614. Select color correction method.
  10615. Available values are:
  10616. @table @samp
  10617. @item absolute
  10618. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10619. component value).
  10620. @item relative
  10621. Specified adjustments are relative to the original component value.
  10622. @end table
  10623. Default is @code{absolute}.
  10624. @item reds
  10625. Adjustments for red pixels (pixels where the red component is the maximum)
  10626. @item yellows
  10627. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10628. @item greens
  10629. Adjustments for green pixels (pixels where the green component is the maximum)
  10630. @item cyans
  10631. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10632. @item blues
  10633. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10634. @item magentas
  10635. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10636. @item whites
  10637. Adjustments for white pixels (pixels where all components are greater than 128)
  10638. @item neutrals
  10639. Adjustments for all pixels except pure black and pure white
  10640. @item blacks
  10641. Adjustments for black pixels (pixels where all components are lesser than 128)
  10642. @item psfile
  10643. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10644. @end table
  10645. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10646. 4 space separated floating point adjustment values in the [-1,1] range,
  10647. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10648. pixels of its range.
  10649. @subsection Examples
  10650. @itemize
  10651. @item
  10652. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10653. increase magenta by 27% in blue areas:
  10654. @example
  10655. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10656. @end example
  10657. @item
  10658. Use a Photoshop selective color preset:
  10659. @example
  10660. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10661. @end example
  10662. @end itemize
  10663. @anchor{separatefields}
  10664. @section separatefields
  10665. The @code{separatefields} takes a frame-based video input and splits
  10666. each frame into its components fields, producing a new half height clip
  10667. with twice the frame rate and twice the frame count.
  10668. This filter use field-dominance information in frame to decide which
  10669. of each pair of fields to place first in the output.
  10670. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10671. @section setdar, setsar
  10672. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10673. output video.
  10674. This is done by changing the specified Sample (aka Pixel) Aspect
  10675. Ratio, according to the following equation:
  10676. @example
  10677. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10678. @end example
  10679. Keep in mind that the @code{setdar} filter does not modify the pixel
  10680. dimensions of the video frame. Also, the display aspect ratio set by
  10681. this filter may be changed by later filters in the filterchain,
  10682. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10683. applied.
  10684. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10685. the filter output video.
  10686. Note that as a consequence of the application of this filter, the
  10687. output display aspect ratio will change according to the equation
  10688. above.
  10689. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10690. filter may be changed by later filters in the filterchain, e.g. if
  10691. another "setsar" or a "setdar" filter is applied.
  10692. It accepts the following parameters:
  10693. @table @option
  10694. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10695. Set the aspect ratio used by the filter.
  10696. The parameter can be a floating point number string, an expression, or
  10697. a string of the form @var{num}:@var{den}, where @var{num} and
  10698. @var{den} are the numerator and denominator of the aspect ratio. If
  10699. the parameter is not specified, it is assumed the value "0".
  10700. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10701. should be escaped.
  10702. @item max
  10703. Set the maximum integer value to use for expressing numerator and
  10704. denominator when reducing the expressed aspect ratio to a rational.
  10705. Default value is @code{100}.
  10706. @end table
  10707. The parameter @var{sar} is an expression containing
  10708. the following constants:
  10709. @table @option
  10710. @item E, PI, PHI
  10711. These are approximated values for the mathematical constants e
  10712. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10713. @item w, h
  10714. The input width and height.
  10715. @item a
  10716. These are the same as @var{w} / @var{h}.
  10717. @item sar
  10718. The input sample aspect ratio.
  10719. @item dar
  10720. The input display aspect ratio. It is the same as
  10721. (@var{w} / @var{h}) * @var{sar}.
  10722. @item hsub, vsub
  10723. Horizontal and vertical chroma subsample values. For example, for the
  10724. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10725. @end table
  10726. @subsection Examples
  10727. @itemize
  10728. @item
  10729. To change the display aspect ratio to 16:9, specify one of the following:
  10730. @example
  10731. setdar=dar=1.77777
  10732. setdar=dar=16/9
  10733. @end example
  10734. @item
  10735. To change the sample aspect ratio to 10:11, specify:
  10736. @example
  10737. setsar=sar=10/11
  10738. @end example
  10739. @item
  10740. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10741. 1000 in the aspect ratio reduction, use the command:
  10742. @example
  10743. setdar=ratio=16/9:max=1000
  10744. @end example
  10745. @end itemize
  10746. @anchor{setfield}
  10747. @section setfield
  10748. Force field for the output video frame.
  10749. The @code{setfield} filter marks the interlace type field for the
  10750. output frames. It does not change the input frame, but only sets the
  10751. corresponding property, which affects how the frame is treated by
  10752. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10753. The filter accepts the following options:
  10754. @table @option
  10755. @item mode
  10756. Available values are:
  10757. @table @samp
  10758. @item auto
  10759. Keep the same field property.
  10760. @item bff
  10761. Mark the frame as bottom-field-first.
  10762. @item tff
  10763. Mark the frame as top-field-first.
  10764. @item prog
  10765. Mark the frame as progressive.
  10766. @end table
  10767. @end table
  10768. @section showinfo
  10769. Show a line containing various information for each input video frame.
  10770. The input video is not modified.
  10771. The shown line contains a sequence of key/value pairs of the form
  10772. @var{key}:@var{value}.
  10773. The following values are shown in the output:
  10774. @table @option
  10775. @item n
  10776. The (sequential) number of the input frame, starting from 0.
  10777. @item pts
  10778. The Presentation TimeStamp of the input frame, expressed as a number of
  10779. time base units. The time base unit depends on the filter input pad.
  10780. @item pts_time
  10781. The Presentation TimeStamp of the input frame, expressed as a number of
  10782. seconds.
  10783. @item pos
  10784. The position of the frame in the input stream, or -1 if this information is
  10785. unavailable and/or meaningless (for example in case of synthetic video).
  10786. @item fmt
  10787. The pixel format name.
  10788. @item sar
  10789. The sample aspect ratio of the input frame, expressed in the form
  10790. @var{num}/@var{den}.
  10791. @item s
  10792. The size of the input frame. For the syntax of this option, check the
  10793. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10794. @item i
  10795. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10796. for bottom field first).
  10797. @item iskey
  10798. This is 1 if the frame is a key frame, 0 otherwise.
  10799. @item type
  10800. The picture type of the input frame ("I" for an I-frame, "P" for a
  10801. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10802. Also refer to the documentation of the @code{AVPictureType} enum and of
  10803. the @code{av_get_picture_type_char} function defined in
  10804. @file{libavutil/avutil.h}.
  10805. @item checksum
  10806. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10807. @item plane_checksum
  10808. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10809. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10810. @end table
  10811. @section showpalette
  10812. Displays the 256 colors palette of each frame. This filter is only relevant for
  10813. @var{pal8} pixel format frames.
  10814. It accepts the following option:
  10815. @table @option
  10816. @item s
  10817. Set the size of the box used to represent one palette color entry. Default is
  10818. @code{30} (for a @code{30x30} pixel box).
  10819. @end table
  10820. @section shuffleframes
  10821. Reorder and/or duplicate and/or drop video frames.
  10822. It accepts the following parameters:
  10823. @table @option
  10824. @item mapping
  10825. Set the destination indexes of input frames.
  10826. This is space or '|' separated list of indexes that maps input frames to output
  10827. frames. Number of indexes also sets maximal value that each index may have.
  10828. '-1' index have special meaning and that is to drop frame.
  10829. @end table
  10830. The first frame has the index 0. The default is to keep the input unchanged.
  10831. @subsection Examples
  10832. @itemize
  10833. @item
  10834. Swap second and third frame of every three frames of the input:
  10835. @example
  10836. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10837. @end example
  10838. @item
  10839. Swap 10th and 1st frame of every ten frames of the input:
  10840. @example
  10841. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10842. @end example
  10843. @end itemize
  10844. @section shuffleplanes
  10845. Reorder and/or duplicate video planes.
  10846. It accepts the following parameters:
  10847. @table @option
  10848. @item map0
  10849. The index of the input plane to be used as the first output plane.
  10850. @item map1
  10851. The index of the input plane to be used as the second output plane.
  10852. @item map2
  10853. The index of the input plane to be used as the third output plane.
  10854. @item map3
  10855. The index of the input plane to be used as the fourth output plane.
  10856. @end table
  10857. The first plane has the index 0. The default is to keep the input unchanged.
  10858. @subsection Examples
  10859. @itemize
  10860. @item
  10861. Swap the second and third planes of the input:
  10862. @example
  10863. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10864. @end example
  10865. @end itemize
  10866. @anchor{signalstats}
  10867. @section signalstats
  10868. Evaluate various visual metrics that assist in determining issues associated
  10869. with the digitization of analog video media.
  10870. By default the filter will log these metadata values:
  10871. @table @option
  10872. @item YMIN
  10873. Display the minimal Y value contained within the input frame. Expressed in
  10874. range of [0-255].
  10875. @item YLOW
  10876. Display the Y value at the 10% percentile within the input frame. Expressed in
  10877. range of [0-255].
  10878. @item YAVG
  10879. Display the average Y value within the input frame. Expressed in range of
  10880. [0-255].
  10881. @item YHIGH
  10882. Display the Y value at the 90% percentile within the input frame. Expressed in
  10883. range of [0-255].
  10884. @item YMAX
  10885. Display the maximum Y value contained within the input frame. Expressed in
  10886. range of [0-255].
  10887. @item UMIN
  10888. Display the minimal U value contained within the input frame. Expressed in
  10889. range of [0-255].
  10890. @item ULOW
  10891. Display the U value at the 10% percentile within the input frame. Expressed in
  10892. range of [0-255].
  10893. @item UAVG
  10894. Display the average U value within the input frame. Expressed in range of
  10895. [0-255].
  10896. @item UHIGH
  10897. Display the U value at the 90% percentile within the input frame. Expressed in
  10898. range of [0-255].
  10899. @item UMAX
  10900. Display the maximum U value contained within the input frame. Expressed in
  10901. range of [0-255].
  10902. @item VMIN
  10903. Display the minimal V value contained within the input frame. Expressed in
  10904. range of [0-255].
  10905. @item VLOW
  10906. Display the V value at the 10% percentile within the input frame. Expressed in
  10907. range of [0-255].
  10908. @item VAVG
  10909. Display the average V value within the input frame. Expressed in range of
  10910. [0-255].
  10911. @item VHIGH
  10912. Display the V value at the 90% percentile within the input frame. Expressed in
  10913. range of [0-255].
  10914. @item VMAX
  10915. Display the maximum V value contained within the input frame. Expressed in
  10916. range of [0-255].
  10917. @item SATMIN
  10918. Display the minimal saturation value contained within the input frame.
  10919. Expressed in range of [0-~181.02].
  10920. @item SATLOW
  10921. Display the saturation value at the 10% percentile within the input frame.
  10922. Expressed in range of [0-~181.02].
  10923. @item SATAVG
  10924. Display the average saturation value within the input frame. Expressed in range
  10925. of [0-~181.02].
  10926. @item SATHIGH
  10927. Display the saturation value at the 90% percentile within the input frame.
  10928. Expressed in range of [0-~181.02].
  10929. @item SATMAX
  10930. Display the maximum saturation value contained within the input frame.
  10931. Expressed in range of [0-~181.02].
  10932. @item HUEMED
  10933. Display the median value for hue within the input frame. Expressed in range of
  10934. [0-360].
  10935. @item HUEAVG
  10936. Display the average value for hue within the input frame. Expressed in range of
  10937. [0-360].
  10938. @item YDIF
  10939. Display the average of sample value difference between all values of the Y
  10940. plane in the current frame and corresponding values of the previous input frame.
  10941. Expressed in range of [0-255].
  10942. @item UDIF
  10943. Display the average of sample value difference between all values of the U
  10944. plane in the current frame and corresponding values of the previous input frame.
  10945. Expressed in range of [0-255].
  10946. @item VDIF
  10947. Display the average of sample value difference between all values of the V
  10948. plane in the current frame and corresponding values of the previous input frame.
  10949. Expressed in range of [0-255].
  10950. @item YBITDEPTH
  10951. Display bit depth of Y plane in current frame.
  10952. Expressed in range of [0-16].
  10953. @item UBITDEPTH
  10954. Display bit depth of U plane in current frame.
  10955. Expressed in range of [0-16].
  10956. @item VBITDEPTH
  10957. Display bit depth of V plane in current frame.
  10958. Expressed in range of [0-16].
  10959. @end table
  10960. The filter accepts the following options:
  10961. @table @option
  10962. @item stat
  10963. @item out
  10964. @option{stat} specify an additional form of image analysis.
  10965. @option{out} output video with the specified type of pixel highlighted.
  10966. Both options accept the following values:
  10967. @table @samp
  10968. @item tout
  10969. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10970. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10971. include the results of video dropouts, head clogs, or tape tracking issues.
  10972. @item vrep
  10973. Identify @var{vertical line repetition}. Vertical line repetition includes
  10974. similar rows of pixels within a frame. In born-digital video vertical line
  10975. repetition is common, but this pattern is uncommon in video digitized from an
  10976. analog source. When it occurs in video that results from the digitization of an
  10977. analog source it can indicate concealment from a dropout compensator.
  10978. @item brng
  10979. Identify pixels that fall outside of legal broadcast range.
  10980. @end table
  10981. @item color, c
  10982. Set the highlight color for the @option{out} option. The default color is
  10983. yellow.
  10984. @end table
  10985. @subsection Examples
  10986. @itemize
  10987. @item
  10988. Output data of various video metrics:
  10989. @example
  10990. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10991. @end example
  10992. @item
  10993. Output specific data about the minimum and maximum values of the Y plane per frame:
  10994. @example
  10995. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10996. @end example
  10997. @item
  10998. Playback video while highlighting pixels that are outside of broadcast range in red.
  10999. @example
  11000. ffplay example.mov -vf signalstats="out=brng:color=red"
  11001. @end example
  11002. @item
  11003. Playback video with signalstats metadata drawn over the frame.
  11004. @example
  11005. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11006. @end example
  11007. The contents of signalstat_drawtext.txt used in the command are:
  11008. @example
  11009. time %@{pts:hms@}
  11010. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11011. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11012. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11013. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11014. @end example
  11015. @end itemize
  11016. @anchor{signature}
  11017. @section signature
  11018. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11019. input. In this case the matching between the inputs can be calculated additionally.
  11020. The filter always passes through the first input. The signature of each stream can
  11021. be written into a file.
  11022. It accepts the following options:
  11023. @table @option
  11024. @item detectmode
  11025. Enable or disable the matching process.
  11026. Available values are:
  11027. @table @samp
  11028. @item off
  11029. Disable the calculation of a matching (default).
  11030. @item full
  11031. Calculate the matching for the whole video and output whether the whole video
  11032. matches or only parts.
  11033. @item fast
  11034. Calculate only until a matching is found or the video ends. Should be faster in
  11035. some cases.
  11036. @end table
  11037. @item nb_inputs
  11038. Set the number of inputs. The option value must be a non negative integer.
  11039. Default value is 1.
  11040. @item filename
  11041. Set the path to which the output is written. If there is more than one input,
  11042. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11043. integer), that will be replaced with the input number. If no filename is
  11044. specified, no output will be written. This is the default.
  11045. @item format
  11046. Choose the output format.
  11047. Available values are:
  11048. @table @samp
  11049. @item binary
  11050. Use the specified binary representation (default).
  11051. @item xml
  11052. Use the specified xml representation.
  11053. @end table
  11054. @item th_d
  11055. Set threshold to detect one word as similar. The option value must be an integer
  11056. greater than zero. The default value is 9000.
  11057. @item th_dc
  11058. Set threshold to detect all words as similar. The option value must be an integer
  11059. greater than zero. The default value is 60000.
  11060. @item th_xh
  11061. Set threshold to detect frames as similar. The option value must be an integer
  11062. greater than zero. The default value is 116.
  11063. @item th_di
  11064. Set the minimum length of a sequence in frames to recognize it as matching
  11065. sequence. The option value must be a non negative integer value.
  11066. The default value is 0.
  11067. @item th_it
  11068. Set the minimum relation, that matching frames to all frames must have.
  11069. The option value must be a double value between 0 and 1. The default value is 0.5.
  11070. @end table
  11071. @subsection Examples
  11072. @itemize
  11073. @item
  11074. To calculate the signature of an input video and store it in signature.bin:
  11075. @example
  11076. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11077. @end example
  11078. @item
  11079. To detect whether two videos match and store the signatures in XML format in
  11080. signature0.xml and signature1.xml:
  11081. @example
  11082. 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 -
  11083. @end example
  11084. @end itemize
  11085. @anchor{smartblur}
  11086. @section smartblur
  11087. Blur the input video without impacting the outlines.
  11088. It accepts the following options:
  11089. @table @option
  11090. @item luma_radius, lr
  11091. Set the luma radius. The option value must be a float number in
  11092. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11093. used to blur the image (slower if larger). Default value is 1.0.
  11094. @item luma_strength, ls
  11095. Set the luma strength. The option value must be a float number
  11096. in the range [-1.0,1.0] that configures the blurring. A value included
  11097. in [0.0,1.0] will blur the image whereas a value included in
  11098. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11099. @item luma_threshold, lt
  11100. Set the luma threshold used as a coefficient to determine
  11101. whether a pixel should be blurred or not. The option value must be an
  11102. integer in the range [-30,30]. A value of 0 will filter all the image,
  11103. a value included in [0,30] will filter flat areas and a value included
  11104. in [-30,0] will filter edges. Default value is 0.
  11105. @item chroma_radius, cr
  11106. Set the chroma radius. The option value must be a float number in
  11107. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11108. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11109. @item chroma_strength, cs
  11110. Set the chroma strength. The option value must be a float number
  11111. in the range [-1.0,1.0] that configures the blurring. A value included
  11112. in [0.0,1.0] will blur the image whereas a value included in
  11113. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11114. @item chroma_threshold, ct
  11115. Set the chroma threshold used as a coefficient to determine
  11116. whether a pixel should be blurred or not. The option value must be an
  11117. integer in the range [-30,30]. A value of 0 will filter all the image,
  11118. a value included in [0,30] will filter flat areas and a value included
  11119. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11120. @end table
  11121. If a chroma option is not explicitly set, the corresponding luma value
  11122. is set.
  11123. @section ssim
  11124. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11125. This filter takes in input two input videos, the first input is
  11126. considered the "main" source and is passed unchanged to the
  11127. output. The second input is used as a "reference" video for computing
  11128. the SSIM.
  11129. Both video inputs must have the same resolution and pixel format for
  11130. this filter to work correctly. Also it assumes that both inputs
  11131. have the same number of frames, which are compared one by one.
  11132. The filter stores the calculated SSIM of each frame.
  11133. The description of the accepted parameters follows.
  11134. @table @option
  11135. @item stats_file, f
  11136. If specified the filter will use the named file to save the SSIM of
  11137. each individual frame. When filename equals "-" the data is sent to
  11138. standard output.
  11139. @end table
  11140. The file printed if @var{stats_file} is selected, contains a sequence of
  11141. key/value pairs of the form @var{key}:@var{value} for each compared
  11142. couple of frames.
  11143. A description of each shown parameter follows:
  11144. @table @option
  11145. @item n
  11146. sequential number of the input frame, starting from 1
  11147. @item Y, U, V, R, G, B
  11148. SSIM of the compared frames for the component specified by the suffix.
  11149. @item All
  11150. SSIM of the compared frames for the whole frame.
  11151. @item dB
  11152. Same as above but in dB representation.
  11153. @end table
  11154. This filter also supports the @ref{framesync} options.
  11155. For example:
  11156. @example
  11157. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11158. [main][ref] ssim="stats_file=stats.log" [out]
  11159. @end example
  11160. On this example the input file being processed is compared with the
  11161. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11162. is stored in @file{stats.log}.
  11163. Another example with both psnr and ssim at same time:
  11164. @example
  11165. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11166. @end example
  11167. @section stereo3d
  11168. Convert between different stereoscopic image formats.
  11169. The filters accept the following options:
  11170. @table @option
  11171. @item in
  11172. Set stereoscopic image format of input.
  11173. Available values for input image formats are:
  11174. @table @samp
  11175. @item sbsl
  11176. side by side parallel (left eye left, right eye right)
  11177. @item sbsr
  11178. side by side crosseye (right eye left, left eye right)
  11179. @item sbs2l
  11180. side by side parallel with half width resolution
  11181. (left eye left, right eye right)
  11182. @item sbs2r
  11183. side by side crosseye with half width resolution
  11184. (right eye left, left eye right)
  11185. @item abl
  11186. above-below (left eye above, right eye below)
  11187. @item abr
  11188. above-below (right eye above, left eye below)
  11189. @item ab2l
  11190. above-below with half height resolution
  11191. (left eye above, right eye below)
  11192. @item ab2r
  11193. above-below with half height resolution
  11194. (right eye above, left eye below)
  11195. @item al
  11196. alternating frames (left eye first, right eye second)
  11197. @item ar
  11198. alternating frames (right eye first, left eye second)
  11199. @item irl
  11200. interleaved rows (left eye has top row, right eye starts on next row)
  11201. @item irr
  11202. interleaved rows (right eye has top row, left eye starts on next row)
  11203. @item icl
  11204. interleaved columns, left eye first
  11205. @item icr
  11206. interleaved columns, right eye first
  11207. Default value is @samp{sbsl}.
  11208. @end table
  11209. @item out
  11210. Set stereoscopic image format of output.
  11211. @table @samp
  11212. @item sbsl
  11213. side by side parallel (left eye left, right eye right)
  11214. @item sbsr
  11215. side by side crosseye (right eye left, left eye right)
  11216. @item sbs2l
  11217. side by side parallel with half width resolution
  11218. (left eye left, right eye right)
  11219. @item sbs2r
  11220. side by side crosseye with half width resolution
  11221. (right eye left, left eye right)
  11222. @item abl
  11223. above-below (left eye above, right eye below)
  11224. @item abr
  11225. above-below (right eye above, left eye below)
  11226. @item ab2l
  11227. above-below with half height resolution
  11228. (left eye above, right eye below)
  11229. @item ab2r
  11230. above-below with half height resolution
  11231. (right eye above, left eye below)
  11232. @item al
  11233. alternating frames (left eye first, right eye second)
  11234. @item ar
  11235. alternating frames (right eye first, left eye second)
  11236. @item irl
  11237. interleaved rows (left eye has top row, right eye starts on next row)
  11238. @item irr
  11239. interleaved rows (right eye has top row, left eye starts on next row)
  11240. @item arbg
  11241. anaglyph red/blue gray
  11242. (red filter on left eye, blue filter on right eye)
  11243. @item argg
  11244. anaglyph red/green gray
  11245. (red filter on left eye, green filter on right eye)
  11246. @item arcg
  11247. anaglyph red/cyan gray
  11248. (red filter on left eye, cyan filter on right eye)
  11249. @item arch
  11250. anaglyph red/cyan half colored
  11251. (red filter on left eye, cyan filter on right eye)
  11252. @item arcc
  11253. anaglyph red/cyan color
  11254. (red filter on left eye, cyan filter on right eye)
  11255. @item arcd
  11256. anaglyph red/cyan color optimized with the least squares projection of dubois
  11257. (red filter on left eye, cyan filter on right eye)
  11258. @item agmg
  11259. anaglyph green/magenta gray
  11260. (green filter on left eye, magenta filter on right eye)
  11261. @item agmh
  11262. anaglyph green/magenta half colored
  11263. (green filter on left eye, magenta filter on right eye)
  11264. @item agmc
  11265. anaglyph green/magenta colored
  11266. (green filter on left eye, magenta filter on right eye)
  11267. @item agmd
  11268. anaglyph green/magenta color optimized with the least squares projection of dubois
  11269. (green filter on left eye, magenta filter on right eye)
  11270. @item aybg
  11271. anaglyph yellow/blue gray
  11272. (yellow filter on left eye, blue filter on right eye)
  11273. @item aybh
  11274. anaglyph yellow/blue half colored
  11275. (yellow filter on left eye, blue filter on right eye)
  11276. @item aybc
  11277. anaglyph yellow/blue colored
  11278. (yellow filter on left eye, blue filter on right eye)
  11279. @item aybd
  11280. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11281. (yellow filter on left eye, blue filter on right eye)
  11282. @item ml
  11283. mono output (left eye only)
  11284. @item mr
  11285. mono output (right eye only)
  11286. @item chl
  11287. checkerboard, left eye first
  11288. @item chr
  11289. checkerboard, right eye first
  11290. @item icl
  11291. interleaved columns, left eye first
  11292. @item icr
  11293. interleaved columns, right eye first
  11294. @item hdmi
  11295. HDMI frame pack
  11296. @end table
  11297. Default value is @samp{arcd}.
  11298. @end table
  11299. @subsection Examples
  11300. @itemize
  11301. @item
  11302. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11303. @example
  11304. stereo3d=sbsl:aybd
  11305. @end example
  11306. @item
  11307. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11308. @example
  11309. stereo3d=abl:sbsr
  11310. @end example
  11311. @end itemize
  11312. @section streamselect, astreamselect
  11313. Select video or audio streams.
  11314. The filter accepts the following options:
  11315. @table @option
  11316. @item inputs
  11317. Set number of inputs. Default is 2.
  11318. @item map
  11319. Set input indexes to remap to outputs.
  11320. @end table
  11321. @subsection Commands
  11322. The @code{streamselect} and @code{astreamselect} filter supports the following
  11323. commands:
  11324. @table @option
  11325. @item map
  11326. Set input indexes to remap to outputs.
  11327. @end table
  11328. @subsection Examples
  11329. @itemize
  11330. @item
  11331. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11332. @example
  11333. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11334. @end example
  11335. @item
  11336. Same as above, but for audio:
  11337. @example
  11338. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11339. @end example
  11340. @end itemize
  11341. @section sobel
  11342. Apply sobel operator to input video stream.
  11343. The filter accepts the following option:
  11344. @table @option
  11345. @item planes
  11346. Set which planes will be processed, unprocessed planes will be copied.
  11347. By default value 0xf, all planes will be processed.
  11348. @item scale
  11349. Set value which will be multiplied with filtered result.
  11350. @item delta
  11351. Set value which will be added to filtered result.
  11352. @end table
  11353. @anchor{spp}
  11354. @section spp
  11355. Apply a simple postprocessing filter that compresses and decompresses the image
  11356. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11357. and average the results.
  11358. The filter accepts the following options:
  11359. @table @option
  11360. @item quality
  11361. Set quality. This option defines the number of levels for averaging. It accepts
  11362. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11363. effect. A value of @code{6} means the higher quality. For each increment of
  11364. that value the speed drops by a factor of approximately 2. Default value is
  11365. @code{3}.
  11366. @item qp
  11367. Force a constant quantization parameter. If not set, the filter will use the QP
  11368. from the video stream (if available).
  11369. @item mode
  11370. Set thresholding mode. Available modes are:
  11371. @table @samp
  11372. @item hard
  11373. Set hard thresholding (default).
  11374. @item soft
  11375. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11376. @end table
  11377. @item use_bframe_qp
  11378. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11379. option may cause flicker since the B-Frames have often larger QP. Default is
  11380. @code{0} (not enabled).
  11381. @end table
  11382. @anchor{subtitles}
  11383. @section subtitles
  11384. Draw subtitles on top of input video using the libass library.
  11385. To enable compilation of this filter you need to configure FFmpeg with
  11386. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11387. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11388. Alpha) subtitles format.
  11389. The filter accepts the following options:
  11390. @table @option
  11391. @item filename, f
  11392. Set the filename of the subtitle file to read. It must be specified.
  11393. @item original_size
  11394. Specify the size of the original video, the video for which the ASS file
  11395. was composed. For the syntax of this option, check the
  11396. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11397. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11398. correctly scale the fonts if the aspect ratio has been changed.
  11399. @item fontsdir
  11400. Set a directory path containing fonts that can be used by the filter.
  11401. These fonts will be used in addition to whatever the font provider uses.
  11402. @item alpha
  11403. Process alpha channel, by default alpha channel is untouched.
  11404. @item charenc
  11405. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11406. useful if not UTF-8.
  11407. @item stream_index, si
  11408. Set subtitles stream index. @code{subtitles} filter only.
  11409. @item force_style
  11410. Override default style or script info parameters of the subtitles. It accepts a
  11411. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11412. @end table
  11413. If the first key is not specified, it is assumed that the first value
  11414. specifies the @option{filename}.
  11415. For example, to render the file @file{sub.srt} on top of the input
  11416. video, use the command:
  11417. @example
  11418. subtitles=sub.srt
  11419. @end example
  11420. which is equivalent to:
  11421. @example
  11422. subtitles=filename=sub.srt
  11423. @end example
  11424. To render the default subtitles stream from file @file{video.mkv}, use:
  11425. @example
  11426. subtitles=video.mkv
  11427. @end example
  11428. To render the second subtitles stream from that file, use:
  11429. @example
  11430. subtitles=video.mkv:si=1
  11431. @end example
  11432. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11433. @code{DejaVu Serif}, use:
  11434. @example
  11435. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11436. @end example
  11437. @section super2xsai
  11438. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11439. Interpolate) pixel art scaling algorithm.
  11440. Useful for enlarging pixel art images without reducing sharpness.
  11441. @section swaprect
  11442. Swap two rectangular objects in video.
  11443. This filter accepts the following options:
  11444. @table @option
  11445. @item w
  11446. Set object width.
  11447. @item h
  11448. Set object height.
  11449. @item x1
  11450. Set 1st rect x coordinate.
  11451. @item y1
  11452. Set 1st rect y coordinate.
  11453. @item x2
  11454. Set 2nd rect x coordinate.
  11455. @item y2
  11456. Set 2nd rect y coordinate.
  11457. All expressions are evaluated once for each frame.
  11458. @end table
  11459. The all options are expressions containing the following constants:
  11460. @table @option
  11461. @item w
  11462. @item h
  11463. The input width and height.
  11464. @item a
  11465. same as @var{w} / @var{h}
  11466. @item sar
  11467. input sample aspect ratio
  11468. @item dar
  11469. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11470. @item n
  11471. The number of the input frame, starting from 0.
  11472. @item t
  11473. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11474. @item pos
  11475. the position in the file of the input frame, NAN if unknown
  11476. @end table
  11477. @section swapuv
  11478. Swap U & V plane.
  11479. @section telecine
  11480. Apply telecine process to the video.
  11481. This filter accepts the following options:
  11482. @table @option
  11483. @item first_field
  11484. @table @samp
  11485. @item top, t
  11486. top field first
  11487. @item bottom, b
  11488. bottom field first
  11489. The default value is @code{top}.
  11490. @end table
  11491. @item pattern
  11492. A string of numbers representing the pulldown pattern you wish to apply.
  11493. The default value is @code{23}.
  11494. @end table
  11495. @example
  11496. Some typical patterns:
  11497. NTSC output (30i):
  11498. 27.5p: 32222
  11499. 24p: 23 (classic)
  11500. 24p: 2332 (preferred)
  11501. 20p: 33
  11502. 18p: 334
  11503. 16p: 3444
  11504. PAL output (25i):
  11505. 27.5p: 12222
  11506. 24p: 222222222223 ("Euro pulldown")
  11507. 16.67p: 33
  11508. 16p: 33333334
  11509. @end example
  11510. @section threshold
  11511. Apply threshold effect to video stream.
  11512. This filter needs four video streams to perform thresholding.
  11513. First stream is stream we are filtering.
  11514. Second stream is holding threshold values, third stream is holding min values,
  11515. and last, fourth stream is holding max values.
  11516. The filter accepts the following option:
  11517. @table @option
  11518. @item planes
  11519. Set which planes will be processed, unprocessed planes will be copied.
  11520. By default value 0xf, all planes will be processed.
  11521. @end table
  11522. For example if first stream pixel's component value is less then threshold value
  11523. of pixel component from 2nd threshold stream, third stream value will picked,
  11524. otherwise fourth stream pixel component value will be picked.
  11525. Using color source filter one can perform various types of thresholding:
  11526. @subsection Examples
  11527. @itemize
  11528. @item
  11529. Binary threshold, using gray color as threshold:
  11530. @example
  11531. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11532. @end example
  11533. @item
  11534. Inverted binary threshold, using gray color as threshold:
  11535. @example
  11536. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11537. @end example
  11538. @item
  11539. Truncate binary threshold, using gray color as threshold:
  11540. @example
  11541. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11542. @end example
  11543. @item
  11544. Threshold to zero, using gray color as threshold:
  11545. @example
  11546. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11547. @end example
  11548. @item
  11549. Inverted threshold to zero, using gray color as threshold:
  11550. @example
  11551. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11552. @end example
  11553. @end itemize
  11554. @section thumbnail
  11555. Select the most representative frame in a given sequence of consecutive frames.
  11556. The filter accepts the following options:
  11557. @table @option
  11558. @item n
  11559. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11560. will pick one of them, and then handle the next batch of @var{n} frames until
  11561. the end. Default is @code{100}.
  11562. @end table
  11563. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11564. value will result in a higher memory usage, so a high value is not recommended.
  11565. @subsection Examples
  11566. @itemize
  11567. @item
  11568. Extract one picture each 50 frames:
  11569. @example
  11570. thumbnail=50
  11571. @end example
  11572. @item
  11573. Complete example of a thumbnail creation with @command{ffmpeg}:
  11574. @example
  11575. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11576. @end example
  11577. @end itemize
  11578. @section tile
  11579. Tile several successive frames together.
  11580. The filter accepts the following options:
  11581. @table @option
  11582. @item layout
  11583. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11584. this option, check the
  11585. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11586. @item nb_frames
  11587. Set the maximum number of frames to render in the given area. It must be less
  11588. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11589. the area will be used.
  11590. @item margin
  11591. Set the outer border margin in pixels.
  11592. @item padding
  11593. Set the inner border thickness (i.e. the number of pixels between frames). For
  11594. more advanced padding options (such as having different values for the edges),
  11595. refer to the pad video filter.
  11596. @item color
  11597. Specify the color of the unused area. For the syntax of this option, check the
  11598. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11599. The default value of @var{color} is "black".
  11600. @item overlap
  11601. Set the number of frames to overlap when tiling several successive frames together.
  11602. The value must be between @code{0} and @var{nb_frames - 1}.
  11603. @item init_padding
  11604. Set the number of frames to initially be empty before displaying first output frame.
  11605. This controls how soon will one get first output frame.
  11606. The value must be between @code{0} and @var{nb_frames - 1}.
  11607. @end table
  11608. @subsection Examples
  11609. @itemize
  11610. @item
  11611. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11612. @example
  11613. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11614. @end example
  11615. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11616. duplicating each output frame to accommodate the originally detected frame
  11617. rate.
  11618. @item
  11619. Display @code{5} pictures in an area of @code{3x2} frames,
  11620. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11621. mixed flat and named options:
  11622. @example
  11623. tile=3x2:nb_frames=5:padding=7:margin=2
  11624. @end example
  11625. @end itemize
  11626. @section tinterlace
  11627. Perform various types of temporal field interlacing.
  11628. Frames are counted starting from 1, so the first input frame is
  11629. considered odd.
  11630. The filter accepts the following options:
  11631. @table @option
  11632. @item mode
  11633. Specify the mode of the interlacing. This option can also be specified
  11634. as a value alone. See below for a list of values for this option.
  11635. Available values are:
  11636. @table @samp
  11637. @item merge, 0
  11638. Move odd frames into the upper field, even into the lower field,
  11639. generating a double height frame at half frame rate.
  11640. @example
  11641. ------> time
  11642. Input:
  11643. Frame 1 Frame 2 Frame 3 Frame 4
  11644. 11111 22222 33333 44444
  11645. 11111 22222 33333 44444
  11646. 11111 22222 33333 44444
  11647. 11111 22222 33333 44444
  11648. Output:
  11649. 11111 33333
  11650. 22222 44444
  11651. 11111 33333
  11652. 22222 44444
  11653. 11111 33333
  11654. 22222 44444
  11655. 11111 33333
  11656. 22222 44444
  11657. @end example
  11658. @item drop_even, 1
  11659. Only output odd frames, even frames are dropped, generating a frame with
  11660. unchanged height at half frame rate.
  11661. @example
  11662. ------> time
  11663. Input:
  11664. Frame 1 Frame 2 Frame 3 Frame 4
  11665. 11111 22222 33333 44444
  11666. 11111 22222 33333 44444
  11667. 11111 22222 33333 44444
  11668. 11111 22222 33333 44444
  11669. Output:
  11670. 11111 33333
  11671. 11111 33333
  11672. 11111 33333
  11673. 11111 33333
  11674. @end example
  11675. @item drop_odd, 2
  11676. Only output even frames, odd frames are dropped, generating a frame with
  11677. unchanged height at half frame rate.
  11678. @example
  11679. ------> time
  11680. Input:
  11681. Frame 1 Frame 2 Frame 3 Frame 4
  11682. 11111 22222 33333 44444
  11683. 11111 22222 33333 44444
  11684. 11111 22222 33333 44444
  11685. 11111 22222 33333 44444
  11686. Output:
  11687. 22222 44444
  11688. 22222 44444
  11689. 22222 44444
  11690. 22222 44444
  11691. @end example
  11692. @item pad, 3
  11693. Expand each frame to full height, but pad alternate lines with black,
  11694. generating a frame with double height at the same input frame rate.
  11695. @example
  11696. ------> time
  11697. Input:
  11698. Frame 1 Frame 2 Frame 3 Frame 4
  11699. 11111 22222 33333 44444
  11700. 11111 22222 33333 44444
  11701. 11111 22222 33333 44444
  11702. 11111 22222 33333 44444
  11703. Output:
  11704. 11111 ..... 33333 .....
  11705. ..... 22222 ..... 44444
  11706. 11111 ..... 33333 .....
  11707. ..... 22222 ..... 44444
  11708. 11111 ..... 33333 .....
  11709. ..... 22222 ..... 44444
  11710. 11111 ..... 33333 .....
  11711. ..... 22222 ..... 44444
  11712. @end example
  11713. @item interleave_top, 4
  11714. Interleave the upper field from odd frames with the lower field from
  11715. even frames, generating a frame with unchanged height at half frame rate.
  11716. @example
  11717. ------> time
  11718. Input:
  11719. Frame 1 Frame 2 Frame 3 Frame 4
  11720. 11111<- 22222 33333<- 44444
  11721. 11111 22222<- 33333 44444<-
  11722. 11111<- 22222 33333<- 44444
  11723. 11111 22222<- 33333 44444<-
  11724. Output:
  11725. 11111 33333
  11726. 22222 44444
  11727. 11111 33333
  11728. 22222 44444
  11729. @end example
  11730. @item interleave_bottom, 5
  11731. Interleave the lower field from odd frames with the upper field from
  11732. even frames, generating a frame with unchanged height at half frame rate.
  11733. @example
  11734. ------> time
  11735. Input:
  11736. Frame 1 Frame 2 Frame 3 Frame 4
  11737. 11111 22222<- 33333 44444<-
  11738. 11111<- 22222 33333<- 44444
  11739. 11111 22222<- 33333 44444<-
  11740. 11111<- 22222 33333<- 44444
  11741. Output:
  11742. 22222 44444
  11743. 11111 33333
  11744. 22222 44444
  11745. 11111 33333
  11746. @end example
  11747. @item interlacex2, 6
  11748. Double frame rate with unchanged height. Frames are inserted each
  11749. containing the second temporal field from the previous input frame and
  11750. the first temporal field from the next input frame. This mode relies on
  11751. the top_field_first flag. Useful for interlaced video displays with no
  11752. field synchronisation.
  11753. @example
  11754. ------> time
  11755. Input:
  11756. Frame 1 Frame 2 Frame 3 Frame 4
  11757. 11111 22222 33333 44444
  11758. 11111 22222 33333 44444
  11759. 11111 22222 33333 44444
  11760. 11111 22222 33333 44444
  11761. Output:
  11762. 11111 22222 22222 33333 33333 44444 44444
  11763. 11111 11111 22222 22222 33333 33333 44444
  11764. 11111 22222 22222 33333 33333 44444 44444
  11765. 11111 11111 22222 22222 33333 33333 44444
  11766. @end example
  11767. @item mergex2, 7
  11768. Move odd frames into the upper field, even into the lower field,
  11769. generating a double height frame at same frame rate.
  11770. @example
  11771. ------> time
  11772. Input:
  11773. Frame 1 Frame 2 Frame 3 Frame 4
  11774. 11111 22222 33333 44444
  11775. 11111 22222 33333 44444
  11776. 11111 22222 33333 44444
  11777. 11111 22222 33333 44444
  11778. Output:
  11779. 11111 33333 33333 55555
  11780. 22222 22222 44444 44444
  11781. 11111 33333 33333 55555
  11782. 22222 22222 44444 44444
  11783. 11111 33333 33333 55555
  11784. 22222 22222 44444 44444
  11785. 11111 33333 33333 55555
  11786. 22222 22222 44444 44444
  11787. @end example
  11788. @end table
  11789. Numeric values are deprecated but are accepted for backward
  11790. compatibility reasons.
  11791. Default mode is @code{merge}.
  11792. @item flags
  11793. Specify flags influencing the filter process.
  11794. Available value for @var{flags} is:
  11795. @table @option
  11796. @item low_pass_filter, vlfp
  11797. Enable linear vertical low-pass filtering in the filter.
  11798. Vertical low-pass filtering is required when creating an interlaced
  11799. destination from a progressive source which contains high-frequency
  11800. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11801. patterning.
  11802. @item complex_filter, cvlfp
  11803. Enable complex vertical low-pass filtering.
  11804. This will slightly less reduce interlace 'twitter' and Moire
  11805. patterning but better retain detail and subjective sharpness impression.
  11806. @end table
  11807. Vertical low-pass filtering can only be enabled for @option{mode}
  11808. @var{interleave_top} and @var{interleave_bottom}.
  11809. @end table
  11810. @section tonemap
  11811. Tone map colors from different dynamic ranges.
  11812. This filter expects data in single precision floating point, as it needs to
  11813. operate on (and can output) out-of-range values. Another filter, such as
  11814. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11815. The tonemapping algorithms implemented only work on linear light, so input
  11816. data should be linearized beforehand (and possibly correctly tagged).
  11817. @example
  11818. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11819. @end example
  11820. @subsection Options
  11821. The filter accepts the following options.
  11822. @table @option
  11823. @item tonemap
  11824. Set the tone map algorithm to use.
  11825. Possible values are:
  11826. @table @var
  11827. @item none
  11828. Do not apply any tone map, only desaturate overbright pixels.
  11829. @item clip
  11830. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11831. in-range values, while distorting out-of-range values.
  11832. @item linear
  11833. Stretch the entire reference gamut to a linear multiple of the display.
  11834. @item gamma
  11835. Fit a logarithmic transfer between the tone curves.
  11836. @item reinhard
  11837. Preserve overall image brightness with a simple curve, using nonlinear
  11838. contrast, which results in flattening details and degrading color accuracy.
  11839. @item hable
  11840. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11841. of slightly darkening everything. Use it when detail preservation is more
  11842. important than color and brightness accuracy.
  11843. @item mobius
  11844. Smoothly map out-of-range values, while retaining contrast and colors for
  11845. in-range material as much as possible. Use it when color accuracy is more
  11846. important than detail preservation.
  11847. @end table
  11848. Default is none.
  11849. @item param
  11850. Tune the tone mapping algorithm.
  11851. This affects the following algorithms:
  11852. @table @var
  11853. @item none
  11854. Ignored.
  11855. @item linear
  11856. Specifies the scale factor to use while stretching.
  11857. Default to 1.0.
  11858. @item gamma
  11859. Specifies the exponent of the function.
  11860. Default to 1.8.
  11861. @item clip
  11862. Specify an extra linear coefficient to multiply into the signal before clipping.
  11863. Default to 1.0.
  11864. @item reinhard
  11865. Specify the local contrast coefficient at the display peak.
  11866. Default to 0.5, which means that in-gamut values will be about half as bright
  11867. as when clipping.
  11868. @item hable
  11869. Ignored.
  11870. @item mobius
  11871. Specify the transition point from linear to mobius transform. Every value
  11872. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11873. more accurate the result will be, at the cost of losing bright details.
  11874. Default to 0.3, which due to the steep initial slope still preserves in-range
  11875. colors fairly accurately.
  11876. @end table
  11877. @item desat
  11878. Apply desaturation for highlights that exceed this level of brightness. The
  11879. higher the parameter, the more color information will be preserved. This
  11880. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11881. (smoothly) turning into white instead. This makes images feel more natural,
  11882. at the cost of reducing information about out-of-range colors.
  11883. The default of 2.0 is somewhat conservative and will mostly just apply to
  11884. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11885. This option works only if the input frame has a supported color tag.
  11886. @item peak
  11887. Override signal/nominal/reference peak with this value. Useful when the
  11888. embedded peak information in display metadata is not reliable or when tone
  11889. mapping from a lower range to a higher range.
  11890. @end table
  11891. @section transpose
  11892. Transpose rows with columns in the input video and optionally flip it.
  11893. It accepts the following parameters:
  11894. @table @option
  11895. @item dir
  11896. Specify the transposition direction.
  11897. Can assume the following values:
  11898. @table @samp
  11899. @item 0, 4, cclock_flip
  11900. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11901. @example
  11902. L.R L.l
  11903. . . -> . .
  11904. l.r R.r
  11905. @end example
  11906. @item 1, 5, clock
  11907. Rotate by 90 degrees clockwise, that is:
  11908. @example
  11909. L.R l.L
  11910. . . -> . .
  11911. l.r r.R
  11912. @end example
  11913. @item 2, 6, cclock
  11914. Rotate by 90 degrees counterclockwise, that is:
  11915. @example
  11916. L.R R.r
  11917. . . -> . .
  11918. l.r L.l
  11919. @end example
  11920. @item 3, 7, clock_flip
  11921. Rotate by 90 degrees clockwise and vertically flip, that is:
  11922. @example
  11923. L.R r.R
  11924. . . -> . .
  11925. l.r l.L
  11926. @end example
  11927. @end table
  11928. For values between 4-7, the transposition is only done if the input
  11929. video geometry is portrait and not landscape. These values are
  11930. deprecated, the @code{passthrough} option should be used instead.
  11931. Numerical values are deprecated, and should be dropped in favor of
  11932. symbolic constants.
  11933. @item passthrough
  11934. Do not apply the transposition if the input geometry matches the one
  11935. specified by the specified value. It accepts the following values:
  11936. @table @samp
  11937. @item none
  11938. Always apply transposition.
  11939. @item portrait
  11940. Preserve portrait geometry (when @var{height} >= @var{width}).
  11941. @item landscape
  11942. Preserve landscape geometry (when @var{width} >= @var{height}).
  11943. @end table
  11944. Default value is @code{none}.
  11945. @end table
  11946. For example to rotate by 90 degrees clockwise and preserve portrait
  11947. layout:
  11948. @example
  11949. transpose=dir=1:passthrough=portrait
  11950. @end example
  11951. The command above can also be specified as:
  11952. @example
  11953. transpose=1:portrait
  11954. @end example
  11955. @section trim
  11956. Trim the input so that the output contains one continuous subpart of the input.
  11957. It accepts the following parameters:
  11958. @table @option
  11959. @item start
  11960. Specify the time of the start of the kept section, i.e. the frame with the
  11961. timestamp @var{start} will be the first frame in the output.
  11962. @item end
  11963. Specify the time of the first frame that will be dropped, i.e. the frame
  11964. immediately preceding the one with the timestamp @var{end} will be the last
  11965. frame in the output.
  11966. @item start_pts
  11967. This is the same as @var{start}, except this option sets the start timestamp
  11968. in timebase units instead of seconds.
  11969. @item end_pts
  11970. This is the same as @var{end}, except this option sets the end timestamp
  11971. in timebase units instead of seconds.
  11972. @item duration
  11973. The maximum duration of the output in seconds.
  11974. @item start_frame
  11975. The number of the first frame that should be passed to the output.
  11976. @item end_frame
  11977. The number of the first frame that should be dropped.
  11978. @end table
  11979. @option{start}, @option{end}, and @option{duration} are expressed as time
  11980. duration specifications; see
  11981. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11982. for the accepted syntax.
  11983. Note that the first two sets of the start/end options and the @option{duration}
  11984. option look at the frame timestamp, while the _frame variants simply count the
  11985. frames that pass through the filter. Also note that this filter does not modify
  11986. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11987. setpts filter after the trim filter.
  11988. If multiple start or end options are set, this filter tries to be greedy and
  11989. keep all the frames that match at least one of the specified constraints. To keep
  11990. only the part that matches all the constraints at once, chain multiple trim
  11991. filters.
  11992. The defaults are such that all the input is kept. So it is possible to set e.g.
  11993. just the end values to keep everything before the specified time.
  11994. Examples:
  11995. @itemize
  11996. @item
  11997. Drop everything except the second minute of input:
  11998. @example
  11999. ffmpeg -i INPUT -vf trim=60:120
  12000. @end example
  12001. @item
  12002. Keep only the first second:
  12003. @example
  12004. ffmpeg -i INPUT -vf trim=duration=1
  12005. @end example
  12006. @end itemize
  12007. @section unpremultiply
  12008. Apply alpha unpremultiply effect to input video stream using first plane
  12009. of second stream as alpha.
  12010. Both streams must have same dimensions and same pixel format.
  12011. The filter accepts the following option:
  12012. @table @option
  12013. @item planes
  12014. Set which planes will be processed, unprocessed planes will be copied.
  12015. By default value 0xf, all planes will be processed.
  12016. If the format has 1 or 2 components, then luma is bit 0.
  12017. If the format has 3 or 4 components:
  12018. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12019. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12020. If present, the alpha channel is always the last bit.
  12021. @item inplace
  12022. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12023. @end table
  12024. @anchor{unsharp}
  12025. @section unsharp
  12026. Sharpen or blur the input video.
  12027. It accepts the following parameters:
  12028. @table @option
  12029. @item luma_msize_x, lx
  12030. Set the luma matrix horizontal size. It must be an odd integer between
  12031. 3 and 23. The default value is 5.
  12032. @item luma_msize_y, ly
  12033. Set the luma matrix vertical size. It must be an odd integer between 3
  12034. and 23. The default value is 5.
  12035. @item luma_amount, la
  12036. Set the luma effect strength. It must be a floating point number, reasonable
  12037. values lay between -1.5 and 1.5.
  12038. Negative values will blur the input video, while positive values will
  12039. sharpen it, a value of zero will disable the effect.
  12040. Default value is 1.0.
  12041. @item chroma_msize_x, cx
  12042. Set the chroma matrix horizontal size. It must be an odd integer
  12043. between 3 and 23. The default value is 5.
  12044. @item chroma_msize_y, cy
  12045. Set the chroma matrix vertical size. It must be an odd integer
  12046. between 3 and 23. The default value is 5.
  12047. @item chroma_amount, ca
  12048. Set the chroma effect strength. It must be a floating point number, reasonable
  12049. values lay between -1.5 and 1.5.
  12050. Negative values will blur the input video, while positive values will
  12051. sharpen it, a value of zero will disable the effect.
  12052. Default value is 0.0.
  12053. @end table
  12054. All parameters are optional and default to the equivalent of the
  12055. string '5:5:1.0:5:5:0.0'.
  12056. @subsection Examples
  12057. @itemize
  12058. @item
  12059. Apply strong luma sharpen effect:
  12060. @example
  12061. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12062. @end example
  12063. @item
  12064. Apply a strong blur of both luma and chroma parameters:
  12065. @example
  12066. unsharp=7:7:-2:7:7:-2
  12067. @end example
  12068. @end itemize
  12069. @section uspp
  12070. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12071. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12072. shifts and average the results.
  12073. The way this differs from the behavior of spp is that uspp actually encodes &
  12074. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12075. DCT similar to MJPEG.
  12076. The filter accepts the following options:
  12077. @table @option
  12078. @item quality
  12079. Set quality. This option defines the number of levels for averaging. It accepts
  12080. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12081. effect. A value of @code{8} means the higher quality. For each increment of
  12082. that value the speed drops by a factor of approximately 2. Default value is
  12083. @code{3}.
  12084. @item qp
  12085. Force a constant quantization parameter. If not set, the filter will use the QP
  12086. from the video stream (if available).
  12087. @end table
  12088. @section vaguedenoiser
  12089. Apply a wavelet based denoiser.
  12090. It transforms each frame from the video input into the wavelet domain,
  12091. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12092. the obtained coefficients. It does an inverse wavelet transform after.
  12093. Due to wavelet properties, it should give a nice smoothed result, and
  12094. reduced noise, without blurring picture features.
  12095. This filter accepts the following options:
  12096. @table @option
  12097. @item threshold
  12098. The filtering strength. The higher, the more filtered the video will be.
  12099. Hard thresholding can use a higher threshold than soft thresholding
  12100. before the video looks overfiltered. Default value is 2.
  12101. @item method
  12102. The filtering method the filter will use.
  12103. It accepts the following values:
  12104. @table @samp
  12105. @item hard
  12106. All values under the threshold will be zeroed.
  12107. @item soft
  12108. All values under the threshold will be zeroed. All values above will be
  12109. reduced by the threshold.
  12110. @item garrote
  12111. Scales or nullifies coefficients - intermediary between (more) soft and
  12112. (less) hard thresholding.
  12113. @end table
  12114. Default is garrote.
  12115. @item nsteps
  12116. Number of times, the wavelet will decompose the picture. Picture can't
  12117. be decomposed beyond a particular point (typically, 8 for a 640x480
  12118. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12119. @item percent
  12120. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12121. @item planes
  12122. A list of the planes to process. By default all planes are processed.
  12123. @end table
  12124. @section vectorscope
  12125. Display 2 color component values in the two dimensional graph (which is called
  12126. a vectorscope).
  12127. This filter accepts the following options:
  12128. @table @option
  12129. @item mode, m
  12130. Set vectorscope mode.
  12131. It accepts the following values:
  12132. @table @samp
  12133. @item gray
  12134. Gray values are displayed on graph, higher brightness means more pixels have
  12135. same component color value on location in graph. This is the default mode.
  12136. @item color
  12137. Gray values are displayed on graph. Surrounding pixels values which are not
  12138. present in video frame are drawn in gradient of 2 color components which are
  12139. set by option @code{x} and @code{y}. The 3rd color component is static.
  12140. @item color2
  12141. Actual color components values present in video frame are displayed on graph.
  12142. @item color3
  12143. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12144. on graph increases value of another color component, which is luminance by
  12145. default values of @code{x} and @code{y}.
  12146. @item color4
  12147. Actual colors present in video frame are displayed on graph. If two different
  12148. colors map to same position on graph then color with higher value of component
  12149. not present in graph is picked.
  12150. @item color5
  12151. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12152. component picked from radial gradient.
  12153. @end table
  12154. @item x
  12155. Set which color component will be represented on X-axis. Default is @code{1}.
  12156. @item y
  12157. Set which color component will be represented on Y-axis. Default is @code{2}.
  12158. @item intensity, i
  12159. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12160. of color component which represents frequency of (X, Y) location in graph.
  12161. @item envelope, e
  12162. @table @samp
  12163. @item none
  12164. No envelope, this is default.
  12165. @item instant
  12166. Instant envelope, even darkest single pixel will be clearly highlighted.
  12167. @item peak
  12168. Hold maximum and minimum values presented in graph over time. This way you
  12169. can still spot out of range values without constantly looking at vectorscope.
  12170. @item peak+instant
  12171. Peak and instant envelope combined together.
  12172. @end table
  12173. @item graticule, g
  12174. Set what kind of graticule to draw.
  12175. @table @samp
  12176. @item none
  12177. @item green
  12178. @item color
  12179. @end table
  12180. @item opacity, o
  12181. Set graticule opacity.
  12182. @item flags, f
  12183. Set graticule flags.
  12184. @table @samp
  12185. @item white
  12186. Draw graticule for white point.
  12187. @item black
  12188. Draw graticule for black point.
  12189. @item name
  12190. Draw color points short names.
  12191. @end table
  12192. @item bgopacity, b
  12193. Set background opacity.
  12194. @item lthreshold, l
  12195. Set low threshold for color component not represented on X or Y axis.
  12196. Values lower than this value will be ignored. Default is 0.
  12197. Note this value is multiplied with actual max possible value one pixel component
  12198. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12199. is 0.1 * 255 = 25.
  12200. @item hthreshold, h
  12201. Set high threshold for color component not represented on X or Y axis.
  12202. Values higher than this value will be ignored. Default is 1.
  12203. Note this value is multiplied with actual max possible value one pixel component
  12204. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12205. is 0.9 * 255 = 230.
  12206. @item colorspace, c
  12207. Set what kind of colorspace to use when drawing graticule.
  12208. @table @samp
  12209. @item auto
  12210. @item 601
  12211. @item 709
  12212. @end table
  12213. Default is auto.
  12214. @end table
  12215. @anchor{vidstabdetect}
  12216. @section vidstabdetect
  12217. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12218. @ref{vidstabtransform} for pass 2.
  12219. This filter generates a file with relative translation and rotation
  12220. transform information about subsequent frames, which is then used by
  12221. the @ref{vidstabtransform} filter.
  12222. To enable compilation of this filter you need to configure FFmpeg with
  12223. @code{--enable-libvidstab}.
  12224. This filter accepts the following options:
  12225. @table @option
  12226. @item result
  12227. Set the path to the file used to write the transforms information.
  12228. Default value is @file{transforms.trf}.
  12229. @item shakiness
  12230. Set how shaky the video is and how quick the camera is. It accepts an
  12231. integer in the range 1-10, a value of 1 means little shakiness, a
  12232. value of 10 means strong shakiness. Default value is 5.
  12233. @item accuracy
  12234. Set the accuracy of the detection process. It must be a value in the
  12235. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12236. accuracy. Default value is 15.
  12237. @item stepsize
  12238. Set stepsize of the search process. The region around minimum is
  12239. scanned with 1 pixel resolution. Default value is 6.
  12240. @item mincontrast
  12241. Set minimum contrast. Below this value a local measurement field is
  12242. discarded. Must be a floating point value in the range 0-1. Default
  12243. value is 0.3.
  12244. @item tripod
  12245. Set reference frame number for tripod mode.
  12246. If enabled, the motion of the frames is compared to a reference frame
  12247. in the filtered stream, identified by the specified number. The idea
  12248. is to compensate all movements in a more-or-less static scene and keep
  12249. the camera view absolutely still.
  12250. If set to 0, it is disabled. The frames are counted starting from 1.
  12251. @item show
  12252. Show fields and transforms in the resulting frames. It accepts an
  12253. integer in the range 0-2. Default value is 0, which disables any
  12254. visualization.
  12255. @end table
  12256. @subsection Examples
  12257. @itemize
  12258. @item
  12259. Use default values:
  12260. @example
  12261. vidstabdetect
  12262. @end example
  12263. @item
  12264. Analyze strongly shaky movie and put the results in file
  12265. @file{mytransforms.trf}:
  12266. @example
  12267. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12268. @end example
  12269. @item
  12270. Visualize the result of internal transformations in the resulting
  12271. video:
  12272. @example
  12273. vidstabdetect=show=1
  12274. @end example
  12275. @item
  12276. Analyze a video with medium shakiness using @command{ffmpeg}:
  12277. @example
  12278. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12279. @end example
  12280. @end itemize
  12281. @anchor{vidstabtransform}
  12282. @section vidstabtransform
  12283. Video stabilization/deshaking: pass 2 of 2,
  12284. see @ref{vidstabdetect} for pass 1.
  12285. Read a file with transform information for each frame and
  12286. apply/compensate them. Together with the @ref{vidstabdetect}
  12287. filter this can be used to deshake videos. See also
  12288. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12289. the @ref{unsharp} filter, see below.
  12290. To enable compilation of this filter you need to configure FFmpeg with
  12291. @code{--enable-libvidstab}.
  12292. @subsection Options
  12293. @table @option
  12294. @item input
  12295. Set path to the file used to read the transforms. Default value is
  12296. @file{transforms.trf}.
  12297. @item smoothing
  12298. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12299. camera movements. Default value is 10.
  12300. For example a number of 10 means that 21 frames are used (10 in the
  12301. past and 10 in the future) to smoothen the motion in the video. A
  12302. larger value leads to a smoother video, but limits the acceleration of
  12303. the camera (pan/tilt movements). 0 is a special case where a static
  12304. camera is simulated.
  12305. @item optalgo
  12306. Set the camera path optimization algorithm.
  12307. Accepted values are:
  12308. @table @samp
  12309. @item gauss
  12310. gaussian kernel low-pass filter on camera motion (default)
  12311. @item avg
  12312. averaging on transformations
  12313. @end table
  12314. @item maxshift
  12315. Set maximal number of pixels to translate frames. Default value is -1,
  12316. meaning no limit.
  12317. @item maxangle
  12318. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12319. value is -1, meaning no limit.
  12320. @item crop
  12321. Specify how to deal with borders that may be visible due to movement
  12322. compensation.
  12323. Available values are:
  12324. @table @samp
  12325. @item keep
  12326. keep image information from previous frame (default)
  12327. @item black
  12328. fill the border black
  12329. @end table
  12330. @item invert
  12331. Invert transforms if set to 1. Default value is 0.
  12332. @item relative
  12333. Consider transforms as relative to previous frame if set to 1,
  12334. absolute if set to 0. Default value is 0.
  12335. @item zoom
  12336. Set percentage to zoom. A positive value will result in a zoom-in
  12337. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12338. zoom).
  12339. @item optzoom
  12340. Set optimal zooming to avoid borders.
  12341. Accepted values are:
  12342. @table @samp
  12343. @item 0
  12344. disabled
  12345. @item 1
  12346. optimal static zoom value is determined (only very strong movements
  12347. will lead to visible borders) (default)
  12348. @item 2
  12349. optimal adaptive zoom value is determined (no borders will be
  12350. visible), see @option{zoomspeed}
  12351. @end table
  12352. Note that the value given at zoom is added to the one calculated here.
  12353. @item zoomspeed
  12354. Set percent to zoom maximally each frame (enabled when
  12355. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12356. 0.25.
  12357. @item interpol
  12358. Specify type of interpolation.
  12359. Available values are:
  12360. @table @samp
  12361. @item no
  12362. no interpolation
  12363. @item linear
  12364. linear only horizontal
  12365. @item bilinear
  12366. linear in both directions (default)
  12367. @item bicubic
  12368. cubic in both directions (slow)
  12369. @end table
  12370. @item tripod
  12371. Enable virtual tripod mode if set to 1, which is equivalent to
  12372. @code{relative=0:smoothing=0}. Default value is 0.
  12373. Use also @code{tripod} option of @ref{vidstabdetect}.
  12374. @item debug
  12375. Increase log verbosity if set to 1. Also the detected global motions
  12376. are written to the temporary file @file{global_motions.trf}. Default
  12377. value is 0.
  12378. @end table
  12379. @subsection Examples
  12380. @itemize
  12381. @item
  12382. Use @command{ffmpeg} for a typical stabilization with default values:
  12383. @example
  12384. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12385. @end example
  12386. Note the use of the @ref{unsharp} filter which is always recommended.
  12387. @item
  12388. Zoom in a bit more and load transform data from a given file:
  12389. @example
  12390. vidstabtransform=zoom=5:input="mytransforms.trf"
  12391. @end example
  12392. @item
  12393. Smoothen the video even more:
  12394. @example
  12395. vidstabtransform=smoothing=30
  12396. @end example
  12397. @end itemize
  12398. @section vflip
  12399. Flip the input video vertically.
  12400. For example, to vertically flip a video with @command{ffmpeg}:
  12401. @example
  12402. ffmpeg -i in.avi -vf "vflip" out.avi
  12403. @end example
  12404. @section vfrdet
  12405. Detect variable frame rate video.
  12406. This filter tries to detect if the input is variable or constant frame rate.
  12407. At end it will output number of frames detected as having variable delta pts,
  12408. and ones with constant delta pts.
  12409. If there was frames with variable delta, than it will also show min and max delta
  12410. encountered.
  12411. @anchor{vignette}
  12412. @section vignette
  12413. Make or reverse a natural vignetting effect.
  12414. The filter accepts the following options:
  12415. @table @option
  12416. @item angle, a
  12417. Set lens angle expression as a number of radians.
  12418. The value is clipped in the @code{[0,PI/2]} range.
  12419. Default value: @code{"PI/5"}
  12420. @item x0
  12421. @item y0
  12422. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12423. by default.
  12424. @item mode
  12425. Set forward/backward mode.
  12426. Available modes are:
  12427. @table @samp
  12428. @item forward
  12429. The larger the distance from the central point, the darker the image becomes.
  12430. @item backward
  12431. The larger the distance from the central point, the brighter the image becomes.
  12432. This can be used to reverse a vignette effect, though there is no automatic
  12433. detection to extract the lens @option{angle} and other settings (yet). It can
  12434. also be used to create a burning effect.
  12435. @end table
  12436. Default value is @samp{forward}.
  12437. @item eval
  12438. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12439. It accepts the following values:
  12440. @table @samp
  12441. @item init
  12442. Evaluate expressions only once during the filter initialization.
  12443. @item frame
  12444. Evaluate expressions for each incoming frame. This is way slower than the
  12445. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12446. allows advanced dynamic expressions.
  12447. @end table
  12448. Default value is @samp{init}.
  12449. @item dither
  12450. Set dithering to reduce the circular banding effects. Default is @code{1}
  12451. (enabled).
  12452. @item aspect
  12453. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12454. Setting this value to the SAR of the input will make a rectangular vignetting
  12455. following the dimensions of the video.
  12456. Default is @code{1/1}.
  12457. @end table
  12458. @subsection Expressions
  12459. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12460. following parameters.
  12461. @table @option
  12462. @item w
  12463. @item h
  12464. input width and height
  12465. @item n
  12466. the number of input frame, starting from 0
  12467. @item pts
  12468. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12469. @var{TB} units, NAN if undefined
  12470. @item r
  12471. frame rate of the input video, NAN if the input frame rate is unknown
  12472. @item t
  12473. the PTS (Presentation TimeStamp) of the filtered video frame,
  12474. expressed in seconds, NAN if undefined
  12475. @item tb
  12476. time base of the input video
  12477. @end table
  12478. @subsection Examples
  12479. @itemize
  12480. @item
  12481. Apply simple strong vignetting effect:
  12482. @example
  12483. vignette=PI/4
  12484. @end example
  12485. @item
  12486. Make a flickering vignetting:
  12487. @example
  12488. vignette='PI/4+random(1)*PI/50':eval=frame
  12489. @end example
  12490. @end itemize
  12491. @section vmafmotion
  12492. Obtain the average vmaf motion score of a video.
  12493. It is one of the component filters of VMAF.
  12494. The obtained average motion score is printed through the logging system.
  12495. In the below example the input file @file{ref.mpg} is being processed and score
  12496. is computed.
  12497. @example
  12498. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12499. @end example
  12500. @section vstack
  12501. Stack input videos vertically.
  12502. All streams must be of same pixel format and of same width.
  12503. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12504. to create same output.
  12505. The filter accept the following option:
  12506. @table @option
  12507. @item inputs
  12508. Set number of input streams. Default is 2.
  12509. @item shortest
  12510. If set to 1, force the output to terminate when the shortest input
  12511. terminates. Default value is 0.
  12512. @end table
  12513. @section w3fdif
  12514. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12515. Deinterlacing Filter").
  12516. Based on the process described by Martin Weston for BBC R&D, and
  12517. implemented based on the de-interlace algorithm written by Jim
  12518. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12519. uses filter coefficients calculated by BBC R&D.
  12520. There are two sets of filter coefficients, so called "simple":
  12521. and "complex". Which set of filter coefficients is used can
  12522. be set by passing an optional parameter:
  12523. @table @option
  12524. @item filter
  12525. Set the interlacing filter coefficients. Accepts one of the following values:
  12526. @table @samp
  12527. @item simple
  12528. Simple filter coefficient set.
  12529. @item complex
  12530. More-complex filter coefficient set.
  12531. @end table
  12532. Default value is @samp{complex}.
  12533. @item deint
  12534. Specify which frames to deinterlace. Accept one of the following values:
  12535. @table @samp
  12536. @item all
  12537. Deinterlace all frames,
  12538. @item interlaced
  12539. Only deinterlace frames marked as interlaced.
  12540. @end table
  12541. Default value is @samp{all}.
  12542. @end table
  12543. @section waveform
  12544. Video waveform monitor.
  12545. The waveform monitor plots color component intensity. By default luminance
  12546. only. Each column of the waveform corresponds to a column of pixels in the
  12547. source video.
  12548. It accepts the following options:
  12549. @table @option
  12550. @item mode, m
  12551. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12552. In row mode, the graph on the left side represents color component value 0 and
  12553. the right side represents value = 255. In column mode, the top side represents
  12554. color component value = 0 and bottom side represents value = 255.
  12555. @item intensity, i
  12556. Set intensity. Smaller values are useful to find out how many values of the same
  12557. luminance are distributed across input rows/columns.
  12558. Default value is @code{0.04}. Allowed range is [0, 1].
  12559. @item mirror, r
  12560. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12561. In mirrored mode, higher values will be represented on the left
  12562. side for @code{row} mode and at the top for @code{column} mode. Default is
  12563. @code{1} (mirrored).
  12564. @item display, d
  12565. Set display mode.
  12566. It accepts the following values:
  12567. @table @samp
  12568. @item overlay
  12569. Presents information identical to that in the @code{parade}, except
  12570. that the graphs representing color components are superimposed directly
  12571. over one another.
  12572. This display mode makes it easier to spot relative differences or similarities
  12573. in overlapping areas of the color components that are supposed to be identical,
  12574. such as neutral whites, grays, or blacks.
  12575. @item stack
  12576. Display separate graph for the color components side by side in
  12577. @code{row} mode or one below the other in @code{column} mode.
  12578. @item parade
  12579. Display separate graph for the color components side by side in
  12580. @code{column} mode or one below the other in @code{row} mode.
  12581. Using this display mode makes it easy to spot color casts in the highlights
  12582. and shadows of an image, by comparing the contours of the top and the bottom
  12583. graphs of each waveform. Since whites, grays, and blacks are characterized
  12584. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12585. should display three waveforms of roughly equal width/height. If not, the
  12586. correction is easy to perform by making level adjustments the three waveforms.
  12587. @end table
  12588. Default is @code{stack}.
  12589. @item components, c
  12590. Set which color components to display. Default is 1, which means only luminance
  12591. or red color component if input is in RGB colorspace. If is set for example to
  12592. 7 it will display all 3 (if) available color components.
  12593. @item envelope, e
  12594. @table @samp
  12595. @item none
  12596. No envelope, this is default.
  12597. @item instant
  12598. Instant envelope, minimum and maximum values presented in graph will be easily
  12599. visible even with small @code{step} value.
  12600. @item peak
  12601. Hold minimum and maximum values presented in graph across time. This way you
  12602. can still spot out of range values without constantly looking at waveforms.
  12603. @item peak+instant
  12604. Peak and instant envelope combined together.
  12605. @end table
  12606. @item filter, f
  12607. @table @samp
  12608. @item lowpass
  12609. No filtering, this is default.
  12610. @item flat
  12611. Luma and chroma combined together.
  12612. @item aflat
  12613. Similar as above, but shows difference between blue and red chroma.
  12614. @item xflat
  12615. Similar as above, but use different colors.
  12616. @item chroma
  12617. Displays only chroma.
  12618. @item color
  12619. Displays actual color value on waveform.
  12620. @item acolor
  12621. Similar as above, but with luma showing frequency of chroma values.
  12622. @end table
  12623. @item graticule, g
  12624. Set which graticule to display.
  12625. @table @samp
  12626. @item none
  12627. Do not display graticule.
  12628. @item green
  12629. Display green graticule showing legal broadcast ranges.
  12630. @item orange
  12631. Display orange graticule showing legal broadcast ranges.
  12632. @end table
  12633. @item opacity, o
  12634. Set graticule opacity.
  12635. @item flags, fl
  12636. Set graticule flags.
  12637. @table @samp
  12638. @item numbers
  12639. Draw numbers above lines. By default enabled.
  12640. @item dots
  12641. Draw dots instead of lines.
  12642. @end table
  12643. @item scale, s
  12644. Set scale used for displaying graticule.
  12645. @table @samp
  12646. @item digital
  12647. @item millivolts
  12648. @item ire
  12649. @end table
  12650. Default is digital.
  12651. @item bgopacity, b
  12652. Set background opacity.
  12653. @end table
  12654. @section weave, doubleweave
  12655. The @code{weave} takes a field-based video input and join
  12656. each two sequential fields into single frame, producing a new double
  12657. height clip with half the frame rate and half the frame count.
  12658. The @code{doubleweave} works same as @code{weave} but without
  12659. halving frame rate and frame count.
  12660. It accepts the following option:
  12661. @table @option
  12662. @item first_field
  12663. Set first field. Available values are:
  12664. @table @samp
  12665. @item top, t
  12666. Set the frame as top-field-first.
  12667. @item bottom, b
  12668. Set the frame as bottom-field-first.
  12669. @end table
  12670. @end table
  12671. @subsection Examples
  12672. @itemize
  12673. @item
  12674. Interlace video using @ref{select} and @ref{separatefields} filter:
  12675. @example
  12676. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12677. @end example
  12678. @end itemize
  12679. @section xbr
  12680. Apply the xBR high-quality magnification filter which is designed for pixel
  12681. art. It follows a set of edge-detection rules, see
  12682. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12683. It accepts the following option:
  12684. @table @option
  12685. @item n
  12686. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12687. @code{3xBR} and @code{4} for @code{4xBR}.
  12688. Default is @code{3}.
  12689. @end table
  12690. @anchor{yadif}
  12691. @section yadif
  12692. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12693. filter").
  12694. It accepts the following parameters:
  12695. @table @option
  12696. @item mode
  12697. The interlacing mode to adopt. It accepts one of the following values:
  12698. @table @option
  12699. @item 0, send_frame
  12700. Output one frame for each frame.
  12701. @item 1, send_field
  12702. Output one frame for each field.
  12703. @item 2, send_frame_nospatial
  12704. Like @code{send_frame}, but it skips the spatial interlacing check.
  12705. @item 3, send_field_nospatial
  12706. Like @code{send_field}, but it skips the spatial interlacing check.
  12707. @end table
  12708. The default value is @code{send_frame}.
  12709. @item parity
  12710. The picture field parity assumed for the input interlaced video. It accepts one
  12711. of the following values:
  12712. @table @option
  12713. @item 0, tff
  12714. Assume the top field is first.
  12715. @item 1, bff
  12716. Assume the bottom field is first.
  12717. @item -1, auto
  12718. Enable automatic detection of field parity.
  12719. @end table
  12720. The default value is @code{auto}.
  12721. If the interlacing is unknown or the decoder does not export this information,
  12722. top field first will be assumed.
  12723. @item deint
  12724. Specify which frames to deinterlace. Accept one of the following
  12725. values:
  12726. @table @option
  12727. @item 0, all
  12728. Deinterlace all frames.
  12729. @item 1, interlaced
  12730. Only deinterlace frames marked as interlaced.
  12731. @end table
  12732. The default value is @code{all}.
  12733. @end table
  12734. @section zoompan
  12735. Apply Zoom & Pan effect.
  12736. This filter accepts the following options:
  12737. @table @option
  12738. @item zoom, z
  12739. Set the zoom expression. Default is 1.
  12740. @item x
  12741. @item y
  12742. Set the x and y expression. Default is 0.
  12743. @item d
  12744. Set the duration expression in number of frames.
  12745. This sets for how many number of frames effect will last for
  12746. single input image.
  12747. @item s
  12748. Set the output image size, default is 'hd720'.
  12749. @item fps
  12750. Set the output frame rate, default is '25'.
  12751. @end table
  12752. Each expression can contain the following constants:
  12753. @table @option
  12754. @item in_w, iw
  12755. Input width.
  12756. @item in_h, ih
  12757. Input height.
  12758. @item out_w, ow
  12759. Output width.
  12760. @item out_h, oh
  12761. Output height.
  12762. @item in
  12763. Input frame count.
  12764. @item on
  12765. Output frame count.
  12766. @item x
  12767. @item y
  12768. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12769. for current input frame.
  12770. @item px
  12771. @item py
  12772. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12773. not yet such frame (first input frame).
  12774. @item zoom
  12775. Last calculated zoom from 'z' expression for current input frame.
  12776. @item pzoom
  12777. Last calculated zoom of last output frame of previous input frame.
  12778. @item duration
  12779. Number of output frames for current input frame. Calculated from 'd' expression
  12780. for each input frame.
  12781. @item pduration
  12782. number of output frames created for previous input frame
  12783. @item a
  12784. Rational number: input width / input height
  12785. @item sar
  12786. sample aspect ratio
  12787. @item dar
  12788. display aspect ratio
  12789. @end table
  12790. @subsection Examples
  12791. @itemize
  12792. @item
  12793. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12794. @example
  12795. 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
  12796. @end example
  12797. @item
  12798. Zoom-in up to 1.5 and pan always at center of picture:
  12799. @example
  12800. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12801. @end example
  12802. @item
  12803. Same as above but without pausing:
  12804. @example
  12805. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12806. @end example
  12807. @end itemize
  12808. @anchor{zscale}
  12809. @section zscale
  12810. Scale (resize) the input video, using the z.lib library:
  12811. https://github.com/sekrit-twc/zimg.
  12812. The zscale filter forces the output display aspect ratio to be the same
  12813. as the input, by changing the output sample aspect ratio.
  12814. If the input image format is different from the format requested by
  12815. the next filter, the zscale filter will convert the input to the
  12816. requested format.
  12817. @subsection Options
  12818. The filter accepts the following options.
  12819. @table @option
  12820. @item width, w
  12821. @item height, h
  12822. Set the output video dimension expression. Default value is the input
  12823. dimension.
  12824. If the @var{width} or @var{w} value is 0, the input width is used for
  12825. the output. If the @var{height} or @var{h} value is 0, the input height
  12826. is used for the output.
  12827. If one and only one of the values is -n with n >= 1, the zscale filter
  12828. will use a value that maintains the aspect ratio of the input image,
  12829. calculated from the other specified dimension. After that it will,
  12830. however, make sure that the calculated dimension is divisible by n and
  12831. adjust the value if necessary.
  12832. If both values are -n with n >= 1, the behavior will be identical to
  12833. both values being set to 0 as previously detailed.
  12834. See below for the list of accepted constants for use in the dimension
  12835. expression.
  12836. @item size, s
  12837. Set the video size. For the syntax of this option, check the
  12838. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12839. @item dither, d
  12840. Set the dither type.
  12841. Possible values are:
  12842. @table @var
  12843. @item none
  12844. @item ordered
  12845. @item random
  12846. @item error_diffusion
  12847. @end table
  12848. Default is none.
  12849. @item filter, f
  12850. Set the resize filter type.
  12851. Possible values are:
  12852. @table @var
  12853. @item point
  12854. @item bilinear
  12855. @item bicubic
  12856. @item spline16
  12857. @item spline36
  12858. @item lanczos
  12859. @end table
  12860. Default is bilinear.
  12861. @item range, r
  12862. Set the color range.
  12863. Possible values are:
  12864. @table @var
  12865. @item input
  12866. @item limited
  12867. @item full
  12868. @end table
  12869. Default is same as input.
  12870. @item primaries, p
  12871. Set the color primaries.
  12872. Possible values are:
  12873. @table @var
  12874. @item input
  12875. @item 709
  12876. @item unspecified
  12877. @item 170m
  12878. @item 240m
  12879. @item 2020
  12880. @end table
  12881. Default is same as input.
  12882. @item transfer, t
  12883. Set the transfer characteristics.
  12884. Possible values are:
  12885. @table @var
  12886. @item input
  12887. @item 709
  12888. @item unspecified
  12889. @item 601
  12890. @item linear
  12891. @item 2020_10
  12892. @item 2020_12
  12893. @item smpte2084
  12894. @item iec61966-2-1
  12895. @item arib-std-b67
  12896. @end table
  12897. Default is same as input.
  12898. @item matrix, m
  12899. Set the colorspace matrix.
  12900. Possible value are:
  12901. @table @var
  12902. @item input
  12903. @item 709
  12904. @item unspecified
  12905. @item 470bg
  12906. @item 170m
  12907. @item 2020_ncl
  12908. @item 2020_cl
  12909. @end table
  12910. Default is same as input.
  12911. @item rangein, rin
  12912. Set the input color range.
  12913. Possible values are:
  12914. @table @var
  12915. @item input
  12916. @item limited
  12917. @item full
  12918. @end table
  12919. Default is same as input.
  12920. @item primariesin, pin
  12921. Set the input color primaries.
  12922. Possible values are:
  12923. @table @var
  12924. @item input
  12925. @item 709
  12926. @item unspecified
  12927. @item 170m
  12928. @item 240m
  12929. @item 2020
  12930. @end table
  12931. Default is same as input.
  12932. @item transferin, tin
  12933. Set the input transfer characteristics.
  12934. Possible values are:
  12935. @table @var
  12936. @item input
  12937. @item 709
  12938. @item unspecified
  12939. @item 601
  12940. @item linear
  12941. @item 2020_10
  12942. @item 2020_12
  12943. @end table
  12944. Default is same as input.
  12945. @item matrixin, min
  12946. Set the input colorspace matrix.
  12947. Possible value are:
  12948. @table @var
  12949. @item input
  12950. @item 709
  12951. @item unspecified
  12952. @item 470bg
  12953. @item 170m
  12954. @item 2020_ncl
  12955. @item 2020_cl
  12956. @end table
  12957. @item chromal, c
  12958. Set the output chroma location.
  12959. Possible values are:
  12960. @table @var
  12961. @item input
  12962. @item left
  12963. @item center
  12964. @item topleft
  12965. @item top
  12966. @item bottomleft
  12967. @item bottom
  12968. @end table
  12969. @item chromalin, cin
  12970. Set the input chroma location.
  12971. Possible values are:
  12972. @table @var
  12973. @item input
  12974. @item left
  12975. @item center
  12976. @item topleft
  12977. @item top
  12978. @item bottomleft
  12979. @item bottom
  12980. @end table
  12981. @item npl
  12982. Set the nominal peak luminance.
  12983. @end table
  12984. The values of the @option{w} and @option{h} options are expressions
  12985. containing the following constants:
  12986. @table @var
  12987. @item in_w
  12988. @item in_h
  12989. The input width and height
  12990. @item iw
  12991. @item ih
  12992. These are the same as @var{in_w} and @var{in_h}.
  12993. @item out_w
  12994. @item out_h
  12995. The output (scaled) width and height
  12996. @item ow
  12997. @item oh
  12998. These are the same as @var{out_w} and @var{out_h}
  12999. @item a
  13000. The same as @var{iw} / @var{ih}
  13001. @item sar
  13002. input sample aspect ratio
  13003. @item dar
  13004. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13005. @item hsub
  13006. @item vsub
  13007. horizontal and vertical input chroma subsample values. For example for the
  13008. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13009. @item ohsub
  13010. @item ovsub
  13011. horizontal and vertical output chroma subsample values. For example for the
  13012. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13013. @end table
  13014. @table @option
  13015. @end table
  13016. @c man end VIDEO FILTERS
  13017. @chapter Video Sources
  13018. @c man begin VIDEO SOURCES
  13019. Below is a description of the currently available video sources.
  13020. @section buffer
  13021. Buffer video frames, and make them available to the filter chain.
  13022. This source is mainly intended for a programmatic use, in particular
  13023. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13024. It accepts the following parameters:
  13025. @table @option
  13026. @item video_size
  13027. Specify the size (width and height) of the buffered video frames. For the
  13028. syntax of this option, check the
  13029. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13030. @item width
  13031. The input video width.
  13032. @item height
  13033. The input video height.
  13034. @item pix_fmt
  13035. A string representing the pixel format of the buffered video frames.
  13036. It may be a number corresponding to a pixel format, or a pixel format
  13037. name.
  13038. @item time_base
  13039. Specify the timebase assumed by the timestamps of the buffered frames.
  13040. @item frame_rate
  13041. Specify the frame rate expected for the video stream.
  13042. @item pixel_aspect, sar
  13043. The sample (pixel) aspect ratio of the input video.
  13044. @item sws_param
  13045. Specify the optional parameters to be used for the scale filter which
  13046. is automatically inserted when an input change is detected in the
  13047. input size or format.
  13048. @item hw_frames_ctx
  13049. When using a hardware pixel format, this should be a reference to an
  13050. AVHWFramesContext describing input frames.
  13051. @end table
  13052. For example:
  13053. @example
  13054. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13055. @end example
  13056. will instruct the source to accept video frames with size 320x240 and
  13057. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13058. square pixels (1:1 sample aspect ratio).
  13059. Since the pixel format with name "yuv410p" corresponds to the number 6
  13060. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13061. this example corresponds to:
  13062. @example
  13063. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13064. @end example
  13065. Alternatively, the options can be specified as a flat string, but this
  13066. syntax is deprecated:
  13067. @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}]
  13068. @section cellauto
  13069. Create a pattern generated by an elementary cellular automaton.
  13070. The initial state of the cellular automaton can be defined through the
  13071. @option{filename} and @option{pattern} options. If such options are
  13072. not specified an initial state is created randomly.
  13073. At each new frame a new row in the video is filled with the result of
  13074. the cellular automaton next generation. The behavior when the whole
  13075. frame is filled is defined by the @option{scroll} option.
  13076. This source accepts the following options:
  13077. @table @option
  13078. @item filename, f
  13079. Read the initial cellular automaton state, i.e. the starting row, from
  13080. the specified file.
  13081. In the file, each non-whitespace character is considered an alive
  13082. cell, a newline will terminate the row, and further characters in the
  13083. file will be ignored.
  13084. @item pattern, p
  13085. Read the initial cellular automaton state, i.e. the starting row, from
  13086. the specified string.
  13087. Each non-whitespace character in the string is considered an alive
  13088. cell, a newline will terminate the row, and further characters in the
  13089. string will be ignored.
  13090. @item rate, r
  13091. Set the video rate, that is the number of frames generated per second.
  13092. Default is 25.
  13093. @item random_fill_ratio, ratio
  13094. Set the random fill ratio for the initial cellular automaton row. It
  13095. is a floating point number value ranging from 0 to 1, defaults to
  13096. 1/PHI.
  13097. This option is ignored when a file or a pattern is specified.
  13098. @item random_seed, seed
  13099. Set the seed for filling randomly the initial row, must be an integer
  13100. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13101. set to -1, the filter will try to use a good random seed on a best
  13102. effort basis.
  13103. @item rule
  13104. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13105. Default value is 110.
  13106. @item size, s
  13107. Set the size of the output video. For the syntax of this option, check the
  13108. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13109. If @option{filename} or @option{pattern} is specified, the size is set
  13110. by default to the width of the specified initial state row, and the
  13111. height is set to @var{width} * PHI.
  13112. If @option{size} is set, it must contain the width of the specified
  13113. pattern string, and the specified pattern will be centered in the
  13114. larger row.
  13115. If a filename or a pattern string is not specified, the size value
  13116. defaults to "320x518" (used for a randomly generated initial state).
  13117. @item scroll
  13118. If set to 1, scroll the output upward when all the rows in the output
  13119. have been already filled. If set to 0, the new generated row will be
  13120. written over the top row just after the bottom row is filled.
  13121. Defaults to 1.
  13122. @item start_full, full
  13123. If set to 1, completely fill the output with generated rows before
  13124. outputting the first frame.
  13125. This is the default behavior, for disabling set the value to 0.
  13126. @item stitch
  13127. If set to 1, stitch the left and right row edges together.
  13128. This is the default behavior, for disabling set the value to 0.
  13129. @end table
  13130. @subsection Examples
  13131. @itemize
  13132. @item
  13133. Read the initial state from @file{pattern}, and specify an output of
  13134. size 200x400.
  13135. @example
  13136. cellauto=f=pattern:s=200x400
  13137. @end example
  13138. @item
  13139. Generate a random initial row with a width of 200 cells, with a fill
  13140. ratio of 2/3:
  13141. @example
  13142. cellauto=ratio=2/3:s=200x200
  13143. @end example
  13144. @item
  13145. Create a pattern generated by rule 18 starting by a single alive cell
  13146. centered on an initial row with width 100:
  13147. @example
  13148. cellauto=p=@@:s=100x400:full=0:rule=18
  13149. @end example
  13150. @item
  13151. Specify a more elaborated initial pattern:
  13152. @example
  13153. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13154. @end example
  13155. @end itemize
  13156. @anchor{coreimagesrc}
  13157. @section coreimagesrc
  13158. Video source generated on GPU using Apple's CoreImage API on OSX.
  13159. This video source is a specialized version of the @ref{coreimage} video filter.
  13160. Use a core image generator at the beginning of the applied filterchain to
  13161. generate the content.
  13162. The coreimagesrc video source accepts the following options:
  13163. @table @option
  13164. @item list_generators
  13165. List all available generators along with all their respective options as well as
  13166. possible minimum and maximum values along with the default values.
  13167. @example
  13168. list_generators=true
  13169. @end example
  13170. @item size, s
  13171. Specify the size of the sourced video. For the syntax of this option, check the
  13172. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13173. The default value is @code{320x240}.
  13174. @item rate, r
  13175. Specify the frame rate of the sourced video, as the number of frames
  13176. generated per second. It has to be a string in the format
  13177. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13178. number or a valid video frame rate abbreviation. The default value is
  13179. "25".
  13180. @item sar
  13181. Set the sample aspect ratio of the sourced video.
  13182. @item duration, d
  13183. Set the duration of the sourced video. See
  13184. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13185. for the accepted syntax.
  13186. If not specified, or the expressed duration is negative, the video is
  13187. supposed to be generated forever.
  13188. @end table
  13189. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13190. A complete filterchain can be used for further processing of the
  13191. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13192. and examples for details.
  13193. @subsection Examples
  13194. @itemize
  13195. @item
  13196. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13197. given as complete and escaped command-line for Apple's standard bash shell:
  13198. @example
  13199. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13200. @end example
  13201. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13202. need for a nullsrc video source.
  13203. @end itemize
  13204. @section mandelbrot
  13205. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13206. point specified with @var{start_x} and @var{start_y}.
  13207. This source accepts the following options:
  13208. @table @option
  13209. @item end_pts
  13210. Set the terminal pts value. Default value is 400.
  13211. @item end_scale
  13212. Set the terminal scale value.
  13213. Must be a floating point value. Default value is 0.3.
  13214. @item inner
  13215. Set the inner coloring mode, that is the algorithm used to draw the
  13216. Mandelbrot fractal internal region.
  13217. It shall assume one of the following values:
  13218. @table @option
  13219. @item black
  13220. Set black mode.
  13221. @item convergence
  13222. Show time until convergence.
  13223. @item mincol
  13224. Set color based on point closest to the origin of the iterations.
  13225. @item period
  13226. Set period mode.
  13227. @end table
  13228. Default value is @var{mincol}.
  13229. @item bailout
  13230. Set the bailout value. Default value is 10.0.
  13231. @item maxiter
  13232. Set the maximum of iterations performed by the rendering
  13233. algorithm. Default value is 7189.
  13234. @item outer
  13235. Set outer coloring mode.
  13236. It shall assume one of following values:
  13237. @table @option
  13238. @item iteration_count
  13239. Set iteration cound mode.
  13240. @item normalized_iteration_count
  13241. set normalized iteration count mode.
  13242. @end table
  13243. Default value is @var{normalized_iteration_count}.
  13244. @item rate, r
  13245. Set frame rate, expressed as number of frames per second. Default
  13246. value is "25".
  13247. @item size, s
  13248. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13249. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13250. @item start_scale
  13251. Set the initial scale value. Default value is 3.0.
  13252. @item start_x
  13253. Set the initial x position. Must be a floating point value between
  13254. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13255. @item start_y
  13256. Set the initial y position. Must be a floating point value between
  13257. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13258. @end table
  13259. @section mptestsrc
  13260. Generate various test patterns, as generated by the MPlayer test filter.
  13261. The size of the generated video is fixed, and is 256x256.
  13262. This source is useful in particular for testing encoding features.
  13263. This source accepts the following options:
  13264. @table @option
  13265. @item rate, r
  13266. Specify the frame rate of the sourced video, as the number of frames
  13267. generated per second. It has to be a string in the format
  13268. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13269. number or a valid video frame rate abbreviation. The default value is
  13270. "25".
  13271. @item duration, d
  13272. Set the duration of the sourced video. See
  13273. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13274. for the accepted syntax.
  13275. If not specified, or the expressed duration is negative, the video is
  13276. supposed to be generated forever.
  13277. @item test, t
  13278. Set the number or the name of the test to perform. Supported tests are:
  13279. @table @option
  13280. @item dc_luma
  13281. @item dc_chroma
  13282. @item freq_luma
  13283. @item freq_chroma
  13284. @item amp_luma
  13285. @item amp_chroma
  13286. @item cbp
  13287. @item mv
  13288. @item ring1
  13289. @item ring2
  13290. @item all
  13291. @end table
  13292. Default value is "all", which will cycle through the list of all tests.
  13293. @end table
  13294. Some examples:
  13295. @example
  13296. mptestsrc=t=dc_luma
  13297. @end example
  13298. will generate a "dc_luma" test pattern.
  13299. @section frei0r_src
  13300. Provide a frei0r source.
  13301. To enable compilation of this filter you need to install the frei0r
  13302. header and configure FFmpeg with @code{--enable-frei0r}.
  13303. This source accepts the following parameters:
  13304. @table @option
  13305. @item size
  13306. The size of the video to generate. For the syntax of this option, check the
  13307. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13308. @item framerate
  13309. The framerate of the generated video. It may be a string of the form
  13310. @var{num}/@var{den} or a frame rate abbreviation.
  13311. @item filter_name
  13312. The name to the frei0r source to load. For more information regarding frei0r and
  13313. how to set the parameters, read the @ref{frei0r} section in the video filters
  13314. documentation.
  13315. @item filter_params
  13316. A '|'-separated list of parameters to pass to the frei0r source.
  13317. @end table
  13318. For example, to generate a frei0r partik0l source with size 200x200
  13319. and frame rate 10 which is overlaid on the overlay filter main input:
  13320. @example
  13321. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13322. @end example
  13323. @section life
  13324. Generate a life pattern.
  13325. This source is based on a generalization of John Conway's life game.
  13326. The sourced input represents a life grid, each pixel represents a cell
  13327. which can be in one of two possible states, alive or dead. Every cell
  13328. interacts with its eight neighbours, which are the cells that are
  13329. horizontally, vertically, or diagonally adjacent.
  13330. At each interaction the grid evolves according to the adopted rule,
  13331. which specifies the number of neighbor alive cells which will make a
  13332. cell stay alive or born. The @option{rule} option allows one to specify
  13333. the rule to adopt.
  13334. This source accepts the following options:
  13335. @table @option
  13336. @item filename, f
  13337. Set the file from which to read the initial grid state. In the file,
  13338. each non-whitespace character is considered an alive cell, and newline
  13339. is used to delimit the end of each row.
  13340. If this option is not specified, the initial grid is generated
  13341. randomly.
  13342. @item rate, r
  13343. Set the video rate, that is the number of frames generated per second.
  13344. Default is 25.
  13345. @item random_fill_ratio, ratio
  13346. Set the random fill ratio for the initial random grid. It is a
  13347. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13348. It is ignored when a file is specified.
  13349. @item random_seed, seed
  13350. Set the seed for filling the initial random grid, must be an integer
  13351. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13352. set to -1, the filter will try to use a good random seed on a best
  13353. effort basis.
  13354. @item rule
  13355. Set the life rule.
  13356. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13357. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13358. @var{NS} specifies the number of alive neighbor cells which make a
  13359. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13360. which make a dead cell to become alive (i.e. to "born").
  13361. "s" and "b" can be used in place of "S" and "B", respectively.
  13362. Alternatively a rule can be specified by an 18-bits integer. The 9
  13363. high order bits are used to encode the next cell state if it is alive
  13364. for each number of neighbor alive cells, the low order bits specify
  13365. the rule for "borning" new cells. Higher order bits encode for an
  13366. higher number of neighbor cells.
  13367. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13368. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13369. Default value is "S23/B3", which is the original Conway's game of life
  13370. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13371. cells, and will born a new cell if there are three alive cells around
  13372. a dead cell.
  13373. @item size, s
  13374. Set the size of the output video. For the syntax of this option, check the
  13375. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13376. If @option{filename} is specified, the size is set by default to the
  13377. same size of the input file. If @option{size} is set, it must contain
  13378. the size specified in the input file, and the initial grid defined in
  13379. that file is centered in the larger resulting area.
  13380. If a filename is not specified, the size value defaults to "320x240"
  13381. (used for a randomly generated initial grid).
  13382. @item stitch
  13383. If set to 1, stitch the left and right grid edges together, and the
  13384. top and bottom edges also. Defaults to 1.
  13385. @item mold
  13386. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13387. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13388. value from 0 to 255.
  13389. @item life_color
  13390. Set the color of living (or new born) cells.
  13391. @item death_color
  13392. Set the color of dead cells. If @option{mold} is set, this is the first color
  13393. used to represent a dead cell.
  13394. @item mold_color
  13395. Set mold color, for definitely dead and moldy cells.
  13396. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13397. ffmpeg-utils manual,ffmpeg-utils}.
  13398. @end table
  13399. @subsection Examples
  13400. @itemize
  13401. @item
  13402. Read a grid from @file{pattern}, and center it on a grid of size
  13403. 300x300 pixels:
  13404. @example
  13405. life=f=pattern:s=300x300
  13406. @end example
  13407. @item
  13408. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13409. @example
  13410. life=ratio=2/3:s=200x200
  13411. @end example
  13412. @item
  13413. Specify a custom rule for evolving a randomly generated grid:
  13414. @example
  13415. life=rule=S14/B34
  13416. @end example
  13417. @item
  13418. Full example with slow death effect (mold) using @command{ffplay}:
  13419. @example
  13420. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13421. @end example
  13422. @end itemize
  13423. @anchor{allrgb}
  13424. @anchor{allyuv}
  13425. @anchor{color}
  13426. @anchor{haldclutsrc}
  13427. @anchor{nullsrc}
  13428. @anchor{rgbtestsrc}
  13429. @anchor{smptebars}
  13430. @anchor{smptehdbars}
  13431. @anchor{testsrc}
  13432. @anchor{testsrc2}
  13433. @anchor{yuvtestsrc}
  13434. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13435. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13436. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13437. The @code{color} source provides an uniformly colored input.
  13438. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13439. @ref{haldclut} filter.
  13440. The @code{nullsrc} source returns unprocessed video frames. It is
  13441. mainly useful to be employed in analysis / debugging tools, or as the
  13442. source for filters which ignore the input data.
  13443. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13444. detecting RGB vs BGR issues. You should see a red, green and blue
  13445. stripe from top to bottom.
  13446. The @code{smptebars} source generates a color bars pattern, based on
  13447. the SMPTE Engineering Guideline EG 1-1990.
  13448. The @code{smptehdbars} source generates a color bars pattern, based on
  13449. the SMPTE RP 219-2002.
  13450. The @code{testsrc} source generates a test video pattern, showing a
  13451. color pattern, a scrolling gradient and a timestamp. This is mainly
  13452. intended for testing purposes.
  13453. The @code{testsrc2} source is similar to testsrc, but supports more
  13454. pixel formats instead of just @code{rgb24}. This allows using it as an
  13455. input for other tests without requiring a format conversion.
  13456. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13457. see a y, cb and cr stripe from top to bottom.
  13458. The sources accept the following parameters:
  13459. @table @option
  13460. @item level
  13461. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13462. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13463. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13464. coded on a @code{1/(N*N)} scale.
  13465. @item color, c
  13466. Specify the color of the source, only available in the @code{color}
  13467. source. For the syntax of this option, check the
  13468. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13469. @item size, s
  13470. Specify the size of the sourced video. For the syntax of this option, check the
  13471. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13472. The default value is @code{320x240}.
  13473. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13474. @code{haldclutsrc} filters.
  13475. @item rate, r
  13476. Specify the frame rate of the sourced video, as the number of frames
  13477. generated per second. It has to be a string in the format
  13478. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13479. number or a valid video frame rate abbreviation. The default value is
  13480. "25".
  13481. @item duration, d
  13482. Set the duration of the sourced video. See
  13483. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13484. for the accepted syntax.
  13485. If not specified, or the expressed duration is negative, the video is
  13486. supposed to be generated forever.
  13487. @item sar
  13488. Set the sample aspect ratio of the sourced video.
  13489. @item alpha
  13490. Specify the alpha (opacity) of the background, only available in the
  13491. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13492. 255 (fully opaque, the default).
  13493. @item decimals, n
  13494. Set the number of decimals to show in the timestamp, only available in the
  13495. @code{testsrc} source.
  13496. The displayed timestamp value will correspond to the original
  13497. timestamp value multiplied by the power of 10 of the specified
  13498. value. Default value is 0.
  13499. @end table
  13500. @subsection Examples
  13501. @itemize
  13502. @item
  13503. Generate a video with a duration of 5.3 seconds, with size
  13504. 176x144 and a frame rate of 10 frames per second:
  13505. @example
  13506. testsrc=duration=5.3:size=qcif:rate=10
  13507. @end example
  13508. @item
  13509. The following graph description will generate a red source
  13510. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13511. frames per second:
  13512. @example
  13513. color=c=red@@0.2:s=qcif:r=10
  13514. @end example
  13515. @item
  13516. If the input content is to be ignored, @code{nullsrc} can be used. The
  13517. following command generates noise in the luminance plane by employing
  13518. the @code{geq} filter:
  13519. @example
  13520. nullsrc=s=256x256, geq=random(1)*255:128:128
  13521. @end example
  13522. @end itemize
  13523. @subsection Commands
  13524. The @code{color} source supports the following commands:
  13525. @table @option
  13526. @item c, color
  13527. Set the color of the created image. Accepts the same syntax of the
  13528. corresponding @option{color} option.
  13529. @end table
  13530. @section openclsrc
  13531. Generate video using an OpenCL program.
  13532. @table @option
  13533. @item source
  13534. OpenCL program source file.
  13535. @item kernel
  13536. Kernel name in program.
  13537. @item size, s
  13538. Size of frames to generate. This must be set.
  13539. @item format
  13540. Pixel format to use for the generated frames. This must be set.
  13541. @item rate, r
  13542. Number of frames generated every second. Default value is '25'.
  13543. @end table
  13544. For details of how the program loading works, see the @ref{program_opencl}
  13545. filter.
  13546. Example programs:
  13547. @itemize
  13548. @item
  13549. Generate a colour ramp by setting pixel values from the position of the pixel
  13550. in the output image. (Note that this will work with all pixel formats, but
  13551. the generated output will not be the same.)
  13552. @verbatim
  13553. __kernel void ramp(__write_only image2d_t dst,
  13554. unsigned int index)
  13555. {
  13556. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13557. float4 val;
  13558. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13559. write_imagef(dst, loc, val);
  13560. }
  13561. @end verbatim
  13562. @item
  13563. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13564. @verbatim
  13565. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13566. unsigned int index)
  13567. {
  13568. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13569. float4 value = 0.0f;
  13570. int x = loc.x + index;
  13571. int y = loc.y + index;
  13572. while (x > 0 || y > 0) {
  13573. if (x % 3 == 1 && y % 3 == 1) {
  13574. value = 1.0f;
  13575. break;
  13576. }
  13577. x /= 3;
  13578. y /= 3;
  13579. }
  13580. write_imagef(dst, loc, value);
  13581. }
  13582. @end verbatim
  13583. @end itemize
  13584. @c man end VIDEO SOURCES
  13585. @chapter Video Sinks
  13586. @c man begin VIDEO SINKS
  13587. Below is a description of the currently available video sinks.
  13588. @section buffersink
  13589. Buffer video frames, and make them available to the end of the filter
  13590. graph.
  13591. This sink is mainly intended for programmatic use, in particular
  13592. through the interface defined in @file{libavfilter/buffersink.h}
  13593. or the options system.
  13594. It accepts a pointer to an AVBufferSinkContext structure, which
  13595. defines the incoming buffers' formats, to be passed as the opaque
  13596. parameter to @code{avfilter_init_filter} for initialization.
  13597. @section nullsink
  13598. Null video sink: do absolutely nothing with the input video. It is
  13599. mainly useful as a template and for use in analysis / debugging
  13600. tools.
  13601. @c man end VIDEO SINKS
  13602. @chapter Multimedia Filters
  13603. @c man begin MULTIMEDIA FILTERS
  13604. Below is a description of the currently available multimedia filters.
  13605. @section abitscope
  13606. Convert input audio to a video output, displaying the audio bit scope.
  13607. The filter accepts the following options:
  13608. @table @option
  13609. @item rate, r
  13610. Set frame rate, expressed as number of frames per second. Default
  13611. value is "25".
  13612. @item size, s
  13613. Specify the video size for the output. For the syntax of this option, check the
  13614. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13615. Default value is @code{1024x256}.
  13616. @item colors
  13617. Specify list of colors separated by space or by '|' which will be used to
  13618. draw channels. Unrecognized or missing colors will be replaced
  13619. by white color.
  13620. @end table
  13621. @section ahistogram
  13622. Convert input audio to a video output, displaying the volume histogram.
  13623. The filter accepts the following options:
  13624. @table @option
  13625. @item dmode
  13626. Specify how histogram is calculated.
  13627. It accepts the following values:
  13628. @table @samp
  13629. @item single
  13630. Use single histogram for all channels.
  13631. @item separate
  13632. Use separate histogram for each channel.
  13633. @end table
  13634. Default is @code{single}.
  13635. @item rate, r
  13636. Set frame rate, expressed as number of frames per second. Default
  13637. value is "25".
  13638. @item size, s
  13639. Specify the video size for the output. For the syntax of this option, check the
  13640. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13641. Default value is @code{hd720}.
  13642. @item scale
  13643. Set display scale.
  13644. It accepts the following values:
  13645. @table @samp
  13646. @item log
  13647. logarithmic
  13648. @item sqrt
  13649. square root
  13650. @item cbrt
  13651. cubic root
  13652. @item lin
  13653. linear
  13654. @item rlog
  13655. reverse logarithmic
  13656. @end table
  13657. Default is @code{log}.
  13658. @item ascale
  13659. Set amplitude scale.
  13660. It accepts the following values:
  13661. @table @samp
  13662. @item log
  13663. logarithmic
  13664. @item lin
  13665. linear
  13666. @end table
  13667. Default is @code{log}.
  13668. @item acount
  13669. Set how much frames to accumulate in histogram.
  13670. Defauls is 1. Setting this to -1 accumulates all frames.
  13671. @item rheight
  13672. Set histogram ratio of window height.
  13673. @item slide
  13674. Set sonogram sliding.
  13675. It accepts the following values:
  13676. @table @samp
  13677. @item replace
  13678. replace old rows with new ones.
  13679. @item scroll
  13680. scroll from top to bottom.
  13681. @end table
  13682. Default is @code{replace}.
  13683. @end table
  13684. @section aphasemeter
  13685. Convert input audio to a video output, displaying the audio phase.
  13686. The filter accepts the following options:
  13687. @table @option
  13688. @item rate, r
  13689. Set the output frame rate. Default value is @code{25}.
  13690. @item size, s
  13691. Set the video size for the output. For the syntax of this option, check the
  13692. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13693. Default value is @code{800x400}.
  13694. @item rc
  13695. @item gc
  13696. @item bc
  13697. Specify the red, green, blue contrast. Default values are @code{2},
  13698. @code{7} and @code{1}.
  13699. Allowed range is @code{[0, 255]}.
  13700. @item mpc
  13701. Set color which will be used for drawing median phase. If color is
  13702. @code{none} which is default, no median phase value will be drawn.
  13703. @item video
  13704. Enable video output. Default is enabled.
  13705. @end table
  13706. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13707. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13708. The @code{-1} means left and right channels are completely out of phase and
  13709. @code{1} means channels are in phase.
  13710. @section avectorscope
  13711. Convert input audio to a video output, representing the audio vector
  13712. scope.
  13713. The filter is used to measure the difference between channels of stereo
  13714. audio stream. A monoaural signal, consisting of identical left and right
  13715. signal, results in straight vertical line. Any stereo separation is visible
  13716. as a deviation from this line, creating a Lissajous figure.
  13717. If the straight (or deviation from it) but horizontal line appears this
  13718. indicates that the left and right channels are out of phase.
  13719. The filter accepts the following options:
  13720. @table @option
  13721. @item mode, m
  13722. Set the vectorscope mode.
  13723. Available values are:
  13724. @table @samp
  13725. @item lissajous
  13726. Lissajous rotated by 45 degrees.
  13727. @item lissajous_xy
  13728. Same as above but not rotated.
  13729. @item polar
  13730. Shape resembling half of circle.
  13731. @end table
  13732. Default value is @samp{lissajous}.
  13733. @item size, s
  13734. Set the video size for the output. For the syntax of this option, check the
  13735. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13736. Default value is @code{400x400}.
  13737. @item rate, r
  13738. Set the output frame rate. Default value is @code{25}.
  13739. @item rc
  13740. @item gc
  13741. @item bc
  13742. @item ac
  13743. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13744. @code{160}, @code{80} and @code{255}.
  13745. Allowed range is @code{[0, 255]}.
  13746. @item rf
  13747. @item gf
  13748. @item bf
  13749. @item af
  13750. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13751. @code{10}, @code{5} and @code{5}.
  13752. Allowed range is @code{[0, 255]}.
  13753. @item zoom
  13754. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13755. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13756. @item draw
  13757. Set the vectorscope drawing mode.
  13758. Available values are:
  13759. @table @samp
  13760. @item dot
  13761. Draw dot for each sample.
  13762. @item line
  13763. Draw line between previous and current sample.
  13764. @end table
  13765. Default value is @samp{dot}.
  13766. @item scale
  13767. Specify amplitude scale of audio samples.
  13768. Available values are:
  13769. @table @samp
  13770. @item lin
  13771. Linear.
  13772. @item sqrt
  13773. Square root.
  13774. @item cbrt
  13775. Cubic root.
  13776. @item log
  13777. Logarithmic.
  13778. @end table
  13779. @item swap
  13780. Swap left channel axis with right channel axis.
  13781. @item mirror
  13782. Mirror axis.
  13783. @table @samp
  13784. @item none
  13785. No mirror.
  13786. @item x
  13787. Mirror only x axis.
  13788. @item y
  13789. Mirror only y axis.
  13790. @item xy
  13791. Mirror both axis.
  13792. @end table
  13793. @end table
  13794. @subsection Examples
  13795. @itemize
  13796. @item
  13797. Complete example using @command{ffplay}:
  13798. @example
  13799. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13800. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13801. @end example
  13802. @end itemize
  13803. @section bench, abench
  13804. Benchmark part of a filtergraph.
  13805. The filter accepts the following options:
  13806. @table @option
  13807. @item action
  13808. Start or stop a timer.
  13809. Available values are:
  13810. @table @samp
  13811. @item start
  13812. Get the current time, set it as frame metadata (using the key
  13813. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13814. @item stop
  13815. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13816. the input frame metadata to get the time difference. Time difference, average,
  13817. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13818. @code{min}) are then printed. The timestamps are expressed in seconds.
  13819. @end table
  13820. @end table
  13821. @subsection Examples
  13822. @itemize
  13823. @item
  13824. Benchmark @ref{selectivecolor} filter:
  13825. @example
  13826. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13827. @end example
  13828. @end itemize
  13829. @section concat
  13830. Concatenate audio and video streams, joining them together one after the
  13831. other.
  13832. The filter works on segments of synchronized video and audio streams. All
  13833. segments must have the same number of streams of each type, and that will
  13834. also be the number of streams at output.
  13835. The filter accepts the following options:
  13836. @table @option
  13837. @item n
  13838. Set the number of segments. Default is 2.
  13839. @item v
  13840. Set the number of output video streams, that is also the number of video
  13841. streams in each segment. Default is 1.
  13842. @item a
  13843. Set the number of output audio streams, that is also the number of audio
  13844. streams in each segment. Default is 0.
  13845. @item unsafe
  13846. Activate unsafe mode: do not fail if segments have a different format.
  13847. @end table
  13848. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13849. @var{a} audio outputs.
  13850. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13851. segment, in the same order as the outputs, then the inputs for the second
  13852. segment, etc.
  13853. Related streams do not always have exactly the same duration, for various
  13854. reasons including codec frame size or sloppy authoring. For that reason,
  13855. related synchronized streams (e.g. a video and its audio track) should be
  13856. concatenated at once. The concat filter will use the duration of the longest
  13857. stream in each segment (except the last one), and if necessary pad shorter
  13858. audio streams with silence.
  13859. For this filter to work correctly, all segments must start at timestamp 0.
  13860. All corresponding streams must have the same parameters in all segments; the
  13861. filtering system will automatically select a common pixel format for video
  13862. streams, and a common sample format, sample rate and channel layout for
  13863. audio streams, but other settings, such as resolution, must be converted
  13864. explicitly by the user.
  13865. Different frame rates are acceptable but will result in variable frame rate
  13866. at output; be sure to configure the output file to handle it.
  13867. @subsection Examples
  13868. @itemize
  13869. @item
  13870. Concatenate an opening, an episode and an ending, all in bilingual version
  13871. (video in stream 0, audio in streams 1 and 2):
  13872. @example
  13873. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13874. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13875. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13876. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13877. @end example
  13878. @item
  13879. Concatenate two parts, handling audio and video separately, using the
  13880. (a)movie sources, and adjusting the resolution:
  13881. @example
  13882. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13883. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13884. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13885. @end example
  13886. Note that a desync will happen at the stitch if the audio and video streams
  13887. do not have exactly the same duration in the first file.
  13888. @end itemize
  13889. @subsection Commands
  13890. This filter supports the following commands:
  13891. @table @option
  13892. @item next
  13893. Close the current segment and step to the next one
  13894. @end table
  13895. @section drawgraph, adrawgraph
  13896. Draw a graph using input video or audio metadata.
  13897. It accepts the following parameters:
  13898. @table @option
  13899. @item m1
  13900. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13901. @item fg1
  13902. Set 1st foreground color expression.
  13903. @item m2
  13904. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13905. @item fg2
  13906. Set 2nd foreground color expression.
  13907. @item m3
  13908. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13909. @item fg3
  13910. Set 3rd foreground color expression.
  13911. @item m4
  13912. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13913. @item fg4
  13914. Set 4th foreground color expression.
  13915. @item min
  13916. Set minimal value of metadata value.
  13917. @item max
  13918. Set maximal value of metadata value.
  13919. @item bg
  13920. Set graph background color. Default is white.
  13921. @item mode
  13922. Set graph mode.
  13923. Available values for mode is:
  13924. @table @samp
  13925. @item bar
  13926. @item dot
  13927. @item line
  13928. @end table
  13929. Default is @code{line}.
  13930. @item slide
  13931. Set slide mode.
  13932. Available values for slide is:
  13933. @table @samp
  13934. @item frame
  13935. Draw new frame when right border is reached.
  13936. @item replace
  13937. Replace old columns with new ones.
  13938. @item scroll
  13939. Scroll from right to left.
  13940. @item rscroll
  13941. Scroll from left to right.
  13942. @item picture
  13943. Draw single picture.
  13944. @end table
  13945. Default is @code{frame}.
  13946. @item size
  13947. Set size of graph video. For the syntax of this option, check the
  13948. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13949. The default value is @code{900x256}.
  13950. The foreground color expressions can use the following variables:
  13951. @table @option
  13952. @item MIN
  13953. Minimal value of metadata value.
  13954. @item MAX
  13955. Maximal value of metadata value.
  13956. @item VAL
  13957. Current metadata key value.
  13958. @end table
  13959. The color is defined as 0xAABBGGRR.
  13960. @end table
  13961. Example using metadata from @ref{signalstats} filter:
  13962. @example
  13963. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13964. @end example
  13965. Example using metadata from @ref{ebur128} filter:
  13966. @example
  13967. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13968. @end example
  13969. @anchor{ebur128}
  13970. @section ebur128
  13971. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13972. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13973. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13974. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13975. The filter also has a video output (see the @var{video} option) with a real
  13976. time graph to observe the loudness evolution. The graphic contains the logged
  13977. message mentioned above, so it is not printed anymore when this option is set,
  13978. unless the verbose logging is set. The main graphing area contains the
  13979. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13980. the momentary loudness (400 milliseconds).
  13981. More information about the Loudness Recommendation EBU R128 on
  13982. @url{http://tech.ebu.ch/loudness}.
  13983. The filter accepts the following options:
  13984. @table @option
  13985. @item video
  13986. Activate the video output. The audio stream is passed unchanged whether this
  13987. option is set or no. The video stream will be the first output stream if
  13988. activated. Default is @code{0}.
  13989. @item size
  13990. Set the video size. This option is for video only. For the syntax of this
  13991. option, check the
  13992. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13993. Default and minimum resolution is @code{640x480}.
  13994. @item meter
  13995. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13996. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13997. other integer value between this range is allowed.
  13998. @item metadata
  13999. Set metadata injection. If set to @code{1}, the audio input will be segmented
  14000. into 100ms output frames, each of them containing various loudness information
  14001. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  14002. Default is @code{0}.
  14003. @item framelog
  14004. Force the frame logging level.
  14005. Available values are:
  14006. @table @samp
  14007. @item info
  14008. information logging level
  14009. @item verbose
  14010. verbose logging level
  14011. @end table
  14012. By default, the logging level is set to @var{info}. If the @option{video} or
  14013. the @option{metadata} options are set, it switches to @var{verbose}.
  14014. @item peak
  14015. Set peak mode(s).
  14016. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14017. values are:
  14018. @table @samp
  14019. @item none
  14020. Disable any peak mode (default).
  14021. @item sample
  14022. Enable sample-peak mode.
  14023. Simple peak mode looking for the higher sample value. It logs a message
  14024. for sample-peak (identified by @code{SPK}).
  14025. @item true
  14026. Enable true-peak mode.
  14027. If enabled, the peak lookup is done on an over-sampled version of the input
  14028. stream for better peak accuracy. It logs a message for true-peak.
  14029. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14030. This mode requires a build with @code{libswresample}.
  14031. @end table
  14032. @item dualmono
  14033. Treat mono input files as "dual mono". If a mono file is intended for playback
  14034. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14035. If set to @code{true}, this option will compensate for this effect.
  14036. Multi-channel input files are not affected by this option.
  14037. @item panlaw
  14038. Set a specific pan law to be used for the measurement of dual mono files.
  14039. This parameter is optional, and has a default value of -3.01dB.
  14040. @end table
  14041. @subsection Examples
  14042. @itemize
  14043. @item
  14044. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14045. @example
  14046. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14047. @end example
  14048. @item
  14049. Run an analysis with @command{ffmpeg}:
  14050. @example
  14051. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14052. @end example
  14053. @end itemize
  14054. @section interleave, ainterleave
  14055. Temporally interleave frames from several inputs.
  14056. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14057. These filters read frames from several inputs and send the oldest
  14058. queued frame to the output.
  14059. Input streams must have well defined, monotonically increasing frame
  14060. timestamp values.
  14061. In order to submit one frame to output, these filters need to enqueue
  14062. at least one frame for each input, so they cannot work in case one
  14063. input is not yet terminated and will not receive incoming frames.
  14064. For example consider the case when one input is a @code{select} filter
  14065. which always drops input frames. The @code{interleave} filter will keep
  14066. reading from that input, but it will never be able to send new frames
  14067. to output until the input sends an end-of-stream signal.
  14068. Also, depending on inputs synchronization, the filters will drop
  14069. frames in case one input receives more frames than the other ones, and
  14070. the queue is already filled.
  14071. These filters accept the following options:
  14072. @table @option
  14073. @item nb_inputs, n
  14074. Set the number of different inputs, it is 2 by default.
  14075. @end table
  14076. @subsection Examples
  14077. @itemize
  14078. @item
  14079. Interleave frames belonging to different streams using @command{ffmpeg}:
  14080. @example
  14081. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14082. @end example
  14083. @item
  14084. Add flickering blur effect:
  14085. @example
  14086. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14087. @end example
  14088. @end itemize
  14089. @section metadata, ametadata
  14090. Manipulate frame metadata.
  14091. This filter accepts the following options:
  14092. @table @option
  14093. @item mode
  14094. Set mode of operation of the filter.
  14095. Can be one of the following:
  14096. @table @samp
  14097. @item select
  14098. If both @code{value} and @code{key} is set, select frames
  14099. which have such metadata. If only @code{key} is set, select
  14100. every frame that has such key in metadata.
  14101. @item add
  14102. Add new metadata @code{key} and @code{value}. If key is already available
  14103. do nothing.
  14104. @item modify
  14105. Modify value of already present key.
  14106. @item delete
  14107. If @code{value} is set, delete only keys that have such value.
  14108. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14109. the frame.
  14110. @item print
  14111. Print key and its value if metadata was found. If @code{key} is not set print all
  14112. metadata values available in frame.
  14113. @end table
  14114. @item key
  14115. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14116. @item value
  14117. Set metadata value which will be used. This option is mandatory for
  14118. @code{modify} and @code{add} mode.
  14119. @item function
  14120. Which function to use when comparing metadata value and @code{value}.
  14121. Can be one of following:
  14122. @table @samp
  14123. @item same_str
  14124. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14125. @item starts_with
  14126. Values are interpreted as strings, returns true if metadata value starts with
  14127. the @code{value} option string.
  14128. @item less
  14129. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14130. @item equal
  14131. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14132. @item greater
  14133. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14134. @item expr
  14135. Values are interpreted as floats, returns true if expression from option @code{expr}
  14136. evaluates to true.
  14137. @end table
  14138. @item expr
  14139. Set expression which is used when @code{function} is set to @code{expr}.
  14140. The expression is evaluated through the eval API and can contain the following
  14141. constants:
  14142. @table @option
  14143. @item VALUE1
  14144. Float representation of @code{value} from metadata key.
  14145. @item VALUE2
  14146. Float representation of @code{value} as supplied by user in @code{value} option.
  14147. @end table
  14148. @item file
  14149. If specified in @code{print} mode, output is written to the named file. Instead of
  14150. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14151. for standard output. If @code{file} option is not set, output is written to the log
  14152. with AV_LOG_INFO loglevel.
  14153. @end table
  14154. @subsection Examples
  14155. @itemize
  14156. @item
  14157. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14158. between 0 and 1.
  14159. @example
  14160. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14161. @end example
  14162. @item
  14163. Print silencedetect output to file @file{metadata.txt}.
  14164. @example
  14165. silencedetect,ametadata=mode=print:file=metadata.txt
  14166. @end example
  14167. @item
  14168. Direct all metadata to a pipe with file descriptor 4.
  14169. @example
  14170. metadata=mode=print:file='pipe\:4'
  14171. @end example
  14172. @end itemize
  14173. @section perms, aperms
  14174. Set read/write permissions for the output frames.
  14175. These filters are mainly aimed at developers to test direct path in the
  14176. following filter in the filtergraph.
  14177. The filters accept the following options:
  14178. @table @option
  14179. @item mode
  14180. Select the permissions mode.
  14181. It accepts the following values:
  14182. @table @samp
  14183. @item none
  14184. Do nothing. This is the default.
  14185. @item ro
  14186. Set all the output frames read-only.
  14187. @item rw
  14188. Set all the output frames directly writable.
  14189. @item toggle
  14190. Make the frame read-only if writable, and writable if read-only.
  14191. @item random
  14192. Set each output frame read-only or writable randomly.
  14193. @end table
  14194. @item seed
  14195. Set the seed for the @var{random} mode, must be an integer included between
  14196. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14197. @code{-1}, the filter will try to use a good random seed on a best effort
  14198. basis.
  14199. @end table
  14200. Note: in case of auto-inserted filter between the permission filter and the
  14201. following one, the permission might not be received as expected in that
  14202. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14203. perms/aperms filter can avoid this problem.
  14204. @section realtime, arealtime
  14205. Slow down filtering to match real time approximately.
  14206. These filters will pause the filtering for a variable amount of time to
  14207. match the output rate with the input timestamps.
  14208. They are similar to the @option{re} option to @code{ffmpeg}.
  14209. They accept the following options:
  14210. @table @option
  14211. @item limit
  14212. Time limit for the pauses. Any pause longer than that will be considered
  14213. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14214. @end table
  14215. @anchor{select}
  14216. @section select, aselect
  14217. Select frames to pass in output.
  14218. This filter accepts the following options:
  14219. @table @option
  14220. @item expr, e
  14221. Set expression, which is evaluated for each input frame.
  14222. If the expression is evaluated to zero, the frame is discarded.
  14223. If the evaluation result is negative or NaN, the frame is sent to the
  14224. first output; otherwise it is sent to the output with index
  14225. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14226. For example a value of @code{1.2} corresponds to the output with index
  14227. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14228. @item outputs, n
  14229. Set the number of outputs. The output to which to send the selected
  14230. frame is based on the result of the evaluation. Default value is 1.
  14231. @end table
  14232. The expression can contain the following constants:
  14233. @table @option
  14234. @item n
  14235. The (sequential) number of the filtered frame, starting from 0.
  14236. @item selected_n
  14237. The (sequential) number of the selected frame, starting from 0.
  14238. @item prev_selected_n
  14239. The sequential number of the last selected frame. It's NAN if undefined.
  14240. @item TB
  14241. The timebase of the input timestamps.
  14242. @item pts
  14243. The PTS (Presentation TimeStamp) of the filtered video frame,
  14244. expressed in @var{TB} units. It's NAN if undefined.
  14245. @item t
  14246. The PTS of the filtered video frame,
  14247. expressed in seconds. It's NAN if undefined.
  14248. @item prev_pts
  14249. The PTS of the previously filtered video frame. It's NAN if undefined.
  14250. @item prev_selected_pts
  14251. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14252. @item prev_selected_t
  14253. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14254. @item start_pts
  14255. The PTS of the first video frame in the video. It's NAN if undefined.
  14256. @item start_t
  14257. The time of the first video frame in the video. It's NAN if undefined.
  14258. @item pict_type @emph{(video only)}
  14259. The type of the filtered frame. It can assume one of the following
  14260. values:
  14261. @table @option
  14262. @item I
  14263. @item P
  14264. @item B
  14265. @item S
  14266. @item SI
  14267. @item SP
  14268. @item BI
  14269. @end table
  14270. @item interlace_type @emph{(video only)}
  14271. The frame interlace type. It can assume one of the following values:
  14272. @table @option
  14273. @item PROGRESSIVE
  14274. The frame is progressive (not interlaced).
  14275. @item TOPFIRST
  14276. The frame is top-field-first.
  14277. @item BOTTOMFIRST
  14278. The frame is bottom-field-first.
  14279. @end table
  14280. @item consumed_sample_n @emph{(audio only)}
  14281. the number of selected samples before the current frame
  14282. @item samples_n @emph{(audio only)}
  14283. the number of samples in the current frame
  14284. @item sample_rate @emph{(audio only)}
  14285. the input sample rate
  14286. @item key
  14287. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14288. @item pos
  14289. the position in the file of the filtered frame, -1 if the information
  14290. is not available (e.g. for synthetic video)
  14291. @item scene @emph{(video only)}
  14292. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14293. probability for the current frame to introduce a new scene, while a higher
  14294. value means the current frame is more likely to be one (see the example below)
  14295. @item concatdec_select
  14296. The concat demuxer can select only part of a concat input file by setting an
  14297. inpoint and an outpoint, but the output packets may not be entirely contained
  14298. in the selected interval. By using this variable, it is possible to skip frames
  14299. generated by the concat demuxer which are not exactly contained in the selected
  14300. interval.
  14301. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14302. and the @var{lavf.concat.duration} packet metadata values which are also
  14303. present in the decoded frames.
  14304. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14305. start_time and either the duration metadata is missing or the frame pts is less
  14306. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14307. missing.
  14308. That basically means that an input frame is selected if its pts is within the
  14309. interval set by the concat demuxer.
  14310. @end table
  14311. The default value of the select expression is "1".
  14312. @subsection Examples
  14313. @itemize
  14314. @item
  14315. Select all frames in input:
  14316. @example
  14317. select
  14318. @end example
  14319. The example above is the same as:
  14320. @example
  14321. select=1
  14322. @end example
  14323. @item
  14324. Skip all frames:
  14325. @example
  14326. select=0
  14327. @end example
  14328. @item
  14329. Select only I-frames:
  14330. @example
  14331. select='eq(pict_type\,I)'
  14332. @end example
  14333. @item
  14334. Select one frame every 100:
  14335. @example
  14336. select='not(mod(n\,100))'
  14337. @end example
  14338. @item
  14339. Select only frames contained in the 10-20 time interval:
  14340. @example
  14341. select=between(t\,10\,20)
  14342. @end example
  14343. @item
  14344. Select only I-frames contained in the 10-20 time interval:
  14345. @example
  14346. select=between(t\,10\,20)*eq(pict_type\,I)
  14347. @end example
  14348. @item
  14349. Select frames with a minimum distance of 10 seconds:
  14350. @example
  14351. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14352. @end example
  14353. @item
  14354. Use aselect to select only audio frames with samples number > 100:
  14355. @example
  14356. aselect='gt(samples_n\,100)'
  14357. @end example
  14358. @item
  14359. Create a mosaic of the first scenes:
  14360. @example
  14361. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14362. @end example
  14363. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14364. choice.
  14365. @item
  14366. Send even and odd frames to separate outputs, and compose them:
  14367. @example
  14368. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14369. @end example
  14370. @item
  14371. Select useful frames from an ffconcat file which is using inpoints and
  14372. outpoints but where the source files are not intra frame only.
  14373. @example
  14374. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14375. @end example
  14376. @end itemize
  14377. @section sendcmd, asendcmd
  14378. Send commands to filters in the filtergraph.
  14379. These filters read commands to be sent to other filters in the
  14380. filtergraph.
  14381. @code{sendcmd} must be inserted between two video filters,
  14382. @code{asendcmd} must be inserted between two audio filters, but apart
  14383. from that they act the same way.
  14384. The specification of commands can be provided in the filter arguments
  14385. with the @var{commands} option, or in a file specified by the
  14386. @var{filename} option.
  14387. These filters accept the following options:
  14388. @table @option
  14389. @item commands, c
  14390. Set the commands to be read and sent to the other filters.
  14391. @item filename, f
  14392. Set the filename of the commands to be read and sent to the other
  14393. filters.
  14394. @end table
  14395. @subsection Commands syntax
  14396. A commands description consists of a sequence of interval
  14397. specifications, comprising a list of commands to be executed when a
  14398. particular event related to that interval occurs. The occurring event
  14399. is typically the current frame time entering or leaving a given time
  14400. interval.
  14401. An interval is specified by the following syntax:
  14402. @example
  14403. @var{START}[-@var{END}] @var{COMMANDS};
  14404. @end example
  14405. The time interval is specified by the @var{START} and @var{END} times.
  14406. @var{END} is optional and defaults to the maximum time.
  14407. The current frame time is considered within the specified interval if
  14408. it is included in the interval [@var{START}, @var{END}), that is when
  14409. the time is greater or equal to @var{START} and is lesser than
  14410. @var{END}.
  14411. @var{COMMANDS} consists of a sequence of one or more command
  14412. specifications, separated by ",", relating to that interval. The
  14413. syntax of a command specification is given by:
  14414. @example
  14415. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14416. @end example
  14417. @var{FLAGS} is optional and specifies the type of events relating to
  14418. the time interval which enable sending the specified command, and must
  14419. be a non-null sequence of identifier flags separated by "+" or "|" and
  14420. enclosed between "[" and "]".
  14421. The following flags are recognized:
  14422. @table @option
  14423. @item enter
  14424. The command is sent when the current frame timestamp enters the
  14425. specified interval. In other words, the command is sent when the
  14426. previous frame timestamp was not in the given interval, and the
  14427. current is.
  14428. @item leave
  14429. The command is sent when the current frame timestamp leaves the
  14430. specified interval. In other words, the command is sent when the
  14431. previous frame timestamp was in the given interval, and the
  14432. current is not.
  14433. @end table
  14434. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14435. assumed.
  14436. @var{TARGET} specifies the target of the command, usually the name of
  14437. the filter class or a specific filter instance name.
  14438. @var{COMMAND} specifies the name of the command for the target filter.
  14439. @var{ARG} is optional and specifies the optional list of argument for
  14440. the given @var{COMMAND}.
  14441. Between one interval specification and another, whitespaces, or
  14442. sequences of characters starting with @code{#} until the end of line,
  14443. are ignored and can be used to annotate comments.
  14444. A simplified BNF description of the commands specification syntax
  14445. follows:
  14446. @example
  14447. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14448. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14449. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14450. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14451. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14452. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14453. @end example
  14454. @subsection Examples
  14455. @itemize
  14456. @item
  14457. Specify audio tempo change at second 4:
  14458. @example
  14459. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14460. @end example
  14461. @item
  14462. Target a specific filter instance:
  14463. @example
  14464. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14465. @end example
  14466. @item
  14467. Specify a list of drawtext and hue commands in a file.
  14468. @example
  14469. # show text in the interval 5-10
  14470. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14471. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14472. # desaturate the image in the interval 15-20
  14473. 15.0-20.0 [enter] hue s 0,
  14474. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14475. [leave] hue s 1,
  14476. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14477. # apply an exponential saturation fade-out effect, starting from time 25
  14478. 25 [enter] hue s exp(25-t)
  14479. @end example
  14480. A filtergraph allowing to read and process the above command list
  14481. stored in a file @file{test.cmd}, can be specified with:
  14482. @example
  14483. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14484. @end example
  14485. @end itemize
  14486. @anchor{setpts}
  14487. @section setpts, asetpts
  14488. Change the PTS (presentation timestamp) of the input frames.
  14489. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14490. This filter accepts the following options:
  14491. @table @option
  14492. @item expr
  14493. The expression which is evaluated for each frame to construct its timestamp.
  14494. @end table
  14495. The expression is evaluated through the eval API and can contain the following
  14496. constants:
  14497. @table @option
  14498. @item FRAME_RATE
  14499. frame rate, only defined for constant frame-rate video
  14500. @item PTS
  14501. The presentation timestamp in input
  14502. @item N
  14503. The count of the input frame for video or the number of consumed samples,
  14504. not including the current frame for audio, starting from 0.
  14505. @item NB_CONSUMED_SAMPLES
  14506. The number of consumed samples, not including the current frame (only
  14507. audio)
  14508. @item NB_SAMPLES, S
  14509. The number of samples in the current frame (only audio)
  14510. @item SAMPLE_RATE, SR
  14511. The audio sample rate.
  14512. @item STARTPTS
  14513. The PTS of the first frame.
  14514. @item STARTT
  14515. the time in seconds of the first frame
  14516. @item INTERLACED
  14517. State whether the current frame is interlaced.
  14518. @item T
  14519. the time in seconds of the current frame
  14520. @item POS
  14521. original position in the file of the frame, or undefined if undefined
  14522. for the current frame
  14523. @item PREV_INPTS
  14524. The previous input PTS.
  14525. @item PREV_INT
  14526. previous input time in seconds
  14527. @item PREV_OUTPTS
  14528. The previous output PTS.
  14529. @item PREV_OUTT
  14530. previous output time in seconds
  14531. @item RTCTIME
  14532. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14533. instead.
  14534. @item RTCSTART
  14535. The wallclock (RTC) time at the start of the movie in microseconds.
  14536. @item TB
  14537. The timebase of the input timestamps.
  14538. @end table
  14539. @subsection Examples
  14540. @itemize
  14541. @item
  14542. Start counting PTS from zero
  14543. @example
  14544. setpts=PTS-STARTPTS
  14545. @end example
  14546. @item
  14547. Apply fast motion effect:
  14548. @example
  14549. setpts=0.5*PTS
  14550. @end example
  14551. @item
  14552. Apply slow motion effect:
  14553. @example
  14554. setpts=2.0*PTS
  14555. @end example
  14556. @item
  14557. Set fixed rate of 25 frames per second:
  14558. @example
  14559. setpts=N/(25*TB)
  14560. @end example
  14561. @item
  14562. Set fixed rate 25 fps with some jitter:
  14563. @example
  14564. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14565. @end example
  14566. @item
  14567. Apply an offset of 10 seconds to the input PTS:
  14568. @example
  14569. setpts=PTS+10/TB
  14570. @end example
  14571. @item
  14572. Generate timestamps from a "live source" and rebase onto the current timebase:
  14573. @example
  14574. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14575. @end example
  14576. @item
  14577. Generate timestamps by counting samples:
  14578. @example
  14579. asetpts=N/SR/TB
  14580. @end example
  14581. @end itemize
  14582. @section setrange
  14583. Force color range for the output video frame.
  14584. The @code{setrange} filter marks the color range property for the
  14585. output frames. It does not change the input frame, but only sets the
  14586. corresponding property, which affects how the frame is treated by
  14587. following filters.
  14588. The filter accepts the following options:
  14589. @table @option
  14590. @item range
  14591. Available values are:
  14592. @table @samp
  14593. @item auto
  14594. Keep the same color range property.
  14595. @item unspecified, unknown
  14596. Set the color range as unspecified.
  14597. @item limited, tv, mpeg
  14598. Set the color range as limited.
  14599. @item full, pc, jpeg
  14600. Set the color range as full.
  14601. @end table
  14602. @end table
  14603. @section settb, asettb
  14604. Set the timebase to use for the output frames timestamps.
  14605. It is mainly useful for testing timebase configuration.
  14606. It accepts the following parameters:
  14607. @table @option
  14608. @item expr, tb
  14609. The expression which is evaluated into the output timebase.
  14610. @end table
  14611. The value for @option{tb} is an arithmetic expression representing a
  14612. rational. The expression can contain the constants "AVTB" (the default
  14613. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14614. audio only). Default value is "intb".
  14615. @subsection Examples
  14616. @itemize
  14617. @item
  14618. Set the timebase to 1/25:
  14619. @example
  14620. settb=expr=1/25
  14621. @end example
  14622. @item
  14623. Set the timebase to 1/10:
  14624. @example
  14625. settb=expr=0.1
  14626. @end example
  14627. @item
  14628. Set the timebase to 1001/1000:
  14629. @example
  14630. settb=1+0.001
  14631. @end example
  14632. @item
  14633. Set the timebase to 2*intb:
  14634. @example
  14635. settb=2*intb
  14636. @end example
  14637. @item
  14638. Set the default timebase value:
  14639. @example
  14640. settb=AVTB
  14641. @end example
  14642. @end itemize
  14643. @section showcqt
  14644. Convert input audio to a video output representing frequency spectrum
  14645. logarithmically using Brown-Puckette constant Q transform algorithm with
  14646. direct frequency domain coefficient calculation (but the transform itself
  14647. is not really constant Q, instead the Q factor is actually variable/clamped),
  14648. with musical tone scale, from E0 to D#10.
  14649. The filter accepts the following options:
  14650. @table @option
  14651. @item size, s
  14652. Specify the video size for the output. It must be even. For the syntax of this option,
  14653. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14654. Default value is @code{1920x1080}.
  14655. @item fps, rate, r
  14656. Set the output frame rate. Default value is @code{25}.
  14657. @item bar_h
  14658. Set the bargraph height. It must be even. Default value is @code{-1} which
  14659. computes the bargraph height automatically.
  14660. @item axis_h
  14661. Set the axis height. It must be even. Default value is @code{-1} which computes
  14662. the axis height automatically.
  14663. @item sono_h
  14664. Set the sonogram height. It must be even. Default value is @code{-1} which
  14665. computes the sonogram height automatically.
  14666. @item fullhd
  14667. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14668. instead. Default value is @code{1}.
  14669. @item sono_v, volume
  14670. Specify the sonogram volume expression. It can contain variables:
  14671. @table @option
  14672. @item bar_v
  14673. the @var{bar_v} evaluated expression
  14674. @item frequency, freq, f
  14675. the frequency where it is evaluated
  14676. @item timeclamp, tc
  14677. the value of @var{timeclamp} option
  14678. @end table
  14679. and functions:
  14680. @table @option
  14681. @item a_weighting(f)
  14682. A-weighting of equal loudness
  14683. @item b_weighting(f)
  14684. B-weighting of equal loudness
  14685. @item c_weighting(f)
  14686. C-weighting of equal loudness.
  14687. @end table
  14688. Default value is @code{16}.
  14689. @item bar_v, volume2
  14690. Specify the bargraph volume expression. It can contain variables:
  14691. @table @option
  14692. @item sono_v
  14693. the @var{sono_v} evaluated expression
  14694. @item frequency, freq, f
  14695. the frequency where it is evaluated
  14696. @item timeclamp, tc
  14697. the value of @var{timeclamp} option
  14698. @end table
  14699. and functions:
  14700. @table @option
  14701. @item a_weighting(f)
  14702. A-weighting of equal loudness
  14703. @item b_weighting(f)
  14704. B-weighting of equal loudness
  14705. @item c_weighting(f)
  14706. C-weighting of equal loudness.
  14707. @end table
  14708. Default value is @code{sono_v}.
  14709. @item sono_g, gamma
  14710. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14711. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14712. Acceptable range is @code{[1, 7]}.
  14713. @item bar_g, gamma2
  14714. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14715. @code{[1, 7]}.
  14716. @item bar_t
  14717. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14718. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14719. @item timeclamp, tc
  14720. Specify the transform timeclamp. At low frequency, there is trade-off between
  14721. accuracy in time domain and frequency domain. If timeclamp is lower,
  14722. event in time domain is represented more accurately (such as fast bass drum),
  14723. otherwise event in frequency domain is represented more accurately
  14724. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14725. @item attack
  14726. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14727. limits future samples by applying asymmetric windowing in time domain, useful
  14728. when low latency is required. Accepted range is @code{[0, 1]}.
  14729. @item basefreq
  14730. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14731. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14732. @item endfreq
  14733. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14734. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14735. @item coeffclamp
  14736. This option is deprecated and ignored.
  14737. @item tlength
  14738. Specify the transform length in time domain. Use this option to control accuracy
  14739. trade-off between time domain and frequency domain at every frequency sample.
  14740. It can contain variables:
  14741. @table @option
  14742. @item frequency, freq, f
  14743. the frequency where it is evaluated
  14744. @item timeclamp, tc
  14745. the value of @var{timeclamp} option.
  14746. @end table
  14747. Default value is @code{384*tc/(384+tc*f)}.
  14748. @item count
  14749. Specify the transform count for every video frame. Default value is @code{6}.
  14750. Acceptable range is @code{[1, 30]}.
  14751. @item fcount
  14752. Specify the transform count for every single pixel. Default value is @code{0},
  14753. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14754. @item fontfile
  14755. Specify font file for use with freetype to draw the axis. If not specified,
  14756. use embedded font. Note that drawing with font file or embedded font is not
  14757. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14758. option instead.
  14759. @item font
  14760. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14761. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14762. @item fontcolor
  14763. Specify font color expression. This is arithmetic expression that should return
  14764. integer value 0xRRGGBB. It can contain variables:
  14765. @table @option
  14766. @item frequency, freq, f
  14767. the frequency where it is evaluated
  14768. @item timeclamp, tc
  14769. the value of @var{timeclamp} option
  14770. @end table
  14771. and functions:
  14772. @table @option
  14773. @item midi(f)
  14774. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14775. @item r(x), g(x), b(x)
  14776. red, green, and blue value of intensity x.
  14777. @end table
  14778. Default value is @code{st(0, (midi(f)-59.5)/12);
  14779. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14780. r(1-ld(1)) + b(ld(1))}.
  14781. @item axisfile
  14782. Specify image file to draw the axis. This option override @var{fontfile} and
  14783. @var{fontcolor} option.
  14784. @item axis, text
  14785. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14786. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14787. Default value is @code{1}.
  14788. @item csp
  14789. Set colorspace. The accepted values are:
  14790. @table @samp
  14791. @item unspecified
  14792. Unspecified (default)
  14793. @item bt709
  14794. BT.709
  14795. @item fcc
  14796. FCC
  14797. @item bt470bg
  14798. BT.470BG or BT.601-6 625
  14799. @item smpte170m
  14800. SMPTE-170M or BT.601-6 525
  14801. @item smpte240m
  14802. SMPTE-240M
  14803. @item bt2020ncl
  14804. BT.2020 with non-constant luminance
  14805. @end table
  14806. @item cscheme
  14807. Set spectrogram color scheme. This is list of floating point values with format
  14808. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14809. The default is @code{1|0.5|0|0|0.5|1}.
  14810. @end table
  14811. @subsection Examples
  14812. @itemize
  14813. @item
  14814. Playing audio while showing the spectrum:
  14815. @example
  14816. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14817. @end example
  14818. @item
  14819. Same as above, but with frame rate 30 fps:
  14820. @example
  14821. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14822. @end example
  14823. @item
  14824. Playing at 1280x720:
  14825. @example
  14826. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14827. @end example
  14828. @item
  14829. Disable sonogram display:
  14830. @example
  14831. sono_h=0
  14832. @end example
  14833. @item
  14834. A1 and its harmonics: A1, A2, (near)E3, A3:
  14835. @example
  14836. 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),
  14837. asplit[a][out1]; [a] showcqt [out0]'
  14838. @end example
  14839. @item
  14840. Same as above, but with more accuracy in frequency domain:
  14841. @example
  14842. 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),
  14843. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14844. @end example
  14845. @item
  14846. Custom volume:
  14847. @example
  14848. bar_v=10:sono_v=bar_v*a_weighting(f)
  14849. @end example
  14850. @item
  14851. Custom gamma, now spectrum is linear to the amplitude.
  14852. @example
  14853. bar_g=2:sono_g=2
  14854. @end example
  14855. @item
  14856. Custom tlength equation:
  14857. @example
  14858. 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)))'
  14859. @end example
  14860. @item
  14861. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14862. @example
  14863. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14864. @end example
  14865. @item
  14866. Custom font using fontconfig:
  14867. @example
  14868. font='Courier New,Monospace,mono|bold'
  14869. @end example
  14870. @item
  14871. Custom frequency range with custom axis using image file:
  14872. @example
  14873. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14874. @end example
  14875. @end itemize
  14876. @section showfreqs
  14877. Convert input audio to video output representing the audio power spectrum.
  14878. Audio amplitude is on Y-axis while frequency is on X-axis.
  14879. The filter accepts the following options:
  14880. @table @option
  14881. @item size, s
  14882. Specify size of video. For the syntax of this option, check the
  14883. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14884. Default is @code{1024x512}.
  14885. @item mode
  14886. Set display mode.
  14887. This set how each frequency bin will be represented.
  14888. It accepts the following values:
  14889. @table @samp
  14890. @item line
  14891. @item bar
  14892. @item dot
  14893. @end table
  14894. Default is @code{bar}.
  14895. @item ascale
  14896. Set amplitude scale.
  14897. It accepts the following values:
  14898. @table @samp
  14899. @item lin
  14900. Linear scale.
  14901. @item sqrt
  14902. Square root scale.
  14903. @item cbrt
  14904. Cubic root scale.
  14905. @item log
  14906. Logarithmic scale.
  14907. @end table
  14908. Default is @code{log}.
  14909. @item fscale
  14910. Set frequency scale.
  14911. It accepts the following values:
  14912. @table @samp
  14913. @item lin
  14914. Linear scale.
  14915. @item log
  14916. Logarithmic scale.
  14917. @item rlog
  14918. Reverse logarithmic scale.
  14919. @end table
  14920. Default is @code{lin}.
  14921. @item win_size
  14922. Set window size.
  14923. It accepts the following values:
  14924. @table @samp
  14925. @item w16
  14926. @item w32
  14927. @item w64
  14928. @item w128
  14929. @item w256
  14930. @item w512
  14931. @item w1024
  14932. @item w2048
  14933. @item w4096
  14934. @item w8192
  14935. @item w16384
  14936. @item w32768
  14937. @item w65536
  14938. @end table
  14939. Default is @code{w2048}
  14940. @item win_func
  14941. Set windowing function.
  14942. It accepts the following values:
  14943. @table @samp
  14944. @item rect
  14945. @item bartlett
  14946. @item hanning
  14947. @item hamming
  14948. @item blackman
  14949. @item welch
  14950. @item flattop
  14951. @item bharris
  14952. @item bnuttall
  14953. @item bhann
  14954. @item sine
  14955. @item nuttall
  14956. @item lanczos
  14957. @item gauss
  14958. @item tukey
  14959. @item dolph
  14960. @item cauchy
  14961. @item parzen
  14962. @item poisson
  14963. @end table
  14964. Default is @code{hanning}.
  14965. @item overlap
  14966. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14967. which means optimal overlap for selected window function will be picked.
  14968. @item averaging
  14969. Set time averaging. Setting this to 0 will display current maximal peaks.
  14970. Default is @code{1}, which means time averaging is disabled.
  14971. @item colors
  14972. Specify list of colors separated by space or by '|' which will be used to
  14973. draw channel frequencies. Unrecognized or missing colors will be replaced
  14974. by white color.
  14975. @item cmode
  14976. Set channel display mode.
  14977. It accepts the following values:
  14978. @table @samp
  14979. @item combined
  14980. @item separate
  14981. @end table
  14982. Default is @code{combined}.
  14983. @item minamp
  14984. Set minimum amplitude used in @code{log} amplitude scaler.
  14985. @end table
  14986. @anchor{showspectrum}
  14987. @section showspectrum
  14988. Convert input audio to a video output, representing the audio frequency
  14989. spectrum.
  14990. The filter accepts the following options:
  14991. @table @option
  14992. @item size, s
  14993. Specify the video size for the output. For the syntax of this option, check the
  14994. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14995. Default value is @code{640x512}.
  14996. @item slide
  14997. Specify how the spectrum should slide along the window.
  14998. It accepts the following values:
  14999. @table @samp
  15000. @item replace
  15001. the samples start again on the left when they reach the right
  15002. @item scroll
  15003. the samples scroll from right to left
  15004. @item fullframe
  15005. frames are only produced when the samples reach the right
  15006. @item rscroll
  15007. the samples scroll from left to right
  15008. @end table
  15009. Default value is @code{replace}.
  15010. @item mode
  15011. Specify display mode.
  15012. It accepts the following values:
  15013. @table @samp
  15014. @item combined
  15015. all channels are displayed in the same row
  15016. @item separate
  15017. all channels are displayed in separate rows
  15018. @end table
  15019. Default value is @samp{combined}.
  15020. @item color
  15021. Specify display color mode.
  15022. It accepts the following values:
  15023. @table @samp
  15024. @item channel
  15025. each channel is displayed in a separate color
  15026. @item intensity
  15027. each channel is displayed using the same color scheme
  15028. @item rainbow
  15029. each channel is displayed using the rainbow color scheme
  15030. @item moreland
  15031. each channel is displayed using the moreland color scheme
  15032. @item nebulae
  15033. each channel is displayed using the nebulae color scheme
  15034. @item fire
  15035. each channel is displayed using the fire color scheme
  15036. @item fiery
  15037. each channel is displayed using the fiery color scheme
  15038. @item fruit
  15039. each channel is displayed using the fruit color scheme
  15040. @item cool
  15041. each channel is displayed using the cool color scheme
  15042. @end table
  15043. Default value is @samp{channel}.
  15044. @item scale
  15045. Specify scale used for calculating intensity color values.
  15046. It accepts the following values:
  15047. @table @samp
  15048. @item lin
  15049. linear
  15050. @item sqrt
  15051. square root, default
  15052. @item cbrt
  15053. cubic root
  15054. @item log
  15055. logarithmic
  15056. @item 4thrt
  15057. 4th root
  15058. @item 5thrt
  15059. 5th root
  15060. @end table
  15061. Default value is @samp{sqrt}.
  15062. @item saturation
  15063. Set saturation modifier for displayed colors. Negative values provide
  15064. alternative color scheme. @code{0} is no saturation at all.
  15065. Saturation must be in [-10.0, 10.0] range.
  15066. Default value is @code{1}.
  15067. @item win_func
  15068. Set window function.
  15069. It accepts the following values:
  15070. @table @samp
  15071. @item rect
  15072. @item bartlett
  15073. @item hann
  15074. @item hanning
  15075. @item hamming
  15076. @item blackman
  15077. @item welch
  15078. @item flattop
  15079. @item bharris
  15080. @item bnuttall
  15081. @item bhann
  15082. @item sine
  15083. @item nuttall
  15084. @item lanczos
  15085. @item gauss
  15086. @item tukey
  15087. @item dolph
  15088. @item cauchy
  15089. @item parzen
  15090. @item poisson
  15091. @end table
  15092. Default value is @code{hann}.
  15093. @item orientation
  15094. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15095. @code{horizontal}. Default is @code{vertical}.
  15096. @item overlap
  15097. Set ratio of overlap window. Default value is @code{0}.
  15098. When value is @code{1} overlap is set to recommended size for specific
  15099. window function currently used.
  15100. @item gain
  15101. Set scale gain for calculating intensity color values.
  15102. Default value is @code{1}.
  15103. @item data
  15104. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15105. @item rotation
  15106. Set color rotation, must be in [-1.0, 1.0] range.
  15107. Default value is @code{0}.
  15108. @end table
  15109. The usage is very similar to the showwaves filter; see the examples in that
  15110. section.
  15111. @subsection Examples
  15112. @itemize
  15113. @item
  15114. Large window with logarithmic color scaling:
  15115. @example
  15116. showspectrum=s=1280x480:scale=log
  15117. @end example
  15118. @item
  15119. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15120. @example
  15121. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15122. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15123. @end example
  15124. @end itemize
  15125. @section showspectrumpic
  15126. Convert input audio to a single video frame, representing the audio frequency
  15127. spectrum.
  15128. The filter accepts the following options:
  15129. @table @option
  15130. @item size, s
  15131. Specify the video size for the output. For the syntax of this option, check the
  15132. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15133. Default value is @code{4096x2048}.
  15134. @item mode
  15135. Specify display mode.
  15136. It accepts the following values:
  15137. @table @samp
  15138. @item combined
  15139. all channels are displayed in the same row
  15140. @item separate
  15141. all channels are displayed in separate rows
  15142. @end table
  15143. Default value is @samp{combined}.
  15144. @item color
  15145. Specify display color mode.
  15146. It accepts the following values:
  15147. @table @samp
  15148. @item channel
  15149. each channel is displayed in a separate color
  15150. @item intensity
  15151. each channel is displayed using the same color scheme
  15152. @item rainbow
  15153. each channel is displayed using the rainbow color scheme
  15154. @item moreland
  15155. each channel is displayed using the moreland color scheme
  15156. @item nebulae
  15157. each channel is displayed using the nebulae color scheme
  15158. @item fire
  15159. each channel is displayed using the fire color scheme
  15160. @item fiery
  15161. each channel is displayed using the fiery color scheme
  15162. @item fruit
  15163. each channel is displayed using the fruit color scheme
  15164. @item cool
  15165. each channel is displayed using the cool color scheme
  15166. @end table
  15167. Default value is @samp{intensity}.
  15168. @item scale
  15169. Specify scale used for calculating intensity color values.
  15170. It accepts the following values:
  15171. @table @samp
  15172. @item lin
  15173. linear
  15174. @item sqrt
  15175. square root, default
  15176. @item cbrt
  15177. cubic root
  15178. @item log
  15179. logarithmic
  15180. @item 4thrt
  15181. 4th root
  15182. @item 5thrt
  15183. 5th root
  15184. @end table
  15185. Default value is @samp{log}.
  15186. @item saturation
  15187. Set saturation modifier for displayed colors. Negative values provide
  15188. alternative color scheme. @code{0} is no saturation at all.
  15189. Saturation must be in [-10.0, 10.0] range.
  15190. Default value is @code{1}.
  15191. @item win_func
  15192. Set window function.
  15193. It accepts the following values:
  15194. @table @samp
  15195. @item rect
  15196. @item bartlett
  15197. @item hann
  15198. @item hanning
  15199. @item hamming
  15200. @item blackman
  15201. @item welch
  15202. @item flattop
  15203. @item bharris
  15204. @item bnuttall
  15205. @item bhann
  15206. @item sine
  15207. @item nuttall
  15208. @item lanczos
  15209. @item gauss
  15210. @item tukey
  15211. @item dolph
  15212. @item cauchy
  15213. @item parzen
  15214. @item poisson
  15215. @end table
  15216. Default value is @code{hann}.
  15217. @item orientation
  15218. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15219. @code{horizontal}. Default is @code{vertical}.
  15220. @item gain
  15221. Set scale gain for calculating intensity color values.
  15222. Default value is @code{1}.
  15223. @item legend
  15224. Draw time and frequency axes and legends. Default is enabled.
  15225. @item rotation
  15226. Set color rotation, must be in [-1.0, 1.0] range.
  15227. Default value is @code{0}.
  15228. @end table
  15229. @subsection Examples
  15230. @itemize
  15231. @item
  15232. Extract an audio spectrogram of a whole audio track
  15233. in a 1024x1024 picture using @command{ffmpeg}:
  15234. @example
  15235. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15236. @end example
  15237. @end itemize
  15238. @section showvolume
  15239. Convert input audio volume to a video output.
  15240. The filter accepts the following options:
  15241. @table @option
  15242. @item rate, r
  15243. Set video rate.
  15244. @item b
  15245. Set border width, allowed range is [0, 5]. Default is 1.
  15246. @item w
  15247. Set channel width, allowed range is [80, 8192]. Default is 400.
  15248. @item h
  15249. Set channel height, allowed range is [1, 900]. Default is 20.
  15250. @item f
  15251. Set fade, allowed range is [0, 1]. Default is 0.95.
  15252. @item c
  15253. Set volume color expression.
  15254. The expression can use the following variables:
  15255. @table @option
  15256. @item VOLUME
  15257. Current max volume of channel in dB.
  15258. @item PEAK
  15259. Current peak.
  15260. @item CHANNEL
  15261. Current channel number, starting from 0.
  15262. @end table
  15263. @item t
  15264. If set, displays channel names. Default is enabled.
  15265. @item v
  15266. If set, displays volume values. Default is enabled.
  15267. @item o
  15268. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  15269. default is @code{h}.
  15270. @item s
  15271. Set step size, allowed range is [0, 5]. Default is 0, which means
  15272. step is disabled.
  15273. @item p
  15274. Set background opacity, allowed range is [0, 1]. Default is 0.
  15275. @item m
  15276. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15277. default is @code{p}.
  15278. @end table
  15279. @section showwaves
  15280. Convert input audio to a video output, representing the samples waves.
  15281. The filter accepts the following options:
  15282. @table @option
  15283. @item size, s
  15284. Specify the video size for the output. For the syntax of this option, check the
  15285. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15286. Default value is @code{600x240}.
  15287. @item mode
  15288. Set display mode.
  15289. Available values are:
  15290. @table @samp
  15291. @item point
  15292. Draw a point for each sample.
  15293. @item line
  15294. Draw a vertical line for each sample.
  15295. @item p2p
  15296. Draw a point for each sample and a line between them.
  15297. @item cline
  15298. Draw a centered vertical line for each sample.
  15299. @end table
  15300. Default value is @code{point}.
  15301. @item n
  15302. Set the number of samples which are printed on the same column. A
  15303. larger value will decrease the frame rate. Must be a positive
  15304. integer. This option can be set only if the value for @var{rate}
  15305. is not explicitly specified.
  15306. @item rate, r
  15307. Set the (approximate) output frame rate. This is done by setting the
  15308. option @var{n}. Default value is "25".
  15309. @item split_channels
  15310. Set if channels should be drawn separately or overlap. Default value is 0.
  15311. @item colors
  15312. Set colors separated by '|' which are going to be used for drawing of each channel.
  15313. @item scale
  15314. Set amplitude scale.
  15315. Available values are:
  15316. @table @samp
  15317. @item lin
  15318. Linear.
  15319. @item log
  15320. Logarithmic.
  15321. @item sqrt
  15322. Square root.
  15323. @item cbrt
  15324. Cubic root.
  15325. @end table
  15326. Default is linear.
  15327. @item draw
  15328. Set the draw mode. This is mostly useful to set for high @var{n}.
  15329. Available values are:
  15330. @table @samp
  15331. @item scale
  15332. Scale pixel values for each drawn sample.
  15333. @item full
  15334. Draw every sample directly.
  15335. @end table
  15336. Default value is @code{scale}.
  15337. @end table
  15338. @subsection Examples
  15339. @itemize
  15340. @item
  15341. Output the input file audio and the corresponding video representation
  15342. at the same time:
  15343. @example
  15344. amovie=a.mp3,asplit[out0],showwaves[out1]
  15345. @end example
  15346. @item
  15347. Create a synthetic signal and show it with showwaves, forcing a
  15348. frame rate of 30 frames per second:
  15349. @example
  15350. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15351. @end example
  15352. @end itemize
  15353. @section showwavespic
  15354. Convert input audio to a single video frame, representing the samples waves.
  15355. The filter accepts the following options:
  15356. @table @option
  15357. @item size, s
  15358. Specify the video size for the output. For the syntax of this option, check the
  15359. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15360. Default value is @code{600x240}.
  15361. @item split_channels
  15362. Set if channels should be drawn separately or overlap. Default value is 0.
  15363. @item colors
  15364. Set colors separated by '|' which are going to be used for drawing of each channel.
  15365. @item scale
  15366. Set amplitude scale.
  15367. Available values are:
  15368. @table @samp
  15369. @item lin
  15370. Linear.
  15371. @item log
  15372. Logarithmic.
  15373. @item sqrt
  15374. Square root.
  15375. @item cbrt
  15376. Cubic root.
  15377. @end table
  15378. Default is linear.
  15379. @end table
  15380. @subsection Examples
  15381. @itemize
  15382. @item
  15383. Extract a channel split representation of the wave form of a whole audio track
  15384. in a 1024x800 picture using @command{ffmpeg}:
  15385. @example
  15386. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15387. @end example
  15388. @end itemize
  15389. @section sidedata, asidedata
  15390. Delete frame side data, or select frames based on it.
  15391. This filter accepts the following options:
  15392. @table @option
  15393. @item mode
  15394. Set mode of operation of the filter.
  15395. Can be one of the following:
  15396. @table @samp
  15397. @item select
  15398. Select every frame with side data of @code{type}.
  15399. @item delete
  15400. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15401. data in the frame.
  15402. @end table
  15403. @item type
  15404. Set side data type used with all modes. Must be set for @code{select} mode. For
  15405. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15406. in @file{libavutil/frame.h}. For example, to choose
  15407. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15408. @end table
  15409. @section spectrumsynth
  15410. Sythesize audio from 2 input video spectrums, first input stream represents
  15411. magnitude across time and second represents phase across time.
  15412. The filter will transform from frequency domain as displayed in videos back
  15413. to time domain as presented in audio output.
  15414. This filter is primarily created for reversing processed @ref{showspectrum}
  15415. filter outputs, but can synthesize sound from other spectrograms too.
  15416. But in such case results are going to be poor if the phase data is not
  15417. available, because in such cases phase data need to be recreated, usually
  15418. its just recreated from random noise.
  15419. For best results use gray only output (@code{channel} color mode in
  15420. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15421. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15422. @code{data} option. Inputs videos should generally use @code{fullframe}
  15423. slide mode as that saves resources needed for decoding video.
  15424. The filter accepts the following options:
  15425. @table @option
  15426. @item sample_rate
  15427. Specify sample rate of output audio, the sample rate of audio from which
  15428. spectrum was generated may differ.
  15429. @item channels
  15430. Set number of channels represented in input video spectrums.
  15431. @item scale
  15432. Set scale which was used when generating magnitude input spectrum.
  15433. Can be @code{lin} or @code{log}. Default is @code{log}.
  15434. @item slide
  15435. Set slide which was used when generating inputs spectrums.
  15436. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15437. Default is @code{fullframe}.
  15438. @item win_func
  15439. Set window function used for resynthesis.
  15440. @item overlap
  15441. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15442. which means optimal overlap for selected window function will be picked.
  15443. @item orientation
  15444. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15445. Default is @code{vertical}.
  15446. @end table
  15447. @subsection Examples
  15448. @itemize
  15449. @item
  15450. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15451. then resynthesize videos back to audio with spectrumsynth:
  15452. @example
  15453. 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
  15454. 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
  15455. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15456. @end example
  15457. @end itemize
  15458. @section split, asplit
  15459. Split input into several identical outputs.
  15460. @code{asplit} works with audio input, @code{split} with video.
  15461. The filter accepts a single parameter which specifies the number of outputs. If
  15462. unspecified, it defaults to 2.
  15463. @subsection Examples
  15464. @itemize
  15465. @item
  15466. Create two separate outputs from the same input:
  15467. @example
  15468. [in] split [out0][out1]
  15469. @end example
  15470. @item
  15471. To create 3 or more outputs, you need to specify the number of
  15472. outputs, like in:
  15473. @example
  15474. [in] asplit=3 [out0][out1][out2]
  15475. @end example
  15476. @item
  15477. Create two separate outputs from the same input, one cropped and
  15478. one padded:
  15479. @example
  15480. [in] split [splitout1][splitout2];
  15481. [splitout1] crop=100:100:0:0 [cropout];
  15482. [splitout2] pad=200:200:100:100 [padout];
  15483. @end example
  15484. @item
  15485. Create 5 copies of the input audio with @command{ffmpeg}:
  15486. @example
  15487. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15488. @end example
  15489. @end itemize
  15490. @section zmq, azmq
  15491. Receive commands sent through a libzmq client, and forward them to
  15492. filters in the filtergraph.
  15493. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15494. must be inserted between two video filters, @code{azmq} between two
  15495. audio filters. Both are capable to send messages to any filter type.
  15496. To enable these filters you need to install the libzmq library and
  15497. headers and configure FFmpeg with @code{--enable-libzmq}.
  15498. For more information about libzmq see:
  15499. @url{http://www.zeromq.org/}
  15500. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15501. receives messages sent through a network interface defined by the
  15502. @option{bind_address} (or the abbreviation "@option{b}") option.
  15503. Default value of this option is @file{tcp://localhost:5555}. You may
  15504. want to alter this value to your needs, but do not forget to escape any
  15505. ':' signs (see @ref{filtergraph escaping}).
  15506. The received message must be in the form:
  15507. @example
  15508. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15509. @end example
  15510. @var{TARGET} specifies the target of the command, usually the name of
  15511. the filter class or a specific filter instance name. The default
  15512. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  15513. but you can override this by using the @samp{filter_name@@id} syntax
  15514. (see @ref{Filtergraph syntax}).
  15515. @var{COMMAND} specifies the name of the command for the target filter.
  15516. @var{ARG} is optional and specifies the optional argument list for the
  15517. given @var{COMMAND}.
  15518. Upon reception, the message is processed and the corresponding command
  15519. is injected into the filtergraph. Depending on the result, the filter
  15520. will send a reply to the client, adopting the format:
  15521. @example
  15522. @var{ERROR_CODE} @var{ERROR_REASON}
  15523. @var{MESSAGE}
  15524. @end example
  15525. @var{MESSAGE} is optional.
  15526. @subsection Examples
  15527. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15528. be used to send commands processed by these filters.
  15529. Consider the following filtergraph generated by @command{ffplay}.
  15530. In this example the last overlay filter has an instance name. All other
  15531. filters will have default instance names.
  15532. @example
  15533. ffplay -dumpgraph 1 -f lavfi "
  15534. color=s=100x100:c=red [l];
  15535. color=s=100x100:c=blue [r];
  15536. nullsrc=s=200x100, zmq [bg];
  15537. [bg][l] overlay [bg+l];
  15538. [bg+l][r] overlay@@my=x=100 "
  15539. @end example
  15540. To change the color of the left side of the video, the following
  15541. command can be used:
  15542. @example
  15543. echo Parsed_color_0 c yellow | tools/zmqsend
  15544. @end example
  15545. To change the right side:
  15546. @example
  15547. echo Parsed_color_1 c pink | tools/zmqsend
  15548. @end example
  15549. To change the position of the right side:
  15550. @example
  15551. echo overlay@@my x 150 | tools/zmqsend
  15552. @end example
  15553. @c man end MULTIMEDIA FILTERS
  15554. @chapter Multimedia Sources
  15555. @c man begin MULTIMEDIA SOURCES
  15556. Below is a description of the currently available multimedia sources.
  15557. @section amovie
  15558. This is the same as @ref{movie} source, except it selects an audio
  15559. stream by default.
  15560. @anchor{movie}
  15561. @section movie
  15562. Read audio and/or video stream(s) from a movie container.
  15563. It accepts the following parameters:
  15564. @table @option
  15565. @item filename
  15566. The name of the resource to read (not necessarily a file; it can also be a
  15567. device or a stream accessed through some protocol).
  15568. @item format_name, f
  15569. Specifies the format assumed for the movie to read, and can be either
  15570. the name of a container or an input device. If not specified, the
  15571. format is guessed from @var{movie_name} or by probing.
  15572. @item seek_point, sp
  15573. Specifies the seek point in seconds. The frames will be output
  15574. starting from this seek point. The parameter is evaluated with
  15575. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15576. postfix. The default value is "0".
  15577. @item streams, s
  15578. Specifies the streams to read. Several streams can be specified,
  15579. separated by "+". The source will then have as many outputs, in the
  15580. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  15581. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  15582. respectively the default (best suited) video and audio stream. Default
  15583. is "dv", or "da" if the filter is called as "amovie".
  15584. @item stream_index, si
  15585. Specifies the index of the video stream to read. If the value is -1,
  15586. the most suitable video stream will be automatically selected. The default
  15587. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15588. audio instead of video.
  15589. @item loop
  15590. Specifies how many times to read the stream in sequence.
  15591. If the value is 0, the stream will be looped infinitely.
  15592. Default value is "1".
  15593. Note that when the movie is looped the source timestamps are not
  15594. changed, so it will generate non monotonically increasing timestamps.
  15595. @item discontinuity
  15596. Specifies the time difference between frames above which the point is
  15597. considered a timestamp discontinuity which is removed by adjusting the later
  15598. timestamps.
  15599. @end table
  15600. It allows overlaying a second video on top of the main input of
  15601. a filtergraph, as shown in this graph:
  15602. @example
  15603. input -----------> deltapts0 --> overlay --> output
  15604. ^
  15605. |
  15606. movie --> scale--> deltapts1 -------+
  15607. @end example
  15608. @subsection Examples
  15609. @itemize
  15610. @item
  15611. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15612. on top of the input labelled "in":
  15613. @example
  15614. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15615. [in] setpts=PTS-STARTPTS [main];
  15616. [main][over] overlay=16:16 [out]
  15617. @end example
  15618. @item
  15619. Read from a video4linux2 device, and overlay it on top of the input
  15620. labelled "in":
  15621. @example
  15622. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15623. [in] setpts=PTS-STARTPTS [main];
  15624. [main][over] overlay=16:16 [out]
  15625. @end example
  15626. @item
  15627. Read the first video stream and the audio stream with id 0x81 from
  15628. dvd.vob; the video is connected to the pad named "video" and the audio is
  15629. connected to the pad named "audio":
  15630. @example
  15631. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15632. @end example
  15633. @end itemize
  15634. @subsection Commands
  15635. Both movie and amovie support the following commands:
  15636. @table @option
  15637. @item seek
  15638. Perform seek using "av_seek_frame".
  15639. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15640. @itemize
  15641. @item
  15642. @var{stream_index}: If stream_index is -1, a default
  15643. stream is selected, and @var{timestamp} is automatically converted
  15644. from AV_TIME_BASE units to the stream specific time_base.
  15645. @item
  15646. @var{timestamp}: Timestamp in AVStream.time_base units
  15647. or, if no stream is specified, in AV_TIME_BASE units.
  15648. @item
  15649. @var{flags}: Flags which select direction and seeking mode.
  15650. @end itemize
  15651. @item get_duration
  15652. Get movie duration in AV_TIME_BASE units.
  15653. @end table
  15654. @c man end MULTIMEDIA SOURCES