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.

20476 lines
542KB

  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.1 - 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.
  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.
  7962. @item k1
  7963. Coefficient of the quadratic correction term. 0.5 means no correction.
  7964. @item k2
  7965. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7966. @end table
  7967. The formula that generates the correction is:
  7968. @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)
  7969. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7970. distances from the focal point in the source and target images, respectively.
  7971. @section libvmaf
  7972. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7973. score between two input videos.
  7974. The obtained VMAF score is printed through the logging system.
  7975. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7976. After installing the library it can be enabled using:
  7977. @code{./configure --enable-libvmaf}.
  7978. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7979. The filter has following options:
  7980. @table @option
  7981. @item model_path
  7982. Set the model path which is to be used for SVM.
  7983. Default value: @code{"vmaf_v0.6.1.pkl"}
  7984. @item log_path
  7985. Set the file path to be used to store logs.
  7986. @item log_fmt
  7987. Set the format of the log file (xml or json).
  7988. @item enable_transform
  7989. Enables transform for computing vmaf.
  7990. @item phone_model
  7991. Invokes the phone model which will generate VMAF scores higher than in the
  7992. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7993. @item psnr
  7994. Enables computing psnr along with vmaf.
  7995. @item ssim
  7996. Enables computing ssim along with vmaf.
  7997. @item ms_ssim
  7998. Enables computing ms_ssim along with vmaf.
  7999. @item pool
  8000. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8001. @end table
  8002. This filter also supports the @ref{framesync} options.
  8003. On the below examples the input file @file{main.mpg} being processed is
  8004. compared with the reference file @file{ref.mpg}.
  8005. @example
  8006. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8007. @end example
  8008. Example with options:
  8009. @example
  8010. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8011. @end example
  8012. @section limiter
  8013. Limits the pixel components values to the specified range [min, max].
  8014. The filter accepts the following options:
  8015. @table @option
  8016. @item min
  8017. Lower bound. Defaults to the lowest allowed value for the input.
  8018. @item max
  8019. Upper bound. Defaults to the highest allowed value for the input.
  8020. @item planes
  8021. Specify which planes will be processed. Defaults to all available.
  8022. @end table
  8023. @section loop
  8024. Loop video frames.
  8025. The filter accepts the following options:
  8026. @table @option
  8027. @item loop
  8028. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8029. Default is 0.
  8030. @item size
  8031. Set maximal size in number of frames. Default is 0.
  8032. @item start
  8033. Set first frame of loop. Default is 0.
  8034. @end table
  8035. @anchor{lut3d}
  8036. @section lut3d
  8037. Apply a 3D LUT to an input video.
  8038. The filter accepts the following options:
  8039. @table @option
  8040. @item file
  8041. Set the 3D LUT file name.
  8042. Currently supported formats:
  8043. @table @samp
  8044. @item 3dl
  8045. AfterEffects
  8046. @item cube
  8047. Iridas
  8048. @item dat
  8049. DaVinci
  8050. @item m3d
  8051. Pandora
  8052. @end table
  8053. @item interp
  8054. Select interpolation mode.
  8055. Available values are:
  8056. @table @samp
  8057. @item nearest
  8058. Use values from the nearest defined point.
  8059. @item trilinear
  8060. Interpolate values using the 8 points defining a cube.
  8061. @item tetrahedral
  8062. Interpolate values using a tetrahedron.
  8063. @end table
  8064. @end table
  8065. This filter also supports the @ref{framesync} options.
  8066. @section lumakey
  8067. Turn certain luma values into transparency.
  8068. The filter accepts the following options:
  8069. @table @option
  8070. @item threshold
  8071. Set the luma which will be used as base for transparency.
  8072. Default value is @code{0}.
  8073. @item tolerance
  8074. Set the range of luma values to be keyed out.
  8075. Default value is @code{0}.
  8076. @item softness
  8077. Set the range of softness. Default value is @code{0}.
  8078. Use this to control gradual transition from zero to full transparency.
  8079. @end table
  8080. @section lut, lutrgb, lutyuv
  8081. Compute a look-up table for binding each pixel component input value
  8082. to an output value, and apply it to the input video.
  8083. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8084. to an RGB input video.
  8085. These filters accept the following parameters:
  8086. @table @option
  8087. @item c0
  8088. set first pixel component expression
  8089. @item c1
  8090. set second pixel component expression
  8091. @item c2
  8092. set third pixel component expression
  8093. @item c3
  8094. set fourth pixel component expression, corresponds to the alpha component
  8095. @item r
  8096. set red component expression
  8097. @item g
  8098. set green component expression
  8099. @item b
  8100. set blue component expression
  8101. @item a
  8102. alpha component expression
  8103. @item y
  8104. set Y/luminance component expression
  8105. @item u
  8106. set U/Cb component expression
  8107. @item v
  8108. set V/Cr component expression
  8109. @end table
  8110. Each of them specifies the expression to use for computing the lookup table for
  8111. the corresponding pixel component values.
  8112. The exact component associated to each of the @var{c*} options depends on the
  8113. format in input.
  8114. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8115. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8116. The expressions can contain the following constants and functions:
  8117. @table @option
  8118. @item w
  8119. @item h
  8120. The input width and height.
  8121. @item val
  8122. The input value for the pixel component.
  8123. @item clipval
  8124. The input value, clipped to the @var{minval}-@var{maxval} range.
  8125. @item maxval
  8126. The maximum value for the pixel component.
  8127. @item minval
  8128. The minimum value for the pixel component.
  8129. @item negval
  8130. The negated value for the pixel component value, clipped to the
  8131. @var{minval}-@var{maxval} range; it corresponds to the expression
  8132. "maxval-clipval+minval".
  8133. @item clip(val)
  8134. The computed value in @var{val}, clipped to the
  8135. @var{minval}-@var{maxval} range.
  8136. @item gammaval(gamma)
  8137. The computed gamma correction value of the pixel component value,
  8138. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8139. expression
  8140. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8141. @end table
  8142. All expressions default to "val".
  8143. @subsection Examples
  8144. @itemize
  8145. @item
  8146. Negate input video:
  8147. @example
  8148. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8149. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8150. @end example
  8151. The above is the same as:
  8152. @example
  8153. lutrgb="r=negval:g=negval:b=negval"
  8154. lutyuv="y=negval:u=negval:v=negval"
  8155. @end example
  8156. @item
  8157. Negate luminance:
  8158. @example
  8159. lutyuv=y=negval
  8160. @end example
  8161. @item
  8162. Remove chroma components, turning the video into a graytone image:
  8163. @example
  8164. lutyuv="u=128:v=128"
  8165. @end example
  8166. @item
  8167. Apply a luma burning effect:
  8168. @example
  8169. lutyuv="y=2*val"
  8170. @end example
  8171. @item
  8172. Remove green and blue components:
  8173. @example
  8174. lutrgb="g=0:b=0"
  8175. @end example
  8176. @item
  8177. Set a constant alpha channel value on input:
  8178. @example
  8179. format=rgba,lutrgb=a="maxval-minval/2"
  8180. @end example
  8181. @item
  8182. Correct luminance gamma by a factor of 0.5:
  8183. @example
  8184. lutyuv=y=gammaval(0.5)
  8185. @end example
  8186. @item
  8187. Discard least significant bits of luma:
  8188. @example
  8189. lutyuv=y='bitand(val, 128+64+32)'
  8190. @end example
  8191. @item
  8192. Technicolor like effect:
  8193. @example
  8194. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8195. @end example
  8196. @end itemize
  8197. @section lut2, tlut2
  8198. The @code{lut2} filter takes two input streams and outputs one
  8199. stream.
  8200. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8201. from one single stream.
  8202. This filter accepts the following parameters:
  8203. @table @option
  8204. @item c0
  8205. set first pixel component expression
  8206. @item c1
  8207. set second pixel component expression
  8208. @item c2
  8209. set third pixel component expression
  8210. @item c3
  8211. set fourth pixel component expression, corresponds to the alpha component
  8212. @end table
  8213. Each of them specifies the expression to use for computing the lookup table for
  8214. the corresponding pixel component values.
  8215. The exact component associated to each of the @var{c*} options depends on the
  8216. format in inputs.
  8217. The expressions can contain the following constants:
  8218. @table @option
  8219. @item w
  8220. @item h
  8221. The input width and height.
  8222. @item x
  8223. The first input value for the pixel component.
  8224. @item y
  8225. The second input value for the pixel component.
  8226. @item bdx
  8227. The first input video bit depth.
  8228. @item bdy
  8229. The second input video bit depth.
  8230. @end table
  8231. All expressions default to "x".
  8232. @subsection Examples
  8233. @itemize
  8234. @item
  8235. Highlight differences between two RGB video streams:
  8236. @example
  8237. 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)'
  8238. @end example
  8239. @item
  8240. Highlight differences between two YUV video streams:
  8241. @example
  8242. 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)'
  8243. @end example
  8244. @item
  8245. Show max difference between two video streams:
  8246. @example
  8247. 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)))'
  8248. @end example
  8249. @end itemize
  8250. @section maskedclamp
  8251. Clamp the first input stream with the second input and third input stream.
  8252. Returns the value of first stream to be between second input
  8253. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8254. This filter accepts the following options:
  8255. @table @option
  8256. @item undershoot
  8257. Default value is @code{0}.
  8258. @item overshoot
  8259. Default value is @code{0}.
  8260. @item planes
  8261. Set which planes will be processed as bitmap, unprocessed planes will be
  8262. copied from first stream.
  8263. By default value 0xf, all planes will be processed.
  8264. @end table
  8265. @section maskedmerge
  8266. Merge the first input stream with the second input stream using per pixel
  8267. weights in the third input stream.
  8268. A value of 0 in the third stream pixel component means that pixel component
  8269. from first stream is returned unchanged, while maximum value (eg. 255 for
  8270. 8-bit videos) means that pixel component from second stream is returned
  8271. unchanged. Intermediate values define the amount of merging between both
  8272. input stream's pixel components.
  8273. This filter accepts the following options:
  8274. @table @option
  8275. @item planes
  8276. Set which planes will be processed as bitmap, unprocessed planes will be
  8277. copied from first stream.
  8278. By default value 0xf, all planes will be processed.
  8279. @end table
  8280. @section mcdeint
  8281. Apply motion-compensation deinterlacing.
  8282. It needs one field per frame as input and must thus be used together
  8283. with yadif=1/3 or equivalent.
  8284. This filter accepts the following options:
  8285. @table @option
  8286. @item mode
  8287. Set the deinterlacing mode.
  8288. It accepts one of the following values:
  8289. @table @samp
  8290. @item fast
  8291. @item medium
  8292. @item slow
  8293. use iterative motion estimation
  8294. @item extra_slow
  8295. like @samp{slow}, but use multiple reference frames.
  8296. @end table
  8297. Default value is @samp{fast}.
  8298. @item parity
  8299. Set the picture field parity assumed for the input video. It must be
  8300. one of the following values:
  8301. @table @samp
  8302. @item 0, tff
  8303. assume top field first
  8304. @item 1, bff
  8305. assume bottom field first
  8306. @end table
  8307. Default value is @samp{bff}.
  8308. @item qp
  8309. Set per-block quantization parameter (QP) used by the internal
  8310. encoder.
  8311. Higher values should result in a smoother motion vector field but less
  8312. optimal individual vectors. Default value is 1.
  8313. @end table
  8314. @section mergeplanes
  8315. Merge color channel components from several video streams.
  8316. The filter accepts up to 4 input streams, and merge selected input
  8317. planes to the output video.
  8318. This filter accepts the following options:
  8319. @table @option
  8320. @item mapping
  8321. Set input to output plane mapping. Default is @code{0}.
  8322. The mappings is specified as a bitmap. It should be specified as a
  8323. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8324. mapping for the first plane of the output stream. 'A' sets the number of
  8325. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8326. corresponding input to use (from 0 to 3). The rest of the mappings is
  8327. similar, 'Bb' describes the mapping for the output stream second
  8328. plane, 'Cc' describes the mapping for the output stream third plane and
  8329. 'Dd' describes the mapping for the output stream fourth plane.
  8330. @item format
  8331. Set output pixel format. Default is @code{yuva444p}.
  8332. @end table
  8333. @subsection Examples
  8334. @itemize
  8335. @item
  8336. Merge three gray video streams of same width and height into single video stream:
  8337. @example
  8338. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8339. @end example
  8340. @item
  8341. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8342. @example
  8343. [a0][a1]mergeplanes=0x00010210:yuva444p
  8344. @end example
  8345. @item
  8346. Swap Y and A plane in yuva444p stream:
  8347. @example
  8348. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8349. @end example
  8350. @item
  8351. Swap U and V plane in yuv420p stream:
  8352. @example
  8353. format=yuv420p,mergeplanes=0x000201:yuv420p
  8354. @end example
  8355. @item
  8356. Cast a rgb24 clip to yuv444p:
  8357. @example
  8358. format=rgb24,mergeplanes=0x000102:yuv444p
  8359. @end example
  8360. @end itemize
  8361. @section mestimate
  8362. Estimate and export motion vectors using block matching algorithms.
  8363. Motion vectors are stored in frame side data to be used by other filters.
  8364. This filter accepts the following options:
  8365. @table @option
  8366. @item method
  8367. Specify the motion estimation method. Accepts one of the following values:
  8368. @table @samp
  8369. @item esa
  8370. Exhaustive search algorithm.
  8371. @item tss
  8372. Three step search algorithm.
  8373. @item tdls
  8374. Two dimensional logarithmic search algorithm.
  8375. @item ntss
  8376. New three step search algorithm.
  8377. @item fss
  8378. Four step search algorithm.
  8379. @item ds
  8380. Diamond search algorithm.
  8381. @item hexbs
  8382. Hexagon-based search algorithm.
  8383. @item epzs
  8384. Enhanced predictive zonal search algorithm.
  8385. @item umh
  8386. Uneven multi-hexagon search algorithm.
  8387. @end table
  8388. Default value is @samp{esa}.
  8389. @item mb_size
  8390. Macroblock size. Default @code{16}.
  8391. @item search_param
  8392. Search parameter. Default @code{7}.
  8393. @end table
  8394. @section midequalizer
  8395. Apply Midway Image Equalization effect using two video streams.
  8396. Midway Image Equalization adjusts a pair of images to have the same
  8397. histogram, while maintaining their dynamics as much as possible. It's
  8398. useful for e.g. matching exposures from a pair of stereo cameras.
  8399. This filter has two inputs and one output, which must be of same pixel format, but
  8400. may be of different sizes. The output of filter is first input adjusted with
  8401. midway histogram of both inputs.
  8402. This filter accepts the following option:
  8403. @table @option
  8404. @item planes
  8405. Set which planes to process. Default is @code{15}, which is all available planes.
  8406. @end table
  8407. @section minterpolate
  8408. Convert the video to specified frame rate using motion interpolation.
  8409. This filter accepts the following options:
  8410. @table @option
  8411. @item fps
  8412. 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}.
  8413. @item mi_mode
  8414. Motion interpolation mode. Following values are accepted:
  8415. @table @samp
  8416. @item dup
  8417. Duplicate previous or next frame for interpolating new ones.
  8418. @item blend
  8419. Blend source frames. Interpolated frame is mean of previous and next frames.
  8420. @item mci
  8421. Motion compensated interpolation. Following options are effective when this mode is selected:
  8422. @table @samp
  8423. @item mc_mode
  8424. Motion compensation mode. Following values are accepted:
  8425. @table @samp
  8426. @item obmc
  8427. Overlapped block motion compensation.
  8428. @item aobmc
  8429. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8430. @end table
  8431. Default mode is @samp{obmc}.
  8432. @item me_mode
  8433. Motion estimation mode. Following values are accepted:
  8434. @table @samp
  8435. @item bidir
  8436. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8437. @item bilat
  8438. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8439. @end table
  8440. Default mode is @samp{bilat}.
  8441. @item me
  8442. The algorithm to be used for motion estimation. Following values are accepted:
  8443. @table @samp
  8444. @item esa
  8445. Exhaustive search algorithm.
  8446. @item tss
  8447. Three step search algorithm.
  8448. @item tdls
  8449. Two dimensional logarithmic search algorithm.
  8450. @item ntss
  8451. New three step search algorithm.
  8452. @item fss
  8453. Four step search algorithm.
  8454. @item ds
  8455. Diamond search algorithm.
  8456. @item hexbs
  8457. Hexagon-based search algorithm.
  8458. @item epzs
  8459. Enhanced predictive zonal search algorithm.
  8460. @item umh
  8461. Uneven multi-hexagon search algorithm.
  8462. @end table
  8463. Default algorithm is @samp{epzs}.
  8464. @item mb_size
  8465. Macroblock size. Default @code{16}.
  8466. @item search_param
  8467. Motion estimation search parameter. Default @code{32}.
  8468. @item vsbmc
  8469. 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).
  8470. @end table
  8471. @end table
  8472. @item scd
  8473. 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:
  8474. @table @samp
  8475. @item none
  8476. Disable scene change detection.
  8477. @item fdiff
  8478. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8479. @end table
  8480. Default method is @samp{fdiff}.
  8481. @item scd_threshold
  8482. Scene change detection threshold. Default is @code{5.0}.
  8483. @end table
  8484. @section mix
  8485. Mix several video input streams into one video stream.
  8486. A description of the accepted options follows.
  8487. @table @option
  8488. @item nb_inputs
  8489. The number of inputs. If unspecified, it defaults to 2.
  8490. @item weights
  8491. Specify weight of each input video stream as sequence.
  8492. Each weight is separated by space.
  8493. @item duration
  8494. Specify how end of stream is determined.
  8495. @table @samp
  8496. @item longest
  8497. The duration of the longest input. (default)
  8498. @item shortest
  8499. The duration of the shortest input.
  8500. @item first
  8501. The duration of the first input.
  8502. @end table
  8503. @end table
  8504. @section mpdecimate
  8505. Drop frames that do not differ greatly from the previous frame in
  8506. order to reduce frame rate.
  8507. The main use of this filter is for very-low-bitrate encoding
  8508. (e.g. streaming over dialup modem), but it could in theory be used for
  8509. fixing movies that were inverse-telecined incorrectly.
  8510. A description of the accepted options follows.
  8511. @table @option
  8512. @item max
  8513. Set the maximum number of consecutive frames which can be dropped (if
  8514. positive), or the minimum interval between dropped frames (if
  8515. negative). If the value is 0, the frame is dropped disregarding the
  8516. number of previous sequentially dropped frames.
  8517. Default value is 0.
  8518. @item hi
  8519. @item lo
  8520. @item frac
  8521. Set the dropping threshold values.
  8522. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8523. represent actual pixel value differences, so a threshold of 64
  8524. corresponds to 1 unit of difference for each pixel, or the same spread
  8525. out differently over the block.
  8526. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8527. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8528. meaning the whole image) differ by more than a threshold of @option{lo}.
  8529. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8530. 64*5, and default value for @option{frac} is 0.33.
  8531. @end table
  8532. @section negate
  8533. Negate input video.
  8534. It accepts an integer in input; if non-zero it negates the
  8535. alpha component (if available). The default value in input is 0.
  8536. @section nlmeans
  8537. Denoise frames using Non-Local Means algorithm.
  8538. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8539. context similarity is defined by comparing their surrounding patches of size
  8540. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8541. around the pixel.
  8542. Note that the research area defines centers for patches, which means some
  8543. patches will be made of pixels outside that research area.
  8544. The filter accepts the following options.
  8545. @table @option
  8546. @item s
  8547. Set denoising strength.
  8548. @item p
  8549. Set patch size.
  8550. @item pc
  8551. Same as @option{p} but for chroma planes.
  8552. The default value is @var{0} and means automatic.
  8553. @item r
  8554. Set research size.
  8555. @item rc
  8556. Same as @option{r} but for chroma planes.
  8557. The default value is @var{0} and means automatic.
  8558. @end table
  8559. @section nnedi
  8560. Deinterlace video using neural network edge directed interpolation.
  8561. This filter accepts the following options:
  8562. @table @option
  8563. @item weights
  8564. Mandatory option, without binary file filter can not work.
  8565. Currently file can be found here:
  8566. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8567. @item deint
  8568. Set which frames to deinterlace, by default it is @code{all}.
  8569. Can be @code{all} or @code{interlaced}.
  8570. @item field
  8571. Set mode of operation.
  8572. Can be one of the following:
  8573. @table @samp
  8574. @item af
  8575. Use frame flags, both fields.
  8576. @item a
  8577. Use frame flags, single field.
  8578. @item t
  8579. Use top field only.
  8580. @item b
  8581. Use bottom field only.
  8582. @item tf
  8583. Use both fields, top first.
  8584. @item bf
  8585. Use both fields, bottom first.
  8586. @end table
  8587. @item planes
  8588. Set which planes to process, by default filter process all frames.
  8589. @item nsize
  8590. Set size of local neighborhood around each pixel, used by the predictor neural
  8591. network.
  8592. Can be one of the following:
  8593. @table @samp
  8594. @item s8x6
  8595. @item s16x6
  8596. @item s32x6
  8597. @item s48x6
  8598. @item s8x4
  8599. @item s16x4
  8600. @item s32x4
  8601. @end table
  8602. @item nns
  8603. Set the number of neurons in predictor neural network.
  8604. Can be one of the following:
  8605. @table @samp
  8606. @item n16
  8607. @item n32
  8608. @item n64
  8609. @item n128
  8610. @item n256
  8611. @end table
  8612. @item qual
  8613. Controls the number of different neural network predictions that are blended
  8614. together to compute the final output value. Can be @code{fast}, default or
  8615. @code{slow}.
  8616. @item etype
  8617. Set which set of weights to use in the predictor.
  8618. Can be one of the following:
  8619. @table @samp
  8620. @item a
  8621. weights trained to minimize absolute error
  8622. @item s
  8623. weights trained to minimize squared error
  8624. @end table
  8625. @item pscrn
  8626. Controls whether or not the prescreener neural network is used to decide
  8627. which pixels should be processed by the predictor neural network and which
  8628. can be handled by simple cubic interpolation.
  8629. The prescreener is trained to know whether cubic interpolation will be
  8630. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8631. The computational complexity of the prescreener nn is much less than that of
  8632. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8633. using the prescreener generally results in much faster processing.
  8634. The prescreener is pretty accurate, so the difference between using it and not
  8635. using it is almost always unnoticeable.
  8636. Can be one of the following:
  8637. @table @samp
  8638. @item none
  8639. @item original
  8640. @item new
  8641. @end table
  8642. Default is @code{new}.
  8643. @item fapprox
  8644. Set various debugging flags.
  8645. @end table
  8646. @section noformat
  8647. Force libavfilter not to use any of the specified pixel formats for the
  8648. input to the next filter.
  8649. It accepts the following parameters:
  8650. @table @option
  8651. @item pix_fmts
  8652. A '|'-separated list of pixel format names, such as
  8653. pix_fmts=yuv420p|monow|rgb24".
  8654. @end table
  8655. @subsection Examples
  8656. @itemize
  8657. @item
  8658. Force libavfilter to use a format different from @var{yuv420p} for the
  8659. input to the vflip filter:
  8660. @example
  8661. noformat=pix_fmts=yuv420p,vflip
  8662. @end example
  8663. @item
  8664. Convert the input video to any of the formats not contained in the list:
  8665. @example
  8666. noformat=yuv420p|yuv444p|yuv410p
  8667. @end example
  8668. @end itemize
  8669. @section noise
  8670. Add noise on video input frame.
  8671. The filter accepts the following options:
  8672. @table @option
  8673. @item all_seed
  8674. @item c0_seed
  8675. @item c1_seed
  8676. @item c2_seed
  8677. @item c3_seed
  8678. Set noise seed for specific pixel component or all pixel components in case
  8679. of @var{all_seed}. Default value is @code{123457}.
  8680. @item all_strength, alls
  8681. @item c0_strength, c0s
  8682. @item c1_strength, c1s
  8683. @item c2_strength, c2s
  8684. @item c3_strength, c3s
  8685. Set noise strength for specific pixel component or all pixel components in case
  8686. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8687. @item all_flags, allf
  8688. @item c0_flags, c0f
  8689. @item c1_flags, c1f
  8690. @item c2_flags, c2f
  8691. @item c3_flags, c3f
  8692. Set pixel component flags or set flags for all components if @var{all_flags}.
  8693. Available values for component flags are:
  8694. @table @samp
  8695. @item a
  8696. averaged temporal noise (smoother)
  8697. @item p
  8698. mix random noise with a (semi)regular pattern
  8699. @item t
  8700. temporal noise (noise pattern changes between frames)
  8701. @item u
  8702. uniform noise (gaussian otherwise)
  8703. @end table
  8704. @end table
  8705. @subsection Examples
  8706. Add temporal and uniform noise to input video:
  8707. @example
  8708. noise=alls=20:allf=t+u
  8709. @end example
  8710. @section normalize
  8711. Normalize RGB video (aka histogram stretching, contrast stretching).
  8712. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8713. For each channel of each frame, the filter computes the input range and maps
  8714. it linearly to the user-specified output range. The output range defaults
  8715. to the full dynamic range from pure black to pure white.
  8716. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8717. changes in brightness) caused when small dark or bright objects enter or leave
  8718. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8719. video camera, and, like a video camera, it may cause a period of over- or
  8720. under-exposure of the video.
  8721. The R,G,B channels can be normalized independently, which may cause some
  8722. color shifting, or linked together as a single channel, which prevents
  8723. color shifting. Linked normalization preserves hue. Independent normalization
  8724. does not, so it can be used to remove some color casts. Independent and linked
  8725. normalization can be combined in any ratio.
  8726. The normalize filter accepts the following options:
  8727. @table @option
  8728. @item blackpt
  8729. @item whitept
  8730. Colors which define the output range. The minimum input value is mapped to
  8731. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8732. The defaults are black and white respectively. Specifying white for
  8733. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8734. normalized video. Shades of grey can be used to reduce the dynamic range
  8735. (contrast). Specifying saturated colors here can create some interesting
  8736. effects.
  8737. @item smoothing
  8738. The number of previous frames to use for temporal smoothing. The input range
  8739. of each channel is smoothed using a rolling average over the current frame
  8740. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8741. smoothing).
  8742. @item independence
  8743. Controls the ratio of independent (color shifting) channel normalization to
  8744. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8745. independent. Defaults to 1.0 (fully independent).
  8746. @item strength
  8747. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8748. expensive no-op. Defaults to 1.0 (full strength).
  8749. @end table
  8750. @subsection Examples
  8751. Stretch video contrast to use the full dynamic range, with no temporal
  8752. smoothing; may flicker depending on the source content:
  8753. @example
  8754. normalize=blackpt=black:whitept=white:smoothing=0
  8755. @end example
  8756. As above, but with 50 frames of temporal smoothing; flicker should be
  8757. reduced, depending on the source content:
  8758. @example
  8759. normalize=blackpt=black:whitept=white:smoothing=50
  8760. @end example
  8761. As above, but with hue-preserving linked channel normalization:
  8762. @example
  8763. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8764. @end example
  8765. As above, but with half strength:
  8766. @example
  8767. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8768. @end example
  8769. Map the darkest input color to red, the brightest input color to cyan:
  8770. @example
  8771. normalize=blackpt=red:whitept=cyan
  8772. @end example
  8773. @section null
  8774. Pass the video source unchanged to the output.
  8775. @section ocr
  8776. Optical Character Recognition
  8777. This filter uses Tesseract for optical character recognition.
  8778. It accepts the following options:
  8779. @table @option
  8780. @item datapath
  8781. Set datapath to tesseract data. Default is to use whatever was
  8782. set at installation.
  8783. @item language
  8784. Set language, default is "eng".
  8785. @item whitelist
  8786. Set character whitelist.
  8787. @item blacklist
  8788. Set character blacklist.
  8789. @end table
  8790. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8791. @section ocv
  8792. Apply a video transform using libopencv.
  8793. To enable this filter, install the libopencv library and headers and
  8794. configure FFmpeg with @code{--enable-libopencv}.
  8795. It accepts the following parameters:
  8796. @table @option
  8797. @item filter_name
  8798. The name of the libopencv filter to apply.
  8799. @item filter_params
  8800. The parameters to pass to the libopencv filter. If not specified, the default
  8801. values are assumed.
  8802. @end table
  8803. Refer to the official libopencv documentation for more precise
  8804. information:
  8805. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8806. Several libopencv filters are supported; see the following subsections.
  8807. @anchor{dilate}
  8808. @subsection dilate
  8809. Dilate an image by using a specific structuring element.
  8810. It corresponds to the libopencv function @code{cvDilate}.
  8811. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8812. @var{struct_el} represents a structuring element, and has the syntax:
  8813. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8814. @var{cols} and @var{rows} represent the number of columns and rows of
  8815. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8816. point, and @var{shape} the shape for the structuring element. @var{shape}
  8817. must be "rect", "cross", "ellipse", or "custom".
  8818. If the value for @var{shape} is "custom", it must be followed by a
  8819. string of the form "=@var{filename}". The file with name
  8820. @var{filename} is assumed to represent a binary image, with each
  8821. printable character corresponding to a bright pixel. When a custom
  8822. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8823. or columns and rows of the read file are assumed instead.
  8824. The default value for @var{struct_el} is "3x3+0x0/rect".
  8825. @var{nb_iterations} specifies the number of times the transform is
  8826. applied to the image, and defaults to 1.
  8827. Some examples:
  8828. @example
  8829. # Use the default values
  8830. ocv=dilate
  8831. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8832. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8833. # Read the shape from the file diamond.shape, iterating two times.
  8834. # The file diamond.shape may contain a pattern of characters like this
  8835. # *
  8836. # ***
  8837. # *****
  8838. # ***
  8839. # *
  8840. # The specified columns and rows are ignored
  8841. # but the anchor point coordinates are not
  8842. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8843. @end example
  8844. @subsection erode
  8845. Erode an image by using a specific structuring element.
  8846. It corresponds to the libopencv function @code{cvErode}.
  8847. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8848. with the same syntax and semantics as the @ref{dilate} filter.
  8849. @subsection smooth
  8850. Smooth the input video.
  8851. The filter takes the following parameters:
  8852. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8853. @var{type} is the type of smooth filter to apply, and must be one of
  8854. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8855. or "bilateral". The default value is "gaussian".
  8856. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8857. depend on the smooth type. @var{param1} and
  8858. @var{param2} accept integer positive values or 0. @var{param3} and
  8859. @var{param4} accept floating point values.
  8860. The default value for @var{param1} is 3. The default value for the
  8861. other parameters is 0.
  8862. These parameters correspond to the parameters assigned to the
  8863. libopencv function @code{cvSmooth}.
  8864. @section oscilloscope
  8865. 2D Video Oscilloscope.
  8866. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8867. It accepts the following parameters:
  8868. @table @option
  8869. @item x
  8870. Set scope center x position.
  8871. @item y
  8872. Set scope center y position.
  8873. @item s
  8874. Set scope size, relative to frame diagonal.
  8875. @item t
  8876. Set scope tilt/rotation.
  8877. @item o
  8878. Set trace opacity.
  8879. @item tx
  8880. Set trace center x position.
  8881. @item ty
  8882. Set trace center y position.
  8883. @item tw
  8884. Set trace width, relative to width of frame.
  8885. @item th
  8886. Set trace height, relative to height of frame.
  8887. @item c
  8888. Set which components to trace. By default it traces first three components.
  8889. @item g
  8890. Draw trace grid. By default is enabled.
  8891. @item st
  8892. Draw some statistics. By default is enabled.
  8893. @item sc
  8894. Draw scope. By default is enabled.
  8895. @end table
  8896. @subsection Examples
  8897. @itemize
  8898. @item
  8899. Inspect full first row of video frame.
  8900. @example
  8901. oscilloscope=x=0.5:y=0:s=1
  8902. @end example
  8903. @item
  8904. Inspect full last row of video frame.
  8905. @example
  8906. oscilloscope=x=0.5:y=1:s=1
  8907. @end example
  8908. @item
  8909. Inspect full 5th line of video frame of height 1080.
  8910. @example
  8911. oscilloscope=x=0.5:y=5/1080:s=1
  8912. @end example
  8913. @item
  8914. Inspect full last column of video frame.
  8915. @example
  8916. oscilloscope=x=1:y=0.5:s=1:t=1
  8917. @end example
  8918. @end itemize
  8919. @anchor{overlay}
  8920. @section overlay
  8921. Overlay one video on top of another.
  8922. It takes two inputs and has one output. The first input is the "main"
  8923. video on which the second input is overlaid.
  8924. It accepts the following parameters:
  8925. A description of the accepted options follows.
  8926. @table @option
  8927. @item x
  8928. @item y
  8929. Set the expression for the x and y coordinates of the overlaid video
  8930. on the main video. Default value is "0" for both expressions. In case
  8931. the expression is invalid, it is set to a huge value (meaning that the
  8932. overlay will not be displayed within the output visible area).
  8933. @item eof_action
  8934. See @ref{framesync}.
  8935. @item eval
  8936. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8937. It accepts the following values:
  8938. @table @samp
  8939. @item init
  8940. only evaluate expressions once during the filter initialization or
  8941. when a command is processed
  8942. @item frame
  8943. evaluate expressions for each incoming frame
  8944. @end table
  8945. Default value is @samp{frame}.
  8946. @item shortest
  8947. See @ref{framesync}.
  8948. @item format
  8949. Set the format for the output video.
  8950. It accepts the following values:
  8951. @table @samp
  8952. @item yuv420
  8953. force YUV420 output
  8954. @item yuv422
  8955. force YUV422 output
  8956. @item yuv444
  8957. force YUV444 output
  8958. @item rgb
  8959. force packed RGB output
  8960. @item gbrp
  8961. force planar RGB output
  8962. @item auto
  8963. automatically pick format
  8964. @end table
  8965. Default value is @samp{yuv420}.
  8966. @item repeatlast
  8967. See @ref{framesync}.
  8968. @item alpha
  8969. Set format of alpha of the overlaid video, it can be @var{straight} or
  8970. @var{premultiplied}. Default is @var{straight}.
  8971. @end table
  8972. The @option{x}, and @option{y} expressions can contain the following
  8973. parameters.
  8974. @table @option
  8975. @item main_w, W
  8976. @item main_h, H
  8977. The main input width and height.
  8978. @item overlay_w, w
  8979. @item overlay_h, h
  8980. The overlay input width and height.
  8981. @item x
  8982. @item y
  8983. The computed values for @var{x} and @var{y}. They are evaluated for
  8984. each new frame.
  8985. @item hsub
  8986. @item vsub
  8987. horizontal and vertical chroma subsample values of the output
  8988. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8989. @var{vsub} is 1.
  8990. @item n
  8991. the number of input frame, starting from 0
  8992. @item pos
  8993. the position in the file of the input frame, NAN if unknown
  8994. @item t
  8995. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8996. @end table
  8997. This filter also supports the @ref{framesync} options.
  8998. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8999. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9000. when @option{eval} is set to @samp{init}.
  9001. Be aware that frames are taken from each input video in timestamp
  9002. order, hence, if their initial timestamps differ, it is a good idea
  9003. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9004. have them begin in the same zero timestamp, as the example for
  9005. the @var{movie} filter does.
  9006. You can chain together more overlays but you should test the
  9007. efficiency of such approach.
  9008. @subsection Commands
  9009. This filter supports the following commands:
  9010. @table @option
  9011. @item x
  9012. @item y
  9013. Modify the x and y of the overlay input.
  9014. The command accepts the same syntax of the corresponding option.
  9015. If the specified expression is not valid, it is kept at its current
  9016. value.
  9017. @end table
  9018. @subsection Examples
  9019. @itemize
  9020. @item
  9021. Draw the overlay at 10 pixels from the bottom right corner of the main
  9022. video:
  9023. @example
  9024. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9025. @end example
  9026. Using named options the example above becomes:
  9027. @example
  9028. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9029. @end example
  9030. @item
  9031. Insert a transparent PNG logo in the bottom left corner of the input,
  9032. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9033. @example
  9034. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9035. @end example
  9036. @item
  9037. Insert 2 different transparent PNG logos (second logo on bottom
  9038. right corner) using the @command{ffmpeg} tool:
  9039. @example
  9040. 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
  9041. @end example
  9042. @item
  9043. Add a transparent color layer on top of the main video; @code{WxH}
  9044. must specify the size of the main input to the overlay filter:
  9045. @example
  9046. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9047. @end example
  9048. @item
  9049. Play an original video and a filtered version (here with the deshake
  9050. filter) side by side using the @command{ffplay} tool:
  9051. @example
  9052. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9053. @end example
  9054. The above command is the same as:
  9055. @example
  9056. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9057. @end example
  9058. @item
  9059. Make a sliding overlay appearing from the left to the right top part of the
  9060. screen starting since time 2:
  9061. @example
  9062. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9063. @end example
  9064. @item
  9065. Compose output by putting two input videos side to side:
  9066. @example
  9067. ffmpeg -i left.avi -i right.avi -filter_complex "
  9068. nullsrc=size=200x100 [background];
  9069. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9070. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9071. [background][left] overlay=shortest=1 [background+left];
  9072. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9073. "
  9074. @end example
  9075. @item
  9076. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9077. @example
  9078. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9079. -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]'
  9080. masked.avi
  9081. @end example
  9082. @item
  9083. Chain several overlays in cascade:
  9084. @example
  9085. nullsrc=s=200x200 [bg];
  9086. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9087. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9088. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9089. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9090. [in3] null, [mid2] overlay=100:100 [out0]
  9091. @end example
  9092. @end itemize
  9093. @section owdenoise
  9094. Apply Overcomplete Wavelet denoiser.
  9095. The filter accepts the following options:
  9096. @table @option
  9097. @item depth
  9098. Set depth.
  9099. Larger depth values will denoise lower frequency components more, but
  9100. slow down filtering.
  9101. Must be an int in the range 8-16, default is @code{8}.
  9102. @item luma_strength, ls
  9103. Set luma strength.
  9104. Must be a double value in the range 0-1000, default is @code{1.0}.
  9105. @item chroma_strength, cs
  9106. Set chroma strength.
  9107. Must be a double value in the range 0-1000, default is @code{1.0}.
  9108. @end table
  9109. @anchor{pad}
  9110. @section pad
  9111. Add paddings to the input image, and place the original input at the
  9112. provided @var{x}, @var{y} coordinates.
  9113. It accepts the following parameters:
  9114. @table @option
  9115. @item width, w
  9116. @item height, h
  9117. Specify an expression for the size of the output image with the
  9118. paddings added. If the value for @var{width} or @var{height} is 0, the
  9119. corresponding input size is used for the output.
  9120. The @var{width} expression can reference the value set by the
  9121. @var{height} expression, and vice versa.
  9122. The default value of @var{width} and @var{height} is 0.
  9123. @item x
  9124. @item y
  9125. Specify the offsets to place the input image at within the padded area,
  9126. with respect to the top/left border of the output image.
  9127. The @var{x} expression can reference the value set by the @var{y}
  9128. expression, and vice versa.
  9129. The default value of @var{x} and @var{y} is 0.
  9130. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9131. so the input image is centered on the padded area.
  9132. @item color
  9133. Specify the color of the padded area. For the syntax of this option,
  9134. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9135. manual,ffmpeg-utils}.
  9136. The default value of @var{color} is "black".
  9137. @item eval
  9138. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9139. It accepts the following values:
  9140. @table @samp
  9141. @item init
  9142. Only evaluate expressions once during the filter initialization or when
  9143. a command is processed.
  9144. @item frame
  9145. Evaluate expressions for each incoming frame.
  9146. @end table
  9147. Default value is @samp{init}.
  9148. @item aspect
  9149. Pad to aspect instead to a resolution.
  9150. @end table
  9151. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9152. options are expressions containing the following constants:
  9153. @table @option
  9154. @item in_w
  9155. @item in_h
  9156. The input video width and height.
  9157. @item iw
  9158. @item ih
  9159. These are the same as @var{in_w} and @var{in_h}.
  9160. @item out_w
  9161. @item out_h
  9162. The output width and height (the size of the padded area), as
  9163. specified by the @var{width} and @var{height} expressions.
  9164. @item ow
  9165. @item oh
  9166. These are the same as @var{out_w} and @var{out_h}.
  9167. @item x
  9168. @item y
  9169. The x and y offsets as specified by the @var{x} and @var{y}
  9170. expressions, or NAN if not yet specified.
  9171. @item a
  9172. same as @var{iw} / @var{ih}
  9173. @item sar
  9174. input sample aspect ratio
  9175. @item dar
  9176. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9177. @item hsub
  9178. @item vsub
  9179. The horizontal and vertical chroma subsample values. For example for the
  9180. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9181. @end table
  9182. @subsection Examples
  9183. @itemize
  9184. @item
  9185. Add paddings with the color "violet" to the input video. The output video
  9186. size is 640x480, and the top-left corner of the input video is placed at
  9187. column 0, row 40
  9188. @example
  9189. pad=640:480:0:40:violet
  9190. @end example
  9191. The example above is equivalent to the following command:
  9192. @example
  9193. pad=width=640:height=480:x=0:y=40:color=violet
  9194. @end example
  9195. @item
  9196. Pad the input to get an output with dimensions increased by 3/2,
  9197. and put the input video at the center of the padded area:
  9198. @example
  9199. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9200. @end example
  9201. @item
  9202. Pad the input to get a squared output with size equal to the maximum
  9203. value between the input width and height, and put the input video at
  9204. the center of the padded area:
  9205. @example
  9206. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9207. @end example
  9208. @item
  9209. Pad the input to get a final w/h ratio of 16:9:
  9210. @example
  9211. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9212. @end example
  9213. @item
  9214. In case of anamorphic video, in order to set the output display aspect
  9215. correctly, it is necessary to use @var{sar} in the expression,
  9216. according to the relation:
  9217. @example
  9218. (ih * X / ih) * sar = output_dar
  9219. X = output_dar / sar
  9220. @end example
  9221. Thus the previous example needs to be modified to:
  9222. @example
  9223. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9224. @end example
  9225. @item
  9226. Double the output size and put the input video in the bottom-right
  9227. corner of the output padded area:
  9228. @example
  9229. pad="2*iw:2*ih:ow-iw:oh-ih"
  9230. @end example
  9231. @end itemize
  9232. @anchor{palettegen}
  9233. @section palettegen
  9234. Generate one palette for a whole video stream.
  9235. It accepts the following options:
  9236. @table @option
  9237. @item max_colors
  9238. Set the maximum number of colors to quantize in the palette.
  9239. Note: the palette will still contain 256 colors; the unused palette entries
  9240. will be black.
  9241. @item reserve_transparent
  9242. Create a palette of 255 colors maximum and reserve the last one for
  9243. transparency. Reserving the transparency color is useful for GIF optimization.
  9244. If not set, the maximum of colors in the palette will be 256. You probably want
  9245. to disable this option for a standalone image.
  9246. Set by default.
  9247. @item transparency_color
  9248. Set the color that will be used as background for transparency.
  9249. @item stats_mode
  9250. Set statistics mode.
  9251. It accepts the following values:
  9252. @table @samp
  9253. @item full
  9254. Compute full frame histograms.
  9255. @item diff
  9256. Compute histograms only for the part that differs from previous frame. This
  9257. might be relevant to give more importance to the moving part of your input if
  9258. the background is static.
  9259. @item single
  9260. Compute new histogram for each frame.
  9261. @end table
  9262. Default value is @var{full}.
  9263. @end table
  9264. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9265. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9266. color quantization of the palette. This information is also visible at
  9267. @var{info} logging level.
  9268. @subsection Examples
  9269. @itemize
  9270. @item
  9271. Generate a representative palette of a given video using @command{ffmpeg}:
  9272. @example
  9273. ffmpeg -i input.mkv -vf palettegen palette.png
  9274. @end example
  9275. @end itemize
  9276. @section paletteuse
  9277. Use a palette to downsample an input video stream.
  9278. The filter takes two inputs: one video stream and a palette. The palette must
  9279. be a 256 pixels image.
  9280. It accepts the following options:
  9281. @table @option
  9282. @item dither
  9283. Select dithering mode. Available algorithms are:
  9284. @table @samp
  9285. @item bayer
  9286. Ordered 8x8 bayer dithering (deterministic)
  9287. @item heckbert
  9288. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9289. Note: this dithering is sometimes considered "wrong" and is included as a
  9290. reference.
  9291. @item floyd_steinberg
  9292. Floyd and Steingberg dithering (error diffusion)
  9293. @item sierra2
  9294. Frankie Sierra dithering v2 (error diffusion)
  9295. @item sierra2_4a
  9296. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9297. @end table
  9298. Default is @var{sierra2_4a}.
  9299. @item bayer_scale
  9300. When @var{bayer} dithering is selected, this option defines the scale of the
  9301. pattern (how much the crosshatch pattern is visible). A low value means more
  9302. visible pattern for less banding, and higher value means less visible pattern
  9303. at the cost of more banding.
  9304. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9305. @item diff_mode
  9306. If set, define the zone to process
  9307. @table @samp
  9308. @item rectangle
  9309. Only the changing rectangle will be reprocessed. This is similar to GIF
  9310. cropping/offsetting compression mechanism. This option can be useful for speed
  9311. if only a part of the image is changing, and has use cases such as limiting the
  9312. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9313. moving scene (it leads to more deterministic output if the scene doesn't change
  9314. much, and as a result less moving noise and better GIF compression).
  9315. @end table
  9316. Default is @var{none}.
  9317. @item new
  9318. Take new palette for each output frame.
  9319. @item alpha_threshold
  9320. Sets the alpha threshold for transparency. Alpha values above this threshold
  9321. will be treated as completely opaque, and values below this threshold will be
  9322. treated as completely transparent.
  9323. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9324. @end table
  9325. @subsection Examples
  9326. @itemize
  9327. @item
  9328. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9329. using @command{ffmpeg}:
  9330. @example
  9331. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9332. @end example
  9333. @end itemize
  9334. @section perspective
  9335. Correct perspective of video not recorded perpendicular to the screen.
  9336. A description of the accepted parameters follows.
  9337. @table @option
  9338. @item x0
  9339. @item y0
  9340. @item x1
  9341. @item y1
  9342. @item x2
  9343. @item y2
  9344. @item x3
  9345. @item y3
  9346. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9347. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9348. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9349. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9350. then the corners of the source will be sent to the specified coordinates.
  9351. The expressions can use the following variables:
  9352. @table @option
  9353. @item W
  9354. @item H
  9355. the width and height of video frame.
  9356. @item in
  9357. Input frame count.
  9358. @item on
  9359. Output frame count.
  9360. @end table
  9361. @item interpolation
  9362. Set interpolation for perspective correction.
  9363. It accepts the following values:
  9364. @table @samp
  9365. @item linear
  9366. @item cubic
  9367. @end table
  9368. Default value is @samp{linear}.
  9369. @item sense
  9370. Set interpretation of coordinate options.
  9371. It accepts the following values:
  9372. @table @samp
  9373. @item 0, source
  9374. Send point in the source specified by the given coordinates to
  9375. the corners of the destination.
  9376. @item 1, destination
  9377. Send the corners of the source to the point in the destination specified
  9378. by the given coordinates.
  9379. Default value is @samp{source}.
  9380. @end table
  9381. @item eval
  9382. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9383. It accepts the following values:
  9384. @table @samp
  9385. @item init
  9386. only evaluate expressions once during the filter initialization or
  9387. when a command is processed
  9388. @item frame
  9389. evaluate expressions for each incoming frame
  9390. @end table
  9391. Default value is @samp{init}.
  9392. @end table
  9393. @section phase
  9394. Delay interlaced video by one field time so that the field order changes.
  9395. The intended use is to fix PAL movies that have been captured with the
  9396. opposite field order to the film-to-video transfer.
  9397. A description of the accepted parameters follows.
  9398. @table @option
  9399. @item mode
  9400. Set phase mode.
  9401. It accepts the following values:
  9402. @table @samp
  9403. @item t
  9404. Capture field order top-first, transfer bottom-first.
  9405. Filter will delay the bottom field.
  9406. @item b
  9407. Capture field order bottom-first, transfer top-first.
  9408. Filter will delay the top field.
  9409. @item p
  9410. Capture and transfer with the same field order. This mode only exists
  9411. for the documentation of the other options to refer to, but if you
  9412. actually select it, the filter will faithfully do nothing.
  9413. @item a
  9414. Capture field order determined automatically by field flags, transfer
  9415. opposite.
  9416. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9417. basis using field flags. If no field information is available,
  9418. then this works just like @samp{u}.
  9419. @item u
  9420. Capture unknown or varying, transfer opposite.
  9421. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9422. analyzing the images and selecting the alternative that produces best
  9423. match between the fields.
  9424. @item T
  9425. Capture top-first, transfer unknown or varying.
  9426. Filter selects among @samp{t} and @samp{p} using image analysis.
  9427. @item B
  9428. Capture bottom-first, transfer unknown or varying.
  9429. Filter selects among @samp{b} and @samp{p} using image analysis.
  9430. @item A
  9431. Capture determined by field flags, transfer unknown or varying.
  9432. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9433. image analysis. If no field information is available, then this works just
  9434. like @samp{U}. This is the default mode.
  9435. @item U
  9436. Both capture and transfer unknown or varying.
  9437. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9438. @end table
  9439. @end table
  9440. @section pixdesctest
  9441. Pixel format descriptor test filter, mainly useful for internal
  9442. testing. The output video should be equal to the input video.
  9443. For example:
  9444. @example
  9445. format=monow, pixdesctest
  9446. @end example
  9447. can be used to test the monowhite pixel format descriptor definition.
  9448. @section pixscope
  9449. Display sample values of color channels. Mainly useful for checking color
  9450. and levels. Minimum supported resolution is 640x480.
  9451. The filters accept the following options:
  9452. @table @option
  9453. @item x
  9454. Set scope X position, relative offset on X axis.
  9455. @item y
  9456. Set scope Y position, relative offset on Y axis.
  9457. @item w
  9458. Set scope width.
  9459. @item h
  9460. Set scope height.
  9461. @item o
  9462. Set window opacity. This window also holds statistics about pixel area.
  9463. @item wx
  9464. Set window X position, relative offset on X axis.
  9465. @item wy
  9466. Set window Y position, relative offset on Y axis.
  9467. @end table
  9468. @section pp
  9469. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9470. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9471. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9472. Each subfilter and some options have a short and a long name that can be used
  9473. interchangeably, i.e. dr/dering are the same.
  9474. The filters accept the following options:
  9475. @table @option
  9476. @item subfilters
  9477. Set postprocessing subfilters string.
  9478. @end table
  9479. All subfilters share common options to determine their scope:
  9480. @table @option
  9481. @item a/autoq
  9482. Honor the quality commands for this subfilter.
  9483. @item c/chrom
  9484. Do chrominance filtering, too (default).
  9485. @item y/nochrom
  9486. Do luminance filtering only (no chrominance).
  9487. @item n/noluma
  9488. Do chrominance filtering only (no luminance).
  9489. @end table
  9490. These options can be appended after the subfilter name, separated by a '|'.
  9491. Available subfilters are:
  9492. @table @option
  9493. @item hb/hdeblock[|difference[|flatness]]
  9494. Horizontal deblocking filter
  9495. @table @option
  9496. @item difference
  9497. Difference factor where higher values mean more deblocking (default: @code{32}).
  9498. @item flatness
  9499. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9500. @end table
  9501. @item vb/vdeblock[|difference[|flatness]]
  9502. Vertical deblocking filter
  9503. @table @option
  9504. @item difference
  9505. Difference factor where higher values mean more deblocking (default: @code{32}).
  9506. @item flatness
  9507. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9508. @end table
  9509. @item ha/hadeblock[|difference[|flatness]]
  9510. Accurate horizontal deblocking filter
  9511. @table @option
  9512. @item difference
  9513. Difference factor where higher values mean more deblocking (default: @code{32}).
  9514. @item flatness
  9515. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9516. @end table
  9517. @item va/vadeblock[|difference[|flatness]]
  9518. Accurate vertical deblocking filter
  9519. @table @option
  9520. @item difference
  9521. Difference factor where higher values mean more deblocking (default: @code{32}).
  9522. @item flatness
  9523. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9524. @end table
  9525. @end table
  9526. The horizontal and vertical deblocking filters share the difference and
  9527. flatness values so you cannot set different horizontal and vertical
  9528. thresholds.
  9529. @table @option
  9530. @item h1/x1hdeblock
  9531. Experimental horizontal deblocking filter
  9532. @item v1/x1vdeblock
  9533. Experimental vertical deblocking filter
  9534. @item dr/dering
  9535. Deringing filter
  9536. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9537. @table @option
  9538. @item threshold1
  9539. larger -> stronger filtering
  9540. @item threshold2
  9541. larger -> stronger filtering
  9542. @item threshold3
  9543. larger -> stronger filtering
  9544. @end table
  9545. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9546. @table @option
  9547. @item f/fullyrange
  9548. Stretch luminance to @code{0-255}.
  9549. @end table
  9550. @item lb/linblenddeint
  9551. Linear blend deinterlacing filter that deinterlaces the given block by
  9552. filtering all lines with a @code{(1 2 1)} filter.
  9553. @item li/linipoldeint
  9554. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9555. linearly interpolating every second line.
  9556. @item ci/cubicipoldeint
  9557. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9558. cubically interpolating every second line.
  9559. @item md/mediandeint
  9560. Median deinterlacing filter that deinterlaces the given block by applying a
  9561. median filter to every second line.
  9562. @item fd/ffmpegdeint
  9563. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9564. second line with a @code{(-1 4 2 4 -1)} filter.
  9565. @item l5/lowpass5
  9566. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9567. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9568. @item fq/forceQuant[|quantizer]
  9569. Overrides the quantizer table from the input with the constant quantizer you
  9570. specify.
  9571. @table @option
  9572. @item quantizer
  9573. Quantizer to use
  9574. @end table
  9575. @item de/default
  9576. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9577. @item fa/fast
  9578. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9579. @item ac
  9580. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9581. @end table
  9582. @subsection Examples
  9583. @itemize
  9584. @item
  9585. Apply horizontal and vertical deblocking, deringing and automatic
  9586. brightness/contrast:
  9587. @example
  9588. pp=hb/vb/dr/al
  9589. @end example
  9590. @item
  9591. Apply default filters without brightness/contrast correction:
  9592. @example
  9593. pp=de/-al
  9594. @end example
  9595. @item
  9596. Apply default filters and temporal denoiser:
  9597. @example
  9598. pp=default/tmpnoise|1|2|3
  9599. @end example
  9600. @item
  9601. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9602. automatically depending on available CPU time:
  9603. @example
  9604. pp=hb|y/vb|a
  9605. @end example
  9606. @end itemize
  9607. @section pp7
  9608. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9609. similar to spp = 6 with 7 point DCT, where only the center sample is
  9610. used after IDCT.
  9611. The filter accepts the following options:
  9612. @table @option
  9613. @item qp
  9614. Force a constant quantization parameter. It accepts an integer in range
  9615. 0 to 63. If not set, the filter will use the QP from the video stream
  9616. (if available).
  9617. @item mode
  9618. Set thresholding mode. Available modes are:
  9619. @table @samp
  9620. @item hard
  9621. Set hard thresholding.
  9622. @item soft
  9623. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9624. @item medium
  9625. Set medium thresholding (good results, default).
  9626. @end table
  9627. @end table
  9628. @section premultiply
  9629. Apply alpha premultiply effect to input video stream using first plane
  9630. of second stream as alpha.
  9631. Both streams must have same dimensions and same pixel format.
  9632. The filter accepts the following option:
  9633. @table @option
  9634. @item planes
  9635. Set which planes will be processed, unprocessed planes will be copied.
  9636. By default value 0xf, all planes will be processed.
  9637. @item inplace
  9638. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9639. @end table
  9640. @section prewitt
  9641. Apply prewitt operator to input video stream.
  9642. The filter accepts the following option:
  9643. @table @option
  9644. @item planes
  9645. Set which planes will be processed, unprocessed planes will be copied.
  9646. By default value 0xf, all planes will be processed.
  9647. @item scale
  9648. Set value which will be multiplied with filtered result.
  9649. @item delta
  9650. Set value which will be added to filtered result.
  9651. @end table
  9652. @anchor{program_opencl}
  9653. @section program_opencl
  9654. Filter video using an OpenCL program.
  9655. @table @option
  9656. @item source
  9657. OpenCL program source file.
  9658. @item kernel
  9659. Kernel name in program.
  9660. @item inputs
  9661. Number of inputs to the filter. Defaults to 1.
  9662. @item size, s
  9663. Size of output frames. Defaults to the same as the first input.
  9664. @end table
  9665. The program source file must contain a kernel function with the given name,
  9666. which will be run once for each plane of the output. Each run on a plane
  9667. gets enqueued as a separate 2D global NDRange with one work-item for each
  9668. pixel to be generated. The global ID offset for each work-item is therefore
  9669. the coordinates of a pixel in the destination image.
  9670. The kernel function needs to take the following arguments:
  9671. @itemize
  9672. @item
  9673. Destination image, @var{__write_only image2d_t}.
  9674. This image will become the output; the kernel should write all of it.
  9675. @item
  9676. Frame index, @var{unsigned int}.
  9677. This is a counter starting from zero and increasing by one for each frame.
  9678. @item
  9679. Source images, @var{__read_only image2d_t}.
  9680. These are the most recent images on each input. The kernel may read from
  9681. them to generate the output, but they can't be written to.
  9682. @end itemize
  9683. Example programs:
  9684. @itemize
  9685. @item
  9686. Copy the input to the output (output must be the same size as the input).
  9687. @verbatim
  9688. __kernel void copy(__write_only image2d_t destination,
  9689. unsigned int index,
  9690. __read_only image2d_t source)
  9691. {
  9692. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  9693. int2 location = (int2)(get_global_id(0), get_global_id(1));
  9694. float4 value = read_imagef(source, sampler, location);
  9695. write_imagef(destination, location, value);
  9696. }
  9697. @end verbatim
  9698. @item
  9699. Apply a simple transformation, rotating the input by an amount increasing
  9700. with the index counter. Pixel values are linearly interpolated by the
  9701. sampler, and the output need not have the same dimensions as the input.
  9702. @verbatim
  9703. __kernel void rotate_image(__write_only image2d_t dst,
  9704. unsigned int index,
  9705. __read_only image2d_t src)
  9706. {
  9707. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9708. CLK_FILTER_LINEAR);
  9709. float angle = (float)index / 100.0f;
  9710. float2 dst_dim = convert_float2(get_image_dim(dst));
  9711. float2 src_dim = convert_float2(get_image_dim(src));
  9712. float2 dst_cen = dst_dim / 2.0f;
  9713. float2 src_cen = src_dim / 2.0f;
  9714. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9715. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  9716. float2 src_pos = {
  9717. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  9718. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  9719. };
  9720. src_pos = src_pos * src_dim / dst_dim;
  9721. float2 src_loc = src_pos + src_cen;
  9722. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  9723. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  9724. write_imagef(dst, dst_loc, 0.5f);
  9725. else
  9726. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  9727. }
  9728. @end verbatim
  9729. @item
  9730. Blend two inputs together, with the amount of each input used varying
  9731. with the index counter.
  9732. @verbatim
  9733. __kernel void blend_images(__write_only image2d_t dst,
  9734. unsigned int index,
  9735. __read_only image2d_t src1,
  9736. __read_only image2d_t src2)
  9737. {
  9738. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9739. CLK_FILTER_LINEAR);
  9740. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  9741. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9742. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  9743. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  9744. float4 val1 = read_imagef(src1, sampler, src1_loc);
  9745. float4 val2 = read_imagef(src2, sampler, src2_loc);
  9746. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  9747. }
  9748. @end verbatim
  9749. @end itemize
  9750. @section pseudocolor
  9751. Alter frame colors in video with pseudocolors.
  9752. This filter accept the following options:
  9753. @table @option
  9754. @item c0
  9755. set pixel first component expression
  9756. @item c1
  9757. set pixel second component expression
  9758. @item c2
  9759. set pixel third component expression
  9760. @item c3
  9761. set pixel fourth component expression, corresponds to the alpha component
  9762. @item i
  9763. set component to use as base for altering colors
  9764. @end table
  9765. Each of them specifies the expression to use for computing the lookup table for
  9766. the corresponding pixel component values.
  9767. The expressions can contain the following constants and functions:
  9768. @table @option
  9769. @item w
  9770. @item h
  9771. The input width and height.
  9772. @item val
  9773. The input value for the pixel component.
  9774. @item ymin, umin, vmin, amin
  9775. The minimum allowed component value.
  9776. @item ymax, umax, vmax, amax
  9777. The maximum allowed component value.
  9778. @end table
  9779. All expressions default to "val".
  9780. @subsection Examples
  9781. @itemize
  9782. @item
  9783. Change too high luma values to gradient:
  9784. @example
  9785. 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'"
  9786. @end example
  9787. @end itemize
  9788. @section psnr
  9789. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9790. Ratio) between two input videos.
  9791. This filter takes in input two input videos, the first input is
  9792. considered the "main" source and is passed unchanged to the
  9793. output. The second input is used as a "reference" video for computing
  9794. the PSNR.
  9795. Both video inputs must have the same resolution and pixel format for
  9796. this filter to work correctly. Also it assumes that both inputs
  9797. have the same number of frames, which are compared one by one.
  9798. The obtained average PSNR is printed through the logging system.
  9799. The filter stores the accumulated MSE (mean squared error) of each
  9800. frame, and at the end of the processing it is averaged across all frames
  9801. equally, and the following formula is applied to obtain the PSNR:
  9802. @example
  9803. PSNR = 10*log10(MAX^2/MSE)
  9804. @end example
  9805. Where MAX is the average of the maximum values of each component of the
  9806. image.
  9807. The description of the accepted parameters follows.
  9808. @table @option
  9809. @item stats_file, f
  9810. If specified the filter will use the named file to save the PSNR of
  9811. each individual frame. When filename equals "-" the data is sent to
  9812. standard output.
  9813. @item stats_version
  9814. Specifies which version of the stats file format to use. Details of
  9815. each format are written below.
  9816. Default value is 1.
  9817. @item stats_add_max
  9818. Determines whether the max value is output to the stats log.
  9819. Default value is 0.
  9820. Requires stats_version >= 2. If this is set and stats_version < 2,
  9821. the filter will return an error.
  9822. @end table
  9823. This filter also supports the @ref{framesync} options.
  9824. The file printed if @var{stats_file} is selected, contains a sequence of
  9825. key/value pairs of the form @var{key}:@var{value} for each compared
  9826. couple of frames.
  9827. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9828. the list of per-frame-pair stats, with key value pairs following the frame
  9829. format with the following parameters:
  9830. @table @option
  9831. @item psnr_log_version
  9832. The version of the log file format. Will match @var{stats_version}.
  9833. @item fields
  9834. A comma separated list of the per-frame-pair parameters included in
  9835. the log.
  9836. @end table
  9837. A description of each shown per-frame-pair parameter follows:
  9838. @table @option
  9839. @item n
  9840. sequential number of the input frame, starting from 1
  9841. @item mse_avg
  9842. Mean Square Error pixel-by-pixel average difference of the compared
  9843. frames, averaged over all the image components.
  9844. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  9845. Mean Square Error pixel-by-pixel average difference of the compared
  9846. frames for the component specified by the suffix.
  9847. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9848. Peak Signal to Noise ratio of the compared frames for the component
  9849. specified by the suffix.
  9850. @item max_avg, max_y, max_u, max_v
  9851. Maximum allowed value for each channel, and average over all
  9852. channels.
  9853. @end table
  9854. For example:
  9855. @example
  9856. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9857. [main][ref] psnr="stats_file=stats.log" [out]
  9858. @end example
  9859. On this example the input file being processed is compared with the
  9860. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9861. is stored in @file{stats.log}.
  9862. @anchor{pullup}
  9863. @section pullup
  9864. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9865. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9866. content.
  9867. The pullup filter is designed to take advantage of future context in making
  9868. its decisions. This filter is stateless in the sense that it does not lock
  9869. onto a pattern to follow, but it instead looks forward to the following
  9870. fields in order to identify matches and rebuild progressive frames.
  9871. To produce content with an even framerate, insert the fps filter after
  9872. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9873. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9874. The filter accepts the following options:
  9875. @table @option
  9876. @item jl
  9877. @item jr
  9878. @item jt
  9879. @item jb
  9880. These options set the amount of "junk" to ignore at the left, right, top, and
  9881. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9882. while top and bottom are in units of 2 lines.
  9883. The default is 8 pixels on each side.
  9884. @item sb
  9885. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9886. filter generating an occasional mismatched frame, but it may also cause an
  9887. excessive number of frames to be dropped during high motion sequences.
  9888. Conversely, setting it to -1 will make filter match fields more easily.
  9889. This may help processing of video where there is slight blurring between
  9890. the fields, but may also cause there to be interlaced frames in the output.
  9891. Default value is @code{0}.
  9892. @item mp
  9893. Set the metric plane to use. It accepts the following values:
  9894. @table @samp
  9895. @item l
  9896. Use luma plane.
  9897. @item u
  9898. Use chroma blue plane.
  9899. @item v
  9900. Use chroma red plane.
  9901. @end table
  9902. This option may be set to use chroma plane instead of the default luma plane
  9903. for doing filter's computations. This may improve accuracy on very clean
  9904. source material, but more likely will decrease accuracy, especially if there
  9905. is chroma noise (rainbow effect) or any grayscale video.
  9906. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9907. load and make pullup usable in realtime on slow machines.
  9908. @end table
  9909. For best results (without duplicated frames in the output file) it is
  9910. necessary to change the output frame rate. For example, to inverse
  9911. telecine NTSC input:
  9912. @example
  9913. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9914. @end example
  9915. @section qp
  9916. Change video quantization parameters (QP).
  9917. The filter accepts the following option:
  9918. @table @option
  9919. @item qp
  9920. Set expression for quantization parameter.
  9921. @end table
  9922. The expression is evaluated through the eval API and can contain, among others,
  9923. the following constants:
  9924. @table @var
  9925. @item known
  9926. 1 if index is not 129, 0 otherwise.
  9927. @item qp
  9928. Sequential index starting from -129 to 128.
  9929. @end table
  9930. @subsection Examples
  9931. @itemize
  9932. @item
  9933. Some equation like:
  9934. @example
  9935. qp=2+2*sin(PI*qp)
  9936. @end example
  9937. @end itemize
  9938. @section random
  9939. Flush video frames from internal cache of frames into a random order.
  9940. No frame is discarded.
  9941. Inspired by @ref{frei0r} nervous filter.
  9942. @table @option
  9943. @item frames
  9944. Set size in number of frames of internal cache, in range from @code{2} to
  9945. @code{512}. Default is @code{30}.
  9946. @item seed
  9947. Set seed for random number generator, must be an integer included between
  9948. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9949. less than @code{0}, the filter will try to use a good random seed on a
  9950. best effort basis.
  9951. @end table
  9952. @section readeia608
  9953. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9954. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9955. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9956. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9957. @table @option
  9958. @item lavfi.readeia608.X.cc
  9959. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9960. @item lavfi.readeia608.X.line
  9961. The number of the line on which the EIA-608 data was identified and read.
  9962. @end table
  9963. This filter accepts the following options:
  9964. @table @option
  9965. @item scan_min
  9966. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9967. @item scan_max
  9968. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9969. @item mac
  9970. Set minimal acceptable amplitude change for sync codes detection.
  9971. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9972. @item spw
  9973. Set the ratio of width reserved for sync code detection.
  9974. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9975. @item mhd
  9976. Set the max peaks height difference for sync code detection.
  9977. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9978. @item mpd
  9979. Set max peaks period difference for sync code detection.
  9980. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9981. @item msd
  9982. Set the first two max start code bits differences.
  9983. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9984. @item bhd
  9985. Set the minimum ratio of bits height compared to 3rd start code bit.
  9986. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9987. @item th_w
  9988. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9989. @item th_b
  9990. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9991. @item chp
  9992. Enable checking the parity bit. In the event of a parity error, the filter will output
  9993. @code{0x00} for that character. Default is false.
  9994. @end table
  9995. @subsection Examples
  9996. @itemize
  9997. @item
  9998. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9999. @example
  10000. 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
  10001. @end example
  10002. @end itemize
  10003. @section readvitc
  10004. Read vertical interval timecode (VITC) information from the top lines of a
  10005. video frame.
  10006. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10007. timecode value, if a valid timecode has been detected. Further metadata key
  10008. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10009. timecode data has been found or not.
  10010. This filter accepts the following options:
  10011. @table @option
  10012. @item scan_max
  10013. Set the maximum number of lines to scan for VITC data. If the value is set to
  10014. @code{-1} the full video frame is scanned. Default is @code{45}.
  10015. @item thr_b
  10016. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10017. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10018. @item thr_w
  10019. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10020. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10021. @end table
  10022. @subsection Examples
  10023. @itemize
  10024. @item
  10025. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10026. draw @code{--:--:--:--} as a placeholder:
  10027. @example
  10028. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10029. @end example
  10030. @end itemize
  10031. @section remap
  10032. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10033. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10034. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10035. value for pixel will be used for destination pixel.
  10036. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10037. will have Xmap/Ymap video stream dimensions.
  10038. Xmap and Ymap input video streams are 16bit depth, single channel.
  10039. @section removegrain
  10040. The removegrain filter is a spatial denoiser for progressive video.
  10041. @table @option
  10042. @item m0
  10043. Set mode for the first plane.
  10044. @item m1
  10045. Set mode for the second plane.
  10046. @item m2
  10047. Set mode for the third plane.
  10048. @item m3
  10049. Set mode for the fourth plane.
  10050. @end table
  10051. Range of mode is from 0 to 24. Description of each mode follows:
  10052. @table @var
  10053. @item 0
  10054. Leave input plane unchanged. Default.
  10055. @item 1
  10056. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10057. @item 2
  10058. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10059. @item 3
  10060. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10061. @item 4
  10062. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10063. This is equivalent to a median filter.
  10064. @item 5
  10065. Line-sensitive clipping giving the minimal change.
  10066. @item 6
  10067. Line-sensitive clipping, intermediate.
  10068. @item 7
  10069. Line-sensitive clipping, intermediate.
  10070. @item 8
  10071. Line-sensitive clipping, intermediate.
  10072. @item 9
  10073. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10074. @item 10
  10075. Replaces the target pixel with the closest neighbour.
  10076. @item 11
  10077. [1 2 1] horizontal and vertical kernel blur.
  10078. @item 12
  10079. Same as mode 11.
  10080. @item 13
  10081. Bob mode, interpolates top field from the line where the neighbours
  10082. pixels are the closest.
  10083. @item 14
  10084. Bob mode, interpolates bottom field from the line where the neighbours
  10085. pixels are the closest.
  10086. @item 15
  10087. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10088. interpolation formula.
  10089. @item 16
  10090. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10091. interpolation formula.
  10092. @item 17
  10093. Clips the pixel with the minimum and maximum of respectively the maximum and
  10094. minimum of each pair of opposite neighbour pixels.
  10095. @item 18
  10096. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10097. the current pixel is minimal.
  10098. @item 19
  10099. Replaces the pixel with the average of its 8 neighbours.
  10100. @item 20
  10101. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10102. @item 21
  10103. Clips pixels using the averages of opposite neighbour.
  10104. @item 22
  10105. Same as mode 21 but simpler and faster.
  10106. @item 23
  10107. Small edge and halo removal, but reputed useless.
  10108. @item 24
  10109. Similar as 23.
  10110. @end table
  10111. @section removelogo
  10112. Suppress a TV station logo, using an image file to determine which
  10113. pixels comprise the logo. It works by filling in the pixels that
  10114. comprise the logo with neighboring pixels.
  10115. The filter accepts the following options:
  10116. @table @option
  10117. @item filename, f
  10118. Set the filter bitmap file, which can be any image format supported by
  10119. libavformat. The width and height of the image file must match those of the
  10120. video stream being processed.
  10121. @end table
  10122. Pixels in the provided bitmap image with a value of zero are not
  10123. considered part of the logo, non-zero pixels are considered part of
  10124. the logo. If you use white (255) for the logo and black (0) for the
  10125. rest, you will be safe. For making the filter bitmap, it is
  10126. recommended to take a screen capture of a black frame with the logo
  10127. visible, and then using a threshold filter followed by the erode
  10128. filter once or twice.
  10129. If needed, little splotches can be fixed manually. Remember that if
  10130. logo pixels are not covered, the filter quality will be much
  10131. reduced. Marking too many pixels as part of the logo does not hurt as
  10132. much, but it will increase the amount of blurring needed to cover over
  10133. the image and will destroy more information than necessary, and extra
  10134. pixels will slow things down on a large logo.
  10135. @section repeatfields
  10136. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10137. fields based on its value.
  10138. @section reverse
  10139. Reverse a video clip.
  10140. Warning: This filter requires memory to buffer the entire clip, so trimming
  10141. is suggested.
  10142. @subsection Examples
  10143. @itemize
  10144. @item
  10145. Take the first 5 seconds of a clip, and reverse it.
  10146. @example
  10147. trim=end=5,reverse
  10148. @end example
  10149. @end itemize
  10150. @section roberts
  10151. Apply roberts cross operator to input video stream.
  10152. The filter accepts the following option:
  10153. @table @option
  10154. @item planes
  10155. Set which planes will be processed, unprocessed planes will be copied.
  10156. By default value 0xf, all planes will be processed.
  10157. @item scale
  10158. Set value which will be multiplied with filtered result.
  10159. @item delta
  10160. Set value which will be added to filtered result.
  10161. @end table
  10162. @section rotate
  10163. Rotate video by an arbitrary angle expressed in radians.
  10164. The filter accepts the following options:
  10165. A description of the optional parameters follows.
  10166. @table @option
  10167. @item angle, a
  10168. Set an expression for the angle by which to rotate the input video
  10169. clockwise, expressed as a number of radians. A negative value will
  10170. result in a counter-clockwise rotation. By default it is set to "0".
  10171. This expression is evaluated for each frame.
  10172. @item out_w, ow
  10173. Set the output width expression, default value is "iw".
  10174. This expression is evaluated just once during configuration.
  10175. @item out_h, oh
  10176. Set the output height expression, default value is "ih".
  10177. This expression is evaluated just once during configuration.
  10178. @item bilinear
  10179. Enable bilinear interpolation if set to 1, a value of 0 disables
  10180. it. Default value is 1.
  10181. @item fillcolor, c
  10182. Set the color used to fill the output area not covered by the rotated
  10183. image. For the general syntax of this option, check the
  10184. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10185. If the special value "none" is selected then no
  10186. background is printed (useful for example if the background is never shown).
  10187. Default value is "black".
  10188. @end table
  10189. The expressions for the angle and the output size can contain the
  10190. following constants and functions:
  10191. @table @option
  10192. @item n
  10193. sequential number of the input frame, starting from 0. It is always NAN
  10194. before the first frame is filtered.
  10195. @item t
  10196. time in seconds of the input frame, it is set to 0 when the filter is
  10197. configured. It is always NAN before the first frame is filtered.
  10198. @item hsub
  10199. @item vsub
  10200. horizontal and vertical chroma subsample values. For example for the
  10201. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10202. @item in_w, iw
  10203. @item in_h, ih
  10204. the input video width and height
  10205. @item out_w, ow
  10206. @item out_h, oh
  10207. the output width and height, that is the size of the padded area as
  10208. specified by the @var{width} and @var{height} expressions
  10209. @item rotw(a)
  10210. @item roth(a)
  10211. the minimal width/height required for completely containing the input
  10212. video rotated by @var{a} radians.
  10213. These are only available when computing the @option{out_w} and
  10214. @option{out_h} expressions.
  10215. @end table
  10216. @subsection Examples
  10217. @itemize
  10218. @item
  10219. Rotate the input by PI/6 radians clockwise:
  10220. @example
  10221. rotate=PI/6
  10222. @end example
  10223. @item
  10224. Rotate the input by PI/6 radians counter-clockwise:
  10225. @example
  10226. rotate=-PI/6
  10227. @end example
  10228. @item
  10229. Rotate the input by 45 degrees clockwise:
  10230. @example
  10231. rotate=45*PI/180
  10232. @end example
  10233. @item
  10234. Apply a constant rotation with period T, starting from an angle of PI/3:
  10235. @example
  10236. rotate=PI/3+2*PI*t/T
  10237. @end example
  10238. @item
  10239. Make the input video rotation oscillating with a period of T
  10240. seconds and an amplitude of A radians:
  10241. @example
  10242. rotate=A*sin(2*PI/T*t)
  10243. @end example
  10244. @item
  10245. Rotate the video, output size is chosen so that the whole rotating
  10246. input video is always completely contained in the output:
  10247. @example
  10248. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10249. @end example
  10250. @item
  10251. Rotate the video, reduce the output size so that no background is ever
  10252. shown:
  10253. @example
  10254. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10255. @end example
  10256. @end itemize
  10257. @subsection Commands
  10258. The filter supports the following commands:
  10259. @table @option
  10260. @item a, angle
  10261. Set the angle expression.
  10262. The command accepts the same syntax of the corresponding option.
  10263. If the specified expression is not valid, it is kept at its current
  10264. value.
  10265. @end table
  10266. @section sab
  10267. Apply Shape Adaptive Blur.
  10268. The filter accepts the following options:
  10269. @table @option
  10270. @item luma_radius, lr
  10271. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10272. value is 1.0. A greater value will result in a more blurred image, and
  10273. in slower processing.
  10274. @item luma_pre_filter_radius, lpfr
  10275. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10276. value is 1.0.
  10277. @item luma_strength, ls
  10278. Set luma maximum difference between pixels to still be considered, must
  10279. be a value in the 0.1-100.0 range, default value is 1.0.
  10280. @item chroma_radius, cr
  10281. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10282. greater value will result in a more blurred image, and in slower
  10283. processing.
  10284. @item chroma_pre_filter_radius, cpfr
  10285. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10286. @item chroma_strength, cs
  10287. Set chroma maximum difference between pixels to still be considered,
  10288. must be a value in the -0.9-100.0 range.
  10289. @end table
  10290. Each chroma option value, if not explicitly specified, is set to the
  10291. corresponding luma option value.
  10292. @anchor{scale}
  10293. @section scale
  10294. Scale (resize) the input video, using the libswscale library.
  10295. The scale filter forces the output display aspect ratio to be the same
  10296. of the input, by changing the output sample aspect ratio.
  10297. If the input image format is different from the format requested by
  10298. the next filter, the scale filter will convert the input to the
  10299. requested format.
  10300. @subsection Options
  10301. The filter accepts the following options, or any of the options
  10302. supported by the libswscale scaler.
  10303. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10304. the complete list of scaler options.
  10305. @table @option
  10306. @item width, w
  10307. @item height, h
  10308. Set the output video dimension expression. Default value is the input
  10309. dimension.
  10310. If the @var{width} or @var{w} value is 0, the input width is used for
  10311. the output. If the @var{height} or @var{h} value is 0, the input height
  10312. is used for the output.
  10313. If one and only one of the values is -n with n >= 1, the scale filter
  10314. will use a value that maintains the aspect ratio of the input image,
  10315. calculated from the other specified dimension. After that it will,
  10316. however, make sure that the calculated dimension is divisible by n and
  10317. adjust the value if necessary.
  10318. If both values are -n with n >= 1, the behavior will be identical to
  10319. both values being set to 0 as previously detailed.
  10320. See below for the list of accepted constants for use in the dimension
  10321. expression.
  10322. @item eval
  10323. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10324. @table @samp
  10325. @item init
  10326. Only evaluate expressions once during the filter initialization or when a command is processed.
  10327. @item frame
  10328. Evaluate expressions for each incoming frame.
  10329. @end table
  10330. Default value is @samp{init}.
  10331. @item interl
  10332. Set the interlacing mode. It accepts the following values:
  10333. @table @samp
  10334. @item 1
  10335. Force interlaced aware scaling.
  10336. @item 0
  10337. Do not apply interlaced scaling.
  10338. @item -1
  10339. Select interlaced aware scaling depending on whether the source frames
  10340. are flagged as interlaced or not.
  10341. @end table
  10342. Default value is @samp{0}.
  10343. @item flags
  10344. Set libswscale scaling flags. See
  10345. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10346. complete list of values. If not explicitly specified the filter applies
  10347. the default flags.
  10348. @item param0, param1
  10349. Set libswscale input parameters for scaling algorithms that need them. See
  10350. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10351. complete documentation. If not explicitly specified the filter applies
  10352. empty parameters.
  10353. @item size, s
  10354. Set the video size. For the syntax of this option, check the
  10355. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10356. @item in_color_matrix
  10357. @item out_color_matrix
  10358. Set in/output YCbCr color space type.
  10359. This allows the autodetected value to be overridden as well as allows forcing
  10360. a specific value used for the output and encoder.
  10361. If not specified, the color space type depends on the pixel format.
  10362. Possible values:
  10363. @table @samp
  10364. @item auto
  10365. Choose automatically.
  10366. @item bt709
  10367. Format conforming to International Telecommunication Union (ITU)
  10368. Recommendation BT.709.
  10369. @item fcc
  10370. Set color space conforming to the United States Federal Communications
  10371. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10372. @item bt601
  10373. Set color space conforming to:
  10374. @itemize
  10375. @item
  10376. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10377. @item
  10378. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10379. @item
  10380. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10381. @end itemize
  10382. @item smpte240m
  10383. Set color space conforming to SMPTE ST 240:1999.
  10384. @end table
  10385. @item in_range
  10386. @item out_range
  10387. Set in/output YCbCr sample range.
  10388. This allows the autodetected value to be overridden as well as allows forcing
  10389. a specific value used for the output and encoder. If not specified, the
  10390. range depends on the pixel format. Possible values:
  10391. @table @samp
  10392. @item auto/unknown
  10393. Choose automatically.
  10394. @item jpeg/full/pc
  10395. Set full range (0-255 in case of 8-bit luma).
  10396. @item mpeg/limited/tv
  10397. Set "MPEG" range (16-235 in case of 8-bit luma).
  10398. @end table
  10399. @item force_original_aspect_ratio
  10400. Enable decreasing or increasing output video width or height if necessary to
  10401. keep the original aspect ratio. Possible values:
  10402. @table @samp
  10403. @item disable
  10404. Scale the video as specified and disable this feature.
  10405. @item decrease
  10406. The output video dimensions will automatically be decreased if needed.
  10407. @item increase
  10408. The output video dimensions will automatically be increased if needed.
  10409. @end table
  10410. One useful instance of this option is that when you know a specific device's
  10411. maximum allowed resolution, you can use this to limit the output video to
  10412. that, while retaining the aspect ratio. For example, device A allows
  10413. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10414. decrease) and specifying 1280x720 to the command line makes the output
  10415. 1280x533.
  10416. Please note that this is a different thing than specifying -1 for @option{w}
  10417. or @option{h}, you still need to specify the output resolution for this option
  10418. to work.
  10419. @end table
  10420. The values of the @option{w} and @option{h} options are expressions
  10421. containing the following constants:
  10422. @table @var
  10423. @item in_w
  10424. @item in_h
  10425. The input width and height
  10426. @item iw
  10427. @item ih
  10428. These are the same as @var{in_w} and @var{in_h}.
  10429. @item out_w
  10430. @item out_h
  10431. The output (scaled) width and height
  10432. @item ow
  10433. @item oh
  10434. These are the same as @var{out_w} and @var{out_h}
  10435. @item a
  10436. The same as @var{iw} / @var{ih}
  10437. @item sar
  10438. input sample aspect ratio
  10439. @item dar
  10440. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10441. @item hsub
  10442. @item vsub
  10443. horizontal and vertical input chroma subsample values. For example for the
  10444. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10445. @item ohsub
  10446. @item ovsub
  10447. horizontal and vertical output chroma subsample values. For example for the
  10448. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10449. @end table
  10450. @subsection Examples
  10451. @itemize
  10452. @item
  10453. Scale the input video to a size of 200x100
  10454. @example
  10455. scale=w=200:h=100
  10456. @end example
  10457. This is equivalent to:
  10458. @example
  10459. scale=200:100
  10460. @end example
  10461. or:
  10462. @example
  10463. scale=200x100
  10464. @end example
  10465. @item
  10466. Specify a size abbreviation for the output size:
  10467. @example
  10468. scale=qcif
  10469. @end example
  10470. which can also be written as:
  10471. @example
  10472. scale=size=qcif
  10473. @end example
  10474. @item
  10475. Scale the input to 2x:
  10476. @example
  10477. scale=w=2*iw:h=2*ih
  10478. @end example
  10479. @item
  10480. The above is the same as:
  10481. @example
  10482. scale=2*in_w:2*in_h
  10483. @end example
  10484. @item
  10485. Scale the input to 2x with forced interlaced scaling:
  10486. @example
  10487. scale=2*iw:2*ih:interl=1
  10488. @end example
  10489. @item
  10490. Scale the input to half size:
  10491. @example
  10492. scale=w=iw/2:h=ih/2
  10493. @end example
  10494. @item
  10495. Increase the width, and set the height to the same size:
  10496. @example
  10497. scale=3/2*iw:ow
  10498. @end example
  10499. @item
  10500. Seek Greek harmony:
  10501. @example
  10502. scale=iw:1/PHI*iw
  10503. scale=ih*PHI:ih
  10504. @end example
  10505. @item
  10506. Increase the height, and set the width to 3/2 of the height:
  10507. @example
  10508. scale=w=3/2*oh:h=3/5*ih
  10509. @end example
  10510. @item
  10511. Increase the size, making the size a multiple of the chroma
  10512. subsample values:
  10513. @example
  10514. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10515. @end example
  10516. @item
  10517. Increase the width to a maximum of 500 pixels,
  10518. keeping the same aspect ratio as the input:
  10519. @example
  10520. scale=w='min(500\, iw*3/2):h=-1'
  10521. @end example
  10522. @item
  10523. Make pixels square by combining scale and setsar:
  10524. @example
  10525. scale='trunc(ih*dar):ih',setsar=1/1
  10526. @end example
  10527. @item
  10528. Make pixels square by combining scale and setsar,
  10529. making sure the resulting resolution is even (required by some codecs):
  10530. @example
  10531. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10532. @end example
  10533. @end itemize
  10534. @subsection Commands
  10535. This filter supports the following commands:
  10536. @table @option
  10537. @item width, w
  10538. @item height, h
  10539. Set the output video dimension expression.
  10540. The command accepts the same syntax of the corresponding option.
  10541. If the specified expression is not valid, it is kept at its current
  10542. value.
  10543. @end table
  10544. @section scale_npp
  10545. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10546. format conversion on CUDA video frames. Setting the output width and height
  10547. works in the same way as for the @var{scale} filter.
  10548. The following additional options are accepted:
  10549. @table @option
  10550. @item format
  10551. The pixel format of the output CUDA frames. If set to the string "same" (the
  10552. default), the input format will be kept. Note that automatic format negotiation
  10553. and conversion is not yet supported for hardware frames
  10554. @item interp_algo
  10555. The interpolation algorithm used for resizing. One of the following:
  10556. @table @option
  10557. @item nn
  10558. Nearest neighbour.
  10559. @item linear
  10560. @item cubic
  10561. @item cubic2p_bspline
  10562. 2-parameter cubic (B=1, C=0)
  10563. @item cubic2p_catmullrom
  10564. 2-parameter cubic (B=0, C=1/2)
  10565. @item cubic2p_b05c03
  10566. 2-parameter cubic (B=1/2, C=3/10)
  10567. @item super
  10568. Supersampling
  10569. @item lanczos
  10570. @end table
  10571. @end table
  10572. @section scale2ref
  10573. Scale (resize) the input video, based on a reference video.
  10574. See the scale filter for available options, scale2ref supports the same but
  10575. uses the reference video instead of the main input as basis. scale2ref also
  10576. supports the following additional constants for the @option{w} and
  10577. @option{h} options:
  10578. @table @var
  10579. @item main_w
  10580. @item main_h
  10581. The main input video's width and height
  10582. @item main_a
  10583. The same as @var{main_w} / @var{main_h}
  10584. @item main_sar
  10585. The main input video's sample aspect ratio
  10586. @item main_dar, mdar
  10587. The main input video's display aspect ratio. Calculated from
  10588. @code{(main_w / main_h) * main_sar}.
  10589. @item main_hsub
  10590. @item main_vsub
  10591. The main input video's horizontal and vertical chroma subsample values.
  10592. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10593. is 1.
  10594. @end table
  10595. @subsection Examples
  10596. @itemize
  10597. @item
  10598. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10599. @example
  10600. 'scale2ref[b][a];[a][b]overlay'
  10601. @end example
  10602. @end itemize
  10603. @anchor{selectivecolor}
  10604. @section selectivecolor
  10605. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10606. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10607. by the "purity" of the color (that is, how saturated it already is).
  10608. This filter is similar to the Adobe Photoshop Selective Color tool.
  10609. The filter accepts the following options:
  10610. @table @option
  10611. @item correction_method
  10612. Select color correction method.
  10613. Available values are:
  10614. @table @samp
  10615. @item absolute
  10616. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10617. component value).
  10618. @item relative
  10619. Specified adjustments are relative to the original component value.
  10620. @end table
  10621. Default is @code{absolute}.
  10622. @item reds
  10623. Adjustments for red pixels (pixels where the red component is the maximum)
  10624. @item yellows
  10625. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10626. @item greens
  10627. Adjustments for green pixels (pixels where the green component is the maximum)
  10628. @item cyans
  10629. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10630. @item blues
  10631. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10632. @item magentas
  10633. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10634. @item whites
  10635. Adjustments for white pixels (pixels where all components are greater than 128)
  10636. @item neutrals
  10637. Adjustments for all pixels except pure black and pure white
  10638. @item blacks
  10639. Adjustments for black pixels (pixels where all components are lesser than 128)
  10640. @item psfile
  10641. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10642. @end table
  10643. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10644. 4 space separated floating point adjustment values in the [-1,1] range,
  10645. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10646. pixels of its range.
  10647. @subsection Examples
  10648. @itemize
  10649. @item
  10650. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10651. increase magenta by 27% in blue areas:
  10652. @example
  10653. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10654. @end example
  10655. @item
  10656. Use a Photoshop selective color preset:
  10657. @example
  10658. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10659. @end example
  10660. @end itemize
  10661. @anchor{separatefields}
  10662. @section separatefields
  10663. The @code{separatefields} takes a frame-based video input and splits
  10664. each frame into its components fields, producing a new half height clip
  10665. with twice the frame rate and twice the frame count.
  10666. This filter use field-dominance information in frame to decide which
  10667. of each pair of fields to place first in the output.
  10668. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10669. @section setdar, setsar
  10670. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10671. output video.
  10672. This is done by changing the specified Sample (aka Pixel) Aspect
  10673. Ratio, according to the following equation:
  10674. @example
  10675. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10676. @end example
  10677. Keep in mind that the @code{setdar} filter does not modify the pixel
  10678. dimensions of the video frame. Also, the display aspect ratio set by
  10679. this filter may be changed by later filters in the filterchain,
  10680. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10681. applied.
  10682. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10683. the filter output video.
  10684. Note that as a consequence of the application of this filter, the
  10685. output display aspect ratio will change according to the equation
  10686. above.
  10687. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10688. filter may be changed by later filters in the filterchain, e.g. if
  10689. another "setsar" or a "setdar" filter is applied.
  10690. It accepts the following parameters:
  10691. @table @option
  10692. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10693. Set the aspect ratio used by the filter.
  10694. The parameter can be a floating point number string, an expression, or
  10695. a string of the form @var{num}:@var{den}, where @var{num} and
  10696. @var{den} are the numerator and denominator of the aspect ratio. If
  10697. the parameter is not specified, it is assumed the value "0".
  10698. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10699. should be escaped.
  10700. @item max
  10701. Set the maximum integer value to use for expressing numerator and
  10702. denominator when reducing the expressed aspect ratio to a rational.
  10703. Default value is @code{100}.
  10704. @end table
  10705. The parameter @var{sar} is an expression containing
  10706. the following constants:
  10707. @table @option
  10708. @item E, PI, PHI
  10709. These are approximated values for the mathematical constants e
  10710. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10711. @item w, h
  10712. The input width and height.
  10713. @item a
  10714. These are the same as @var{w} / @var{h}.
  10715. @item sar
  10716. The input sample aspect ratio.
  10717. @item dar
  10718. The input display aspect ratio. It is the same as
  10719. (@var{w} / @var{h}) * @var{sar}.
  10720. @item hsub, vsub
  10721. Horizontal and vertical chroma subsample values. For example, for the
  10722. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10723. @end table
  10724. @subsection Examples
  10725. @itemize
  10726. @item
  10727. To change the display aspect ratio to 16:9, specify one of the following:
  10728. @example
  10729. setdar=dar=1.77777
  10730. setdar=dar=16/9
  10731. @end example
  10732. @item
  10733. To change the sample aspect ratio to 10:11, specify:
  10734. @example
  10735. setsar=sar=10/11
  10736. @end example
  10737. @item
  10738. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10739. 1000 in the aspect ratio reduction, use the command:
  10740. @example
  10741. setdar=ratio=16/9:max=1000
  10742. @end example
  10743. @end itemize
  10744. @anchor{setfield}
  10745. @section setfield
  10746. Force field for the output video frame.
  10747. The @code{setfield} filter marks the interlace type field for the
  10748. output frames. It does not change the input frame, but only sets the
  10749. corresponding property, which affects how the frame is treated by
  10750. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10751. The filter accepts the following options:
  10752. @table @option
  10753. @item mode
  10754. Available values are:
  10755. @table @samp
  10756. @item auto
  10757. Keep the same field property.
  10758. @item bff
  10759. Mark the frame as bottom-field-first.
  10760. @item tff
  10761. Mark the frame as top-field-first.
  10762. @item prog
  10763. Mark the frame as progressive.
  10764. @end table
  10765. @end table
  10766. @section showinfo
  10767. Show a line containing various information for each input video frame.
  10768. The input video is not modified.
  10769. The shown line contains a sequence of key/value pairs of the form
  10770. @var{key}:@var{value}.
  10771. The following values are shown in the output:
  10772. @table @option
  10773. @item n
  10774. The (sequential) number of the input frame, starting from 0.
  10775. @item pts
  10776. The Presentation TimeStamp of the input frame, expressed as a number of
  10777. time base units. The time base unit depends on the filter input pad.
  10778. @item pts_time
  10779. The Presentation TimeStamp of the input frame, expressed as a number of
  10780. seconds.
  10781. @item pos
  10782. The position of the frame in the input stream, or -1 if this information is
  10783. unavailable and/or meaningless (for example in case of synthetic video).
  10784. @item fmt
  10785. The pixel format name.
  10786. @item sar
  10787. The sample aspect ratio of the input frame, expressed in the form
  10788. @var{num}/@var{den}.
  10789. @item s
  10790. The size of the input frame. For the syntax of this option, check the
  10791. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10792. @item i
  10793. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10794. for bottom field first).
  10795. @item iskey
  10796. This is 1 if the frame is a key frame, 0 otherwise.
  10797. @item type
  10798. The picture type of the input frame ("I" for an I-frame, "P" for a
  10799. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10800. Also refer to the documentation of the @code{AVPictureType} enum and of
  10801. the @code{av_get_picture_type_char} function defined in
  10802. @file{libavutil/avutil.h}.
  10803. @item checksum
  10804. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10805. @item plane_checksum
  10806. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10807. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10808. @end table
  10809. @section showpalette
  10810. Displays the 256 colors palette of each frame. This filter is only relevant for
  10811. @var{pal8} pixel format frames.
  10812. It accepts the following option:
  10813. @table @option
  10814. @item s
  10815. Set the size of the box used to represent one palette color entry. Default is
  10816. @code{30} (for a @code{30x30} pixel box).
  10817. @end table
  10818. @section shuffleframes
  10819. Reorder and/or duplicate and/or drop video frames.
  10820. It accepts the following parameters:
  10821. @table @option
  10822. @item mapping
  10823. Set the destination indexes of input frames.
  10824. This is space or '|' separated list of indexes that maps input frames to output
  10825. frames. Number of indexes also sets maximal value that each index may have.
  10826. '-1' index have special meaning and that is to drop frame.
  10827. @end table
  10828. The first frame has the index 0. The default is to keep the input unchanged.
  10829. @subsection Examples
  10830. @itemize
  10831. @item
  10832. Swap second and third frame of every three frames of the input:
  10833. @example
  10834. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10835. @end example
  10836. @item
  10837. Swap 10th and 1st frame of every ten frames of the input:
  10838. @example
  10839. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10840. @end example
  10841. @end itemize
  10842. @section shuffleplanes
  10843. Reorder and/or duplicate video planes.
  10844. It accepts the following parameters:
  10845. @table @option
  10846. @item map0
  10847. The index of the input plane to be used as the first output plane.
  10848. @item map1
  10849. The index of the input plane to be used as the second output plane.
  10850. @item map2
  10851. The index of the input plane to be used as the third output plane.
  10852. @item map3
  10853. The index of the input plane to be used as the fourth output plane.
  10854. @end table
  10855. The first plane has the index 0. The default is to keep the input unchanged.
  10856. @subsection Examples
  10857. @itemize
  10858. @item
  10859. Swap the second and third planes of the input:
  10860. @example
  10861. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10862. @end example
  10863. @end itemize
  10864. @anchor{signalstats}
  10865. @section signalstats
  10866. Evaluate various visual metrics that assist in determining issues associated
  10867. with the digitization of analog video media.
  10868. By default the filter will log these metadata values:
  10869. @table @option
  10870. @item YMIN
  10871. Display the minimal Y value contained within the input frame. Expressed in
  10872. range of [0-255].
  10873. @item YLOW
  10874. Display the Y value at the 10% percentile within the input frame. Expressed in
  10875. range of [0-255].
  10876. @item YAVG
  10877. Display the average Y value within the input frame. Expressed in range of
  10878. [0-255].
  10879. @item YHIGH
  10880. Display the Y value at the 90% percentile within the input frame. Expressed in
  10881. range of [0-255].
  10882. @item YMAX
  10883. Display the maximum Y value contained within the input frame. Expressed in
  10884. range of [0-255].
  10885. @item UMIN
  10886. Display the minimal U value contained within the input frame. Expressed in
  10887. range of [0-255].
  10888. @item ULOW
  10889. Display the U value at the 10% percentile within the input frame. Expressed in
  10890. range of [0-255].
  10891. @item UAVG
  10892. Display the average U value within the input frame. Expressed in range of
  10893. [0-255].
  10894. @item UHIGH
  10895. Display the U value at the 90% percentile within the input frame. Expressed in
  10896. range of [0-255].
  10897. @item UMAX
  10898. Display the maximum U value contained within the input frame. Expressed in
  10899. range of [0-255].
  10900. @item VMIN
  10901. Display the minimal V value contained within the input frame. Expressed in
  10902. range of [0-255].
  10903. @item VLOW
  10904. Display the V value at the 10% percentile within the input frame. Expressed in
  10905. range of [0-255].
  10906. @item VAVG
  10907. Display the average V value within the input frame. Expressed in range of
  10908. [0-255].
  10909. @item VHIGH
  10910. Display the V value at the 90% percentile within the input frame. Expressed in
  10911. range of [0-255].
  10912. @item VMAX
  10913. Display the maximum V value contained within the input frame. Expressed in
  10914. range of [0-255].
  10915. @item SATMIN
  10916. Display the minimal saturation value contained within the input frame.
  10917. Expressed in range of [0-~181.02].
  10918. @item SATLOW
  10919. Display the saturation value at the 10% percentile within the input frame.
  10920. Expressed in range of [0-~181.02].
  10921. @item SATAVG
  10922. Display the average saturation value within the input frame. Expressed in range
  10923. of [0-~181.02].
  10924. @item SATHIGH
  10925. Display the saturation value at the 90% percentile within the input frame.
  10926. Expressed in range of [0-~181.02].
  10927. @item SATMAX
  10928. Display the maximum saturation value contained within the input frame.
  10929. Expressed in range of [0-~181.02].
  10930. @item HUEMED
  10931. Display the median value for hue within the input frame. Expressed in range of
  10932. [0-360].
  10933. @item HUEAVG
  10934. Display the average value for hue within the input frame. Expressed in range of
  10935. [0-360].
  10936. @item YDIF
  10937. Display the average of sample value difference between all values of the Y
  10938. plane in the current frame and corresponding values of the previous input frame.
  10939. Expressed in range of [0-255].
  10940. @item UDIF
  10941. Display the average of sample value difference between all values of the U
  10942. plane in the current frame and corresponding values of the previous input frame.
  10943. Expressed in range of [0-255].
  10944. @item VDIF
  10945. Display the average of sample value difference between all values of the V
  10946. plane in the current frame and corresponding values of the previous input frame.
  10947. Expressed in range of [0-255].
  10948. @item YBITDEPTH
  10949. Display bit depth of Y plane in current frame.
  10950. Expressed in range of [0-16].
  10951. @item UBITDEPTH
  10952. Display bit depth of U plane in current frame.
  10953. Expressed in range of [0-16].
  10954. @item VBITDEPTH
  10955. Display bit depth of V plane in current frame.
  10956. Expressed in range of [0-16].
  10957. @end table
  10958. The filter accepts the following options:
  10959. @table @option
  10960. @item stat
  10961. @item out
  10962. @option{stat} specify an additional form of image analysis.
  10963. @option{out} output video with the specified type of pixel highlighted.
  10964. Both options accept the following values:
  10965. @table @samp
  10966. @item tout
  10967. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10968. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10969. include the results of video dropouts, head clogs, or tape tracking issues.
  10970. @item vrep
  10971. Identify @var{vertical line repetition}. Vertical line repetition includes
  10972. similar rows of pixels within a frame. In born-digital video vertical line
  10973. repetition is common, but this pattern is uncommon in video digitized from an
  10974. analog source. When it occurs in video that results from the digitization of an
  10975. analog source it can indicate concealment from a dropout compensator.
  10976. @item brng
  10977. Identify pixels that fall outside of legal broadcast range.
  10978. @end table
  10979. @item color, c
  10980. Set the highlight color for the @option{out} option. The default color is
  10981. yellow.
  10982. @end table
  10983. @subsection Examples
  10984. @itemize
  10985. @item
  10986. Output data of various video metrics:
  10987. @example
  10988. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10989. @end example
  10990. @item
  10991. Output specific data about the minimum and maximum values of the Y plane per frame:
  10992. @example
  10993. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10994. @end example
  10995. @item
  10996. Playback video while highlighting pixels that are outside of broadcast range in red.
  10997. @example
  10998. ffplay example.mov -vf signalstats="out=brng:color=red"
  10999. @end example
  11000. @item
  11001. Playback video with signalstats metadata drawn over the frame.
  11002. @example
  11003. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11004. @end example
  11005. The contents of signalstat_drawtext.txt used in the command are:
  11006. @example
  11007. time %@{pts:hms@}
  11008. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11009. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11010. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11011. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11012. @end example
  11013. @end itemize
  11014. @anchor{signature}
  11015. @section signature
  11016. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11017. input. In this case the matching between the inputs can be calculated additionally.
  11018. The filter always passes through the first input. The signature of each stream can
  11019. be written into a file.
  11020. It accepts the following options:
  11021. @table @option
  11022. @item detectmode
  11023. Enable or disable the matching process.
  11024. Available values are:
  11025. @table @samp
  11026. @item off
  11027. Disable the calculation of a matching (default).
  11028. @item full
  11029. Calculate the matching for the whole video and output whether the whole video
  11030. matches or only parts.
  11031. @item fast
  11032. Calculate only until a matching is found or the video ends. Should be faster in
  11033. some cases.
  11034. @end table
  11035. @item nb_inputs
  11036. Set the number of inputs. The option value must be a non negative integer.
  11037. Default value is 1.
  11038. @item filename
  11039. Set the path to which the output is written. If there is more than one input,
  11040. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11041. integer), that will be replaced with the input number. If no filename is
  11042. specified, no output will be written. This is the default.
  11043. @item format
  11044. Choose the output format.
  11045. Available values are:
  11046. @table @samp
  11047. @item binary
  11048. Use the specified binary representation (default).
  11049. @item xml
  11050. Use the specified xml representation.
  11051. @end table
  11052. @item th_d
  11053. Set threshold to detect one word as similar. The option value must be an integer
  11054. greater than zero. The default value is 9000.
  11055. @item th_dc
  11056. Set threshold to detect all words as similar. The option value must be an integer
  11057. greater than zero. The default value is 60000.
  11058. @item th_xh
  11059. Set threshold to detect frames as similar. The option value must be an integer
  11060. greater than zero. The default value is 116.
  11061. @item th_di
  11062. Set the minimum length of a sequence in frames to recognize it as matching
  11063. sequence. The option value must be a non negative integer value.
  11064. The default value is 0.
  11065. @item th_it
  11066. Set the minimum relation, that matching frames to all frames must have.
  11067. The option value must be a double value between 0 and 1. The default value is 0.5.
  11068. @end table
  11069. @subsection Examples
  11070. @itemize
  11071. @item
  11072. To calculate the signature of an input video and store it in signature.bin:
  11073. @example
  11074. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11075. @end example
  11076. @item
  11077. To detect whether two videos match and store the signatures in XML format in
  11078. signature0.xml and signature1.xml:
  11079. @example
  11080. 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 -
  11081. @end example
  11082. @end itemize
  11083. @anchor{smartblur}
  11084. @section smartblur
  11085. Blur the input video without impacting the outlines.
  11086. It accepts the following options:
  11087. @table @option
  11088. @item luma_radius, lr
  11089. Set the luma radius. The option value must be a float number in
  11090. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11091. used to blur the image (slower if larger). Default value is 1.0.
  11092. @item luma_strength, ls
  11093. Set the luma strength. The option value must be a float number
  11094. in the range [-1.0,1.0] that configures the blurring. A value included
  11095. in [0.0,1.0] will blur the image whereas a value included in
  11096. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11097. @item luma_threshold, lt
  11098. Set the luma threshold used as a coefficient to determine
  11099. whether a pixel should be blurred or not. The option value must be an
  11100. integer in the range [-30,30]. A value of 0 will filter all the image,
  11101. a value included in [0,30] will filter flat areas and a value included
  11102. in [-30,0] will filter edges. Default value is 0.
  11103. @item chroma_radius, cr
  11104. Set the chroma radius. The option value must be a float number in
  11105. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11106. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11107. @item chroma_strength, cs
  11108. Set the chroma strength. The option value must be a float number
  11109. in the range [-1.0,1.0] that configures the blurring. A value included
  11110. in [0.0,1.0] will blur the image whereas a value included in
  11111. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11112. @item chroma_threshold, ct
  11113. Set the chroma threshold used as a coefficient to determine
  11114. whether a pixel should be blurred or not. The option value must be an
  11115. integer in the range [-30,30]. A value of 0 will filter all the image,
  11116. a value included in [0,30] will filter flat areas and a value included
  11117. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11118. @end table
  11119. If a chroma option is not explicitly set, the corresponding luma value
  11120. is set.
  11121. @section ssim
  11122. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11123. This filter takes in input two input videos, the first input is
  11124. considered the "main" source and is passed unchanged to the
  11125. output. The second input is used as a "reference" video for computing
  11126. the SSIM.
  11127. Both video inputs must have the same resolution and pixel format for
  11128. this filter to work correctly. Also it assumes that both inputs
  11129. have the same number of frames, which are compared one by one.
  11130. The filter stores the calculated SSIM of each frame.
  11131. The description of the accepted parameters follows.
  11132. @table @option
  11133. @item stats_file, f
  11134. If specified the filter will use the named file to save the SSIM of
  11135. each individual frame. When filename equals "-" the data is sent to
  11136. standard output.
  11137. @end table
  11138. The file printed if @var{stats_file} is selected, contains a sequence of
  11139. key/value pairs of the form @var{key}:@var{value} for each compared
  11140. couple of frames.
  11141. A description of each shown parameter follows:
  11142. @table @option
  11143. @item n
  11144. sequential number of the input frame, starting from 1
  11145. @item Y, U, V, R, G, B
  11146. SSIM of the compared frames for the component specified by the suffix.
  11147. @item All
  11148. SSIM of the compared frames for the whole frame.
  11149. @item dB
  11150. Same as above but in dB representation.
  11151. @end table
  11152. This filter also supports the @ref{framesync} options.
  11153. For example:
  11154. @example
  11155. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11156. [main][ref] ssim="stats_file=stats.log" [out]
  11157. @end example
  11158. On this example the input file being processed is compared with the
  11159. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11160. is stored in @file{stats.log}.
  11161. Another example with both psnr and ssim at same time:
  11162. @example
  11163. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11164. @end example
  11165. @section stereo3d
  11166. Convert between different stereoscopic image formats.
  11167. The filters accept the following options:
  11168. @table @option
  11169. @item in
  11170. Set stereoscopic image format of input.
  11171. Available values for input image formats are:
  11172. @table @samp
  11173. @item sbsl
  11174. side by side parallel (left eye left, right eye right)
  11175. @item sbsr
  11176. side by side crosseye (right eye left, left eye right)
  11177. @item sbs2l
  11178. side by side parallel with half width resolution
  11179. (left eye left, right eye right)
  11180. @item sbs2r
  11181. side by side crosseye with half width resolution
  11182. (right eye left, left eye right)
  11183. @item abl
  11184. above-below (left eye above, right eye below)
  11185. @item abr
  11186. above-below (right eye above, left eye below)
  11187. @item ab2l
  11188. above-below with half height resolution
  11189. (left eye above, right eye below)
  11190. @item ab2r
  11191. above-below with half height resolution
  11192. (right eye above, left eye below)
  11193. @item al
  11194. alternating frames (left eye first, right eye second)
  11195. @item ar
  11196. alternating frames (right eye first, left eye second)
  11197. @item irl
  11198. interleaved rows (left eye has top row, right eye starts on next row)
  11199. @item irr
  11200. interleaved rows (right eye has top row, left eye starts on next row)
  11201. @item icl
  11202. interleaved columns, left eye first
  11203. @item icr
  11204. interleaved columns, right eye first
  11205. Default value is @samp{sbsl}.
  11206. @end table
  11207. @item out
  11208. Set stereoscopic image format of output.
  11209. @table @samp
  11210. @item sbsl
  11211. side by side parallel (left eye left, right eye right)
  11212. @item sbsr
  11213. side by side crosseye (right eye left, left eye right)
  11214. @item sbs2l
  11215. side by side parallel with half width resolution
  11216. (left eye left, right eye right)
  11217. @item sbs2r
  11218. side by side crosseye with half width resolution
  11219. (right eye left, left eye right)
  11220. @item abl
  11221. above-below (left eye above, right eye below)
  11222. @item abr
  11223. above-below (right eye above, left eye below)
  11224. @item ab2l
  11225. above-below with half height resolution
  11226. (left eye above, right eye below)
  11227. @item ab2r
  11228. above-below with half height resolution
  11229. (right eye above, left eye below)
  11230. @item al
  11231. alternating frames (left eye first, right eye second)
  11232. @item ar
  11233. alternating frames (right eye first, left eye second)
  11234. @item irl
  11235. interleaved rows (left eye has top row, right eye starts on next row)
  11236. @item irr
  11237. interleaved rows (right eye has top row, left eye starts on next row)
  11238. @item arbg
  11239. anaglyph red/blue gray
  11240. (red filter on left eye, blue filter on right eye)
  11241. @item argg
  11242. anaglyph red/green gray
  11243. (red filter on left eye, green filter on right eye)
  11244. @item arcg
  11245. anaglyph red/cyan gray
  11246. (red filter on left eye, cyan filter on right eye)
  11247. @item arch
  11248. anaglyph red/cyan half colored
  11249. (red filter on left eye, cyan filter on right eye)
  11250. @item arcc
  11251. anaglyph red/cyan color
  11252. (red filter on left eye, cyan filter on right eye)
  11253. @item arcd
  11254. anaglyph red/cyan color optimized with the least squares projection of dubois
  11255. (red filter on left eye, cyan filter on right eye)
  11256. @item agmg
  11257. anaglyph green/magenta gray
  11258. (green filter on left eye, magenta filter on right eye)
  11259. @item agmh
  11260. anaglyph green/magenta half colored
  11261. (green filter on left eye, magenta filter on right eye)
  11262. @item agmc
  11263. anaglyph green/magenta colored
  11264. (green filter on left eye, magenta filter on right eye)
  11265. @item agmd
  11266. anaglyph green/magenta color optimized with the least squares projection of dubois
  11267. (green filter on left eye, magenta filter on right eye)
  11268. @item aybg
  11269. anaglyph yellow/blue gray
  11270. (yellow filter on left eye, blue filter on right eye)
  11271. @item aybh
  11272. anaglyph yellow/blue half colored
  11273. (yellow filter on left eye, blue filter on right eye)
  11274. @item aybc
  11275. anaglyph yellow/blue colored
  11276. (yellow filter on left eye, blue filter on right eye)
  11277. @item aybd
  11278. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11279. (yellow filter on left eye, blue filter on right eye)
  11280. @item ml
  11281. mono output (left eye only)
  11282. @item mr
  11283. mono output (right eye only)
  11284. @item chl
  11285. checkerboard, left eye first
  11286. @item chr
  11287. checkerboard, right eye first
  11288. @item icl
  11289. interleaved columns, left eye first
  11290. @item icr
  11291. interleaved columns, right eye first
  11292. @item hdmi
  11293. HDMI frame pack
  11294. @end table
  11295. Default value is @samp{arcd}.
  11296. @end table
  11297. @subsection Examples
  11298. @itemize
  11299. @item
  11300. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11301. @example
  11302. stereo3d=sbsl:aybd
  11303. @end example
  11304. @item
  11305. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11306. @example
  11307. stereo3d=abl:sbsr
  11308. @end example
  11309. @end itemize
  11310. @section streamselect, astreamselect
  11311. Select video or audio streams.
  11312. The filter accepts the following options:
  11313. @table @option
  11314. @item inputs
  11315. Set number of inputs. Default is 2.
  11316. @item map
  11317. Set input indexes to remap to outputs.
  11318. @end table
  11319. @subsection Commands
  11320. The @code{streamselect} and @code{astreamselect} filter supports the following
  11321. commands:
  11322. @table @option
  11323. @item map
  11324. Set input indexes to remap to outputs.
  11325. @end table
  11326. @subsection Examples
  11327. @itemize
  11328. @item
  11329. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11330. @example
  11331. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11332. @end example
  11333. @item
  11334. Same as above, but for audio:
  11335. @example
  11336. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11337. @end example
  11338. @end itemize
  11339. @section sobel
  11340. Apply sobel operator to input video stream.
  11341. The filter accepts the following option:
  11342. @table @option
  11343. @item planes
  11344. Set which planes will be processed, unprocessed planes will be copied.
  11345. By default value 0xf, all planes will be processed.
  11346. @item scale
  11347. Set value which will be multiplied with filtered result.
  11348. @item delta
  11349. Set value which will be added to filtered result.
  11350. @end table
  11351. @anchor{spp}
  11352. @section spp
  11353. Apply a simple postprocessing filter that compresses and decompresses the image
  11354. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11355. and average the results.
  11356. The filter accepts the following options:
  11357. @table @option
  11358. @item quality
  11359. Set quality. This option defines the number of levels for averaging. It accepts
  11360. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11361. effect. A value of @code{6} means the higher quality. For each increment of
  11362. that value the speed drops by a factor of approximately 2. Default value is
  11363. @code{3}.
  11364. @item qp
  11365. Force a constant quantization parameter. If not set, the filter will use the QP
  11366. from the video stream (if available).
  11367. @item mode
  11368. Set thresholding mode. Available modes are:
  11369. @table @samp
  11370. @item hard
  11371. Set hard thresholding (default).
  11372. @item soft
  11373. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11374. @end table
  11375. @item use_bframe_qp
  11376. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11377. option may cause flicker since the B-Frames have often larger QP. Default is
  11378. @code{0} (not enabled).
  11379. @end table
  11380. @anchor{subtitles}
  11381. @section subtitles
  11382. Draw subtitles on top of input video using the libass library.
  11383. To enable compilation of this filter you need to configure FFmpeg with
  11384. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11385. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11386. Alpha) subtitles format.
  11387. The filter accepts the following options:
  11388. @table @option
  11389. @item filename, f
  11390. Set the filename of the subtitle file to read. It must be specified.
  11391. @item original_size
  11392. Specify the size of the original video, the video for which the ASS file
  11393. was composed. For the syntax of this option, check the
  11394. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11395. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11396. correctly scale the fonts if the aspect ratio has been changed.
  11397. @item fontsdir
  11398. Set a directory path containing fonts that can be used by the filter.
  11399. These fonts will be used in addition to whatever the font provider uses.
  11400. @item alpha
  11401. Process alpha channel, by default alpha channel is untouched.
  11402. @item charenc
  11403. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11404. useful if not UTF-8.
  11405. @item stream_index, si
  11406. Set subtitles stream index. @code{subtitles} filter only.
  11407. @item force_style
  11408. Override default style or script info parameters of the subtitles. It accepts a
  11409. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11410. @end table
  11411. If the first key is not specified, it is assumed that the first value
  11412. specifies the @option{filename}.
  11413. For example, to render the file @file{sub.srt} on top of the input
  11414. video, use the command:
  11415. @example
  11416. subtitles=sub.srt
  11417. @end example
  11418. which is equivalent to:
  11419. @example
  11420. subtitles=filename=sub.srt
  11421. @end example
  11422. To render the default subtitles stream from file @file{video.mkv}, use:
  11423. @example
  11424. subtitles=video.mkv
  11425. @end example
  11426. To render the second subtitles stream from that file, use:
  11427. @example
  11428. subtitles=video.mkv:si=1
  11429. @end example
  11430. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11431. @code{DejaVu Serif}, use:
  11432. @example
  11433. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11434. @end example
  11435. @section super2xsai
  11436. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11437. Interpolate) pixel art scaling algorithm.
  11438. Useful for enlarging pixel art images without reducing sharpness.
  11439. @section swaprect
  11440. Swap two rectangular objects in video.
  11441. This filter accepts the following options:
  11442. @table @option
  11443. @item w
  11444. Set object width.
  11445. @item h
  11446. Set object height.
  11447. @item x1
  11448. Set 1st rect x coordinate.
  11449. @item y1
  11450. Set 1st rect y coordinate.
  11451. @item x2
  11452. Set 2nd rect x coordinate.
  11453. @item y2
  11454. Set 2nd rect y coordinate.
  11455. All expressions are evaluated once for each frame.
  11456. @end table
  11457. The all options are expressions containing the following constants:
  11458. @table @option
  11459. @item w
  11460. @item h
  11461. The input width and height.
  11462. @item a
  11463. same as @var{w} / @var{h}
  11464. @item sar
  11465. input sample aspect ratio
  11466. @item dar
  11467. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11468. @item n
  11469. The number of the input frame, starting from 0.
  11470. @item t
  11471. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11472. @item pos
  11473. the position in the file of the input frame, NAN if unknown
  11474. @end table
  11475. @section swapuv
  11476. Swap U & V plane.
  11477. @section telecine
  11478. Apply telecine process to the video.
  11479. This filter accepts the following options:
  11480. @table @option
  11481. @item first_field
  11482. @table @samp
  11483. @item top, t
  11484. top field first
  11485. @item bottom, b
  11486. bottom field first
  11487. The default value is @code{top}.
  11488. @end table
  11489. @item pattern
  11490. A string of numbers representing the pulldown pattern you wish to apply.
  11491. The default value is @code{23}.
  11492. @end table
  11493. @example
  11494. Some typical patterns:
  11495. NTSC output (30i):
  11496. 27.5p: 32222
  11497. 24p: 23 (classic)
  11498. 24p: 2332 (preferred)
  11499. 20p: 33
  11500. 18p: 334
  11501. 16p: 3444
  11502. PAL output (25i):
  11503. 27.5p: 12222
  11504. 24p: 222222222223 ("Euro pulldown")
  11505. 16.67p: 33
  11506. 16p: 33333334
  11507. @end example
  11508. @section threshold
  11509. Apply threshold effect to video stream.
  11510. This filter needs four video streams to perform thresholding.
  11511. First stream is stream we are filtering.
  11512. Second stream is holding threshold values, third stream is holding min values,
  11513. and last, fourth stream is holding max values.
  11514. The filter accepts the following option:
  11515. @table @option
  11516. @item planes
  11517. Set which planes will be processed, unprocessed planes will be copied.
  11518. By default value 0xf, all planes will be processed.
  11519. @end table
  11520. For example if first stream pixel's component value is less then threshold value
  11521. of pixel component from 2nd threshold stream, third stream value will picked,
  11522. otherwise fourth stream pixel component value will be picked.
  11523. Using color source filter one can perform various types of thresholding:
  11524. @subsection Examples
  11525. @itemize
  11526. @item
  11527. Binary threshold, using gray color as threshold:
  11528. @example
  11529. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11530. @end example
  11531. @item
  11532. Inverted binary threshold, using gray color as threshold:
  11533. @example
  11534. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11535. @end example
  11536. @item
  11537. Truncate binary threshold, using gray color as threshold:
  11538. @example
  11539. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11540. @end example
  11541. @item
  11542. Threshold to zero, using gray color as threshold:
  11543. @example
  11544. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11545. @end example
  11546. @item
  11547. Inverted threshold to zero, using gray color as threshold:
  11548. @example
  11549. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11550. @end example
  11551. @end itemize
  11552. @section thumbnail
  11553. Select the most representative frame in a given sequence of consecutive frames.
  11554. The filter accepts the following options:
  11555. @table @option
  11556. @item n
  11557. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11558. will pick one of them, and then handle the next batch of @var{n} frames until
  11559. the end. Default is @code{100}.
  11560. @end table
  11561. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11562. value will result in a higher memory usage, so a high value is not recommended.
  11563. @subsection Examples
  11564. @itemize
  11565. @item
  11566. Extract one picture each 50 frames:
  11567. @example
  11568. thumbnail=50
  11569. @end example
  11570. @item
  11571. Complete example of a thumbnail creation with @command{ffmpeg}:
  11572. @example
  11573. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11574. @end example
  11575. @end itemize
  11576. @section tile
  11577. Tile several successive frames together.
  11578. The filter accepts the following options:
  11579. @table @option
  11580. @item layout
  11581. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11582. this option, check the
  11583. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11584. @item nb_frames
  11585. Set the maximum number of frames to render in the given area. It must be less
  11586. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11587. the area will be used.
  11588. @item margin
  11589. Set the outer border margin in pixels.
  11590. @item padding
  11591. Set the inner border thickness (i.e. the number of pixels between frames). For
  11592. more advanced padding options (such as having different values for the edges),
  11593. refer to the pad video filter.
  11594. @item color
  11595. Specify the color of the unused area. For the syntax of this option, check the
  11596. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11597. The default value of @var{color} is "black".
  11598. @item overlap
  11599. Set the number of frames to overlap when tiling several successive frames together.
  11600. The value must be between @code{0} and @var{nb_frames - 1}.
  11601. @item init_padding
  11602. Set the number of frames to initially be empty before displaying first output frame.
  11603. This controls how soon will one get first output frame.
  11604. The value must be between @code{0} and @var{nb_frames - 1}.
  11605. @end table
  11606. @subsection Examples
  11607. @itemize
  11608. @item
  11609. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11610. @example
  11611. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11612. @end example
  11613. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11614. duplicating each output frame to accommodate the originally detected frame
  11615. rate.
  11616. @item
  11617. Display @code{5} pictures in an area of @code{3x2} frames,
  11618. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11619. mixed flat and named options:
  11620. @example
  11621. tile=3x2:nb_frames=5:padding=7:margin=2
  11622. @end example
  11623. @end itemize
  11624. @section tinterlace
  11625. Perform various types of temporal field interlacing.
  11626. Frames are counted starting from 1, so the first input frame is
  11627. considered odd.
  11628. The filter accepts the following options:
  11629. @table @option
  11630. @item mode
  11631. Specify the mode of the interlacing. This option can also be specified
  11632. as a value alone. See below for a list of values for this option.
  11633. Available values are:
  11634. @table @samp
  11635. @item merge, 0
  11636. Move odd frames into the upper field, even into the lower field,
  11637. generating a double height frame at half frame rate.
  11638. @example
  11639. ------> time
  11640. Input:
  11641. Frame 1 Frame 2 Frame 3 Frame 4
  11642. 11111 22222 33333 44444
  11643. 11111 22222 33333 44444
  11644. 11111 22222 33333 44444
  11645. 11111 22222 33333 44444
  11646. Output:
  11647. 11111 33333
  11648. 22222 44444
  11649. 11111 33333
  11650. 22222 44444
  11651. 11111 33333
  11652. 22222 44444
  11653. 11111 33333
  11654. 22222 44444
  11655. @end example
  11656. @item drop_even, 1
  11657. Only output odd frames, even frames are dropped, generating a frame with
  11658. unchanged height at half frame rate.
  11659. @example
  11660. ------> time
  11661. Input:
  11662. Frame 1 Frame 2 Frame 3 Frame 4
  11663. 11111 22222 33333 44444
  11664. 11111 22222 33333 44444
  11665. 11111 22222 33333 44444
  11666. 11111 22222 33333 44444
  11667. Output:
  11668. 11111 33333
  11669. 11111 33333
  11670. 11111 33333
  11671. 11111 33333
  11672. @end example
  11673. @item drop_odd, 2
  11674. Only output even frames, odd frames are dropped, generating a frame with
  11675. unchanged height at half frame rate.
  11676. @example
  11677. ------> time
  11678. Input:
  11679. Frame 1 Frame 2 Frame 3 Frame 4
  11680. 11111 22222 33333 44444
  11681. 11111 22222 33333 44444
  11682. 11111 22222 33333 44444
  11683. 11111 22222 33333 44444
  11684. Output:
  11685. 22222 44444
  11686. 22222 44444
  11687. 22222 44444
  11688. 22222 44444
  11689. @end example
  11690. @item pad, 3
  11691. Expand each frame to full height, but pad alternate lines with black,
  11692. generating a frame with double height at the same input frame rate.
  11693. @example
  11694. ------> time
  11695. Input:
  11696. Frame 1 Frame 2 Frame 3 Frame 4
  11697. 11111 22222 33333 44444
  11698. 11111 22222 33333 44444
  11699. 11111 22222 33333 44444
  11700. 11111 22222 33333 44444
  11701. Output:
  11702. 11111 ..... 33333 .....
  11703. ..... 22222 ..... 44444
  11704. 11111 ..... 33333 .....
  11705. ..... 22222 ..... 44444
  11706. 11111 ..... 33333 .....
  11707. ..... 22222 ..... 44444
  11708. 11111 ..... 33333 .....
  11709. ..... 22222 ..... 44444
  11710. @end example
  11711. @item interleave_top, 4
  11712. Interleave the upper field from odd frames with the lower field from
  11713. even frames, generating a frame with unchanged height at half frame rate.
  11714. @example
  11715. ------> time
  11716. Input:
  11717. Frame 1 Frame 2 Frame 3 Frame 4
  11718. 11111<- 22222 33333<- 44444
  11719. 11111 22222<- 33333 44444<-
  11720. 11111<- 22222 33333<- 44444
  11721. 11111 22222<- 33333 44444<-
  11722. Output:
  11723. 11111 33333
  11724. 22222 44444
  11725. 11111 33333
  11726. 22222 44444
  11727. @end example
  11728. @item interleave_bottom, 5
  11729. Interleave the lower field from odd frames with the upper field from
  11730. even frames, generating a frame with unchanged height at half frame rate.
  11731. @example
  11732. ------> time
  11733. Input:
  11734. Frame 1 Frame 2 Frame 3 Frame 4
  11735. 11111 22222<- 33333 44444<-
  11736. 11111<- 22222 33333<- 44444
  11737. 11111 22222<- 33333 44444<-
  11738. 11111<- 22222 33333<- 44444
  11739. Output:
  11740. 22222 44444
  11741. 11111 33333
  11742. 22222 44444
  11743. 11111 33333
  11744. @end example
  11745. @item interlacex2, 6
  11746. Double frame rate with unchanged height. Frames are inserted each
  11747. containing the second temporal field from the previous input frame and
  11748. the first temporal field from the next input frame. This mode relies on
  11749. the top_field_first flag. Useful for interlaced video displays with no
  11750. field synchronisation.
  11751. @example
  11752. ------> time
  11753. Input:
  11754. Frame 1 Frame 2 Frame 3 Frame 4
  11755. 11111 22222 33333 44444
  11756. 11111 22222 33333 44444
  11757. 11111 22222 33333 44444
  11758. 11111 22222 33333 44444
  11759. Output:
  11760. 11111 22222 22222 33333 33333 44444 44444
  11761. 11111 11111 22222 22222 33333 33333 44444
  11762. 11111 22222 22222 33333 33333 44444 44444
  11763. 11111 11111 22222 22222 33333 33333 44444
  11764. @end example
  11765. @item mergex2, 7
  11766. Move odd frames into the upper field, even into the lower field,
  11767. generating a double height frame at same frame rate.
  11768. @example
  11769. ------> time
  11770. Input:
  11771. Frame 1 Frame 2 Frame 3 Frame 4
  11772. 11111 22222 33333 44444
  11773. 11111 22222 33333 44444
  11774. 11111 22222 33333 44444
  11775. 11111 22222 33333 44444
  11776. Output:
  11777. 11111 33333 33333 55555
  11778. 22222 22222 44444 44444
  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. @end example
  11786. @end table
  11787. Numeric values are deprecated but are accepted for backward
  11788. compatibility reasons.
  11789. Default mode is @code{merge}.
  11790. @item flags
  11791. Specify flags influencing the filter process.
  11792. Available value for @var{flags} is:
  11793. @table @option
  11794. @item low_pass_filter, vlfp
  11795. Enable linear vertical low-pass filtering in the filter.
  11796. Vertical low-pass filtering is required when creating an interlaced
  11797. destination from a progressive source which contains high-frequency
  11798. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11799. patterning.
  11800. @item complex_filter, cvlfp
  11801. Enable complex vertical low-pass filtering.
  11802. This will slightly less reduce interlace 'twitter' and Moire
  11803. patterning but better retain detail and subjective sharpness impression.
  11804. @end table
  11805. Vertical low-pass filtering can only be enabled for @option{mode}
  11806. @var{interleave_top} and @var{interleave_bottom}.
  11807. @end table
  11808. @section tonemap
  11809. Tone map colors from different dynamic ranges.
  11810. This filter expects data in single precision floating point, as it needs to
  11811. operate on (and can output) out-of-range values. Another filter, such as
  11812. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11813. The tonemapping algorithms implemented only work on linear light, so input
  11814. data should be linearized beforehand (and possibly correctly tagged).
  11815. @example
  11816. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11817. @end example
  11818. @subsection Options
  11819. The filter accepts the following options.
  11820. @table @option
  11821. @item tonemap
  11822. Set the tone map algorithm to use.
  11823. Possible values are:
  11824. @table @var
  11825. @item none
  11826. Do not apply any tone map, only desaturate overbright pixels.
  11827. @item clip
  11828. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11829. in-range values, while distorting out-of-range values.
  11830. @item linear
  11831. Stretch the entire reference gamut to a linear multiple of the display.
  11832. @item gamma
  11833. Fit a logarithmic transfer between the tone curves.
  11834. @item reinhard
  11835. Preserve overall image brightness with a simple curve, using nonlinear
  11836. contrast, which results in flattening details and degrading color accuracy.
  11837. @item hable
  11838. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11839. of slightly darkening everything. Use it when detail preservation is more
  11840. important than color and brightness accuracy.
  11841. @item mobius
  11842. Smoothly map out-of-range values, while retaining contrast and colors for
  11843. in-range material as much as possible. Use it when color accuracy is more
  11844. important than detail preservation.
  11845. @end table
  11846. Default is none.
  11847. @item param
  11848. Tune the tone mapping algorithm.
  11849. This affects the following algorithms:
  11850. @table @var
  11851. @item none
  11852. Ignored.
  11853. @item linear
  11854. Specifies the scale factor to use while stretching.
  11855. Default to 1.0.
  11856. @item gamma
  11857. Specifies the exponent of the function.
  11858. Default to 1.8.
  11859. @item clip
  11860. Specify an extra linear coefficient to multiply into the signal before clipping.
  11861. Default to 1.0.
  11862. @item reinhard
  11863. Specify the local contrast coefficient at the display peak.
  11864. Default to 0.5, which means that in-gamut values will be about half as bright
  11865. as when clipping.
  11866. @item hable
  11867. Ignored.
  11868. @item mobius
  11869. Specify the transition point from linear to mobius transform. Every value
  11870. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11871. more accurate the result will be, at the cost of losing bright details.
  11872. Default to 0.3, which due to the steep initial slope still preserves in-range
  11873. colors fairly accurately.
  11874. @end table
  11875. @item desat
  11876. Apply desaturation for highlights that exceed this level of brightness. The
  11877. higher the parameter, the more color information will be preserved. This
  11878. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11879. (smoothly) turning into white instead. This makes images feel more natural,
  11880. at the cost of reducing information about out-of-range colors.
  11881. The default of 2.0 is somewhat conservative and will mostly just apply to
  11882. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11883. This option works only if the input frame has a supported color tag.
  11884. @item peak
  11885. Override signal/nominal/reference peak with this value. Useful when the
  11886. embedded peak information in display metadata is not reliable or when tone
  11887. mapping from a lower range to a higher range.
  11888. @end table
  11889. @section transpose
  11890. Transpose rows with columns in the input video and optionally flip it.
  11891. It accepts the following parameters:
  11892. @table @option
  11893. @item dir
  11894. Specify the transposition direction.
  11895. Can assume the following values:
  11896. @table @samp
  11897. @item 0, 4, cclock_flip
  11898. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11899. @example
  11900. L.R L.l
  11901. . . -> . .
  11902. l.r R.r
  11903. @end example
  11904. @item 1, 5, clock
  11905. Rotate by 90 degrees clockwise, that is:
  11906. @example
  11907. L.R l.L
  11908. . . -> . .
  11909. l.r r.R
  11910. @end example
  11911. @item 2, 6, cclock
  11912. Rotate by 90 degrees counterclockwise, that is:
  11913. @example
  11914. L.R R.r
  11915. . . -> . .
  11916. l.r L.l
  11917. @end example
  11918. @item 3, 7, clock_flip
  11919. Rotate by 90 degrees clockwise and vertically flip, that is:
  11920. @example
  11921. L.R r.R
  11922. . . -> . .
  11923. l.r l.L
  11924. @end example
  11925. @end table
  11926. For values between 4-7, the transposition is only done if the input
  11927. video geometry is portrait and not landscape. These values are
  11928. deprecated, the @code{passthrough} option should be used instead.
  11929. Numerical values are deprecated, and should be dropped in favor of
  11930. symbolic constants.
  11931. @item passthrough
  11932. Do not apply the transposition if the input geometry matches the one
  11933. specified by the specified value. It accepts the following values:
  11934. @table @samp
  11935. @item none
  11936. Always apply transposition.
  11937. @item portrait
  11938. Preserve portrait geometry (when @var{height} >= @var{width}).
  11939. @item landscape
  11940. Preserve landscape geometry (when @var{width} >= @var{height}).
  11941. @end table
  11942. Default value is @code{none}.
  11943. @end table
  11944. For example to rotate by 90 degrees clockwise and preserve portrait
  11945. layout:
  11946. @example
  11947. transpose=dir=1:passthrough=portrait
  11948. @end example
  11949. The command above can also be specified as:
  11950. @example
  11951. transpose=1:portrait
  11952. @end example
  11953. @section trim
  11954. Trim the input so that the output contains one continuous subpart of the input.
  11955. It accepts the following parameters:
  11956. @table @option
  11957. @item start
  11958. Specify the time of the start of the kept section, i.e. the frame with the
  11959. timestamp @var{start} will be the first frame in the output.
  11960. @item end
  11961. Specify the time of the first frame that will be dropped, i.e. the frame
  11962. immediately preceding the one with the timestamp @var{end} will be the last
  11963. frame in the output.
  11964. @item start_pts
  11965. This is the same as @var{start}, except this option sets the start timestamp
  11966. in timebase units instead of seconds.
  11967. @item end_pts
  11968. This is the same as @var{end}, except this option sets the end timestamp
  11969. in timebase units instead of seconds.
  11970. @item duration
  11971. The maximum duration of the output in seconds.
  11972. @item start_frame
  11973. The number of the first frame that should be passed to the output.
  11974. @item end_frame
  11975. The number of the first frame that should be dropped.
  11976. @end table
  11977. @option{start}, @option{end}, and @option{duration} are expressed as time
  11978. duration specifications; see
  11979. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11980. for the accepted syntax.
  11981. Note that the first two sets of the start/end options and the @option{duration}
  11982. option look at the frame timestamp, while the _frame variants simply count the
  11983. frames that pass through the filter. Also note that this filter does not modify
  11984. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11985. setpts filter after the trim filter.
  11986. If multiple start or end options are set, this filter tries to be greedy and
  11987. keep all the frames that match at least one of the specified constraints. To keep
  11988. only the part that matches all the constraints at once, chain multiple trim
  11989. filters.
  11990. The defaults are such that all the input is kept. So it is possible to set e.g.
  11991. just the end values to keep everything before the specified time.
  11992. Examples:
  11993. @itemize
  11994. @item
  11995. Drop everything except the second minute of input:
  11996. @example
  11997. ffmpeg -i INPUT -vf trim=60:120
  11998. @end example
  11999. @item
  12000. Keep only the first second:
  12001. @example
  12002. ffmpeg -i INPUT -vf trim=duration=1
  12003. @end example
  12004. @end itemize
  12005. @section unpremultiply
  12006. Apply alpha unpremultiply effect to input video stream using first plane
  12007. of second stream as alpha.
  12008. Both streams must have same dimensions and same pixel format.
  12009. The filter accepts the following option:
  12010. @table @option
  12011. @item planes
  12012. Set which planes will be processed, unprocessed planes will be copied.
  12013. By default value 0xf, all planes will be processed.
  12014. If the format has 1 or 2 components, then luma is bit 0.
  12015. If the format has 3 or 4 components:
  12016. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12017. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12018. If present, the alpha channel is always the last bit.
  12019. @item inplace
  12020. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12021. @end table
  12022. @anchor{unsharp}
  12023. @section unsharp
  12024. Sharpen or blur the input video.
  12025. It accepts the following parameters:
  12026. @table @option
  12027. @item luma_msize_x, lx
  12028. Set the luma matrix horizontal size. It must be an odd integer between
  12029. 3 and 23. The default value is 5.
  12030. @item luma_msize_y, ly
  12031. Set the luma matrix vertical size. It must be an odd integer between 3
  12032. and 23. The default value is 5.
  12033. @item luma_amount, la
  12034. Set the luma effect strength. It must be a floating point number, reasonable
  12035. values lay between -1.5 and 1.5.
  12036. Negative values will blur the input video, while positive values will
  12037. sharpen it, a value of zero will disable the effect.
  12038. Default value is 1.0.
  12039. @item chroma_msize_x, cx
  12040. Set the chroma matrix horizontal size. It must be an odd integer
  12041. between 3 and 23. The default value is 5.
  12042. @item chroma_msize_y, cy
  12043. Set the chroma matrix vertical size. It must be an odd integer
  12044. between 3 and 23. The default value is 5.
  12045. @item chroma_amount, ca
  12046. Set the chroma effect strength. It must be a floating point number, reasonable
  12047. values lay between -1.5 and 1.5.
  12048. Negative values will blur the input video, while positive values will
  12049. sharpen it, a value of zero will disable the effect.
  12050. Default value is 0.0.
  12051. @end table
  12052. All parameters are optional and default to the equivalent of the
  12053. string '5:5:1.0:5:5:0.0'.
  12054. @subsection Examples
  12055. @itemize
  12056. @item
  12057. Apply strong luma sharpen effect:
  12058. @example
  12059. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12060. @end example
  12061. @item
  12062. Apply a strong blur of both luma and chroma parameters:
  12063. @example
  12064. unsharp=7:7:-2:7:7:-2
  12065. @end example
  12066. @end itemize
  12067. @section uspp
  12068. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12069. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12070. shifts and average the results.
  12071. The way this differs from the behavior of spp is that uspp actually encodes &
  12072. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12073. DCT similar to MJPEG.
  12074. The filter accepts the following options:
  12075. @table @option
  12076. @item quality
  12077. Set quality. This option defines the number of levels for averaging. It accepts
  12078. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12079. effect. A value of @code{8} means the higher quality. For each increment of
  12080. that value the speed drops by a factor of approximately 2. Default value is
  12081. @code{3}.
  12082. @item qp
  12083. Force a constant quantization parameter. If not set, the filter will use the QP
  12084. from the video stream (if available).
  12085. @end table
  12086. @section vaguedenoiser
  12087. Apply a wavelet based denoiser.
  12088. It transforms each frame from the video input into the wavelet domain,
  12089. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12090. the obtained coefficients. It does an inverse wavelet transform after.
  12091. Due to wavelet properties, it should give a nice smoothed result, and
  12092. reduced noise, without blurring picture features.
  12093. This filter accepts the following options:
  12094. @table @option
  12095. @item threshold
  12096. The filtering strength. The higher, the more filtered the video will be.
  12097. Hard thresholding can use a higher threshold than soft thresholding
  12098. before the video looks overfiltered. Default value is 2.
  12099. @item method
  12100. The filtering method the filter will use.
  12101. It accepts the following values:
  12102. @table @samp
  12103. @item hard
  12104. All values under the threshold will be zeroed.
  12105. @item soft
  12106. All values under the threshold will be zeroed. All values above will be
  12107. reduced by the threshold.
  12108. @item garrote
  12109. Scales or nullifies coefficients - intermediary between (more) soft and
  12110. (less) hard thresholding.
  12111. @end table
  12112. Default is garrote.
  12113. @item nsteps
  12114. Number of times, the wavelet will decompose the picture. Picture can't
  12115. be decomposed beyond a particular point (typically, 8 for a 640x480
  12116. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12117. @item percent
  12118. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12119. @item planes
  12120. A list of the planes to process. By default all planes are processed.
  12121. @end table
  12122. @section vectorscope
  12123. Display 2 color component values in the two dimensional graph (which is called
  12124. a vectorscope).
  12125. This filter accepts the following options:
  12126. @table @option
  12127. @item mode, m
  12128. Set vectorscope mode.
  12129. It accepts the following values:
  12130. @table @samp
  12131. @item gray
  12132. Gray values are displayed on graph, higher brightness means more pixels have
  12133. same component color value on location in graph. This is the default mode.
  12134. @item color
  12135. Gray values are displayed on graph. Surrounding pixels values which are not
  12136. present in video frame are drawn in gradient of 2 color components which are
  12137. set by option @code{x} and @code{y}. The 3rd color component is static.
  12138. @item color2
  12139. Actual color components values present in video frame are displayed on graph.
  12140. @item color3
  12141. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12142. on graph increases value of another color component, which is luminance by
  12143. default values of @code{x} and @code{y}.
  12144. @item color4
  12145. Actual colors present in video frame are displayed on graph. If two different
  12146. colors map to same position on graph then color with higher value of component
  12147. not present in graph is picked.
  12148. @item color5
  12149. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12150. component picked from radial gradient.
  12151. @end table
  12152. @item x
  12153. Set which color component will be represented on X-axis. Default is @code{1}.
  12154. @item y
  12155. Set which color component will be represented on Y-axis. Default is @code{2}.
  12156. @item intensity, i
  12157. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12158. of color component which represents frequency of (X, Y) location in graph.
  12159. @item envelope, e
  12160. @table @samp
  12161. @item none
  12162. No envelope, this is default.
  12163. @item instant
  12164. Instant envelope, even darkest single pixel will be clearly highlighted.
  12165. @item peak
  12166. Hold maximum and minimum values presented in graph over time. This way you
  12167. can still spot out of range values without constantly looking at vectorscope.
  12168. @item peak+instant
  12169. Peak and instant envelope combined together.
  12170. @end table
  12171. @item graticule, g
  12172. Set what kind of graticule to draw.
  12173. @table @samp
  12174. @item none
  12175. @item green
  12176. @item color
  12177. @end table
  12178. @item opacity, o
  12179. Set graticule opacity.
  12180. @item flags, f
  12181. Set graticule flags.
  12182. @table @samp
  12183. @item white
  12184. Draw graticule for white point.
  12185. @item black
  12186. Draw graticule for black point.
  12187. @item name
  12188. Draw color points short names.
  12189. @end table
  12190. @item bgopacity, b
  12191. Set background opacity.
  12192. @item lthreshold, l
  12193. Set low threshold for color component not represented on X or Y axis.
  12194. Values lower than this value will be ignored. Default is 0.
  12195. Note this value is multiplied with actual max possible value one pixel component
  12196. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12197. is 0.1 * 255 = 25.
  12198. @item hthreshold, h
  12199. Set high threshold for color component not represented on X or Y axis.
  12200. Values higher than this value will be ignored. Default is 1.
  12201. Note this value is multiplied with actual max possible value one pixel component
  12202. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12203. is 0.9 * 255 = 230.
  12204. @item colorspace, c
  12205. Set what kind of colorspace to use when drawing graticule.
  12206. @table @samp
  12207. @item auto
  12208. @item 601
  12209. @item 709
  12210. @end table
  12211. Default is auto.
  12212. @end table
  12213. @anchor{vidstabdetect}
  12214. @section vidstabdetect
  12215. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12216. @ref{vidstabtransform} for pass 2.
  12217. This filter generates a file with relative translation and rotation
  12218. transform information about subsequent frames, which is then used by
  12219. the @ref{vidstabtransform} filter.
  12220. To enable compilation of this filter you need to configure FFmpeg with
  12221. @code{--enable-libvidstab}.
  12222. This filter accepts the following options:
  12223. @table @option
  12224. @item result
  12225. Set the path to the file used to write the transforms information.
  12226. Default value is @file{transforms.trf}.
  12227. @item shakiness
  12228. Set how shaky the video is and how quick the camera is. It accepts an
  12229. integer in the range 1-10, a value of 1 means little shakiness, a
  12230. value of 10 means strong shakiness. Default value is 5.
  12231. @item accuracy
  12232. Set the accuracy of the detection process. It must be a value in the
  12233. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12234. accuracy. Default value is 15.
  12235. @item stepsize
  12236. Set stepsize of the search process. The region around minimum is
  12237. scanned with 1 pixel resolution. Default value is 6.
  12238. @item mincontrast
  12239. Set minimum contrast. Below this value a local measurement field is
  12240. discarded. Must be a floating point value in the range 0-1. Default
  12241. value is 0.3.
  12242. @item tripod
  12243. Set reference frame number for tripod mode.
  12244. If enabled, the motion of the frames is compared to a reference frame
  12245. in the filtered stream, identified by the specified number. The idea
  12246. is to compensate all movements in a more-or-less static scene and keep
  12247. the camera view absolutely still.
  12248. If set to 0, it is disabled. The frames are counted starting from 1.
  12249. @item show
  12250. Show fields and transforms in the resulting frames. It accepts an
  12251. integer in the range 0-2. Default value is 0, which disables any
  12252. visualization.
  12253. @end table
  12254. @subsection Examples
  12255. @itemize
  12256. @item
  12257. Use default values:
  12258. @example
  12259. vidstabdetect
  12260. @end example
  12261. @item
  12262. Analyze strongly shaky movie and put the results in file
  12263. @file{mytransforms.trf}:
  12264. @example
  12265. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12266. @end example
  12267. @item
  12268. Visualize the result of internal transformations in the resulting
  12269. video:
  12270. @example
  12271. vidstabdetect=show=1
  12272. @end example
  12273. @item
  12274. Analyze a video with medium shakiness using @command{ffmpeg}:
  12275. @example
  12276. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12277. @end example
  12278. @end itemize
  12279. @anchor{vidstabtransform}
  12280. @section vidstabtransform
  12281. Video stabilization/deshaking: pass 2 of 2,
  12282. see @ref{vidstabdetect} for pass 1.
  12283. Read a file with transform information for each frame and
  12284. apply/compensate them. Together with the @ref{vidstabdetect}
  12285. filter this can be used to deshake videos. See also
  12286. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12287. the @ref{unsharp} filter, see below.
  12288. To enable compilation of this filter you need to configure FFmpeg with
  12289. @code{--enable-libvidstab}.
  12290. @subsection Options
  12291. @table @option
  12292. @item input
  12293. Set path to the file used to read the transforms. Default value is
  12294. @file{transforms.trf}.
  12295. @item smoothing
  12296. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12297. camera movements. Default value is 10.
  12298. For example a number of 10 means that 21 frames are used (10 in the
  12299. past and 10 in the future) to smoothen the motion in the video. A
  12300. larger value leads to a smoother video, but limits the acceleration of
  12301. the camera (pan/tilt movements). 0 is a special case where a static
  12302. camera is simulated.
  12303. @item optalgo
  12304. Set the camera path optimization algorithm.
  12305. Accepted values are:
  12306. @table @samp
  12307. @item gauss
  12308. gaussian kernel low-pass filter on camera motion (default)
  12309. @item avg
  12310. averaging on transformations
  12311. @end table
  12312. @item maxshift
  12313. Set maximal number of pixels to translate frames. Default value is -1,
  12314. meaning no limit.
  12315. @item maxangle
  12316. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12317. value is -1, meaning no limit.
  12318. @item crop
  12319. Specify how to deal with borders that may be visible due to movement
  12320. compensation.
  12321. Available values are:
  12322. @table @samp
  12323. @item keep
  12324. keep image information from previous frame (default)
  12325. @item black
  12326. fill the border black
  12327. @end table
  12328. @item invert
  12329. Invert transforms if set to 1. Default value is 0.
  12330. @item relative
  12331. Consider transforms as relative to previous frame if set to 1,
  12332. absolute if set to 0. Default value is 0.
  12333. @item zoom
  12334. Set percentage to zoom. A positive value will result in a zoom-in
  12335. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12336. zoom).
  12337. @item optzoom
  12338. Set optimal zooming to avoid borders.
  12339. Accepted values are:
  12340. @table @samp
  12341. @item 0
  12342. disabled
  12343. @item 1
  12344. optimal static zoom value is determined (only very strong movements
  12345. will lead to visible borders) (default)
  12346. @item 2
  12347. optimal adaptive zoom value is determined (no borders will be
  12348. visible), see @option{zoomspeed}
  12349. @end table
  12350. Note that the value given at zoom is added to the one calculated here.
  12351. @item zoomspeed
  12352. Set percent to zoom maximally each frame (enabled when
  12353. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12354. 0.25.
  12355. @item interpol
  12356. Specify type of interpolation.
  12357. Available values are:
  12358. @table @samp
  12359. @item no
  12360. no interpolation
  12361. @item linear
  12362. linear only horizontal
  12363. @item bilinear
  12364. linear in both directions (default)
  12365. @item bicubic
  12366. cubic in both directions (slow)
  12367. @end table
  12368. @item tripod
  12369. Enable virtual tripod mode if set to 1, which is equivalent to
  12370. @code{relative=0:smoothing=0}. Default value is 0.
  12371. Use also @code{tripod} option of @ref{vidstabdetect}.
  12372. @item debug
  12373. Increase log verbosity if set to 1. Also the detected global motions
  12374. are written to the temporary file @file{global_motions.trf}. Default
  12375. value is 0.
  12376. @end table
  12377. @subsection Examples
  12378. @itemize
  12379. @item
  12380. Use @command{ffmpeg} for a typical stabilization with default values:
  12381. @example
  12382. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12383. @end example
  12384. Note the use of the @ref{unsharp} filter which is always recommended.
  12385. @item
  12386. Zoom in a bit more and load transform data from a given file:
  12387. @example
  12388. vidstabtransform=zoom=5:input="mytransforms.trf"
  12389. @end example
  12390. @item
  12391. Smoothen the video even more:
  12392. @example
  12393. vidstabtransform=smoothing=30
  12394. @end example
  12395. @end itemize
  12396. @section vflip
  12397. Flip the input video vertically.
  12398. For example, to vertically flip a video with @command{ffmpeg}:
  12399. @example
  12400. ffmpeg -i in.avi -vf "vflip" out.avi
  12401. @end example
  12402. @anchor{vignette}
  12403. @section vignette
  12404. Make or reverse a natural vignetting effect.
  12405. The filter accepts the following options:
  12406. @table @option
  12407. @item angle, a
  12408. Set lens angle expression as a number of radians.
  12409. The value is clipped in the @code{[0,PI/2]} range.
  12410. Default value: @code{"PI/5"}
  12411. @item x0
  12412. @item y0
  12413. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12414. by default.
  12415. @item mode
  12416. Set forward/backward mode.
  12417. Available modes are:
  12418. @table @samp
  12419. @item forward
  12420. The larger the distance from the central point, the darker the image becomes.
  12421. @item backward
  12422. The larger the distance from the central point, the brighter the image becomes.
  12423. This can be used to reverse a vignette effect, though there is no automatic
  12424. detection to extract the lens @option{angle} and other settings (yet). It can
  12425. also be used to create a burning effect.
  12426. @end table
  12427. Default value is @samp{forward}.
  12428. @item eval
  12429. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12430. It accepts the following values:
  12431. @table @samp
  12432. @item init
  12433. Evaluate expressions only once during the filter initialization.
  12434. @item frame
  12435. Evaluate expressions for each incoming frame. This is way slower than the
  12436. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12437. allows advanced dynamic expressions.
  12438. @end table
  12439. Default value is @samp{init}.
  12440. @item dither
  12441. Set dithering to reduce the circular banding effects. Default is @code{1}
  12442. (enabled).
  12443. @item aspect
  12444. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12445. Setting this value to the SAR of the input will make a rectangular vignetting
  12446. following the dimensions of the video.
  12447. Default is @code{1/1}.
  12448. @end table
  12449. @subsection Expressions
  12450. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12451. following parameters.
  12452. @table @option
  12453. @item w
  12454. @item h
  12455. input width and height
  12456. @item n
  12457. the number of input frame, starting from 0
  12458. @item pts
  12459. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12460. @var{TB} units, NAN if undefined
  12461. @item r
  12462. frame rate of the input video, NAN if the input frame rate is unknown
  12463. @item t
  12464. the PTS (Presentation TimeStamp) of the filtered video frame,
  12465. expressed in seconds, NAN if undefined
  12466. @item tb
  12467. time base of the input video
  12468. @end table
  12469. @subsection Examples
  12470. @itemize
  12471. @item
  12472. Apply simple strong vignetting effect:
  12473. @example
  12474. vignette=PI/4
  12475. @end example
  12476. @item
  12477. Make a flickering vignetting:
  12478. @example
  12479. vignette='PI/4+random(1)*PI/50':eval=frame
  12480. @end example
  12481. @end itemize
  12482. @section vmafmotion
  12483. Obtain the average vmaf motion score of a video.
  12484. It is one of the component filters of VMAF.
  12485. The obtained average motion score is printed through the logging system.
  12486. In the below example the input file @file{ref.mpg} is being processed and score
  12487. is computed.
  12488. @example
  12489. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12490. @end example
  12491. @section vstack
  12492. Stack input videos vertically.
  12493. All streams must be of same pixel format and of same width.
  12494. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12495. to create same output.
  12496. The filter accept the following option:
  12497. @table @option
  12498. @item inputs
  12499. Set number of input streams. Default is 2.
  12500. @item shortest
  12501. If set to 1, force the output to terminate when the shortest input
  12502. terminates. Default value is 0.
  12503. @end table
  12504. @section w3fdif
  12505. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12506. Deinterlacing Filter").
  12507. Based on the process described by Martin Weston for BBC R&D, and
  12508. implemented based on the de-interlace algorithm written by Jim
  12509. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12510. uses filter coefficients calculated by BBC R&D.
  12511. There are two sets of filter coefficients, so called "simple":
  12512. and "complex". Which set of filter coefficients is used can
  12513. be set by passing an optional parameter:
  12514. @table @option
  12515. @item filter
  12516. Set the interlacing filter coefficients. Accepts one of the following values:
  12517. @table @samp
  12518. @item simple
  12519. Simple filter coefficient set.
  12520. @item complex
  12521. More-complex filter coefficient set.
  12522. @end table
  12523. Default value is @samp{complex}.
  12524. @item deint
  12525. Specify which frames to deinterlace. Accept one of the following values:
  12526. @table @samp
  12527. @item all
  12528. Deinterlace all frames,
  12529. @item interlaced
  12530. Only deinterlace frames marked as interlaced.
  12531. @end table
  12532. Default value is @samp{all}.
  12533. @end table
  12534. @section waveform
  12535. Video waveform monitor.
  12536. The waveform monitor plots color component intensity. By default luminance
  12537. only. Each column of the waveform corresponds to a column of pixels in the
  12538. source video.
  12539. It accepts the following options:
  12540. @table @option
  12541. @item mode, m
  12542. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12543. In row mode, the graph on the left side represents color component value 0 and
  12544. the right side represents value = 255. In column mode, the top side represents
  12545. color component value = 0 and bottom side represents value = 255.
  12546. @item intensity, i
  12547. Set intensity. Smaller values are useful to find out how many values of the same
  12548. luminance are distributed across input rows/columns.
  12549. Default value is @code{0.04}. Allowed range is [0, 1].
  12550. @item mirror, r
  12551. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12552. In mirrored mode, higher values will be represented on the left
  12553. side for @code{row} mode and at the top for @code{column} mode. Default is
  12554. @code{1} (mirrored).
  12555. @item display, d
  12556. Set display mode.
  12557. It accepts the following values:
  12558. @table @samp
  12559. @item overlay
  12560. Presents information identical to that in the @code{parade}, except
  12561. that the graphs representing color components are superimposed directly
  12562. over one another.
  12563. This display mode makes it easier to spot relative differences or similarities
  12564. in overlapping areas of the color components that are supposed to be identical,
  12565. such as neutral whites, grays, or blacks.
  12566. @item stack
  12567. Display separate graph for the color components side by side in
  12568. @code{row} mode or one below the other in @code{column} mode.
  12569. @item parade
  12570. Display separate graph for the color components side by side in
  12571. @code{column} mode or one below the other in @code{row} mode.
  12572. Using this display mode makes it easy to spot color casts in the highlights
  12573. and shadows of an image, by comparing the contours of the top and the bottom
  12574. graphs of each waveform. Since whites, grays, and blacks are characterized
  12575. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12576. should display three waveforms of roughly equal width/height. If not, the
  12577. correction is easy to perform by making level adjustments the three waveforms.
  12578. @end table
  12579. Default is @code{stack}.
  12580. @item components, c
  12581. Set which color components to display. Default is 1, which means only luminance
  12582. or red color component if input is in RGB colorspace. If is set for example to
  12583. 7 it will display all 3 (if) available color components.
  12584. @item envelope, e
  12585. @table @samp
  12586. @item none
  12587. No envelope, this is default.
  12588. @item instant
  12589. Instant envelope, minimum and maximum values presented in graph will be easily
  12590. visible even with small @code{step} value.
  12591. @item peak
  12592. Hold minimum and maximum values presented in graph across time. This way you
  12593. can still spot out of range values without constantly looking at waveforms.
  12594. @item peak+instant
  12595. Peak and instant envelope combined together.
  12596. @end table
  12597. @item filter, f
  12598. @table @samp
  12599. @item lowpass
  12600. No filtering, this is default.
  12601. @item flat
  12602. Luma and chroma combined together.
  12603. @item aflat
  12604. Similar as above, but shows difference between blue and red chroma.
  12605. @item xflat
  12606. Similar as above, but use different colors.
  12607. @item chroma
  12608. Displays only chroma.
  12609. @item color
  12610. Displays actual color value on waveform.
  12611. @item acolor
  12612. Similar as above, but with luma showing frequency of chroma values.
  12613. @end table
  12614. @item graticule, g
  12615. Set which graticule to display.
  12616. @table @samp
  12617. @item none
  12618. Do not display graticule.
  12619. @item green
  12620. Display green graticule showing legal broadcast ranges.
  12621. @item orange
  12622. Display orange graticule showing legal broadcast ranges.
  12623. @end table
  12624. @item opacity, o
  12625. Set graticule opacity.
  12626. @item flags, fl
  12627. Set graticule flags.
  12628. @table @samp
  12629. @item numbers
  12630. Draw numbers above lines. By default enabled.
  12631. @item dots
  12632. Draw dots instead of lines.
  12633. @end table
  12634. @item scale, s
  12635. Set scale used for displaying graticule.
  12636. @table @samp
  12637. @item digital
  12638. @item millivolts
  12639. @item ire
  12640. @end table
  12641. Default is digital.
  12642. @item bgopacity, b
  12643. Set background opacity.
  12644. @end table
  12645. @section weave, doubleweave
  12646. The @code{weave} takes a field-based video input and join
  12647. each two sequential fields into single frame, producing a new double
  12648. height clip with half the frame rate and half the frame count.
  12649. The @code{doubleweave} works same as @code{weave} but without
  12650. halving frame rate and frame count.
  12651. It accepts the following option:
  12652. @table @option
  12653. @item first_field
  12654. Set first field. Available values are:
  12655. @table @samp
  12656. @item top, t
  12657. Set the frame as top-field-first.
  12658. @item bottom, b
  12659. Set the frame as bottom-field-first.
  12660. @end table
  12661. @end table
  12662. @subsection Examples
  12663. @itemize
  12664. @item
  12665. Interlace video using @ref{select} and @ref{separatefields} filter:
  12666. @example
  12667. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12668. @end example
  12669. @end itemize
  12670. @section xbr
  12671. Apply the xBR high-quality magnification filter which is designed for pixel
  12672. art. It follows a set of edge-detection rules, see
  12673. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12674. It accepts the following option:
  12675. @table @option
  12676. @item n
  12677. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12678. @code{3xBR} and @code{4} for @code{4xBR}.
  12679. Default is @code{3}.
  12680. @end table
  12681. @anchor{yadif}
  12682. @section yadif
  12683. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12684. filter").
  12685. It accepts the following parameters:
  12686. @table @option
  12687. @item mode
  12688. The interlacing mode to adopt. It accepts one of the following values:
  12689. @table @option
  12690. @item 0, send_frame
  12691. Output one frame for each frame.
  12692. @item 1, send_field
  12693. Output one frame for each field.
  12694. @item 2, send_frame_nospatial
  12695. Like @code{send_frame}, but it skips the spatial interlacing check.
  12696. @item 3, send_field_nospatial
  12697. Like @code{send_field}, but it skips the spatial interlacing check.
  12698. @end table
  12699. The default value is @code{send_frame}.
  12700. @item parity
  12701. The picture field parity assumed for the input interlaced video. It accepts one
  12702. of the following values:
  12703. @table @option
  12704. @item 0, tff
  12705. Assume the top field is first.
  12706. @item 1, bff
  12707. Assume the bottom field is first.
  12708. @item -1, auto
  12709. Enable automatic detection of field parity.
  12710. @end table
  12711. The default value is @code{auto}.
  12712. If the interlacing is unknown or the decoder does not export this information,
  12713. top field first will be assumed.
  12714. @item deint
  12715. Specify which frames to deinterlace. Accept one of the following
  12716. values:
  12717. @table @option
  12718. @item 0, all
  12719. Deinterlace all frames.
  12720. @item 1, interlaced
  12721. Only deinterlace frames marked as interlaced.
  12722. @end table
  12723. The default value is @code{all}.
  12724. @end table
  12725. @section zoompan
  12726. Apply Zoom & Pan effect.
  12727. This filter accepts the following options:
  12728. @table @option
  12729. @item zoom, z
  12730. Set the zoom expression. Default is 1.
  12731. @item x
  12732. @item y
  12733. Set the x and y expression. Default is 0.
  12734. @item d
  12735. Set the duration expression in number of frames.
  12736. This sets for how many number of frames effect will last for
  12737. single input image.
  12738. @item s
  12739. Set the output image size, default is 'hd720'.
  12740. @item fps
  12741. Set the output frame rate, default is '25'.
  12742. @end table
  12743. Each expression can contain the following constants:
  12744. @table @option
  12745. @item in_w, iw
  12746. Input width.
  12747. @item in_h, ih
  12748. Input height.
  12749. @item out_w, ow
  12750. Output width.
  12751. @item out_h, oh
  12752. Output height.
  12753. @item in
  12754. Input frame count.
  12755. @item on
  12756. Output frame count.
  12757. @item x
  12758. @item y
  12759. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12760. for current input frame.
  12761. @item px
  12762. @item py
  12763. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12764. not yet such frame (first input frame).
  12765. @item zoom
  12766. Last calculated zoom from 'z' expression for current input frame.
  12767. @item pzoom
  12768. Last calculated zoom of last output frame of previous input frame.
  12769. @item duration
  12770. Number of output frames for current input frame. Calculated from 'd' expression
  12771. for each input frame.
  12772. @item pduration
  12773. number of output frames created for previous input frame
  12774. @item a
  12775. Rational number: input width / input height
  12776. @item sar
  12777. sample aspect ratio
  12778. @item dar
  12779. display aspect ratio
  12780. @end table
  12781. @subsection Examples
  12782. @itemize
  12783. @item
  12784. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12785. @example
  12786. 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
  12787. @end example
  12788. @item
  12789. Zoom-in up to 1.5 and pan always at center of picture:
  12790. @example
  12791. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12792. @end example
  12793. @item
  12794. Same as above but without pausing:
  12795. @example
  12796. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12797. @end example
  12798. @end itemize
  12799. @anchor{zscale}
  12800. @section zscale
  12801. Scale (resize) the input video, using the z.lib library:
  12802. https://github.com/sekrit-twc/zimg.
  12803. The zscale filter forces the output display aspect ratio to be the same
  12804. as the input, by changing the output sample aspect ratio.
  12805. If the input image format is different from the format requested by
  12806. the next filter, the zscale filter will convert the input to the
  12807. requested format.
  12808. @subsection Options
  12809. The filter accepts the following options.
  12810. @table @option
  12811. @item width, w
  12812. @item height, h
  12813. Set the output video dimension expression. Default value is the input
  12814. dimension.
  12815. If the @var{width} or @var{w} value is 0, the input width is used for
  12816. the output. If the @var{height} or @var{h} value is 0, the input height
  12817. is used for the output.
  12818. If one and only one of the values is -n with n >= 1, the zscale filter
  12819. will use a value that maintains the aspect ratio of the input image,
  12820. calculated from the other specified dimension. After that it will,
  12821. however, make sure that the calculated dimension is divisible by n and
  12822. adjust the value if necessary.
  12823. If both values are -n with n >= 1, the behavior will be identical to
  12824. both values being set to 0 as previously detailed.
  12825. See below for the list of accepted constants for use in the dimension
  12826. expression.
  12827. @item size, s
  12828. Set the video size. For the syntax of this option, check the
  12829. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12830. @item dither, d
  12831. Set the dither type.
  12832. Possible values are:
  12833. @table @var
  12834. @item none
  12835. @item ordered
  12836. @item random
  12837. @item error_diffusion
  12838. @end table
  12839. Default is none.
  12840. @item filter, f
  12841. Set the resize filter type.
  12842. Possible values are:
  12843. @table @var
  12844. @item point
  12845. @item bilinear
  12846. @item bicubic
  12847. @item spline16
  12848. @item spline36
  12849. @item lanczos
  12850. @end table
  12851. Default is bilinear.
  12852. @item range, r
  12853. Set the color range.
  12854. Possible values are:
  12855. @table @var
  12856. @item input
  12857. @item limited
  12858. @item full
  12859. @end table
  12860. Default is same as input.
  12861. @item primaries, p
  12862. Set the color primaries.
  12863. Possible values are:
  12864. @table @var
  12865. @item input
  12866. @item 709
  12867. @item unspecified
  12868. @item 170m
  12869. @item 240m
  12870. @item 2020
  12871. @end table
  12872. Default is same as input.
  12873. @item transfer, t
  12874. Set the transfer characteristics.
  12875. Possible values are:
  12876. @table @var
  12877. @item input
  12878. @item 709
  12879. @item unspecified
  12880. @item 601
  12881. @item linear
  12882. @item 2020_10
  12883. @item 2020_12
  12884. @item smpte2084
  12885. @item iec61966-2-1
  12886. @item arib-std-b67
  12887. @end table
  12888. Default is same as input.
  12889. @item matrix, m
  12890. Set the colorspace matrix.
  12891. Possible value are:
  12892. @table @var
  12893. @item input
  12894. @item 709
  12895. @item unspecified
  12896. @item 470bg
  12897. @item 170m
  12898. @item 2020_ncl
  12899. @item 2020_cl
  12900. @end table
  12901. Default is same as input.
  12902. @item rangein, rin
  12903. Set the input color range.
  12904. Possible values are:
  12905. @table @var
  12906. @item input
  12907. @item limited
  12908. @item full
  12909. @end table
  12910. Default is same as input.
  12911. @item primariesin, pin
  12912. Set the input color primaries.
  12913. Possible values are:
  12914. @table @var
  12915. @item input
  12916. @item 709
  12917. @item unspecified
  12918. @item 170m
  12919. @item 240m
  12920. @item 2020
  12921. @end table
  12922. Default is same as input.
  12923. @item transferin, tin
  12924. Set the input transfer characteristics.
  12925. Possible values are:
  12926. @table @var
  12927. @item input
  12928. @item 709
  12929. @item unspecified
  12930. @item 601
  12931. @item linear
  12932. @item 2020_10
  12933. @item 2020_12
  12934. @end table
  12935. Default is same as input.
  12936. @item matrixin, min
  12937. Set the input colorspace matrix.
  12938. Possible value are:
  12939. @table @var
  12940. @item input
  12941. @item 709
  12942. @item unspecified
  12943. @item 470bg
  12944. @item 170m
  12945. @item 2020_ncl
  12946. @item 2020_cl
  12947. @end table
  12948. @item chromal, c
  12949. Set the output chroma location.
  12950. Possible values are:
  12951. @table @var
  12952. @item input
  12953. @item left
  12954. @item center
  12955. @item topleft
  12956. @item top
  12957. @item bottomleft
  12958. @item bottom
  12959. @end table
  12960. @item chromalin, cin
  12961. Set the input chroma location.
  12962. Possible values are:
  12963. @table @var
  12964. @item input
  12965. @item left
  12966. @item center
  12967. @item topleft
  12968. @item top
  12969. @item bottomleft
  12970. @item bottom
  12971. @end table
  12972. @item npl
  12973. Set the nominal peak luminance.
  12974. @end table
  12975. The values of the @option{w} and @option{h} options are expressions
  12976. containing the following constants:
  12977. @table @var
  12978. @item in_w
  12979. @item in_h
  12980. The input width and height
  12981. @item iw
  12982. @item ih
  12983. These are the same as @var{in_w} and @var{in_h}.
  12984. @item out_w
  12985. @item out_h
  12986. The output (scaled) width and height
  12987. @item ow
  12988. @item oh
  12989. These are the same as @var{out_w} and @var{out_h}
  12990. @item a
  12991. The same as @var{iw} / @var{ih}
  12992. @item sar
  12993. input sample aspect ratio
  12994. @item dar
  12995. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12996. @item hsub
  12997. @item vsub
  12998. horizontal and vertical input chroma subsample values. For example for the
  12999. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13000. @item ohsub
  13001. @item ovsub
  13002. horizontal and vertical output chroma subsample values. For example for the
  13003. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13004. @end table
  13005. @table @option
  13006. @end table
  13007. @c man end VIDEO FILTERS
  13008. @chapter Video Sources
  13009. @c man begin VIDEO SOURCES
  13010. Below is a description of the currently available video sources.
  13011. @section buffer
  13012. Buffer video frames, and make them available to the filter chain.
  13013. This source is mainly intended for a programmatic use, in particular
  13014. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13015. It accepts the following parameters:
  13016. @table @option
  13017. @item video_size
  13018. Specify the size (width and height) of the buffered video frames. For the
  13019. syntax of this option, check the
  13020. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13021. @item width
  13022. The input video width.
  13023. @item height
  13024. The input video height.
  13025. @item pix_fmt
  13026. A string representing the pixel format of the buffered video frames.
  13027. It may be a number corresponding to a pixel format, or a pixel format
  13028. name.
  13029. @item time_base
  13030. Specify the timebase assumed by the timestamps of the buffered frames.
  13031. @item frame_rate
  13032. Specify the frame rate expected for the video stream.
  13033. @item pixel_aspect, sar
  13034. The sample (pixel) aspect ratio of the input video.
  13035. @item sws_param
  13036. Specify the optional parameters to be used for the scale filter which
  13037. is automatically inserted when an input change is detected in the
  13038. input size or format.
  13039. @item hw_frames_ctx
  13040. When using a hardware pixel format, this should be a reference to an
  13041. AVHWFramesContext describing input frames.
  13042. @end table
  13043. For example:
  13044. @example
  13045. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13046. @end example
  13047. will instruct the source to accept video frames with size 320x240 and
  13048. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13049. square pixels (1:1 sample aspect ratio).
  13050. Since the pixel format with name "yuv410p" corresponds to the number 6
  13051. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13052. this example corresponds to:
  13053. @example
  13054. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13055. @end example
  13056. Alternatively, the options can be specified as a flat string, but this
  13057. syntax is deprecated:
  13058. @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}]
  13059. @section cellauto
  13060. Create a pattern generated by an elementary cellular automaton.
  13061. The initial state of the cellular automaton can be defined through the
  13062. @option{filename} and @option{pattern} options. If such options are
  13063. not specified an initial state is created randomly.
  13064. At each new frame a new row in the video is filled with the result of
  13065. the cellular automaton next generation. The behavior when the whole
  13066. frame is filled is defined by the @option{scroll} option.
  13067. This source accepts the following options:
  13068. @table @option
  13069. @item filename, f
  13070. Read the initial cellular automaton state, i.e. the starting row, from
  13071. the specified file.
  13072. In the file, each non-whitespace character is considered an alive
  13073. cell, a newline will terminate the row, and further characters in the
  13074. file will be ignored.
  13075. @item pattern, p
  13076. Read the initial cellular automaton state, i.e. the starting row, from
  13077. the specified string.
  13078. Each non-whitespace character in the string is considered an alive
  13079. cell, a newline will terminate the row, and further characters in the
  13080. string will be ignored.
  13081. @item rate, r
  13082. Set the video rate, that is the number of frames generated per second.
  13083. Default is 25.
  13084. @item random_fill_ratio, ratio
  13085. Set the random fill ratio for the initial cellular automaton row. It
  13086. is a floating point number value ranging from 0 to 1, defaults to
  13087. 1/PHI.
  13088. This option is ignored when a file or a pattern is specified.
  13089. @item random_seed, seed
  13090. Set the seed for filling randomly the initial row, must be an integer
  13091. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13092. set to -1, the filter will try to use a good random seed on a best
  13093. effort basis.
  13094. @item rule
  13095. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13096. Default value is 110.
  13097. @item size, s
  13098. Set the size of the output video. For the syntax of this option, check the
  13099. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13100. If @option{filename} or @option{pattern} is specified, the size is set
  13101. by default to the width of the specified initial state row, and the
  13102. height is set to @var{width} * PHI.
  13103. If @option{size} is set, it must contain the width of the specified
  13104. pattern string, and the specified pattern will be centered in the
  13105. larger row.
  13106. If a filename or a pattern string is not specified, the size value
  13107. defaults to "320x518" (used for a randomly generated initial state).
  13108. @item scroll
  13109. If set to 1, scroll the output upward when all the rows in the output
  13110. have been already filled. If set to 0, the new generated row will be
  13111. written over the top row just after the bottom row is filled.
  13112. Defaults to 1.
  13113. @item start_full, full
  13114. If set to 1, completely fill the output with generated rows before
  13115. outputting the first frame.
  13116. This is the default behavior, for disabling set the value to 0.
  13117. @item stitch
  13118. If set to 1, stitch the left and right row edges together.
  13119. This is the default behavior, for disabling set the value to 0.
  13120. @end table
  13121. @subsection Examples
  13122. @itemize
  13123. @item
  13124. Read the initial state from @file{pattern}, and specify an output of
  13125. size 200x400.
  13126. @example
  13127. cellauto=f=pattern:s=200x400
  13128. @end example
  13129. @item
  13130. Generate a random initial row with a width of 200 cells, with a fill
  13131. ratio of 2/3:
  13132. @example
  13133. cellauto=ratio=2/3:s=200x200
  13134. @end example
  13135. @item
  13136. Create a pattern generated by rule 18 starting by a single alive cell
  13137. centered on an initial row with width 100:
  13138. @example
  13139. cellauto=p=@@:s=100x400:full=0:rule=18
  13140. @end example
  13141. @item
  13142. Specify a more elaborated initial pattern:
  13143. @example
  13144. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13145. @end example
  13146. @end itemize
  13147. @anchor{coreimagesrc}
  13148. @section coreimagesrc
  13149. Video source generated on GPU using Apple's CoreImage API on OSX.
  13150. This video source is a specialized version of the @ref{coreimage} video filter.
  13151. Use a core image generator at the beginning of the applied filterchain to
  13152. generate the content.
  13153. The coreimagesrc video source accepts the following options:
  13154. @table @option
  13155. @item list_generators
  13156. List all available generators along with all their respective options as well as
  13157. possible minimum and maximum values along with the default values.
  13158. @example
  13159. list_generators=true
  13160. @end example
  13161. @item size, s
  13162. Specify the size of the sourced video. For the syntax of this option, check the
  13163. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13164. The default value is @code{320x240}.
  13165. @item rate, r
  13166. Specify the frame rate of the sourced video, as the number of frames
  13167. generated per second. It has to be a string in the format
  13168. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13169. number or a valid video frame rate abbreviation. The default value is
  13170. "25".
  13171. @item sar
  13172. Set the sample aspect ratio of the sourced video.
  13173. @item duration, d
  13174. Set the duration of the sourced video. See
  13175. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13176. for the accepted syntax.
  13177. If not specified, or the expressed duration is negative, the video is
  13178. supposed to be generated forever.
  13179. @end table
  13180. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13181. A complete filterchain can be used for further processing of the
  13182. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13183. and examples for details.
  13184. @subsection Examples
  13185. @itemize
  13186. @item
  13187. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13188. given as complete and escaped command-line for Apple's standard bash shell:
  13189. @example
  13190. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13191. @end example
  13192. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13193. need for a nullsrc video source.
  13194. @end itemize
  13195. @section mandelbrot
  13196. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13197. point specified with @var{start_x} and @var{start_y}.
  13198. This source accepts the following options:
  13199. @table @option
  13200. @item end_pts
  13201. Set the terminal pts value. Default value is 400.
  13202. @item end_scale
  13203. Set the terminal scale value.
  13204. Must be a floating point value. Default value is 0.3.
  13205. @item inner
  13206. Set the inner coloring mode, that is the algorithm used to draw the
  13207. Mandelbrot fractal internal region.
  13208. It shall assume one of the following values:
  13209. @table @option
  13210. @item black
  13211. Set black mode.
  13212. @item convergence
  13213. Show time until convergence.
  13214. @item mincol
  13215. Set color based on point closest to the origin of the iterations.
  13216. @item period
  13217. Set period mode.
  13218. @end table
  13219. Default value is @var{mincol}.
  13220. @item bailout
  13221. Set the bailout value. Default value is 10.0.
  13222. @item maxiter
  13223. Set the maximum of iterations performed by the rendering
  13224. algorithm. Default value is 7189.
  13225. @item outer
  13226. Set outer coloring mode.
  13227. It shall assume one of following values:
  13228. @table @option
  13229. @item iteration_count
  13230. Set iteration cound mode.
  13231. @item normalized_iteration_count
  13232. set normalized iteration count mode.
  13233. @end table
  13234. Default value is @var{normalized_iteration_count}.
  13235. @item rate, r
  13236. Set frame rate, expressed as number of frames per second. Default
  13237. value is "25".
  13238. @item size, s
  13239. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13240. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13241. @item start_scale
  13242. Set the initial scale value. Default value is 3.0.
  13243. @item start_x
  13244. Set the initial x position. Must be a floating point value between
  13245. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13246. @item start_y
  13247. Set the initial y position. Must be a floating point value between
  13248. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13249. @end table
  13250. @section mptestsrc
  13251. Generate various test patterns, as generated by the MPlayer test filter.
  13252. The size of the generated video is fixed, and is 256x256.
  13253. This source is useful in particular for testing encoding features.
  13254. This source accepts the following options:
  13255. @table @option
  13256. @item rate, r
  13257. Specify the frame rate of the sourced video, as the number of frames
  13258. generated per second. It has to be a string in the format
  13259. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13260. number or a valid video frame rate abbreviation. The default value is
  13261. "25".
  13262. @item duration, d
  13263. Set the duration of the sourced video. See
  13264. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13265. for the accepted syntax.
  13266. If not specified, or the expressed duration is negative, the video is
  13267. supposed to be generated forever.
  13268. @item test, t
  13269. Set the number or the name of the test to perform. Supported tests are:
  13270. @table @option
  13271. @item dc_luma
  13272. @item dc_chroma
  13273. @item freq_luma
  13274. @item freq_chroma
  13275. @item amp_luma
  13276. @item amp_chroma
  13277. @item cbp
  13278. @item mv
  13279. @item ring1
  13280. @item ring2
  13281. @item all
  13282. @end table
  13283. Default value is "all", which will cycle through the list of all tests.
  13284. @end table
  13285. Some examples:
  13286. @example
  13287. mptestsrc=t=dc_luma
  13288. @end example
  13289. will generate a "dc_luma" test pattern.
  13290. @section frei0r_src
  13291. Provide a frei0r source.
  13292. To enable compilation of this filter you need to install the frei0r
  13293. header and configure FFmpeg with @code{--enable-frei0r}.
  13294. This source accepts the following parameters:
  13295. @table @option
  13296. @item size
  13297. The size of the video to generate. For the syntax of this option, check the
  13298. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13299. @item framerate
  13300. The framerate of the generated video. It may be a string of the form
  13301. @var{num}/@var{den} or a frame rate abbreviation.
  13302. @item filter_name
  13303. The name to the frei0r source to load. For more information regarding frei0r and
  13304. how to set the parameters, read the @ref{frei0r} section in the video filters
  13305. documentation.
  13306. @item filter_params
  13307. A '|'-separated list of parameters to pass to the frei0r source.
  13308. @end table
  13309. For example, to generate a frei0r partik0l source with size 200x200
  13310. and frame rate 10 which is overlaid on the overlay filter main input:
  13311. @example
  13312. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13313. @end example
  13314. @section life
  13315. Generate a life pattern.
  13316. This source is based on a generalization of John Conway's life game.
  13317. The sourced input represents a life grid, each pixel represents a cell
  13318. which can be in one of two possible states, alive or dead. Every cell
  13319. interacts with its eight neighbours, which are the cells that are
  13320. horizontally, vertically, or diagonally adjacent.
  13321. At each interaction the grid evolves according to the adopted rule,
  13322. which specifies the number of neighbor alive cells which will make a
  13323. cell stay alive or born. The @option{rule} option allows one to specify
  13324. the rule to adopt.
  13325. This source accepts the following options:
  13326. @table @option
  13327. @item filename, f
  13328. Set the file from which to read the initial grid state. In the file,
  13329. each non-whitespace character is considered an alive cell, and newline
  13330. is used to delimit the end of each row.
  13331. If this option is not specified, the initial grid is generated
  13332. randomly.
  13333. @item rate, r
  13334. Set the video rate, that is the number of frames generated per second.
  13335. Default is 25.
  13336. @item random_fill_ratio, ratio
  13337. Set the random fill ratio for the initial random grid. It is a
  13338. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13339. It is ignored when a file is specified.
  13340. @item random_seed, seed
  13341. Set the seed for filling the initial random grid, must be an integer
  13342. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13343. set to -1, the filter will try to use a good random seed on a best
  13344. effort basis.
  13345. @item rule
  13346. Set the life rule.
  13347. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13348. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13349. @var{NS} specifies the number of alive neighbor cells which make a
  13350. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13351. which make a dead cell to become alive (i.e. to "born").
  13352. "s" and "b" can be used in place of "S" and "B", respectively.
  13353. Alternatively a rule can be specified by an 18-bits integer. The 9
  13354. high order bits are used to encode the next cell state if it is alive
  13355. for each number of neighbor alive cells, the low order bits specify
  13356. the rule for "borning" new cells. Higher order bits encode for an
  13357. higher number of neighbor cells.
  13358. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13359. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13360. Default value is "S23/B3", which is the original Conway's game of life
  13361. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13362. cells, and will born a new cell if there are three alive cells around
  13363. a dead cell.
  13364. @item size, s
  13365. Set the size of the output video. For the syntax of this option, check the
  13366. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13367. If @option{filename} is specified, the size is set by default to the
  13368. same size of the input file. If @option{size} is set, it must contain
  13369. the size specified in the input file, and the initial grid defined in
  13370. that file is centered in the larger resulting area.
  13371. If a filename is not specified, the size value defaults to "320x240"
  13372. (used for a randomly generated initial grid).
  13373. @item stitch
  13374. If set to 1, stitch the left and right grid edges together, and the
  13375. top and bottom edges also. Defaults to 1.
  13376. @item mold
  13377. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13378. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13379. value from 0 to 255.
  13380. @item life_color
  13381. Set the color of living (or new born) cells.
  13382. @item death_color
  13383. Set the color of dead cells. If @option{mold} is set, this is the first color
  13384. used to represent a dead cell.
  13385. @item mold_color
  13386. Set mold color, for definitely dead and moldy cells.
  13387. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13388. ffmpeg-utils manual,ffmpeg-utils}.
  13389. @end table
  13390. @subsection Examples
  13391. @itemize
  13392. @item
  13393. Read a grid from @file{pattern}, and center it on a grid of size
  13394. 300x300 pixels:
  13395. @example
  13396. life=f=pattern:s=300x300
  13397. @end example
  13398. @item
  13399. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13400. @example
  13401. life=ratio=2/3:s=200x200
  13402. @end example
  13403. @item
  13404. Specify a custom rule for evolving a randomly generated grid:
  13405. @example
  13406. life=rule=S14/B34
  13407. @end example
  13408. @item
  13409. Full example with slow death effect (mold) using @command{ffplay}:
  13410. @example
  13411. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13412. @end example
  13413. @end itemize
  13414. @anchor{allrgb}
  13415. @anchor{allyuv}
  13416. @anchor{color}
  13417. @anchor{haldclutsrc}
  13418. @anchor{nullsrc}
  13419. @anchor{rgbtestsrc}
  13420. @anchor{smptebars}
  13421. @anchor{smptehdbars}
  13422. @anchor{testsrc}
  13423. @anchor{testsrc2}
  13424. @anchor{yuvtestsrc}
  13425. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13426. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13427. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13428. The @code{color} source provides an uniformly colored input.
  13429. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13430. @ref{haldclut} filter.
  13431. The @code{nullsrc} source returns unprocessed video frames. It is
  13432. mainly useful to be employed in analysis / debugging tools, or as the
  13433. source for filters which ignore the input data.
  13434. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13435. detecting RGB vs BGR issues. You should see a red, green and blue
  13436. stripe from top to bottom.
  13437. The @code{smptebars} source generates a color bars pattern, based on
  13438. the SMPTE Engineering Guideline EG 1-1990.
  13439. The @code{smptehdbars} source generates a color bars pattern, based on
  13440. the SMPTE RP 219-2002.
  13441. The @code{testsrc} source generates a test video pattern, showing a
  13442. color pattern, a scrolling gradient and a timestamp. This is mainly
  13443. intended for testing purposes.
  13444. The @code{testsrc2} source is similar to testsrc, but supports more
  13445. pixel formats instead of just @code{rgb24}. This allows using it as an
  13446. input for other tests without requiring a format conversion.
  13447. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13448. see a y, cb and cr stripe from top to bottom.
  13449. The sources accept the following parameters:
  13450. @table @option
  13451. @item level
  13452. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13453. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13454. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13455. coded on a @code{1/(N*N)} scale.
  13456. @item color, c
  13457. Specify the color of the source, only available in the @code{color}
  13458. source. For the syntax of this option, check the
  13459. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13460. @item size, s
  13461. Specify the size of the sourced video. For the syntax of this option, check the
  13462. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13463. The default value is @code{320x240}.
  13464. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13465. @code{haldclutsrc} filters.
  13466. @item rate, r
  13467. Specify the frame rate of the sourced video, as the number of frames
  13468. generated per second. It has to be a string in the format
  13469. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13470. number or a valid video frame rate abbreviation. The default value is
  13471. "25".
  13472. @item duration, d
  13473. Set the duration of the sourced video. See
  13474. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13475. for the accepted syntax.
  13476. If not specified, or the expressed duration is negative, the video is
  13477. supposed to be generated forever.
  13478. @item sar
  13479. Set the sample aspect ratio of the sourced video.
  13480. @item alpha
  13481. Specify the alpha (opacity) of the background, only available in the
  13482. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13483. 255 (fully opaque, the default).
  13484. @item decimals, n
  13485. Set the number of decimals to show in the timestamp, only available in the
  13486. @code{testsrc} source.
  13487. The displayed timestamp value will correspond to the original
  13488. timestamp value multiplied by the power of 10 of the specified
  13489. value. Default value is 0.
  13490. @end table
  13491. @subsection Examples
  13492. @itemize
  13493. @item
  13494. Generate a video with a duration of 5.3 seconds, with size
  13495. 176x144 and a frame rate of 10 frames per second:
  13496. @example
  13497. testsrc=duration=5.3:size=qcif:rate=10
  13498. @end example
  13499. @item
  13500. The following graph description will generate a red source
  13501. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13502. frames per second:
  13503. @example
  13504. color=c=red@@0.2:s=qcif:r=10
  13505. @end example
  13506. @item
  13507. If the input content is to be ignored, @code{nullsrc} can be used. The
  13508. following command generates noise in the luminance plane by employing
  13509. the @code{geq} filter:
  13510. @example
  13511. nullsrc=s=256x256, geq=random(1)*255:128:128
  13512. @end example
  13513. @end itemize
  13514. @subsection Commands
  13515. The @code{color} source supports the following commands:
  13516. @table @option
  13517. @item c, color
  13518. Set the color of the created image. Accepts the same syntax of the
  13519. corresponding @option{color} option.
  13520. @end table
  13521. @section openclsrc
  13522. Generate video using an OpenCL program.
  13523. @table @option
  13524. @item source
  13525. OpenCL program source file.
  13526. @item kernel
  13527. Kernel name in program.
  13528. @item size, s
  13529. Size of frames to generate. This must be set.
  13530. @item format
  13531. Pixel format to use for the generated frames. This must be set.
  13532. @item rate, r
  13533. Number of frames generated every second. Default value is '25'.
  13534. @end table
  13535. For details of how the program loading works, see the @ref{program_opencl}
  13536. filter.
  13537. Example programs:
  13538. @itemize
  13539. @item
  13540. Generate a colour ramp by setting pixel values from the position of the pixel
  13541. in the output image. (Note that this will work with all pixel formats, but
  13542. the generated output will not be the same.)
  13543. @verbatim
  13544. __kernel void ramp(__write_only image2d_t dst,
  13545. unsigned int index)
  13546. {
  13547. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13548. float4 val;
  13549. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13550. write_imagef(dst, loc, val);
  13551. }
  13552. @end verbatim
  13553. @item
  13554. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13555. @verbatim
  13556. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13557. unsigned int index)
  13558. {
  13559. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13560. float4 value = 0.0f;
  13561. int x = loc.x + index;
  13562. int y = loc.y + index;
  13563. while (x > 0 || y > 0) {
  13564. if (x % 3 == 1 && y % 3 == 1) {
  13565. value = 1.0f;
  13566. break;
  13567. }
  13568. x /= 3;
  13569. y /= 3;
  13570. }
  13571. write_imagef(dst, loc, value);
  13572. }
  13573. @end verbatim
  13574. @end itemize
  13575. @c man end VIDEO SOURCES
  13576. @chapter Video Sinks
  13577. @c man begin VIDEO SINKS
  13578. Below is a description of the currently available video sinks.
  13579. @section buffersink
  13580. Buffer video frames, and make them available to the end of the filter
  13581. graph.
  13582. This sink is mainly intended for programmatic use, in particular
  13583. through the interface defined in @file{libavfilter/buffersink.h}
  13584. or the options system.
  13585. It accepts a pointer to an AVBufferSinkContext structure, which
  13586. defines the incoming buffers' formats, to be passed as the opaque
  13587. parameter to @code{avfilter_init_filter} for initialization.
  13588. @section nullsink
  13589. Null video sink: do absolutely nothing with the input video. It is
  13590. mainly useful as a template and for use in analysis / debugging
  13591. tools.
  13592. @c man end VIDEO SINKS
  13593. @chapter Multimedia Filters
  13594. @c man begin MULTIMEDIA FILTERS
  13595. Below is a description of the currently available multimedia filters.
  13596. @section abitscope
  13597. Convert input audio to a video output, displaying the audio bit scope.
  13598. The filter accepts the following options:
  13599. @table @option
  13600. @item rate, r
  13601. Set frame rate, expressed as number of frames per second. Default
  13602. value is "25".
  13603. @item size, s
  13604. Specify the video size for the output. For the syntax of this option, check the
  13605. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13606. Default value is @code{1024x256}.
  13607. @item colors
  13608. Specify list of colors separated by space or by '|' which will be used to
  13609. draw channels. Unrecognized or missing colors will be replaced
  13610. by white color.
  13611. @end table
  13612. @section ahistogram
  13613. Convert input audio to a video output, displaying the volume histogram.
  13614. The filter accepts the following options:
  13615. @table @option
  13616. @item dmode
  13617. Specify how histogram is calculated.
  13618. It accepts the following values:
  13619. @table @samp
  13620. @item single
  13621. Use single histogram for all channels.
  13622. @item separate
  13623. Use separate histogram for each channel.
  13624. @end table
  13625. Default is @code{single}.
  13626. @item rate, r
  13627. Set frame rate, expressed as number of frames per second. Default
  13628. value is "25".
  13629. @item size, s
  13630. Specify the video size for the output. For the syntax of this option, check the
  13631. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13632. Default value is @code{hd720}.
  13633. @item scale
  13634. Set display scale.
  13635. It accepts the following values:
  13636. @table @samp
  13637. @item log
  13638. logarithmic
  13639. @item sqrt
  13640. square root
  13641. @item cbrt
  13642. cubic root
  13643. @item lin
  13644. linear
  13645. @item rlog
  13646. reverse logarithmic
  13647. @end table
  13648. Default is @code{log}.
  13649. @item ascale
  13650. Set amplitude scale.
  13651. It accepts the following values:
  13652. @table @samp
  13653. @item log
  13654. logarithmic
  13655. @item lin
  13656. linear
  13657. @end table
  13658. Default is @code{log}.
  13659. @item acount
  13660. Set how much frames to accumulate in histogram.
  13661. Defauls is 1. Setting this to -1 accumulates all frames.
  13662. @item rheight
  13663. Set histogram ratio of window height.
  13664. @item slide
  13665. Set sonogram sliding.
  13666. It accepts the following values:
  13667. @table @samp
  13668. @item replace
  13669. replace old rows with new ones.
  13670. @item scroll
  13671. scroll from top to bottom.
  13672. @end table
  13673. Default is @code{replace}.
  13674. @end table
  13675. @section aphasemeter
  13676. Convert input audio to a video output, displaying the audio phase.
  13677. The filter accepts the following options:
  13678. @table @option
  13679. @item rate, r
  13680. Set the output frame rate. Default value is @code{25}.
  13681. @item size, s
  13682. Set the video size for the output. For the syntax of this option, check the
  13683. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13684. Default value is @code{800x400}.
  13685. @item rc
  13686. @item gc
  13687. @item bc
  13688. Specify the red, green, blue contrast. Default values are @code{2},
  13689. @code{7} and @code{1}.
  13690. Allowed range is @code{[0, 255]}.
  13691. @item mpc
  13692. Set color which will be used for drawing median phase. If color is
  13693. @code{none} which is default, no median phase value will be drawn.
  13694. @item video
  13695. Enable video output. Default is enabled.
  13696. @end table
  13697. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13698. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13699. The @code{-1} means left and right channels are completely out of phase and
  13700. @code{1} means channels are in phase.
  13701. @section avectorscope
  13702. Convert input audio to a video output, representing the audio vector
  13703. scope.
  13704. The filter is used to measure the difference between channels of stereo
  13705. audio stream. A monoaural signal, consisting of identical left and right
  13706. signal, results in straight vertical line. Any stereo separation is visible
  13707. as a deviation from this line, creating a Lissajous figure.
  13708. If the straight (or deviation from it) but horizontal line appears this
  13709. indicates that the left and right channels are out of phase.
  13710. The filter accepts the following options:
  13711. @table @option
  13712. @item mode, m
  13713. Set the vectorscope mode.
  13714. Available values are:
  13715. @table @samp
  13716. @item lissajous
  13717. Lissajous rotated by 45 degrees.
  13718. @item lissajous_xy
  13719. Same as above but not rotated.
  13720. @item polar
  13721. Shape resembling half of circle.
  13722. @end table
  13723. Default value is @samp{lissajous}.
  13724. @item size, s
  13725. Set the video size for the output. For the syntax of this option, check the
  13726. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13727. Default value is @code{400x400}.
  13728. @item rate, r
  13729. Set the output frame rate. Default value is @code{25}.
  13730. @item rc
  13731. @item gc
  13732. @item bc
  13733. @item ac
  13734. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13735. @code{160}, @code{80} and @code{255}.
  13736. Allowed range is @code{[0, 255]}.
  13737. @item rf
  13738. @item gf
  13739. @item bf
  13740. @item af
  13741. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13742. @code{10}, @code{5} and @code{5}.
  13743. Allowed range is @code{[0, 255]}.
  13744. @item zoom
  13745. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13746. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13747. @item draw
  13748. Set the vectorscope drawing mode.
  13749. Available values are:
  13750. @table @samp
  13751. @item dot
  13752. Draw dot for each sample.
  13753. @item line
  13754. Draw line between previous and current sample.
  13755. @end table
  13756. Default value is @samp{dot}.
  13757. @item scale
  13758. Specify amplitude scale of audio samples.
  13759. Available values are:
  13760. @table @samp
  13761. @item lin
  13762. Linear.
  13763. @item sqrt
  13764. Square root.
  13765. @item cbrt
  13766. Cubic root.
  13767. @item log
  13768. Logarithmic.
  13769. @end table
  13770. @item swap
  13771. Swap left channel axis with right channel axis.
  13772. @item mirror
  13773. Mirror axis.
  13774. @table @samp
  13775. @item none
  13776. No mirror.
  13777. @item x
  13778. Mirror only x axis.
  13779. @item y
  13780. Mirror only y axis.
  13781. @item xy
  13782. Mirror both axis.
  13783. @end table
  13784. @end table
  13785. @subsection Examples
  13786. @itemize
  13787. @item
  13788. Complete example using @command{ffplay}:
  13789. @example
  13790. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13791. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13792. @end example
  13793. @end itemize
  13794. @section bench, abench
  13795. Benchmark part of a filtergraph.
  13796. The filter accepts the following options:
  13797. @table @option
  13798. @item action
  13799. Start or stop a timer.
  13800. Available values are:
  13801. @table @samp
  13802. @item start
  13803. Get the current time, set it as frame metadata (using the key
  13804. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13805. @item stop
  13806. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13807. the input frame metadata to get the time difference. Time difference, average,
  13808. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13809. @code{min}) are then printed. The timestamps are expressed in seconds.
  13810. @end table
  13811. @end table
  13812. @subsection Examples
  13813. @itemize
  13814. @item
  13815. Benchmark @ref{selectivecolor} filter:
  13816. @example
  13817. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13818. @end example
  13819. @end itemize
  13820. @section concat
  13821. Concatenate audio and video streams, joining them together one after the
  13822. other.
  13823. The filter works on segments of synchronized video and audio streams. All
  13824. segments must have the same number of streams of each type, and that will
  13825. also be the number of streams at output.
  13826. The filter accepts the following options:
  13827. @table @option
  13828. @item n
  13829. Set the number of segments. Default is 2.
  13830. @item v
  13831. Set the number of output video streams, that is also the number of video
  13832. streams in each segment. Default is 1.
  13833. @item a
  13834. Set the number of output audio streams, that is also the number of audio
  13835. streams in each segment. Default is 0.
  13836. @item unsafe
  13837. Activate unsafe mode: do not fail if segments have a different format.
  13838. @end table
  13839. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13840. @var{a} audio outputs.
  13841. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13842. segment, in the same order as the outputs, then the inputs for the second
  13843. segment, etc.
  13844. Related streams do not always have exactly the same duration, for various
  13845. reasons including codec frame size or sloppy authoring. For that reason,
  13846. related synchronized streams (e.g. a video and its audio track) should be
  13847. concatenated at once. The concat filter will use the duration of the longest
  13848. stream in each segment (except the last one), and if necessary pad shorter
  13849. audio streams with silence.
  13850. For this filter to work correctly, all segments must start at timestamp 0.
  13851. All corresponding streams must have the same parameters in all segments; the
  13852. filtering system will automatically select a common pixel format for video
  13853. streams, and a common sample format, sample rate and channel layout for
  13854. audio streams, but other settings, such as resolution, must be converted
  13855. explicitly by the user.
  13856. Different frame rates are acceptable but will result in variable frame rate
  13857. at output; be sure to configure the output file to handle it.
  13858. @subsection Examples
  13859. @itemize
  13860. @item
  13861. Concatenate an opening, an episode and an ending, all in bilingual version
  13862. (video in stream 0, audio in streams 1 and 2):
  13863. @example
  13864. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13865. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13866. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13867. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13868. @end example
  13869. @item
  13870. Concatenate two parts, handling audio and video separately, using the
  13871. (a)movie sources, and adjusting the resolution:
  13872. @example
  13873. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13874. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13875. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13876. @end example
  13877. Note that a desync will happen at the stitch if the audio and video streams
  13878. do not have exactly the same duration in the first file.
  13879. @end itemize
  13880. @subsection Commands
  13881. This filter supports the following commands:
  13882. @table @option
  13883. @item next
  13884. Close the current segment and step to the next one
  13885. @end table
  13886. @section drawgraph, adrawgraph
  13887. Draw a graph using input video or audio metadata.
  13888. It accepts the following parameters:
  13889. @table @option
  13890. @item m1
  13891. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13892. @item fg1
  13893. Set 1st foreground color expression.
  13894. @item m2
  13895. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13896. @item fg2
  13897. Set 2nd foreground color expression.
  13898. @item m3
  13899. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13900. @item fg3
  13901. Set 3rd foreground color expression.
  13902. @item m4
  13903. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13904. @item fg4
  13905. Set 4th foreground color expression.
  13906. @item min
  13907. Set minimal value of metadata value.
  13908. @item max
  13909. Set maximal value of metadata value.
  13910. @item bg
  13911. Set graph background color. Default is white.
  13912. @item mode
  13913. Set graph mode.
  13914. Available values for mode is:
  13915. @table @samp
  13916. @item bar
  13917. @item dot
  13918. @item line
  13919. @end table
  13920. Default is @code{line}.
  13921. @item slide
  13922. Set slide mode.
  13923. Available values for slide is:
  13924. @table @samp
  13925. @item frame
  13926. Draw new frame when right border is reached.
  13927. @item replace
  13928. Replace old columns with new ones.
  13929. @item scroll
  13930. Scroll from right to left.
  13931. @item rscroll
  13932. Scroll from left to right.
  13933. @item picture
  13934. Draw single picture.
  13935. @end table
  13936. Default is @code{frame}.
  13937. @item size
  13938. Set size of graph video. For the syntax of this option, check the
  13939. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13940. The default value is @code{900x256}.
  13941. The foreground color expressions can use the following variables:
  13942. @table @option
  13943. @item MIN
  13944. Minimal value of metadata value.
  13945. @item MAX
  13946. Maximal value of metadata value.
  13947. @item VAL
  13948. Current metadata key value.
  13949. @end table
  13950. The color is defined as 0xAABBGGRR.
  13951. @end table
  13952. Example using metadata from @ref{signalstats} filter:
  13953. @example
  13954. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13955. @end example
  13956. Example using metadata from @ref{ebur128} filter:
  13957. @example
  13958. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13959. @end example
  13960. @anchor{ebur128}
  13961. @section ebur128
  13962. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13963. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13964. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13965. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13966. The filter also has a video output (see the @var{video} option) with a real
  13967. time graph to observe the loudness evolution. The graphic contains the logged
  13968. message mentioned above, so it is not printed anymore when this option is set,
  13969. unless the verbose logging is set. The main graphing area contains the
  13970. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13971. the momentary loudness (400 milliseconds).
  13972. More information about the Loudness Recommendation EBU R128 on
  13973. @url{http://tech.ebu.ch/loudness}.
  13974. The filter accepts the following options:
  13975. @table @option
  13976. @item video
  13977. Activate the video output. The audio stream is passed unchanged whether this
  13978. option is set or no. The video stream will be the first output stream if
  13979. activated. Default is @code{0}.
  13980. @item size
  13981. Set the video size. This option is for video only. For the syntax of this
  13982. option, check the
  13983. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13984. Default and minimum resolution is @code{640x480}.
  13985. @item meter
  13986. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13987. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13988. other integer value between this range is allowed.
  13989. @item metadata
  13990. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13991. into 100ms output frames, each of them containing various loudness information
  13992. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13993. Default is @code{0}.
  13994. @item framelog
  13995. Force the frame logging level.
  13996. Available values are:
  13997. @table @samp
  13998. @item info
  13999. information logging level
  14000. @item verbose
  14001. verbose logging level
  14002. @end table
  14003. By default, the logging level is set to @var{info}. If the @option{video} or
  14004. the @option{metadata} options are set, it switches to @var{verbose}.
  14005. @item peak
  14006. Set peak mode(s).
  14007. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14008. values are:
  14009. @table @samp
  14010. @item none
  14011. Disable any peak mode (default).
  14012. @item sample
  14013. Enable sample-peak mode.
  14014. Simple peak mode looking for the higher sample value. It logs a message
  14015. for sample-peak (identified by @code{SPK}).
  14016. @item true
  14017. Enable true-peak mode.
  14018. If enabled, the peak lookup is done on an over-sampled version of the input
  14019. stream for better peak accuracy. It logs a message for true-peak.
  14020. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14021. This mode requires a build with @code{libswresample}.
  14022. @end table
  14023. @item dualmono
  14024. Treat mono input files as "dual mono". If a mono file is intended for playback
  14025. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14026. If set to @code{true}, this option will compensate for this effect.
  14027. Multi-channel input files are not affected by this option.
  14028. @item panlaw
  14029. Set a specific pan law to be used for the measurement of dual mono files.
  14030. This parameter is optional, and has a default value of -3.01dB.
  14031. @end table
  14032. @subsection Examples
  14033. @itemize
  14034. @item
  14035. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14036. @example
  14037. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14038. @end example
  14039. @item
  14040. Run an analysis with @command{ffmpeg}:
  14041. @example
  14042. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14043. @end example
  14044. @end itemize
  14045. @section interleave, ainterleave
  14046. Temporally interleave frames from several inputs.
  14047. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14048. These filters read frames from several inputs and send the oldest
  14049. queued frame to the output.
  14050. Input streams must have well defined, monotonically increasing frame
  14051. timestamp values.
  14052. In order to submit one frame to output, these filters need to enqueue
  14053. at least one frame for each input, so they cannot work in case one
  14054. input is not yet terminated and will not receive incoming frames.
  14055. For example consider the case when one input is a @code{select} filter
  14056. which always drops input frames. The @code{interleave} filter will keep
  14057. reading from that input, but it will never be able to send new frames
  14058. to output until the input sends an end-of-stream signal.
  14059. Also, depending on inputs synchronization, the filters will drop
  14060. frames in case one input receives more frames than the other ones, and
  14061. the queue is already filled.
  14062. These filters accept the following options:
  14063. @table @option
  14064. @item nb_inputs, n
  14065. Set the number of different inputs, it is 2 by default.
  14066. @end table
  14067. @subsection Examples
  14068. @itemize
  14069. @item
  14070. Interleave frames belonging to different streams using @command{ffmpeg}:
  14071. @example
  14072. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14073. @end example
  14074. @item
  14075. Add flickering blur effect:
  14076. @example
  14077. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14078. @end example
  14079. @end itemize
  14080. @section metadata, ametadata
  14081. Manipulate frame metadata.
  14082. This filter accepts the following options:
  14083. @table @option
  14084. @item mode
  14085. Set mode of operation of the filter.
  14086. Can be one of the following:
  14087. @table @samp
  14088. @item select
  14089. If both @code{value} and @code{key} is set, select frames
  14090. which have such metadata. If only @code{key} is set, select
  14091. every frame that has such key in metadata.
  14092. @item add
  14093. Add new metadata @code{key} and @code{value}. If key is already available
  14094. do nothing.
  14095. @item modify
  14096. Modify value of already present key.
  14097. @item delete
  14098. If @code{value} is set, delete only keys that have such value.
  14099. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14100. the frame.
  14101. @item print
  14102. Print key and its value if metadata was found. If @code{key} is not set print all
  14103. metadata values available in frame.
  14104. @end table
  14105. @item key
  14106. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14107. @item value
  14108. Set metadata value which will be used. This option is mandatory for
  14109. @code{modify} and @code{add} mode.
  14110. @item function
  14111. Which function to use when comparing metadata value and @code{value}.
  14112. Can be one of following:
  14113. @table @samp
  14114. @item same_str
  14115. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14116. @item starts_with
  14117. Values are interpreted as strings, returns true if metadata value starts with
  14118. the @code{value} option string.
  14119. @item less
  14120. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14121. @item equal
  14122. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14123. @item greater
  14124. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14125. @item expr
  14126. Values are interpreted as floats, returns true if expression from option @code{expr}
  14127. evaluates to true.
  14128. @end table
  14129. @item expr
  14130. Set expression which is used when @code{function} is set to @code{expr}.
  14131. The expression is evaluated through the eval API and can contain the following
  14132. constants:
  14133. @table @option
  14134. @item VALUE1
  14135. Float representation of @code{value} from metadata key.
  14136. @item VALUE2
  14137. Float representation of @code{value} as supplied by user in @code{value} option.
  14138. @end table
  14139. @item file
  14140. If specified in @code{print} mode, output is written to the named file. Instead of
  14141. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14142. for standard output. If @code{file} option is not set, output is written to the log
  14143. with AV_LOG_INFO loglevel.
  14144. @end table
  14145. @subsection Examples
  14146. @itemize
  14147. @item
  14148. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14149. between 0 and 1.
  14150. @example
  14151. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14152. @end example
  14153. @item
  14154. Print silencedetect output to file @file{metadata.txt}.
  14155. @example
  14156. silencedetect,ametadata=mode=print:file=metadata.txt
  14157. @end example
  14158. @item
  14159. Direct all metadata to a pipe with file descriptor 4.
  14160. @example
  14161. metadata=mode=print:file='pipe\:4'
  14162. @end example
  14163. @end itemize
  14164. @section perms, aperms
  14165. Set read/write permissions for the output frames.
  14166. These filters are mainly aimed at developers to test direct path in the
  14167. following filter in the filtergraph.
  14168. The filters accept the following options:
  14169. @table @option
  14170. @item mode
  14171. Select the permissions mode.
  14172. It accepts the following values:
  14173. @table @samp
  14174. @item none
  14175. Do nothing. This is the default.
  14176. @item ro
  14177. Set all the output frames read-only.
  14178. @item rw
  14179. Set all the output frames directly writable.
  14180. @item toggle
  14181. Make the frame read-only if writable, and writable if read-only.
  14182. @item random
  14183. Set each output frame read-only or writable randomly.
  14184. @end table
  14185. @item seed
  14186. Set the seed for the @var{random} mode, must be an integer included between
  14187. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14188. @code{-1}, the filter will try to use a good random seed on a best effort
  14189. basis.
  14190. @end table
  14191. Note: in case of auto-inserted filter between the permission filter and the
  14192. following one, the permission might not be received as expected in that
  14193. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14194. perms/aperms filter can avoid this problem.
  14195. @section realtime, arealtime
  14196. Slow down filtering to match real time approximately.
  14197. These filters will pause the filtering for a variable amount of time to
  14198. match the output rate with the input timestamps.
  14199. They are similar to the @option{re} option to @code{ffmpeg}.
  14200. They accept the following options:
  14201. @table @option
  14202. @item limit
  14203. Time limit for the pauses. Any pause longer than that will be considered
  14204. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14205. @end table
  14206. @anchor{select}
  14207. @section select, aselect
  14208. Select frames to pass in output.
  14209. This filter accepts the following options:
  14210. @table @option
  14211. @item expr, e
  14212. Set expression, which is evaluated for each input frame.
  14213. If the expression is evaluated to zero, the frame is discarded.
  14214. If the evaluation result is negative or NaN, the frame is sent to the
  14215. first output; otherwise it is sent to the output with index
  14216. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14217. For example a value of @code{1.2} corresponds to the output with index
  14218. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14219. @item outputs, n
  14220. Set the number of outputs. The output to which to send the selected
  14221. frame is based on the result of the evaluation. Default value is 1.
  14222. @end table
  14223. The expression can contain the following constants:
  14224. @table @option
  14225. @item n
  14226. The (sequential) number of the filtered frame, starting from 0.
  14227. @item selected_n
  14228. The (sequential) number of the selected frame, starting from 0.
  14229. @item prev_selected_n
  14230. The sequential number of the last selected frame. It's NAN if undefined.
  14231. @item TB
  14232. The timebase of the input timestamps.
  14233. @item pts
  14234. The PTS (Presentation TimeStamp) of the filtered video frame,
  14235. expressed in @var{TB} units. It's NAN if undefined.
  14236. @item t
  14237. The PTS of the filtered video frame,
  14238. expressed in seconds. It's NAN if undefined.
  14239. @item prev_pts
  14240. The PTS of the previously filtered video frame. It's NAN if undefined.
  14241. @item prev_selected_pts
  14242. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14243. @item prev_selected_t
  14244. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14245. @item start_pts
  14246. The PTS of the first video frame in the video. It's NAN if undefined.
  14247. @item start_t
  14248. The time of the first video frame in the video. It's NAN if undefined.
  14249. @item pict_type @emph{(video only)}
  14250. The type of the filtered frame. It can assume one of the following
  14251. values:
  14252. @table @option
  14253. @item I
  14254. @item P
  14255. @item B
  14256. @item S
  14257. @item SI
  14258. @item SP
  14259. @item BI
  14260. @end table
  14261. @item interlace_type @emph{(video only)}
  14262. The frame interlace type. It can assume one of the following values:
  14263. @table @option
  14264. @item PROGRESSIVE
  14265. The frame is progressive (not interlaced).
  14266. @item TOPFIRST
  14267. The frame is top-field-first.
  14268. @item BOTTOMFIRST
  14269. The frame is bottom-field-first.
  14270. @end table
  14271. @item consumed_sample_n @emph{(audio only)}
  14272. the number of selected samples before the current frame
  14273. @item samples_n @emph{(audio only)}
  14274. the number of samples in the current frame
  14275. @item sample_rate @emph{(audio only)}
  14276. the input sample rate
  14277. @item key
  14278. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14279. @item pos
  14280. the position in the file of the filtered frame, -1 if the information
  14281. is not available (e.g. for synthetic video)
  14282. @item scene @emph{(video only)}
  14283. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14284. probability for the current frame to introduce a new scene, while a higher
  14285. value means the current frame is more likely to be one (see the example below)
  14286. @item concatdec_select
  14287. The concat demuxer can select only part of a concat input file by setting an
  14288. inpoint and an outpoint, but the output packets may not be entirely contained
  14289. in the selected interval. By using this variable, it is possible to skip frames
  14290. generated by the concat demuxer which are not exactly contained in the selected
  14291. interval.
  14292. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14293. and the @var{lavf.concat.duration} packet metadata values which are also
  14294. present in the decoded frames.
  14295. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14296. start_time and either the duration metadata is missing or the frame pts is less
  14297. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14298. missing.
  14299. That basically means that an input frame is selected if its pts is within the
  14300. interval set by the concat demuxer.
  14301. @end table
  14302. The default value of the select expression is "1".
  14303. @subsection Examples
  14304. @itemize
  14305. @item
  14306. Select all frames in input:
  14307. @example
  14308. select
  14309. @end example
  14310. The example above is the same as:
  14311. @example
  14312. select=1
  14313. @end example
  14314. @item
  14315. Skip all frames:
  14316. @example
  14317. select=0
  14318. @end example
  14319. @item
  14320. Select only I-frames:
  14321. @example
  14322. select='eq(pict_type\,I)'
  14323. @end example
  14324. @item
  14325. Select one frame every 100:
  14326. @example
  14327. select='not(mod(n\,100))'
  14328. @end example
  14329. @item
  14330. Select only frames contained in the 10-20 time interval:
  14331. @example
  14332. select=between(t\,10\,20)
  14333. @end example
  14334. @item
  14335. Select only I-frames contained in the 10-20 time interval:
  14336. @example
  14337. select=between(t\,10\,20)*eq(pict_type\,I)
  14338. @end example
  14339. @item
  14340. Select frames with a minimum distance of 10 seconds:
  14341. @example
  14342. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14343. @end example
  14344. @item
  14345. Use aselect to select only audio frames with samples number > 100:
  14346. @example
  14347. aselect='gt(samples_n\,100)'
  14348. @end example
  14349. @item
  14350. Create a mosaic of the first scenes:
  14351. @example
  14352. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14353. @end example
  14354. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14355. choice.
  14356. @item
  14357. Send even and odd frames to separate outputs, and compose them:
  14358. @example
  14359. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14360. @end example
  14361. @item
  14362. Select useful frames from an ffconcat file which is using inpoints and
  14363. outpoints but where the source files are not intra frame only.
  14364. @example
  14365. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14366. @end example
  14367. @end itemize
  14368. @section sendcmd, asendcmd
  14369. Send commands to filters in the filtergraph.
  14370. These filters read commands to be sent to other filters in the
  14371. filtergraph.
  14372. @code{sendcmd} must be inserted between two video filters,
  14373. @code{asendcmd} must be inserted between two audio filters, but apart
  14374. from that they act the same way.
  14375. The specification of commands can be provided in the filter arguments
  14376. with the @var{commands} option, or in a file specified by the
  14377. @var{filename} option.
  14378. These filters accept the following options:
  14379. @table @option
  14380. @item commands, c
  14381. Set the commands to be read and sent to the other filters.
  14382. @item filename, f
  14383. Set the filename of the commands to be read and sent to the other
  14384. filters.
  14385. @end table
  14386. @subsection Commands syntax
  14387. A commands description consists of a sequence of interval
  14388. specifications, comprising a list of commands to be executed when a
  14389. particular event related to that interval occurs. The occurring event
  14390. is typically the current frame time entering or leaving a given time
  14391. interval.
  14392. An interval is specified by the following syntax:
  14393. @example
  14394. @var{START}[-@var{END}] @var{COMMANDS};
  14395. @end example
  14396. The time interval is specified by the @var{START} and @var{END} times.
  14397. @var{END} is optional and defaults to the maximum time.
  14398. The current frame time is considered within the specified interval if
  14399. it is included in the interval [@var{START}, @var{END}), that is when
  14400. the time is greater or equal to @var{START} and is lesser than
  14401. @var{END}.
  14402. @var{COMMANDS} consists of a sequence of one or more command
  14403. specifications, separated by ",", relating to that interval. The
  14404. syntax of a command specification is given by:
  14405. @example
  14406. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14407. @end example
  14408. @var{FLAGS} is optional and specifies the type of events relating to
  14409. the time interval which enable sending the specified command, and must
  14410. be a non-null sequence of identifier flags separated by "+" or "|" and
  14411. enclosed between "[" and "]".
  14412. The following flags are recognized:
  14413. @table @option
  14414. @item enter
  14415. The command is sent when the current frame timestamp enters the
  14416. specified interval. In other words, the command is sent when the
  14417. previous frame timestamp was not in the given interval, and the
  14418. current is.
  14419. @item leave
  14420. The command is sent when the current frame timestamp leaves the
  14421. specified interval. In other words, the command is sent when the
  14422. previous frame timestamp was in the given interval, and the
  14423. current is not.
  14424. @end table
  14425. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14426. assumed.
  14427. @var{TARGET} specifies the target of the command, usually the name of
  14428. the filter class or a specific filter instance name.
  14429. @var{COMMAND} specifies the name of the command for the target filter.
  14430. @var{ARG} is optional and specifies the optional list of argument for
  14431. the given @var{COMMAND}.
  14432. Between one interval specification and another, whitespaces, or
  14433. sequences of characters starting with @code{#} until the end of line,
  14434. are ignored and can be used to annotate comments.
  14435. A simplified BNF description of the commands specification syntax
  14436. follows:
  14437. @example
  14438. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14439. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14440. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14441. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14442. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14443. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14444. @end example
  14445. @subsection Examples
  14446. @itemize
  14447. @item
  14448. Specify audio tempo change at second 4:
  14449. @example
  14450. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14451. @end example
  14452. @item
  14453. Target a specific filter instance:
  14454. @example
  14455. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14456. @end example
  14457. @item
  14458. Specify a list of drawtext and hue commands in a file.
  14459. @example
  14460. # show text in the interval 5-10
  14461. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14462. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14463. # desaturate the image in the interval 15-20
  14464. 15.0-20.0 [enter] hue s 0,
  14465. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14466. [leave] hue s 1,
  14467. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14468. # apply an exponential saturation fade-out effect, starting from time 25
  14469. 25 [enter] hue s exp(25-t)
  14470. @end example
  14471. A filtergraph allowing to read and process the above command list
  14472. stored in a file @file{test.cmd}, can be specified with:
  14473. @example
  14474. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14475. @end example
  14476. @end itemize
  14477. @anchor{setpts}
  14478. @section setpts, asetpts
  14479. Change the PTS (presentation timestamp) of the input frames.
  14480. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14481. This filter accepts the following options:
  14482. @table @option
  14483. @item expr
  14484. The expression which is evaluated for each frame to construct its timestamp.
  14485. @end table
  14486. The expression is evaluated through the eval API and can contain the following
  14487. constants:
  14488. @table @option
  14489. @item FRAME_RATE
  14490. frame rate, only defined for constant frame-rate video
  14491. @item PTS
  14492. The presentation timestamp in input
  14493. @item N
  14494. The count of the input frame for video or the number of consumed samples,
  14495. not including the current frame for audio, starting from 0.
  14496. @item NB_CONSUMED_SAMPLES
  14497. The number of consumed samples, not including the current frame (only
  14498. audio)
  14499. @item NB_SAMPLES, S
  14500. The number of samples in the current frame (only audio)
  14501. @item SAMPLE_RATE, SR
  14502. The audio sample rate.
  14503. @item STARTPTS
  14504. The PTS of the first frame.
  14505. @item STARTT
  14506. the time in seconds of the first frame
  14507. @item INTERLACED
  14508. State whether the current frame is interlaced.
  14509. @item T
  14510. the time in seconds of the current frame
  14511. @item POS
  14512. original position in the file of the frame, or undefined if undefined
  14513. for the current frame
  14514. @item PREV_INPTS
  14515. The previous input PTS.
  14516. @item PREV_INT
  14517. previous input time in seconds
  14518. @item PREV_OUTPTS
  14519. The previous output PTS.
  14520. @item PREV_OUTT
  14521. previous output time in seconds
  14522. @item RTCTIME
  14523. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14524. instead.
  14525. @item RTCSTART
  14526. The wallclock (RTC) time at the start of the movie in microseconds.
  14527. @item TB
  14528. The timebase of the input timestamps.
  14529. @end table
  14530. @subsection Examples
  14531. @itemize
  14532. @item
  14533. Start counting PTS from zero
  14534. @example
  14535. setpts=PTS-STARTPTS
  14536. @end example
  14537. @item
  14538. Apply fast motion effect:
  14539. @example
  14540. setpts=0.5*PTS
  14541. @end example
  14542. @item
  14543. Apply slow motion effect:
  14544. @example
  14545. setpts=2.0*PTS
  14546. @end example
  14547. @item
  14548. Set fixed rate of 25 frames per second:
  14549. @example
  14550. setpts=N/(25*TB)
  14551. @end example
  14552. @item
  14553. Set fixed rate 25 fps with some jitter:
  14554. @example
  14555. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14556. @end example
  14557. @item
  14558. Apply an offset of 10 seconds to the input PTS:
  14559. @example
  14560. setpts=PTS+10/TB
  14561. @end example
  14562. @item
  14563. Generate timestamps from a "live source" and rebase onto the current timebase:
  14564. @example
  14565. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14566. @end example
  14567. @item
  14568. Generate timestamps by counting samples:
  14569. @example
  14570. asetpts=N/SR/TB
  14571. @end example
  14572. @end itemize
  14573. @section setrange
  14574. Force color range for the output video frame.
  14575. The @code{setrange} filter marks the color range property for the
  14576. output frames. It does not change the input frame, but only sets the
  14577. corresponding property, which affects how the frame is treated by
  14578. following filters.
  14579. The filter accepts the following options:
  14580. @table @option
  14581. @item range
  14582. Available values are:
  14583. @table @samp
  14584. @item auto
  14585. Keep the same color range property.
  14586. @item unspecified, unknown
  14587. Set the color range as unspecified.
  14588. @item limited, tv, mpeg
  14589. Set the color range as limited.
  14590. @item full, pc, jpeg
  14591. Set the color range as full.
  14592. @end table
  14593. @end table
  14594. @section settb, asettb
  14595. Set the timebase to use for the output frames timestamps.
  14596. It is mainly useful for testing timebase configuration.
  14597. It accepts the following parameters:
  14598. @table @option
  14599. @item expr, tb
  14600. The expression which is evaluated into the output timebase.
  14601. @end table
  14602. The value for @option{tb} is an arithmetic expression representing a
  14603. rational. The expression can contain the constants "AVTB" (the default
  14604. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14605. audio only). Default value is "intb".
  14606. @subsection Examples
  14607. @itemize
  14608. @item
  14609. Set the timebase to 1/25:
  14610. @example
  14611. settb=expr=1/25
  14612. @end example
  14613. @item
  14614. Set the timebase to 1/10:
  14615. @example
  14616. settb=expr=0.1
  14617. @end example
  14618. @item
  14619. Set the timebase to 1001/1000:
  14620. @example
  14621. settb=1+0.001
  14622. @end example
  14623. @item
  14624. Set the timebase to 2*intb:
  14625. @example
  14626. settb=2*intb
  14627. @end example
  14628. @item
  14629. Set the default timebase value:
  14630. @example
  14631. settb=AVTB
  14632. @end example
  14633. @end itemize
  14634. @section showcqt
  14635. Convert input audio to a video output representing frequency spectrum
  14636. logarithmically using Brown-Puckette constant Q transform algorithm with
  14637. direct frequency domain coefficient calculation (but the transform itself
  14638. is not really constant Q, instead the Q factor is actually variable/clamped),
  14639. with musical tone scale, from E0 to D#10.
  14640. The filter accepts the following options:
  14641. @table @option
  14642. @item size, s
  14643. Specify the video size for the output. It must be even. For the syntax of this option,
  14644. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14645. Default value is @code{1920x1080}.
  14646. @item fps, rate, r
  14647. Set the output frame rate. Default value is @code{25}.
  14648. @item bar_h
  14649. Set the bargraph height. It must be even. Default value is @code{-1} which
  14650. computes the bargraph height automatically.
  14651. @item axis_h
  14652. Set the axis height. It must be even. Default value is @code{-1} which computes
  14653. the axis height automatically.
  14654. @item sono_h
  14655. Set the sonogram height. It must be even. Default value is @code{-1} which
  14656. computes the sonogram height automatically.
  14657. @item fullhd
  14658. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14659. instead. Default value is @code{1}.
  14660. @item sono_v, volume
  14661. Specify the sonogram volume expression. It can contain variables:
  14662. @table @option
  14663. @item bar_v
  14664. the @var{bar_v} evaluated expression
  14665. @item frequency, freq, f
  14666. the frequency where it is evaluated
  14667. @item timeclamp, tc
  14668. the value of @var{timeclamp} option
  14669. @end table
  14670. and functions:
  14671. @table @option
  14672. @item a_weighting(f)
  14673. A-weighting of equal loudness
  14674. @item b_weighting(f)
  14675. B-weighting of equal loudness
  14676. @item c_weighting(f)
  14677. C-weighting of equal loudness.
  14678. @end table
  14679. Default value is @code{16}.
  14680. @item bar_v, volume2
  14681. Specify the bargraph volume expression. It can contain variables:
  14682. @table @option
  14683. @item sono_v
  14684. the @var{sono_v} evaluated expression
  14685. @item frequency, freq, f
  14686. the frequency where it is evaluated
  14687. @item timeclamp, tc
  14688. the value of @var{timeclamp} option
  14689. @end table
  14690. and functions:
  14691. @table @option
  14692. @item a_weighting(f)
  14693. A-weighting of equal loudness
  14694. @item b_weighting(f)
  14695. B-weighting of equal loudness
  14696. @item c_weighting(f)
  14697. C-weighting of equal loudness.
  14698. @end table
  14699. Default value is @code{sono_v}.
  14700. @item sono_g, gamma
  14701. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14702. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14703. Acceptable range is @code{[1, 7]}.
  14704. @item bar_g, gamma2
  14705. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14706. @code{[1, 7]}.
  14707. @item bar_t
  14708. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14709. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14710. @item timeclamp, tc
  14711. Specify the transform timeclamp. At low frequency, there is trade-off between
  14712. accuracy in time domain and frequency domain. If timeclamp is lower,
  14713. event in time domain is represented more accurately (such as fast bass drum),
  14714. otherwise event in frequency domain is represented more accurately
  14715. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14716. @item attack
  14717. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14718. limits future samples by applying asymmetric windowing in time domain, useful
  14719. when low latency is required. Accepted range is @code{[0, 1]}.
  14720. @item basefreq
  14721. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14722. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14723. @item endfreq
  14724. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14725. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14726. @item coeffclamp
  14727. This option is deprecated and ignored.
  14728. @item tlength
  14729. Specify the transform length in time domain. Use this option to control accuracy
  14730. trade-off between time domain and frequency domain at every frequency sample.
  14731. It can contain variables:
  14732. @table @option
  14733. @item frequency, freq, f
  14734. the frequency where it is evaluated
  14735. @item timeclamp, tc
  14736. the value of @var{timeclamp} option.
  14737. @end table
  14738. Default value is @code{384*tc/(384+tc*f)}.
  14739. @item count
  14740. Specify the transform count for every video frame. Default value is @code{6}.
  14741. Acceptable range is @code{[1, 30]}.
  14742. @item fcount
  14743. Specify the transform count for every single pixel. Default value is @code{0},
  14744. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14745. @item fontfile
  14746. Specify font file for use with freetype to draw the axis. If not specified,
  14747. use embedded font. Note that drawing with font file or embedded font is not
  14748. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14749. option instead.
  14750. @item font
  14751. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14752. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14753. @item fontcolor
  14754. Specify font color expression. This is arithmetic expression that should return
  14755. integer value 0xRRGGBB. It can contain variables:
  14756. @table @option
  14757. @item frequency, freq, f
  14758. the frequency where it is evaluated
  14759. @item timeclamp, tc
  14760. the value of @var{timeclamp} option
  14761. @end table
  14762. and functions:
  14763. @table @option
  14764. @item midi(f)
  14765. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14766. @item r(x), g(x), b(x)
  14767. red, green, and blue value of intensity x.
  14768. @end table
  14769. Default value is @code{st(0, (midi(f)-59.5)/12);
  14770. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14771. r(1-ld(1)) + b(ld(1))}.
  14772. @item axisfile
  14773. Specify image file to draw the axis. This option override @var{fontfile} and
  14774. @var{fontcolor} option.
  14775. @item axis, text
  14776. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14777. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14778. Default value is @code{1}.
  14779. @item csp
  14780. Set colorspace. The accepted values are:
  14781. @table @samp
  14782. @item unspecified
  14783. Unspecified (default)
  14784. @item bt709
  14785. BT.709
  14786. @item fcc
  14787. FCC
  14788. @item bt470bg
  14789. BT.470BG or BT.601-6 625
  14790. @item smpte170m
  14791. SMPTE-170M or BT.601-6 525
  14792. @item smpte240m
  14793. SMPTE-240M
  14794. @item bt2020ncl
  14795. BT.2020 with non-constant luminance
  14796. @end table
  14797. @item cscheme
  14798. Set spectrogram color scheme. This is list of floating point values with format
  14799. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14800. The default is @code{1|0.5|0|0|0.5|1}.
  14801. @end table
  14802. @subsection Examples
  14803. @itemize
  14804. @item
  14805. Playing audio while showing the spectrum:
  14806. @example
  14807. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14808. @end example
  14809. @item
  14810. Same as above, but with frame rate 30 fps:
  14811. @example
  14812. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14813. @end example
  14814. @item
  14815. Playing at 1280x720:
  14816. @example
  14817. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14818. @end example
  14819. @item
  14820. Disable sonogram display:
  14821. @example
  14822. sono_h=0
  14823. @end example
  14824. @item
  14825. A1 and its harmonics: A1, A2, (near)E3, A3:
  14826. @example
  14827. 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),
  14828. asplit[a][out1]; [a] showcqt [out0]'
  14829. @end example
  14830. @item
  14831. Same as above, but with more accuracy in frequency domain:
  14832. @example
  14833. 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),
  14834. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14835. @end example
  14836. @item
  14837. Custom volume:
  14838. @example
  14839. bar_v=10:sono_v=bar_v*a_weighting(f)
  14840. @end example
  14841. @item
  14842. Custom gamma, now spectrum is linear to the amplitude.
  14843. @example
  14844. bar_g=2:sono_g=2
  14845. @end example
  14846. @item
  14847. Custom tlength equation:
  14848. @example
  14849. 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)))'
  14850. @end example
  14851. @item
  14852. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14853. @example
  14854. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14855. @end example
  14856. @item
  14857. Custom font using fontconfig:
  14858. @example
  14859. font='Courier New,Monospace,mono|bold'
  14860. @end example
  14861. @item
  14862. Custom frequency range with custom axis using image file:
  14863. @example
  14864. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14865. @end example
  14866. @end itemize
  14867. @section showfreqs
  14868. Convert input audio to video output representing the audio power spectrum.
  14869. Audio amplitude is on Y-axis while frequency is on X-axis.
  14870. The filter accepts the following options:
  14871. @table @option
  14872. @item size, s
  14873. Specify size of video. For the syntax of this option, check the
  14874. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14875. Default is @code{1024x512}.
  14876. @item mode
  14877. Set display mode.
  14878. This set how each frequency bin will be represented.
  14879. It accepts the following values:
  14880. @table @samp
  14881. @item line
  14882. @item bar
  14883. @item dot
  14884. @end table
  14885. Default is @code{bar}.
  14886. @item ascale
  14887. Set amplitude scale.
  14888. It accepts the following values:
  14889. @table @samp
  14890. @item lin
  14891. Linear scale.
  14892. @item sqrt
  14893. Square root scale.
  14894. @item cbrt
  14895. Cubic root scale.
  14896. @item log
  14897. Logarithmic scale.
  14898. @end table
  14899. Default is @code{log}.
  14900. @item fscale
  14901. Set frequency scale.
  14902. It accepts the following values:
  14903. @table @samp
  14904. @item lin
  14905. Linear scale.
  14906. @item log
  14907. Logarithmic scale.
  14908. @item rlog
  14909. Reverse logarithmic scale.
  14910. @end table
  14911. Default is @code{lin}.
  14912. @item win_size
  14913. Set window size.
  14914. It accepts the following values:
  14915. @table @samp
  14916. @item w16
  14917. @item w32
  14918. @item w64
  14919. @item w128
  14920. @item w256
  14921. @item w512
  14922. @item w1024
  14923. @item w2048
  14924. @item w4096
  14925. @item w8192
  14926. @item w16384
  14927. @item w32768
  14928. @item w65536
  14929. @end table
  14930. Default is @code{w2048}
  14931. @item win_func
  14932. Set windowing function.
  14933. It accepts the following values:
  14934. @table @samp
  14935. @item rect
  14936. @item bartlett
  14937. @item hanning
  14938. @item hamming
  14939. @item blackman
  14940. @item welch
  14941. @item flattop
  14942. @item bharris
  14943. @item bnuttall
  14944. @item bhann
  14945. @item sine
  14946. @item nuttall
  14947. @item lanczos
  14948. @item gauss
  14949. @item tukey
  14950. @item dolph
  14951. @item cauchy
  14952. @item parzen
  14953. @item poisson
  14954. @end table
  14955. Default is @code{hanning}.
  14956. @item overlap
  14957. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14958. which means optimal overlap for selected window function will be picked.
  14959. @item averaging
  14960. Set time averaging. Setting this to 0 will display current maximal peaks.
  14961. Default is @code{1}, which means time averaging is disabled.
  14962. @item colors
  14963. Specify list of colors separated by space or by '|' which will be used to
  14964. draw channel frequencies. Unrecognized or missing colors will be replaced
  14965. by white color.
  14966. @item cmode
  14967. Set channel display mode.
  14968. It accepts the following values:
  14969. @table @samp
  14970. @item combined
  14971. @item separate
  14972. @end table
  14973. Default is @code{combined}.
  14974. @item minamp
  14975. Set minimum amplitude used in @code{log} amplitude scaler.
  14976. @end table
  14977. @anchor{showspectrum}
  14978. @section showspectrum
  14979. Convert input audio to a video output, representing the audio frequency
  14980. spectrum.
  14981. The filter accepts the following options:
  14982. @table @option
  14983. @item size, s
  14984. Specify the video size for the output. For the syntax of this option, check the
  14985. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14986. Default value is @code{640x512}.
  14987. @item slide
  14988. Specify how the spectrum should slide along the window.
  14989. It accepts the following values:
  14990. @table @samp
  14991. @item replace
  14992. the samples start again on the left when they reach the right
  14993. @item scroll
  14994. the samples scroll from right to left
  14995. @item fullframe
  14996. frames are only produced when the samples reach the right
  14997. @item rscroll
  14998. the samples scroll from left to right
  14999. @end table
  15000. Default value is @code{replace}.
  15001. @item mode
  15002. Specify display mode.
  15003. It accepts the following values:
  15004. @table @samp
  15005. @item combined
  15006. all channels are displayed in the same row
  15007. @item separate
  15008. all channels are displayed in separate rows
  15009. @end table
  15010. Default value is @samp{combined}.
  15011. @item color
  15012. Specify display color mode.
  15013. It accepts the following values:
  15014. @table @samp
  15015. @item channel
  15016. each channel is displayed in a separate color
  15017. @item intensity
  15018. each channel is displayed using the same color scheme
  15019. @item rainbow
  15020. each channel is displayed using the rainbow color scheme
  15021. @item moreland
  15022. each channel is displayed using the moreland color scheme
  15023. @item nebulae
  15024. each channel is displayed using the nebulae color scheme
  15025. @item fire
  15026. each channel is displayed using the fire color scheme
  15027. @item fiery
  15028. each channel is displayed using the fiery color scheme
  15029. @item fruit
  15030. each channel is displayed using the fruit color scheme
  15031. @item cool
  15032. each channel is displayed using the cool color scheme
  15033. @end table
  15034. Default value is @samp{channel}.
  15035. @item scale
  15036. Specify scale used for calculating intensity color values.
  15037. It accepts the following values:
  15038. @table @samp
  15039. @item lin
  15040. linear
  15041. @item sqrt
  15042. square root, default
  15043. @item cbrt
  15044. cubic root
  15045. @item log
  15046. logarithmic
  15047. @item 4thrt
  15048. 4th root
  15049. @item 5thrt
  15050. 5th root
  15051. @end table
  15052. Default value is @samp{sqrt}.
  15053. @item saturation
  15054. Set saturation modifier for displayed colors. Negative values provide
  15055. alternative color scheme. @code{0} is no saturation at all.
  15056. Saturation must be in [-10.0, 10.0] range.
  15057. Default value is @code{1}.
  15058. @item win_func
  15059. Set window function.
  15060. It accepts the following values:
  15061. @table @samp
  15062. @item rect
  15063. @item bartlett
  15064. @item hann
  15065. @item hanning
  15066. @item hamming
  15067. @item blackman
  15068. @item welch
  15069. @item flattop
  15070. @item bharris
  15071. @item bnuttall
  15072. @item bhann
  15073. @item sine
  15074. @item nuttall
  15075. @item lanczos
  15076. @item gauss
  15077. @item tukey
  15078. @item dolph
  15079. @item cauchy
  15080. @item parzen
  15081. @item poisson
  15082. @end table
  15083. Default value is @code{hann}.
  15084. @item orientation
  15085. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15086. @code{horizontal}. Default is @code{vertical}.
  15087. @item overlap
  15088. Set ratio of overlap window. Default value is @code{0}.
  15089. When value is @code{1} overlap is set to recommended size for specific
  15090. window function currently used.
  15091. @item gain
  15092. Set scale gain for calculating intensity color values.
  15093. Default value is @code{1}.
  15094. @item data
  15095. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15096. @item rotation
  15097. Set color rotation, must be in [-1.0, 1.0] range.
  15098. Default value is @code{0}.
  15099. @end table
  15100. The usage is very similar to the showwaves filter; see the examples in that
  15101. section.
  15102. @subsection Examples
  15103. @itemize
  15104. @item
  15105. Large window with logarithmic color scaling:
  15106. @example
  15107. showspectrum=s=1280x480:scale=log
  15108. @end example
  15109. @item
  15110. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15111. @example
  15112. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15113. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15114. @end example
  15115. @end itemize
  15116. @section showspectrumpic
  15117. Convert input audio to a single video frame, representing the audio frequency
  15118. spectrum.
  15119. The filter accepts the following options:
  15120. @table @option
  15121. @item size, s
  15122. Specify the video size for the output. For the syntax of this option, check the
  15123. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15124. Default value is @code{4096x2048}.
  15125. @item mode
  15126. Specify display mode.
  15127. It accepts the following values:
  15128. @table @samp
  15129. @item combined
  15130. all channels are displayed in the same row
  15131. @item separate
  15132. all channels are displayed in separate rows
  15133. @end table
  15134. Default value is @samp{combined}.
  15135. @item color
  15136. Specify display color mode.
  15137. It accepts the following values:
  15138. @table @samp
  15139. @item channel
  15140. each channel is displayed in a separate color
  15141. @item intensity
  15142. each channel is displayed using the same color scheme
  15143. @item rainbow
  15144. each channel is displayed using the rainbow color scheme
  15145. @item moreland
  15146. each channel is displayed using the moreland color scheme
  15147. @item nebulae
  15148. each channel is displayed using the nebulae color scheme
  15149. @item fire
  15150. each channel is displayed using the fire color scheme
  15151. @item fiery
  15152. each channel is displayed using the fiery color scheme
  15153. @item fruit
  15154. each channel is displayed using the fruit color scheme
  15155. @item cool
  15156. each channel is displayed using the cool color scheme
  15157. @end table
  15158. Default value is @samp{intensity}.
  15159. @item scale
  15160. Specify scale used for calculating intensity color values.
  15161. It accepts the following values:
  15162. @table @samp
  15163. @item lin
  15164. linear
  15165. @item sqrt
  15166. square root, default
  15167. @item cbrt
  15168. cubic root
  15169. @item log
  15170. logarithmic
  15171. @item 4thrt
  15172. 4th root
  15173. @item 5thrt
  15174. 5th root
  15175. @end table
  15176. Default value is @samp{log}.
  15177. @item saturation
  15178. Set saturation modifier for displayed colors. Negative values provide
  15179. alternative color scheme. @code{0} is no saturation at all.
  15180. Saturation must be in [-10.0, 10.0] range.
  15181. Default value is @code{1}.
  15182. @item win_func
  15183. Set window function.
  15184. It accepts the following values:
  15185. @table @samp
  15186. @item rect
  15187. @item bartlett
  15188. @item hann
  15189. @item hanning
  15190. @item hamming
  15191. @item blackman
  15192. @item welch
  15193. @item flattop
  15194. @item bharris
  15195. @item bnuttall
  15196. @item bhann
  15197. @item sine
  15198. @item nuttall
  15199. @item lanczos
  15200. @item gauss
  15201. @item tukey
  15202. @item dolph
  15203. @item cauchy
  15204. @item parzen
  15205. @item poisson
  15206. @end table
  15207. Default value is @code{hann}.
  15208. @item orientation
  15209. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15210. @code{horizontal}. Default is @code{vertical}.
  15211. @item gain
  15212. Set scale gain for calculating intensity color values.
  15213. Default value is @code{1}.
  15214. @item legend
  15215. Draw time and frequency axes and legends. Default is enabled.
  15216. @item rotation
  15217. Set color rotation, must be in [-1.0, 1.0] range.
  15218. Default value is @code{0}.
  15219. @end table
  15220. @subsection Examples
  15221. @itemize
  15222. @item
  15223. Extract an audio spectrogram of a whole audio track
  15224. in a 1024x1024 picture using @command{ffmpeg}:
  15225. @example
  15226. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15227. @end example
  15228. @end itemize
  15229. @section showvolume
  15230. Convert input audio volume to a video output.
  15231. The filter accepts the following options:
  15232. @table @option
  15233. @item rate, r
  15234. Set video rate.
  15235. @item b
  15236. Set border width, allowed range is [0, 5]. Default is 1.
  15237. @item w
  15238. Set channel width, allowed range is [80, 8192]. Default is 400.
  15239. @item h
  15240. Set channel height, allowed range is [1, 900]. Default is 20.
  15241. @item f
  15242. Set fade, allowed range is [0, 1]. Default is 0.95.
  15243. @item c
  15244. Set volume color expression.
  15245. The expression can use the following variables:
  15246. @table @option
  15247. @item VOLUME
  15248. Current max volume of channel in dB.
  15249. @item PEAK
  15250. Current peak.
  15251. @item CHANNEL
  15252. Current channel number, starting from 0.
  15253. @end table
  15254. @item t
  15255. If set, displays channel names. Default is enabled.
  15256. @item v
  15257. If set, displays volume values. Default is enabled.
  15258. @item o
  15259. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  15260. default is @code{h}.
  15261. @item s
  15262. Set step size, allowed range is [0, 5]. Default is 0, which means
  15263. step is disabled.
  15264. @item p
  15265. Set background opacity, allowed range is [0, 1]. Default is 0.
  15266. @item m
  15267. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15268. default is @code{p}.
  15269. @end table
  15270. @section showwaves
  15271. Convert input audio to a video output, representing the samples waves.
  15272. The filter accepts the following options:
  15273. @table @option
  15274. @item size, s
  15275. Specify the video size for the output. For the syntax of this option, check the
  15276. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15277. Default value is @code{600x240}.
  15278. @item mode
  15279. Set display mode.
  15280. Available values are:
  15281. @table @samp
  15282. @item point
  15283. Draw a point for each sample.
  15284. @item line
  15285. Draw a vertical line for each sample.
  15286. @item p2p
  15287. Draw a point for each sample and a line between them.
  15288. @item cline
  15289. Draw a centered vertical line for each sample.
  15290. @end table
  15291. Default value is @code{point}.
  15292. @item n
  15293. Set the number of samples which are printed on the same column. A
  15294. larger value will decrease the frame rate. Must be a positive
  15295. integer. This option can be set only if the value for @var{rate}
  15296. is not explicitly specified.
  15297. @item rate, r
  15298. Set the (approximate) output frame rate. This is done by setting the
  15299. option @var{n}. Default value is "25".
  15300. @item split_channels
  15301. Set if channels should be drawn separately or overlap. Default value is 0.
  15302. @item colors
  15303. Set colors separated by '|' which are going to be used for drawing of each channel.
  15304. @item scale
  15305. Set amplitude scale.
  15306. Available values are:
  15307. @table @samp
  15308. @item lin
  15309. Linear.
  15310. @item log
  15311. Logarithmic.
  15312. @item sqrt
  15313. Square root.
  15314. @item cbrt
  15315. Cubic root.
  15316. @end table
  15317. Default is linear.
  15318. @item draw
  15319. Set the draw mode. This is mostly useful to set for high @var{n}.
  15320. Available values are:
  15321. @table @samp
  15322. @item scale
  15323. Scale pixel values for each drawn sample.
  15324. @item full
  15325. Draw every sample directly.
  15326. @end table
  15327. Default value is @code{scale}.
  15328. @end table
  15329. @subsection Examples
  15330. @itemize
  15331. @item
  15332. Output the input file audio and the corresponding video representation
  15333. at the same time:
  15334. @example
  15335. amovie=a.mp3,asplit[out0],showwaves[out1]
  15336. @end example
  15337. @item
  15338. Create a synthetic signal and show it with showwaves, forcing a
  15339. frame rate of 30 frames per second:
  15340. @example
  15341. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15342. @end example
  15343. @end itemize
  15344. @section showwavespic
  15345. Convert input audio to a single video frame, representing the samples waves.
  15346. The filter accepts the following options:
  15347. @table @option
  15348. @item size, s
  15349. Specify the video size for the output. For the syntax of this option, check the
  15350. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15351. Default value is @code{600x240}.
  15352. @item split_channels
  15353. Set if channels should be drawn separately or overlap. Default value is 0.
  15354. @item colors
  15355. Set colors separated by '|' which are going to be used for drawing of each channel.
  15356. @item scale
  15357. Set amplitude scale.
  15358. Available values are:
  15359. @table @samp
  15360. @item lin
  15361. Linear.
  15362. @item log
  15363. Logarithmic.
  15364. @item sqrt
  15365. Square root.
  15366. @item cbrt
  15367. Cubic root.
  15368. @end table
  15369. Default is linear.
  15370. @end table
  15371. @subsection Examples
  15372. @itemize
  15373. @item
  15374. Extract a channel split representation of the wave form of a whole audio track
  15375. in a 1024x800 picture using @command{ffmpeg}:
  15376. @example
  15377. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15378. @end example
  15379. @end itemize
  15380. @section sidedata, asidedata
  15381. Delete frame side data, or select frames based on it.
  15382. This filter accepts the following options:
  15383. @table @option
  15384. @item mode
  15385. Set mode of operation of the filter.
  15386. Can be one of the following:
  15387. @table @samp
  15388. @item select
  15389. Select every frame with side data of @code{type}.
  15390. @item delete
  15391. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15392. data in the frame.
  15393. @end table
  15394. @item type
  15395. Set side data type used with all modes. Must be set for @code{select} mode. For
  15396. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15397. in @file{libavutil/frame.h}. For example, to choose
  15398. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15399. @end table
  15400. @section spectrumsynth
  15401. Sythesize audio from 2 input video spectrums, first input stream represents
  15402. magnitude across time and second represents phase across time.
  15403. The filter will transform from frequency domain as displayed in videos back
  15404. to time domain as presented in audio output.
  15405. This filter is primarily created for reversing processed @ref{showspectrum}
  15406. filter outputs, but can synthesize sound from other spectrograms too.
  15407. But in such case results are going to be poor if the phase data is not
  15408. available, because in such cases phase data need to be recreated, usually
  15409. its just recreated from random noise.
  15410. For best results use gray only output (@code{channel} color mode in
  15411. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15412. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15413. @code{data} option. Inputs videos should generally use @code{fullframe}
  15414. slide mode as that saves resources needed for decoding video.
  15415. The filter accepts the following options:
  15416. @table @option
  15417. @item sample_rate
  15418. Specify sample rate of output audio, the sample rate of audio from which
  15419. spectrum was generated may differ.
  15420. @item channels
  15421. Set number of channels represented in input video spectrums.
  15422. @item scale
  15423. Set scale which was used when generating magnitude input spectrum.
  15424. Can be @code{lin} or @code{log}. Default is @code{log}.
  15425. @item slide
  15426. Set slide which was used when generating inputs spectrums.
  15427. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15428. Default is @code{fullframe}.
  15429. @item win_func
  15430. Set window function used for resynthesis.
  15431. @item overlap
  15432. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15433. which means optimal overlap for selected window function will be picked.
  15434. @item orientation
  15435. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15436. Default is @code{vertical}.
  15437. @end table
  15438. @subsection Examples
  15439. @itemize
  15440. @item
  15441. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15442. then resynthesize videos back to audio with spectrumsynth:
  15443. @example
  15444. 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
  15445. 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
  15446. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15447. @end example
  15448. @end itemize
  15449. @section split, asplit
  15450. Split input into several identical outputs.
  15451. @code{asplit} works with audio input, @code{split} with video.
  15452. The filter accepts a single parameter which specifies the number of outputs. If
  15453. unspecified, it defaults to 2.
  15454. @subsection Examples
  15455. @itemize
  15456. @item
  15457. Create two separate outputs from the same input:
  15458. @example
  15459. [in] split [out0][out1]
  15460. @end example
  15461. @item
  15462. To create 3 or more outputs, you need to specify the number of
  15463. outputs, like in:
  15464. @example
  15465. [in] asplit=3 [out0][out1][out2]
  15466. @end example
  15467. @item
  15468. Create two separate outputs from the same input, one cropped and
  15469. one padded:
  15470. @example
  15471. [in] split [splitout1][splitout2];
  15472. [splitout1] crop=100:100:0:0 [cropout];
  15473. [splitout2] pad=200:200:100:100 [padout];
  15474. @end example
  15475. @item
  15476. Create 5 copies of the input audio with @command{ffmpeg}:
  15477. @example
  15478. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15479. @end example
  15480. @end itemize
  15481. @section zmq, azmq
  15482. Receive commands sent through a libzmq client, and forward them to
  15483. filters in the filtergraph.
  15484. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15485. must be inserted between two video filters, @code{azmq} between two
  15486. audio filters. Both are capable to send messages to any filter type.
  15487. To enable these filters you need to install the libzmq library and
  15488. headers and configure FFmpeg with @code{--enable-libzmq}.
  15489. For more information about libzmq see:
  15490. @url{http://www.zeromq.org/}
  15491. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15492. receives messages sent through a network interface defined by the
  15493. @option{bind_address} (or the abbreviation "@option{b}") option.
  15494. Default value of this option is @file{tcp://localhost:5555}. You may
  15495. want to alter this value to your needs, but do not forget to escape any
  15496. ':' signs (see @ref{filtergraph escaping}).
  15497. The received message must be in the form:
  15498. @example
  15499. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15500. @end example
  15501. @var{TARGET} specifies the target of the command, usually the name of
  15502. the filter class or a specific filter instance name. The default
  15503. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  15504. but you can override this by using the @samp{filter_name@@id} syntax
  15505. (see @ref{Filtergraph syntax}).
  15506. @var{COMMAND} specifies the name of the command for the target filter.
  15507. @var{ARG} is optional and specifies the optional argument list for the
  15508. given @var{COMMAND}.
  15509. Upon reception, the message is processed and the corresponding command
  15510. is injected into the filtergraph. Depending on the result, the filter
  15511. will send a reply to the client, adopting the format:
  15512. @example
  15513. @var{ERROR_CODE} @var{ERROR_REASON}
  15514. @var{MESSAGE}
  15515. @end example
  15516. @var{MESSAGE} is optional.
  15517. @subsection Examples
  15518. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15519. be used to send commands processed by these filters.
  15520. Consider the following filtergraph generated by @command{ffplay}.
  15521. In this example the last overlay filter has an instance name. All other
  15522. filters will have default instance names.
  15523. @example
  15524. ffplay -dumpgraph 1 -f lavfi "
  15525. color=s=100x100:c=red [l];
  15526. color=s=100x100:c=blue [r];
  15527. nullsrc=s=200x100, zmq [bg];
  15528. [bg][l] overlay [bg+l];
  15529. [bg+l][r] overlay@@my=x=100 "
  15530. @end example
  15531. To change the color of the left side of the video, the following
  15532. command can be used:
  15533. @example
  15534. echo Parsed_color_0 c yellow | tools/zmqsend
  15535. @end example
  15536. To change the right side:
  15537. @example
  15538. echo Parsed_color_1 c pink | tools/zmqsend
  15539. @end example
  15540. To change the position of the right side:
  15541. @example
  15542. echo overlay@@my x 150 | tools/zmqsend
  15543. @end example
  15544. @c man end MULTIMEDIA FILTERS
  15545. @chapter Multimedia Sources
  15546. @c man begin MULTIMEDIA SOURCES
  15547. Below is a description of the currently available multimedia sources.
  15548. @section amovie
  15549. This is the same as @ref{movie} source, except it selects an audio
  15550. stream by default.
  15551. @anchor{movie}
  15552. @section movie
  15553. Read audio and/or video stream(s) from a movie container.
  15554. It accepts the following parameters:
  15555. @table @option
  15556. @item filename
  15557. The name of the resource to read (not necessarily a file; it can also be a
  15558. device or a stream accessed through some protocol).
  15559. @item format_name, f
  15560. Specifies the format assumed for the movie to read, and can be either
  15561. the name of a container or an input device. If not specified, the
  15562. format is guessed from @var{movie_name} or by probing.
  15563. @item seek_point, sp
  15564. Specifies the seek point in seconds. The frames will be output
  15565. starting from this seek point. The parameter is evaluated with
  15566. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15567. postfix. The default value is "0".
  15568. @item streams, s
  15569. Specifies the streams to read. Several streams can be specified,
  15570. separated by "+". The source will then have as many outputs, in the
  15571. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  15572. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  15573. respectively the default (best suited) video and audio stream. Default
  15574. is "dv", or "da" if the filter is called as "amovie".
  15575. @item stream_index, si
  15576. Specifies the index of the video stream to read. If the value is -1,
  15577. the most suitable video stream will be automatically selected. The default
  15578. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15579. audio instead of video.
  15580. @item loop
  15581. Specifies how many times to read the stream in sequence.
  15582. If the value is 0, the stream will be looped infinitely.
  15583. Default value is "1".
  15584. Note that when the movie is looped the source timestamps are not
  15585. changed, so it will generate non monotonically increasing timestamps.
  15586. @item discontinuity
  15587. Specifies the time difference between frames above which the point is
  15588. considered a timestamp discontinuity which is removed by adjusting the later
  15589. timestamps.
  15590. @end table
  15591. It allows overlaying a second video on top of the main input of
  15592. a filtergraph, as shown in this graph:
  15593. @example
  15594. input -----------> deltapts0 --> overlay --> output
  15595. ^
  15596. |
  15597. movie --> scale--> deltapts1 -------+
  15598. @end example
  15599. @subsection Examples
  15600. @itemize
  15601. @item
  15602. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15603. on top of the input labelled "in":
  15604. @example
  15605. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15606. [in] setpts=PTS-STARTPTS [main];
  15607. [main][over] overlay=16:16 [out]
  15608. @end example
  15609. @item
  15610. Read from a video4linux2 device, and overlay it on top of the input
  15611. labelled "in":
  15612. @example
  15613. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15614. [in] setpts=PTS-STARTPTS [main];
  15615. [main][over] overlay=16:16 [out]
  15616. @end example
  15617. @item
  15618. Read the first video stream and the audio stream with id 0x81 from
  15619. dvd.vob; the video is connected to the pad named "video" and the audio is
  15620. connected to the pad named "audio":
  15621. @example
  15622. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15623. @end example
  15624. @end itemize
  15625. @subsection Commands
  15626. Both movie and amovie support the following commands:
  15627. @table @option
  15628. @item seek
  15629. Perform seek using "av_seek_frame".
  15630. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15631. @itemize
  15632. @item
  15633. @var{stream_index}: If stream_index is -1, a default
  15634. stream is selected, and @var{timestamp} is automatically converted
  15635. from AV_TIME_BASE units to the stream specific time_base.
  15636. @item
  15637. @var{timestamp}: Timestamp in AVStream.time_base units
  15638. or, if no stream is specified, in AV_TIME_BASE units.
  15639. @item
  15640. @var{flags}: Flags which select direction and seeking mode.
  15641. @end itemize
  15642. @item get_duration
  15643. Get movie duration in AV_TIME_BASE units.
  15644. @end table
  15645. @c man end MULTIMEDIA SOURCES