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.

19558 lines
519KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @anchor{framesync}
  251. @chapter Options for filters with several inputs (framesync)
  252. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  253. Some filters with several inputs support a common set of options.
  254. These options can only be set by name, not with the short notation.
  255. @table @option
  256. @item eof_action
  257. The action to take when EOF is encountered on the secondary input; it accepts
  258. one of the following values:
  259. @table @option
  260. @item repeat
  261. Repeat the last frame (the default).
  262. @item endall
  263. End both streams.
  264. @item pass
  265. Pass the main input through.
  266. @end table
  267. @item shortest
  268. If set to 1, force the output to terminate when the shortest input
  269. terminates. Default value is 0.
  270. @item repeatlast
  271. If set to 1, force the filter to extend the last frame of secondary streams
  272. until the end of the primary stream. A value of 0 disables this behavior.
  273. Default value is 1.
  274. @end table
  275. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  276. @chapter Audio Filters
  277. @c man begin AUDIO FILTERS
  278. When you configure your FFmpeg build, you can disable any of the
  279. existing filters using @code{--disable-filters}.
  280. The configure output will show the audio filters included in your
  281. build.
  282. Below is a description of the currently available audio filters.
  283. @section acompressor
  284. A compressor is mainly used to reduce the dynamic range of a signal.
  285. Especially modern music is mostly compressed at a high ratio to
  286. improve the overall loudness. It's done to get the highest attention
  287. of a listener, "fatten" the sound and bring more "power" to the track.
  288. If a signal is compressed too much it may sound dull or "dead"
  289. afterwards or it may start to "pump" (which could be a powerful effect
  290. but can also destroy a track completely).
  291. The right compression is the key to reach a professional sound and is
  292. the high art of mixing and mastering. Because of its complex settings
  293. it may take a long time to get the right feeling for this kind of effect.
  294. Compression is done by detecting the volume above a chosen level
  295. @code{threshold} and dividing it by the factor set with @code{ratio}.
  296. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  297. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  298. the signal would cause distortion of the waveform the reduction can be
  299. levelled over the time. This is done by setting "Attack" and "Release".
  300. @code{attack} determines how long the signal has to rise above the threshold
  301. before any reduction will occur and @code{release} sets the time the signal
  302. has to fall below the threshold to reduce the reduction again. Shorter signals
  303. than the chosen attack time will be left untouched.
  304. The overall reduction of the signal can be made up afterwards with the
  305. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  306. raising the makeup to this level results in a signal twice as loud than the
  307. source. To gain a softer entry in the compression the @code{knee} flattens the
  308. hard edge at the threshold in the range of the chosen decibels.
  309. The filter accepts the following options:
  310. @table @option
  311. @item level_in
  312. Set input gain. Default is 1. Range is between 0.015625 and 64.
  313. @item threshold
  314. If a signal of stream rises above this level it will affect the gain
  315. reduction.
  316. By default it is 0.125. Range is between 0.00097563 and 1.
  317. @item ratio
  318. Set a ratio by which the signal is reduced. 1:2 means that if the level
  319. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  320. Default is 2. Range is between 1 and 20.
  321. @item attack
  322. Amount of milliseconds the signal has to rise above the threshold before gain
  323. reduction starts. Default is 20. Range is between 0.01 and 2000.
  324. @item release
  325. Amount of milliseconds the signal has to fall below the threshold before
  326. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  327. @item makeup
  328. Set the amount by how much signal will be amplified after processing.
  329. Default is 1. Range is from 1 to 64.
  330. @item knee
  331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  332. Default is 2.82843. Range is between 1 and 8.
  333. @item link
  334. Choose if the @code{average} level between all channels of input stream
  335. or the louder(@code{maximum}) channel of input stream affects the
  336. reduction. Default is @code{average}.
  337. @item detection
  338. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  339. of @code{rms}. Default is @code{rms} which is mostly smoother.
  340. @item mix
  341. How much to use compressed signal in output. Default is 1.
  342. Range is between 0 and 1.
  343. @end table
  344. @section acontrast
  345. Simple audio dynamic range commpression/expansion filter.
  346. The filter accepts the following options:
  347. @table @option
  348. @item contrast
  349. Set contrast. Default is 33. Allowed range is between 0 and 100.
  350. @end table
  351. @section acopy
  352. Copy the input audio source unchanged to the output. This is mainly useful for
  353. testing purposes.
  354. @section acrossfade
  355. Apply cross fade from one input audio stream to another input audio stream.
  356. The cross fade is applied for specified duration near the end of first stream.
  357. The filter accepts the following options:
  358. @table @option
  359. @item nb_samples, ns
  360. Specify the number of samples for which the cross fade effect has to last.
  361. At the end of the cross fade effect the first input audio will be completely
  362. silent. Default is 44100.
  363. @item duration, d
  364. Specify the duration of the cross fade effect. See
  365. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  366. for the accepted syntax.
  367. By default the duration is determined by @var{nb_samples}.
  368. If set this option is used instead of @var{nb_samples}.
  369. @item overlap, o
  370. Should first stream end overlap with second stream start. Default is enabled.
  371. @item curve1
  372. Set curve for cross fade transition for first stream.
  373. @item curve2
  374. Set curve for cross fade transition for second stream.
  375. For description of available curve types see @ref{afade} filter description.
  376. @end table
  377. @subsection Examples
  378. @itemize
  379. @item
  380. Cross fade from one input to another:
  381. @example
  382. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  383. @end example
  384. @item
  385. Cross fade from one input to another but without overlapping:
  386. @example
  387. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  388. @end example
  389. @end itemize
  390. @section acrusher
  391. Reduce audio bit resolution.
  392. This filter is bit crusher with enhanced functionality. A bit crusher
  393. is used to audibly reduce number of bits an audio signal is sampled
  394. with. This doesn't change the bit depth at all, it just produces the
  395. effect. Material reduced in bit depth sounds more harsh and "digital".
  396. This filter is able to even round to continuous values instead of discrete
  397. bit depths.
  398. Additionally it has a D/C offset which results in different crushing of
  399. the lower and the upper half of the signal.
  400. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  401. Another feature of this filter is the logarithmic mode.
  402. This setting switches from linear distances between bits to logarithmic ones.
  403. The result is a much more "natural" sounding crusher which doesn't gate low
  404. signals for example. The human ear has a logarithmic perception, too
  405. so this kind of crushing is much more pleasant.
  406. Logarithmic crushing is also able to get anti-aliased.
  407. The filter accepts the following options:
  408. @table @option
  409. @item level_in
  410. Set level in.
  411. @item level_out
  412. Set level out.
  413. @item bits
  414. Set bit reduction.
  415. @item mix
  416. Set mixing amount.
  417. @item mode
  418. Can be linear: @code{lin} or logarithmic: @code{log}.
  419. @item dc
  420. Set DC.
  421. @item aa
  422. Set anti-aliasing.
  423. @item samples
  424. Set sample reduction.
  425. @item lfo
  426. Enable LFO. By default disabled.
  427. @item lforange
  428. Set LFO range.
  429. @item lforate
  430. Set LFO rate.
  431. @end table
  432. @section adelay
  433. Delay one or more audio channels.
  434. Samples in delayed channel are filled with silence.
  435. The filter accepts the following option:
  436. @table @option
  437. @item delays
  438. Set list of delays in milliseconds for each channel separated by '|'.
  439. Unused delays will be silently ignored. If number of given delays is
  440. smaller than number of channels all remaining channels will not be delayed.
  441. If you want to delay exact number of samples, append 'S' to number.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  447. the second channel (and any other channels that may be present) unchanged.
  448. @example
  449. adelay=1500|0|500
  450. @end example
  451. @item
  452. Delay second channel by 500 samples, the third channel by 700 samples and leave
  453. the first channel (and any other channels that may be present) unchanged.
  454. @example
  455. adelay=0|500S|700S
  456. @end example
  457. @end itemize
  458. @section aecho
  459. Apply echoing to the input audio.
  460. Echoes are reflected sound and can occur naturally amongst mountains
  461. (and sometimes large buildings) when talking or shouting; digital echo
  462. effects emulate this behaviour and are often used to help fill out the
  463. sound of a single instrument or vocal. The time difference between the
  464. original signal and the reflection is the @code{delay}, and the
  465. loudness of the reflected signal is the @code{decay}.
  466. Multiple echoes can have different delays and decays.
  467. A description of the accepted parameters follows.
  468. @table @option
  469. @item in_gain
  470. Set input gain of reflected signal. Default is @code{0.6}.
  471. @item out_gain
  472. Set output gain of reflected signal. Default is @code{0.3}.
  473. @item delays
  474. Set list of time intervals in milliseconds between original signal and reflections
  475. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  476. Default is @code{1000}.
  477. @item decays
  478. Set list of loudness of reflected signals separated by '|'.
  479. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  480. Default is @code{0.5}.
  481. @end table
  482. @subsection Examples
  483. @itemize
  484. @item
  485. Make it sound as if there are twice as many instruments as are actually playing:
  486. @example
  487. aecho=0.8:0.88:60:0.4
  488. @end example
  489. @item
  490. If delay is very short, then it sound like a (metallic) robot playing music:
  491. @example
  492. aecho=0.8:0.88:6:0.4
  493. @end example
  494. @item
  495. A longer delay will sound like an open air concert in the mountains:
  496. @example
  497. aecho=0.8:0.9:1000:0.3
  498. @end example
  499. @item
  500. Same as above but with one more mountain:
  501. @example
  502. aecho=0.8:0.9:1000|1800:0.3|0.25
  503. @end example
  504. @end itemize
  505. @section aemphasis
  506. Audio emphasis filter creates or restores material directly taken from LPs or
  507. emphased CDs with different filter curves. E.g. to store music on vinyl the
  508. signal has to be altered by a filter first to even out the disadvantages of
  509. this recording medium.
  510. Once the material is played back the inverse filter has to be applied to
  511. restore the distortion of the frequency response.
  512. The filter accepts the following options:
  513. @table @option
  514. @item level_in
  515. Set input gain.
  516. @item level_out
  517. Set output gain.
  518. @item mode
  519. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  520. use @code{production} mode. Default is @code{reproduction} mode.
  521. @item type
  522. Set filter type. Selects medium. Can be one of the following:
  523. @table @option
  524. @item col
  525. select Columbia.
  526. @item emi
  527. select EMI.
  528. @item bsi
  529. select BSI (78RPM).
  530. @item riaa
  531. select RIAA.
  532. @item cd
  533. select Compact Disc (CD).
  534. @item 50fm
  535. select 50µs (FM).
  536. @item 75fm
  537. select 75µs (FM).
  538. @item 50kf
  539. select 50µs (FM-KF).
  540. @item 75kf
  541. select 75µs (FM-KF).
  542. @end table
  543. @end table
  544. @section aeval
  545. Modify an audio signal according to the specified expressions.
  546. This filter accepts one or more expressions (one for each channel),
  547. which are evaluated and used to modify a corresponding audio signal.
  548. It accepts the following parameters:
  549. @table @option
  550. @item exprs
  551. Set the '|'-separated expressions list for each separate channel. If
  552. the number of input channels is greater than the number of
  553. expressions, the last specified expression is used for the remaining
  554. output channels.
  555. @item channel_layout, c
  556. Set output channel layout. If not specified, the channel layout is
  557. specified by the number of expressions. If set to @samp{same}, it will
  558. use by default the same input channel layout.
  559. @end table
  560. Each expression in @var{exprs} can contain the following constants and functions:
  561. @table @option
  562. @item ch
  563. channel number of the current expression
  564. @item n
  565. number of the evaluated sample, starting from 0
  566. @item s
  567. sample rate
  568. @item t
  569. time of the evaluated sample expressed in seconds
  570. @item nb_in_channels
  571. @item nb_out_channels
  572. input and output number of channels
  573. @item val(CH)
  574. the value of input channel with number @var{CH}
  575. @end table
  576. Note: this filter is slow. For faster processing you should use a
  577. dedicated filter.
  578. @subsection Examples
  579. @itemize
  580. @item
  581. Half volume:
  582. @example
  583. aeval=val(ch)/2:c=same
  584. @end example
  585. @item
  586. Invert phase of the second channel:
  587. @example
  588. aeval=val(0)|-val(1)
  589. @end example
  590. @end itemize
  591. @anchor{afade}
  592. @section afade
  593. Apply fade-in/out effect to input audio.
  594. A description of the accepted parameters follows.
  595. @table @option
  596. @item type, t
  597. Specify the effect type, can be either @code{in} for fade-in, or
  598. @code{out} for a fade-out effect. Default is @code{in}.
  599. @item start_sample, ss
  600. Specify the number of the start sample for starting to apply the fade
  601. effect. Default is 0.
  602. @item nb_samples, ns
  603. Specify the number of samples for which the fade effect has to last. At
  604. the end of the fade-in effect the output audio will have the same
  605. volume as the input audio, at the end of the fade-out transition
  606. the output audio will be silence. Default is 44100.
  607. @item start_time, st
  608. Specify the start time of the fade effect. Default is 0.
  609. The value must be specified as a time duration; see
  610. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  611. for the accepted syntax.
  612. If set this option is used instead of @var{start_sample}.
  613. @item duration, d
  614. Specify the duration of the fade effect. See
  615. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  616. for the accepted syntax.
  617. At the end of the fade-in effect the output audio will have the same
  618. volume as the input audio, at the end of the fade-out transition
  619. the output audio will be silence.
  620. By default the duration is determined by @var{nb_samples}.
  621. If set this option is used instead of @var{nb_samples}.
  622. @item curve
  623. Set curve for fade transition.
  624. It accepts the following values:
  625. @table @option
  626. @item tri
  627. select triangular, linear slope (default)
  628. @item qsin
  629. select quarter of sine wave
  630. @item hsin
  631. select half of sine wave
  632. @item esin
  633. select exponential sine wave
  634. @item log
  635. select logarithmic
  636. @item ipar
  637. select inverted parabola
  638. @item qua
  639. select quadratic
  640. @item cub
  641. select cubic
  642. @item squ
  643. select square root
  644. @item cbr
  645. select cubic root
  646. @item par
  647. select parabola
  648. @item exp
  649. select exponential
  650. @item iqsin
  651. select inverted quarter of sine wave
  652. @item ihsin
  653. select inverted half of sine wave
  654. @item dese
  655. select double-exponential seat
  656. @item desi
  657. select double-exponential sigmoid
  658. @end table
  659. @end table
  660. @subsection Examples
  661. @itemize
  662. @item
  663. Fade in first 15 seconds of audio:
  664. @example
  665. afade=t=in:ss=0:d=15
  666. @end example
  667. @item
  668. Fade out last 25 seconds of a 900 seconds audio:
  669. @example
  670. afade=t=out:st=875:d=25
  671. @end example
  672. @end itemize
  673. @section afftfilt
  674. Apply arbitrary expressions to samples in frequency domain.
  675. @table @option
  676. @item real
  677. Set frequency domain real expression for each separate channel separated
  678. by '|'. Default is "1".
  679. If the number of input channels is greater than the number of
  680. expressions, the last specified expression is used for the remaining
  681. output channels.
  682. @item imag
  683. Set frequency domain imaginary expression for each separate channel
  684. separated by '|'. If not set, @var{real} option is used.
  685. Each expression in @var{real} and @var{imag} can contain the following
  686. constants:
  687. @table @option
  688. @item sr
  689. sample rate
  690. @item b
  691. current frequency bin number
  692. @item nb
  693. number of available bins
  694. @item ch
  695. channel number of the current expression
  696. @item chs
  697. number of channels
  698. @item pts
  699. current frame pts
  700. @end table
  701. @item win_size
  702. Set window size.
  703. It accepts the following values:
  704. @table @samp
  705. @item w16
  706. @item w32
  707. @item w64
  708. @item w128
  709. @item w256
  710. @item w512
  711. @item w1024
  712. @item w2048
  713. @item w4096
  714. @item w8192
  715. @item w16384
  716. @item w32768
  717. @item w65536
  718. @end table
  719. Default is @code{w4096}
  720. @item win_func
  721. Set window function. Default is @code{hann}.
  722. @item overlap
  723. Set window overlap. If set to 1, the recommended overlap for selected
  724. window function will be picked. Default is @code{0.75}.
  725. @end table
  726. @subsection Examples
  727. @itemize
  728. @item
  729. Leave almost only low frequencies in audio:
  730. @example
  731. afftfilt="1-clip((b/nb)*b,0,1)"
  732. @end example
  733. @end itemize
  734. @section afir
  735. Apply an arbitrary Frequency Impulse Response filter.
  736. This filter is designed for applying long FIR filters,
  737. up to 30 seconds long.
  738. It can be used as component for digital crossover filters,
  739. room equalization, cross talk cancellation, wavefield synthesis,
  740. auralization, ambiophonics and ambisonics.
  741. This filter uses second stream as FIR coefficients.
  742. If second stream holds single channel, it will be used
  743. for all input channels in first stream, otherwise
  744. number of channels in second stream must be same as
  745. number of channels in first stream.
  746. It accepts the following parameters:
  747. @table @option
  748. @item dry
  749. Set dry gain. This sets input gain.
  750. @item wet
  751. Set wet gain. This sets final output gain.
  752. @item length
  753. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  754. @item again
  755. Enable applying gain measured from power of IR.
  756. @end table
  757. @subsection Examples
  758. @itemize
  759. @item
  760. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  761. @example
  762. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  763. @end example
  764. @end itemize
  765. @anchor{aformat}
  766. @section aformat
  767. Set output format constraints for the input audio. The framework will
  768. negotiate the most appropriate format to minimize conversions.
  769. It accepts the following parameters:
  770. @table @option
  771. @item sample_fmts
  772. A '|'-separated list of requested sample formats.
  773. @item sample_rates
  774. A '|'-separated list of requested sample rates.
  775. @item channel_layouts
  776. A '|'-separated list of requested channel layouts.
  777. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  778. for the required syntax.
  779. @end table
  780. If a parameter is omitted, all values are allowed.
  781. Force the output to either unsigned 8-bit or signed 16-bit stereo
  782. @example
  783. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  784. @end example
  785. @section agate
  786. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  787. processing reduces disturbing noise between useful signals.
  788. Gating is done by detecting the volume below a chosen level @var{threshold}
  789. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  790. floor is set via @var{range}. Because an exact manipulation of the signal
  791. would cause distortion of the waveform the reduction can be levelled over
  792. time. This is done by setting @var{attack} and @var{release}.
  793. @var{attack} determines how long the signal has to fall below the threshold
  794. before any reduction will occur and @var{release} sets the time the signal
  795. has to rise above the threshold to reduce the reduction again.
  796. Shorter signals than the chosen attack time will be left untouched.
  797. @table @option
  798. @item level_in
  799. Set input level before filtering.
  800. Default is 1. Allowed range is from 0.015625 to 64.
  801. @item range
  802. Set the level of gain reduction when the signal is below the threshold.
  803. Default is 0.06125. Allowed range is from 0 to 1.
  804. @item threshold
  805. If a signal rises above this level the gain reduction is released.
  806. Default is 0.125. Allowed range is from 0 to 1.
  807. @item ratio
  808. Set a ratio by which the signal is reduced.
  809. Default is 2. Allowed range is from 1 to 9000.
  810. @item attack
  811. Amount of milliseconds the signal has to rise above the threshold before gain
  812. reduction stops.
  813. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  814. @item release
  815. Amount of milliseconds the signal has to fall below the threshold before the
  816. reduction is increased again. Default is 250 milliseconds.
  817. Allowed range is from 0.01 to 9000.
  818. @item makeup
  819. Set amount of amplification of signal after processing.
  820. Default is 1. Allowed range is from 1 to 64.
  821. @item knee
  822. Curve the sharp knee around the threshold to enter gain reduction more softly.
  823. Default is 2.828427125. Allowed range is from 1 to 8.
  824. @item detection
  825. Choose if exact signal should be taken for detection or an RMS like one.
  826. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  827. @item link
  828. Choose if the average level between all channels or the louder channel affects
  829. the reduction.
  830. Default is @code{average}. Can be @code{average} or @code{maximum}.
  831. @end table
  832. @section alimiter
  833. The limiter prevents an input signal from rising over a desired threshold.
  834. This limiter uses lookahead technology to prevent your signal from distorting.
  835. It means that there is a small delay after the signal is processed. Keep in mind
  836. that the delay it produces is the attack time you set.
  837. The filter accepts the following options:
  838. @table @option
  839. @item level_in
  840. Set input gain. Default is 1.
  841. @item level_out
  842. Set output gain. Default is 1.
  843. @item limit
  844. Don't let signals above this level pass the limiter. Default is 1.
  845. @item attack
  846. The limiter will reach its attenuation level in this amount of time in
  847. milliseconds. Default is 5 milliseconds.
  848. @item release
  849. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  850. Default is 50 milliseconds.
  851. @item asc
  852. When gain reduction is always needed ASC takes care of releasing to an
  853. average reduction level rather than reaching a reduction of 0 in the release
  854. time.
  855. @item asc_level
  856. Select how much the release time is affected by ASC, 0 means nearly no changes
  857. in release time while 1 produces higher release times.
  858. @item level
  859. Auto level output signal. Default is enabled.
  860. This normalizes audio back to 0dB if enabled.
  861. @end table
  862. Depending on picked setting it is recommended to upsample input 2x or 4x times
  863. with @ref{aresample} before applying this filter.
  864. @section allpass
  865. Apply a two-pole all-pass filter with central frequency (in Hz)
  866. @var{frequency}, and filter-width @var{width}.
  867. An all-pass filter changes the audio's frequency to phase relationship
  868. without changing its frequency to amplitude relationship.
  869. The filter accepts the following options:
  870. @table @option
  871. @item frequency, f
  872. Set frequency in Hz.
  873. @item width_type, t
  874. Set method to specify band-width of filter.
  875. @table @option
  876. @item h
  877. Hz
  878. @item q
  879. Q-Factor
  880. @item o
  881. octave
  882. @item s
  883. slope
  884. @end table
  885. @item width, w
  886. Specify the band-width of a filter in width_type units.
  887. @item channels, c
  888. Specify which channels to filter, by default all available are filtered.
  889. @end table
  890. @section aloop
  891. Loop audio samples.
  892. The filter accepts the following options:
  893. @table @option
  894. @item loop
  895. Set the number of loops.
  896. @item size
  897. Set maximal number of samples.
  898. @item start
  899. Set first sample of loop.
  900. @end table
  901. @anchor{amerge}
  902. @section amerge
  903. Merge two or more audio streams into a single multi-channel stream.
  904. The filter accepts the following options:
  905. @table @option
  906. @item inputs
  907. Set the number of inputs. Default is 2.
  908. @end table
  909. If the channel layouts of the inputs are disjoint, and therefore compatible,
  910. the channel layout of the output will be set accordingly and the channels
  911. will be reordered as necessary. If the channel layouts of the inputs are not
  912. disjoint, the output will have all the channels of the first input then all
  913. the channels of the second input, in that order, and the channel layout of
  914. the output will be the default value corresponding to the total number of
  915. channels.
  916. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  917. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  918. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  919. first input, b1 is the first channel of the second input).
  920. On the other hand, if both input are in stereo, the output channels will be
  921. in the default order: a1, a2, b1, b2, and the channel layout will be
  922. arbitrarily set to 4.0, which may or may not be the expected value.
  923. All inputs must have the same sample rate, and format.
  924. If inputs do not have the same duration, the output will stop with the
  925. shortest.
  926. @subsection Examples
  927. @itemize
  928. @item
  929. Merge two mono files into a stereo stream:
  930. @example
  931. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  932. @end example
  933. @item
  934. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  935. @example
  936. 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
  937. @end example
  938. @end itemize
  939. @section amix
  940. Mixes multiple audio inputs into a single output.
  941. Note that this filter only supports float samples (the @var{amerge}
  942. and @var{pan} audio filters support many formats). If the @var{amix}
  943. input has integer samples then @ref{aresample} will be automatically
  944. inserted to perform the conversion to float samples.
  945. For example
  946. @example
  947. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  948. @end example
  949. will mix 3 input audio streams to a single output with the same duration as the
  950. first input and a dropout transition time of 3 seconds.
  951. It accepts the following parameters:
  952. @table @option
  953. @item inputs
  954. The number of inputs. If unspecified, it defaults to 2.
  955. @item duration
  956. How to determine the end-of-stream.
  957. @table @option
  958. @item longest
  959. The duration of the longest input. (default)
  960. @item shortest
  961. The duration of the shortest input.
  962. @item first
  963. The duration of the first input.
  964. @end table
  965. @item dropout_transition
  966. The transition time, in seconds, for volume renormalization when an input
  967. stream ends. The default value is 2 seconds.
  968. @end table
  969. @section anequalizer
  970. High-order parametric multiband equalizer for each channel.
  971. It accepts the following parameters:
  972. @table @option
  973. @item params
  974. This option string is in format:
  975. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  976. Each equalizer band is separated by '|'.
  977. @table @option
  978. @item chn
  979. Set channel number to which equalization will be applied.
  980. If input doesn't have that channel the entry is ignored.
  981. @item f
  982. Set central frequency for band.
  983. If input doesn't have that frequency the entry is ignored.
  984. @item w
  985. Set band width in hertz.
  986. @item g
  987. Set band gain in dB.
  988. @item t
  989. Set filter type for band, optional, can be:
  990. @table @samp
  991. @item 0
  992. Butterworth, this is default.
  993. @item 1
  994. Chebyshev type 1.
  995. @item 2
  996. Chebyshev type 2.
  997. @end table
  998. @end table
  999. @item curves
  1000. With this option activated frequency response of anequalizer is displayed
  1001. in video stream.
  1002. @item size
  1003. Set video stream size. Only useful if curves option is activated.
  1004. @item mgain
  1005. Set max gain that will be displayed. Only useful if curves option is activated.
  1006. Setting this to a reasonable value makes it possible to display gain which is derived from
  1007. neighbour bands which are too close to each other and thus produce higher gain
  1008. when both are activated.
  1009. @item fscale
  1010. Set frequency scale used to draw frequency response in video output.
  1011. Can be linear or logarithmic. Default is logarithmic.
  1012. @item colors
  1013. Set color for each channel curve which is going to be displayed in video stream.
  1014. This is list of color names separated by space or by '|'.
  1015. Unrecognised or missing colors will be replaced by white color.
  1016. @end table
  1017. @subsection Examples
  1018. @itemize
  1019. @item
  1020. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1021. for first 2 channels using Chebyshev type 1 filter:
  1022. @example
  1023. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1024. @end example
  1025. @end itemize
  1026. @subsection Commands
  1027. This filter supports the following commands:
  1028. @table @option
  1029. @item change
  1030. Alter existing filter parameters.
  1031. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1032. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1033. error is returned.
  1034. @var{freq} set new frequency parameter.
  1035. @var{width} set new width parameter in herz.
  1036. @var{gain} set new gain parameter in dB.
  1037. Full filter invocation with asendcmd may look like this:
  1038. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1039. @end table
  1040. @section anull
  1041. Pass the audio source unchanged to the output.
  1042. @section apad
  1043. Pad the end of an audio stream with silence.
  1044. This can be used together with @command{ffmpeg} @option{-shortest} to
  1045. extend audio streams to the same length as the video stream.
  1046. A description of the accepted options follows.
  1047. @table @option
  1048. @item packet_size
  1049. Set silence packet size. Default value is 4096.
  1050. @item pad_len
  1051. Set the number of samples of silence to add to the end. After the
  1052. value is reached, the stream is terminated. This option is mutually
  1053. exclusive with @option{whole_len}.
  1054. @item whole_len
  1055. Set the minimum total number of samples in the output audio stream. If
  1056. the value is longer than the input audio length, silence is added to
  1057. the end, until the value is reached. This option is mutually exclusive
  1058. with @option{pad_len}.
  1059. @end table
  1060. If neither the @option{pad_len} nor the @option{whole_len} option is
  1061. set, the filter will add silence to the end of the input stream
  1062. indefinitely.
  1063. @subsection Examples
  1064. @itemize
  1065. @item
  1066. Add 1024 samples of silence to the end of the input:
  1067. @example
  1068. apad=pad_len=1024
  1069. @end example
  1070. @item
  1071. Make sure the audio output will contain at least 10000 samples, pad
  1072. the input with silence if required:
  1073. @example
  1074. apad=whole_len=10000
  1075. @end example
  1076. @item
  1077. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1078. video stream will always result the shortest and will be converted
  1079. until the end in the output file when using the @option{shortest}
  1080. option:
  1081. @example
  1082. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1083. @end example
  1084. @end itemize
  1085. @section aphaser
  1086. Add a phasing effect to the input audio.
  1087. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1088. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1089. A description of the accepted parameters follows.
  1090. @table @option
  1091. @item in_gain
  1092. Set input gain. Default is 0.4.
  1093. @item out_gain
  1094. Set output gain. Default is 0.74
  1095. @item delay
  1096. Set delay in milliseconds. Default is 3.0.
  1097. @item decay
  1098. Set decay. Default is 0.4.
  1099. @item speed
  1100. Set modulation speed in Hz. Default is 0.5.
  1101. @item type
  1102. Set modulation type. Default is triangular.
  1103. It accepts the following values:
  1104. @table @samp
  1105. @item triangular, t
  1106. @item sinusoidal, s
  1107. @end table
  1108. @end table
  1109. @section apulsator
  1110. Audio pulsator is something between an autopanner and a tremolo.
  1111. But it can produce funny stereo effects as well. Pulsator changes the volume
  1112. of the left and right channel based on a LFO (low frequency oscillator) with
  1113. different waveforms and shifted phases.
  1114. This filter have the ability to define an offset between left and right
  1115. channel. An offset of 0 means that both LFO shapes match each other.
  1116. The left and right channel are altered equally - a conventional tremolo.
  1117. An offset of 50% means that the shape of the right channel is exactly shifted
  1118. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1119. an autopanner. At 1 both curves match again. Every setting in between moves the
  1120. phase shift gapless between all stages and produces some "bypassing" sounds with
  1121. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1122. the 0.5) the faster the signal passes from the left to the right speaker.
  1123. The filter accepts the following options:
  1124. @table @option
  1125. @item level_in
  1126. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1127. @item level_out
  1128. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1129. @item mode
  1130. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1131. sawup or sawdown. Default is sine.
  1132. @item amount
  1133. Set modulation. Define how much of original signal is affected by the LFO.
  1134. @item offset_l
  1135. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1136. @item offset_r
  1137. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1138. @item width
  1139. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1140. @item timing
  1141. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1142. @item bpm
  1143. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1144. is set to bpm.
  1145. @item ms
  1146. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1147. is set to ms.
  1148. @item hz
  1149. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1150. if timing is set to hz.
  1151. @end table
  1152. @anchor{aresample}
  1153. @section aresample
  1154. Resample the input audio to the specified parameters, using the
  1155. libswresample library. If none are specified then the filter will
  1156. automatically convert between its input and output.
  1157. This filter is also able to stretch/squeeze the audio data to make it match
  1158. the timestamps or to inject silence / cut out audio to make it match the
  1159. timestamps, do a combination of both or do neither.
  1160. The filter accepts the syntax
  1161. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1162. expresses a sample rate and @var{resampler_options} is a list of
  1163. @var{key}=@var{value} pairs, separated by ":". See the
  1164. @ref{Resampler Options,,the "Resampler Options" section in the
  1165. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1166. for the complete list of supported options.
  1167. @subsection Examples
  1168. @itemize
  1169. @item
  1170. Resample the input audio to 44100Hz:
  1171. @example
  1172. aresample=44100
  1173. @end example
  1174. @item
  1175. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1176. samples per second compensation:
  1177. @example
  1178. aresample=async=1000
  1179. @end example
  1180. @end itemize
  1181. @section areverse
  1182. Reverse an audio clip.
  1183. Warning: This filter requires memory to buffer the entire clip, so trimming
  1184. is suggested.
  1185. @subsection Examples
  1186. @itemize
  1187. @item
  1188. Take the first 5 seconds of a clip, and reverse it.
  1189. @example
  1190. atrim=end=5,areverse
  1191. @end example
  1192. @end itemize
  1193. @section asetnsamples
  1194. Set the number of samples per each output audio frame.
  1195. The last output packet may contain a different number of samples, as
  1196. the filter will flush all the remaining samples when the input audio
  1197. signals its end.
  1198. The filter accepts the following options:
  1199. @table @option
  1200. @item nb_out_samples, n
  1201. Set the number of frames per each output audio frame. The number is
  1202. intended as the number of samples @emph{per each channel}.
  1203. Default value is 1024.
  1204. @item pad, p
  1205. If set to 1, the filter will pad the last audio frame with zeroes, so
  1206. that the last frame will contain the same number of samples as the
  1207. previous ones. Default value is 1.
  1208. @end table
  1209. For example, to set the number of per-frame samples to 1234 and
  1210. disable padding for the last frame, use:
  1211. @example
  1212. asetnsamples=n=1234:p=0
  1213. @end example
  1214. @section asetrate
  1215. Set the sample rate without altering the PCM data.
  1216. This will result in a change of speed and pitch.
  1217. The filter accepts the following options:
  1218. @table @option
  1219. @item sample_rate, r
  1220. Set the output sample rate. Default is 44100 Hz.
  1221. @end table
  1222. @section ashowinfo
  1223. Show a line containing various information for each input audio frame.
  1224. The input audio is not modified.
  1225. The shown line contains a sequence of key/value pairs of the form
  1226. @var{key}:@var{value}.
  1227. The following values are shown in the output:
  1228. @table @option
  1229. @item n
  1230. The (sequential) number of the input frame, starting from 0.
  1231. @item pts
  1232. The presentation timestamp of the input frame, in time base units; the time base
  1233. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1234. @item pts_time
  1235. The presentation timestamp of the input frame in seconds.
  1236. @item pos
  1237. position of the frame in the input stream, -1 if this information in
  1238. unavailable and/or meaningless (for example in case of synthetic audio)
  1239. @item fmt
  1240. The sample format.
  1241. @item chlayout
  1242. The channel layout.
  1243. @item rate
  1244. The sample rate for the audio frame.
  1245. @item nb_samples
  1246. The number of samples (per channel) in the frame.
  1247. @item checksum
  1248. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1249. audio, the data is treated as if all the planes were concatenated.
  1250. @item plane_checksums
  1251. A list of Adler-32 checksums for each data plane.
  1252. @end table
  1253. @anchor{astats}
  1254. @section astats
  1255. Display time domain statistical information about the audio channels.
  1256. Statistics are calculated and displayed for each audio channel and,
  1257. where applicable, an overall figure is also given.
  1258. It accepts the following option:
  1259. @table @option
  1260. @item length
  1261. Short window length in seconds, used for peak and trough RMS measurement.
  1262. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1263. @item metadata
  1264. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1265. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1266. disabled.
  1267. Available keys for each channel are:
  1268. DC_offset
  1269. Min_level
  1270. Max_level
  1271. Min_difference
  1272. Max_difference
  1273. Mean_difference
  1274. RMS_difference
  1275. Peak_level
  1276. RMS_peak
  1277. RMS_trough
  1278. Crest_factor
  1279. Flat_factor
  1280. Peak_count
  1281. Bit_depth
  1282. Dynamic_range
  1283. and for Overall:
  1284. DC_offset
  1285. Min_level
  1286. Max_level
  1287. Min_difference
  1288. Max_difference
  1289. Mean_difference
  1290. RMS_difference
  1291. Peak_level
  1292. RMS_level
  1293. RMS_peak
  1294. RMS_trough
  1295. Flat_factor
  1296. Peak_count
  1297. Bit_depth
  1298. Number_of_samples
  1299. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1300. this @code{lavfi.astats.Overall.Peak_count}.
  1301. For description what each key means read below.
  1302. @item reset
  1303. Set number of frame after which stats are going to be recalculated.
  1304. Default is disabled.
  1305. @end table
  1306. A description of each shown parameter follows:
  1307. @table @option
  1308. @item DC offset
  1309. Mean amplitude displacement from zero.
  1310. @item Min level
  1311. Minimal sample level.
  1312. @item Max level
  1313. Maximal sample level.
  1314. @item Min difference
  1315. Minimal difference between two consecutive samples.
  1316. @item Max difference
  1317. Maximal difference between two consecutive samples.
  1318. @item Mean difference
  1319. Mean difference between two consecutive samples.
  1320. The average of each difference between two consecutive samples.
  1321. @item RMS difference
  1322. Root Mean Square difference between two consecutive samples.
  1323. @item Peak level dB
  1324. @item RMS level dB
  1325. Standard peak and RMS level measured in dBFS.
  1326. @item RMS peak dB
  1327. @item RMS trough dB
  1328. Peak and trough values for RMS level measured over a short window.
  1329. @item Crest factor
  1330. Standard ratio of peak to RMS level (note: not in dB).
  1331. @item Flat factor
  1332. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1333. (i.e. either @var{Min level} or @var{Max level}).
  1334. @item Peak count
  1335. Number of occasions (not the number of samples) that the signal attained either
  1336. @var{Min level} or @var{Max level}.
  1337. @item Bit depth
  1338. Overall bit depth of audio. Number of bits used for each sample.
  1339. @item Dynamic range
  1340. Measured dynamic range of audio in dB.
  1341. @end table
  1342. @section atempo
  1343. Adjust audio tempo.
  1344. The filter accepts exactly one parameter, the audio tempo. If not
  1345. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1346. be in the [0.5, 2.0] range.
  1347. @subsection Examples
  1348. @itemize
  1349. @item
  1350. Slow down audio to 80% tempo:
  1351. @example
  1352. atempo=0.8
  1353. @end example
  1354. @item
  1355. To speed up audio to 125% tempo:
  1356. @example
  1357. atempo=1.25
  1358. @end example
  1359. @end itemize
  1360. @section atrim
  1361. Trim the input so that the output contains one continuous subpart of the input.
  1362. It accepts the following parameters:
  1363. @table @option
  1364. @item start
  1365. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1366. sample with the timestamp @var{start} will be the first sample in the output.
  1367. @item end
  1368. Specify time of the first audio sample that will be dropped, i.e. the
  1369. audio sample immediately preceding the one with the timestamp @var{end} will be
  1370. the last sample in the output.
  1371. @item start_pts
  1372. Same as @var{start}, except this option sets the start timestamp in samples
  1373. instead of seconds.
  1374. @item end_pts
  1375. Same as @var{end}, except this option sets the end timestamp in samples instead
  1376. of seconds.
  1377. @item duration
  1378. The maximum duration of the output in seconds.
  1379. @item start_sample
  1380. The number of the first sample that should be output.
  1381. @item end_sample
  1382. The number of the first sample that should be dropped.
  1383. @end table
  1384. @option{start}, @option{end}, and @option{duration} are expressed as time
  1385. duration specifications; see
  1386. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1387. Note that the first two sets of the start/end options and the @option{duration}
  1388. option look at the frame timestamp, while the _sample options simply count the
  1389. samples that pass through the filter. So start/end_pts and start/end_sample will
  1390. give different results when the timestamps are wrong, inexact or do not start at
  1391. zero. Also note that this filter does not modify the timestamps. If you wish
  1392. to have the output timestamps start at zero, insert the asetpts filter after the
  1393. atrim filter.
  1394. If multiple start or end options are set, this filter tries to be greedy and
  1395. keep all samples that match at least one of the specified constraints. To keep
  1396. only the part that matches all the constraints at once, chain multiple atrim
  1397. filters.
  1398. The defaults are such that all the input is kept. So it is possible to set e.g.
  1399. just the end values to keep everything before the specified time.
  1400. Examples:
  1401. @itemize
  1402. @item
  1403. Drop everything except the second minute of input:
  1404. @example
  1405. ffmpeg -i INPUT -af atrim=60:120
  1406. @end example
  1407. @item
  1408. Keep only the first 1000 samples:
  1409. @example
  1410. ffmpeg -i INPUT -af atrim=end_sample=1000
  1411. @end example
  1412. @end itemize
  1413. @section bandpass
  1414. Apply a two-pole Butterworth band-pass filter with central
  1415. frequency @var{frequency}, and (3dB-point) band-width width.
  1416. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1417. instead of the default: constant 0dB peak gain.
  1418. The filter roll off at 6dB per octave (20dB per decade).
  1419. The filter accepts the following options:
  1420. @table @option
  1421. @item frequency, f
  1422. Set the filter's central frequency. Default is @code{3000}.
  1423. @item csg
  1424. Constant skirt gain if set to 1. Defaults to 0.
  1425. @item width_type, t
  1426. Set method to specify band-width of filter.
  1427. @table @option
  1428. @item h
  1429. Hz
  1430. @item q
  1431. Q-Factor
  1432. @item o
  1433. octave
  1434. @item s
  1435. slope
  1436. @end table
  1437. @item width, w
  1438. Specify the band-width of a filter in width_type units.
  1439. @item channels, c
  1440. Specify which channels to filter, by default all available are filtered.
  1441. @end table
  1442. @section bandreject
  1443. Apply a two-pole Butterworth band-reject filter with central
  1444. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1445. The filter roll off at 6dB per octave (20dB per decade).
  1446. The filter accepts the following options:
  1447. @table @option
  1448. @item frequency, f
  1449. Set the filter's central frequency. Default is @code{3000}.
  1450. @item width_type, t
  1451. Set method to specify band-width of filter.
  1452. @table @option
  1453. @item h
  1454. Hz
  1455. @item q
  1456. Q-Factor
  1457. @item o
  1458. octave
  1459. @item s
  1460. slope
  1461. @end table
  1462. @item width, w
  1463. Specify the band-width of a filter in width_type units.
  1464. @item channels, c
  1465. Specify which channels to filter, by default all available are filtered.
  1466. @end table
  1467. @section bass
  1468. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1469. shelving filter with a response similar to that of a standard
  1470. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1471. The filter accepts the following options:
  1472. @table @option
  1473. @item gain, g
  1474. Give the gain at 0 Hz. Its useful range is about -20
  1475. (for a large cut) to +20 (for a large boost).
  1476. Beware of clipping when using a positive gain.
  1477. @item frequency, f
  1478. Set the filter's central frequency and so can be used
  1479. to extend or reduce the frequency range to be boosted or cut.
  1480. The default value is @code{100} Hz.
  1481. @item width_type, t
  1482. Set method to specify band-width of filter.
  1483. @table @option
  1484. @item h
  1485. Hz
  1486. @item q
  1487. Q-Factor
  1488. @item o
  1489. octave
  1490. @item s
  1491. slope
  1492. @end table
  1493. @item width, w
  1494. Determine how steep is the filter's shelf transition.
  1495. @item channels, c
  1496. Specify which channels to filter, by default all available are filtered.
  1497. @end table
  1498. @section biquad
  1499. Apply a biquad IIR filter with the given coefficients.
  1500. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1501. are the numerator and denominator coefficients respectively.
  1502. and @var{channels}, @var{c} specify which channels to filter, by default all
  1503. available are filtered.
  1504. @section bs2b
  1505. Bauer stereo to binaural transformation, which improves headphone listening of
  1506. stereo audio records.
  1507. To enable compilation of this filter you need to configure FFmpeg with
  1508. @code{--enable-libbs2b}.
  1509. It accepts the following parameters:
  1510. @table @option
  1511. @item profile
  1512. Pre-defined crossfeed level.
  1513. @table @option
  1514. @item default
  1515. Default level (fcut=700, feed=50).
  1516. @item cmoy
  1517. Chu Moy circuit (fcut=700, feed=60).
  1518. @item jmeier
  1519. Jan Meier circuit (fcut=650, feed=95).
  1520. @end table
  1521. @item fcut
  1522. Cut frequency (in Hz).
  1523. @item feed
  1524. Feed level (in Hz).
  1525. @end table
  1526. @section channelmap
  1527. Remap input channels to new locations.
  1528. It accepts the following parameters:
  1529. @table @option
  1530. @item map
  1531. Map channels from input to output. The argument is a '|'-separated list of
  1532. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1533. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1534. channel (e.g. FL for front left) or its index in the input channel layout.
  1535. @var{out_channel} is the name of the output channel or its index in the output
  1536. channel layout. If @var{out_channel} is not given then it is implicitly an
  1537. index, starting with zero and increasing by one for each mapping.
  1538. @item channel_layout
  1539. The channel layout of the output stream.
  1540. @end table
  1541. If no mapping is present, the filter will implicitly map input channels to
  1542. output channels, preserving indices.
  1543. For example, assuming a 5.1+downmix input MOV file,
  1544. @example
  1545. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1546. @end example
  1547. will create an output WAV file tagged as stereo from the downmix channels of
  1548. the input.
  1549. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1550. @example
  1551. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1552. @end example
  1553. @section channelsplit
  1554. Split each channel from an input audio stream into a separate output stream.
  1555. It accepts the following parameters:
  1556. @table @option
  1557. @item channel_layout
  1558. The channel layout of the input stream. The default is "stereo".
  1559. @end table
  1560. For example, assuming a stereo input MP3 file,
  1561. @example
  1562. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1563. @end example
  1564. will create an output Matroska file with two audio streams, one containing only
  1565. the left channel and the other the right channel.
  1566. Split a 5.1 WAV file into per-channel files:
  1567. @example
  1568. ffmpeg -i in.wav -filter_complex
  1569. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1570. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1571. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1572. side_right.wav
  1573. @end example
  1574. @section chorus
  1575. Add a chorus effect to the audio.
  1576. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1577. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1578. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1579. The modulation depth defines the range the modulated delay is played before or after
  1580. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1581. sound tuned around the original one, like in a chorus where some vocals are slightly
  1582. off key.
  1583. It accepts the following parameters:
  1584. @table @option
  1585. @item in_gain
  1586. Set input gain. Default is 0.4.
  1587. @item out_gain
  1588. Set output gain. Default is 0.4.
  1589. @item delays
  1590. Set delays. A typical delay is around 40ms to 60ms.
  1591. @item decays
  1592. Set decays.
  1593. @item speeds
  1594. Set speeds.
  1595. @item depths
  1596. Set depths.
  1597. @end table
  1598. @subsection Examples
  1599. @itemize
  1600. @item
  1601. A single delay:
  1602. @example
  1603. chorus=0.7:0.9:55:0.4:0.25:2
  1604. @end example
  1605. @item
  1606. Two delays:
  1607. @example
  1608. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1609. @end example
  1610. @item
  1611. Fuller sounding chorus with three delays:
  1612. @example
  1613. 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
  1614. @end example
  1615. @end itemize
  1616. @section compand
  1617. Compress or expand the audio's dynamic range.
  1618. It accepts the following parameters:
  1619. @table @option
  1620. @item attacks
  1621. @item decays
  1622. A list of times in seconds for each channel over which the instantaneous level
  1623. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1624. increase of volume and @var{decays} refers to decrease of volume. For most
  1625. situations, the attack time (response to the audio getting louder) should be
  1626. shorter than the decay time, because the human ear is more sensitive to sudden
  1627. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1628. a typical value for decay is 0.8 seconds.
  1629. If specified number of attacks & decays is lower than number of channels, the last
  1630. set attack/decay will be used for all remaining channels.
  1631. @item points
  1632. A list of points for the transfer function, specified in dB relative to the
  1633. maximum possible signal amplitude. Each key points list must be defined using
  1634. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1635. @code{x0/y0 x1/y1 x2/y2 ....}
  1636. The input values must be in strictly increasing order but the transfer function
  1637. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1638. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1639. function are @code{-70/-70|-60/-20|1/0}.
  1640. @item soft-knee
  1641. Set the curve radius in dB for all joints. It defaults to 0.01.
  1642. @item gain
  1643. Set the additional gain in dB to be applied at all points on the transfer
  1644. function. This allows for easy adjustment of the overall gain.
  1645. It defaults to 0.
  1646. @item volume
  1647. Set an initial volume, in dB, to be assumed for each channel when filtering
  1648. starts. This permits the user to supply a nominal level initially, so that, for
  1649. example, a very large gain is not applied to initial signal levels before the
  1650. companding has begun to operate. A typical value for audio which is initially
  1651. quiet is -90 dB. It defaults to 0.
  1652. @item delay
  1653. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1654. delayed before being fed to the volume adjuster. Specifying a delay
  1655. approximately equal to the attack/decay times allows the filter to effectively
  1656. operate in predictive rather than reactive mode. It defaults to 0.
  1657. @end table
  1658. @subsection Examples
  1659. @itemize
  1660. @item
  1661. Make music with both quiet and loud passages suitable for listening to in a
  1662. noisy environment:
  1663. @example
  1664. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1665. @end example
  1666. Another example for audio with whisper and explosion parts:
  1667. @example
  1668. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1669. @end example
  1670. @item
  1671. A noise gate for when the noise is at a lower level than the signal:
  1672. @example
  1673. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1674. @end example
  1675. @item
  1676. Here is another noise gate, this time for when the noise is at a higher level
  1677. than the signal (making it, in some ways, similar to squelch):
  1678. @example
  1679. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1680. @end example
  1681. @item
  1682. 2:1 compression starting at -6dB:
  1683. @example
  1684. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1685. @end example
  1686. @item
  1687. 2:1 compression starting at -9dB:
  1688. @example
  1689. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1690. @end example
  1691. @item
  1692. 2:1 compression starting at -12dB:
  1693. @example
  1694. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1695. @end example
  1696. @item
  1697. 2:1 compression starting at -18dB:
  1698. @example
  1699. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1700. @end example
  1701. @item
  1702. 3:1 compression starting at -15dB:
  1703. @example
  1704. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1705. @end example
  1706. @item
  1707. Compressor/Gate:
  1708. @example
  1709. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1710. @end example
  1711. @item
  1712. Expander:
  1713. @example
  1714. 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
  1715. @end example
  1716. @item
  1717. Hard limiter at -6dB:
  1718. @example
  1719. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1720. @end example
  1721. @item
  1722. Hard limiter at -12dB:
  1723. @example
  1724. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1725. @end example
  1726. @item
  1727. Hard noise gate at -35 dB:
  1728. @example
  1729. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1730. @end example
  1731. @item
  1732. Soft limiter:
  1733. @example
  1734. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1735. @end example
  1736. @end itemize
  1737. @section compensationdelay
  1738. Compensation Delay Line is a metric based delay to compensate differing
  1739. positions of microphones or speakers.
  1740. For example, you have recorded guitar with two microphones placed in
  1741. different location. Because the front of sound wave has fixed speed in
  1742. normal conditions, the phasing of microphones can vary and depends on
  1743. their location and interposition. The best sound mix can be achieved when
  1744. these microphones are in phase (synchronized). Note that distance of
  1745. ~30 cm between microphones makes one microphone to capture signal in
  1746. antiphase to another microphone. That makes the final mix sounding moody.
  1747. This filter helps to solve phasing problems by adding different delays
  1748. to each microphone track and make them synchronized.
  1749. The best result can be reached when you take one track as base and
  1750. synchronize other tracks one by one with it.
  1751. Remember that synchronization/delay tolerance depends on sample rate, too.
  1752. Higher sample rates will give more tolerance.
  1753. It accepts the following parameters:
  1754. @table @option
  1755. @item mm
  1756. Set millimeters distance. This is compensation distance for fine tuning.
  1757. Default is 0.
  1758. @item cm
  1759. Set cm distance. This is compensation distance for tightening distance setup.
  1760. Default is 0.
  1761. @item m
  1762. Set meters distance. This is compensation distance for hard distance setup.
  1763. Default is 0.
  1764. @item dry
  1765. Set dry amount. Amount of unprocessed (dry) signal.
  1766. Default is 0.
  1767. @item wet
  1768. Set wet amount. Amount of processed (wet) signal.
  1769. Default is 1.
  1770. @item temp
  1771. Set temperature degree in Celsius. This is the temperature of the environment.
  1772. Default is 20.
  1773. @end table
  1774. @section crossfeed
  1775. Apply headphone crossfeed filter.
  1776. Crossfeed is the process of blending the left and right channels of stereo
  1777. audio recording.
  1778. It is mainly used to reduce extreme stereo separation of low frequencies.
  1779. The intent is to produce more speaker like sound to the listener.
  1780. The filter accepts the following options:
  1781. @table @option
  1782. @item strength
  1783. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1784. This sets gain of low shelf filter for side part of stereo image.
  1785. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1786. @item range
  1787. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1788. This sets cut off frequency of low shelf filter. Default is cut off near
  1789. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1790. @item level_in
  1791. Set input gain. Default is 0.9.
  1792. @item level_out
  1793. Set output gain. Default is 1.
  1794. @end table
  1795. @section crystalizer
  1796. Simple algorithm to expand audio dynamic range.
  1797. The filter accepts the following options:
  1798. @table @option
  1799. @item i
  1800. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1801. (unchanged sound) to 10.0 (maximum effect).
  1802. @item c
  1803. Enable clipping. By default is enabled.
  1804. @end table
  1805. @section dcshift
  1806. Apply a DC shift to the audio.
  1807. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1808. in the recording chain) from the audio. The effect of a DC offset is reduced
  1809. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1810. a signal has a DC offset.
  1811. @table @option
  1812. @item shift
  1813. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1814. the audio.
  1815. @item limitergain
  1816. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1817. used to prevent clipping.
  1818. @end table
  1819. @section dynaudnorm
  1820. Dynamic Audio Normalizer.
  1821. This filter applies a certain amount of gain to the input audio in order
  1822. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1823. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1824. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1825. This allows for applying extra gain to the "quiet" sections of the audio
  1826. while avoiding distortions or clipping the "loud" sections. In other words:
  1827. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1828. sections, in the sense that the volume of each section is brought to the
  1829. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1830. this goal *without* applying "dynamic range compressing". It will retain 100%
  1831. of the dynamic range *within* each section of the audio file.
  1832. @table @option
  1833. @item f
  1834. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1835. Default is 500 milliseconds.
  1836. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1837. referred to as frames. This is required, because a peak magnitude has no
  1838. meaning for just a single sample value. Instead, we need to determine the
  1839. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1840. normalizer would simply use the peak magnitude of the complete file, the
  1841. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1842. frame. The length of a frame is specified in milliseconds. By default, the
  1843. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1844. been found to give good results with most files.
  1845. Note that the exact frame length, in number of samples, will be determined
  1846. automatically, based on the sampling rate of the individual input audio file.
  1847. @item g
  1848. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1849. number. Default is 31.
  1850. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1851. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1852. is specified in frames, centered around the current frame. For the sake of
  1853. simplicity, this must be an odd number. Consequently, the default value of 31
  1854. takes into account the current frame, as well as the 15 preceding frames and
  1855. the 15 subsequent frames. Using a larger window results in a stronger
  1856. smoothing effect and thus in less gain variation, i.e. slower gain
  1857. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1858. effect and thus in more gain variation, i.e. faster gain adaptation.
  1859. In other words, the more you increase this value, the more the Dynamic Audio
  1860. Normalizer will behave like a "traditional" normalization filter. On the
  1861. contrary, the more you decrease this value, the more the Dynamic Audio
  1862. Normalizer will behave like a dynamic range compressor.
  1863. @item p
  1864. Set the target peak value. This specifies the highest permissible magnitude
  1865. level for the normalized audio input. This filter will try to approach the
  1866. target peak magnitude as closely as possible, but at the same time it also
  1867. makes sure that the normalized signal will never exceed the peak magnitude.
  1868. A frame's maximum local gain factor is imposed directly by the target peak
  1869. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1870. It is not recommended to go above this value.
  1871. @item m
  1872. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1873. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1874. factor for each input frame, i.e. the maximum gain factor that does not
  1875. result in clipping or distortion. The maximum gain factor is determined by
  1876. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1877. additionally bounds the frame's maximum gain factor by a predetermined
  1878. (global) maximum gain factor. This is done in order to avoid excessive gain
  1879. factors in "silent" or almost silent frames. By default, the maximum gain
  1880. factor is 10.0, For most inputs the default value should be sufficient and
  1881. it usually is not recommended to increase this value. Though, for input
  1882. with an extremely low overall volume level, it may be necessary to allow even
  1883. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1884. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1885. Instead, a "sigmoid" threshold function will be applied. This way, the
  1886. gain factors will smoothly approach the threshold value, but never exceed that
  1887. value.
  1888. @item r
  1889. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1890. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1891. This means that the maximum local gain factor for each frame is defined
  1892. (only) by the frame's highest magnitude sample. This way, the samples can
  1893. be amplified as much as possible without exceeding the maximum signal
  1894. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1895. Normalizer can also take into account the frame's root mean square,
  1896. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1897. determine the power of a time-varying signal. It is therefore considered
  1898. that the RMS is a better approximation of the "perceived loudness" than
  1899. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1900. frames to a constant RMS value, a uniform "perceived loudness" can be
  1901. established. If a target RMS value has been specified, a frame's local gain
  1902. factor is defined as the factor that would result in exactly that RMS value.
  1903. Note, however, that the maximum local gain factor is still restricted by the
  1904. frame's highest magnitude sample, in order to prevent clipping.
  1905. @item n
  1906. Enable channels coupling. By default is enabled.
  1907. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1908. amount. This means the same gain factor will be applied to all channels, i.e.
  1909. the maximum possible gain factor is determined by the "loudest" channel.
  1910. However, in some recordings, it may happen that the volume of the different
  1911. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1912. In this case, this option can be used to disable the channel coupling. This way,
  1913. the gain factor will be determined independently for each channel, depending
  1914. only on the individual channel's highest magnitude sample. This allows for
  1915. harmonizing the volume of the different channels.
  1916. @item c
  1917. Enable DC bias correction. By default is disabled.
  1918. An audio signal (in the time domain) is a sequence of sample values.
  1919. In the Dynamic Audio Normalizer these sample values are represented in the
  1920. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1921. audio signal, or "waveform", should be centered around the zero point.
  1922. That means if we calculate the mean value of all samples in a file, or in a
  1923. single frame, then the result should be 0.0 or at least very close to that
  1924. value. If, however, there is a significant deviation of the mean value from
  1925. 0.0, in either positive or negative direction, this is referred to as a
  1926. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1927. Audio Normalizer provides optional DC bias correction.
  1928. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1929. the mean value, or "DC correction" offset, of each input frame and subtract
  1930. that value from all of the frame's sample values which ensures those samples
  1931. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1932. boundaries, the DC correction offset values will be interpolated smoothly
  1933. between neighbouring frames.
  1934. @item b
  1935. Enable alternative boundary mode. By default is disabled.
  1936. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1937. around each frame. This includes the preceding frames as well as the
  1938. subsequent frames. However, for the "boundary" frames, located at the very
  1939. beginning and at the very end of the audio file, not all neighbouring
  1940. frames are available. In particular, for the first few frames in the audio
  1941. file, the preceding frames are not known. And, similarly, for the last few
  1942. frames in the audio file, the subsequent frames are not known. Thus, the
  1943. question arises which gain factors should be assumed for the missing frames
  1944. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1945. to deal with this situation. The default boundary mode assumes a gain factor
  1946. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1947. "fade out" at the beginning and at the end of the input, respectively.
  1948. @item s
  1949. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1950. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1951. compression. This means that signal peaks will not be pruned and thus the
  1952. full dynamic range will be retained within each local neighbourhood. However,
  1953. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1954. normalization algorithm with a more "traditional" compression.
  1955. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1956. (thresholding) function. If (and only if) the compression feature is enabled,
  1957. all input frames will be processed by a soft knee thresholding function prior
  1958. to the actual normalization process. Put simply, the thresholding function is
  1959. going to prune all samples whose magnitude exceeds a certain threshold value.
  1960. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1961. value. Instead, the threshold value will be adjusted for each individual
  1962. frame.
  1963. In general, smaller parameters result in stronger compression, and vice versa.
  1964. Values below 3.0 are not recommended, because audible distortion may appear.
  1965. @end table
  1966. @section earwax
  1967. Make audio easier to listen to on headphones.
  1968. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1969. so that when listened to on headphones the stereo image is moved from
  1970. inside your head (standard for headphones) to outside and in front of
  1971. the listener (standard for speakers).
  1972. Ported from SoX.
  1973. @section equalizer
  1974. Apply a two-pole peaking equalisation (EQ) filter. With this
  1975. filter, the signal-level at and around a selected frequency can
  1976. be increased or decreased, whilst (unlike bandpass and bandreject
  1977. filters) that at all other frequencies is unchanged.
  1978. In order to produce complex equalisation curves, this filter can
  1979. be given several times, each with a different central frequency.
  1980. The filter accepts the following options:
  1981. @table @option
  1982. @item frequency, f
  1983. Set the filter's central frequency in Hz.
  1984. @item width_type, t
  1985. Set method to specify band-width of filter.
  1986. @table @option
  1987. @item h
  1988. Hz
  1989. @item q
  1990. Q-Factor
  1991. @item o
  1992. octave
  1993. @item s
  1994. slope
  1995. @end table
  1996. @item width, w
  1997. Specify the band-width of a filter in width_type units.
  1998. @item gain, g
  1999. Set the required gain or attenuation in dB.
  2000. Beware of clipping when using a positive gain.
  2001. @item channels, c
  2002. Specify which channels to filter, by default all available are filtered.
  2003. @end table
  2004. @subsection Examples
  2005. @itemize
  2006. @item
  2007. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2008. @example
  2009. equalizer=f=1000:t=h:width=200:g=-10
  2010. @end example
  2011. @item
  2012. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2013. @example
  2014. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2015. @end example
  2016. @end itemize
  2017. @section extrastereo
  2018. Linearly increases the difference between left and right channels which
  2019. adds some sort of "live" effect to playback.
  2020. The filter accepts the following options:
  2021. @table @option
  2022. @item m
  2023. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2024. (average of both channels), with 1.0 sound will be unchanged, with
  2025. -1.0 left and right channels will be swapped.
  2026. @item c
  2027. Enable clipping. By default is enabled.
  2028. @end table
  2029. @section firequalizer
  2030. Apply FIR Equalization using arbitrary frequency response.
  2031. The filter accepts the following option:
  2032. @table @option
  2033. @item gain
  2034. Set gain curve equation (in dB). The expression can contain variables:
  2035. @table @option
  2036. @item f
  2037. the evaluated frequency
  2038. @item sr
  2039. sample rate
  2040. @item ch
  2041. channel number, set to 0 when multichannels evaluation is disabled
  2042. @item chid
  2043. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2044. multichannels evaluation is disabled
  2045. @item chs
  2046. number of channels
  2047. @item chlayout
  2048. channel_layout, see libavutil/channel_layout.h
  2049. @end table
  2050. and functions:
  2051. @table @option
  2052. @item gain_interpolate(f)
  2053. interpolate gain on frequency f based on gain_entry
  2054. @item cubic_interpolate(f)
  2055. same as gain_interpolate, but smoother
  2056. @end table
  2057. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2058. @item gain_entry
  2059. Set gain entry for gain_interpolate function. The expression can
  2060. contain functions:
  2061. @table @option
  2062. @item entry(f, g)
  2063. store gain entry at frequency f with value g
  2064. @end table
  2065. This option is also available as command.
  2066. @item delay
  2067. Set filter delay in seconds. Higher value means more accurate.
  2068. Default is @code{0.01}.
  2069. @item accuracy
  2070. Set filter accuracy in Hz. Lower value means more accurate.
  2071. Default is @code{5}.
  2072. @item wfunc
  2073. Set window function. Acceptable values are:
  2074. @table @option
  2075. @item rectangular
  2076. rectangular window, useful when gain curve is already smooth
  2077. @item hann
  2078. hann window (default)
  2079. @item hamming
  2080. hamming window
  2081. @item blackman
  2082. blackman window
  2083. @item nuttall3
  2084. 3-terms continuous 1st derivative nuttall window
  2085. @item mnuttall3
  2086. minimum 3-terms discontinuous nuttall window
  2087. @item nuttall
  2088. 4-terms continuous 1st derivative nuttall window
  2089. @item bnuttall
  2090. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2091. @item bharris
  2092. blackman-harris window
  2093. @item tukey
  2094. tukey window
  2095. @end table
  2096. @item fixed
  2097. If enabled, use fixed number of audio samples. This improves speed when
  2098. filtering with large delay. Default is disabled.
  2099. @item multi
  2100. Enable multichannels evaluation on gain. Default is disabled.
  2101. @item zero_phase
  2102. Enable zero phase mode by subtracting timestamp to compensate delay.
  2103. Default is disabled.
  2104. @item scale
  2105. Set scale used by gain. Acceptable values are:
  2106. @table @option
  2107. @item linlin
  2108. linear frequency, linear gain
  2109. @item linlog
  2110. linear frequency, logarithmic (in dB) gain (default)
  2111. @item loglin
  2112. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2113. @item loglog
  2114. logarithmic frequency, logarithmic gain
  2115. @end table
  2116. @item dumpfile
  2117. Set file for dumping, suitable for gnuplot.
  2118. @item dumpscale
  2119. Set scale for dumpfile. Acceptable values are same with scale option.
  2120. Default is linlog.
  2121. @item fft2
  2122. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2123. Default is disabled.
  2124. @item min_phase
  2125. Enable minimum phase impulse response. Default is disabled.
  2126. @end table
  2127. @subsection Examples
  2128. @itemize
  2129. @item
  2130. lowpass at 1000 Hz:
  2131. @example
  2132. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2133. @end example
  2134. @item
  2135. lowpass at 1000 Hz with gain_entry:
  2136. @example
  2137. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2138. @end example
  2139. @item
  2140. custom equalization:
  2141. @example
  2142. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2143. @end example
  2144. @item
  2145. higher delay with zero phase to compensate delay:
  2146. @example
  2147. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2148. @end example
  2149. @item
  2150. lowpass on left channel, highpass on right channel:
  2151. @example
  2152. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2153. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2154. @end example
  2155. @end itemize
  2156. @section flanger
  2157. Apply a flanging effect to the audio.
  2158. The filter accepts the following options:
  2159. @table @option
  2160. @item delay
  2161. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2162. @item depth
  2163. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2164. @item regen
  2165. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2166. Default value is 0.
  2167. @item width
  2168. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2169. Default value is 71.
  2170. @item speed
  2171. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2172. @item shape
  2173. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2174. Default value is @var{sinusoidal}.
  2175. @item phase
  2176. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2177. Default value is 25.
  2178. @item interp
  2179. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2180. Default is @var{linear}.
  2181. @end table
  2182. @section haas
  2183. Apply Haas effect to audio.
  2184. Note that this makes most sense to apply on mono signals.
  2185. With this filter applied to mono signals it give some directionality and
  2186. stretches its stereo image.
  2187. The filter accepts the following options:
  2188. @table @option
  2189. @item level_in
  2190. Set input level. By default is @var{1}, or 0dB
  2191. @item level_out
  2192. Set output level. By default is @var{1}, or 0dB.
  2193. @item side_gain
  2194. Set gain applied to side part of signal. By default is @var{1}.
  2195. @item middle_source
  2196. Set kind of middle source. Can be one of the following:
  2197. @table @samp
  2198. @item left
  2199. Pick left channel.
  2200. @item right
  2201. Pick right channel.
  2202. @item mid
  2203. Pick middle part signal of stereo image.
  2204. @item side
  2205. Pick side part signal of stereo image.
  2206. @end table
  2207. @item middle_phase
  2208. Change middle phase. By default is disabled.
  2209. @item left_delay
  2210. Set left channel delay. By default is @var{2.05} milliseconds.
  2211. @item left_balance
  2212. Set left channel balance. By default is @var{-1}.
  2213. @item left_gain
  2214. Set left channel gain. By default is @var{1}.
  2215. @item left_phase
  2216. Change left phase. By default is disabled.
  2217. @item right_delay
  2218. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2219. @item right_balance
  2220. Set right channel balance. By default is @var{1}.
  2221. @item right_gain
  2222. Set right channel gain. By default is @var{1}.
  2223. @item right_phase
  2224. Change right phase. By default is enabled.
  2225. @end table
  2226. @section hdcd
  2227. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2228. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2229. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2230. of HDCD, and detects the Transient Filter flag.
  2231. @example
  2232. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2233. @end example
  2234. When using the filter with wav, note the default encoding for wav is 16-bit,
  2235. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2236. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2237. @example
  2238. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2239. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2240. @end example
  2241. The filter accepts the following options:
  2242. @table @option
  2243. @item disable_autoconvert
  2244. Disable any automatic format conversion or resampling in the filter graph.
  2245. @item process_stereo
  2246. Process the stereo channels together. If target_gain does not match between
  2247. channels, consider it invalid and use the last valid target_gain.
  2248. @item cdt_ms
  2249. Set the code detect timer period in ms.
  2250. @item force_pe
  2251. Always extend peaks above -3dBFS even if PE isn't signaled.
  2252. @item analyze_mode
  2253. Replace audio with a solid tone and adjust the amplitude to signal some
  2254. specific aspect of the decoding process. The output file can be loaded in
  2255. an audio editor alongside the original to aid analysis.
  2256. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2257. Modes are:
  2258. @table @samp
  2259. @item 0, off
  2260. Disabled
  2261. @item 1, lle
  2262. Gain adjustment level at each sample
  2263. @item 2, pe
  2264. Samples where peak extend occurs
  2265. @item 3, cdt
  2266. Samples where the code detect timer is active
  2267. @item 4, tgm
  2268. Samples where the target gain does not match between channels
  2269. @end table
  2270. @end table
  2271. @section headphone
  2272. Apply head-related transfer functions (HRTFs) to create virtual
  2273. loudspeakers around the user for binaural listening via headphones.
  2274. The HRIRs are provided via additional streams, for each channel
  2275. one stereo input stream is needed.
  2276. The filter accepts the following options:
  2277. @table @option
  2278. @item map
  2279. Set mapping of input streams for convolution.
  2280. The argument is a '|'-separated list of channel names in order as they
  2281. are given as additional stream inputs for filter.
  2282. This also specify number of input streams. Number of input streams
  2283. must be not less than number of channels in first stream plus one.
  2284. @item gain
  2285. Set gain applied to audio. Value is in dB. Default is 0.
  2286. @item type
  2287. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2288. processing audio in time domain which is slow.
  2289. @var{freq} is processing audio in frequency domain which is fast.
  2290. Default is @var{freq}.
  2291. @item lfe
  2292. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2293. @end table
  2294. @subsection Examples
  2295. @itemize
  2296. @item
  2297. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2298. each amovie filter use stereo file with IR coefficients as input.
  2299. The files give coefficients for each position of virtual loudspeaker:
  2300. @example
  2301. 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"
  2302. output.wav
  2303. @end example
  2304. @end itemize
  2305. @section highpass
  2306. Apply a high-pass filter with 3dB point frequency.
  2307. The filter can be either single-pole, or double-pole (the default).
  2308. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2309. The filter accepts the following options:
  2310. @table @option
  2311. @item frequency, f
  2312. Set frequency in Hz. Default is 3000.
  2313. @item poles, p
  2314. Set number of poles. Default is 2.
  2315. @item width_type, t
  2316. Set method to specify band-width of filter.
  2317. @table @option
  2318. @item h
  2319. Hz
  2320. @item q
  2321. Q-Factor
  2322. @item o
  2323. octave
  2324. @item s
  2325. slope
  2326. @end table
  2327. @item width, w
  2328. Specify the band-width of a filter in width_type units.
  2329. Applies only to double-pole filter.
  2330. The default is 0.707q and gives a Butterworth response.
  2331. @item channels, c
  2332. Specify which channels to filter, by default all available are filtered.
  2333. @end table
  2334. @section join
  2335. Join multiple input streams into one multi-channel stream.
  2336. It accepts the following parameters:
  2337. @table @option
  2338. @item inputs
  2339. The number of input streams. It defaults to 2.
  2340. @item channel_layout
  2341. The desired output channel layout. It defaults to stereo.
  2342. @item map
  2343. Map channels from inputs to output. The argument is a '|'-separated list of
  2344. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2345. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2346. can be either the name of the input channel (e.g. FL for front left) or its
  2347. index in the specified input stream. @var{out_channel} is the name of the output
  2348. channel.
  2349. @end table
  2350. The filter will attempt to guess the mappings when they are not specified
  2351. explicitly. It does so by first trying to find an unused matching input channel
  2352. and if that fails it picks the first unused input channel.
  2353. Join 3 inputs (with properly set channel layouts):
  2354. @example
  2355. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2356. @end example
  2357. Build a 5.1 output from 6 single-channel streams:
  2358. @example
  2359. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2360. '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'
  2361. out
  2362. @end example
  2363. @section ladspa
  2364. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2365. To enable compilation of this filter you need to configure FFmpeg with
  2366. @code{--enable-ladspa}.
  2367. @table @option
  2368. @item file, f
  2369. Specifies the name of LADSPA plugin library to load. If the environment
  2370. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2371. each one of the directories specified by the colon separated list in
  2372. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2373. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2374. @file{/usr/lib/ladspa/}.
  2375. @item plugin, p
  2376. Specifies the plugin within the library. Some libraries contain only
  2377. one plugin, but others contain many of them. If this is not set filter
  2378. will list all available plugins within the specified library.
  2379. @item controls, c
  2380. Set the '|' separated list of controls which are zero or more floating point
  2381. values that determine the behavior of the loaded plugin (for example delay,
  2382. threshold or gain).
  2383. Controls need to be defined using the following syntax:
  2384. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2385. @var{valuei} is the value set on the @var{i}-th control.
  2386. Alternatively they can be also defined using the following syntax:
  2387. @var{value0}|@var{value1}|@var{value2}|..., where
  2388. @var{valuei} is the value set on the @var{i}-th control.
  2389. If @option{controls} is set to @code{help}, all available controls and
  2390. their valid ranges are printed.
  2391. @item sample_rate, s
  2392. Specify the sample rate, default to 44100. Only used if plugin have
  2393. zero inputs.
  2394. @item nb_samples, n
  2395. Set the number of samples per channel per each output frame, default
  2396. is 1024. Only used if plugin have zero inputs.
  2397. @item duration, d
  2398. Set the minimum duration of the sourced audio. See
  2399. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2400. for the accepted syntax.
  2401. Note that the resulting duration may be greater than the specified duration,
  2402. as the generated audio is always cut at the end of a complete frame.
  2403. If not specified, or the expressed duration is negative, the audio is
  2404. supposed to be generated forever.
  2405. Only used if plugin have zero inputs.
  2406. @end table
  2407. @subsection Examples
  2408. @itemize
  2409. @item
  2410. List all available plugins within amp (LADSPA example plugin) library:
  2411. @example
  2412. ladspa=file=amp
  2413. @end example
  2414. @item
  2415. List all available controls and their valid ranges for @code{vcf_notch}
  2416. plugin from @code{VCF} library:
  2417. @example
  2418. ladspa=f=vcf:p=vcf_notch:c=help
  2419. @end example
  2420. @item
  2421. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2422. plugin library:
  2423. @example
  2424. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2425. @end example
  2426. @item
  2427. Add reverberation to the audio using TAP-plugins
  2428. (Tom's Audio Processing plugins):
  2429. @example
  2430. ladspa=file=tap_reverb:tap_reverb
  2431. @end example
  2432. @item
  2433. Generate white noise, with 0.2 amplitude:
  2434. @example
  2435. ladspa=file=cmt:noise_source_white:c=c0=.2
  2436. @end example
  2437. @item
  2438. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2439. @code{C* Audio Plugin Suite} (CAPS) library:
  2440. @example
  2441. ladspa=file=caps:Click:c=c1=20'
  2442. @end example
  2443. @item
  2444. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2445. @example
  2446. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2447. @end example
  2448. @item
  2449. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2450. @code{SWH Plugins} collection:
  2451. @example
  2452. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2453. @end example
  2454. @item
  2455. Attenuate low frequencies using Multiband EQ from Steve Harris
  2456. @code{SWH Plugins} collection:
  2457. @example
  2458. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2459. @end example
  2460. @item
  2461. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2462. (CAPS) library:
  2463. @example
  2464. ladspa=caps:Narrower
  2465. @end example
  2466. @item
  2467. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2468. @example
  2469. ladspa=caps:White:.2
  2470. @end example
  2471. @item
  2472. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2473. @example
  2474. ladspa=caps:Fractal:c=c1=1
  2475. @end example
  2476. @item
  2477. Dynamic volume normalization using @code{VLevel} plugin:
  2478. @example
  2479. ladspa=vlevel-ladspa:vlevel_mono
  2480. @end example
  2481. @end itemize
  2482. @subsection Commands
  2483. This filter supports the following commands:
  2484. @table @option
  2485. @item cN
  2486. Modify the @var{N}-th control value.
  2487. If the specified value is not valid, it is ignored and prior one is kept.
  2488. @end table
  2489. @section loudnorm
  2490. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2491. Support for both single pass (livestreams, files) and double pass (files) modes.
  2492. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2493. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2494. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2495. The filter accepts the following options:
  2496. @table @option
  2497. @item I, i
  2498. Set integrated loudness target.
  2499. Range is -70.0 - -5.0. Default value is -24.0.
  2500. @item LRA, lra
  2501. Set loudness range target.
  2502. Range is 1.0 - 20.0. Default value is 7.0.
  2503. @item TP, tp
  2504. Set maximum true peak.
  2505. Range is -9.0 - +0.0. Default value is -2.0.
  2506. @item measured_I, measured_i
  2507. Measured IL of input file.
  2508. Range is -99.0 - +0.0.
  2509. @item measured_LRA, measured_lra
  2510. Measured LRA of input file.
  2511. Range is 0.0 - 99.0.
  2512. @item measured_TP, measured_tp
  2513. Measured true peak of input file.
  2514. Range is -99.0 - +99.0.
  2515. @item measured_thresh
  2516. Measured threshold of input file.
  2517. Range is -99.0 - +0.0.
  2518. @item offset
  2519. Set offset gain. Gain is applied before the true-peak limiter.
  2520. Range is -99.0 - +99.0. Default is +0.0.
  2521. @item linear
  2522. Normalize linearly if possible.
  2523. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2524. to be specified in order to use this mode.
  2525. Options are true or false. Default is true.
  2526. @item dual_mono
  2527. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2528. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2529. If set to @code{true}, this option will compensate for this effect.
  2530. Multi-channel input files are not affected by this option.
  2531. Options are true or false. Default is false.
  2532. @item print_format
  2533. Set print format for stats. Options are summary, json, or none.
  2534. Default value is none.
  2535. @end table
  2536. @section lowpass
  2537. Apply a low-pass filter with 3dB point frequency.
  2538. The filter can be either single-pole or double-pole (the default).
  2539. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2540. The filter accepts the following options:
  2541. @table @option
  2542. @item frequency, f
  2543. Set frequency in Hz. Default is 500.
  2544. @item poles, p
  2545. Set number of poles. Default is 2.
  2546. @item width_type, t
  2547. Set method to specify band-width of filter.
  2548. @table @option
  2549. @item h
  2550. Hz
  2551. @item q
  2552. Q-Factor
  2553. @item o
  2554. octave
  2555. @item s
  2556. slope
  2557. @end table
  2558. @item width, w
  2559. Specify the band-width of a filter in width_type units.
  2560. Applies only to double-pole filter.
  2561. The default is 0.707q and gives a Butterworth response.
  2562. @item channels, c
  2563. Specify which channels to filter, by default all available are filtered.
  2564. @end table
  2565. @subsection Examples
  2566. @itemize
  2567. @item
  2568. Lowpass only LFE channel, it LFE is not present it does nothing:
  2569. @example
  2570. lowpass=c=LFE
  2571. @end example
  2572. @end itemize
  2573. @section mcompand
  2574. Multiband Compress or expand the audio's dynamic range.
  2575. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2576. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2577. response when absent compander action.
  2578. It accepts the following parameters:
  2579. @table @option
  2580. @item args
  2581. This option syntax is:
  2582. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2583. For explanation of each item refer to compand filter documentation.
  2584. @end table
  2585. @anchor{pan}
  2586. @section pan
  2587. Mix channels with specific gain levels. The filter accepts the output
  2588. channel layout followed by a set of channels definitions.
  2589. This filter is also designed to efficiently remap the channels of an audio
  2590. stream.
  2591. The filter accepts parameters of the form:
  2592. "@var{l}|@var{outdef}|@var{outdef}|..."
  2593. @table @option
  2594. @item l
  2595. output channel layout or number of channels
  2596. @item outdef
  2597. output channel specification, of the form:
  2598. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2599. @item out_name
  2600. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2601. number (c0, c1, etc.)
  2602. @item gain
  2603. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2604. @item in_name
  2605. input channel to use, see out_name for details; it is not possible to mix
  2606. named and numbered input channels
  2607. @end table
  2608. If the `=' in a channel specification is replaced by `<', then the gains for
  2609. that specification will be renormalized so that the total is 1, thus
  2610. avoiding clipping noise.
  2611. @subsection Mixing examples
  2612. For example, if you want to down-mix from stereo to mono, but with a bigger
  2613. factor for the left channel:
  2614. @example
  2615. pan=1c|c0=0.9*c0+0.1*c1
  2616. @end example
  2617. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2618. 7-channels surround:
  2619. @example
  2620. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2621. @end example
  2622. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2623. that should be preferred (see "-ac" option) unless you have very specific
  2624. needs.
  2625. @subsection Remapping examples
  2626. The channel remapping will be effective if, and only if:
  2627. @itemize
  2628. @item gain coefficients are zeroes or ones,
  2629. @item only one input per channel output,
  2630. @end itemize
  2631. If all these conditions are satisfied, the filter will notify the user ("Pure
  2632. channel mapping detected"), and use an optimized and lossless method to do the
  2633. remapping.
  2634. For example, if you have a 5.1 source and want a stereo audio stream by
  2635. dropping the extra channels:
  2636. @example
  2637. pan="stereo| c0=FL | c1=FR"
  2638. @end example
  2639. Given the same source, you can also switch front left and front right channels
  2640. and keep the input channel layout:
  2641. @example
  2642. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2643. @end example
  2644. If the input is a stereo audio stream, you can mute the front left channel (and
  2645. still keep the stereo channel layout) with:
  2646. @example
  2647. pan="stereo|c1=c1"
  2648. @end example
  2649. Still with a stereo audio stream input, you can copy the right channel in both
  2650. front left and right:
  2651. @example
  2652. pan="stereo| c0=FR | c1=FR"
  2653. @end example
  2654. @section replaygain
  2655. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2656. outputs it unchanged.
  2657. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2658. @section resample
  2659. Convert the audio sample format, sample rate and channel layout. It is
  2660. not meant to be used directly.
  2661. @section rubberband
  2662. Apply time-stretching and pitch-shifting with librubberband.
  2663. The filter accepts the following options:
  2664. @table @option
  2665. @item tempo
  2666. Set tempo scale factor.
  2667. @item pitch
  2668. Set pitch scale factor.
  2669. @item transients
  2670. Set transients detector.
  2671. Possible values are:
  2672. @table @var
  2673. @item crisp
  2674. @item mixed
  2675. @item smooth
  2676. @end table
  2677. @item detector
  2678. Set detector.
  2679. Possible values are:
  2680. @table @var
  2681. @item compound
  2682. @item percussive
  2683. @item soft
  2684. @end table
  2685. @item phase
  2686. Set phase.
  2687. Possible values are:
  2688. @table @var
  2689. @item laminar
  2690. @item independent
  2691. @end table
  2692. @item window
  2693. Set processing window size.
  2694. Possible values are:
  2695. @table @var
  2696. @item standard
  2697. @item short
  2698. @item long
  2699. @end table
  2700. @item smoothing
  2701. Set smoothing.
  2702. Possible values are:
  2703. @table @var
  2704. @item off
  2705. @item on
  2706. @end table
  2707. @item formant
  2708. Enable formant preservation when shift pitching.
  2709. Possible values are:
  2710. @table @var
  2711. @item shifted
  2712. @item preserved
  2713. @end table
  2714. @item pitchq
  2715. Set pitch quality.
  2716. Possible values are:
  2717. @table @var
  2718. @item quality
  2719. @item speed
  2720. @item consistency
  2721. @end table
  2722. @item channels
  2723. Set channels.
  2724. Possible values are:
  2725. @table @var
  2726. @item apart
  2727. @item together
  2728. @end table
  2729. @end table
  2730. @section sidechaincompress
  2731. This filter acts like normal compressor but has the ability to compress
  2732. detected signal using second input signal.
  2733. It needs two input streams and returns one output stream.
  2734. First input stream will be processed depending on second stream signal.
  2735. The filtered signal then can be filtered with other filters in later stages of
  2736. processing. See @ref{pan} and @ref{amerge} filter.
  2737. The filter accepts the following options:
  2738. @table @option
  2739. @item level_in
  2740. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2741. @item threshold
  2742. If a signal of second stream raises above this level it will affect the gain
  2743. reduction of first stream.
  2744. By default is 0.125. Range is between 0.00097563 and 1.
  2745. @item ratio
  2746. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2747. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2748. Default is 2. Range is between 1 and 20.
  2749. @item attack
  2750. Amount of milliseconds the signal has to rise above the threshold before gain
  2751. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2752. @item release
  2753. Amount of milliseconds the signal has to fall below the threshold before
  2754. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2755. @item makeup
  2756. Set the amount by how much signal will be amplified after processing.
  2757. Default is 1. Range is from 1 to 64.
  2758. @item knee
  2759. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2760. Default is 2.82843. Range is between 1 and 8.
  2761. @item link
  2762. Choose if the @code{average} level between all channels of side-chain stream
  2763. or the louder(@code{maximum}) channel of side-chain stream affects the
  2764. reduction. Default is @code{average}.
  2765. @item detection
  2766. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2767. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2768. @item level_sc
  2769. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2770. @item mix
  2771. How much to use compressed signal in output. Default is 1.
  2772. Range is between 0 and 1.
  2773. @end table
  2774. @subsection Examples
  2775. @itemize
  2776. @item
  2777. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2778. depending on the signal of 2nd input and later compressed signal to be
  2779. merged with 2nd input:
  2780. @example
  2781. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2782. @end example
  2783. @end itemize
  2784. @section sidechaingate
  2785. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2786. filter the detected signal before sending it to the gain reduction stage.
  2787. Normally a gate uses the full range signal to detect a level above the
  2788. threshold.
  2789. For example: If you cut all lower frequencies from your sidechain signal
  2790. the gate will decrease the volume of your track only if not enough highs
  2791. appear. With this technique you are able to reduce the resonation of a
  2792. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2793. guitar.
  2794. It needs two input streams and returns one output stream.
  2795. First input stream will be processed depending on second stream signal.
  2796. The filter accepts the following options:
  2797. @table @option
  2798. @item level_in
  2799. Set input level before filtering.
  2800. Default is 1. Allowed range is from 0.015625 to 64.
  2801. @item range
  2802. Set the level of gain reduction when the signal is below the threshold.
  2803. Default is 0.06125. Allowed range is from 0 to 1.
  2804. @item threshold
  2805. If a signal rises above this level the gain reduction is released.
  2806. Default is 0.125. Allowed range is from 0 to 1.
  2807. @item ratio
  2808. Set a ratio about which the signal is reduced.
  2809. Default is 2. Allowed range is from 1 to 9000.
  2810. @item attack
  2811. Amount of milliseconds the signal has to rise above the threshold before gain
  2812. reduction stops.
  2813. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2814. @item release
  2815. Amount of milliseconds the signal has to fall below the threshold before the
  2816. reduction is increased again. Default is 250 milliseconds.
  2817. Allowed range is from 0.01 to 9000.
  2818. @item makeup
  2819. Set amount of amplification of signal after processing.
  2820. Default is 1. Allowed range is from 1 to 64.
  2821. @item knee
  2822. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2823. Default is 2.828427125. Allowed range is from 1 to 8.
  2824. @item detection
  2825. Choose if exact signal should be taken for detection or an RMS like one.
  2826. Default is rms. Can be peak or rms.
  2827. @item link
  2828. Choose if the average level between all channels or the louder channel affects
  2829. the reduction.
  2830. Default is average. Can be average or maximum.
  2831. @item level_sc
  2832. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2833. @end table
  2834. @section silencedetect
  2835. Detect silence in an audio stream.
  2836. This filter logs a message when it detects that the input audio volume is less
  2837. or equal to a noise tolerance value for a duration greater or equal to the
  2838. minimum detected noise duration.
  2839. The printed times and duration are expressed in seconds.
  2840. The filter accepts the following options:
  2841. @table @option
  2842. @item duration, d
  2843. Set silence duration until notification (default is 2 seconds).
  2844. @item noise, n
  2845. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2846. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2847. @end table
  2848. @subsection Examples
  2849. @itemize
  2850. @item
  2851. Detect 5 seconds of silence with -50dB noise tolerance:
  2852. @example
  2853. silencedetect=n=-50dB:d=5
  2854. @end example
  2855. @item
  2856. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2857. tolerance in @file{silence.mp3}:
  2858. @example
  2859. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2860. @end example
  2861. @end itemize
  2862. @section silenceremove
  2863. Remove silence from the beginning, middle or end of the audio.
  2864. The filter accepts the following options:
  2865. @table @option
  2866. @item start_periods
  2867. This value is used to indicate if audio should be trimmed at beginning of
  2868. the audio. A value of zero indicates no silence should be trimmed from the
  2869. beginning. When specifying a non-zero value, it trims audio up until it
  2870. finds non-silence. Normally, when trimming silence from beginning of audio
  2871. the @var{start_periods} will be @code{1} but it can be increased to higher
  2872. values to trim all audio up to specific count of non-silence periods.
  2873. Default value is @code{0}.
  2874. @item start_duration
  2875. Specify the amount of time that non-silence must be detected before it stops
  2876. trimming audio. By increasing the duration, bursts of noises can be treated
  2877. as silence and trimmed off. Default value is @code{0}.
  2878. @item start_threshold
  2879. This indicates what sample value should be treated as silence. For digital
  2880. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2881. you may wish to increase the value to account for background noise.
  2882. Can be specified in dB (in case "dB" is appended to the specified value)
  2883. or amplitude ratio. Default value is @code{0}.
  2884. @item stop_periods
  2885. Set the count for trimming silence from the end of audio.
  2886. To remove silence from the middle of a file, specify a @var{stop_periods}
  2887. that is negative. This value is then treated as a positive value and is
  2888. used to indicate the effect should restart processing as specified by
  2889. @var{start_periods}, making it suitable for removing periods of silence
  2890. in the middle of the audio.
  2891. Default value is @code{0}.
  2892. @item stop_duration
  2893. Specify a duration of silence that must exist before audio is not copied any
  2894. more. By specifying a higher duration, silence that is wanted can be left in
  2895. the audio.
  2896. Default value is @code{0}.
  2897. @item stop_threshold
  2898. This is the same as @option{start_threshold} but for trimming silence from
  2899. the end of audio.
  2900. Can be specified in dB (in case "dB" is appended to the specified value)
  2901. or amplitude ratio. Default value is @code{0}.
  2902. @item leave_silence
  2903. This indicates that @var{stop_duration} length of audio should be left intact
  2904. at the beginning of each period of silence.
  2905. For example, if you want to remove long pauses between words but do not want
  2906. to remove the pauses completely. Default value is @code{0}.
  2907. @item detection
  2908. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2909. and works better with digital silence which is exactly 0.
  2910. Default value is @code{rms}.
  2911. @item window
  2912. Set ratio used to calculate size of window for detecting silence.
  2913. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2914. @end table
  2915. @subsection Examples
  2916. @itemize
  2917. @item
  2918. The following example shows how this filter can be used to start a recording
  2919. that does not contain the delay at the start which usually occurs between
  2920. pressing the record button and the start of the performance:
  2921. @example
  2922. silenceremove=1:5:0.02
  2923. @end example
  2924. @item
  2925. Trim all silence encountered from beginning to end where there is more than 1
  2926. second of silence in audio:
  2927. @example
  2928. silenceremove=0:0:0:-1:1:-90dB
  2929. @end example
  2930. @end itemize
  2931. @section sofalizer
  2932. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2933. loudspeakers around the user for binaural listening via headphones (audio
  2934. formats up to 9 channels supported).
  2935. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2936. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2937. Austrian Academy of Sciences.
  2938. To enable compilation of this filter you need to configure FFmpeg with
  2939. @code{--enable-libmysofa}.
  2940. The filter accepts the following options:
  2941. @table @option
  2942. @item sofa
  2943. Set the SOFA file used for rendering.
  2944. @item gain
  2945. Set gain applied to audio. Value is in dB. Default is 0.
  2946. @item rotation
  2947. Set rotation of virtual loudspeakers in deg. Default is 0.
  2948. @item elevation
  2949. Set elevation of virtual speakers in deg. Default is 0.
  2950. @item radius
  2951. Set distance in meters between loudspeakers and the listener with near-field
  2952. HRTFs. Default is 1.
  2953. @item type
  2954. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2955. processing audio in time domain which is slow.
  2956. @var{freq} is processing audio in frequency domain which is fast.
  2957. Default is @var{freq}.
  2958. @item speakers
  2959. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2960. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2961. Each virtual loudspeaker is described with short channel name following with
  2962. azimuth and elevation in degrees.
  2963. Each virtual loudspeaker description is separated by '|'.
  2964. For example to override front left and front right channel positions use:
  2965. 'speakers=FL 45 15|FR 345 15'.
  2966. Descriptions with unrecognised channel names are ignored.
  2967. @item lfegain
  2968. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2969. @end table
  2970. @subsection Examples
  2971. @itemize
  2972. @item
  2973. Using ClubFritz6 sofa file:
  2974. @example
  2975. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2976. @end example
  2977. @item
  2978. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2979. @example
  2980. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2981. @end example
  2982. @item
  2983. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2984. and also with custom gain:
  2985. @example
  2986. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2987. @end example
  2988. @end itemize
  2989. @section stereotools
  2990. This filter has some handy utilities to manage stereo signals, for converting
  2991. M/S stereo recordings to L/R signal while having control over the parameters
  2992. or spreading the stereo image of master track.
  2993. The filter accepts the following options:
  2994. @table @option
  2995. @item level_in
  2996. Set input level before filtering for both channels. Defaults is 1.
  2997. Allowed range is from 0.015625 to 64.
  2998. @item level_out
  2999. Set output level after filtering for both channels. Defaults is 1.
  3000. Allowed range is from 0.015625 to 64.
  3001. @item balance_in
  3002. Set input balance between both channels. Default is 0.
  3003. Allowed range is from -1 to 1.
  3004. @item balance_out
  3005. Set output balance between both channels. Default is 0.
  3006. Allowed range is from -1 to 1.
  3007. @item softclip
  3008. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3009. clipping. Disabled by default.
  3010. @item mutel
  3011. Mute the left channel. Disabled by default.
  3012. @item muter
  3013. Mute the right channel. Disabled by default.
  3014. @item phasel
  3015. Change the phase of the left channel. Disabled by default.
  3016. @item phaser
  3017. Change the phase of the right channel. Disabled by default.
  3018. @item mode
  3019. Set stereo mode. Available values are:
  3020. @table @samp
  3021. @item lr>lr
  3022. Left/Right to Left/Right, this is default.
  3023. @item lr>ms
  3024. Left/Right to Mid/Side.
  3025. @item ms>lr
  3026. Mid/Side to Left/Right.
  3027. @item lr>ll
  3028. Left/Right to Left/Left.
  3029. @item lr>rr
  3030. Left/Right to Right/Right.
  3031. @item lr>l+r
  3032. Left/Right to Left + Right.
  3033. @item lr>rl
  3034. Left/Right to Right/Left.
  3035. @item ms>ll
  3036. Mid/Side to Left/Left.
  3037. @item ms>rr
  3038. Mid/Side to Right/Right.
  3039. @end table
  3040. @item slev
  3041. Set level of side signal. Default is 1.
  3042. Allowed range is from 0.015625 to 64.
  3043. @item sbal
  3044. Set balance of side signal. Default is 0.
  3045. Allowed range is from -1 to 1.
  3046. @item mlev
  3047. Set level of the middle signal. Default is 1.
  3048. Allowed range is from 0.015625 to 64.
  3049. @item mpan
  3050. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3051. @item base
  3052. Set stereo base between mono and inversed channels. Default is 0.
  3053. Allowed range is from -1 to 1.
  3054. @item delay
  3055. Set delay in milliseconds how much to delay left from right channel and
  3056. vice versa. Default is 0. Allowed range is from -20 to 20.
  3057. @item sclevel
  3058. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3059. @item phase
  3060. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3061. @item bmode_in, bmode_out
  3062. Set balance mode for balance_in/balance_out option.
  3063. Can be one of the following:
  3064. @table @samp
  3065. @item balance
  3066. Classic balance mode. Attenuate one channel at time.
  3067. Gain is raised up to 1.
  3068. @item amplitude
  3069. Similar as classic mode above but gain is raised up to 2.
  3070. @item power
  3071. Equal power distribution, from -6dB to +6dB range.
  3072. @end table
  3073. @end table
  3074. @subsection Examples
  3075. @itemize
  3076. @item
  3077. Apply karaoke like effect:
  3078. @example
  3079. stereotools=mlev=0.015625
  3080. @end example
  3081. @item
  3082. Convert M/S signal to L/R:
  3083. @example
  3084. "stereotools=mode=ms>lr"
  3085. @end example
  3086. @end itemize
  3087. @section stereowiden
  3088. This filter enhance the stereo effect by suppressing signal common to both
  3089. channels and by delaying the signal of left into right and vice versa,
  3090. thereby widening the stereo effect.
  3091. The filter accepts the following options:
  3092. @table @option
  3093. @item delay
  3094. Time in milliseconds of the delay of left signal into right and vice versa.
  3095. Default is 20 milliseconds.
  3096. @item feedback
  3097. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3098. effect of left signal in right output and vice versa which gives widening
  3099. effect. Default is 0.3.
  3100. @item crossfeed
  3101. Cross feed of left into right with inverted phase. This helps in suppressing
  3102. the mono. If the value is 1 it will cancel all the signal common to both
  3103. channels. Default is 0.3.
  3104. @item drymix
  3105. Set level of input signal of original channel. Default is 0.8.
  3106. @end table
  3107. @section superequalizer
  3108. Apply 18 band equalizer.
  3109. The filter accepts the following options:
  3110. @table @option
  3111. @item 1b
  3112. Set 65Hz band gain.
  3113. @item 2b
  3114. Set 92Hz band gain.
  3115. @item 3b
  3116. Set 131Hz band gain.
  3117. @item 4b
  3118. Set 185Hz band gain.
  3119. @item 5b
  3120. Set 262Hz band gain.
  3121. @item 6b
  3122. Set 370Hz band gain.
  3123. @item 7b
  3124. Set 523Hz band gain.
  3125. @item 8b
  3126. Set 740Hz band gain.
  3127. @item 9b
  3128. Set 1047Hz band gain.
  3129. @item 10b
  3130. Set 1480Hz band gain.
  3131. @item 11b
  3132. Set 2093Hz band gain.
  3133. @item 12b
  3134. Set 2960Hz band gain.
  3135. @item 13b
  3136. Set 4186Hz band gain.
  3137. @item 14b
  3138. Set 5920Hz band gain.
  3139. @item 15b
  3140. Set 8372Hz band gain.
  3141. @item 16b
  3142. Set 11840Hz band gain.
  3143. @item 17b
  3144. Set 16744Hz band gain.
  3145. @item 18b
  3146. Set 20000Hz band gain.
  3147. @end table
  3148. @section surround
  3149. Apply audio surround upmix filter.
  3150. This filter allows to produce multichannel output from audio stream.
  3151. The filter accepts the following options:
  3152. @table @option
  3153. @item chl_out
  3154. Set output channel layout. By default, this is @var{5.1}.
  3155. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3156. for the required syntax.
  3157. @item chl_in
  3158. Set input channel layout. By default, this is @var{stereo}.
  3159. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3160. for the required syntax.
  3161. @item level_in
  3162. Set input volume level. By default, this is @var{1}.
  3163. @item level_out
  3164. Set output volume level. By default, this is @var{1}.
  3165. @item lfe
  3166. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3167. @item lfe_low
  3168. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3169. @item lfe_high
  3170. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3171. @item fc_in
  3172. Set front center input volume. By default, this is @var{1}.
  3173. @item fc_out
  3174. Set front center output volume. By default, this is @var{1}.
  3175. @item lfe_in
  3176. Set LFE input volume. By default, this is @var{1}.
  3177. @item lfe_out
  3178. Set LFE output volume. By default, this is @var{1}.
  3179. @end table
  3180. @section treble
  3181. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3182. shelving filter with a response similar to that of a standard
  3183. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3184. The filter accepts the following options:
  3185. @table @option
  3186. @item gain, g
  3187. Give the gain at whichever is the lower of ~22 kHz and the
  3188. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3189. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3190. @item frequency, f
  3191. Set the filter's central frequency and so can be used
  3192. to extend or reduce the frequency range to be boosted or cut.
  3193. The default value is @code{3000} Hz.
  3194. @item width_type, t
  3195. Set method to specify band-width of filter.
  3196. @table @option
  3197. @item h
  3198. Hz
  3199. @item q
  3200. Q-Factor
  3201. @item o
  3202. octave
  3203. @item s
  3204. slope
  3205. @end table
  3206. @item width, w
  3207. Determine how steep is the filter's shelf transition.
  3208. @item channels, c
  3209. Specify which channels to filter, by default all available are filtered.
  3210. @end table
  3211. @section tremolo
  3212. Sinusoidal amplitude modulation.
  3213. The filter accepts the following options:
  3214. @table @option
  3215. @item f
  3216. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3217. (20 Hz or lower) will result in a tremolo effect.
  3218. This filter may also be used as a ring modulator by specifying
  3219. a modulation frequency higher than 20 Hz.
  3220. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3221. @item d
  3222. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3223. Default value is 0.5.
  3224. @end table
  3225. @section vibrato
  3226. Sinusoidal phase modulation.
  3227. The filter accepts the following options:
  3228. @table @option
  3229. @item f
  3230. Modulation frequency in Hertz.
  3231. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3232. @item d
  3233. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3234. Default value is 0.5.
  3235. @end table
  3236. @section volume
  3237. Adjust the input audio volume.
  3238. It accepts the following parameters:
  3239. @table @option
  3240. @item volume
  3241. Set audio volume expression.
  3242. Output values are clipped to the maximum value.
  3243. The output audio volume is given by the relation:
  3244. @example
  3245. @var{output_volume} = @var{volume} * @var{input_volume}
  3246. @end example
  3247. The default value for @var{volume} is "1.0".
  3248. @item precision
  3249. This parameter represents the mathematical precision.
  3250. It determines which input sample formats will be allowed, which affects the
  3251. precision of the volume scaling.
  3252. @table @option
  3253. @item fixed
  3254. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3255. @item float
  3256. 32-bit floating-point; this limits input sample format to FLT. (default)
  3257. @item double
  3258. 64-bit floating-point; this limits input sample format to DBL.
  3259. @end table
  3260. @item replaygain
  3261. Choose the behaviour on encountering ReplayGain side data in input frames.
  3262. @table @option
  3263. @item drop
  3264. Remove ReplayGain side data, ignoring its contents (the default).
  3265. @item ignore
  3266. Ignore ReplayGain side data, but leave it in the frame.
  3267. @item track
  3268. Prefer the track gain, if present.
  3269. @item album
  3270. Prefer the album gain, if present.
  3271. @end table
  3272. @item replaygain_preamp
  3273. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3274. Default value for @var{replaygain_preamp} is 0.0.
  3275. @item eval
  3276. Set when the volume expression is evaluated.
  3277. It accepts the following values:
  3278. @table @samp
  3279. @item once
  3280. only evaluate expression once during the filter initialization, or
  3281. when the @samp{volume} command is sent
  3282. @item frame
  3283. evaluate expression for each incoming frame
  3284. @end table
  3285. Default value is @samp{once}.
  3286. @end table
  3287. The volume expression can contain the following parameters.
  3288. @table @option
  3289. @item n
  3290. frame number (starting at zero)
  3291. @item nb_channels
  3292. number of channels
  3293. @item nb_consumed_samples
  3294. number of samples consumed by the filter
  3295. @item nb_samples
  3296. number of samples in the current frame
  3297. @item pos
  3298. original frame position in the file
  3299. @item pts
  3300. frame PTS
  3301. @item sample_rate
  3302. sample rate
  3303. @item startpts
  3304. PTS at start of stream
  3305. @item startt
  3306. time at start of stream
  3307. @item t
  3308. frame time
  3309. @item tb
  3310. timestamp timebase
  3311. @item volume
  3312. last set volume value
  3313. @end table
  3314. Note that when @option{eval} is set to @samp{once} only the
  3315. @var{sample_rate} and @var{tb} variables are available, all other
  3316. variables will evaluate to NAN.
  3317. @subsection Commands
  3318. This filter supports the following commands:
  3319. @table @option
  3320. @item volume
  3321. Modify the volume expression.
  3322. The command accepts the same syntax of the corresponding option.
  3323. If the specified expression is not valid, it is kept at its current
  3324. value.
  3325. @item replaygain_noclip
  3326. Prevent clipping by limiting the gain applied.
  3327. Default value for @var{replaygain_noclip} is 1.
  3328. @end table
  3329. @subsection Examples
  3330. @itemize
  3331. @item
  3332. Halve the input audio volume:
  3333. @example
  3334. volume=volume=0.5
  3335. volume=volume=1/2
  3336. volume=volume=-6.0206dB
  3337. @end example
  3338. In all the above example the named key for @option{volume} can be
  3339. omitted, for example like in:
  3340. @example
  3341. volume=0.5
  3342. @end example
  3343. @item
  3344. Increase input audio power by 6 decibels using fixed-point precision:
  3345. @example
  3346. volume=volume=6dB:precision=fixed
  3347. @end example
  3348. @item
  3349. Fade volume after time 10 with an annihilation period of 5 seconds:
  3350. @example
  3351. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3352. @end example
  3353. @end itemize
  3354. @section volumedetect
  3355. Detect the volume of the input video.
  3356. The filter has no parameters. The input is not modified. Statistics about
  3357. the volume will be printed in the log when the input stream end is reached.
  3358. In particular it will show the mean volume (root mean square), maximum
  3359. volume (on a per-sample basis), and the beginning of a histogram of the
  3360. registered volume values (from the maximum value to a cumulated 1/1000 of
  3361. the samples).
  3362. All volumes are in decibels relative to the maximum PCM value.
  3363. @subsection Examples
  3364. Here is an excerpt of the output:
  3365. @example
  3366. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3367. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3368. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3369. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3370. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3371. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3372. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3373. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3374. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3375. @end example
  3376. It means that:
  3377. @itemize
  3378. @item
  3379. The mean square energy is approximately -27 dB, or 10^-2.7.
  3380. @item
  3381. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3382. @item
  3383. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3384. @end itemize
  3385. In other words, raising the volume by +4 dB does not cause any clipping,
  3386. raising it by +5 dB causes clipping for 6 samples, etc.
  3387. @c man end AUDIO FILTERS
  3388. @chapter Audio Sources
  3389. @c man begin AUDIO SOURCES
  3390. Below is a description of the currently available audio sources.
  3391. @section abuffer
  3392. Buffer audio frames, and make them available to the filter chain.
  3393. This source is mainly intended for a programmatic use, in particular
  3394. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3395. It accepts the following parameters:
  3396. @table @option
  3397. @item time_base
  3398. The timebase which will be used for timestamps of submitted frames. It must be
  3399. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3400. @item sample_rate
  3401. The sample rate of the incoming audio buffers.
  3402. @item sample_fmt
  3403. The sample format of the incoming audio buffers.
  3404. Either a sample format name or its corresponding integer representation from
  3405. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3406. @item channel_layout
  3407. The channel layout of the incoming audio buffers.
  3408. Either a channel layout name from channel_layout_map in
  3409. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3410. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3411. @item channels
  3412. The number of channels of the incoming audio buffers.
  3413. If both @var{channels} and @var{channel_layout} are specified, then they
  3414. must be consistent.
  3415. @end table
  3416. @subsection Examples
  3417. @example
  3418. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3419. @end example
  3420. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3421. Since the sample format with name "s16p" corresponds to the number
  3422. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3423. equivalent to:
  3424. @example
  3425. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3426. @end example
  3427. @section aevalsrc
  3428. Generate an audio signal specified by an expression.
  3429. This source accepts in input one or more expressions (one for each
  3430. channel), which are evaluated and used to generate a corresponding
  3431. audio signal.
  3432. This source accepts the following options:
  3433. @table @option
  3434. @item exprs
  3435. Set the '|'-separated expressions list for each separate channel. In case the
  3436. @option{channel_layout} option is not specified, the selected channel layout
  3437. depends on the number of provided expressions. Otherwise the last
  3438. specified expression is applied to the remaining output channels.
  3439. @item channel_layout, c
  3440. Set the channel layout. The number of channels in the specified layout
  3441. must be equal to the number of specified expressions.
  3442. @item duration, d
  3443. Set the minimum duration of the sourced audio. See
  3444. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3445. for the accepted syntax.
  3446. Note that the resulting duration may be greater than the specified
  3447. duration, as the generated audio is always cut at the end of a
  3448. complete frame.
  3449. If not specified, or the expressed duration is negative, the audio is
  3450. supposed to be generated forever.
  3451. @item nb_samples, n
  3452. Set the number of samples per channel per each output frame,
  3453. default to 1024.
  3454. @item sample_rate, s
  3455. Specify the sample rate, default to 44100.
  3456. @end table
  3457. Each expression in @var{exprs} can contain the following constants:
  3458. @table @option
  3459. @item n
  3460. number of the evaluated sample, starting from 0
  3461. @item t
  3462. time of the evaluated sample expressed in seconds, starting from 0
  3463. @item s
  3464. sample rate
  3465. @end table
  3466. @subsection Examples
  3467. @itemize
  3468. @item
  3469. Generate silence:
  3470. @example
  3471. aevalsrc=0
  3472. @end example
  3473. @item
  3474. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3475. 8000 Hz:
  3476. @example
  3477. aevalsrc="sin(440*2*PI*t):s=8000"
  3478. @end example
  3479. @item
  3480. Generate a two channels signal, specify the channel layout (Front
  3481. Center + Back Center) explicitly:
  3482. @example
  3483. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3484. @end example
  3485. @item
  3486. Generate white noise:
  3487. @example
  3488. aevalsrc="-2+random(0)"
  3489. @end example
  3490. @item
  3491. Generate an amplitude modulated signal:
  3492. @example
  3493. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3494. @end example
  3495. @item
  3496. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3497. @example
  3498. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3499. @end example
  3500. @end itemize
  3501. @section anullsrc
  3502. The null audio source, return unprocessed audio frames. It is mainly useful
  3503. as a template and to be employed in analysis / debugging tools, or as
  3504. the source for filters which ignore the input data (for example the sox
  3505. synth filter).
  3506. This source accepts the following options:
  3507. @table @option
  3508. @item channel_layout, cl
  3509. Specifies the channel layout, and can be either an integer or a string
  3510. representing a channel layout. The default value of @var{channel_layout}
  3511. is "stereo".
  3512. Check the channel_layout_map definition in
  3513. @file{libavutil/channel_layout.c} for the mapping between strings and
  3514. channel layout values.
  3515. @item sample_rate, r
  3516. Specifies the sample rate, and defaults to 44100.
  3517. @item nb_samples, n
  3518. Set the number of samples per requested frames.
  3519. @end table
  3520. @subsection Examples
  3521. @itemize
  3522. @item
  3523. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3524. @example
  3525. anullsrc=r=48000:cl=4
  3526. @end example
  3527. @item
  3528. Do the same operation with a more obvious syntax:
  3529. @example
  3530. anullsrc=r=48000:cl=mono
  3531. @end example
  3532. @end itemize
  3533. All the parameters need to be explicitly defined.
  3534. @section flite
  3535. Synthesize a voice utterance using the libflite library.
  3536. To enable compilation of this filter you need to configure FFmpeg with
  3537. @code{--enable-libflite}.
  3538. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3539. The filter accepts the following options:
  3540. @table @option
  3541. @item list_voices
  3542. If set to 1, list the names of the available voices and exit
  3543. immediately. Default value is 0.
  3544. @item nb_samples, n
  3545. Set the maximum number of samples per frame. Default value is 512.
  3546. @item textfile
  3547. Set the filename containing the text to speak.
  3548. @item text
  3549. Set the text to speak.
  3550. @item voice, v
  3551. Set the voice to use for the speech synthesis. Default value is
  3552. @code{kal}. See also the @var{list_voices} option.
  3553. @end table
  3554. @subsection Examples
  3555. @itemize
  3556. @item
  3557. Read from file @file{speech.txt}, and synthesize the text using the
  3558. standard flite voice:
  3559. @example
  3560. flite=textfile=speech.txt
  3561. @end example
  3562. @item
  3563. Read the specified text selecting the @code{slt} voice:
  3564. @example
  3565. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3566. @end example
  3567. @item
  3568. Input text to ffmpeg:
  3569. @example
  3570. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3571. @end example
  3572. @item
  3573. Make @file{ffplay} speak the specified text, using @code{flite} and
  3574. the @code{lavfi} device:
  3575. @example
  3576. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3577. @end example
  3578. @end itemize
  3579. For more information about libflite, check:
  3580. @url{http://www.festvox.org/flite/}
  3581. @section anoisesrc
  3582. Generate a noise audio signal.
  3583. The filter accepts the following options:
  3584. @table @option
  3585. @item sample_rate, r
  3586. Specify the sample rate. Default value is 48000 Hz.
  3587. @item amplitude, a
  3588. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3589. is 1.0.
  3590. @item duration, d
  3591. Specify the duration of the generated audio stream. Not specifying this option
  3592. results in noise with an infinite length.
  3593. @item color, colour, c
  3594. Specify the color of noise. Available noise colors are white, pink, brown,
  3595. blue and violet. Default color is white.
  3596. @item seed, s
  3597. Specify a value used to seed the PRNG.
  3598. @item nb_samples, n
  3599. Set the number of samples per each output frame, default is 1024.
  3600. @end table
  3601. @subsection Examples
  3602. @itemize
  3603. @item
  3604. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3605. @example
  3606. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3607. @end example
  3608. @end itemize
  3609. @section sine
  3610. Generate an audio signal made of a sine wave with amplitude 1/8.
  3611. The audio signal is bit-exact.
  3612. The filter accepts the following options:
  3613. @table @option
  3614. @item frequency, f
  3615. Set the carrier frequency. Default is 440 Hz.
  3616. @item beep_factor, b
  3617. Enable a periodic beep every second with frequency @var{beep_factor} times
  3618. the carrier frequency. Default is 0, meaning the beep is disabled.
  3619. @item sample_rate, r
  3620. Specify the sample rate, default is 44100.
  3621. @item duration, d
  3622. Specify the duration of the generated audio stream.
  3623. @item samples_per_frame
  3624. Set the number of samples per output frame.
  3625. The expression can contain the following constants:
  3626. @table @option
  3627. @item n
  3628. The (sequential) number of the output audio frame, starting from 0.
  3629. @item pts
  3630. The PTS (Presentation TimeStamp) of the output audio frame,
  3631. expressed in @var{TB} units.
  3632. @item t
  3633. The PTS of the output audio frame, expressed in seconds.
  3634. @item TB
  3635. The timebase of the output audio frames.
  3636. @end table
  3637. Default is @code{1024}.
  3638. @end table
  3639. @subsection Examples
  3640. @itemize
  3641. @item
  3642. Generate a simple 440 Hz sine wave:
  3643. @example
  3644. sine
  3645. @end example
  3646. @item
  3647. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3648. @example
  3649. sine=220:4:d=5
  3650. sine=f=220:b=4:d=5
  3651. sine=frequency=220:beep_factor=4:duration=5
  3652. @end example
  3653. @item
  3654. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3655. pattern:
  3656. @example
  3657. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3658. @end example
  3659. @end itemize
  3660. @c man end AUDIO SOURCES
  3661. @chapter Audio Sinks
  3662. @c man begin AUDIO SINKS
  3663. Below is a description of the currently available audio sinks.
  3664. @section abuffersink
  3665. Buffer audio frames, and make them available to the end of filter chain.
  3666. This sink is mainly intended for programmatic use, in particular
  3667. through the interface defined in @file{libavfilter/buffersink.h}
  3668. or the options system.
  3669. It accepts a pointer to an AVABufferSinkContext structure, which
  3670. defines the incoming buffers' formats, to be passed as the opaque
  3671. parameter to @code{avfilter_init_filter} for initialization.
  3672. @section anullsink
  3673. Null audio sink; do absolutely nothing with the input audio. It is
  3674. mainly useful as a template and for use in analysis / debugging
  3675. tools.
  3676. @c man end AUDIO SINKS
  3677. @chapter Video Filters
  3678. @c man begin VIDEO FILTERS
  3679. When you configure your FFmpeg build, you can disable any of the
  3680. existing filters using @code{--disable-filters}.
  3681. The configure output will show the video filters included in your
  3682. build.
  3683. Below is a description of the currently available video filters.
  3684. @section alphaextract
  3685. Extract the alpha component from the input as a grayscale video. This
  3686. is especially useful with the @var{alphamerge} filter.
  3687. @section alphamerge
  3688. Add or replace the alpha component of the primary input with the
  3689. grayscale value of a second input. This is intended for use with
  3690. @var{alphaextract} to allow the transmission or storage of frame
  3691. sequences that have alpha in a format that doesn't support an alpha
  3692. channel.
  3693. For example, to reconstruct full frames from a normal YUV-encoded video
  3694. and a separate video created with @var{alphaextract}, you might use:
  3695. @example
  3696. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3697. @end example
  3698. Since this filter is designed for reconstruction, it operates on frame
  3699. sequences without considering timestamps, and terminates when either
  3700. input reaches end of stream. This will cause problems if your encoding
  3701. pipeline drops frames. If you're trying to apply an image as an
  3702. overlay to a video stream, consider the @var{overlay} filter instead.
  3703. @section ass
  3704. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3705. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3706. Substation Alpha) subtitles files.
  3707. This filter accepts the following option in addition to the common options from
  3708. the @ref{subtitles} filter:
  3709. @table @option
  3710. @item shaping
  3711. Set the shaping engine
  3712. Available values are:
  3713. @table @samp
  3714. @item auto
  3715. The default libass shaping engine, which is the best available.
  3716. @item simple
  3717. Fast, font-agnostic shaper that can do only substitutions
  3718. @item complex
  3719. Slower shaper using OpenType for substitutions and positioning
  3720. @end table
  3721. The default is @code{auto}.
  3722. @end table
  3723. @section atadenoise
  3724. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3725. The filter accepts the following options:
  3726. @table @option
  3727. @item 0a
  3728. Set threshold A for 1st plane. Default is 0.02.
  3729. Valid range is 0 to 0.3.
  3730. @item 0b
  3731. Set threshold B for 1st plane. Default is 0.04.
  3732. Valid range is 0 to 5.
  3733. @item 1a
  3734. Set threshold A for 2nd plane. Default is 0.02.
  3735. Valid range is 0 to 0.3.
  3736. @item 1b
  3737. Set threshold B for 2nd plane. Default is 0.04.
  3738. Valid range is 0 to 5.
  3739. @item 2a
  3740. Set threshold A for 3rd plane. Default is 0.02.
  3741. Valid range is 0 to 0.3.
  3742. @item 2b
  3743. Set threshold B for 3rd plane. Default is 0.04.
  3744. Valid range is 0 to 5.
  3745. Threshold A is designed to react on abrupt changes in the input signal and
  3746. threshold B is designed to react on continuous changes in the input signal.
  3747. @item s
  3748. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3749. number in range [5, 129].
  3750. @item p
  3751. Set what planes of frame filter will use for averaging. Default is all.
  3752. @end table
  3753. @section avgblur
  3754. Apply average blur filter.
  3755. The filter accepts the following options:
  3756. @table @option
  3757. @item sizeX
  3758. Set horizontal kernel size.
  3759. @item planes
  3760. Set which planes to filter. By default all planes are filtered.
  3761. @item sizeY
  3762. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3763. Default is @code{0}.
  3764. @end table
  3765. @section bbox
  3766. Compute the bounding box for the non-black pixels in the input frame
  3767. luminance plane.
  3768. This filter computes the bounding box containing all the pixels with a
  3769. luminance value greater than the minimum allowed value.
  3770. The parameters describing the bounding box are printed on the filter
  3771. log.
  3772. The filter accepts the following option:
  3773. @table @option
  3774. @item min_val
  3775. Set the minimal luminance value. Default is @code{16}.
  3776. @end table
  3777. @section bitplanenoise
  3778. Show and measure bit plane noise.
  3779. The filter accepts the following options:
  3780. @table @option
  3781. @item bitplane
  3782. Set which plane to analyze. Default is @code{1}.
  3783. @item filter
  3784. Filter out noisy pixels from @code{bitplane} set above.
  3785. Default is disabled.
  3786. @end table
  3787. @section blackdetect
  3788. Detect video intervals that are (almost) completely black. Can be
  3789. useful to detect chapter transitions, commercials, or invalid
  3790. recordings. Output lines contains the time for the start, end and
  3791. duration of the detected black interval expressed in seconds.
  3792. In order to display the output lines, you need to set the loglevel at
  3793. least to the AV_LOG_INFO value.
  3794. The filter accepts the following options:
  3795. @table @option
  3796. @item black_min_duration, d
  3797. Set the minimum detected black duration expressed in seconds. It must
  3798. be a non-negative floating point number.
  3799. Default value is 2.0.
  3800. @item picture_black_ratio_th, pic_th
  3801. Set the threshold for considering a picture "black".
  3802. Express the minimum value for the ratio:
  3803. @example
  3804. @var{nb_black_pixels} / @var{nb_pixels}
  3805. @end example
  3806. for which a picture is considered black.
  3807. Default value is 0.98.
  3808. @item pixel_black_th, pix_th
  3809. Set the threshold for considering a pixel "black".
  3810. The threshold expresses the maximum pixel luminance value for which a
  3811. pixel is considered "black". The provided value is scaled according to
  3812. the following equation:
  3813. @example
  3814. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3815. @end example
  3816. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3817. the input video format, the range is [0-255] for YUV full-range
  3818. formats and [16-235] for YUV non full-range formats.
  3819. Default value is 0.10.
  3820. @end table
  3821. The following example sets the maximum pixel threshold to the minimum
  3822. value, and detects only black intervals of 2 or more seconds:
  3823. @example
  3824. blackdetect=d=2:pix_th=0.00
  3825. @end example
  3826. @section blackframe
  3827. Detect frames that are (almost) completely black. Can be useful to
  3828. detect chapter transitions or commercials. Output lines consist of
  3829. the frame number of the detected frame, the percentage of blackness,
  3830. the position in the file if known or -1 and the timestamp in seconds.
  3831. In order to display the output lines, you need to set the loglevel at
  3832. least to the AV_LOG_INFO value.
  3833. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3834. The value represents the percentage of pixels in the picture that
  3835. are below the threshold value.
  3836. It accepts the following parameters:
  3837. @table @option
  3838. @item amount
  3839. The percentage of the pixels that have to be below the threshold; it defaults to
  3840. @code{98}.
  3841. @item threshold, thresh
  3842. The threshold below which a pixel value is considered black; it defaults to
  3843. @code{32}.
  3844. @end table
  3845. @section blend, tblend
  3846. Blend two video frames into each other.
  3847. The @code{blend} filter takes two input streams and outputs one
  3848. stream, the first input is the "top" layer and second input is
  3849. "bottom" layer. By default, the output terminates when the longest input terminates.
  3850. The @code{tblend} (time blend) filter takes two consecutive frames
  3851. from one single stream, and outputs the result obtained by blending
  3852. the new frame on top of the old frame.
  3853. A description of the accepted options follows.
  3854. @table @option
  3855. @item c0_mode
  3856. @item c1_mode
  3857. @item c2_mode
  3858. @item c3_mode
  3859. @item all_mode
  3860. Set blend mode for specific pixel component or all pixel components in case
  3861. of @var{all_mode}. Default value is @code{normal}.
  3862. Available values for component modes are:
  3863. @table @samp
  3864. @item addition
  3865. @item grainmerge
  3866. @item and
  3867. @item average
  3868. @item burn
  3869. @item darken
  3870. @item difference
  3871. @item grainextract
  3872. @item divide
  3873. @item dodge
  3874. @item freeze
  3875. @item exclusion
  3876. @item extremity
  3877. @item glow
  3878. @item hardlight
  3879. @item hardmix
  3880. @item heat
  3881. @item lighten
  3882. @item linearlight
  3883. @item multiply
  3884. @item multiply128
  3885. @item negation
  3886. @item normal
  3887. @item or
  3888. @item overlay
  3889. @item phoenix
  3890. @item pinlight
  3891. @item reflect
  3892. @item screen
  3893. @item softlight
  3894. @item subtract
  3895. @item vividlight
  3896. @item xor
  3897. @end table
  3898. @item c0_opacity
  3899. @item c1_opacity
  3900. @item c2_opacity
  3901. @item c3_opacity
  3902. @item all_opacity
  3903. Set blend opacity for specific pixel component or all pixel components in case
  3904. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3905. @item c0_expr
  3906. @item c1_expr
  3907. @item c2_expr
  3908. @item c3_expr
  3909. @item all_expr
  3910. Set blend expression for specific pixel component or all pixel components in case
  3911. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3912. The expressions can use the following variables:
  3913. @table @option
  3914. @item N
  3915. The sequential number of the filtered frame, starting from @code{0}.
  3916. @item X
  3917. @item Y
  3918. the coordinates of the current sample
  3919. @item W
  3920. @item H
  3921. the width and height of currently filtered plane
  3922. @item SW
  3923. @item SH
  3924. Width and height scale depending on the currently filtered plane. It is the
  3925. ratio between the corresponding luma plane number of pixels and the current
  3926. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3927. @code{0.5,0.5} for chroma planes.
  3928. @item T
  3929. Time of the current frame, expressed in seconds.
  3930. @item TOP, A
  3931. Value of pixel component at current location for first video frame (top layer).
  3932. @item BOTTOM, B
  3933. Value of pixel component at current location for second video frame (bottom layer).
  3934. @end table
  3935. @end table
  3936. The @code{blend} filter also supports the @ref{framesync} options.
  3937. @subsection Examples
  3938. @itemize
  3939. @item
  3940. Apply transition from bottom layer to top layer in first 10 seconds:
  3941. @example
  3942. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3943. @end example
  3944. @item
  3945. Apply linear horizontal transition from top layer to bottom layer:
  3946. @example
  3947. blend=all_expr='A*(X/W)+B*(1-X/W)'
  3948. @end example
  3949. @item
  3950. Apply 1x1 checkerboard effect:
  3951. @example
  3952. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3953. @end example
  3954. @item
  3955. Apply uncover left effect:
  3956. @example
  3957. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3958. @end example
  3959. @item
  3960. Apply uncover down effect:
  3961. @example
  3962. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3963. @end example
  3964. @item
  3965. Apply uncover up-left effect:
  3966. @example
  3967. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3968. @end example
  3969. @item
  3970. Split diagonally video and shows top and bottom layer on each side:
  3971. @example
  3972. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  3973. @end example
  3974. @item
  3975. Display differences between the current and the previous frame:
  3976. @example
  3977. tblend=all_mode=grainextract
  3978. @end example
  3979. @end itemize
  3980. @section boxblur
  3981. Apply a boxblur algorithm to the input video.
  3982. It accepts the following parameters:
  3983. @table @option
  3984. @item luma_radius, lr
  3985. @item luma_power, lp
  3986. @item chroma_radius, cr
  3987. @item chroma_power, cp
  3988. @item alpha_radius, ar
  3989. @item alpha_power, ap
  3990. @end table
  3991. A description of the accepted options follows.
  3992. @table @option
  3993. @item luma_radius, lr
  3994. @item chroma_radius, cr
  3995. @item alpha_radius, ar
  3996. Set an expression for the box radius in pixels used for blurring the
  3997. corresponding input plane.
  3998. The radius value must be a non-negative number, and must not be
  3999. greater than the value of the expression @code{min(w,h)/2} for the
  4000. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4001. planes.
  4002. Default value for @option{luma_radius} is "2". If not specified,
  4003. @option{chroma_radius} and @option{alpha_radius} default to the
  4004. corresponding value set for @option{luma_radius}.
  4005. The expressions can contain the following constants:
  4006. @table @option
  4007. @item w
  4008. @item h
  4009. The input width and height in pixels.
  4010. @item cw
  4011. @item ch
  4012. The input chroma image width and height in pixels.
  4013. @item hsub
  4014. @item vsub
  4015. The horizontal and vertical chroma subsample values. For example, for the
  4016. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4017. @end table
  4018. @item luma_power, lp
  4019. @item chroma_power, cp
  4020. @item alpha_power, ap
  4021. Specify how many times the boxblur filter is applied to the
  4022. corresponding plane.
  4023. Default value for @option{luma_power} is 2. If not specified,
  4024. @option{chroma_power} and @option{alpha_power} default to the
  4025. corresponding value set for @option{luma_power}.
  4026. A value of 0 will disable the effect.
  4027. @end table
  4028. @subsection Examples
  4029. @itemize
  4030. @item
  4031. Apply a boxblur filter with the luma, chroma, and alpha radii
  4032. set to 2:
  4033. @example
  4034. boxblur=luma_radius=2:luma_power=1
  4035. boxblur=2:1
  4036. @end example
  4037. @item
  4038. Set the luma radius to 2, and alpha and chroma radius to 0:
  4039. @example
  4040. boxblur=2:1:cr=0:ar=0
  4041. @end example
  4042. @item
  4043. Set the luma and chroma radii to a fraction of the video dimension:
  4044. @example
  4045. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4046. @end example
  4047. @end itemize
  4048. @section bwdif
  4049. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4050. Deinterlacing Filter").
  4051. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4052. interpolation algorithms.
  4053. It accepts the following parameters:
  4054. @table @option
  4055. @item mode
  4056. The interlacing mode to adopt. It accepts one of the following values:
  4057. @table @option
  4058. @item 0, send_frame
  4059. Output one frame for each frame.
  4060. @item 1, send_field
  4061. Output one frame for each field.
  4062. @end table
  4063. The default value is @code{send_field}.
  4064. @item parity
  4065. The picture field parity assumed for the input interlaced video. It accepts one
  4066. of the following values:
  4067. @table @option
  4068. @item 0, tff
  4069. Assume the top field is first.
  4070. @item 1, bff
  4071. Assume the bottom field is first.
  4072. @item -1, auto
  4073. Enable automatic detection of field parity.
  4074. @end table
  4075. The default value is @code{auto}.
  4076. If the interlacing is unknown or the decoder does not export this information,
  4077. top field first will be assumed.
  4078. @item deint
  4079. Specify which frames to deinterlace. Accept one of the following
  4080. values:
  4081. @table @option
  4082. @item 0, all
  4083. Deinterlace all frames.
  4084. @item 1, interlaced
  4085. Only deinterlace frames marked as interlaced.
  4086. @end table
  4087. The default value is @code{all}.
  4088. @end table
  4089. @section chromakey
  4090. YUV colorspace color/chroma keying.
  4091. The filter accepts the following options:
  4092. @table @option
  4093. @item color
  4094. The color which will be replaced with transparency.
  4095. @item similarity
  4096. Similarity percentage with the key color.
  4097. 0.01 matches only the exact key color, while 1.0 matches everything.
  4098. @item blend
  4099. Blend percentage.
  4100. 0.0 makes pixels either fully transparent, or not transparent at all.
  4101. Higher values result in semi-transparent pixels, with a higher transparency
  4102. the more similar the pixels color is to the key color.
  4103. @item yuv
  4104. Signals that the color passed is already in YUV instead of RGB.
  4105. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4106. This can be used to pass exact YUV values as hexadecimal numbers.
  4107. @end table
  4108. @subsection Examples
  4109. @itemize
  4110. @item
  4111. Make every green pixel in the input image transparent:
  4112. @example
  4113. ffmpeg -i input.png -vf chromakey=green out.png
  4114. @end example
  4115. @item
  4116. Overlay a greenscreen-video on top of a static black background.
  4117. @example
  4118. 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
  4119. @end example
  4120. @end itemize
  4121. @section ciescope
  4122. Display CIE color diagram with pixels overlaid onto it.
  4123. The filter accepts the following options:
  4124. @table @option
  4125. @item system
  4126. Set color system.
  4127. @table @samp
  4128. @item ntsc, 470m
  4129. @item ebu, 470bg
  4130. @item smpte
  4131. @item 240m
  4132. @item apple
  4133. @item widergb
  4134. @item cie1931
  4135. @item rec709, hdtv
  4136. @item uhdtv, rec2020
  4137. @end table
  4138. @item cie
  4139. Set CIE system.
  4140. @table @samp
  4141. @item xyy
  4142. @item ucs
  4143. @item luv
  4144. @end table
  4145. @item gamuts
  4146. Set what gamuts to draw.
  4147. See @code{system} option for available values.
  4148. @item size, s
  4149. Set ciescope size, by default set to 512.
  4150. @item intensity, i
  4151. Set intensity used to map input pixel values to CIE diagram.
  4152. @item contrast
  4153. Set contrast used to draw tongue colors that are out of active color system gamut.
  4154. @item corrgamma
  4155. Correct gamma displayed on scope, by default enabled.
  4156. @item showwhite
  4157. Show white point on CIE diagram, by default disabled.
  4158. @item gamma
  4159. Set input gamma. Used only with XYZ input color space.
  4160. @end table
  4161. @section codecview
  4162. Visualize information exported by some codecs.
  4163. Some codecs can export information through frames using side-data or other
  4164. means. For example, some MPEG based codecs export motion vectors through the
  4165. @var{export_mvs} flag in the codec @option{flags2} option.
  4166. The filter accepts the following option:
  4167. @table @option
  4168. @item mv
  4169. Set motion vectors to visualize.
  4170. Available flags for @var{mv} are:
  4171. @table @samp
  4172. @item pf
  4173. forward predicted MVs of P-frames
  4174. @item bf
  4175. forward predicted MVs of B-frames
  4176. @item bb
  4177. backward predicted MVs of B-frames
  4178. @end table
  4179. @item qp
  4180. Display quantization parameters using the chroma planes.
  4181. @item mv_type, mvt
  4182. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4183. Available flags for @var{mv_type} are:
  4184. @table @samp
  4185. @item fp
  4186. forward predicted MVs
  4187. @item bp
  4188. backward predicted MVs
  4189. @end table
  4190. @item frame_type, ft
  4191. Set frame type to visualize motion vectors of.
  4192. Available flags for @var{frame_type} are:
  4193. @table @samp
  4194. @item if
  4195. intra-coded frames (I-frames)
  4196. @item pf
  4197. predicted frames (P-frames)
  4198. @item bf
  4199. bi-directionally predicted frames (B-frames)
  4200. @end table
  4201. @end table
  4202. @subsection Examples
  4203. @itemize
  4204. @item
  4205. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4206. @example
  4207. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4208. @end example
  4209. @item
  4210. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4211. @example
  4212. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4213. @end example
  4214. @end itemize
  4215. @section colorbalance
  4216. Modify intensity of primary colors (red, green and blue) of input frames.
  4217. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4218. regions for the red-cyan, green-magenta or blue-yellow balance.
  4219. A positive adjustment value shifts the balance towards the primary color, a negative
  4220. value towards the complementary color.
  4221. The filter accepts the following options:
  4222. @table @option
  4223. @item rs
  4224. @item gs
  4225. @item bs
  4226. Adjust red, green and blue shadows (darkest pixels).
  4227. @item rm
  4228. @item gm
  4229. @item bm
  4230. Adjust red, green and blue midtones (medium pixels).
  4231. @item rh
  4232. @item gh
  4233. @item bh
  4234. Adjust red, green and blue highlights (brightest pixels).
  4235. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4236. @end table
  4237. @subsection Examples
  4238. @itemize
  4239. @item
  4240. Add red color cast to shadows:
  4241. @example
  4242. colorbalance=rs=.3
  4243. @end example
  4244. @end itemize
  4245. @section colorkey
  4246. RGB colorspace color keying.
  4247. The filter accepts the following options:
  4248. @table @option
  4249. @item color
  4250. The color which will be replaced with transparency.
  4251. @item similarity
  4252. Similarity percentage with the key color.
  4253. 0.01 matches only the exact key color, while 1.0 matches everything.
  4254. @item blend
  4255. Blend percentage.
  4256. 0.0 makes pixels either fully transparent, or not transparent at all.
  4257. Higher values result in semi-transparent pixels, with a higher transparency
  4258. the more similar the pixels color is to the key color.
  4259. @end table
  4260. @subsection Examples
  4261. @itemize
  4262. @item
  4263. Make every green pixel in the input image transparent:
  4264. @example
  4265. ffmpeg -i input.png -vf colorkey=green out.png
  4266. @end example
  4267. @item
  4268. Overlay a greenscreen-video on top of a static background image.
  4269. @example
  4270. 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
  4271. @end example
  4272. @end itemize
  4273. @section colorlevels
  4274. Adjust video input frames using levels.
  4275. The filter accepts the following options:
  4276. @table @option
  4277. @item rimin
  4278. @item gimin
  4279. @item bimin
  4280. @item aimin
  4281. Adjust red, green, blue and alpha input black point.
  4282. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4283. @item rimax
  4284. @item gimax
  4285. @item bimax
  4286. @item aimax
  4287. Adjust red, green, blue and alpha input white point.
  4288. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4289. Input levels are used to lighten highlights (bright tones), darken shadows
  4290. (dark tones), change the balance of bright and dark tones.
  4291. @item romin
  4292. @item gomin
  4293. @item bomin
  4294. @item aomin
  4295. Adjust red, green, blue and alpha output black point.
  4296. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4297. @item romax
  4298. @item gomax
  4299. @item bomax
  4300. @item aomax
  4301. Adjust red, green, blue and alpha output white point.
  4302. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4303. Output levels allows manual selection of a constrained output level range.
  4304. @end table
  4305. @subsection Examples
  4306. @itemize
  4307. @item
  4308. Make video output darker:
  4309. @example
  4310. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4311. @end example
  4312. @item
  4313. Increase contrast:
  4314. @example
  4315. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4316. @end example
  4317. @item
  4318. Make video output lighter:
  4319. @example
  4320. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4321. @end example
  4322. @item
  4323. Increase brightness:
  4324. @example
  4325. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4326. @end example
  4327. @end itemize
  4328. @section colorchannelmixer
  4329. Adjust video input frames by re-mixing color channels.
  4330. This filter modifies a color channel by adding the values associated to
  4331. the other channels of the same pixels. For example if the value to
  4332. modify is red, the output value will be:
  4333. @example
  4334. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4335. @end example
  4336. The filter accepts the following options:
  4337. @table @option
  4338. @item rr
  4339. @item rg
  4340. @item rb
  4341. @item ra
  4342. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4343. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4344. @item gr
  4345. @item gg
  4346. @item gb
  4347. @item ga
  4348. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4349. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4350. @item br
  4351. @item bg
  4352. @item bb
  4353. @item ba
  4354. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4355. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4356. @item ar
  4357. @item ag
  4358. @item ab
  4359. @item aa
  4360. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4361. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4362. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4363. @end table
  4364. @subsection Examples
  4365. @itemize
  4366. @item
  4367. Convert source to grayscale:
  4368. @example
  4369. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4370. @end example
  4371. @item
  4372. Simulate sepia tones:
  4373. @example
  4374. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4375. @end example
  4376. @end itemize
  4377. @section colormatrix
  4378. Convert color matrix.
  4379. The filter accepts the following options:
  4380. @table @option
  4381. @item src
  4382. @item dst
  4383. Specify the source and destination color matrix. Both values must be
  4384. specified.
  4385. The accepted values are:
  4386. @table @samp
  4387. @item bt709
  4388. BT.709
  4389. @item fcc
  4390. FCC
  4391. @item bt601
  4392. BT.601
  4393. @item bt470
  4394. BT.470
  4395. @item bt470bg
  4396. BT.470BG
  4397. @item smpte170m
  4398. SMPTE-170M
  4399. @item smpte240m
  4400. SMPTE-240M
  4401. @item bt2020
  4402. BT.2020
  4403. @end table
  4404. @end table
  4405. For example to convert from BT.601 to SMPTE-240M, use the command:
  4406. @example
  4407. colormatrix=bt601:smpte240m
  4408. @end example
  4409. @section colorspace
  4410. Convert colorspace, transfer characteristics or color primaries.
  4411. Input video needs to have an even size.
  4412. The filter accepts the following options:
  4413. @table @option
  4414. @anchor{all}
  4415. @item all
  4416. Specify all color properties at once.
  4417. The accepted values are:
  4418. @table @samp
  4419. @item bt470m
  4420. BT.470M
  4421. @item bt470bg
  4422. BT.470BG
  4423. @item bt601-6-525
  4424. BT.601-6 525
  4425. @item bt601-6-625
  4426. BT.601-6 625
  4427. @item bt709
  4428. BT.709
  4429. @item smpte170m
  4430. SMPTE-170M
  4431. @item smpte240m
  4432. SMPTE-240M
  4433. @item bt2020
  4434. BT.2020
  4435. @end table
  4436. @anchor{space}
  4437. @item space
  4438. Specify output colorspace.
  4439. The accepted values are:
  4440. @table @samp
  4441. @item bt709
  4442. BT.709
  4443. @item fcc
  4444. FCC
  4445. @item bt470bg
  4446. BT.470BG or BT.601-6 625
  4447. @item smpte170m
  4448. SMPTE-170M or BT.601-6 525
  4449. @item smpte240m
  4450. SMPTE-240M
  4451. @item ycgco
  4452. YCgCo
  4453. @item bt2020ncl
  4454. BT.2020 with non-constant luminance
  4455. @end table
  4456. @anchor{trc}
  4457. @item trc
  4458. Specify output transfer characteristics.
  4459. The accepted values are:
  4460. @table @samp
  4461. @item bt709
  4462. BT.709
  4463. @item bt470m
  4464. BT.470M
  4465. @item bt470bg
  4466. BT.470BG
  4467. @item gamma22
  4468. Constant gamma of 2.2
  4469. @item gamma28
  4470. Constant gamma of 2.8
  4471. @item smpte170m
  4472. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4473. @item smpte240m
  4474. SMPTE-240M
  4475. @item srgb
  4476. SRGB
  4477. @item iec61966-2-1
  4478. iec61966-2-1
  4479. @item iec61966-2-4
  4480. iec61966-2-4
  4481. @item xvycc
  4482. xvycc
  4483. @item bt2020-10
  4484. BT.2020 for 10-bits content
  4485. @item bt2020-12
  4486. BT.2020 for 12-bits content
  4487. @end table
  4488. @anchor{primaries}
  4489. @item primaries
  4490. Specify output color primaries.
  4491. The accepted values are:
  4492. @table @samp
  4493. @item bt709
  4494. BT.709
  4495. @item bt470m
  4496. BT.470M
  4497. @item bt470bg
  4498. BT.470BG or BT.601-6 625
  4499. @item smpte170m
  4500. SMPTE-170M or BT.601-6 525
  4501. @item smpte240m
  4502. SMPTE-240M
  4503. @item film
  4504. film
  4505. @item smpte431
  4506. SMPTE-431
  4507. @item smpte432
  4508. SMPTE-432
  4509. @item bt2020
  4510. BT.2020
  4511. @item jedec-p22
  4512. JEDEC P22 phosphors
  4513. @end table
  4514. @anchor{range}
  4515. @item range
  4516. Specify output color range.
  4517. The accepted values are:
  4518. @table @samp
  4519. @item tv
  4520. TV (restricted) range
  4521. @item mpeg
  4522. MPEG (restricted) range
  4523. @item pc
  4524. PC (full) range
  4525. @item jpeg
  4526. JPEG (full) range
  4527. @end table
  4528. @item format
  4529. Specify output color format.
  4530. The accepted values are:
  4531. @table @samp
  4532. @item yuv420p
  4533. YUV 4:2:0 planar 8-bits
  4534. @item yuv420p10
  4535. YUV 4:2:0 planar 10-bits
  4536. @item yuv420p12
  4537. YUV 4:2:0 planar 12-bits
  4538. @item yuv422p
  4539. YUV 4:2:2 planar 8-bits
  4540. @item yuv422p10
  4541. YUV 4:2:2 planar 10-bits
  4542. @item yuv422p12
  4543. YUV 4:2:2 planar 12-bits
  4544. @item yuv444p
  4545. YUV 4:4:4 planar 8-bits
  4546. @item yuv444p10
  4547. YUV 4:4:4 planar 10-bits
  4548. @item yuv444p12
  4549. YUV 4:4:4 planar 12-bits
  4550. @end table
  4551. @item fast
  4552. Do a fast conversion, which skips gamma/primary correction. This will take
  4553. significantly less CPU, but will be mathematically incorrect. To get output
  4554. compatible with that produced by the colormatrix filter, use fast=1.
  4555. @item dither
  4556. Specify dithering mode.
  4557. The accepted values are:
  4558. @table @samp
  4559. @item none
  4560. No dithering
  4561. @item fsb
  4562. Floyd-Steinberg dithering
  4563. @end table
  4564. @item wpadapt
  4565. Whitepoint adaptation mode.
  4566. The accepted values are:
  4567. @table @samp
  4568. @item bradford
  4569. Bradford whitepoint adaptation
  4570. @item vonkries
  4571. von Kries whitepoint adaptation
  4572. @item identity
  4573. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4574. @end table
  4575. @item iall
  4576. Override all input properties at once. Same accepted values as @ref{all}.
  4577. @item ispace
  4578. Override input colorspace. Same accepted values as @ref{space}.
  4579. @item iprimaries
  4580. Override input color primaries. Same accepted values as @ref{primaries}.
  4581. @item itrc
  4582. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4583. @item irange
  4584. Override input color range. Same accepted values as @ref{range}.
  4585. @end table
  4586. The filter converts the transfer characteristics, color space and color
  4587. primaries to the specified user values. The output value, if not specified,
  4588. is set to a default value based on the "all" property. If that property is
  4589. also not specified, the filter will log an error. The output color range and
  4590. format default to the same value as the input color range and format. The
  4591. input transfer characteristics, color space, color primaries and color range
  4592. should be set on the input data. If any of these are missing, the filter will
  4593. log an error and no conversion will take place.
  4594. For example to convert the input to SMPTE-240M, use the command:
  4595. @example
  4596. colorspace=smpte240m
  4597. @end example
  4598. @section convolution
  4599. Apply convolution 3x3 or 5x5 filter.
  4600. The filter accepts the following options:
  4601. @table @option
  4602. @item 0m
  4603. @item 1m
  4604. @item 2m
  4605. @item 3m
  4606. Set matrix for each plane.
  4607. Matrix is sequence of 9 or 25 signed integers.
  4608. @item 0rdiv
  4609. @item 1rdiv
  4610. @item 2rdiv
  4611. @item 3rdiv
  4612. Set multiplier for calculated value for each plane.
  4613. @item 0bias
  4614. @item 1bias
  4615. @item 2bias
  4616. @item 3bias
  4617. Set bias for each plane. This value is added to the result of the multiplication.
  4618. Useful for making the overall image brighter or darker. Default is 0.0.
  4619. @end table
  4620. @subsection Examples
  4621. @itemize
  4622. @item
  4623. Apply sharpen:
  4624. @example
  4625. 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"
  4626. @end example
  4627. @item
  4628. Apply blur:
  4629. @example
  4630. 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"
  4631. @end example
  4632. @item
  4633. Apply edge enhance:
  4634. @example
  4635. 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"
  4636. @end example
  4637. @item
  4638. Apply edge detect:
  4639. @example
  4640. 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"
  4641. @end example
  4642. @item
  4643. Apply laplacian edge detector which includes diagonals:
  4644. @example
  4645. 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"
  4646. @end example
  4647. @item
  4648. Apply emboss:
  4649. @example
  4650. 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"
  4651. @end example
  4652. @end itemize
  4653. @section convolve
  4654. Apply 2D convolution of video stream in frequency domain using second stream
  4655. as impulse.
  4656. The filter accepts the following options:
  4657. @table @option
  4658. @item planes
  4659. Set which planes to process.
  4660. @item impulse
  4661. Set which impulse video frames will be processed, can be @var{first}
  4662. or @var{all}. Default is @var{all}.
  4663. @end table
  4664. The @code{convolve} filter also supports the @ref{framesync} options.
  4665. @section copy
  4666. Copy the input video source unchanged to the output. This is mainly useful for
  4667. testing purposes.
  4668. @anchor{coreimage}
  4669. @section coreimage
  4670. Video filtering on GPU using Apple's CoreImage API on OSX.
  4671. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4672. processed by video hardware. However, software-based OpenGL implementations
  4673. exist which means there is no guarantee for hardware processing. It depends on
  4674. the respective OSX.
  4675. There are many filters and image generators provided by Apple that come with a
  4676. large variety of options. The filter has to be referenced by its name along
  4677. with its options.
  4678. The coreimage filter accepts the following options:
  4679. @table @option
  4680. @item list_filters
  4681. List all available filters and generators along with all their respective
  4682. options as well as possible minimum and maximum values along with the default
  4683. values.
  4684. @example
  4685. list_filters=true
  4686. @end example
  4687. @item filter
  4688. Specify all filters by their respective name and options.
  4689. Use @var{list_filters} to determine all valid filter names and options.
  4690. Numerical options are specified by a float value and are automatically clamped
  4691. to their respective value range. Vector and color options have to be specified
  4692. by a list of space separated float values. Character escaping has to be done.
  4693. A special option name @code{default} is available to use default options for a
  4694. filter.
  4695. It is required to specify either @code{default} or at least one of the filter options.
  4696. All omitted options are used with their default values.
  4697. The syntax of the filter string is as follows:
  4698. @example
  4699. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4700. @end example
  4701. @item output_rect
  4702. Specify a rectangle where the output of the filter chain is copied into the
  4703. input image. It is given by a list of space separated float values:
  4704. @example
  4705. output_rect=x\ y\ width\ height
  4706. @end example
  4707. If not given, the output rectangle equals the dimensions of the input image.
  4708. The output rectangle is automatically cropped at the borders of the input
  4709. image. Negative values are valid for each component.
  4710. @example
  4711. output_rect=25\ 25\ 100\ 100
  4712. @end example
  4713. @end table
  4714. Several filters can be chained for successive processing without GPU-HOST
  4715. transfers allowing for fast processing of complex filter chains.
  4716. Currently, only filters with zero (generators) or exactly one (filters) input
  4717. image and one output image are supported. Also, transition filters are not yet
  4718. usable as intended.
  4719. Some filters generate output images with additional padding depending on the
  4720. respective filter kernel. The padding is automatically removed to ensure the
  4721. filter output has the same size as the input image.
  4722. For image generators, the size of the output image is determined by the
  4723. previous output image of the filter chain or the input image of the whole
  4724. filterchain, respectively. The generators do not use the pixel information of
  4725. this image to generate their output. However, the generated output is
  4726. blended onto this image, resulting in partial or complete coverage of the
  4727. output image.
  4728. The @ref{coreimagesrc} video source can be used for generating input images
  4729. which are directly fed into the filter chain. By using it, providing input
  4730. images by another video source or an input video is not required.
  4731. @subsection Examples
  4732. @itemize
  4733. @item
  4734. List all filters available:
  4735. @example
  4736. coreimage=list_filters=true
  4737. @end example
  4738. @item
  4739. Use the CIBoxBlur filter with default options to blur an image:
  4740. @example
  4741. coreimage=filter=CIBoxBlur@@default
  4742. @end example
  4743. @item
  4744. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4745. its center at 100x100 and a radius of 50 pixels:
  4746. @example
  4747. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4748. @end example
  4749. @item
  4750. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4751. given as complete and escaped command-line for Apple's standard bash shell:
  4752. @example
  4753. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4754. @end example
  4755. @end itemize
  4756. @section crop
  4757. Crop the input video to given dimensions.
  4758. It accepts the following parameters:
  4759. @table @option
  4760. @item w, out_w
  4761. The width of the output video. It defaults to @code{iw}.
  4762. This expression is evaluated only once during the filter
  4763. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4764. @item h, out_h
  4765. The height of the output video. It defaults to @code{ih}.
  4766. This expression is evaluated only once during the filter
  4767. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4768. @item x
  4769. The horizontal position, in the input video, of the left edge of the output
  4770. video. It defaults to @code{(in_w-out_w)/2}.
  4771. This expression is evaluated per-frame.
  4772. @item y
  4773. The vertical position, in the input video, of the top edge of the output video.
  4774. It defaults to @code{(in_h-out_h)/2}.
  4775. This expression is evaluated per-frame.
  4776. @item keep_aspect
  4777. If set to 1 will force the output display aspect ratio
  4778. to be the same of the input, by changing the output sample aspect
  4779. ratio. It defaults to 0.
  4780. @item exact
  4781. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4782. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4783. It defaults to 0.
  4784. @end table
  4785. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4786. expressions containing the following constants:
  4787. @table @option
  4788. @item x
  4789. @item y
  4790. The computed values for @var{x} and @var{y}. They are evaluated for
  4791. each new frame.
  4792. @item in_w
  4793. @item in_h
  4794. The input width and height.
  4795. @item iw
  4796. @item ih
  4797. These are the same as @var{in_w} and @var{in_h}.
  4798. @item out_w
  4799. @item out_h
  4800. The output (cropped) width and height.
  4801. @item ow
  4802. @item oh
  4803. These are the same as @var{out_w} and @var{out_h}.
  4804. @item a
  4805. same as @var{iw} / @var{ih}
  4806. @item sar
  4807. input sample aspect ratio
  4808. @item dar
  4809. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4810. @item hsub
  4811. @item vsub
  4812. horizontal and vertical chroma subsample values. For example for the
  4813. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4814. @item n
  4815. The number of the input frame, starting from 0.
  4816. @item pos
  4817. the position in the file of the input frame, NAN if unknown
  4818. @item t
  4819. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4820. @end table
  4821. The expression for @var{out_w} may depend on the value of @var{out_h},
  4822. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4823. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4824. evaluated after @var{out_w} and @var{out_h}.
  4825. The @var{x} and @var{y} parameters specify the expressions for the
  4826. position of the top-left corner of the output (non-cropped) area. They
  4827. are evaluated for each frame. If the evaluated value is not valid, it
  4828. is approximated to the nearest valid value.
  4829. The expression for @var{x} may depend on @var{y}, and the expression
  4830. for @var{y} may depend on @var{x}.
  4831. @subsection Examples
  4832. @itemize
  4833. @item
  4834. Crop area with size 100x100 at position (12,34).
  4835. @example
  4836. crop=100:100:12:34
  4837. @end example
  4838. Using named options, the example above becomes:
  4839. @example
  4840. crop=w=100:h=100:x=12:y=34
  4841. @end example
  4842. @item
  4843. Crop the central input area with size 100x100:
  4844. @example
  4845. crop=100:100
  4846. @end example
  4847. @item
  4848. Crop the central input area with size 2/3 of the input video:
  4849. @example
  4850. crop=2/3*in_w:2/3*in_h
  4851. @end example
  4852. @item
  4853. Crop the input video central square:
  4854. @example
  4855. crop=out_w=in_h
  4856. crop=in_h
  4857. @end example
  4858. @item
  4859. Delimit the rectangle with the top-left corner placed at position
  4860. 100:100 and the right-bottom corner corresponding to the right-bottom
  4861. corner of the input image.
  4862. @example
  4863. crop=in_w-100:in_h-100:100:100
  4864. @end example
  4865. @item
  4866. Crop 10 pixels from the left and right borders, and 20 pixels from
  4867. the top and bottom borders
  4868. @example
  4869. crop=in_w-2*10:in_h-2*20
  4870. @end example
  4871. @item
  4872. Keep only the bottom right quarter of the input image:
  4873. @example
  4874. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4875. @end example
  4876. @item
  4877. Crop height for getting Greek harmony:
  4878. @example
  4879. crop=in_w:1/PHI*in_w
  4880. @end example
  4881. @item
  4882. Apply trembling effect:
  4883. @example
  4884. 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)
  4885. @end example
  4886. @item
  4887. Apply erratic camera effect depending on timestamp:
  4888. @example
  4889. 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)"
  4890. @end example
  4891. @item
  4892. Set x depending on the value of y:
  4893. @example
  4894. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4895. @end example
  4896. @end itemize
  4897. @subsection Commands
  4898. This filter supports the following commands:
  4899. @table @option
  4900. @item w, out_w
  4901. @item h, out_h
  4902. @item x
  4903. @item y
  4904. Set width/height of the output video and the horizontal/vertical position
  4905. in the input video.
  4906. The command accepts the same syntax of the corresponding option.
  4907. If the specified expression is not valid, it is kept at its current
  4908. value.
  4909. @end table
  4910. @section cropdetect
  4911. Auto-detect the crop size.
  4912. It calculates the necessary cropping parameters and prints the
  4913. recommended parameters via the logging system. The detected dimensions
  4914. correspond to the non-black area of the input video.
  4915. It accepts the following parameters:
  4916. @table @option
  4917. @item limit
  4918. Set higher black value threshold, which can be optionally specified
  4919. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4920. value greater to the set value is considered non-black. It defaults to 24.
  4921. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4922. on the bitdepth of the pixel format.
  4923. @item round
  4924. The value which the width/height should be divisible by. It defaults to
  4925. 16. The offset is automatically adjusted to center the video. Use 2 to
  4926. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4927. encoding to most video codecs.
  4928. @item reset_count, reset
  4929. Set the counter that determines after how many frames cropdetect will
  4930. reset the previously detected largest video area and start over to
  4931. detect the current optimal crop area. Default value is 0.
  4932. This can be useful when channel logos distort the video area. 0
  4933. indicates 'never reset', and returns the largest area encountered during
  4934. playback.
  4935. @end table
  4936. @anchor{curves}
  4937. @section curves
  4938. Apply color adjustments using curves.
  4939. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4940. component (red, green and blue) has its values defined by @var{N} key points
  4941. tied from each other using a smooth curve. The x-axis represents the pixel
  4942. values from the input frame, and the y-axis the new pixel values to be set for
  4943. the output frame.
  4944. By default, a component curve is defined by the two points @var{(0;0)} and
  4945. @var{(1;1)}. This creates a straight line where each original pixel value is
  4946. "adjusted" to its own value, which means no change to the image.
  4947. The filter allows you to redefine these two points and add some more. A new
  4948. curve (using a natural cubic spline interpolation) will be define to pass
  4949. smoothly through all these new coordinates. The new defined points needs to be
  4950. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4951. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4952. the vector spaces, the values will be clipped accordingly.
  4953. The filter accepts the following options:
  4954. @table @option
  4955. @item preset
  4956. Select one of the available color presets. This option can be used in addition
  4957. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4958. options takes priority on the preset values.
  4959. Available presets are:
  4960. @table @samp
  4961. @item none
  4962. @item color_negative
  4963. @item cross_process
  4964. @item darker
  4965. @item increase_contrast
  4966. @item lighter
  4967. @item linear_contrast
  4968. @item medium_contrast
  4969. @item negative
  4970. @item strong_contrast
  4971. @item vintage
  4972. @end table
  4973. Default is @code{none}.
  4974. @item master, m
  4975. Set the master key points. These points will define a second pass mapping. It
  4976. is sometimes called a "luminance" or "value" mapping. It can be used with
  4977. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4978. post-processing LUT.
  4979. @item red, r
  4980. Set the key points for the red component.
  4981. @item green, g
  4982. Set the key points for the green component.
  4983. @item blue, b
  4984. Set the key points for the blue component.
  4985. @item all
  4986. Set the key points for all components (not including master).
  4987. Can be used in addition to the other key points component
  4988. options. In this case, the unset component(s) will fallback on this
  4989. @option{all} setting.
  4990. @item psfile
  4991. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4992. @item plot
  4993. Save Gnuplot script of the curves in specified file.
  4994. @end table
  4995. To avoid some filtergraph syntax conflicts, each key points list need to be
  4996. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4997. @subsection Examples
  4998. @itemize
  4999. @item
  5000. Increase slightly the middle level of blue:
  5001. @example
  5002. curves=blue='0/0 0.5/0.58 1/1'
  5003. @end example
  5004. @item
  5005. Vintage effect:
  5006. @example
  5007. 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'
  5008. @end example
  5009. Here we obtain the following coordinates for each components:
  5010. @table @var
  5011. @item red
  5012. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5013. @item green
  5014. @code{(0;0) (0.50;0.48) (1;1)}
  5015. @item blue
  5016. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5017. @end table
  5018. @item
  5019. The previous example can also be achieved with the associated built-in preset:
  5020. @example
  5021. curves=preset=vintage
  5022. @end example
  5023. @item
  5024. Or simply:
  5025. @example
  5026. curves=vintage
  5027. @end example
  5028. @item
  5029. Use a Photoshop preset and redefine the points of the green component:
  5030. @example
  5031. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5032. @end example
  5033. @item
  5034. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5035. and @command{gnuplot}:
  5036. @example
  5037. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5038. gnuplot -p /tmp/curves.plt
  5039. @end example
  5040. @end itemize
  5041. @section datascope
  5042. Video data analysis filter.
  5043. This filter shows hexadecimal pixel values of part of video.
  5044. The filter accepts the following options:
  5045. @table @option
  5046. @item size, s
  5047. Set output video size.
  5048. @item x
  5049. Set x offset from where to pick pixels.
  5050. @item y
  5051. Set y offset from where to pick pixels.
  5052. @item mode
  5053. Set scope mode, can be one of the following:
  5054. @table @samp
  5055. @item mono
  5056. Draw hexadecimal pixel values with white color on black background.
  5057. @item color
  5058. Draw hexadecimal pixel values with input video pixel color on black
  5059. background.
  5060. @item color2
  5061. Draw hexadecimal pixel values on color background picked from input video,
  5062. the text color is picked in such way so its always visible.
  5063. @end table
  5064. @item axis
  5065. Draw rows and columns numbers on left and top of video.
  5066. @item opacity
  5067. Set background opacity.
  5068. @end table
  5069. @section dctdnoiz
  5070. Denoise frames using 2D DCT (frequency domain filtering).
  5071. This filter is not designed for real time.
  5072. The filter accepts the following options:
  5073. @table @option
  5074. @item sigma, s
  5075. Set the noise sigma constant.
  5076. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5077. coefficient (absolute value) below this threshold with be dropped.
  5078. If you need a more advanced filtering, see @option{expr}.
  5079. Default is @code{0}.
  5080. @item overlap
  5081. Set number overlapping pixels for each block. Since the filter can be slow, you
  5082. may want to reduce this value, at the cost of a less effective filter and the
  5083. risk of various artefacts.
  5084. If the overlapping value doesn't permit processing the whole input width or
  5085. height, a warning will be displayed and according borders won't be denoised.
  5086. Default value is @var{blocksize}-1, which is the best possible setting.
  5087. @item expr, e
  5088. Set the coefficient factor expression.
  5089. For each coefficient of a DCT block, this expression will be evaluated as a
  5090. multiplier value for the coefficient.
  5091. If this is option is set, the @option{sigma} option will be ignored.
  5092. The absolute value of the coefficient can be accessed through the @var{c}
  5093. variable.
  5094. @item n
  5095. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5096. @var{blocksize}, which is the width and height of the processed blocks.
  5097. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5098. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5099. on the speed processing. Also, a larger block size does not necessarily means a
  5100. better de-noising.
  5101. @end table
  5102. @subsection Examples
  5103. Apply a denoise with a @option{sigma} of @code{4.5}:
  5104. @example
  5105. dctdnoiz=4.5
  5106. @end example
  5107. The same operation can be achieved using the expression system:
  5108. @example
  5109. dctdnoiz=e='gte(c, 4.5*3)'
  5110. @end example
  5111. Violent denoise using a block size of @code{16x16}:
  5112. @example
  5113. dctdnoiz=15:n=4
  5114. @end example
  5115. @section deband
  5116. Remove banding artifacts from input video.
  5117. It works by replacing banded pixels with average value of referenced pixels.
  5118. The filter accepts the following options:
  5119. @table @option
  5120. @item 1thr
  5121. @item 2thr
  5122. @item 3thr
  5123. @item 4thr
  5124. Set banding detection threshold for each plane. Default is 0.02.
  5125. Valid range is 0.00003 to 0.5.
  5126. If difference between current pixel and reference pixel is less than threshold,
  5127. it will be considered as banded.
  5128. @item range, r
  5129. Banding detection range in pixels. Default is 16. If positive, random number
  5130. in range 0 to set value will be used. If negative, exact absolute value
  5131. will be used.
  5132. The range defines square of four pixels around current pixel.
  5133. @item direction, d
  5134. Set direction in radians from which four pixel will be compared. If positive,
  5135. random direction from 0 to set direction will be picked. If negative, exact of
  5136. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5137. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5138. column.
  5139. @item blur, b
  5140. If enabled, current pixel is compared with average value of all four
  5141. surrounding pixels. The default is enabled. If disabled current pixel is
  5142. compared with all four surrounding pixels. The pixel is considered banded
  5143. if only all four differences with surrounding pixels are less than threshold.
  5144. @item coupling, c
  5145. If enabled, current pixel is changed if and only if all pixel components are banded,
  5146. e.g. banding detection threshold is triggered for all color components.
  5147. The default is disabled.
  5148. @end table
  5149. @anchor{decimate}
  5150. @section decimate
  5151. Drop duplicated frames at regular intervals.
  5152. The filter accepts the following options:
  5153. @table @option
  5154. @item cycle
  5155. Set the number of frames from which one will be dropped. Setting this to
  5156. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5157. Default is @code{5}.
  5158. @item dupthresh
  5159. Set the threshold for duplicate detection. If the difference metric for a frame
  5160. is less than or equal to this value, then it is declared as duplicate. Default
  5161. is @code{1.1}
  5162. @item scthresh
  5163. Set scene change threshold. Default is @code{15}.
  5164. @item blockx
  5165. @item blocky
  5166. Set the size of the x and y-axis blocks used during metric calculations.
  5167. Larger blocks give better noise suppression, but also give worse detection of
  5168. small movements. Must be a power of two. Default is @code{32}.
  5169. @item ppsrc
  5170. Mark main input as a pre-processed input and activate clean source input
  5171. stream. This allows the input to be pre-processed with various filters to help
  5172. the metrics calculation while keeping the frame selection lossless. When set to
  5173. @code{1}, the first stream is for the pre-processed input, and the second
  5174. stream is the clean source from where the kept frames are chosen. Default is
  5175. @code{0}.
  5176. @item chroma
  5177. Set whether or not chroma is considered in the metric calculations. Default is
  5178. @code{1}.
  5179. @end table
  5180. @section deflate
  5181. Apply deflate effect to the video.
  5182. This filter replaces the pixel by the local(3x3) average by taking into account
  5183. only values lower than the pixel.
  5184. It accepts the following options:
  5185. @table @option
  5186. @item threshold0
  5187. @item threshold1
  5188. @item threshold2
  5189. @item threshold3
  5190. Limit the maximum change for each plane, default is 65535.
  5191. If 0, plane will remain unchanged.
  5192. @end table
  5193. @section deflicker
  5194. Remove temporal frame luminance variations.
  5195. It accepts the following options:
  5196. @table @option
  5197. @item size, s
  5198. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5199. @item mode, m
  5200. Set averaging mode to smooth temporal luminance variations.
  5201. Available values are:
  5202. @table @samp
  5203. @item am
  5204. Arithmetic mean
  5205. @item gm
  5206. Geometric mean
  5207. @item hm
  5208. Harmonic mean
  5209. @item qm
  5210. Quadratic mean
  5211. @item cm
  5212. Cubic mean
  5213. @item pm
  5214. Power mean
  5215. @item median
  5216. Median
  5217. @end table
  5218. @item bypass
  5219. Do not actually modify frame. Useful when one only wants metadata.
  5220. @end table
  5221. @section dejudder
  5222. Remove judder produced by partially interlaced telecined content.
  5223. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5224. source was partially telecined content then the output of @code{pullup,dejudder}
  5225. will have a variable frame rate. May change the recorded frame rate of the
  5226. container. Aside from that change, this filter will not affect constant frame
  5227. rate video.
  5228. The option available in this filter is:
  5229. @table @option
  5230. @item cycle
  5231. Specify the length of the window over which the judder repeats.
  5232. Accepts any integer greater than 1. Useful values are:
  5233. @table @samp
  5234. @item 4
  5235. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5236. @item 5
  5237. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5238. @item 20
  5239. If a mixture of the two.
  5240. @end table
  5241. The default is @samp{4}.
  5242. @end table
  5243. @section delogo
  5244. Suppress a TV station logo by a simple interpolation of the surrounding
  5245. pixels. Just set a rectangle covering the logo and watch it disappear
  5246. (and sometimes something even uglier appear - your mileage may vary).
  5247. It accepts the following parameters:
  5248. @table @option
  5249. @item x
  5250. @item y
  5251. Specify the top left corner coordinates of the logo. They must be
  5252. specified.
  5253. @item w
  5254. @item h
  5255. Specify the width and height of the logo to clear. They must be
  5256. specified.
  5257. @item band, t
  5258. Specify the thickness of the fuzzy edge of the rectangle (added to
  5259. @var{w} and @var{h}). The default value is 1. This option is
  5260. deprecated, setting higher values should no longer be necessary and
  5261. is not recommended.
  5262. @item show
  5263. When set to 1, a green rectangle is drawn on the screen to simplify
  5264. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5265. The default value is 0.
  5266. The rectangle is drawn on the outermost pixels which will be (partly)
  5267. replaced with interpolated values. The values of the next pixels
  5268. immediately outside this rectangle in each direction will be used to
  5269. compute the interpolated pixel values inside the rectangle.
  5270. @end table
  5271. @subsection Examples
  5272. @itemize
  5273. @item
  5274. Set a rectangle covering the area with top left corner coordinates 0,0
  5275. and size 100x77, and a band of size 10:
  5276. @example
  5277. delogo=x=0:y=0:w=100:h=77:band=10
  5278. @end example
  5279. @end itemize
  5280. @section deshake
  5281. Attempt to fix small changes in horizontal and/or vertical shift. This
  5282. filter helps remove camera shake from hand-holding a camera, bumping a
  5283. tripod, moving on a vehicle, etc.
  5284. The filter accepts the following options:
  5285. @table @option
  5286. @item x
  5287. @item y
  5288. @item w
  5289. @item h
  5290. Specify a rectangular area where to limit the search for motion
  5291. vectors.
  5292. If desired the search for motion vectors can be limited to a
  5293. rectangular area of the frame defined by its top left corner, width
  5294. and height. These parameters have the same meaning as the drawbox
  5295. filter which can be used to visualise the position of the bounding
  5296. box.
  5297. This is useful when simultaneous movement of subjects within the frame
  5298. might be confused for camera motion by the motion vector search.
  5299. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5300. then the full frame is used. This allows later options to be set
  5301. without specifying the bounding box for the motion vector search.
  5302. Default - search the whole frame.
  5303. @item rx
  5304. @item ry
  5305. Specify the maximum extent of movement in x and y directions in the
  5306. range 0-64 pixels. Default 16.
  5307. @item edge
  5308. Specify how to generate pixels to fill blanks at the edge of the
  5309. frame. Available values are:
  5310. @table @samp
  5311. @item blank, 0
  5312. Fill zeroes at blank locations
  5313. @item original, 1
  5314. Original image at blank locations
  5315. @item clamp, 2
  5316. Extruded edge value at blank locations
  5317. @item mirror, 3
  5318. Mirrored edge at blank locations
  5319. @end table
  5320. Default value is @samp{mirror}.
  5321. @item blocksize
  5322. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5323. default 8.
  5324. @item contrast
  5325. Specify the contrast threshold for blocks. Only blocks with more than
  5326. the specified contrast (difference between darkest and lightest
  5327. pixels) will be considered. Range 1-255, default 125.
  5328. @item search
  5329. Specify the search strategy. Available values are:
  5330. @table @samp
  5331. @item exhaustive, 0
  5332. Set exhaustive search
  5333. @item less, 1
  5334. Set less exhaustive search.
  5335. @end table
  5336. Default value is @samp{exhaustive}.
  5337. @item filename
  5338. If set then a detailed log of the motion search is written to the
  5339. specified file.
  5340. @item opencl
  5341. If set to 1, specify using OpenCL capabilities, only available if
  5342. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5343. @end table
  5344. @section despill
  5345. Remove unwanted contamination of foreground colors, caused by reflected color of
  5346. greenscreen or bluescreen.
  5347. This filter accepts the following options:
  5348. @table @option
  5349. @item type
  5350. Set what type of despill to use.
  5351. @item mix
  5352. Set how spillmap will be generated.
  5353. @item expand
  5354. Set how much to get rid of still remaining spill.
  5355. @item red
  5356. Controls amount of red in spill area.
  5357. @item green
  5358. Controls amount of green in spill area.
  5359. Should be -1 for greenscreen.
  5360. @item blue
  5361. Controls amount of blue in spill area.
  5362. Should be -1 for bluescreen.
  5363. @item brightness
  5364. Controls brightness of spill area, preserving colors.
  5365. @item alpha
  5366. Modify alpha from generated spillmap.
  5367. @end table
  5368. @section detelecine
  5369. Apply an exact inverse of the telecine operation. It requires a predefined
  5370. pattern specified using the pattern option which must be the same as that passed
  5371. to the telecine filter.
  5372. This filter accepts the following options:
  5373. @table @option
  5374. @item first_field
  5375. @table @samp
  5376. @item top, t
  5377. top field first
  5378. @item bottom, b
  5379. bottom field first
  5380. The default value is @code{top}.
  5381. @end table
  5382. @item pattern
  5383. A string of numbers representing the pulldown pattern you wish to apply.
  5384. The default value is @code{23}.
  5385. @item start_frame
  5386. A number representing position of the first frame with respect to the telecine
  5387. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5388. @end table
  5389. @section dilation
  5390. Apply dilation effect to the video.
  5391. This filter replaces the pixel by the local(3x3) maximum.
  5392. It accepts the following options:
  5393. @table @option
  5394. @item threshold0
  5395. @item threshold1
  5396. @item threshold2
  5397. @item threshold3
  5398. Limit the maximum change for each plane, default is 65535.
  5399. If 0, plane will remain unchanged.
  5400. @item coordinates
  5401. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5402. pixels are used.
  5403. Flags to local 3x3 coordinates maps like this:
  5404. 1 2 3
  5405. 4 5
  5406. 6 7 8
  5407. @end table
  5408. @section displace
  5409. Displace pixels as indicated by second and third input stream.
  5410. It takes three input streams and outputs one stream, the first input is the
  5411. source, and second and third input are displacement maps.
  5412. The second input specifies how much to displace pixels along the
  5413. x-axis, while the third input specifies how much to displace pixels
  5414. along the y-axis.
  5415. If one of displacement map streams terminates, last frame from that
  5416. displacement map will be used.
  5417. Note that once generated, displacements maps can be reused over and over again.
  5418. A description of the accepted options follows.
  5419. @table @option
  5420. @item edge
  5421. Set displace behavior for pixels that are out of range.
  5422. Available values are:
  5423. @table @samp
  5424. @item blank
  5425. Missing pixels are replaced by black pixels.
  5426. @item smear
  5427. Adjacent pixels will spread out to replace missing pixels.
  5428. @item wrap
  5429. Out of range pixels are wrapped so they point to pixels of other side.
  5430. @item mirror
  5431. Out of range pixels will be replaced with mirrored pixels.
  5432. @end table
  5433. Default is @samp{smear}.
  5434. @end table
  5435. @subsection Examples
  5436. @itemize
  5437. @item
  5438. Add ripple effect to rgb input of video size hd720:
  5439. @example
  5440. 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
  5441. @end example
  5442. @item
  5443. Add wave effect to rgb input of video size hd720:
  5444. @example
  5445. 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
  5446. @end example
  5447. @end itemize
  5448. @section drawbox
  5449. Draw a colored box on the input image.
  5450. It accepts the following parameters:
  5451. @table @option
  5452. @item x
  5453. @item y
  5454. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5455. @item width, w
  5456. @item height, h
  5457. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5458. the input width and height. It defaults to 0.
  5459. @item color, c
  5460. Specify the color of the box to write. For the general syntax of this option,
  5461. check the "Color" section in the ffmpeg-utils manual. If the special
  5462. value @code{invert} is used, the box edge color is the same as the
  5463. video with inverted luma.
  5464. @item thickness, t
  5465. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5466. See below for the list of accepted constants.
  5467. @end table
  5468. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5469. following constants:
  5470. @table @option
  5471. @item dar
  5472. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5473. @item hsub
  5474. @item vsub
  5475. horizontal and vertical chroma subsample values. For example for the
  5476. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5477. @item in_h, ih
  5478. @item in_w, iw
  5479. The input width and height.
  5480. @item sar
  5481. The input sample aspect ratio.
  5482. @item x
  5483. @item y
  5484. The x and y offset coordinates where the box is drawn.
  5485. @item w
  5486. @item h
  5487. The width and height of the drawn box.
  5488. @item t
  5489. The thickness of the drawn box.
  5490. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5491. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5492. @end table
  5493. @subsection Examples
  5494. @itemize
  5495. @item
  5496. Draw a black box around the edge of the input image:
  5497. @example
  5498. drawbox
  5499. @end example
  5500. @item
  5501. Draw a box with color red and an opacity of 50%:
  5502. @example
  5503. drawbox=10:20:200:60:red@@0.5
  5504. @end example
  5505. The previous example can be specified as:
  5506. @example
  5507. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5508. @end example
  5509. @item
  5510. Fill the box with pink color:
  5511. @example
  5512. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5513. @end example
  5514. @item
  5515. Draw a 2-pixel red 2.40:1 mask:
  5516. @example
  5517. 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
  5518. @end example
  5519. @end itemize
  5520. @section drawgrid
  5521. Draw a grid on the input image.
  5522. It accepts the following parameters:
  5523. @table @option
  5524. @item x
  5525. @item y
  5526. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5527. @item width, w
  5528. @item height, h
  5529. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5530. input width and height, respectively, minus @code{thickness}, so image gets
  5531. framed. Default to 0.
  5532. @item color, c
  5533. Specify the color of the grid. For the general syntax of this option,
  5534. check the "Color" section in the ffmpeg-utils manual. If the special
  5535. value @code{invert} is used, the grid color is the same as the
  5536. video with inverted luma.
  5537. @item thickness, t
  5538. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5539. See below for the list of accepted constants.
  5540. @end table
  5541. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5542. following constants:
  5543. @table @option
  5544. @item dar
  5545. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5546. @item hsub
  5547. @item vsub
  5548. horizontal and vertical chroma subsample values. For example for the
  5549. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5550. @item in_h, ih
  5551. @item in_w, iw
  5552. The input grid cell width and height.
  5553. @item sar
  5554. The input sample aspect ratio.
  5555. @item x
  5556. @item y
  5557. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5558. @item w
  5559. @item h
  5560. The width and height of the drawn cell.
  5561. @item t
  5562. The thickness of the drawn cell.
  5563. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5564. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5565. @end table
  5566. @subsection Examples
  5567. @itemize
  5568. @item
  5569. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5570. @example
  5571. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5572. @end example
  5573. @item
  5574. Draw a white 3x3 grid with an opacity of 50%:
  5575. @example
  5576. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5577. @end example
  5578. @end itemize
  5579. @anchor{drawtext}
  5580. @section drawtext
  5581. Draw a text string or text from a specified file on top of a video, using the
  5582. libfreetype library.
  5583. To enable compilation of this filter, you need to configure FFmpeg with
  5584. @code{--enable-libfreetype}.
  5585. To enable default font fallback and the @var{font} option you need to
  5586. configure FFmpeg with @code{--enable-libfontconfig}.
  5587. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5588. @code{--enable-libfribidi}.
  5589. @subsection Syntax
  5590. It accepts the following parameters:
  5591. @table @option
  5592. @item box
  5593. Used to draw a box around text using the background color.
  5594. The value must be either 1 (enable) or 0 (disable).
  5595. The default value of @var{box} is 0.
  5596. @item boxborderw
  5597. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5598. The default value of @var{boxborderw} is 0.
  5599. @item boxcolor
  5600. The color to be used for drawing box around text. For the syntax of this
  5601. option, check the "Color" section in the ffmpeg-utils manual.
  5602. The default value of @var{boxcolor} is "white".
  5603. @item line_spacing
  5604. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5605. The default value of @var{line_spacing} is 0.
  5606. @item borderw
  5607. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5608. The default value of @var{borderw} is 0.
  5609. @item bordercolor
  5610. Set the color to be used for drawing border around text. For the syntax of this
  5611. option, check the "Color" section in the ffmpeg-utils manual.
  5612. The default value of @var{bordercolor} is "black".
  5613. @item expansion
  5614. Select how the @var{text} is expanded. Can be either @code{none},
  5615. @code{strftime} (deprecated) or
  5616. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5617. below for details.
  5618. @item basetime
  5619. Set a start time for the count. Value is in microseconds. Only applied
  5620. in the deprecated strftime expansion mode. To emulate in normal expansion
  5621. mode use the @code{pts} function, supplying the start time (in seconds)
  5622. as the second argument.
  5623. @item fix_bounds
  5624. If true, check and fix text coords to avoid clipping.
  5625. @item fontcolor
  5626. The color to be used for drawing fonts. For the syntax of this option, check
  5627. the "Color" section in the ffmpeg-utils manual.
  5628. The default value of @var{fontcolor} is "black".
  5629. @item fontcolor_expr
  5630. String which is expanded the same way as @var{text} to obtain dynamic
  5631. @var{fontcolor} value. By default this option has empty value and is not
  5632. processed. When this option is set, it overrides @var{fontcolor} option.
  5633. @item font
  5634. The font family to be used for drawing text. By default Sans.
  5635. @item fontfile
  5636. The font file to be used for drawing text. The path must be included.
  5637. This parameter is mandatory if the fontconfig support is disabled.
  5638. @item alpha
  5639. Draw the text applying alpha blending. The value can
  5640. be a number between 0.0 and 1.0.
  5641. The expression accepts the same variables @var{x, y} as well.
  5642. The default value is 1.
  5643. Please see @var{fontcolor_expr}.
  5644. @item fontsize
  5645. The font size to be used for drawing text.
  5646. The default value of @var{fontsize} is 16.
  5647. @item text_shaping
  5648. If set to 1, attempt to shape the text (for example, reverse the order of
  5649. right-to-left text and join Arabic characters) before drawing it.
  5650. Otherwise, just draw the text exactly as given.
  5651. By default 1 (if supported).
  5652. @item ft_load_flags
  5653. The flags to be used for loading the fonts.
  5654. The flags map the corresponding flags supported by libfreetype, and are
  5655. a combination of the following values:
  5656. @table @var
  5657. @item default
  5658. @item no_scale
  5659. @item no_hinting
  5660. @item render
  5661. @item no_bitmap
  5662. @item vertical_layout
  5663. @item force_autohint
  5664. @item crop_bitmap
  5665. @item pedantic
  5666. @item ignore_global_advance_width
  5667. @item no_recurse
  5668. @item ignore_transform
  5669. @item monochrome
  5670. @item linear_design
  5671. @item no_autohint
  5672. @end table
  5673. Default value is "default".
  5674. For more information consult the documentation for the FT_LOAD_*
  5675. libfreetype flags.
  5676. @item shadowcolor
  5677. The color to be used for drawing a shadow behind the drawn text. For the
  5678. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5679. The default value of @var{shadowcolor} is "black".
  5680. @item shadowx
  5681. @item shadowy
  5682. The x and y offsets for the text shadow position with respect to the
  5683. position of the text. They can be either positive or negative
  5684. values. The default value for both is "0".
  5685. @item start_number
  5686. The starting frame number for the n/frame_num variable. The default value
  5687. is "0".
  5688. @item tabsize
  5689. The size in number of spaces to use for rendering the tab.
  5690. Default value is 4.
  5691. @item timecode
  5692. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5693. format. It can be used with or without text parameter. @var{timecode_rate}
  5694. option must be specified.
  5695. @item timecode_rate, rate, r
  5696. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  5697. integer. Minimum value is "1".
  5698. Drop-frame timecode is supported for frame rates 30 & 60.
  5699. @item tc24hmax
  5700. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5701. Default is 0 (disabled).
  5702. @item text
  5703. The text string to be drawn. The text must be a sequence of UTF-8
  5704. encoded characters.
  5705. This parameter is mandatory if no file is specified with the parameter
  5706. @var{textfile}.
  5707. @item textfile
  5708. A text file containing text to be drawn. The text must be a sequence
  5709. of UTF-8 encoded characters.
  5710. This parameter is mandatory if no text string is specified with the
  5711. parameter @var{text}.
  5712. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5713. @item reload
  5714. If set to 1, the @var{textfile} will be reloaded before each frame.
  5715. Be sure to update it atomically, or it may be read partially, or even fail.
  5716. @item x
  5717. @item y
  5718. The expressions which specify the offsets where text will be drawn
  5719. within the video frame. They are relative to the top/left border of the
  5720. output image.
  5721. The default value of @var{x} and @var{y} is "0".
  5722. See below for the list of accepted constants and functions.
  5723. @end table
  5724. The parameters for @var{x} and @var{y} are expressions containing the
  5725. following constants and functions:
  5726. @table @option
  5727. @item dar
  5728. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5729. @item hsub
  5730. @item vsub
  5731. horizontal and vertical chroma subsample values. For example for the
  5732. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5733. @item line_h, lh
  5734. the height of each text line
  5735. @item main_h, h, H
  5736. the input height
  5737. @item main_w, w, W
  5738. the input width
  5739. @item max_glyph_a, ascent
  5740. the maximum distance from the baseline to the highest/upper grid
  5741. coordinate used to place a glyph outline point, for all the rendered
  5742. glyphs.
  5743. It is a positive value, due to the grid's orientation with the Y axis
  5744. upwards.
  5745. @item max_glyph_d, descent
  5746. the maximum distance from the baseline to the lowest grid coordinate
  5747. used to place a glyph outline point, for all the rendered glyphs.
  5748. This is a negative value, due to the grid's orientation, with the Y axis
  5749. upwards.
  5750. @item max_glyph_h
  5751. maximum glyph height, that is the maximum height for all the glyphs
  5752. contained in the rendered text, it is equivalent to @var{ascent} -
  5753. @var{descent}.
  5754. @item max_glyph_w
  5755. maximum glyph width, that is the maximum width for all the glyphs
  5756. contained in the rendered text
  5757. @item n
  5758. the number of input frame, starting from 0
  5759. @item rand(min, max)
  5760. return a random number included between @var{min} and @var{max}
  5761. @item sar
  5762. The input sample aspect ratio.
  5763. @item t
  5764. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5765. @item text_h, th
  5766. the height of the rendered text
  5767. @item text_w, tw
  5768. the width of the rendered text
  5769. @item x
  5770. @item y
  5771. the x and y offset coordinates where the text is drawn.
  5772. These parameters allow the @var{x} and @var{y} expressions to refer
  5773. each other, so you can for example specify @code{y=x/dar}.
  5774. @end table
  5775. @anchor{drawtext_expansion}
  5776. @subsection Text expansion
  5777. If @option{expansion} is set to @code{strftime},
  5778. the filter recognizes strftime() sequences in the provided text and
  5779. expands them accordingly. Check the documentation of strftime(). This
  5780. feature is deprecated.
  5781. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5782. If @option{expansion} is set to @code{normal} (which is the default),
  5783. the following expansion mechanism is used.
  5784. The backslash character @samp{\}, followed by any character, always expands to
  5785. the second character.
  5786. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5787. braces is a function name, possibly followed by arguments separated by ':'.
  5788. If the arguments contain special characters or delimiters (':' or '@}'),
  5789. they should be escaped.
  5790. Note that they probably must also be escaped as the value for the
  5791. @option{text} option in the filter argument string and as the filter
  5792. argument in the filtergraph description, and possibly also for the shell,
  5793. that makes up to four levels of escaping; using a text file avoids these
  5794. problems.
  5795. The following functions are available:
  5796. @table @command
  5797. @item expr, e
  5798. The expression evaluation result.
  5799. It must take one argument specifying the expression to be evaluated,
  5800. which accepts the same constants and functions as the @var{x} and
  5801. @var{y} values. Note that not all constants should be used, for
  5802. example the text size is not known when evaluating the expression, so
  5803. the constants @var{text_w} and @var{text_h} will have an undefined
  5804. value.
  5805. @item expr_int_format, eif
  5806. Evaluate the expression's value and output as formatted integer.
  5807. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5808. The second argument specifies the output format. Allowed values are @samp{x},
  5809. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5810. @code{printf} function.
  5811. The third parameter is optional and sets the number of positions taken by the output.
  5812. It can be used to add padding with zeros from the left.
  5813. @item gmtime
  5814. The time at which the filter is running, expressed in UTC.
  5815. It can accept an argument: a strftime() format string.
  5816. @item localtime
  5817. The time at which the filter is running, expressed in the local time zone.
  5818. It can accept an argument: a strftime() format string.
  5819. @item metadata
  5820. Frame metadata. Takes one or two arguments.
  5821. The first argument is mandatory and specifies the metadata key.
  5822. The second argument is optional and specifies a default value, used when the
  5823. metadata key is not found or empty.
  5824. @item n, frame_num
  5825. The frame number, starting from 0.
  5826. @item pict_type
  5827. A 1 character description of the current picture type.
  5828. @item pts
  5829. The timestamp of the current frame.
  5830. It can take up to three arguments.
  5831. The first argument is the format of the timestamp; it defaults to @code{flt}
  5832. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5833. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5834. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5835. @code{localtime} stands for the timestamp of the frame formatted as
  5836. local time zone time.
  5837. The second argument is an offset added to the timestamp.
  5838. If the format is set to @code{localtime} or @code{gmtime},
  5839. a third argument may be supplied: a strftime() format string.
  5840. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5841. @end table
  5842. @subsection Examples
  5843. @itemize
  5844. @item
  5845. Draw "Test Text" with font FreeSerif, using the default values for the
  5846. optional parameters.
  5847. @example
  5848. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5849. @end example
  5850. @item
  5851. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5852. and y=50 (counting from the top-left corner of the screen), text is
  5853. yellow with a red box around it. Both the text and the box have an
  5854. opacity of 20%.
  5855. @example
  5856. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5857. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5858. @end example
  5859. Note that the double quotes are not necessary if spaces are not used
  5860. within the parameter list.
  5861. @item
  5862. Show the text at the center of the video frame:
  5863. @example
  5864. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5865. @end example
  5866. @item
  5867. Show the text at a random position, switching to a new position every 30 seconds:
  5868. @example
  5869. 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)"
  5870. @end example
  5871. @item
  5872. Show a text line sliding from right to left in the last row of the video
  5873. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5874. with no newlines.
  5875. @example
  5876. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5877. @end example
  5878. @item
  5879. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5880. @example
  5881. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5882. @end example
  5883. @item
  5884. Draw a single green letter "g", at the center of the input video.
  5885. The glyph baseline is placed at half screen height.
  5886. @example
  5887. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5888. @end example
  5889. @item
  5890. Show text for 1 second every 3 seconds:
  5891. @example
  5892. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5893. @end example
  5894. @item
  5895. Use fontconfig to set the font. Note that the colons need to be escaped.
  5896. @example
  5897. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5898. @end example
  5899. @item
  5900. Print the date of a real-time encoding (see strftime(3)):
  5901. @example
  5902. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5903. @end example
  5904. @item
  5905. Show text fading in and out (appearing/disappearing):
  5906. @example
  5907. #!/bin/sh
  5908. DS=1.0 # display start
  5909. DE=10.0 # display end
  5910. FID=1.5 # fade in duration
  5911. FOD=5 # fade out duration
  5912. 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 @}"
  5913. @end example
  5914. @item
  5915. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5916. and the @option{fontsize} value are included in the @option{y} offset.
  5917. @example
  5918. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5919. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5920. @end example
  5921. @end itemize
  5922. For more information about libfreetype, check:
  5923. @url{http://www.freetype.org/}.
  5924. For more information about fontconfig, check:
  5925. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5926. For more information about libfribidi, check:
  5927. @url{http://fribidi.org/}.
  5928. @section edgedetect
  5929. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5930. The filter accepts the following options:
  5931. @table @option
  5932. @item low
  5933. @item high
  5934. Set low and high threshold values used by the Canny thresholding
  5935. algorithm.
  5936. The high threshold selects the "strong" edge pixels, which are then
  5937. connected through 8-connectivity with the "weak" edge pixels selected
  5938. by the low threshold.
  5939. @var{low} and @var{high} threshold values must be chosen in the range
  5940. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5941. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5942. is @code{50/255}.
  5943. @item mode
  5944. Define the drawing mode.
  5945. @table @samp
  5946. @item wires
  5947. Draw white/gray wires on black background.
  5948. @item colormix
  5949. Mix the colors to create a paint/cartoon effect.
  5950. @end table
  5951. Default value is @var{wires}.
  5952. @end table
  5953. @subsection Examples
  5954. @itemize
  5955. @item
  5956. Standard edge detection with custom values for the hysteresis thresholding:
  5957. @example
  5958. edgedetect=low=0.1:high=0.4
  5959. @end example
  5960. @item
  5961. Painting effect without thresholding:
  5962. @example
  5963. edgedetect=mode=colormix:high=0
  5964. @end example
  5965. @end itemize
  5966. @section eq
  5967. Set brightness, contrast, saturation and approximate gamma adjustment.
  5968. The filter accepts the following options:
  5969. @table @option
  5970. @item contrast
  5971. Set the contrast expression. The value must be a float value in range
  5972. @code{-2.0} to @code{2.0}. The default value is "1".
  5973. @item brightness
  5974. Set the brightness expression. The value must be a float value in
  5975. range @code{-1.0} to @code{1.0}. The default value is "0".
  5976. @item saturation
  5977. Set the saturation expression. The value must be a float in
  5978. range @code{0.0} to @code{3.0}. The default value is "1".
  5979. @item gamma
  5980. Set the gamma expression. The value must be a float in range
  5981. @code{0.1} to @code{10.0}. The default value is "1".
  5982. @item gamma_r
  5983. Set the gamma expression for red. The value must be a float in
  5984. range @code{0.1} to @code{10.0}. The default value is "1".
  5985. @item gamma_g
  5986. Set the gamma expression for green. The value must be a float in range
  5987. @code{0.1} to @code{10.0}. The default value is "1".
  5988. @item gamma_b
  5989. Set the gamma expression for blue. The value must be a float in range
  5990. @code{0.1} to @code{10.0}. The default value is "1".
  5991. @item gamma_weight
  5992. Set the gamma weight expression. It can be used to reduce the effect
  5993. of a high gamma value on bright image areas, e.g. keep them from
  5994. getting overamplified and just plain white. The value must be a float
  5995. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5996. gamma correction all the way down while @code{1.0} leaves it at its
  5997. full strength. Default is "1".
  5998. @item eval
  5999. Set when the expressions for brightness, contrast, saturation and
  6000. gamma expressions are evaluated.
  6001. It accepts the following values:
  6002. @table @samp
  6003. @item init
  6004. only evaluate expressions once during the filter initialization or
  6005. when a command is processed
  6006. @item frame
  6007. evaluate expressions for each incoming frame
  6008. @end table
  6009. Default value is @samp{init}.
  6010. @end table
  6011. The expressions accept the following parameters:
  6012. @table @option
  6013. @item n
  6014. frame count of the input frame starting from 0
  6015. @item pos
  6016. byte position of the corresponding packet in the input file, NAN if
  6017. unspecified
  6018. @item r
  6019. frame rate of the input video, NAN if the input frame rate is unknown
  6020. @item t
  6021. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6022. @end table
  6023. @subsection Commands
  6024. The filter supports the following commands:
  6025. @table @option
  6026. @item contrast
  6027. Set the contrast expression.
  6028. @item brightness
  6029. Set the brightness expression.
  6030. @item saturation
  6031. Set the saturation expression.
  6032. @item gamma
  6033. Set the gamma expression.
  6034. @item gamma_r
  6035. Set the gamma_r expression.
  6036. @item gamma_g
  6037. Set gamma_g expression.
  6038. @item gamma_b
  6039. Set gamma_b expression.
  6040. @item gamma_weight
  6041. Set gamma_weight expression.
  6042. The command accepts the same syntax of the corresponding option.
  6043. If the specified expression is not valid, it is kept at its current
  6044. value.
  6045. @end table
  6046. @section erosion
  6047. Apply erosion effect to the video.
  6048. This filter replaces the pixel by the local(3x3) minimum.
  6049. It accepts the following options:
  6050. @table @option
  6051. @item threshold0
  6052. @item threshold1
  6053. @item threshold2
  6054. @item threshold3
  6055. Limit the maximum change for each plane, default is 65535.
  6056. If 0, plane will remain unchanged.
  6057. @item coordinates
  6058. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6059. pixels are used.
  6060. Flags to local 3x3 coordinates maps like this:
  6061. 1 2 3
  6062. 4 5
  6063. 6 7 8
  6064. @end table
  6065. @section extractplanes
  6066. Extract color channel components from input video stream into
  6067. separate grayscale video streams.
  6068. The filter accepts the following option:
  6069. @table @option
  6070. @item planes
  6071. Set plane(s) to extract.
  6072. Available values for planes are:
  6073. @table @samp
  6074. @item y
  6075. @item u
  6076. @item v
  6077. @item a
  6078. @item r
  6079. @item g
  6080. @item b
  6081. @end table
  6082. Choosing planes not available in the input will result in an error.
  6083. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6084. with @code{y}, @code{u}, @code{v} planes at same time.
  6085. @end table
  6086. @subsection Examples
  6087. @itemize
  6088. @item
  6089. Extract luma, u and v color channel component from input video frame
  6090. into 3 grayscale outputs:
  6091. @example
  6092. 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
  6093. @end example
  6094. @end itemize
  6095. @section elbg
  6096. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6097. For each input image, the filter will compute the optimal mapping from
  6098. the input to the output given the codebook length, that is the number
  6099. of distinct output colors.
  6100. This filter accepts the following options.
  6101. @table @option
  6102. @item codebook_length, l
  6103. Set codebook length. The value must be a positive integer, and
  6104. represents the number of distinct output colors. Default value is 256.
  6105. @item nb_steps, n
  6106. Set the maximum number of iterations to apply for computing the optimal
  6107. mapping. The higher the value the better the result and the higher the
  6108. computation time. Default value is 1.
  6109. @item seed, s
  6110. Set a random seed, must be an integer included between 0 and
  6111. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6112. will try to use a good random seed on a best effort basis.
  6113. @item pal8
  6114. Set pal8 output pixel format. This option does not work with codebook
  6115. length greater than 256.
  6116. @end table
  6117. @section fade
  6118. Apply a fade-in/out effect to the input video.
  6119. It accepts the following parameters:
  6120. @table @option
  6121. @item type, t
  6122. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6123. effect.
  6124. Default is @code{in}.
  6125. @item start_frame, s
  6126. Specify the number of the frame to start applying the fade
  6127. effect at. Default is 0.
  6128. @item nb_frames, n
  6129. The number of frames that the fade effect lasts. At the end of the
  6130. fade-in effect, the output video will have the same intensity as the input video.
  6131. At the end of the fade-out transition, the output video will be filled with the
  6132. selected @option{color}.
  6133. Default is 25.
  6134. @item alpha
  6135. If set to 1, fade only alpha channel, if one exists on the input.
  6136. Default value is 0.
  6137. @item start_time, st
  6138. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6139. effect. If both start_frame and start_time are specified, the fade will start at
  6140. whichever comes last. Default is 0.
  6141. @item duration, d
  6142. The number of seconds for which the fade effect has to last. At the end of the
  6143. fade-in effect the output video will have the same intensity as the input video,
  6144. at the end of the fade-out transition the output video will be filled with the
  6145. selected @option{color}.
  6146. If both duration and nb_frames are specified, duration is used. Default is 0
  6147. (nb_frames is used by default).
  6148. @item color, c
  6149. Specify the color of the fade. Default is "black".
  6150. @end table
  6151. @subsection Examples
  6152. @itemize
  6153. @item
  6154. Fade in the first 30 frames of video:
  6155. @example
  6156. fade=in:0:30
  6157. @end example
  6158. The command above is equivalent to:
  6159. @example
  6160. fade=t=in:s=0:n=30
  6161. @end example
  6162. @item
  6163. Fade out the last 45 frames of a 200-frame video:
  6164. @example
  6165. fade=out:155:45
  6166. fade=type=out:start_frame=155:nb_frames=45
  6167. @end example
  6168. @item
  6169. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6170. @example
  6171. fade=in:0:25, fade=out:975:25
  6172. @end example
  6173. @item
  6174. Make the first 5 frames yellow, then fade in from frame 5-24:
  6175. @example
  6176. fade=in:5:20:color=yellow
  6177. @end example
  6178. @item
  6179. Fade in alpha over first 25 frames of video:
  6180. @example
  6181. fade=in:0:25:alpha=1
  6182. @end example
  6183. @item
  6184. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6185. @example
  6186. fade=t=in:st=5.5:d=0.5
  6187. @end example
  6188. @end itemize
  6189. @section fftfilt
  6190. Apply arbitrary expressions to samples in frequency domain
  6191. @table @option
  6192. @item dc_Y
  6193. Adjust the dc value (gain) of the luma plane of the image. The filter
  6194. accepts an integer value in range @code{0} to @code{1000}. The default
  6195. value is set to @code{0}.
  6196. @item dc_U
  6197. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6198. filter accepts an integer value in range @code{0} to @code{1000}. The
  6199. default value is set to @code{0}.
  6200. @item dc_V
  6201. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6202. filter accepts an integer value in range @code{0} to @code{1000}. The
  6203. default value is set to @code{0}.
  6204. @item weight_Y
  6205. Set the frequency domain weight expression for the luma plane.
  6206. @item weight_U
  6207. Set the frequency domain weight expression for the 1st chroma plane.
  6208. @item weight_V
  6209. Set the frequency domain weight expression for the 2nd chroma plane.
  6210. @item eval
  6211. Set when the expressions are evaluated.
  6212. It accepts the following values:
  6213. @table @samp
  6214. @item init
  6215. Only evaluate expressions once during the filter initialization.
  6216. @item frame
  6217. Evaluate expressions for each incoming frame.
  6218. @end table
  6219. Default value is @samp{init}.
  6220. The filter accepts the following variables:
  6221. @item X
  6222. @item Y
  6223. The coordinates of the current sample.
  6224. @item W
  6225. @item H
  6226. The width and height of the image.
  6227. @item N
  6228. The number of input frame, starting from 0.
  6229. @end table
  6230. @subsection Examples
  6231. @itemize
  6232. @item
  6233. High-pass:
  6234. @example
  6235. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6236. @end example
  6237. @item
  6238. Low-pass:
  6239. @example
  6240. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6241. @end example
  6242. @item
  6243. Sharpen:
  6244. @example
  6245. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6246. @end example
  6247. @item
  6248. Blur:
  6249. @example
  6250. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6251. @end example
  6252. @end itemize
  6253. @section field
  6254. Extract a single field from an interlaced image using stride
  6255. arithmetic to avoid wasting CPU time. The output frames are marked as
  6256. non-interlaced.
  6257. The filter accepts the following options:
  6258. @table @option
  6259. @item type
  6260. Specify whether to extract the top (if the value is @code{0} or
  6261. @code{top}) or the bottom field (if the value is @code{1} or
  6262. @code{bottom}).
  6263. @end table
  6264. @section fieldhint
  6265. Create new frames by copying the top and bottom fields from surrounding frames
  6266. supplied as numbers by the hint file.
  6267. @table @option
  6268. @item hint
  6269. Set file containing hints: absolute/relative frame numbers.
  6270. There must be one line for each frame in a clip. Each line must contain two
  6271. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6272. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6273. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6274. for @code{relative} mode. First number tells from which frame to pick up top
  6275. field and second number tells from which frame to pick up bottom field.
  6276. If optionally followed by @code{+} output frame will be marked as interlaced,
  6277. else if followed by @code{-} output frame will be marked as progressive, else
  6278. it will be marked same as input frame.
  6279. If line starts with @code{#} or @code{;} that line is skipped.
  6280. @item mode
  6281. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6282. @end table
  6283. Example of first several lines of @code{hint} file for @code{relative} mode:
  6284. @example
  6285. 0,0 - # first frame
  6286. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6287. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6288. 1,0 -
  6289. 0,0 -
  6290. 0,0 -
  6291. 1,0 -
  6292. 1,0 -
  6293. 1,0 -
  6294. 0,0 -
  6295. 0,0 -
  6296. 1,0 -
  6297. 1,0 -
  6298. 1,0 -
  6299. 0,0 -
  6300. @end example
  6301. @section fieldmatch
  6302. Field matching filter for inverse telecine. It is meant to reconstruct the
  6303. progressive frames from a telecined stream. The filter does not drop duplicated
  6304. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6305. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6306. The separation of the field matching and the decimation is notably motivated by
  6307. the possibility of inserting a de-interlacing filter fallback between the two.
  6308. If the source has mixed telecined and real interlaced content,
  6309. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6310. But these remaining combed frames will be marked as interlaced, and thus can be
  6311. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6312. In addition to the various configuration options, @code{fieldmatch} can take an
  6313. optional second stream, activated through the @option{ppsrc} option. If
  6314. enabled, the frames reconstruction will be based on the fields and frames from
  6315. this second stream. This allows the first input to be pre-processed in order to
  6316. help the various algorithms of the filter, while keeping the output lossless
  6317. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6318. or brightness/contrast adjustments can help.
  6319. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6320. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6321. which @code{fieldmatch} is based on. While the semantic and usage are very
  6322. close, some behaviour and options names can differ.
  6323. The @ref{decimate} filter currently only works for constant frame rate input.
  6324. If your input has mixed telecined (30fps) and progressive content with a lower
  6325. framerate like 24fps use the following filterchain to produce the necessary cfr
  6326. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6327. The filter accepts the following options:
  6328. @table @option
  6329. @item order
  6330. Specify the assumed field order of the input stream. Available values are:
  6331. @table @samp
  6332. @item auto
  6333. Auto detect parity (use FFmpeg's internal parity value).
  6334. @item bff
  6335. Assume bottom field first.
  6336. @item tff
  6337. Assume top field first.
  6338. @end table
  6339. Note that it is sometimes recommended not to trust the parity announced by the
  6340. stream.
  6341. Default value is @var{auto}.
  6342. @item mode
  6343. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6344. sense that it won't risk creating jerkiness due to duplicate frames when
  6345. possible, but if there are bad edits or blended fields it will end up
  6346. outputting combed frames when a good match might actually exist. On the other
  6347. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6348. but will almost always find a good frame if there is one. The other values are
  6349. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6350. jerkiness and creating duplicate frames versus finding good matches in sections
  6351. with bad edits, orphaned fields, blended fields, etc.
  6352. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6353. Available values are:
  6354. @table @samp
  6355. @item pc
  6356. 2-way matching (p/c)
  6357. @item pc_n
  6358. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6359. @item pc_u
  6360. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6361. @item pc_n_ub
  6362. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6363. still combed (p/c + n + u/b)
  6364. @item pcn
  6365. 3-way matching (p/c/n)
  6366. @item pcn_ub
  6367. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6368. detected as combed (p/c/n + u/b)
  6369. @end table
  6370. The parenthesis at the end indicate the matches that would be used for that
  6371. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6372. @var{top}).
  6373. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6374. the slowest.
  6375. Default value is @var{pc_n}.
  6376. @item ppsrc
  6377. Mark the main input stream as a pre-processed input, and enable the secondary
  6378. input stream as the clean source to pick the fields from. See the filter
  6379. introduction for more details. It is similar to the @option{clip2} feature from
  6380. VFM/TFM.
  6381. Default value is @code{0} (disabled).
  6382. @item field
  6383. Set the field to match from. It is recommended to set this to the same value as
  6384. @option{order} unless you experience matching failures with that setting. In
  6385. certain circumstances changing the field that is used to match from can have a
  6386. large impact on matching performance. Available values are:
  6387. @table @samp
  6388. @item auto
  6389. Automatic (same value as @option{order}).
  6390. @item bottom
  6391. Match from the bottom field.
  6392. @item top
  6393. Match from the top field.
  6394. @end table
  6395. Default value is @var{auto}.
  6396. @item mchroma
  6397. Set whether or not chroma is included during the match comparisons. In most
  6398. cases it is recommended to leave this enabled. You should set this to @code{0}
  6399. only if your clip has bad chroma problems such as heavy rainbowing or other
  6400. artifacts. Setting this to @code{0} could also be used to speed things up at
  6401. the cost of some accuracy.
  6402. Default value is @code{1}.
  6403. @item y0
  6404. @item y1
  6405. These define an exclusion band which excludes the lines between @option{y0} and
  6406. @option{y1} from being included in the field matching decision. An exclusion
  6407. band can be used to ignore subtitles, a logo, or other things that may
  6408. interfere with the matching. @option{y0} sets the starting scan line and
  6409. @option{y1} sets the ending line; all lines in between @option{y0} and
  6410. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6411. @option{y0} and @option{y1} to the same value will disable the feature.
  6412. @option{y0} and @option{y1} defaults to @code{0}.
  6413. @item scthresh
  6414. Set the scene change detection threshold as a percentage of maximum change on
  6415. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6416. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6417. @option{scthresh} is @code{[0.0, 100.0]}.
  6418. Default value is @code{12.0}.
  6419. @item combmatch
  6420. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6421. account the combed scores of matches when deciding what match to use as the
  6422. final match. Available values are:
  6423. @table @samp
  6424. @item none
  6425. No final matching based on combed scores.
  6426. @item sc
  6427. Combed scores are only used when a scene change is detected.
  6428. @item full
  6429. Use combed scores all the time.
  6430. @end table
  6431. Default is @var{sc}.
  6432. @item combdbg
  6433. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6434. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6435. Available values are:
  6436. @table @samp
  6437. @item none
  6438. No forced calculation.
  6439. @item pcn
  6440. Force p/c/n calculations.
  6441. @item pcnub
  6442. Force p/c/n/u/b calculations.
  6443. @end table
  6444. Default value is @var{none}.
  6445. @item cthresh
  6446. This is the area combing threshold used for combed frame detection. This
  6447. essentially controls how "strong" or "visible" combing must be to be detected.
  6448. Larger values mean combing must be more visible and smaller values mean combing
  6449. can be less visible or strong and still be detected. Valid settings are from
  6450. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6451. be detected as combed). This is basically a pixel difference value. A good
  6452. range is @code{[8, 12]}.
  6453. Default value is @code{9}.
  6454. @item chroma
  6455. Sets whether or not chroma is considered in the combed frame decision. Only
  6456. disable this if your source has chroma problems (rainbowing, etc.) that are
  6457. causing problems for the combed frame detection with chroma enabled. Actually,
  6458. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6459. where there is chroma only combing in the source.
  6460. Default value is @code{0}.
  6461. @item blockx
  6462. @item blocky
  6463. Respectively set the x-axis and y-axis size of the window used during combed
  6464. frame detection. This has to do with the size of the area in which
  6465. @option{combpel} pixels are required to be detected as combed for a frame to be
  6466. declared combed. See the @option{combpel} parameter description for more info.
  6467. Possible values are any number that is a power of 2 starting at 4 and going up
  6468. to 512.
  6469. Default value is @code{16}.
  6470. @item combpel
  6471. The number of combed pixels inside any of the @option{blocky} by
  6472. @option{blockx} size blocks on the frame for the frame to be detected as
  6473. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6474. setting controls "how much" combing there must be in any localized area (a
  6475. window defined by the @option{blockx} and @option{blocky} settings) on the
  6476. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6477. which point no frames will ever be detected as combed). This setting is known
  6478. as @option{MI} in TFM/VFM vocabulary.
  6479. Default value is @code{80}.
  6480. @end table
  6481. @anchor{p/c/n/u/b meaning}
  6482. @subsection p/c/n/u/b meaning
  6483. @subsubsection p/c/n
  6484. We assume the following telecined stream:
  6485. @example
  6486. Top fields: 1 2 2 3 4
  6487. Bottom fields: 1 2 3 4 4
  6488. @end example
  6489. The numbers correspond to the progressive frame the fields relate to. Here, the
  6490. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6491. When @code{fieldmatch} is configured to run a matching from bottom
  6492. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6493. @example
  6494. Input stream:
  6495. T 1 2 2 3 4
  6496. B 1 2 3 4 4 <-- matching reference
  6497. Matches: c c n n c
  6498. Output stream:
  6499. T 1 2 3 4 4
  6500. B 1 2 3 4 4
  6501. @end example
  6502. As a result of the field matching, we can see that some frames get duplicated.
  6503. To perform a complete inverse telecine, you need to rely on a decimation filter
  6504. after this operation. See for instance the @ref{decimate} filter.
  6505. The same operation now matching from top fields (@option{field}=@var{top})
  6506. looks like this:
  6507. @example
  6508. Input stream:
  6509. T 1 2 2 3 4 <-- matching reference
  6510. B 1 2 3 4 4
  6511. Matches: c c p p c
  6512. Output stream:
  6513. T 1 2 2 3 4
  6514. B 1 2 2 3 4
  6515. @end example
  6516. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6517. basically, they refer to the frame and field of the opposite parity:
  6518. @itemize
  6519. @item @var{p} matches the field of the opposite parity in the previous frame
  6520. @item @var{c} matches the field of the opposite parity in the current frame
  6521. @item @var{n} matches the field of the opposite parity in the next frame
  6522. @end itemize
  6523. @subsubsection u/b
  6524. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6525. from the opposite parity flag. In the following examples, we assume that we are
  6526. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6527. 'x' is placed above and below each matched fields.
  6528. With bottom matching (@option{field}=@var{bottom}):
  6529. @example
  6530. Match: c p n b u
  6531. x x x x x
  6532. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6533. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6534. x x x x x
  6535. Output frames:
  6536. 2 1 2 2 2
  6537. 2 2 2 1 3
  6538. @end example
  6539. With top matching (@option{field}=@var{top}):
  6540. @example
  6541. Match: c p n b u
  6542. x x x x x
  6543. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6544. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6545. x x x x x
  6546. Output frames:
  6547. 2 2 2 1 2
  6548. 2 1 3 2 2
  6549. @end example
  6550. @subsection Examples
  6551. Simple IVTC of a top field first telecined stream:
  6552. @example
  6553. fieldmatch=order=tff:combmatch=none, decimate
  6554. @end example
  6555. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6556. @example
  6557. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6558. @end example
  6559. @section fieldorder
  6560. Transform the field order of the input video.
  6561. It accepts the following parameters:
  6562. @table @option
  6563. @item order
  6564. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6565. for bottom field first.
  6566. @end table
  6567. The default value is @samp{tff}.
  6568. The transformation is done by shifting the picture content up or down
  6569. by one line, and filling the remaining line with appropriate picture content.
  6570. This method is consistent with most broadcast field order converters.
  6571. If the input video is not flagged as being interlaced, or it is already
  6572. flagged as being of the required output field order, then this filter does
  6573. not alter the incoming video.
  6574. It is very useful when converting to or from PAL DV material,
  6575. which is bottom field first.
  6576. For example:
  6577. @example
  6578. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6579. @end example
  6580. @section fifo, afifo
  6581. Buffer input images and send them when they are requested.
  6582. It is mainly useful when auto-inserted by the libavfilter
  6583. framework.
  6584. It does not take parameters.
  6585. @section find_rect
  6586. Find a rectangular object
  6587. It accepts the following options:
  6588. @table @option
  6589. @item object
  6590. Filepath of the object image, needs to be in gray8.
  6591. @item threshold
  6592. Detection threshold, default is 0.5.
  6593. @item mipmaps
  6594. Number of mipmaps, default is 3.
  6595. @item xmin, ymin, xmax, ymax
  6596. Specifies the rectangle in which to search.
  6597. @end table
  6598. @subsection Examples
  6599. @itemize
  6600. @item
  6601. Generate a representative palette of a given video using @command{ffmpeg}:
  6602. @example
  6603. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6604. @end example
  6605. @end itemize
  6606. @section cover_rect
  6607. Cover a rectangular object
  6608. It accepts the following options:
  6609. @table @option
  6610. @item cover
  6611. Filepath of the optional cover image, needs to be in yuv420.
  6612. @item mode
  6613. Set covering mode.
  6614. It accepts the following values:
  6615. @table @samp
  6616. @item cover
  6617. cover it by the supplied image
  6618. @item blur
  6619. cover it by interpolating the surrounding pixels
  6620. @end table
  6621. Default value is @var{blur}.
  6622. @end table
  6623. @subsection Examples
  6624. @itemize
  6625. @item
  6626. Generate a representative palette of a given video using @command{ffmpeg}:
  6627. @example
  6628. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6629. @end example
  6630. @end itemize
  6631. @section floodfill
  6632. Flood area with values of same pixel components with another values.
  6633. It accepts the following options:
  6634. @table @option
  6635. @item x
  6636. Set pixel x coordinate.
  6637. @item y
  6638. Set pixel y coordinate.
  6639. @item s0
  6640. Set source #0 component value.
  6641. @item s1
  6642. Set source #1 component value.
  6643. @item s2
  6644. Set source #2 component value.
  6645. @item s3
  6646. Set source #3 component value.
  6647. @item d0
  6648. Set destination #0 component value.
  6649. @item d1
  6650. Set destination #1 component value.
  6651. @item d2
  6652. Set destination #2 component value.
  6653. @item d3
  6654. Set destination #3 component value.
  6655. @end table
  6656. @anchor{format}
  6657. @section format
  6658. Convert the input video to one of the specified pixel formats.
  6659. Libavfilter will try to pick one that is suitable as input to
  6660. the next filter.
  6661. It accepts the following parameters:
  6662. @table @option
  6663. @item pix_fmts
  6664. A '|'-separated list of pixel format names, such as
  6665. "pix_fmts=yuv420p|monow|rgb24".
  6666. @end table
  6667. @subsection Examples
  6668. @itemize
  6669. @item
  6670. Convert the input video to the @var{yuv420p} format
  6671. @example
  6672. format=pix_fmts=yuv420p
  6673. @end example
  6674. Convert the input video to any of the formats in the list
  6675. @example
  6676. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6677. @end example
  6678. @end itemize
  6679. @anchor{fps}
  6680. @section fps
  6681. Convert the video to specified constant frame rate by duplicating or dropping
  6682. frames as necessary.
  6683. It accepts the following parameters:
  6684. @table @option
  6685. @item fps
  6686. The desired output frame rate. The default is @code{25}.
  6687. @item start_time
  6688. Assume the first PTS should be the given value, in seconds. This allows for
  6689. padding/trimming at the start of stream. By default, no assumption is made
  6690. about the first frame's expected PTS, so no padding or trimming is done.
  6691. For example, this could be set to 0 to pad the beginning with duplicates of
  6692. the first frame if a video stream starts after the audio stream or to trim any
  6693. frames with a negative PTS.
  6694. @item round
  6695. Timestamp (PTS) rounding method.
  6696. Possible values are:
  6697. @table @option
  6698. @item zero
  6699. round towards 0
  6700. @item inf
  6701. round away from 0
  6702. @item down
  6703. round towards -infinity
  6704. @item up
  6705. round towards +infinity
  6706. @item near
  6707. round to nearest
  6708. @end table
  6709. The default is @code{near}.
  6710. @item eof_action
  6711. Action performed when reading the last frame.
  6712. Possible values are:
  6713. @table @option
  6714. @item round
  6715. Use same timestamp rounding method as used for other frames.
  6716. @item pass
  6717. Pass through last frame if input duration has not been reached yet.
  6718. @end table
  6719. The default is @code{round}.
  6720. @end table
  6721. Alternatively, the options can be specified as a flat string:
  6722. @var{fps}[:@var{start_time}[:@var{round}]].
  6723. See also the @ref{setpts} filter.
  6724. @subsection Examples
  6725. @itemize
  6726. @item
  6727. A typical usage in order to set the fps to 25:
  6728. @example
  6729. fps=fps=25
  6730. @end example
  6731. @item
  6732. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6733. @example
  6734. fps=fps=film:round=near
  6735. @end example
  6736. @end itemize
  6737. @section framepack
  6738. Pack two different video streams into a stereoscopic video, setting proper
  6739. metadata on supported codecs. The two views should have the same size and
  6740. framerate and processing will stop when the shorter video ends. Please note
  6741. that you may conveniently adjust view properties with the @ref{scale} and
  6742. @ref{fps} filters.
  6743. It accepts the following parameters:
  6744. @table @option
  6745. @item format
  6746. The desired packing format. Supported values are:
  6747. @table @option
  6748. @item sbs
  6749. The views are next to each other (default).
  6750. @item tab
  6751. The views are on top of each other.
  6752. @item lines
  6753. The views are packed by line.
  6754. @item columns
  6755. The views are packed by column.
  6756. @item frameseq
  6757. The views are temporally interleaved.
  6758. @end table
  6759. @end table
  6760. Some examples:
  6761. @example
  6762. # Convert left and right views into a frame-sequential video
  6763. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6764. # Convert views into a side-by-side video with the same output resolution as the input
  6765. 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
  6766. @end example
  6767. @section framerate
  6768. Change the frame rate by interpolating new video output frames from the source
  6769. frames.
  6770. This filter is not designed to function correctly with interlaced media. If
  6771. you wish to change the frame rate of interlaced media then you are required
  6772. to deinterlace before this filter and re-interlace after this filter.
  6773. A description of the accepted options follows.
  6774. @table @option
  6775. @item fps
  6776. Specify the output frames per second. This option can also be specified
  6777. as a value alone. The default is @code{50}.
  6778. @item interp_start
  6779. Specify the start of a range where the output frame will be created as a
  6780. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6781. the default is @code{15}.
  6782. @item interp_end
  6783. Specify the end of a range where the output frame will be created as a
  6784. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6785. the default is @code{240}.
  6786. @item scene
  6787. Specify the level at which a scene change is detected as a value between
  6788. 0 and 100 to indicate a new scene; a low value reflects a low
  6789. probability for the current frame to introduce a new scene, while a higher
  6790. value means the current frame is more likely to be one.
  6791. The default is @code{7}.
  6792. @item flags
  6793. Specify flags influencing the filter process.
  6794. Available value for @var{flags} is:
  6795. @table @option
  6796. @item scene_change_detect, scd
  6797. Enable scene change detection using the value of the option @var{scene}.
  6798. This flag is enabled by default.
  6799. @end table
  6800. @end table
  6801. @section framestep
  6802. Select one frame every N-th frame.
  6803. This filter accepts the following option:
  6804. @table @option
  6805. @item step
  6806. Select frame after every @code{step} frames.
  6807. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6808. @end table
  6809. @anchor{frei0r}
  6810. @section frei0r
  6811. Apply a frei0r effect to the input video.
  6812. To enable the compilation of this filter, you need to install the frei0r
  6813. header and configure FFmpeg with @code{--enable-frei0r}.
  6814. It accepts the following parameters:
  6815. @table @option
  6816. @item filter_name
  6817. The name of the frei0r effect to load. If the environment variable
  6818. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6819. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6820. Otherwise, the standard frei0r paths are searched, in this order:
  6821. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6822. @file{/usr/lib/frei0r-1/}.
  6823. @item filter_params
  6824. A '|'-separated list of parameters to pass to the frei0r effect.
  6825. @end table
  6826. A frei0r effect parameter can be a boolean (its value is either
  6827. "y" or "n"), a double, a color (specified as
  6828. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6829. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6830. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6831. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6832. The number and types of parameters depend on the loaded effect. If an
  6833. effect parameter is not specified, the default value is set.
  6834. @subsection Examples
  6835. @itemize
  6836. @item
  6837. Apply the distort0r effect, setting the first two double parameters:
  6838. @example
  6839. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6840. @end example
  6841. @item
  6842. Apply the colordistance effect, taking a color as the first parameter:
  6843. @example
  6844. frei0r=colordistance:0.2/0.3/0.4
  6845. frei0r=colordistance:violet
  6846. frei0r=colordistance:0x112233
  6847. @end example
  6848. @item
  6849. Apply the perspective effect, specifying the top left and top right image
  6850. positions:
  6851. @example
  6852. frei0r=perspective:0.2/0.2|0.8/0.2
  6853. @end example
  6854. @end itemize
  6855. For more information, see
  6856. @url{http://frei0r.dyne.org}
  6857. @section fspp
  6858. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6859. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6860. processing filter, one of them is performed once per block, not per pixel.
  6861. This allows for much higher speed.
  6862. The filter accepts the following options:
  6863. @table @option
  6864. @item quality
  6865. Set quality. This option defines the number of levels for averaging. It accepts
  6866. an integer in the range 4-5. Default value is @code{4}.
  6867. @item qp
  6868. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6869. If not set, the filter will use the QP from the video stream (if available).
  6870. @item strength
  6871. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6872. more details but also more artifacts, while higher values make the image smoother
  6873. but also blurrier. Default value is @code{0} − PSNR optimal.
  6874. @item use_bframe_qp
  6875. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6876. option may cause flicker since the B-Frames have often larger QP. Default is
  6877. @code{0} (not enabled).
  6878. @end table
  6879. @section gblur
  6880. Apply Gaussian blur filter.
  6881. The filter accepts the following options:
  6882. @table @option
  6883. @item sigma
  6884. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6885. @item steps
  6886. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6887. @item planes
  6888. Set which planes to filter. By default all planes are filtered.
  6889. @item sigmaV
  6890. Set vertical sigma, if negative it will be same as @code{sigma}.
  6891. Default is @code{-1}.
  6892. @end table
  6893. @section geq
  6894. The filter accepts the following options:
  6895. @table @option
  6896. @item lum_expr, lum
  6897. Set the luminance expression.
  6898. @item cb_expr, cb
  6899. Set the chrominance blue expression.
  6900. @item cr_expr, cr
  6901. Set the chrominance red expression.
  6902. @item alpha_expr, a
  6903. Set the alpha expression.
  6904. @item red_expr, r
  6905. Set the red expression.
  6906. @item green_expr, g
  6907. Set the green expression.
  6908. @item blue_expr, b
  6909. Set the blue expression.
  6910. @end table
  6911. The colorspace is selected according to the specified options. If one
  6912. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6913. options is specified, the filter will automatically select a YCbCr
  6914. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6915. @option{blue_expr} options is specified, it will select an RGB
  6916. colorspace.
  6917. If one of the chrominance expression is not defined, it falls back on the other
  6918. one. If no alpha expression is specified it will evaluate to opaque value.
  6919. If none of chrominance expressions are specified, they will evaluate
  6920. to the luminance expression.
  6921. The expressions can use the following variables and functions:
  6922. @table @option
  6923. @item N
  6924. The sequential number of the filtered frame, starting from @code{0}.
  6925. @item X
  6926. @item Y
  6927. The coordinates of the current sample.
  6928. @item W
  6929. @item H
  6930. The width and height of the image.
  6931. @item SW
  6932. @item SH
  6933. Width and height scale depending on the currently filtered plane. It is the
  6934. ratio between the corresponding luma plane number of pixels and the current
  6935. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6936. @code{0.5,0.5} for chroma planes.
  6937. @item T
  6938. Time of the current frame, expressed in seconds.
  6939. @item p(x, y)
  6940. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6941. plane.
  6942. @item lum(x, y)
  6943. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6944. plane.
  6945. @item cb(x, y)
  6946. Return the value of the pixel at location (@var{x},@var{y}) of the
  6947. blue-difference chroma plane. Return 0 if there is no such plane.
  6948. @item cr(x, y)
  6949. Return the value of the pixel at location (@var{x},@var{y}) of the
  6950. red-difference chroma plane. Return 0 if there is no such plane.
  6951. @item r(x, y)
  6952. @item g(x, y)
  6953. @item b(x, y)
  6954. Return the value of the pixel at location (@var{x},@var{y}) of the
  6955. red/green/blue component. Return 0 if there is no such component.
  6956. @item alpha(x, y)
  6957. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6958. plane. Return 0 if there is no such plane.
  6959. @end table
  6960. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6961. automatically clipped to the closer edge.
  6962. @subsection Examples
  6963. @itemize
  6964. @item
  6965. Flip the image horizontally:
  6966. @example
  6967. geq=p(W-X\,Y)
  6968. @end example
  6969. @item
  6970. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6971. wavelength of 100 pixels:
  6972. @example
  6973. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6974. @end example
  6975. @item
  6976. Generate a fancy enigmatic moving light:
  6977. @example
  6978. 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
  6979. @end example
  6980. @item
  6981. Generate a quick emboss effect:
  6982. @example
  6983. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6984. @end example
  6985. @item
  6986. Modify RGB components depending on pixel position:
  6987. @example
  6988. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6989. @end example
  6990. @item
  6991. Create a radial gradient that is the same size as the input (also see
  6992. the @ref{vignette} filter):
  6993. @example
  6994. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6995. @end example
  6996. @end itemize
  6997. @section gradfun
  6998. Fix the banding artifacts that are sometimes introduced into nearly flat
  6999. regions by truncation to 8-bit color depth.
  7000. Interpolate the gradients that should go where the bands are, and
  7001. dither them.
  7002. It is designed for playback only. Do not use it prior to
  7003. lossy compression, because compression tends to lose the dither and
  7004. bring back the bands.
  7005. It accepts the following parameters:
  7006. @table @option
  7007. @item strength
  7008. The maximum amount by which the filter will change any one pixel. This is also
  7009. the threshold for detecting nearly flat regions. Acceptable values range from
  7010. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7011. valid range.
  7012. @item radius
  7013. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7014. gradients, but also prevents the filter from modifying the pixels near detailed
  7015. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7016. values will be clipped to the valid range.
  7017. @end table
  7018. Alternatively, the options can be specified as a flat string:
  7019. @var{strength}[:@var{radius}]
  7020. @subsection Examples
  7021. @itemize
  7022. @item
  7023. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7024. @example
  7025. gradfun=3.5:8
  7026. @end example
  7027. @item
  7028. Specify radius, omitting the strength (which will fall-back to the default
  7029. value):
  7030. @example
  7031. gradfun=radius=8
  7032. @end example
  7033. @end itemize
  7034. @anchor{haldclut}
  7035. @section haldclut
  7036. Apply a Hald CLUT to a video stream.
  7037. First input is the video stream to process, and second one is the Hald CLUT.
  7038. The Hald CLUT input can be a simple picture or a complete video stream.
  7039. The filter accepts the following options:
  7040. @table @option
  7041. @item shortest
  7042. Force termination when the shortest input terminates. Default is @code{0}.
  7043. @item repeatlast
  7044. Continue applying the last CLUT after the end of the stream. A value of
  7045. @code{0} disable the filter after the last frame of the CLUT is reached.
  7046. Default is @code{1}.
  7047. @end table
  7048. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7049. filters share the same internals).
  7050. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7051. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7052. @subsection Workflow examples
  7053. @subsubsection Hald CLUT video stream
  7054. Generate an identity Hald CLUT stream altered with various effects:
  7055. @example
  7056. 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
  7057. @end example
  7058. Note: make sure you use a lossless codec.
  7059. Then use it with @code{haldclut} to apply it on some random stream:
  7060. @example
  7061. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7062. @end example
  7063. The Hald CLUT will be applied to the 10 first seconds (duration of
  7064. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7065. to the remaining frames of the @code{mandelbrot} stream.
  7066. @subsubsection Hald CLUT with preview
  7067. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7068. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7069. biggest possible square starting at the top left of the picture. The remaining
  7070. padding pixels (bottom or right) will be ignored. This area can be used to add
  7071. a preview of the Hald CLUT.
  7072. Typically, the following generated Hald CLUT will be supported by the
  7073. @code{haldclut} filter:
  7074. @example
  7075. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7076. pad=iw+320 [padded_clut];
  7077. smptebars=s=320x256, split [a][b];
  7078. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7079. [main][b] overlay=W-320" -frames:v 1 clut.png
  7080. @end example
  7081. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7082. bars are displayed on the right-top, and below the same color bars processed by
  7083. the color changes.
  7084. Then, the effect of this Hald CLUT can be visualized with:
  7085. @example
  7086. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7087. @end example
  7088. @section hflip
  7089. Flip the input video horizontally.
  7090. For example, to horizontally flip the input video with @command{ffmpeg}:
  7091. @example
  7092. ffmpeg -i in.avi -vf "hflip" out.avi
  7093. @end example
  7094. @section histeq
  7095. This filter applies a global color histogram equalization on a
  7096. per-frame basis.
  7097. It can be used to correct video that has a compressed range of pixel
  7098. intensities. The filter redistributes the pixel intensities to
  7099. equalize their distribution across the intensity range. It may be
  7100. viewed as an "automatically adjusting contrast filter". This filter is
  7101. useful only for correcting degraded or poorly captured source
  7102. video.
  7103. The filter accepts the following options:
  7104. @table @option
  7105. @item strength
  7106. Determine the amount of equalization to be applied. As the strength
  7107. is reduced, the distribution of pixel intensities more-and-more
  7108. approaches that of the input frame. The value must be a float number
  7109. in the range [0,1] and defaults to 0.200.
  7110. @item intensity
  7111. Set the maximum intensity that can generated and scale the output
  7112. values appropriately. The strength should be set as desired and then
  7113. the intensity can be limited if needed to avoid washing-out. The value
  7114. must be a float number in the range [0,1] and defaults to 0.210.
  7115. @item antibanding
  7116. Set the antibanding level. If enabled the filter will randomly vary
  7117. the luminance of output pixels by a small amount to avoid banding of
  7118. the histogram. Possible values are @code{none}, @code{weak} or
  7119. @code{strong}. It defaults to @code{none}.
  7120. @end table
  7121. @section histogram
  7122. Compute and draw a color distribution histogram for the input video.
  7123. The computed histogram is a representation of the color component
  7124. distribution in an image.
  7125. Standard histogram displays the color components distribution in an image.
  7126. Displays color graph for each color component. Shows distribution of
  7127. the Y, U, V, A or R, G, B components, depending on input format, in the
  7128. current frame. Below each graph a color component scale meter is shown.
  7129. The filter accepts the following options:
  7130. @table @option
  7131. @item level_height
  7132. Set height of level. Default value is @code{200}.
  7133. Allowed range is [50, 2048].
  7134. @item scale_height
  7135. Set height of color scale. Default value is @code{12}.
  7136. Allowed range is [0, 40].
  7137. @item display_mode
  7138. Set display mode.
  7139. It accepts the following values:
  7140. @table @samp
  7141. @item stack
  7142. Per color component graphs are placed below each other.
  7143. @item parade
  7144. Per color component graphs are placed side by side.
  7145. @item overlay
  7146. Presents information identical to that in the @code{parade}, except
  7147. that the graphs representing color components are superimposed directly
  7148. over one another.
  7149. @end table
  7150. Default is @code{stack}.
  7151. @item levels_mode
  7152. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7153. Default is @code{linear}.
  7154. @item components
  7155. Set what color components to display.
  7156. Default is @code{7}.
  7157. @item fgopacity
  7158. Set foreground opacity. Default is @code{0.7}.
  7159. @item bgopacity
  7160. Set background opacity. Default is @code{0.5}.
  7161. @end table
  7162. @subsection Examples
  7163. @itemize
  7164. @item
  7165. Calculate and draw histogram:
  7166. @example
  7167. ffplay -i input -vf histogram
  7168. @end example
  7169. @end itemize
  7170. @anchor{hqdn3d}
  7171. @section hqdn3d
  7172. This is a high precision/quality 3d denoise filter. It aims to reduce
  7173. image noise, producing smooth images and making still images really
  7174. still. It should enhance compressibility.
  7175. It accepts the following optional parameters:
  7176. @table @option
  7177. @item luma_spatial
  7178. A non-negative floating point number which specifies spatial luma strength.
  7179. It defaults to 4.0.
  7180. @item chroma_spatial
  7181. A non-negative floating point number which specifies spatial chroma strength.
  7182. It defaults to 3.0*@var{luma_spatial}/4.0.
  7183. @item luma_tmp
  7184. A floating point number which specifies luma temporal strength. It defaults to
  7185. 6.0*@var{luma_spatial}/4.0.
  7186. @item chroma_tmp
  7187. A floating point number which specifies chroma temporal strength. It defaults to
  7188. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7189. @end table
  7190. @section hwdownload
  7191. Download hardware frames to system memory.
  7192. The input must be in hardware frames, and the output a non-hardware format.
  7193. Not all formats will be supported on the output - it may be necessary to insert
  7194. an additional @option{format} filter immediately following in the graph to get
  7195. the output in a supported format.
  7196. @section hwmap
  7197. Map hardware frames to system memory or to another device.
  7198. This filter has several different modes of operation; which one is used depends
  7199. on the input and output formats:
  7200. @itemize
  7201. @item
  7202. Hardware frame input, normal frame output
  7203. Map the input frames to system memory and pass them to the output. If the
  7204. original hardware frame is later required (for example, after overlaying
  7205. something else on part of it), the @option{hwmap} filter can be used again
  7206. in the next mode to retrieve it.
  7207. @item
  7208. Normal frame input, hardware frame output
  7209. If the input is actually a software-mapped hardware frame, then unmap it -
  7210. that is, return the original hardware frame.
  7211. Otherwise, a device must be provided. Create new hardware surfaces on that
  7212. device for the output, then map them back to the software format at the input
  7213. and give those frames to the preceding filter. This will then act like the
  7214. @option{hwupload} filter, but may be able to avoid an additional copy when
  7215. the input is already in a compatible format.
  7216. @item
  7217. Hardware frame input and output
  7218. A device must be supplied for the output, either directly or with the
  7219. @option{derive_device} option. The input and output devices must be of
  7220. different types and compatible - the exact meaning of this is
  7221. system-dependent, but typically it means that they must refer to the same
  7222. underlying hardware context (for example, refer to the same graphics card).
  7223. If the input frames were originally created on the output device, then unmap
  7224. to retrieve the original frames.
  7225. Otherwise, map the frames to the output device - create new hardware frames
  7226. on the output corresponding to the frames on the input.
  7227. @end itemize
  7228. The following additional parameters are accepted:
  7229. @table @option
  7230. @item mode
  7231. Set the frame mapping mode. Some combination of:
  7232. @table @var
  7233. @item read
  7234. The mapped frame should be readable.
  7235. @item write
  7236. The mapped frame should be writeable.
  7237. @item overwrite
  7238. The mapping will always overwrite the entire frame.
  7239. This may improve performance in some cases, as the original contents of the
  7240. frame need not be loaded.
  7241. @item direct
  7242. The mapping must not involve any copying.
  7243. Indirect mappings to copies of frames are created in some cases where either
  7244. direct mapping is not possible or it would have unexpected properties.
  7245. Setting this flag ensures that the mapping is direct and will fail if that is
  7246. not possible.
  7247. @end table
  7248. Defaults to @var{read+write} if not specified.
  7249. @item derive_device @var{type}
  7250. Rather than using the device supplied at initialisation, instead derive a new
  7251. device of type @var{type} from the device the input frames exist on.
  7252. @item reverse
  7253. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7254. and map them back to the source. This may be necessary in some cases where
  7255. a mapping in one direction is required but only the opposite direction is
  7256. supported by the devices being used.
  7257. This option is dangerous - it may break the preceding filter in undefined
  7258. ways if there are any additional constraints on that filter's output.
  7259. Do not use it without fully understanding the implications of its use.
  7260. @end table
  7261. @section hwupload
  7262. Upload system memory frames to hardware surfaces.
  7263. The device to upload to must be supplied when the filter is initialised. If
  7264. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7265. option.
  7266. @anchor{hwupload_cuda}
  7267. @section hwupload_cuda
  7268. Upload system memory frames to a CUDA device.
  7269. It accepts the following optional parameters:
  7270. @table @option
  7271. @item device
  7272. The number of the CUDA device to use
  7273. @end table
  7274. @section hqx
  7275. Apply a high-quality magnification filter designed for pixel art. This filter
  7276. was originally created by Maxim Stepin.
  7277. It accepts the following option:
  7278. @table @option
  7279. @item n
  7280. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7281. @code{hq3x} and @code{4} for @code{hq4x}.
  7282. Default is @code{3}.
  7283. @end table
  7284. @section hstack
  7285. Stack input videos horizontally.
  7286. All streams must be of same pixel format and of same height.
  7287. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7288. to create same output.
  7289. The filter accept the following option:
  7290. @table @option
  7291. @item inputs
  7292. Set number of input streams. Default is 2.
  7293. @item shortest
  7294. If set to 1, force the output to terminate when the shortest input
  7295. terminates. Default value is 0.
  7296. @end table
  7297. @section hue
  7298. Modify the hue and/or the saturation of the input.
  7299. It accepts the following parameters:
  7300. @table @option
  7301. @item h
  7302. Specify the hue angle as a number of degrees. It accepts an expression,
  7303. and defaults to "0".
  7304. @item s
  7305. Specify the saturation in the [-10,10] range. It accepts an expression and
  7306. defaults to "1".
  7307. @item H
  7308. Specify the hue angle as a number of radians. It accepts an
  7309. expression, and defaults to "0".
  7310. @item b
  7311. Specify the brightness in the [-10,10] range. It accepts an expression and
  7312. defaults to "0".
  7313. @end table
  7314. @option{h} and @option{H} are mutually exclusive, and can't be
  7315. specified at the same time.
  7316. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7317. expressions containing the following constants:
  7318. @table @option
  7319. @item n
  7320. frame count of the input frame starting from 0
  7321. @item pts
  7322. presentation timestamp of the input frame expressed in time base units
  7323. @item r
  7324. frame rate of the input video, NAN if the input frame rate is unknown
  7325. @item t
  7326. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7327. @item tb
  7328. time base of the input video
  7329. @end table
  7330. @subsection Examples
  7331. @itemize
  7332. @item
  7333. Set the hue to 90 degrees and the saturation to 1.0:
  7334. @example
  7335. hue=h=90:s=1
  7336. @end example
  7337. @item
  7338. Same command but expressing the hue in radians:
  7339. @example
  7340. hue=H=PI/2:s=1
  7341. @end example
  7342. @item
  7343. Rotate hue and make the saturation swing between 0
  7344. and 2 over a period of 1 second:
  7345. @example
  7346. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7347. @end example
  7348. @item
  7349. Apply a 3 seconds saturation fade-in effect starting at 0:
  7350. @example
  7351. hue="s=min(t/3\,1)"
  7352. @end example
  7353. The general fade-in expression can be written as:
  7354. @example
  7355. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7356. @end example
  7357. @item
  7358. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7359. @example
  7360. hue="s=max(0\, min(1\, (8-t)/3))"
  7361. @end example
  7362. The general fade-out expression can be written as:
  7363. @example
  7364. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7365. @end example
  7366. @end itemize
  7367. @subsection Commands
  7368. This filter supports the following commands:
  7369. @table @option
  7370. @item b
  7371. @item s
  7372. @item h
  7373. @item H
  7374. Modify the hue and/or the saturation and/or brightness of the input video.
  7375. The command accepts the same syntax of the corresponding option.
  7376. If the specified expression is not valid, it is kept at its current
  7377. value.
  7378. @end table
  7379. @section hysteresis
  7380. Grow first stream into second stream by connecting components.
  7381. This makes it possible to build more robust edge masks.
  7382. This filter accepts the following options:
  7383. @table @option
  7384. @item planes
  7385. Set which planes will be processed as bitmap, unprocessed planes will be
  7386. copied from first stream.
  7387. By default value 0xf, all planes will be processed.
  7388. @item threshold
  7389. Set threshold which is used in filtering. If pixel component value is higher than
  7390. this value filter algorithm for connecting components is activated.
  7391. By default value is 0.
  7392. @end table
  7393. @section idet
  7394. Detect video interlacing type.
  7395. This filter tries to detect if the input frames are interlaced, progressive,
  7396. top or bottom field first. It will also try to detect fields that are
  7397. repeated between adjacent frames (a sign of telecine).
  7398. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7399. Multiple frame detection incorporates the classification history of previous frames.
  7400. The filter will log these metadata values:
  7401. @table @option
  7402. @item single.current_frame
  7403. Detected type of current frame using single-frame detection. One of:
  7404. ``tff'' (top field first), ``bff'' (bottom field first),
  7405. ``progressive'', or ``undetermined''
  7406. @item single.tff
  7407. Cumulative number of frames detected as top field first using single-frame detection.
  7408. @item multiple.tff
  7409. Cumulative number of frames detected as top field first using multiple-frame detection.
  7410. @item single.bff
  7411. Cumulative number of frames detected as bottom field first using single-frame detection.
  7412. @item multiple.current_frame
  7413. Detected type of current frame using multiple-frame detection. One of:
  7414. ``tff'' (top field first), ``bff'' (bottom field first),
  7415. ``progressive'', or ``undetermined''
  7416. @item multiple.bff
  7417. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7418. @item single.progressive
  7419. Cumulative number of frames detected as progressive using single-frame detection.
  7420. @item multiple.progressive
  7421. Cumulative number of frames detected as progressive using multiple-frame detection.
  7422. @item single.undetermined
  7423. Cumulative number of frames that could not be classified using single-frame detection.
  7424. @item multiple.undetermined
  7425. Cumulative number of frames that could not be classified using multiple-frame detection.
  7426. @item repeated.current_frame
  7427. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7428. @item repeated.neither
  7429. Cumulative number of frames with no repeated field.
  7430. @item repeated.top
  7431. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7432. @item repeated.bottom
  7433. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7434. @end table
  7435. The filter accepts the following options:
  7436. @table @option
  7437. @item intl_thres
  7438. Set interlacing threshold.
  7439. @item prog_thres
  7440. Set progressive threshold.
  7441. @item rep_thres
  7442. Threshold for repeated field detection.
  7443. @item half_life
  7444. Number of frames after which a given frame's contribution to the
  7445. statistics is halved (i.e., it contributes only 0.5 to its
  7446. classification). The default of 0 means that all frames seen are given
  7447. full weight of 1.0 forever.
  7448. @item analyze_interlaced_flag
  7449. When this is not 0 then idet will use the specified number of frames to determine
  7450. if the interlaced flag is accurate, it will not count undetermined frames.
  7451. If the flag is found to be accurate it will be used without any further
  7452. computations, if it is found to be inaccurate it will be cleared without any
  7453. further computations. This allows inserting the idet filter as a low computational
  7454. method to clean up the interlaced flag
  7455. @end table
  7456. @section il
  7457. Deinterleave or interleave fields.
  7458. This filter allows one to process interlaced images fields without
  7459. deinterlacing them. Deinterleaving splits the input frame into 2
  7460. fields (so called half pictures). Odd lines are moved to the top
  7461. half of the output image, even lines to the bottom half.
  7462. You can process (filter) them independently and then re-interleave them.
  7463. The filter accepts the following options:
  7464. @table @option
  7465. @item luma_mode, l
  7466. @item chroma_mode, c
  7467. @item alpha_mode, a
  7468. Available values for @var{luma_mode}, @var{chroma_mode} and
  7469. @var{alpha_mode} are:
  7470. @table @samp
  7471. @item none
  7472. Do nothing.
  7473. @item deinterleave, d
  7474. Deinterleave fields, placing one above the other.
  7475. @item interleave, i
  7476. Interleave fields. Reverse the effect of deinterleaving.
  7477. @end table
  7478. Default value is @code{none}.
  7479. @item luma_swap, ls
  7480. @item chroma_swap, cs
  7481. @item alpha_swap, as
  7482. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7483. @end table
  7484. @section inflate
  7485. Apply inflate effect to the video.
  7486. This filter replaces the pixel by the local(3x3) average by taking into account
  7487. only values higher than the pixel.
  7488. It accepts the following options:
  7489. @table @option
  7490. @item threshold0
  7491. @item threshold1
  7492. @item threshold2
  7493. @item threshold3
  7494. Limit the maximum change for each plane, default is 65535.
  7495. If 0, plane will remain unchanged.
  7496. @end table
  7497. @section interlace
  7498. Simple interlacing filter from progressive contents. This interleaves upper (or
  7499. lower) lines from odd frames with lower (or upper) lines from even frames,
  7500. halving the frame rate and preserving image height.
  7501. @example
  7502. Original Original New Frame
  7503. Frame 'j' Frame 'j+1' (tff)
  7504. ========== =========== ==================
  7505. Line 0 --------------------> Frame 'j' Line 0
  7506. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7507. Line 2 ---------------------> Frame 'j' Line 2
  7508. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7509. ... ... ...
  7510. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7511. @end example
  7512. It accepts the following optional parameters:
  7513. @table @option
  7514. @item scan
  7515. This determines whether the interlaced frame is taken from the even
  7516. (tff - default) or odd (bff) lines of the progressive frame.
  7517. @item lowpass
  7518. Vertical lowpass filter to avoid twitter interlacing and
  7519. reduce moire patterns.
  7520. @table @samp
  7521. @item 0, off
  7522. Disable vertical lowpass filter
  7523. @item 1, linear
  7524. Enable linear filter (default)
  7525. @item 2, complex
  7526. Enable complex filter. This will slightly less reduce twitter and moire
  7527. but better retain detail and subjective sharpness impression.
  7528. @end table
  7529. @end table
  7530. @section kerndeint
  7531. Deinterlace input video by applying Donald Graft's adaptive kernel
  7532. deinterling. Work on interlaced parts of a video to produce
  7533. progressive frames.
  7534. The description of the accepted parameters follows.
  7535. @table @option
  7536. @item thresh
  7537. Set the threshold which affects the filter's tolerance when
  7538. determining if a pixel line must be processed. It must be an integer
  7539. in the range [0,255] and defaults to 10. A value of 0 will result in
  7540. applying the process on every pixels.
  7541. @item map
  7542. Paint pixels exceeding the threshold value to white if set to 1.
  7543. Default is 0.
  7544. @item order
  7545. Set the fields order. Swap fields if set to 1, leave fields alone if
  7546. 0. Default is 0.
  7547. @item sharp
  7548. Enable additional sharpening if set to 1. Default is 0.
  7549. @item twoway
  7550. Enable twoway sharpening if set to 1. Default is 0.
  7551. @end table
  7552. @subsection Examples
  7553. @itemize
  7554. @item
  7555. Apply default values:
  7556. @example
  7557. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7558. @end example
  7559. @item
  7560. Enable additional sharpening:
  7561. @example
  7562. kerndeint=sharp=1
  7563. @end example
  7564. @item
  7565. Paint processed pixels in white:
  7566. @example
  7567. kerndeint=map=1
  7568. @end example
  7569. @end itemize
  7570. @section lenscorrection
  7571. Correct radial lens distortion
  7572. This filter can be used to correct for radial distortion as can result from the use
  7573. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7574. one can use tools available for example as part of opencv or simply trial-and-error.
  7575. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7576. and extract the k1 and k2 coefficients from the resulting matrix.
  7577. Note that effectively the same filter is available in the open-source tools Krita and
  7578. Digikam from the KDE project.
  7579. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7580. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7581. brightness distribution, so you may want to use both filters together in certain
  7582. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7583. be applied before or after lens correction.
  7584. @subsection Options
  7585. The filter accepts the following options:
  7586. @table @option
  7587. @item cx
  7588. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7589. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7590. width.
  7591. @item cy
  7592. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7593. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7594. height.
  7595. @item k1
  7596. Coefficient of the quadratic correction term. 0.5 means no correction.
  7597. @item k2
  7598. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7599. @end table
  7600. The formula that generates the correction is:
  7601. @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)
  7602. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7603. distances from the focal point in the source and target images, respectively.
  7604. @section libvmaf
  7605. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7606. score between two input videos.
  7607. The obtained VMAF score is printed through the logging system.
  7608. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7609. After installing the library it can be enabled using:
  7610. @code{./configure --enable-libvmaf}.
  7611. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7612. The filter has following options:
  7613. @table @option
  7614. @item model_path
  7615. Set the model path which is to be used for SVM.
  7616. Default value: @code{"vmaf_v0.6.1.pkl"}
  7617. @item log_path
  7618. Set the file path to be used to store logs.
  7619. @item log_fmt
  7620. Set the format of the log file (xml or json).
  7621. @item enable_transform
  7622. Enables transform for computing vmaf.
  7623. @item phone_model
  7624. Invokes the phone model which will generate VMAF scores higher than in the
  7625. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7626. @item psnr
  7627. Enables computing psnr along with vmaf.
  7628. @item ssim
  7629. Enables computing ssim along with vmaf.
  7630. @item ms_ssim
  7631. Enables computing ms_ssim along with vmaf.
  7632. @item pool
  7633. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  7634. @end table
  7635. This filter also supports the @ref{framesync} options.
  7636. On the below examples the input file @file{main.mpg} being processed is
  7637. compared with the reference file @file{ref.mpg}.
  7638. @example
  7639. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7640. @end example
  7641. Example with options:
  7642. @example
  7643. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7644. @end example
  7645. @section limiter
  7646. Limits the pixel components values to the specified range [min, max].
  7647. The filter accepts the following options:
  7648. @table @option
  7649. @item min
  7650. Lower bound. Defaults to the lowest allowed value for the input.
  7651. @item max
  7652. Upper bound. Defaults to the highest allowed value for the input.
  7653. @item planes
  7654. Specify which planes will be processed. Defaults to all available.
  7655. @end table
  7656. @section loop
  7657. Loop video frames.
  7658. The filter accepts the following options:
  7659. @table @option
  7660. @item loop
  7661. Set the number of loops.
  7662. @item size
  7663. Set maximal size in number of frames.
  7664. @item start
  7665. Set first frame of loop.
  7666. @end table
  7667. @anchor{lut3d}
  7668. @section lut3d
  7669. Apply a 3D LUT to an input video.
  7670. The filter accepts the following options:
  7671. @table @option
  7672. @item file
  7673. Set the 3D LUT file name.
  7674. Currently supported formats:
  7675. @table @samp
  7676. @item 3dl
  7677. AfterEffects
  7678. @item cube
  7679. Iridas
  7680. @item dat
  7681. DaVinci
  7682. @item m3d
  7683. Pandora
  7684. @end table
  7685. @item interp
  7686. Select interpolation mode.
  7687. Available values are:
  7688. @table @samp
  7689. @item nearest
  7690. Use values from the nearest defined point.
  7691. @item trilinear
  7692. Interpolate values using the 8 points defining a cube.
  7693. @item tetrahedral
  7694. Interpolate values using a tetrahedron.
  7695. @end table
  7696. @end table
  7697. This filter also supports the @ref{framesync} options.
  7698. @section lumakey
  7699. Turn certain luma values into transparency.
  7700. The filter accepts the following options:
  7701. @table @option
  7702. @item threshold
  7703. Set the luma which will be used as base for transparency.
  7704. Default value is @code{0}.
  7705. @item tolerance
  7706. Set the range of luma values to be keyed out.
  7707. Default value is @code{0}.
  7708. @item softness
  7709. Set the range of softness. Default value is @code{0}.
  7710. Use this to control gradual transition from zero to full transparency.
  7711. @end table
  7712. @section lut, lutrgb, lutyuv
  7713. Compute a look-up table for binding each pixel component input value
  7714. to an output value, and apply it to the input video.
  7715. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7716. to an RGB input video.
  7717. These filters accept the following parameters:
  7718. @table @option
  7719. @item c0
  7720. set first pixel component expression
  7721. @item c1
  7722. set second pixel component expression
  7723. @item c2
  7724. set third pixel component expression
  7725. @item c3
  7726. set fourth pixel component expression, corresponds to the alpha component
  7727. @item r
  7728. set red component expression
  7729. @item g
  7730. set green component expression
  7731. @item b
  7732. set blue component expression
  7733. @item a
  7734. alpha component expression
  7735. @item y
  7736. set Y/luminance component expression
  7737. @item u
  7738. set U/Cb component expression
  7739. @item v
  7740. set V/Cr component expression
  7741. @end table
  7742. Each of them specifies the expression to use for computing the lookup table for
  7743. the corresponding pixel component values.
  7744. The exact component associated to each of the @var{c*} options depends on the
  7745. format in input.
  7746. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7747. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7748. The expressions can contain the following constants and functions:
  7749. @table @option
  7750. @item w
  7751. @item h
  7752. The input width and height.
  7753. @item val
  7754. The input value for the pixel component.
  7755. @item clipval
  7756. The input value, clipped to the @var{minval}-@var{maxval} range.
  7757. @item maxval
  7758. The maximum value for the pixel component.
  7759. @item minval
  7760. The minimum value for the pixel component.
  7761. @item negval
  7762. The negated value for the pixel component value, clipped to the
  7763. @var{minval}-@var{maxval} range; it corresponds to the expression
  7764. "maxval-clipval+minval".
  7765. @item clip(val)
  7766. The computed value in @var{val}, clipped to the
  7767. @var{minval}-@var{maxval} range.
  7768. @item gammaval(gamma)
  7769. The computed gamma correction value of the pixel component value,
  7770. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7771. expression
  7772. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7773. @end table
  7774. All expressions default to "val".
  7775. @subsection Examples
  7776. @itemize
  7777. @item
  7778. Negate input video:
  7779. @example
  7780. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7781. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7782. @end example
  7783. The above is the same as:
  7784. @example
  7785. lutrgb="r=negval:g=negval:b=negval"
  7786. lutyuv="y=negval:u=negval:v=negval"
  7787. @end example
  7788. @item
  7789. Negate luminance:
  7790. @example
  7791. lutyuv=y=negval
  7792. @end example
  7793. @item
  7794. Remove chroma components, turning the video into a graytone image:
  7795. @example
  7796. lutyuv="u=128:v=128"
  7797. @end example
  7798. @item
  7799. Apply a luma burning effect:
  7800. @example
  7801. lutyuv="y=2*val"
  7802. @end example
  7803. @item
  7804. Remove green and blue components:
  7805. @example
  7806. lutrgb="g=0:b=0"
  7807. @end example
  7808. @item
  7809. Set a constant alpha channel value on input:
  7810. @example
  7811. format=rgba,lutrgb=a="maxval-minval/2"
  7812. @end example
  7813. @item
  7814. Correct luminance gamma by a factor of 0.5:
  7815. @example
  7816. lutyuv=y=gammaval(0.5)
  7817. @end example
  7818. @item
  7819. Discard least significant bits of luma:
  7820. @example
  7821. lutyuv=y='bitand(val, 128+64+32)'
  7822. @end example
  7823. @item
  7824. Technicolor like effect:
  7825. @example
  7826. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7827. @end example
  7828. @end itemize
  7829. @section lut2, tlut2
  7830. The @code{lut2} filter takes two input streams and outputs one
  7831. stream.
  7832. The @code{tlut2} (time lut2) filter takes two consecutive frames
  7833. from one single stream.
  7834. This filter accepts the following parameters:
  7835. @table @option
  7836. @item c0
  7837. set first pixel component expression
  7838. @item c1
  7839. set second pixel component expression
  7840. @item c2
  7841. set third pixel component expression
  7842. @item c3
  7843. set fourth pixel component expression, corresponds to the alpha component
  7844. @end table
  7845. Each of them specifies the expression to use for computing the lookup table for
  7846. the corresponding pixel component values.
  7847. The exact component associated to each of the @var{c*} options depends on the
  7848. format in inputs.
  7849. The expressions can contain the following constants:
  7850. @table @option
  7851. @item w
  7852. @item h
  7853. The input width and height.
  7854. @item x
  7855. The first input value for the pixel component.
  7856. @item y
  7857. The second input value for the pixel component.
  7858. @item bdx
  7859. The first input video bit depth.
  7860. @item bdy
  7861. The second input video bit depth.
  7862. @end table
  7863. All expressions default to "x".
  7864. @subsection Examples
  7865. @itemize
  7866. @item
  7867. Highlight differences between two RGB video streams:
  7868. @example
  7869. 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)'
  7870. @end example
  7871. @item
  7872. Highlight differences between two YUV video streams:
  7873. @example
  7874. 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)'
  7875. @end example
  7876. @item
  7877. Show max difference between two video streams:
  7878. @example
  7879. 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)))'
  7880. @end example
  7881. @end itemize
  7882. @section maskedclamp
  7883. Clamp the first input stream with the second input and third input stream.
  7884. Returns the value of first stream to be between second input
  7885. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7886. This filter accepts the following options:
  7887. @table @option
  7888. @item undershoot
  7889. Default value is @code{0}.
  7890. @item overshoot
  7891. Default value is @code{0}.
  7892. @item planes
  7893. Set which planes will be processed as bitmap, unprocessed planes will be
  7894. copied from first stream.
  7895. By default value 0xf, all planes will be processed.
  7896. @end table
  7897. @section maskedmerge
  7898. Merge the first input stream with the second input stream using per pixel
  7899. weights in the third input stream.
  7900. A value of 0 in the third stream pixel component means that pixel component
  7901. from first stream is returned unchanged, while maximum value (eg. 255 for
  7902. 8-bit videos) means that pixel component from second stream is returned
  7903. unchanged. Intermediate values define the amount of merging between both
  7904. input stream's pixel components.
  7905. This filter accepts the following options:
  7906. @table @option
  7907. @item planes
  7908. Set which planes will be processed as bitmap, unprocessed planes will be
  7909. copied from first stream.
  7910. By default value 0xf, all planes will be processed.
  7911. @end table
  7912. @section mcdeint
  7913. Apply motion-compensation deinterlacing.
  7914. It needs one field per frame as input and must thus be used together
  7915. with yadif=1/3 or equivalent.
  7916. This filter accepts the following options:
  7917. @table @option
  7918. @item mode
  7919. Set the deinterlacing mode.
  7920. It accepts one of the following values:
  7921. @table @samp
  7922. @item fast
  7923. @item medium
  7924. @item slow
  7925. use iterative motion estimation
  7926. @item extra_slow
  7927. like @samp{slow}, but use multiple reference frames.
  7928. @end table
  7929. Default value is @samp{fast}.
  7930. @item parity
  7931. Set the picture field parity assumed for the input video. It must be
  7932. one of the following values:
  7933. @table @samp
  7934. @item 0, tff
  7935. assume top field first
  7936. @item 1, bff
  7937. assume bottom field first
  7938. @end table
  7939. Default value is @samp{bff}.
  7940. @item qp
  7941. Set per-block quantization parameter (QP) used by the internal
  7942. encoder.
  7943. Higher values should result in a smoother motion vector field but less
  7944. optimal individual vectors. Default value is 1.
  7945. @end table
  7946. @section mergeplanes
  7947. Merge color channel components from several video streams.
  7948. The filter accepts up to 4 input streams, and merge selected input
  7949. planes to the output video.
  7950. This filter accepts the following options:
  7951. @table @option
  7952. @item mapping
  7953. Set input to output plane mapping. Default is @code{0}.
  7954. The mappings is specified as a bitmap. It should be specified as a
  7955. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7956. mapping for the first plane of the output stream. 'A' sets the number of
  7957. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7958. corresponding input to use (from 0 to 3). The rest of the mappings is
  7959. similar, 'Bb' describes the mapping for the output stream second
  7960. plane, 'Cc' describes the mapping for the output stream third plane and
  7961. 'Dd' describes the mapping for the output stream fourth plane.
  7962. @item format
  7963. Set output pixel format. Default is @code{yuva444p}.
  7964. @end table
  7965. @subsection Examples
  7966. @itemize
  7967. @item
  7968. Merge three gray video streams of same width and height into single video stream:
  7969. @example
  7970. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7971. @end example
  7972. @item
  7973. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7974. @example
  7975. [a0][a1]mergeplanes=0x00010210:yuva444p
  7976. @end example
  7977. @item
  7978. Swap Y and A plane in yuva444p stream:
  7979. @example
  7980. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7981. @end example
  7982. @item
  7983. Swap U and V plane in yuv420p stream:
  7984. @example
  7985. format=yuv420p,mergeplanes=0x000201:yuv420p
  7986. @end example
  7987. @item
  7988. Cast a rgb24 clip to yuv444p:
  7989. @example
  7990. format=rgb24,mergeplanes=0x000102:yuv444p
  7991. @end example
  7992. @end itemize
  7993. @section mestimate
  7994. Estimate and export motion vectors using block matching algorithms.
  7995. Motion vectors are stored in frame side data to be used by other filters.
  7996. This filter accepts the following options:
  7997. @table @option
  7998. @item method
  7999. Specify the motion estimation method. Accepts one of the following values:
  8000. @table @samp
  8001. @item esa
  8002. Exhaustive search algorithm.
  8003. @item tss
  8004. Three step search algorithm.
  8005. @item tdls
  8006. Two dimensional logarithmic search algorithm.
  8007. @item ntss
  8008. New three step search algorithm.
  8009. @item fss
  8010. Four step search algorithm.
  8011. @item ds
  8012. Diamond search algorithm.
  8013. @item hexbs
  8014. Hexagon-based search algorithm.
  8015. @item epzs
  8016. Enhanced predictive zonal search algorithm.
  8017. @item umh
  8018. Uneven multi-hexagon search algorithm.
  8019. @end table
  8020. Default value is @samp{esa}.
  8021. @item mb_size
  8022. Macroblock size. Default @code{16}.
  8023. @item search_param
  8024. Search parameter. Default @code{7}.
  8025. @end table
  8026. @section midequalizer
  8027. Apply Midway Image Equalization effect using two video streams.
  8028. Midway Image Equalization adjusts a pair of images to have the same
  8029. histogram, while maintaining their dynamics as much as possible. It's
  8030. useful for e.g. matching exposures from a pair of stereo cameras.
  8031. This filter has two inputs and one output, which must be of same pixel format, but
  8032. may be of different sizes. The output of filter is first input adjusted with
  8033. midway histogram of both inputs.
  8034. This filter accepts the following option:
  8035. @table @option
  8036. @item planes
  8037. Set which planes to process. Default is @code{15}, which is all available planes.
  8038. @end table
  8039. @section minterpolate
  8040. Convert the video to specified frame rate using motion interpolation.
  8041. This filter accepts the following options:
  8042. @table @option
  8043. @item fps
  8044. 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}.
  8045. @item mi_mode
  8046. Motion interpolation mode. Following values are accepted:
  8047. @table @samp
  8048. @item dup
  8049. Duplicate previous or next frame for interpolating new ones.
  8050. @item blend
  8051. Blend source frames. Interpolated frame is mean of previous and next frames.
  8052. @item mci
  8053. Motion compensated interpolation. Following options are effective when this mode is selected:
  8054. @table @samp
  8055. @item mc_mode
  8056. Motion compensation mode. Following values are accepted:
  8057. @table @samp
  8058. @item obmc
  8059. Overlapped block motion compensation.
  8060. @item aobmc
  8061. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8062. @end table
  8063. Default mode is @samp{obmc}.
  8064. @item me_mode
  8065. Motion estimation mode. Following values are accepted:
  8066. @table @samp
  8067. @item bidir
  8068. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8069. @item bilat
  8070. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8071. @end table
  8072. Default mode is @samp{bilat}.
  8073. @item me
  8074. The algorithm to be used for motion estimation. Following values are accepted:
  8075. @table @samp
  8076. @item esa
  8077. Exhaustive search algorithm.
  8078. @item tss
  8079. Three step search algorithm.
  8080. @item tdls
  8081. Two dimensional logarithmic search algorithm.
  8082. @item ntss
  8083. New three step search algorithm.
  8084. @item fss
  8085. Four step search algorithm.
  8086. @item ds
  8087. Diamond search algorithm.
  8088. @item hexbs
  8089. Hexagon-based search algorithm.
  8090. @item epzs
  8091. Enhanced predictive zonal search algorithm.
  8092. @item umh
  8093. Uneven multi-hexagon search algorithm.
  8094. @end table
  8095. Default algorithm is @samp{epzs}.
  8096. @item mb_size
  8097. Macroblock size. Default @code{16}.
  8098. @item search_param
  8099. Motion estimation search parameter. Default @code{32}.
  8100. @item vsbmc
  8101. 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).
  8102. @end table
  8103. @end table
  8104. @item scd
  8105. 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:
  8106. @table @samp
  8107. @item none
  8108. Disable scene change detection.
  8109. @item fdiff
  8110. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8111. @end table
  8112. Default method is @samp{fdiff}.
  8113. @item scd_threshold
  8114. Scene change detection threshold. Default is @code{5.0}.
  8115. @end table
  8116. @section mpdecimate
  8117. Drop frames that do not differ greatly from the previous frame in
  8118. order to reduce frame rate.
  8119. The main use of this filter is for very-low-bitrate encoding
  8120. (e.g. streaming over dialup modem), but it could in theory be used for
  8121. fixing movies that were inverse-telecined incorrectly.
  8122. A description of the accepted options follows.
  8123. @table @option
  8124. @item max
  8125. Set the maximum number of consecutive frames which can be dropped (if
  8126. positive), or the minimum interval between dropped frames (if
  8127. negative). If the value is 0, the frame is dropped disregarding the
  8128. number of previous sequentially dropped frames.
  8129. Default value is 0.
  8130. @item hi
  8131. @item lo
  8132. @item frac
  8133. Set the dropping threshold values.
  8134. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8135. represent actual pixel value differences, so a threshold of 64
  8136. corresponds to 1 unit of difference for each pixel, or the same spread
  8137. out differently over the block.
  8138. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8139. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8140. meaning the whole image) differ by more than a threshold of @option{lo}.
  8141. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8142. 64*5, and default value for @option{frac} is 0.33.
  8143. @end table
  8144. @section negate
  8145. Negate input video.
  8146. It accepts an integer in input; if non-zero it negates the
  8147. alpha component (if available). The default value in input is 0.
  8148. @section nlmeans
  8149. Denoise frames using Non-Local Means algorithm.
  8150. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8151. context similarity is defined by comparing their surrounding patches of size
  8152. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8153. around the pixel.
  8154. Note that the research area defines centers for patches, which means some
  8155. patches will be made of pixels outside that research area.
  8156. The filter accepts the following options.
  8157. @table @option
  8158. @item s
  8159. Set denoising strength.
  8160. @item p
  8161. Set patch size.
  8162. @item pc
  8163. Same as @option{p} but for chroma planes.
  8164. The default value is @var{0} and means automatic.
  8165. @item r
  8166. Set research size.
  8167. @item rc
  8168. Same as @option{r} but for chroma planes.
  8169. The default value is @var{0} and means automatic.
  8170. @end table
  8171. @section nnedi
  8172. Deinterlace video using neural network edge directed interpolation.
  8173. This filter accepts the following options:
  8174. @table @option
  8175. @item weights
  8176. Mandatory option, without binary file filter can not work.
  8177. Currently file can be found here:
  8178. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8179. @item deint
  8180. Set which frames to deinterlace, by default it is @code{all}.
  8181. Can be @code{all} or @code{interlaced}.
  8182. @item field
  8183. Set mode of operation.
  8184. Can be one of the following:
  8185. @table @samp
  8186. @item af
  8187. Use frame flags, both fields.
  8188. @item a
  8189. Use frame flags, single field.
  8190. @item t
  8191. Use top field only.
  8192. @item b
  8193. Use bottom field only.
  8194. @item tf
  8195. Use both fields, top first.
  8196. @item bf
  8197. Use both fields, bottom first.
  8198. @end table
  8199. @item planes
  8200. Set which planes to process, by default filter process all frames.
  8201. @item nsize
  8202. Set size of local neighborhood around each pixel, used by the predictor neural
  8203. network.
  8204. Can be one of the following:
  8205. @table @samp
  8206. @item s8x6
  8207. @item s16x6
  8208. @item s32x6
  8209. @item s48x6
  8210. @item s8x4
  8211. @item s16x4
  8212. @item s32x4
  8213. @end table
  8214. @item nns
  8215. Set the number of neurons in predictor neural network.
  8216. Can be one of the following:
  8217. @table @samp
  8218. @item n16
  8219. @item n32
  8220. @item n64
  8221. @item n128
  8222. @item n256
  8223. @end table
  8224. @item qual
  8225. Controls the number of different neural network predictions that are blended
  8226. together to compute the final output value. Can be @code{fast}, default or
  8227. @code{slow}.
  8228. @item etype
  8229. Set which set of weights to use in the predictor.
  8230. Can be one of the following:
  8231. @table @samp
  8232. @item a
  8233. weights trained to minimize absolute error
  8234. @item s
  8235. weights trained to minimize squared error
  8236. @end table
  8237. @item pscrn
  8238. Controls whether or not the prescreener neural network is used to decide
  8239. which pixels should be processed by the predictor neural network and which
  8240. can be handled by simple cubic interpolation.
  8241. The prescreener is trained to know whether cubic interpolation will be
  8242. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8243. The computational complexity of the prescreener nn is much less than that of
  8244. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8245. using the prescreener generally results in much faster processing.
  8246. The prescreener is pretty accurate, so the difference between using it and not
  8247. using it is almost always unnoticeable.
  8248. Can be one of the following:
  8249. @table @samp
  8250. @item none
  8251. @item original
  8252. @item new
  8253. @end table
  8254. Default is @code{new}.
  8255. @item fapprox
  8256. Set various debugging flags.
  8257. @end table
  8258. @section noformat
  8259. Force libavfilter not to use any of the specified pixel formats for the
  8260. input to the next filter.
  8261. It accepts the following parameters:
  8262. @table @option
  8263. @item pix_fmts
  8264. A '|'-separated list of pixel format names, such as
  8265. pix_fmts=yuv420p|monow|rgb24".
  8266. @end table
  8267. @subsection Examples
  8268. @itemize
  8269. @item
  8270. Force libavfilter to use a format different from @var{yuv420p} for the
  8271. input to the vflip filter:
  8272. @example
  8273. noformat=pix_fmts=yuv420p,vflip
  8274. @end example
  8275. @item
  8276. Convert the input video to any of the formats not contained in the list:
  8277. @example
  8278. noformat=yuv420p|yuv444p|yuv410p
  8279. @end example
  8280. @end itemize
  8281. @section noise
  8282. Add noise on video input frame.
  8283. The filter accepts the following options:
  8284. @table @option
  8285. @item all_seed
  8286. @item c0_seed
  8287. @item c1_seed
  8288. @item c2_seed
  8289. @item c3_seed
  8290. Set noise seed for specific pixel component or all pixel components in case
  8291. of @var{all_seed}. Default value is @code{123457}.
  8292. @item all_strength, alls
  8293. @item c0_strength, c0s
  8294. @item c1_strength, c1s
  8295. @item c2_strength, c2s
  8296. @item c3_strength, c3s
  8297. Set noise strength for specific pixel component or all pixel components in case
  8298. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8299. @item all_flags, allf
  8300. @item c0_flags, c0f
  8301. @item c1_flags, c1f
  8302. @item c2_flags, c2f
  8303. @item c3_flags, c3f
  8304. Set pixel component flags or set flags for all components if @var{all_flags}.
  8305. Available values for component flags are:
  8306. @table @samp
  8307. @item a
  8308. averaged temporal noise (smoother)
  8309. @item p
  8310. mix random noise with a (semi)regular pattern
  8311. @item t
  8312. temporal noise (noise pattern changes between frames)
  8313. @item u
  8314. uniform noise (gaussian otherwise)
  8315. @end table
  8316. @end table
  8317. @subsection Examples
  8318. Add temporal and uniform noise to input video:
  8319. @example
  8320. noise=alls=20:allf=t+u
  8321. @end example
  8322. @section null
  8323. Pass the video source unchanged to the output.
  8324. @section ocr
  8325. Optical Character Recognition
  8326. This filter uses Tesseract for optical character recognition.
  8327. It accepts the following options:
  8328. @table @option
  8329. @item datapath
  8330. Set datapath to tesseract data. Default is to use whatever was
  8331. set at installation.
  8332. @item language
  8333. Set language, default is "eng".
  8334. @item whitelist
  8335. Set character whitelist.
  8336. @item blacklist
  8337. Set character blacklist.
  8338. @end table
  8339. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8340. @section ocv
  8341. Apply a video transform using libopencv.
  8342. To enable this filter, install the libopencv library and headers and
  8343. configure FFmpeg with @code{--enable-libopencv}.
  8344. It accepts the following parameters:
  8345. @table @option
  8346. @item filter_name
  8347. The name of the libopencv filter to apply.
  8348. @item filter_params
  8349. The parameters to pass to the libopencv filter. If not specified, the default
  8350. values are assumed.
  8351. @end table
  8352. Refer to the official libopencv documentation for more precise
  8353. information:
  8354. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8355. Several libopencv filters are supported; see the following subsections.
  8356. @anchor{dilate}
  8357. @subsection dilate
  8358. Dilate an image by using a specific structuring element.
  8359. It corresponds to the libopencv function @code{cvDilate}.
  8360. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8361. @var{struct_el} represents a structuring element, and has the syntax:
  8362. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8363. @var{cols} and @var{rows} represent the number of columns and rows of
  8364. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8365. point, and @var{shape} the shape for the structuring element. @var{shape}
  8366. must be "rect", "cross", "ellipse", or "custom".
  8367. If the value for @var{shape} is "custom", it must be followed by a
  8368. string of the form "=@var{filename}". The file with name
  8369. @var{filename} is assumed to represent a binary image, with each
  8370. printable character corresponding to a bright pixel. When a custom
  8371. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8372. or columns and rows of the read file are assumed instead.
  8373. The default value for @var{struct_el} is "3x3+0x0/rect".
  8374. @var{nb_iterations} specifies the number of times the transform is
  8375. applied to the image, and defaults to 1.
  8376. Some examples:
  8377. @example
  8378. # Use the default values
  8379. ocv=dilate
  8380. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8381. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8382. # Read the shape from the file diamond.shape, iterating two times.
  8383. # The file diamond.shape may contain a pattern of characters like this
  8384. # *
  8385. # ***
  8386. # *****
  8387. # ***
  8388. # *
  8389. # The specified columns and rows are ignored
  8390. # but the anchor point coordinates are not
  8391. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8392. @end example
  8393. @subsection erode
  8394. Erode an image by using a specific structuring element.
  8395. It corresponds to the libopencv function @code{cvErode}.
  8396. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8397. with the same syntax and semantics as the @ref{dilate} filter.
  8398. @subsection smooth
  8399. Smooth the input video.
  8400. The filter takes the following parameters:
  8401. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8402. @var{type} is the type of smooth filter to apply, and must be one of
  8403. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8404. or "bilateral". The default value is "gaussian".
  8405. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8406. depend on the smooth type. @var{param1} and
  8407. @var{param2} accept integer positive values or 0. @var{param3} and
  8408. @var{param4} accept floating point values.
  8409. The default value for @var{param1} is 3. The default value for the
  8410. other parameters is 0.
  8411. These parameters correspond to the parameters assigned to the
  8412. libopencv function @code{cvSmooth}.
  8413. @section oscilloscope
  8414. 2D Video Oscilloscope.
  8415. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8416. It accepts the following parameters:
  8417. @table @option
  8418. @item x
  8419. Set scope center x position.
  8420. @item y
  8421. Set scope center y position.
  8422. @item s
  8423. Set scope size, relative to frame diagonal.
  8424. @item t
  8425. Set scope tilt/rotation.
  8426. @item o
  8427. Set trace opacity.
  8428. @item tx
  8429. Set trace center x position.
  8430. @item ty
  8431. Set trace center y position.
  8432. @item tw
  8433. Set trace width, relative to width of frame.
  8434. @item th
  8435. Set trace height, relative to height of frame.
  8436. @item c
  8437. Set which components to trace. By default it traces first three components.
  8438. @item g
  8439. Draw trace grid. By default is enabled.
  8440. @item st
  8441. Draw some statistics. By default is enabled.
  8442. @item sc
  8443. Draw scope. By default is enabled.
  8444. @end table
  8445. @subsection Examples
  8446. @itemize
  8447. @item
  8448. Inspect full first row of video frame.
  8449. @example
  8450. oscilloscope=x=0.5:y=0:s=1
  8451. @end example
  8452. @item
  8453. Inspect full last row of video frame.
  8454. @example
  8455. oscilloscope=x=0.5:y=1:s=1
  8456. @end example
  8457. @item
  8458. Inspect full 5th line of video frame of height 1080.
  8459. @example
  8460. oscilloscope=x=0.5:y=5/1080:s=1
  8461. @end example
  8462. @item
  8463. Inspect full last column of video frame.
  8464. @example
  8465. oscilloscope=x=1:y=0.5:s=1:t=1
  8466. @end example
  8467. @end itemize
  8468. @anchor{overlay}
  8469. @section overlay
  8470. Overlay one video on top of another.
  8471. It takes two inputs and has one output. The first input is the "main"
  8472. video on which the second input is overlaid.
  8473. It accepts the following parameters:
  8474. A description of the accepted options follows.
  8475. @table @option
  8476. @item x
  8477. @item y
  8478. Set the expression for the x and y coordinates of the overlaid video
  8479. on the main video. Default value is "0" for both expressions. In case
  8480. the expression is invalid, it is set to a huge value (meaning that the
  8481. overlay will not be displayed within the output visible area).
  8482. @item eof_action
  8483. See @ref{framesync}.
  8484. @item eval
  8485. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8486. It accepts the following values:
  8487. @table @samp
  8488. @item init
  8489. only evaluate expressions once during the filter initialization or
  8490. when a command is processed
  8491. @item frame
  8492. evaluate expressions for each incoming frame
  8493. @end table
  8494. Default value is @samp{frame}.
  8495. @item shortest
  8496. See @ref{framesync}.
  8497. @item format
  8498. Set the format for the output video.
  8499. It accepts the following values:
  8500. @table @samp
  8501. @item yuv420
  8502. force YUV420 output
  8503. @item yuv422
  8504. force YUV422 output
  8505. @item yuv444
  8506. force YUV444 output
  8507. @item rgb
  8508. force packed RGB output
  8509. @item gbrp
  8510. force planar RGB output
  8511. @item auto
  8512. automatically pick format
  8513. @end table
  8514. Default value is @samp{yuv420}.
  8515. @item repeatlast
  8516. See @ref{framesync}.
  8517. @end table
  8518. The @option{x}, and @option{y} expressions can contain the following
  8519. parameters.
  8520. @table @option
  8521. @item main_w, W
  8522. @item main_h, H
  8523. The main input width and height.
  8524. @item overlay_w, w
  8525. @item overlay_h, h
  8526. The overlay input width and height.
  8527. @item x
  8528. @item y
  8529. The computed values for @var{x} and @var{y}. They are evaluated for
  8530. each new frame.
  8531. @item hsub
  8532. @item vsub
  8533. horizontal and vertical chroma subsample values of the output
  8534. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8535. @var{vsub} is 1.
  8536. @item n
  8537. the number of input frame, starting from 0
  8538. @item pos
  8539. the position in the file of the input frame, NAN if unknown
  8540. @item t
  8541. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8542. @end table
  8543. This filter also supports the @ref{framesync} options.
  8544. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8545. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8546. when @option{eval} is set to @samp{init}.
  8547. Be aware that frames are taken from each input video in timestamp
  8548. order, hence, if their initial timestamps differ, it is a good idea
  8549. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8550. have them begin in the same zero timestamp, as the example for
  8551. the @var{movie} filter does.
  8552. You can chain together more overlays but you should test the
  8553. efficiency of such approach.
  8554. @subsection Commands
  8555. This filter supports the following commands:
  8556. @table @option
  8557. @item x
  8558. @item y
  8559. Modify the x and y of the overlay input.
  8560. The command accepts the same syntax of the corresponding option.
  8561. If the specified expression is not valid, it is kept at its current
  8562. value.
  8563. @end table
  8564. @subsection Examples
  8565. @itemize
  8566. @item
  8567. Draw the overlay at 10 pixels from the bottom right corner of the main
  8568. video:
  8569. @example
  8570. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8571. @end example
  8572. Using named options the example above becomes:
  8573. @example
  8574. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8575. @end example
  8576. @item
  8577. Insert a transparent PNG logo in the bottom left corner of the input,
  8578. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8579. @example
  8580. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8581. @end example
  8582. @item
  8583. Insert 2 different transparent PNG logos (second logo on bottom
  8584. right corner) using the @command{ffmpeg} tool:
  8585. @example
  8586. 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
  8587. @end example
  8588. @item
  8589. Add a transparent color layer on top of the main video; @code{WxH}
  8590. must specify the size of the main input to the overlay filter:
  8591. @example
  8592. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8593. @end example
  8594. @item
  8595. Play an original video and a filtered version (here with the deshake
  8596. filter) side by side using the @command{ffplay} tool:
  8597. @example
  8598. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8599. @end example
  8600. The above command is the same as:
  8601. @example
  8602. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8603. @end example
  8604. @item
  8605. Make a sliding overlay appearing from the left to the right top part of the
  8606. screen starting since time 2:
  8607. @example
  8608. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8609. @end example
  8610. @item
  8611. Compose output by putting two input videos side to side:
  8612. @example
  8613. ffmpeg -i left.avi -i right.avi -filter_complex "
  8614. nullsrc=size=200x100 [background];
  8615. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8616. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8617. [background][left] overlay=shortest=1 [background+left];
  8618. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8619. "
  8620. @end example
  8621. @item
  8622. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8623. @example
  8624. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8625. -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]'
  8626. masked.avi
  8627. @end example
  8628. @item
  8629. Chain several overlays in cascade:
  8630. @example
  8631. nullsrc=s=200x200 [bg];
  8632. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8633. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8634. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8635. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8636. [in3] null, [mid2] overlay=100:100 [out0]
  8637. @end example
  8638. @end itemize
  8639. @section owdenoise
  8640. Apply Overcomplete Wavelet denoiser.
  8641. The filter accepts the following options:
  8642. @table @option
  8643. @item depth
  8644. Set depth.
  8645. Larger depth values will denoise lower frequency components more, but
  8646. slow down filtering.
  8647. Must be an int in the range 8-16, default is @code{8}.
  8648. @item luma_strength, ls
  8649. Set luma strength.
  8650. Must be a double value in the range 0-1000, default is @code{1.0}.
  8651. @item chroma_strength, cs
  8652. Set chroma strength.
  8653. Must be a double value in the range 0-1000, default is @code{1.0}.
  8654. @end table
  8655. @anchor{pad}
  8656. @section pad
  8657. Add paddings to the input image, and place the original input at the
  8658. provided @var{x}, @var{y} coordinates.
  8659. It accepts the following parameters:
  8660. @table @option
  8661. @item width, w
  8662. @item height, h
  8663. Specify an expression for the size of the output image with the
  8664. paddings added. If the value for @var{width} or @var{height} is 0, the
  8665. corresponding input size is used for the output.
  8666. The @var{width} expression can reference the value set by the
  8667. @var{height} expression, and vice versa.
  8668. The default value of @var{width} and @var{height} is 0.
  8669. @item x
  8670. @item y
  8671. Specify the offsets to place the input image at within the padded area,
  8672. with respect to the top/left border of the output image.
  8673. The @var{x} expression can reference the value set by the @var{y}
  8674. expression, and vice versa.
  8675. The default value of @var{x} and @var{y} is 0.
  8676. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8677. so the input image is centered on the padded area.
  8678. @item color
  8679. Specify the color of the padded area. For the syntax of this option,
  8680. check the "Color" section in the ffmpeg-utils manual.
  8681. The default value of @var{color} is "black".
  8682. @item eval
  8683. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8684. It accepts the following values:
  8685. @table @samp
  8686. @item init
  8687. Only evaluate expressions once during the filter initialization or when
  8688. a command is processed.
  8689. @item frame
  8690. Evaluate expressions for each incoming frame.
  8691. @end table
  8692. Default value is @samp{init}.
  8693. @item aspect
  8694. Pad to aspect instead to a resolution.
  8695. @end table
  8696. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8697. options are expressions containing the following constants:
  8698. @table @option
  8699. @item in_w
  8700. @item in_h
  8701. The input video width and height.
  8702. @item iw
  8703. @item ih
  8704. These are the same as @var{in_w} and @var{in_h}.
  8705. @item out_w
  8706. @item out_h
  8707. The output width and height (the size of the padded area), as
  8708. specified by the @var{width} and @var{height} expressions.
  8709. @item ow
  8710. @item oh
  8711. These are the same as @var{out_w} and @var{out_h}.
  8712. @item x
  8713. @item y
  8714. The x and y offsets as specified by the @var{x} and @var{y}
  8715. expressions, or NAN if not yet specified.
  8716. @item a
  8717. same as @var{iw} / @var{ih}
  8718. @item sar
  8719. input sample aspect ratio
  8720. @item dar
  8721. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8722. @item hsub
  8723. @item vsub
  8724. The horizontal and vertical chroma subsample values. For example for the
  8725. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8726. @end table
  8727. @subsection Examples
  8728. @itemize
  8729. @item
  8730. Add paddings with the color "violet" to the input video. The output video
  8731. size is 640x480, and the top-left corner of the input video is placed at
  8732. column 0, row 40
  8733. @example
  8734. pad=640:480:0:40:violet
  8735. @end example
  8736. The example above is equivalent to the following command:
  8737. @example
  8738. pad=width=640:height=480:x=0:y=40:color=violet
  8739. @end example
  8740. @item
  8741. Pad the input to get an output with dimensions increased by 3/2,
  8742. and put the input video at the center of the padded area:
  8743. @example
  8744. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8745. @end example
  8746. @item
  8747. Pad the input to get a squared output with size equal to the maximum
  8748. value between the input width and height, and put the input video at
  8749. the center of the padded area:
  8750. @example
  8751. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8752. @end example
  8753. @item
  8754. Pad the input to get a final w/h ratio of 16:9:
  8755. @example
  8756. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8757. @end example
  8758. @item
  8759. In case of anamorphic video, in order to set the output display aspect
  8760. correctly, it is necessary to use @var{sar} in the expression,
  8761. according to the relation:
  8762. @example
  8763. (ih * X / ih) * sar = output_dar
  8764. X = output_dar / sar
  8765. @end example
  8766. Thus the previous example needs to be modified to:
  8767. @example
  8768. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8769. @end example
  8770. @item
  8771. Double the output size and put the input video in the bottom-right
  8772. corner of the output padded area:
  8773. @example
  8774. pad="2*iw:2*ih:ow-iw:oh-ih"
  8775. @end example
  8776. @end itemize
  8777. @anchor{palettegen}
  8778. @section palettegen
  8779. Generate one palette for a whole video stream.
  8780. It accepts the following options:
  8781. @table @option
  8782. @item max_colors
  8783. Set the maximum number of colors to quantize in the palette.
  8784. Note: the palette will still contain 256 colors; the unused palette entries
  8785. will be black.
  8786. @item reserve_transparent
  8787. Create a palette of 255 colors maximum and reserve the last one for
  8788. transparency. Reserving the transparency color is useful for GIF optimization.
  8789. If not set, the maximum of colors in the palette will be 256. You probably want
  8790. to disable this option for a standalone image.
  8791. Set by default.
  8792. @item transparency_color
  8793. Set the color that will be used as background for transparency.
  8794. @item stats_mode
  8795. Set statistics mode.
  8796. It accepts the following values:
  8797. @table @samp
  8798. @item full
  8799. Compute full frame histograms.
  8800. @item diff
  8801. Compute histograms only for the part that differs from previous frame. This
  8802. might be relevant to give more importance to the moving part of your input if
  8803. the background is static.
  8804. @item single
  8805. Compute new histogram for each frame.
  8806. @end table
  8807. Default value is @var{full}.
  8808. @end table
  8809. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8810. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8811. color quantization of the palette. This information is also visible at
  8812. @var{info} logging level.
  8813. @subsection Examples
  8814. @itemize
  8815. @item
  8816. Generate a representative palette of a given video using @command{ffmpeg}:
  8817. @example
  8818. ffmpeg -i input.mkv -vf palettegen palette.png
  8819. @end example
  8820. @end itemize
  8821. @section paletteuse
  8822. Use a palette to downsample an input video stream.
  8823. The filter takes two inputs: one video stream and a palette. The palette must
  8824. be a 256 pixels image.
  8825. It accepts the following options:
  8826. @table @option
  8827. @item dither
  8828. Select dithering mode. Available algorithms are:
  8829. @table @samp
  8830. @item bayer
  8831. Ordered 8x8 bayer dithering (deterministic)
  8832. @item heckbert
  8833. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8834. Note: this dithering is sometimes considered "wrong" and is included as a
  8835. reference.
  8836. @item floyd_steinberg
  8837. Floyd and Steingberg dithering (error diffusion)
  8838. @item sierra2
  8839. Frankie Sierra dithering v2 (error diffusion)
  8840. @item sierra2_4a
  8841. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8842. @end table
  8843. Default is @var{sierra2_4a}.
  8844. @item bayer_scale
  8845. When @var{bayer} dithering is selected, this option defines the scale of the
  8846. pattern (how much the crosshatch pattern is visible). A low value means more
  8847. visible pattern for less banding, and higher value means less visible pattern
  8848. at the cost of more banding.
  8849. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8850. @item diff_mode
  8851. If set, define the zone to process
  8852. @table @samp
  8853. @item rectangle
  8854. Only the changing rectangle will be reprocessed. This is similar to GIF
  8855. cropping/offsetting compression mechanism. This option can be useful for speed
  8856. if only a part of the image is changing, and has use cases such as limiting the
  8857. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8858. moving scene (it leads to more deterministic output if the scene doesn't change
  8859. much, and as a result less moving noise and better GIF compression).
  8860. @end table
  8861. Default is @var{none}.
  8862. @item new
  8863. Take new palette for each output frame.
  8864. @item alpha_threshold
  8865. Sets the alpha threshold for transparency. Alpha values above this threshold
  8866. will be treated as completely opaque, and values below this threshold will be
  8867. treated as completely transparent.
  8868. The option must be an integer value in the range [0,255]. Default is @var{128}.
  8869. @end table
  8870. @subsection Examples
  8871. @itemize
  8872. @item
  8873. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8874. using @command{ffmpeg}:
  8875. @example
  8876. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8877. @end example
  8878. @end itemize
  8879. @section perspective
  8880. Correct perspective of video not recorded perpendicular to the screen.
  8881. A description of the accepted parameters follows.
  8882. @table @option
  8883. @item x0
  8884. @item y0
  8885. @item x1
  8886. @item y1
  8887. @item x2
  8888. @item y2
  8889. @item x3
  8890. @item y3
  8891. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8892. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8893. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8894. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8895. then the corners of the source will be sent to the specified coordinates.
  8896. The expressions can use the following variables:
  8897. @table @option
  8898. @item W
  8899. @item H
  8900. the width and height of video frame.
  8901. @item in
  8902. Input frame count.
  8903. @item on
  8904. Output frame count.
  8905. @end table
  8906. @item interpolation
  8907. Set interpolation for perspective correction.
  8908. It accepts the following values:
  8909. @table @samp
  8910. @item linear
  8911. @item cubic
  8912. @end table
  8913. Default value is @samp{linear}.
  8914. @item sense
  8915. Set interpretation of coordinate options.
  8916. It accepts the following values:
  8917. @table @samp
  8918. @item 0, source
  8919. Send point in the source specified by the given coordinates to
  8920. the corners of the destination.
  8921. @item 1, destination
  8922. Send the corners of the source to the point in the destination specified
  8923. by the given coordinates.
  8924. Default value is @samp{source}.
  8925. @end table
  8926. @item eval
  8927. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8928. It accepts the following values:
  8929. @table @samp
  8930. @item init
  8931. only evaluate expressions once during the filter initialization or
  8932. when a command is processed
  8933. @item frame
  8934. evaluate expressions for each incoming frame
  8935. @end table
  8936. Default value is @samp{init}.
  8937. @end table
  8938. @section phase
  8939. Delay interlaced video by one field time so that the field order changes.
  8940. The intended use is to fix PAL movies that have been captured with the
  8941. opposite field order to the film-to-video transfer.
  8942. A description of the accepted parameters follows.
  8943. @table @option
  8944. @item mode
  8945. Set phase mode.
  8946. It accepts the following values:
  8947. @table @samp
  8948. @item t
  8949. Capture field order top-first, transfer bottom-first.
  8950. Filter will delay the bottom field.
  8951. @item b
  8952. Capture field order bottom-first, transfer top-first.
  8953. Filter will delay the top field.
  8954. @item p
  8955. Capture and transfer with the same field order. This mode only exists
  8956. for the documentation of the other options to refer to, but if you
  8957. actually select it, the filter will faithfully do nothing.
  8958. @item a
  8959. Capture field order determined automatically by field flags, transfer
  8960. opposite.
  8961. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8962. basis using field flags. If no field information is available,
  8963. then this works just like @samp{u}.
  8964. @item u
  8965. Capture unknown or varying, transfer opposite.
  8966. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8967. analyzing the images and selecting the alternative that produces best
  8968. match between the fields.
  8969. @item T
  8970. Capture top-first, transfer unknown or varying.
  8971. Filter selects among @samp{t} and @samp{p} using image analysis.
  8972. @item B
  8973. Capture bottom-first, transfer unknown or varying.
  8974. Filter selects among @samp{b} and @samp{p} using image analysis.
  8975. @item A
  8976. Capture determined by field flags, transfer unknown or varying.
  8977. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8978. image analysis. If no field information is available, then this works just
  8979. like @samp{U}. This is the default mode.
  8980. @item U
  8981. Both capture and transfer unknown or varying.
  8982. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8983. @end table
  8984. @end table
  8985. @section pixdesctest
  8986. Pixel format descriptor test filter, mainly useful for internal
  8987. testing. The output video should be equal to the input video.
  8988. For example:
  8989. @example
  8990. format=monow, pixdesctest
  8991. @end example
  8992. can be used to test the monowhite pixel format descriptor definition.
  8993. @section pixscope
  8994. Display sample values of color channels. Mainly useful for checking color
  8995. and levels. Minimum supported resolution is 640x480.
  8996. The filters accept the following options:
  8997. @table @option
  8998. @item x
  8999. Set scope X position, relative offset on X axis.
  9000. @item y
  9001. Set scope Y position, relative offset on Y axis.
  9002. @item w
  9003. Set scope width.
  9004. @item h
  9005. Set scope height.
  9006. @item o
  9007. Set window opacity. This window also holds statistics about pixel area.
  9008. @item wx
  9009. Set window X position, relative offset on X axis.
  9010. @item wy
  9011. Set window Y position, relative offset on Y axis.
  9012. @end table
  9013. @section pp
  9014. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9015. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9016. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9017. Each subfilter and some options have a short and a long name that can be used
  9018. interchangeably, i.e. dr/dering are the same.
  9019. The filters accept the following options:
  9020. @table @option
  9021. @item subfilters
  9022. Set postprocessing subfilters string.
  9023. @end table
  9024. All subfilters share common options to determine their scope:
  9025. @table @option
  9026. @item a/autoq
  9027. Honor the quality commands for this subfilter.
  9028. @item c/chrom
  9029. Do chrominance filtering, too (default).
  9030. @item y/nochrom
  9031. Do luminance filtering only (no chrominance).
  9032. @item n/noluma
  9033. Do chrominance filtering only (no luminance).
  9034. @end table
  9035. These options can be appended after the subfilter name, separated by a '|'.
  9036. Available subfilters are:
  9037. @table @option
  9038. @item hb/hdeblock[|difference[|flatness]]
  9039. Horizontal deblocking filter
  9040. @table @option
  9041. @item difference
  9042. Difference factor where higher values mean more deblocking (default: @code{32}).
  9043. @item flatness
  9044. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9045. @end table
  9046. @item vb/vdeblock[|difference[|flatness]]
  9047. Vertical deblocking filter
  9048. @table @option
  9049. @item difference
  9050. Difference factor where higher values mean more deblocking (default: @code{32}).
  9051. @item flatness
  9052. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9053. @end table
  9054. @item ha/hadeblock[|difference[|flatness]]
  9055. Accurate horizontal deblocking filter
  9056. @table @option
  9057. @item difference
  9058. Difference factor where higher values mean more deblocking (default: @code{32}).
  9059. @item flatness
  9060. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9061. @end table
  9062. @item va/vadeblock[|difference[|flatness]]
  9063. Accurate vertical deblocking filter
  9064. @table @option
  9065. @item difference
  9066. Difference factor where higher values mean more deblocking (default: @code{32}).
  9067. @item flatness
  9068. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9069. @end table
  9070. @end table
  9071. The horizontal and vertical deblocking filters share the difference and
  9072. flatness values so you cannot set different horizontal and vertical
  9073. thresholds.
  9074. @table @option
  9075. @item h1/x1hdeblock
  9076. Experimental horizontal deblocking filter
  9077. @item v1/x1vdeblock
  9078. Experimental vertical deblocking filter
  9079. @item dr/dering
  9080. Deringing filter
  9081. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9082. @table @option
  9083. @item threshold1
  9084. larger -> stronger filtering
  9085. @item threshold2
  9086. larger -> stronger filtering
  9087. @item threshold3
  9088. larger -> stronger filtering
  9089. @end table
  9090. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9091. @table @option
  9092. @item f/fullyrange
  9093. Stretch luminance to @code{0-255}.
  9094. @end table
  9095. @item lb/linblenddeint
  9096. Linear blend deinterlacing filter that deinterlaces the given block by
  9097. filtering all lines with a @code{(1 2 1)} filter.
  9098. @item li/linipoldeint
  9099. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9100. linearly interpolating every second line.
  9101. @item ci/cubicipoldeint
  9102. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9103. cubically interpolating every second line.
  9104. @item md/mediandeint
  9105. Median deinterlacing filter that deinterlaces the given block by applying a
  9106. median filter to every second line.
  9107. @item fd/ffmpegdeint
  9108. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9109. second line with a @code{(-1 4 2 4 -1)} filter.
  9110. @item l5/lowpass5
  9111. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9112. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9113. @item fq/forceQuant[|quantizer]
  9114. Overrides the quantizer table from the input with the constant quantizer you
  9115. specify.
  9116. @table @option
  9117. @item quantizer
  9118. Quantizer to use
  9119. @end table
  9120. @item de/default
  9121. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9122. @item fa/fast
  9123. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9124. @item ac
  9125. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9126. @end table
  9127. @subsection Examples
  9128. @itemize
  9129. @item
  9130. Apply horizontal and vertical deblocking, deringing and automatic
  9131. brightness/contrast:
  9132. @example
  9133. pp=hb/vb/dr/al
  9134. @end example
  9135. @item
  9136. Apply default filters without brightness/contrast correction:
  9137. @example
  9138. pp=de/-al
  9139. @end example
  9140. @item
  9141. Apply default filters and temporal denoiser:
  9142. @example
  9143. pp=default/tmpnoise|1|2|3
  9144. @end example
  9145. @item
  9146. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9147. automatically depending on available CPU time:
  9148. @example
  9149. pp=hb|y/vb|a
  9150. @end example
  9151. @end itemize
  9152. @section pp7
  9153. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9154. similar to spp = 6 with 7 point DCT, where only the center sample is
  9155. used after IDCT.
  9156. The filter accepts the following options:
  9157. @table @option
  9158. @item qp
  9159. Force a constant quantization parameter. It accepts an integer in range
  9160. 0 to 63. If not set, the filter will use the QP from the video stream
  9161. (if available).
  9162. @item mode
  9163. Set thresholding mode. Available modes are:
  9164. @table @samp
  9165. @item hard
  9166. Set hard thresholding.
  9167. @item soft
  9168. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9169. @item medium
  9170. Set medium thresholding (good results, default).
  9171. @end table
  9172. @end table
  9173. @section premultiply
  9174. Apply alpha premultiply effect to input video stream using first plane
  9175. of second stream as alpha.
  9176. Both streams must have same dimensions and same pixel format.
  9177. The filter accepts the following option:
  9178. @table @option
  9179. @item planes
  9180. Set which planes will be processed, unprocessed planes will be copied.
  9181. By default value 0xf, all planes will be processed.
  9182. @item inplace
  9183. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9184. @end table
  9185. @section prewitt
  9186. Apply prewitt operator to input video stream.
  9187. The filter accepts the following option:
  9188. @table @option
  9189. @item planes
  9190. Set which planes will be processed, unprocessed planes will be copied.
  9191. By default value 0xf, all planes will be processed.
  9192. @item scale
  9193. Set value which will be multiplied with filtered result.
  9194. @item delta
  9195. Set value which will be added to filtered result.
  9196. @end table
  9197. @section pseudocolor
  9198. Alter frame colors in video with pseudocolors.
  9199. This filter accept the following options:
  9200. @table @option
  9201. @item c0
  9202. set pixel first component expression
  9203. @item c1
  9204. set pixel second component expression
  9205. @item c2
  9206. set pixel third component expression
  9207. @item c3
  9208. set pixel fourth component expression, corresponds to the alpha component
  9209. @item i
  9210. set component to use as base for altering colors
  9211. @end table
  9212. Each of them specifies the expression to use for computing the lookup table for
  9213. the corresponding pixel component values.
  9214. The expressions can contain the following constants and functions:
  9215. @table @option
  9216. @item w
  9217. @item h
  9218. The input width and height.
  9219. @item val
  9220. The input value for the pixel component.
  9221. @item ymin, umin, vmin, amin
  9222. The minimum allowed component value.
  9223. @item ymax, umax, vmax, amax
  9224. The maximum allowed component value.
  9225. @end table
  9226. All expressions default to "val".
  9227. @subsection Examples
  9228. @itemize
  9229. @item
  9230. Change too high luma values to gradient:
  9231. @example
  9232. 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'"
  9233. @end example
  9234. @end itemize
  9235. @section psnr
  9236. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9237. Ratio) between two input videos.
  9238. This filter takes in input two input videos, the first input is
  9239. considered the "main" source and is passed unchanged to the
  9240. output. The second input is used as a "reference" video for computing
  9241. the PSNR.
  9242. Both video inputs must have the same resolution and pixel format for
  9243. this filter to work correctly. Also it assumes that both inputs
  9244. have the same number of frames, which are compared one by one.
  9245. The obtained average PSNR is printed through the logging system.
  9246. The filter stores the accumulated MSE (mean squared error) of each
  9247. frame, and at the end of the processing it is averaged across all frames
  9248. equally, and the following formula is applied to obtain the PSNR:
  9249. @example
  9250. PSNR = 10*log10(MAX^2/MSE)
  9251. @end example
  9252. Where MAX is the average of the maximum values of each component of the
  9253. image.
  9254. The description of the accepted parameters follows.
  9255. @table @option
  9256. @item stats_file, f
  9257. If specified the filter will use the named file to save the PSNR of
  9258. each individual frame. When filename equals "-" the data is sent to
  9259. standard output.
  9260. @item stats_version
  9261. Specifies which version of the stats file format to use. Details of
  9262. each format are written below.
  9263. Default value is 1.
  9264. @item stats_add_max
  9265. Determines whether the max value is output to the stats log.
  9266. Default value is 0.
  9267. Requires stats_version >= 2. If this is set and stats_version < 2,
  9268. the filter will return an error.
  9269. @end table
  9270. This filter also supports the @ref{framesync} options.
  9271. The file printed if @var{stats_file} is selected, contains a sequence of
  9272. key/value pairs of the form @var{key}:@var{value} for each compared
  9273. couple of frames.
  9274. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9275. the list of per-frame-pair stats, with key value pairs following the frame
  9276. format with the following parameters:
  9277. @table @option
  9278. @item psnr_log_version
  9279. The version of the log file format. Will match @var{stats_version}.
  9280. @item fields
  9281. A comma separated list of the per-frame-pair parameters included in
  9282. the log.
  9283. @end table
  9284. A description of each shown per-frame-pair parameter follows:
  9285. @table @option
  9286. @item n
  9287. sequential number of the input frame, starting from 1
  9288. @item mse_avg
  9289. Mean Square Error pixel-by-pixel average difference of the compared
  9290. frames, averaged over all the image components.
  9291. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9292. Mean Square Error pixel-by-pixel average difference of the compared
  9293. frames for the component specified by the suffix.
  9294. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9295. Peak Signal to Noise ratio of the compared frames for the component
  9296. specified by the suffix.
  9297. @item max_avg, max_y, max_u, max_v
  9298. Maximum allowed value for each channel, and average over all
  9299. channels.
  9300. @end table
  9301. For example:
  9302. @example
  9303. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9304. [main][ref] psnr="stats_file=stats.log" [out]
  9305. @end example
  9306. On this example the input file being processed is compared with the
  9307. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9308. is stored in @file{stats.log}.
  9309. @anchor{pullup}
  9310. @section pullup
  9311. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9312. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9313. content.
  9314. The pullup filter is designed to take advantage of future context in making
  9315. its decisions. This filter is stateless in the sense that it does not lock
  9316. onto a pattern to follow, but it instead looks forward to the following
  9317. fields in order to identify matches and rebuild progressive frames.
  9318. To produce content with an even framerate, insert the fps filter after
  9319. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9320. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9321. The filter accepts the following options:
  9322. @table @option
  9323. @item jl
  9324. @item jr
  9325. @item jt
  9326. @item jb
  9327. These options set the amount of "junk" to ignore at the left, right, top, and
  9328. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9329. while top and bottom are in units of 2 lines.
  9330. The default is 8 pixels on each side.
  9331. @item sb
  9332. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9333. filter generating an occasional mismatched frame, but it may also cause an
  9334. excessive number of frames to be dropped during high motion sequences.
  9335. Conversely, setting it to -1 will make filter match fields more easily.
  9336. This may help processing of video where there is slight blurring between
  9337. the fields, but may also cause there to be interlaced frames in the output.
  9338. Default value is @code{0}.
  9339. @item mp
  9340. Set the metric plane to use. It accepts the following values:
  9341. @table @samp
  9342. @item l
  9343. Use luma plane.
  9344. @item u
  9345. Use chroma blue plane.
  9346. @item v
  9347. Use chroma red plane.
  9348. @end table
  9349. This option may be set to use chroma plane instead of the default luma plane
  9350. for doing filter's computations. This may improve accuracy on very clean
  9351. source material, but more likely will decrease accuracy, especially if there
  9352. is chroma noise (rainbow effect) or any grayscale video.
  9353. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9354. load and make pullup usable in realtime on slow machines.
  9355. @end table
  9356. For best results (without duplicated frames in the output file) it is
  9357. necessary to change the output frame rate. For example, to inverse
  9358. telecine NTSC input:
  9359. @example
  9360. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9361. @end example
  9362. @section qp
  9363. Change video quantization parameters (QP).
  9364. The filter accepts the following option:
  9365. @table @option
  9366. @item qp
  9367. Set expression for quantization parameter.
  9368. @end table
  9369. The expression is evaluated through the eval API and can contain, among others,
  9370. the following constants:
  9371. @table @var
  9372. @item known
  9373. 1 if index is not 129, 0 otherwise.
  9374. @item qp
  9375. Sequential index starting from -129 to 128.
  9376. @end table
  9377. @subsection Examples
  9378. @itemize
  9379. @item
  9380. Some equation like:
  9381. @example
  9382. qp=2+2*sin(PI*qp)
  9383. @end example
  9384. @end itemize
  9385. @section random
  9386. Flush video frames from internal cache of frames into a random order.
  9387. No frame is discarded.
  9388. Inspired by @ref{frei0r} nervous filter.
  9389. @table @option
  9390. @item frames
  9391. Set size in number of frames of internal cache, in range from @code{2} to
  9392. @code{512}. Default is @code{30}.
  9393. @item seed
  9394. Set seed for random number generator, must be an integer included between
  9395. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9396. less than @code{0}, the filter will try to use a good random seed on a
  9397. best effort basis.
  9398. @end table
  9399. @section readeia608
  9400. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9401. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9402. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9403. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9404. @table @option
  9405. @item lavfi.readeia608.X.cc
  9406. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9407. @item lavfi.readeia608.X.line
  9408. The number of the line on which the EIA-608 data was identified and read.
  9409. @end table
  9410. This filter accepts the following options:
  9411. @table @option
  9412. @item scan_min
  9413. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9414. @item scan_max
  9415. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9416. @item mac
  9417. Set minimal acceptable amplitude change for sync codes detection.
  9418. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9419. @item spw
  9420. Set the ratio of width reserved for sync code detection.
  9421. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9422. @item mhd
  9423. Set the max peaks height difference for sync code detection.
  9424. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9425. @item mpd
  9426. Set max peaks period difference for sync code detection.
  9427. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9428. @item msd
  9429. Set the first two max start code bits differences.
  9430. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9431. @item bhd
  9432. Set the minimum ratio of bits height compared to 3rd start code bit.
  9433. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9434. @item th_w
  9435. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9436. @item th_b
  9437. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9438. @item chp
  9439. Enable checking the parity bit. In the event of a parity error, the filter will output
  9440. @code{0x00} for that character. Default is false.
  9441. @end table
  9442. @subsection Examples
  9443. @itemize
  9444. @item
  9445. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9446. @example
  9447. 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
  9448. @end example
  9449. @end itemize
  9450. @section readvitc
  9451. Read vertical interval timecode (VITC) information from the top lines of a
  9452. video frame.
  9453. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9454. timecode value, if a valid timecode has been detected. Further metadata key
  9455. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9456. timecode data has been found or not.
  9457. This filter accepts the following options:
  9458. @table @option
  9459. @item scan_max
  9460. Set the maximum number of lines to scan for VITC data. If the value is set to
  9461. @code{-1} the full video frame is scanned. Default is @code{45}.
  9462. @item thr_b
  9463. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9464. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9465. @item thr_w
  9466. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9467. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9468. @end table
  9469. @subsection Examples
  9470. @itemize
  9471. @item
  9472. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9473. draw @code{--:--:--:--} as a placeholder:
  9474. @example
  9475. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9476. @end example
  9477. @end itemize
  9478. @section remap
  9479. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9480. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9481. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9482. value for pixel will be used for destination pixel.
  9483. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9484. will have Xmap/Ymap video stream dimensions.
  9485. Xmap and Ymap input video streams are 16bit depth, single channel.
  9486. @section removegrain
  9487. The removegrain filter is a spatial denoiser for progressive video.
  9488. @table @option
  9489. @item m0
  9490. Set mode for the first plane.
  9491. @item m1
  9492. Set mode for the second plane.
  9493. @item m2
  9494. Set mode for the third plane.
  9495. @item m3
  9496. Set mode for the fourth plane.
  9497. @end table
  9498. Range of mode is from 0 to 24. Description of each mode follows:
  9499. @table @var
  9500. @item 0
  9501. Leave input plane unchanged. Default.
  9502. @item 1
  9503. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9504. @item 2
  9505. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9506. @item 3
  9507. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9508. @item 4
  9509. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9510. This is equivalent to a median filter.
  9511. @item 5
  9512. Line-sensitive clipping giving the minimal change.
  9513. @item 6
  9514. Line-sensitive clipping, intermediate.
  9515. @item 7
  9516. Line-sensitive clipping, intermediate.
  9517. @item 8
  9518. Line-sensitive clipping, intermediate.
  9519. @item 9
  9520. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9521. @item 10
  9522. Replaces the target pixel with the closest neighbour.
  9523. @item 11
  9524. [1 2 1] horizontal and vertical kernel blur.
  9525. @item 12
  9526. Same as mode 11.
  9527. @item 13
  9528. Bob mode, interpolates top field from the line where the neighbours
  9529. pixels are the closest.
  9530. @item 14
  9531. Bob mode, interpolates bottom field from the line where the neighbours
  9532. pixels are the closest.
  9533. @item 15
  9534. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9535. interpolation formula.
  9536. @item 16
  9537. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9538. interpolation formula.
  9539. @item 17
  9540. Clips the pixel with the minimum and maximum of respectively the maximum and
  9541. minimum of each pair of opposite neighbour pixels.
  9542. @item 18
  9543. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9544. the current pixel is minimal.
  9545. @item 19
  9546. Replaces the pixel with the average of its 8 neighbours.
  9547. @item 20
  9548. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9549. @item 21
  9550. Clips pixels using the averages of opposite neighbour.
  9551. @item 22
  9552. Same as mode 21 but simpler and faster.
  9553. @item 23
  9554. Small edge and halo removal, but reputed useless.
  9555. @item 24
  9556. Similar as 23.
  9557. @end table
  9558. @section removelogo
  9559. Suppress a TV station logo, using an image file to determine which
  9560. pixels comprise the logo. It works by filling in the pixels that
  9561. comprise the logo with neighboring pixels.
  9562. The filter accepts the following options:
  9563. @table @option
  9564. @item filename, f
  9565. Set the filter bitmap file, which can be any image format supported by
  9566. libavformat. The width and height of the image file must match those of the
  9567. video stream being processed.
  9568. @end table
  9569. Pixels in the provided bitmap image with a value of zero are not
  9570. considered part of the logo, non-zero pixels are considered part of
  9571. the logo. If you use white (255) for the logo and black (0) for the
  9572. rest, you will be safe. For making the filter bitmap, it is
  9573. recommended to take a screen capture of a black frame with the logo
  9574. visible, and then using a threshold filter followed by the erode
  9575. filter once or twice.
  9576. If needed, little splotches can be fixed manually. Remember that if
  9577. logo pixels are not covered, the filter quality will be much
  9578. reduced. Marking too many pixels as part of the logo does not hurt as
  9579. much, but it will increase the amount of blurring needed to cover over
  9580. the image and will destroy more information than necessary, and extra
  9581. pixels will slow things down on a large logo.
  9582. @section repeatfields
  9583. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9584. fields based on its value.
  9585. @section reverse
  9586. Reverse a video clip.
  9587. Warning: This filter requires memory to buffer the entire clip, so trimming
  9588. is suggested.
  9589. @subsection Examples
  9590. @itemize
  9591. @item
  9592. Take the first 5 seconds of a clip, and reverse it.
  9593. @example
  9594. trim=end=5,reverse
  9595. @end example
  9596. @end itemize
  9597. @section roberts
  9598. Apply roberts cross operator to input video stream.
  9599. The filter accepts the following option:
  9600. @table @option
  9601. @item planes
  9602. Set which planes will be processed, unprocessed planes will be copied.
  9603. By default value 0xf, all planes will be processed.
  9604. @item scale
  9605. Set value which will be multiplied with filtered result.
  9606. @item delta
  9607. Set value which will be added to filtered result.
  9608. @end table
  9609. @section rotate
  9610. Rotate video by an arbitrary angle expressed in radians.
  9611. The filter accepts the following options:
  9612. A description of the optional parameters follows.
  9613. @table @option
  9614. @item angle, a
  9615. Set an expression for the angle by which to rotate the input video
  9616. clockwise, expressed as a number of radians. A negative value will
  9617. result in a counter-clockwise rotation. By default it is set to "0".
  9618. This expression is evaluated for each frame.
  9619. @item out_w, ow
  9620. Set the output width expression, default value is "iw".
  9621. This expression is evaluated just once during configuration.
  9622. @item out_h, oh
  9623. Set the output height expression, default value is "ih".
  9624. This expression is evaluated just once during configuration.
  9625. @item bilinear
  9626. Enable bilinear interpolation if set to 1, a value of 0 disables
  9627. it. Default value is 1.
  9628. @item fillcolor, c
  9629. Set the color used to fill the output area not covered by the rotated
  9630. image. For the general syntax of this option, check the "Color" section in the
  9631. ffmpeg-utils manual. If the special value "none" is selected then no
  9632. background is printed (useful for example if the background is never shown).
  9633. Default value is "black".
  9634. @end table
  9635. The expressions for the angle and the output size can contain the
  9636. following constants and functions:
  9637. @table @option
  9638. @item n
  9639. sequential number of the input frame, starting from 0. It is always NAN
  9640. before the first frame is filtered.
  9641. @item t
  9642. time in seconds of the input frame, it is set to 0 when the filter is
  9643. configured. It is always NAN before the first frame is filtered.
  9644. @item hsub
  9645. @item vsub
  9646. horizontal and vertical chroma subsample values. For example for the
  9647. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9648. @item in_w, iw
  9649. @item in_h, ih
  9650. the input video width and height
  9651. @item out_w, ow
  9652. @item out_h, oh
  9653. the output width and height, that is the size of the padded area as
  9654. specified by the @var{width} and @var{height} expressions
  9655. @item rotw(a)
  9656. @item roth(a)
  9657. the minimal width/height required for completely containing the input
  9658. video rotated by @var{a} radians.
  9659. These are only available when computing the @option{out_w} and
  9660. @option{out_h} expressions.
  9661. @end table
  9662. @subsection Examples
  9663. @itemize
  9664. @item
  9665. Rotate the input by PI/6 radians clockwise:
  9666. @example
  9667. rotate=PI/6
  9668. @end example
  9669. @item
  9670. Rotate the input by PI/6 radians counter-clockwise:
  9671. @example
  9672. rotate=-PI/6
  9673. @end example
  9674. @item
  9675. Rotate the input by 45 degrees clockwise:
  9676. @example
  9677. rotate=45*PI/180
  9678. @end example
  9679. @item
  9680. Apply a constant rotation with period T, starting from an angle of PI/3:
  9681. @example
  9682. rotate=PI/3+2*PI*t/T
  9683. @end example
  9684. @item
  9685. Make the input video rotation oscillating with a period of T
  9686. seconds and an amplitude of A radians:
  9687. @example
  9688. rotate=A*sin(2*PI/T*t)
  9689. @end example
  9690. @item
  9691. Rotate the video, output size is chosen so that the whole rotating
  9692. input video is always completely contained in the output:
  9693. @example
  9694. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9695. @end example
  9696. @item
  9697. Rotate the video, reduce the output size so that no background is ever
  9698. shown:
  9699. @example
  9700. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9701. @end example
  9702. @end itemize
  9703. @subsection Commands
  9704. The filter supports the following commands:
  9705. @table @option
  9706. @item a, angle
  9707. Set the angle expression.
  9708. The command accepts the same syntax of the corresponding option.
  9709. If the specified expression is not valid, it is kept at its current
  9710. value.
  9711. @end table
  9712. @section sab
  9713. Apply Shape Adaptive Blur.
  9714. The filter accepts the following options:
  9715. @table @option
  9716. @item luma_radius, lr
  9717. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9718. value is 1.0. A greater value will result in a more blurred image, and
  9719. in slower processing.
  9720. @item luma_pre_filter_radius, lpfr
  9721. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9722. value is 1.0.
  9723. @item luma_strength, ls
  9724. Set luma maximum difference between pixels to still be considered, must
  9725. be a value in the 0.1-100.0 range, default value is 1.0.
  9726. @item chroma_radius, cr
  9727. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9728. greater value will result in a more blurred image, and in slower
  9729. processing.
  9730. @item chroma_pre_filter_radius, cpfr
  9731. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9732. @item chroma_strength, cs
  9733. Set chroma maximum difference between pixels to still be considered,
  9734. must be a value in the -0.9-100.0 range.
  9735. @end table
  9736. Each chroma option value, if not explicitly specified, is set to the
  9737. corresponding luma option value.
  9738. @anchor{scale}
  9739. @section scale
  9740. Scale (resize) the input video, using the libswscale library.
  9741. The scale filter forces the output display aspect ratio to be the same
  9742. of the input, by changing the output sample aspect ratio.
  9743. If the input image format is different from the format requested by
  9744. the next filter, the scale filter will convert the input to the
  9745. requested format.
  9746. @subsection Options
  9747. The filter accepts the following options, or any of the options
  9748. supported by the libswscale scaler.
  9749. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9750. the complete list of scaler options.
  9751. @table @option
  9752. @item width, w
  9753. @item height, h
  9754. Set the output video dimension expression. Default value is the input
  9755. dimension.
  9756. If the @var{width} or @var{w} value is 0, the input width is used for
  9757. the output. If the @var{height} or @var{h} value is 0, the input height
  9758. is used for the output.
  9759. If one and only one of the values is -n with n >= 1, the scale filter
  9760. will use a value that maintains the aspect ratio of the input image,
  9761. calculated from the other specified dimension. After that it will,
  9762. however, make sure that the calculated dimension is divisible by n and
  9763. adjust the value if necessary.
  9764. If both values are -n with n >= 1, the behavior will be identical to
  9765. both values being set to 0 as previously detailed.
  9766. See below for the list of accepted constants for use in the dimension
  9767. expression.
  9768. @item eval
  9769. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9770. @table @samp
  9771. @item init
  9772. Only evaluate expressions once during the filter initialization or when a command is processed.
  9773. @item frame
  9774. Evaluate expressions for each incoming frame.
  9775. @end table
  9776. Default value is @samp{init}.
  9777. @item interl
  9778. Set the interlacing mode. It accepts the following values:
  9779. @table @samp
  9780. @item 1
  9781. Force interlaced aware scaling.
  9782. @item 0
  9783. Do not apply interlaced scaling.
  9784. @item -1
  9785. Select interlaced aware scaling depending on whether the source frames
  9786. are flagged as interlaced or not.
  9787. @end table
  9788. Default value is @samp{0}.
  9789. @item flags
  9790. Set libswscale scaling flags. See
  9791. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9792. complete list of values. If not explicitly specified the filter applies
  9793. the default flags.
  9794. @item param0, param1
  9795. Set libswscale input parameters for scaling algorithms that need them. See
  9796. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9797. complete documentation. If not explicitly specified the filter applies
  9798. empty parameters.
  9799. @item size, s
  9800. Set the video size. For the syntax of this option, check the
  9801. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9802. @item in_color_matrix
  9803. @item out_color_matrix
  9804. Set in/output YCbCr color space type.
  9805. This allows the autodetected value to be overridden as well as allows forcing
  9806. a specific value used for the output and encoder.
  9807. If not specified, the color space type depends on the pixel format.
  9808. Possible values:
  9809. @table @samp
  9810. @item auto
  9811. Choose automatically.
  9812. @item bt709
  9813. Format conforming to International Telecommunication Union (ITU)
  9814. Recommendation BT.709.
  9815. @item fcc
  9816. Set color space conforming to the United States Federal Communications
  9817. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9818. @item bt601
  9819. Set color space conforming to:
  9820. @itemize
  9821. @item
  9822. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9823. @item
  9824. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9825. @item
  9826. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9827. @end itemize
  9828. @item smpte240m
  9829. Set color space conforming to SMPTE ST 240:1999.
  9830. @end table
  9831. @item in_range
  9832. @item out_range
  9833. Set in/output YCbCr sample range.
  9834. This allows the autodetected value to be overridden as well as allows forcing
  9835. a specific value used for the output and encoder. If not specified, the
  9836. range depends on the pixel format. Possible values:
  9837. @table @samp
  9838. @item auto
  9839. Choose automatically.
  9840. @item jpeg/full/pc
  9841. Set full range (0-255 in case of 8-bit luma).
  9842. @item mpeg/tv
  9843. Set "MPEG" range (16-235 in case of 8-bit luma).
  9844. @end table
  9845. @item force_original_aspect_ratio
  9846. Enable decreasing or increasing output video width or height if necessary to
  9847. keep the original aspect ratio. Possible values:
  9848. @table @samp
  9849. @item disable
  9850. Scale the video as specified and disable this feature.
  9851. @item decrease
  9852. The output video dimensions will automatically be decreased if needed.
  9853. @item increase
  9854. The output video dimensions will automatically be increased if needed.
  9855. @end table
  9856. One useful instance of this option is that when you know a specific device's
  9857. maximum allowed resolution, you can use this to limit the output video to
  9858. that, while retaining the aspect ratio. For example, device A allows
  9859. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9860. decrease) and specifying 1280x720 to the command line makes the output
  9861. 1280x533.
  9862. Please note that this is a different thing than specifying -1 for @option{w}
  9863. or @option{h}, you still need to specify the output resolution for this option
  9864. to work.
  9865. @end table
  9866. The values of the @option{w} and @option{h} options are expressions
  9867. containing the following constants:
  9868. @table @var
  9869. @item in_w
  9870. @item in_h
  9871. The input width and height
  9872. @item iw
  9873. @item ih
  9874. These are the same as @var{in_w} and @var{in_h}.
  9875. @item out_w
  9876. @item out_h
  9877. The output (scaled) width and height
  9878. @item ow
  9879. @item oh
  9880. These are the same as @var{out_w} and @var{out_h}
  9881. @item a
  9882. The same as @var{iw} / @var{ih}
  9883. @item sar
  9884. input sample aspect ratio
  9885. @item dar
  9886. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9887. @item hsub
  9888. @item vsub
  9889. horizontal and vertical input chroma subsample values. For example for the
  9890. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9891. @item ohsub
  9892. @item ovsub
  9893. horizontal and vertical output chroma subsample values. For example for the
  9894. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9895. @end table
  9896. @subsection Examples
  9897. @itemize
  9898. @item
  9899. Scale the input video to a size of 200x100
  9900. @example
  9901. scale=w=200:h=100
  9902. @end example
  9903. This is equivalent to:
  9904. @example
  9905. scale=200:100
  9906. @end example
  9907. or:
  9908. @example
  9909. scale=200x100
  9910. @end example
  9911. @item
  9912. Specify a size abbreviation for the output size:
  9913. @example
  9914. scale=qcif
  9915. @end example
  9916. which can also be written as:
  9917. @example
  9918. scale=size=qcif
  9919. @end example
  9920. @item
  9921. Scale the input to 2x:
  9922. @example
  9923. scale=w=2*iw:h=2*ih
  9924. @end example
  9925. @item
  9926. The above is the same as:
  9927. @example
  9928. scale=2*in_w:2*in_h
  9929. @end example
  9930. @item
  9931. Scale the input to 2x with forced interlaced scaling:
  9932. @example
  9933. scale=2*iw:2*ih:interl=1
  9934. @end example
  9935. @item
  9936. Scale the input to half size:
  9937. @example
  9938. scale=w=iw/2:h=ih/2
  9939. @end example
  9940. @item
  9941. Increase the width, and set the height to the same size:
  9942. @example
  9943. scale=3/2*iw:ow
  9944. @end example
  9945. @item
  9946. Seek Greek harmony:
  9947. @example
  9948. scale=iw:1/PHI*iw
  9949. scale=ih*PHI:ih
  9950. @end example
  9951. @item
  9952. Increase the height, and set the width to 3/2 of the height:
  9953. @example
  9954. scale=w=3/2*oh:h=3/5*ih
  9955. @end example
  9956. @item
  9957. Increase the size, making the size a multiple of the chroma
  9958. subsample values:
  9959. @example
  9960. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9961. @end example
  9962. @item
  9963. Increase the width to a maximum of 500 pixels,
  9964. keeping the same aspect ratio as the input:
  9965. @example
  9966. scale=w='min(500\, iw*3/2):h=-1'
  9967. @end example
  9968. @end itemize
  9969. @subsection Commands
  9970. This filter supports the following commands:
  9971. @table @option
  9972. @item width, w
  9973. @item height, h
  9974. Set the output video dimension expression.
  9975. The command accepts the same syntax of the corresponding option.
  9976. If the specified expression is not valid, it is kept at its current
  9977. value.
  9978. @end table
  9979. @section scale_npp
  9980. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9981. format conversion on CUDA video frames. Setting the output width and height
  9982. works in the same way as for the @var{scale} filter.
  9983. The following additional options are accepted:
  9984. @table @option
  9985. @item format
  9986. The pixel format of the output CUDA frames. If set to the string "same" (the
  9987. default), the input format will be kept. Note that automatic format negotiation
  9988. and conversion is not yet supported for hardware frames
  9989. @item interp_algo
  9990. The interpolation algorithm used for resizing. One of the following:
  9991. @table @option
  9992. @item nn
  9993. Nearest neighbour.
  9994. @item linear
  9995. @item cubic
  9996. @item cubic2p_bspline
  9997. 2-parameter cubic (B=1, C=0)
  9998. @item cubic2p_catmullrom
  9999. 2-parameter cubic (B=0, C=1/2)
  10000. @item cubic2p_b05c03
  10001. 2-parameter cubic (B=1/2, C=3/10)
  10002. @item super
  10003. Supersampling
  10004. @item lanczos
  10005. @end table
  10006. @end table
  10007. @section scale2ref
  10008. Scale (resize) the input video, based on a reference video.
  10009. See the scale filter for available options, scale2ref supports the same but
  10010. uses the reference video instead of the main input as basis. scale2ref also
  10011. supports the following additional constants for the @option{w} and
  10012. @option{h} options:
  10013. @table @var
  10014. @item main_w
  10015. @item main_h
  10016. The main input video's width and height
  10017. @item main_a
  10018. The same as @var{main_w} / @var{main_h}
  10019. @item main_sar
  10020. The main input video's sample aspect ratio
  10021. @item main_dar, mdar
  10022. The main input video's display aspect ratio. Calculated from
  10023. @code{(main_w / main_h) * main_sar}.
  10024. @item main_hsub
  10025. @item main_vsub
  10026. The main input video's horizontal and vertical chroma subsample values.
  10027. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10028. is 1.
  10029. @end table
  10030. @subsection Examples
  10031. @itemize
  10032. @item
  10033. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10034. @example
  10035. 'scale2ref[b][a];[a][b]overlay'
  10036. @end example
  10037. @end itemize
  10038. @anchor{selectivecolor}
  10039. @section selectivecolor
  10040. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10041. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10042. by the "purity" of the color (that is, how saturated it already is).
  10043. This filter is similar to the Adobe Photoshop Selective Color tool.
  10044. The filter accepts the following options:
  10045. @table @option
  10046. @item correction_method
  10047. Select color correction method.
  10048. Available values are:
  10049. @table @samp
  10050. @item absolute
  10051. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10052. component value).
  10053. @item relative
  10054. Specified adjustments are relative to the original component value.
  10055. @end table
  10056. Default is @code{absolute}.
  10057. @item reds
  10058. Adjustments for red pixels (pixels where the red component is the maximum)
  10059. @item yellows
  10060. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10061. @item greens
  10062. Adjustments for green pixels (pixels where the green component is the maximum)
  10063. @item cyans
  10064. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10065. @item blues
  10066. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10067. @item magentas
  10068. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10069. @item whites
  10070. Adjustments for white pixels (pixels where all components are greater than 128)
  10071. @item neutrals
  10072. Adjustments for all pixels except pure black and pure white
  10073. @item blacks
  10074. Adjustments for black pixels (pixels where all components are lesser than 128)
  10075. @item psfile
  10076. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10077. @end table
  10078. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10079. 4 space separated floating point adjustment values in the [-1,1] range,
  10080. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10081. pixels of its range.
  10082. @subsection Examples
  10083. @itemize
  10084. @item
  10085. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10086. increase magenta by 27% in blue areas:
  10087. @example
  10088. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10089. @end example
  10090. @item
  10091. Use a Photoshop selective color preset:
  10092. @example
  10093. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10094. @end example
  10095. @end itemize
  10096. @anchor{separatefields}
  10097. @section separatefields
  10098. The @code{separatefields} takes a frame-based video input and splits
  10099. each frame into its components fields, producing a new half height clip
  10100. with twice the frame rate and twice the frame count.
  10101. This filter use field-dominance information in frame to decide which
  10102. of each pair of fields to place first in the output.
  10103. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10104. @section setdar, setsar
  10105. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10106. output video.
  10107. This is done by changing the specified Sample (aka Pixel) Aspect
  10108. Ratio, according to the following equation:
  10109. @example
  10110. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10111. @end example
  10112. Keep in mind that the @code{setdar} filter does not modify the pixel
  10113. dimensions of the video frame. Also, the display aspect ratio set by
  10114. this filter may be changed by later filters in the filterchain,
  10115. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10116. applied.
  10117. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10118. the filter output video.
  10119. Note that as a consequence of the application of this filter, the
  10120. output display aspect ratio will change according to the equation
  10121. above.
  10122. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10123. filter may be changed by later filters in the filterchain, e.g. if
  10124. another "setsar" or a "setdar" filter is applied.
  10125. It accepts the following parameters:
  10126. @table @option
  10127. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10128. Set the aspect ratio used by the filter.
  10129. The parameter can be a floating point number string, an expression, or
  10130. a string of the form @var{num}:@var{den}, where @var{num} and
  10131. @var{den} are the numerator and denominator of the aspect ratio. If
  10132. the parameter is not specified, it is assumed the value "0".
  10133. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10134. should be escaped.
  10135. @item max
  10136. Set the maximum integer value to use for expressing numerator and
  10137. denominator when reducing the expressed aspect ratio to a rational.
  10138. Default value is @code{100}.
  10139. @end table
  10140. The parameter @var{sar} is an expression containing
  10141. the following constants:
  10142. @table @option
  10143. @item E, PI, PHI
  10144. These are approximated values for the mathematical constants e
  10145. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10146. @item w, h
  10147. The input width and height.
  10148. @item a
  10149. These are the same as @var{w} / @var{h}.
  10150. @item sar
  10151. The input sample aspect ratio.
  10152. @item dar
  10153. The input display aspect ratio. It is the same as
  10154. (@var{w} / @var{h}) * @var{sar}.
  10155. @item hsub, vsub
  10156. Horizontal and vertical chroma subsample values. For example, for the
  10157. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10158. @end table
  10159. @subsection Examples
  10160. @itemize
  10161. @item
  10162. To change the display aspect ratio to 16:9, specify one of the following:
  10163. @example
  10164. setdar=dar=1.77777
  10165. setdar=dar=16/9
  10166. @end example
  10167. @item
  10168. To change the sample aspect ratio to 10:11, specify:
  10169. @example
  10170. setsar=sar=10/11
  10171. @end example
  10172. @item
  10173. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10174. 1000 in the aspect ratio reduction, use the command:
  10175. @example
  10176. setdar=ratio=16/9:max=1000
  10177. @end example
  10178. @end itemize
  10179. @anchor{setfield}
  10180. @section setfield
  10181. Force field for the output video frame.
  10182. The @code{setfield} filter marks the interlace type field for the
  10183. output frames. It does not change the input frame, but only sets the
  10184. corresponding property, which affects how the frame is treated by
  10185. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10186. The filter accepts the following options:
  10187. @table @option
  10188. @item mode
  10189. Available values are:
  10190. @table @samp
  10191. @item auto
  10192. Keep the same field property.
  10193. @item bff
  10194. Mark the frame as bottom-field-first.
  10195. @item tff
  10196. Mark the frame as top-field-first.
  10197. @item prog
  10198. Mark the frame as progressive.
  10199. @end table
  10200. @end table
  10201. @section showinfo
  10202. Show a line containing various information for each input video frame.
  10203. The input video is not modified.
  10204. The shown line contains a sequence of key/value pairs of the form
  10205. @var{key}:@var{value}.
  10206. The following values are shown in the output:
  10207. @table @option
  10208. @item n
  10209. The (sequential) number of the input frame, starting from 0.
  10210. @item pts
  10211. The Presentation TimeStamp of the input frame, expressed as a number of
  10212. time base units. The time base unit depends on the filter input pad.
  10213. @item pts_time
  10214. The Presentation TimeStamp of the input frame, expressed as a number of
  10215. seconds.
  10216. @item pos
  10217. The position of the frame in the input stream, or -1 if this information is
  10218. unavailable and/or meaningless (for example in case of synthetic video).
  10219. @item fmt
  10220. The pixel format name.
  10221. @item sar
  10222. The sample aspect ratio of the input frame, expressed in the form
  10223. @var{num}/@var{den}.
  10224. @item s
  10225. The size of the input frame. For the syntax of this option, check the
  10226. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10227. @item i
  10228. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10229. for bottom field first).
  10230. @item iskey
  10231. This is 1 if the frame is a key frame, 0 otherwise.
  10232. @item type
  10233. The picture type of the input frame ("I" for an I-frame, "P" for a
  10234. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10235. Also refer to the documentation of the @code{AVPictureType} enum and of
  10236. the @code{av_get_picture_type_char} function defined in
  10237. @file{libavutil/avutil.h}.
  10238. @item checksum
  10239. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10240. @item plane_checksum
  10241. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10242. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10243. @end table
  10244. @section showpalette
  10245. Displays the 256 colors palette of each frame. This filter is only relevant for
  10246. @var{pal8} pixel format frames.
  10247. It accepts the following option:
  10248. @table @option
  10249. @item s
  10250. Set the size of the box used to represent one palette color entry. Default is
  10251. @code{30} (for a @code{30x30} pixel box).
  10252. @end table
  10253. @section shuffleframes
  10254. Reorder and/or duplicate and/or drop video frames.
  10255. It accepts the following parameters:
  10256. @table @option
  10257. @item mapping
  10258. Set the destination indexes of input frames.
  10259. This is space or '|' separated list of indexes that maps input frames to output
  10260. frames. Number of indexes also sets maximal value that each index may have.
  10261. '-1' index have special meaning and that is to drop frame.
  10262. @end table
  10263. The first frame has the index 0. The default is to keep the input unchanged.
  10264. @subsection Examples
  10265. @itemize
  10266. @item
  10267. Swap second and third frame of every three frames of the input:
  10268. @example
  10269. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10270. @end example
  10271. @item
  10272. Swap 10th and 1st frame of every ten frames of the input:
  10273. @example
  10274. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10275. @end example
  10276. @end itemize
  10277. @section shuffleplanes
  10278. Reorder and/or duplicate video planes.
  10279. It accepts the following parameters:
  10280. @table @option
  10281. @item map0
  10282. The index of the input plane to be used as the first output plane.
  10283. @item map1
  10284. The index of the input plane to be used as the second output plane.
  10285. @item map2
  10286. The index of the input plane to be used as the third output plane.
  10287. @item map3
  10288. The index of the input plane to be used as the fourth output plane.
  10289. @end table
  10290. The first plane has the index 0. The default is to keep the input unchanged.
  10291. @subsection Examples
  10292. @itemize
  10293. @item
  10294. Swap the second and third planes of the input:
  10295. @example
  10296. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10297. @end example
  10298. @end itemize
  10299. @anchor{signalstats}
  10300. @section signalstats
  10301. Evaluate various visual metrics that assist in determining issues associated
  10302. with the digitization of analog video media.
  10303. By default the filter will log these metadata values:
  10304. @table @option
  10305. @item YMIN
  10306. Display the minimal Y value contained within the input frame. Expressed in
  10307. range of [0-255].
  10308. @item YLOW
  10309. Display the Y value at the 10% percentile within the input frame. Expressed in
  10310. range of [0-255].
  10311. @item YAVG
  10312. Display the average Y value within the input frame. Expressed in range of
  10313. [0-255].
  10314. @item YHIGH
  10315. Display the Y value at the 90% percentile within the input frame. Expressed in
  10316. range of [0-255].
  10317. @item YMAX
  10318. Display the maximum Y value contained within the input frame. Expressed in
  10319. range of [0-255].
  10320. @item UMIN
  10321. Display the minimal U value contained within the input frame. Expressed in
  10322. range of [0-255].
  10323. @item ULOW
  10324. Display the U value at the 10% percentile within the input frame. Expressed in
  10325. range of [0-255].
  10326. @item UAVG
  10327. Display the average U value within the input frame. Expressed in range of
  10328. [0-255].
  10329. @item UHIGH
  10330. Display the U value at the 90% percentile within the input frame. Expressed in
  10331. range of [0-255].
  10332. @item UMAX
  10333. Display the maximum U value contained within the input frame. Expressed in
  10334. range of [0-255].
  10335. @item VMIN
  10336. Display the minimal V value contained within the input frame. Expressed in
  10337. range of [0-255].
  10338. @item VLOW
  10339. Display the V value at the 10% percentile within the input frame. Expressed in
  10340. range of [0-255].
  10341. @item VAVG
  10342. Display the average V value within the input frame. Expressed in range of
  10343. [0-255].
  10344. @item VHIGH
  10345. Display the V value at the 90% percentile within the input frame. Expressed in
  10346. range of [0-255].
  10347. @item VMAX
  10348. Display the maximum V value contained within the input frame. Expressed in
  10349. range of [0-255].
  10350. @item SATMIN
  10351. Display the minimal saturation value contained within the input frame.
  10352. Expressed in range of [0-~181.02].
  10353. @item SATLOW
  10354. Display the saturation value at the 10% percentile within the input frame.
  10355. Expressed in range of [0-~181.02].
  10356. @item SATAVG
  10357. Display the average saturation value within the input frame. Expressed in range
  10358. of [0-~181.02].
  10359. @item SATHIGH
  10360. Display the saturation value at the 90% percentile within the input frame.
  10361. Expressed in range of [0-~181.02].
  10362. @item SATMAX
  10363. Display the maximum saturation value contained within the input frame.
  10364. Expressed in range of [0-~181.02].
  10365. @item HUEMED
  10366. Display the median value for hue within the input frame. Expressed in range of
  10367. [0-360].
  10368. @item HUEAVG
  10369. Display the average value for hue within the input frame. Expressed in range of
  10370. [0-360].
  10371. @item YDIF
  10372. Display the average of sample value difference between all values of the Y
  10373. plane in the current frame and corresponding values of the previous input frame.
  10374. Expressed in range of [0-255].
  10375. @item UDIF
  10376. Display the average of sample value difference between all values of the U
  10377. plane in the current frame and corresponding values of the previous input frame.
  10378. Expressed in range of [0-255].
  10379. @item VDIF
  10380. Display the average of sample value difference between all values of the V
  10381. plane in the current frame and corresponding values of the previous input frame.
  10382. Expressed in range of [0-255].
  10383. @item YBITDEPTH
  10384. Display bit depth of Y plane in current frame.
  10385. Expressed in range of [0-16].
  10386. @item UBITDEPTH
  10387. Display bit depth of U plane in current frame.
  10388. Expressed in range of [0-16].
  10389. @item VBITDEPTH
  10390. Display bit depth of V plane in current frame.
  10391. Expressed in range of [0-16].
  10392. @end table
  10393. The filter accepts the following options:
  10394. @table @option
  10395. @item stat
  10396. @item out
  10397. @option{stat} specify an additional form of image analysis.
  10398. @option{out} output video with the specified type of pixel highlighted.
  10399. Both options accept the following values:
  10400. @table @samp
  10401. @item tout
  10402. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10403. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10404. include the results of video dropouts, head clogs, or tape tracking issues.
  10405. @item vrep
  10406. Identify @var{vertical line repetition}. Vertical line repetition includes
  10407. similar rows of pixels within a frame. In born-digital video vertical line
  10408. repetition is common, but this pattern is uncommon in video digitized from an
  10409. analog source. When it occurs in video that results from the digitization of an
  10410. analog source it can indicate concealment from a dropout compensator.
  10411. @item brng
  10412. Identify pixels that fall outside of legal broadcast range.
  10413. @end table
  10414. @item color, c
  10415. Set the highlight color for the @option{out} option. The default color is
  10416. yellow.
  10417. @end table
  10418. @subsection Examples
  10419. @itemize
  10420. @item
  10421. Output data of various video metrics:
  10422. @example
  10423. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10424. @end example
  10425. @item
  10426. Output specific data about the minimum and maximum values of the Y plane per frame:
  10427. @example
  10428. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10429. @end example
  10430. @item
  10431. Playback video while highlighting pixels that are outside of broadcast range in red.
  10432. @example
  10433. ffplay example.mov -vf signalstats="out=brng:color=red"
  10434. @end example
  10435. @item
  10436. Playback video with signalstats metadata drawn over the frame.
  10437. @example
  10438. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10439. @end example
  10440. The contents of signalstat_drawtext.txt used in the command are:
  10441. @example
  10442. time %@{pts:hms@}
  10443. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10444. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10445. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10446. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10447. @end example
  10448. @end itemize
  10449. @anchor{signature}
  10450. @section signature
  10451. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10452. input. In this case the matching between the inputs can be calculated additionally.
  10453. The filter always passes through the first input. The signature of each stream can
  10454. be written into a file.
  10455. It accepts the following options:
  10456. @table @option
  10457. @item detectmode
  10458. Enable or disable the matching process.
  10459. Available values are:
  10460. @table @samp
  10461. @item off
  10462. Disable the calculation of a matching (default).
  10463. @item full
  10464. Calculate the matching for the whole video and output whether the whole video
  10465. matches or only parts.
  10466. @item fast
  10467. Calculate only until a matching is found or the video ends. Should be faster in
  10468. some cases.
  10469. @end table
  10470. @item nb_inputs
  10471. Set the number of inputs. The option value must be a non negative integer.
  10472. Default value is 1.
  10473. @item filename
  10474. Set the path to which the output is written. If there is more than one input,
  10475. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10476. integer), that will be replaced with the input number. If no filename is
  10477. specified, no output will be written. This is the default.
  10478. @item format
  10479. Choose the output format.
  10480. Available values are:
  10481. @table @samp
  10482. @item binary
  10483. Use the specified binary representation (default).
  10484. @item xml
  10485. Use the specified xml representation.
  10486. @end table
  10487. @item th_d
  10488. Set threshold to detect one word as similar. The option value must be an integer
  10489. greater than zero. The default value is 9000.
  10490. @item th_dc
  10491. Set threshold to detect all words as similar. The option value must be an integer
  10492. greater than zero. The default value is 60000.
  10493. @item th_xh
  10494. Set threshold to detect frames as similar. The option value must be an integer
  10495. greater than zero. The default value is 116.
  10496. @item th_di
  10497. Set the minimum length of a sequence in frames to recognize it as matching
  10498. sequence. The option value must be a non negative integer value.
  10499. The default value is 0.
  10500. @item th_it
  10501. Set the minimum relation, that matching frames to all frames must have.
  10502. The option value must be a double value between 0 and 1. The default value is 0.5.
  10503. @end table
  10504. @subsection Examples
  10505. @itemize
  10506. @item
  10507. To calculate the signature of an input video and store it in signature.bin:
  10508. @example
  10509. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10510. @end example
  10511. @item
  10512. To detect whether two videos match and store the signatures in XML format in
  10513. signature0.xml and signature1.xml:
  10514. @example
  10515. 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 -
  10516. @end example
  10517. @end itemize
  10518. @anchor{smartblur}
  10519. @section smartblur
  10520. Blur the input video without impacting the outlines.
  10521. It accepts the following options:
  10522. @table @option
  10523. @item luma_radius, lr
  10524. Set the luma radius. The option value must be a float number in
  10525. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10526. used to blur the image (slower if larger). Default value is 1.0.
  10527. @item luma_strength, ls
  10528. Set the luma strength. The option value must be a float number
  10529. in the range [-1.0,1.0] that configures the blurring. A value included
  10530. in [0.0,1.0] will blur the image whereas a value included in
  10531. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10532. @item luma_threshold, lt
  10533. Set the luma threshold used as a coefficient to determine
  10534. whether a pixel should be blurred or not. The option value must be an
  10535. integer in the range [-30,30]. A value of 0 will filter all the image,
  10536. a value included in [0,30] will filter flat areas and a value included
  10537. in [-30,0] will filter edges. Default value is 0.
  10538. @item chroma_radius, cr
  10539. Set the chroma radius. The option value must be a float number in
  10540. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10541. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10542. @item chroma_strength, cs
  10543. Set the chroma strength. The option value must be a float number
  10544. in the range [-1.0,1.0] that configures the blurring. A value included
  10545. in [0.0,1.0] will blur the image whereas a value included in
  10546. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10547. @item chroma_threshold, ct
  10548. Set the chroma threshold used as a coefficient to determine
  10549. whether a pixel should be blurred or not. The option value must be an
  10550. integer in the range [-30,30]. A value of 0 will filter all the image,
  10551. a value included in [0,30] will filter flat areas and a value included
  10552. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10553. @end table
  10554. If a chroma option is not explicitly set, the corresponding luma value
  10555. is set.
  10556. @section ssim
  10557. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10558. This filter takes in input two input videos, the first input is
  10559. considered the "main" source and is passed unchanged to the
  10560. output. The second input is used as a "reference" video for computing
  10561. the SSIM.
  10562. Both video inputs must have the same resolution and pixel format for
  10563. this filter to work correctly. Also it assumes that both inputs
  10564. have the same number of frames, which are compared one by one.
  10565. The filter stores the calculated SSIM of each frame.
  10566. The description of the accepted parameters follows.
  10567. @table @option
  10568. @item stats_file, f
  10569. If specified the filter will use the named file to save the SSIM of
  10570. each individual frame. When filename equals "-" the data is sent to
  10571. standard output.
  10572. @end table
  10573. The file printed if @var{stats_file} is selected, contains a sequence of
  10574. key/value pairs of the form @var{key}:@var{value} for each compared
  10575. couple of frames.
  10576. A description of each shown parameter follows:
  10577. @table @option
  10578. @item n
  10579. sequential number of the input frame, starting from 1
  10580. @item Y, U, V, R, G, B
  10581. SSIM of the compared frames for the component specified by the suffix.
  10582. @item All
  10583. SSIM of the compared frames for the whole frame.
  10584. @item dB
  10585. Same as above but in dB representation.
  10586. @end table
  10587. This filter also supports the @ref{framesync} options.
  10588. For example:
  10589. @example
  10590. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10591. [main][ref] ssim="stats_file=stats.log" [out]
  10592. @end example
  10593. On this example the input file being processed is compared with the
  10594. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10595. is stored in @file{stats.log}.
  10596. Another example with both psnr and ssim at same time:
  10597. @example
  10598. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10599. @end example
  10600. @section stereo3d
  10601. Convert between different stereoscopic image formats.
  10602. The filters accept the following options:
  10603. @table @option
  10604. @item in
  10605. Set stereoscopic image format of input.
  10606. Available values for input image formats are:
  10607. @table @samp
  10608. @item sbsl
  10609. side by side parallel (left eye left, right eye right)
  10610. @item sbsr
  10611. side by side crosseye (right eye left, left eye right)
  10612. @item sbs2l
  10613. side by side parallel with half width resolution
  10614. (left eye left, right eye right)
  10615. @item sbs2r
  10616. side by side crosseye with half width resolution
  10617. (right eye left, left eye right)
  10618. @item abl
  10619. above-below (left eye above, right eye below)
  10620. @item abr
  10621. above-below (right eye above, left eye below)
  10622. @item ab2l
  10623. above-below with half height resolution
  10624. (left eye above, right eye below)
  10625. @item ab2r
  10626. above-below with half height resolution
  10627. (right eye above, left eye below)
  10628. @item al
  10629. alternating frames (left eye first, right eye second)
  10630. @item ar
  10631. alternating frames (right eye first, left eye second)
  10632. @item irl
  10633. interleaved rows (left eye has top row, right eye starts on next row)
  10634. @item irr
  10635. interleaved rows (right eye has top row, left eye starts on next row)
  10636. @item icl
  10637. interleaved columns, left eye first
  10638. @item icr
  10639. interleaved columns, right eye first
  10640. Default value is @samp{sbsl}.
  10641. @end table
  10642. @item out
  10643. Set stereoscopic image format of output.
  10644. @table @samp
  10645. @item sbsl
  10646. side by side parallel (left eye left, right eye right)
  10647. @item sbsr
  10648. side by side crosseye (right eye left, left eye right)
  10649. @item sbs2l
  10650. side by side parallel with half width resolution
  10651. (left eye left, right eye right)
  10652. @item sbs2r
  10653. side by side crosseye with half width resolution
  10654. (right eye left, left eye right)
  10655. @item abl
  10656. above-below (left eye above, right eye below)
  10657. @item abr
  10658. above-below (right eye above, left eye below)
  10659. @item ab2l
  10660. above-below with half height resolution
  10661. (left eye above, right eye below)
  10662. @item ab2r
  10663. above-below with half height resolution
  10664. (right eye above, left eye below)
  10665. @item al
  10666. alternating frames (left eye first, right eye second)
  10667. @item ar
  10668. alternating frames (right eye first, left eye second)
  10669. @item irl
  10670. interleaved rows (left eye has top row, right eye starts on next row)
  10671. @item irr
  10672. interleaved rows (right eye has top row, left eye starts on next row)
  10673. @item arbg
  10674. anaglyph red/blue gray
  10675. (red filter on left eye, blue filter on right eye)
  10676. @item argg
  10677. anaglyph red/green gray
  10678. (red filter on left eye, green filter on right eye)
  10679. @item arcg
  10680. anaglyph red/cyan gray
  10681. (red filter on left eye, cyan filter on right eye)
  10682. @item arch
  10683. anaglyph red/cyan half colored
  10684. (red filter on left eye, cyan filter on right eye)
  10685. @item arcc
  10686. anaglyph red/cyan color
  10687. (red filter on left eye, cyan filter on right eye)
  10688. @item arcd
  10689. anaglyph red/cyan color optimized with the least squares projection of dubois
  10690. (red filter on left eye, cyan filter on right eye)
  10691. @item agmg
  10692. anaglyph green/magenta gray
  10693. (green filter on left eye, magenta filter on right eye)
  10694. @item agmh
  10695. anaglyph green/magenta half colored
  10696. (green filter on left eye, magenta filter on right eye)
  10697. @item agmc
  10698. anaglyph green/magenta colored
  10699. (green filter on left eye, magenta filter on right eye)
  10700. @item agmd
  10701. anaglyph green/magenta color optimized with the least squares projection of dubois
  10702. (green filter on left eye, magenta filter on right eye)
  10703. @item aybg
  10704. anaglyph yellow/blue gray
  10705. (yellow filter on left eye, blue filter on right eye)
  10706. @item aybh
  10707. anaglyph yellow/blue half colored
  10708. (yellow filter on left eye, blue filter on right eye)
  10709. @item aybc
  10710. anaglyph yellow/blue colored
  10711. (yellow filter on left eye, blue filter on right eye)
  10712. @item aybd
  10713. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10714. (yellow filter on left eye, blue filter on right eye)
  10715. @item ml
  10716. mono output (left eye only)
  10717. @item mr
  10718. mono output (right eye only)
  10719. @item chl
  10720. checkerboard, left eye first
  10721. @item chr
  10722. checkerboard, right eye first
  10723. @item icl
  10724. interleaved columns, left eye first
  10725. @item icr
  10726. interleaved columns, right eye first
  10727. @item hdmi
  10728. HDMI frame pack
  10729. @end table
  10730. Default value is @samp{arcd}.
  10731. @end table
  10732. @subsection Examples
  10733. @itemize
  10734. @item
  10735. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10736. @example
  10737. stereo3d=sbsl:aybd
  10738. @end example
  10739. @item
  10740. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10741. @example
  10742. stereo3d=abl:sbsr
  10743. @end example
  10744. @end itemize
  10745. @section streamselect, astreamselect
  10746. Select video or audio streams.
  10747. The filter accepts the following options:
  10748. @table @option
  10749. @item inputs
  10750. Set number of inputs. Default is 2.
  10751. @item map
  10752. Set input indexes to remap to outputs.
  10753. @end table
  10754. @subsection Commands
  10755. The @code{streamselect} and @code{astreamselect} filter supports the following
  10756. commands:
  10757. @table @option
  10758. @item map
  10759. Set input indexes to remap to outputs.
  10760. @end table
  10761. @subsection Examples
  10762. @itemize
  10763. @item
  10764. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10765. @example
  10766. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10767. @end example
  10768. @item
  10769. Same as above, but for audio:
  10770. @example
  10771. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10772. @end example
  10773. @end itemize
  10774. @section sobel
  10775. Apply sobel operator to input video stream.
  10776. The filter accepts the following option:
  10777. @table @option
  10778. @item planes
  10779. Set which planes will be processed, unprocessed planes will be copied.
  10780. By default value 0xf, all planes will be processed.
  10781. @item scale
  10782. Set value which will be multiplied with filtered result.
  10783. @item delta
  10784. Set value which will be added to filtered result.
  10785. @end table
  10786. @anchor{spp}
  10787. @section spp
  10788. Apply a simple postprocessing filter that compresses and decompresses the image
  10789. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10790. and average the results.
  10791. The filter accepts the following options:
  10792. @table @option
  10793. @item quality
  10794. Set quality. This option defines the number of levels for averaging. It accepts
  10795. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10796. effect. A value of @code{6} means the higher quality. For each increment of
  10797. that value the speed drops by a factor of approximately 2. Default value is
  10798. @code{3}.
  10799. @item qp
  10800. Force a constant quantization parameter. If not set, the filter will use the QP
  10801. from the video stream (if available).
  10802. @item mode
  10803. Set thresholding mode. Available modes are:
  10804. @table @samp
  10805. @item hard
  10806. Set hard thresholding (default).
  10807. @item soft
  10808. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10809. @end table
  10810. @item use_bframe_qp
  10811. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10812. option may cause flicker since the B-Frames have often larger QP. Default is
  10813. @code{0} (not enabled).
  10814. @end table
  10815. @anchor{subtitles}
  10816. @section subtitles
  10817. Draw subtitles on top of input video using the libass library.
  10818. To enable compilation of this filter you need to configure FFmpeg with
  10819. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10820. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10821. Alpha) subtitles format.
  10822. The filter accepts the following options:
  10823. @table @option
  10824. @item filename, f
  10825. Set the filename of the subtitle file to read. It must be specified.
  10826. @item original_size
  10827. Specify the size of the original video, the video for which the ASS file
  10828. was composed. For the syntax of this option, check the
  10829. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10830. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10831. correctly scale the fonts if the aspect ratio has been changed.
  10832. @item fontsdir
  10833. Set a directory path containing fonts that can be used by the filter.
  10834. These fonts will be used in addition to whatever the font provider uses.
  10835. @item alpha
  10836. Process alpha channel, by default alpha channel is untouched.
  10837. @item charenc
  10838. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10839. useful if not UTF-8.
  10840. @item stream_index, si
  10841. Set subtitles stream index. @code{subtitles} filter only.
  10842. @item force_style
  10843. Override default style or script info parameters of the subtitles. It accepts a
  10844. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10845. @end table
  10846. If the first key is not specified, it is assumed that the first value
  10847. specifies the @option{filename}.
  10848. For example, to render the file @file{sub.srt} on top of the input
  10849. video, use the command:
  10850. @example
  10851. subtitles=sub.srt
  10852. @end example
  10853. which is equivalent to:
  10854. @example
  10855. subtitles=filename=sub.srt
  10856. @end example
  10857. To render the default subtitles stream from file @file{video.mkv}, use:
  10858. @example
  10859. subtitles=video.mkv
  10860. @end example
  10861. To render the second subtitles stream from that file, use:
  10862. @example
  10863. subtitles=video.mkv:si=1
  10864. @end example
  10865. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10866. @code{DejaVu Serif}, use:
  10867. @example
  10868. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10869. @end example
  10870. @section super2xsai
  10871. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10872. Interpolate) pixel art scaling algorithm.
  10873. Useful for enlarging pixel art images without reducing sharpness.
  10874. @section swaprect
  10875. Swap two rectangular objects in video.
  10876. This filter accepts the following options:
  10877. @table @option
  10878. @item w
  10879. Set object width.
  10880. @item h
  10881. Set object height.
  10882. @item x1
  10883. Set 1st rect x coordinate.
  10884. @item y1
  10885. Set 1st rect y coordinate.
  10886. @item x2
  10887. Set 2nd rect x coordinate.
  10888. @item y2
  10889. Set 2nd rect y coordinate.
  10890. All expressions are evaluated once for each frame.
  10891. @end table
  10892. The all options are expressions containing the following constants:
  10893. @table @option
  10894. @item w
  10895. @item h
  10896. The input width and height.
  10897. @item a
  10898. same as @var{w} / @var{h}
  10899. @item sar
  10900. input sample aspect ratio
  10901. @item dar
  10902. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10903. @item n
  10904. The number of the input frame, starting from 0.
  10905. @item t
  10906. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10907. @item pos
  10908. the position in the file of the input frame, NAN if unknown
  10909. @end table
  10910. @section swapuv
  10911. Swap U & V plane.
  10912. @section telecine
  10913. Apply telecine process to the video.
  10914. This filter accepts the following options:
  10915. @table @option
  10916. @item first_field
  10917. @table @samp
  10918. @item top, t
  10919. top field first
  10920. @item bottom, b
  10921. bottom field first
  10922. The default value is @code{top}.
  10923. @end table
  10924. @item pattern
  10925. A string of numbers representing the pulldown pattern you wish to apply.
  10926. The default value is @code{23}.
  10927. @end table
  10928. @example
  10929. Some typical patterns:
  10930. NTSC output (30i):
  10931. 27.5p: 32222
  10932. 24p: 23 (classic)
  10933. 24p: 2332 (preferred)
  10934. 20p: 33
  10935. 18p: 334
  10936. 16p: 3444
  10937. PAL output (25i):
  10938. 27.5p: 12222
  10939. 24p: 222222222223 ("Euro pulldown")
  10940. 16.67p: 33
  10941. 16p: 33333334
  10942. @end example
  10943. @section threshold
  10944. Apply threshold effect to video stream.
  10945. This filter needs four video streams to perform thresholding.
  10946. First stream is stream we are filtering.
  10947. Second stream is holding threshold values, third stream is holding min values,
  10948. and last, fourth stream is holding max values.
  10949. The filter accepts the following option:
  10950. @table @option
  10951. @item planes
  10952. Set which planes will be processed, unprocessed planes will be copied.
  10953. By default value 0xf, all planes will be processed.
  10954. @end table
  10955. For example if first stream pixel's component value is less then threshold value
  10956. of pixel component from 2nd threshold stream, third stream value will picked,
  10957. otherwise fourth stream pixel component value will be picked.
  10958. Using color source filter one can perform various types of thresholding:
  10959. @subsection Examples
  10960. @itemize
  10961. @item
  10962. Binary threshold, using gray color as threshold:
  10963. @example
  10964. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10965. @end example
  10966. @item
  10967. Inverted binary threshold, using gray color as threshold:
  10968. @example
  10969. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10970. @end example
  10971. @item
  10972. Truncate binary threshold, using gray color as threshold:
  10973. @example
  10974. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10975. @end example
  10976. @item
  10977. Threshold to zero, using gray color as threshold:
  10978. @example
  10979. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10980. @end example
  10981. @item
  10982. Inverted threshold to zero, using gray color as threshold:
  10983. @example
  10984. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10985. @end example
  10986. @end itemize
  10987. @section thumbnail
  10988. Select the most representative frame in a given sequence of consecutive frames.
  10989. The filter accepts the following options:
  10990. @table @option
  10991. @item n
  10992. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10993. will pick one of them, and then handle the next batch of @var{n} frames until
  10994. the end. Default is @code{100}.
  10995. @end table
  10996. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10997. value will result in a higher memory usage, so a high value is not recommended.
  10998. @subsection Examples
  10999. @itemize
  11000. @item
  11001. Extract one picture each 50 frames:
  11002. @example
  11003. thumbnail=50
  11004. @end example
  11005. @item
  11006. Complete example of a thumbnail creation with @command{ffmpeg}:
  11007. @example
  11008. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11009. @end example
  11010. @end itemize
  11011. @section tile
  11012. Tile several successive frames together.
  11013. The filter accepts the following options:
  11014. @table @option
  11015. @item layout
  11016. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11017. this option, check the
  11018. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11019. @item nb_frames
  11020. Set the maximum number of frames to render in the given area. It must be less
  11021. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11022. the area will be used.
  11023. @item margin
  11024. Set the outer border margin in pixels.
  11025. @item padding
  11026. Set the inner border thickness (i.e. the number of pixels between frames). For
  11027. more advanced padding options (such as having different values for the edges),
  11028. refer to the pad video filter.
  11029. @item color
  11030. Specify the color of the unused area. For the syntax of this option, check the
  11031. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  11032. is "black".
  11033. @item overlap
  11034. Set the number of frames to overlap when tiling several successive frames together.
  11035. The value must be between @code{0} and @var{nb_frames - 1}.
  11036. @end table
  11037. @subsection Examples
  11038. @itemize
  11039. @item
  11040. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11041. @example
  11042. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11043. @end example
  11044. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11045. duplicating each output frame to accommodate the originally detected frame
  11046. rate.
  11047. @item
  11048. Display @code{5} pictures in an area of @code{3x2} frames,
  11049. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11050. mixed flat and named options:
  11051. @example
  11052. tile=3x2:nb_frames=5:padding=7:margin=2
  11053. @end example
  11054. @end itemize
  11055. @section tinterlace
  11056. Perform various types of temporal field interlacing.
  11057. Frames are counted starting from 1, so the first input frame is
  11058. considered odd.
  11059. The filter accepts the following options:
  11060. @table @option
  11061. @item mode
  11062. Specify the mode of the interlacing. This option can also be specified
  11063. as a value alone. See below for a list of values for this option.
  11064. Available values are:
  11065. @table @samp
  11066. @item merge, 0
  11067. Move odd frames into the upper field, even into the lower field,
  11068. generating a double height frame at half frame rate.
  11069. @example
  11070. ------> time
  11071. Input:
  11072. Frame 1 Frame 2 Frame 3 Frame 4
  11073. 11111 22222 33333 44444
  11074. 11111 22222 33333 44444
  11075. 11111 22222 33333 44444
  11076. 11111 22222 33333 44444
  11077. Output:
  11078. 11111 33333
  11079. 22222 44444
  11080. 11111 33333
  11081. 22222 44444
  11082. 11111 33333
  11083. 22222 44444
  11084. 11111 33333
  11085. 22222 44444
  11086. @end example
  11087. @item drop_even, 1
  11088. Only output odd frames, even frames are dropped, generating a frame with
  11089. unchanged height at half frame rate.
  11090. @example
  11091. ------> time
  11092. Input:
  11093. Frame 1 Frame 2 Frame 3 Frame 4
  11094. 11111 22222 33333 44444
  11095. 11111 22222 33333 44444
  11096. 11111 22222 33333 44444
  11097. 11111 22222 33333 44444
  11098. Output:
  11099. 11111 33333
  11100. 11111 33333
  11101. 11111 33333
  11102. 11111 33333
  11103. @end example
  11104. @item drop_odd, 2
  11105. Only output even frames, odd frames are dropped, generating a frame with
  11106. unchanged height at half frame rate.
  11107. @example
  11108. ------> time
  11109. Input:
  11110. Frame 1 Frame 2 Frame 3 Frame 4
  11111. 11111 22222 33333 44444
  11112. 11111 22222 33333 44444
  11113. 11111 22222 33333 44444
  11114. 11111 22222 33333 44444
  11115. Output:
  11116. 22222 44444
  11117. 22222 44444
  11118. 22222 44444
  11119. 22222 44444
  11120. @end example
  11121. @item pad, 3
  11122. Expand each frame to full height, but pad alternate lines with black,
  11123. generating a frame with double height at the same input frame rate.
  11124. @example
  11125. ------> time
  11126. Input:
  11127. Frame 1 Frame 2 Frame 3 Frame 4
  11128. 11111 22222 33333 44444
  11129. 11111 22222 33333 44444
  11130. 11111 22222 33333 44444
  11131. 11111 22222 33333 44444
  11132. Output:
  11133. 11111 ..... 33333 .....
  11134. ..... 22222 ..... 44444
  11135. 11111 ..... 33333 .....
  11136. ..... 22222 ..... 44444
  11137. 11111 ..... 33333 .....
  11138. ..... 22222 ..... 44444
  11139. 11111 ..... 33333 .....
  11140. ..... 22222 ..... 44444
  11141. @end example
  11142. @item interleave_top, 4
  11143. Interleave the upper field from odd frames with the lower field from
  11144. even frames, generating a frame with unchanged height at half frame rate.
  11145. @example
  11146. ------> time
  11147. Input:
  11148. Frame 1 Frame 2 Frame 3 Frame 4
  11149. 11111<- 22222 33333<- 44444
  11150. 11111 22222<- 33333 44444<-
  11151. 11111<- 22222 33333<- 44444
  11152. 11111 22222<- 33333 44444<-
  11153. Output:
  11154. 11111 33333
  11155. 22222 44444
  11156. 11111 33333
  11157. 22222 44444
  11158. @end example
  11159. @item interleave_bottom, 5
  11160. Interleave the lower field from odd frames with the upper field from
  11161. even frames, generating a frame with unchanged height at half frame rate.
  11162. @example
  11163. ------> time
  11164. Input:
  11165. Frame 1 Frame 2 Frame 3 Frame 4
  11166. 11111 22222<- 33333 44444<-
  11167. 11111<- 22222 33333<- 44444
  11168. 11111 22222<- 33333 44444<-
  11169. 11111<- 22222 33333<- 44444
  11170. Output:
  11171. 22222 44444
  11172. 11111 33333
  11173. 22222 44444
  11174. 11111 33333
  11175. @end example
  11176. @item interlacex2, 6
  11177. Double frame rate with unchanged height. Frames are inserted each
  11178. containing the second temporal field from the previous input frame and
  11179. the first temporal field from the next input frame. This mode relies on
  11180. the top_field_first flag. Useful for interlaced video displays with no
  11181. field synchronisation.
  11182. @example
  11183. ------> time
  11184. Input:
  11185. Frame 1 Frame 2 Frame 3 Frame 4
  11186. 11111 22222 33333 44444
  11187. 11111 22222 33333 44444
  11188. 11111 22222 33333 44444
  11189. 11111 22222 33333 44444
  11190. Output:
  11191. 11111 22222 22222 33333 33333 44444 44444
  11192. 11111 11111 22222 22222 33333 33333 44444
  11193. 11111 22222 22222 33333 33333 44444 44444
  11194. 11111 11111 22222 22222 33333 33333 44444
  11195. @end example
  11196. @item mergex2, 7
  11197. Move odd frames into the upper field, even into the lower field,
  11198. generating a double height frame at same frame rate.
  11199. @example
  11200. ------> time
  11201. Input:
  11202. Frame 1 Frame 2 Frame 3 Frame 4
  11203. 11111 22222 33333 44444
  11204. 11111 22222 33333 44444
  11205. 11111 22222 33333 44444
  11206. 11111 22222 33333 44444
  11207. Output:
  11208. 11111 33333 33333 55555
  11209. 22222 22222 44444 44444
  11210. 11111 33333 33333 55555
  11211. 22222 22222 44444 44444
  11212. 11111 33333 33333 55555
  11213. 22222 22222 44444 44444
  11214. 11111 33333 33333 55555
  11215. 22222 22222 44444 44444
  11216. @end example
  11217. @end table
  11218. Numeric values are deprecated but are accepted for backward
  11219. compatibility reasons.
  11220. Default mode is @code{merge}.
  11221. @item flags
  11222. Specify flags influencing the filter process.
  11223. Available value for @var{flags} is:
  11224. @table @option
  11225. @item low_pass_filter, vlfp
  11226. Enable linear vertical low-pass filtering in the filter.
  11227. Vertical low-pass filtering is required when creating an interlaced
  11228. destination from a progressive source which contains high-frequency
  11229. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11230. patterning.
  11231. @item complex_filter, cvlfp
  11232. Enable complex vertical low-pass filtering.
  11233. This will slightly less reduce interlace 'twitter' and Moire
  11234. patterning but better retain detail and subjective sharpness impression.
  11235. @end table
  11236. Vertical low-pass filtering can only be enabled for @option{mode}
  11237. @var{interleave_top} and @var{interleave_bottom}.
  11238. @end table
  11239. @section tonemap
  11240. Tone map colors from different dynamic ranges.
  11241. This filter expects data in single precision floating point, as it needs to
  11242. operate on (and can output) out-of-range values. Another filter, such as
  11243. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11244. The tonemapping algorithms implemented only work on linear light, so input
  11245. data should be linearized beforehand (and possibly correctly tagged).
  11246. @example
  11247. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11248. @end example
  11249. @subsection Options
  11250. The filter accepts the following options.
  11251. @table @option
  11252. @item tonemap
  11253. Set the tone map algorithm to use.
  11254. Possible values are:
  11255. @table @var
  11256. @item none
  11257. Do not apply any tone map, only desaturate overbright pixels.
  11258. @item clip
  11259. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11260. in-range values, while distorting out-of-range values.
  11261. @item linear
  11262. Stretch the entire reference gamut to a linear multiple of the display.
  11263. @item gamma
  11264. Fit a logarithmic transfer between the tone curves.
  11265. @item reinhard
  11266. Preserve overall image brightness with a simple curve, using nonlinear
  11267. contrast, which results in flattening details and degrading color accuracy.
  11268. @item hable
  11269. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11270. of slightly darkening everything. Use it when detail preservation is more
  11271. important than color and brightness accuracy.
  11272. @item mobius
  11273. Smoothly map out-of-range values, while retaining contrast and colors for
  11274. in-range material as much as possible. Use it when color accuracy is more
  11275. important than detail preservation.
  11276. @end table
  11277. Default is none.
  11278. @item param
  11279. Tune the tone mapping algorithm.
  11280. This affects the following algorithms:
  11281. @table @var
  11282. @item none
  11283. Ignored.
  11284. @item linear
  11285. Specifies the scale factor to use while stretching.
  11286. Default to 1.0.
  11287. @item gamma
  11288. Specifies the exponent of the function.
  11289. Default to 1.8.
  11290. @item clip
  11291. Specify an extra linear coefficient to multiply into the signal before clipping.
  11292. Default to 1.0.
  11293. @item reinhard
  11294. Specify the local contrast coefficient at the display peak.
  11295. Default to 0.5, which means that in-gamut values will be about half as bright
  11296. as when clipping.
  11297. @item hable
  11298. Ignored.
  11299. @item mobius
  11300. Specify the transition point from linear to mobius transform. Every value
  11301. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11302. more accurate the result will be, at the cost of losing bright details.
  11303. Default to 0.3, which due to the steep initial slope still preserves in-range
  11304. colors fairly accurately.
  11305. @end table
  11306. @item desat
  11307. Apply desaturation for highlights that exceed this level of brightness. The
  11308. higher the parameter, the more color information will be preserved. This
  11309. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11310. (smoothly) turning into white instead. This makes images feel more natural,
  11311. at the cost of reducing information about out-of-range colors.
  11312. The default of 2.0 is somewhat conservative and will mostly just apply to
  11313. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11314. This option works only if the input frame has a supported color tag.
  11315. @item peak
  11316. Override signal/nominal/reference peak with this value. Useful when the
  11317. embedded peak information in display metadata is not reliable or when tone
  11318. mapping from a lower range to a higher range.
  11319. @end table
  11320. @section transpose
  11321. Transpose rows with columns in the input video and optionally flip it.
  11322. It accepts the following parameters:
  11323. @table @option
  11324. @item dir
  11325. Specify the transposition direction.
  11326. Can assume the following values:
  11327. @table @samp
  11328. @item 0, 4, cclock_flip
  11329. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11330. @example
  11331. L.R L.l
  11332. . . -> . .
  11333. l.r R.r
  11334. @end example
  11335. @item 1, 5, clock
  11336. Rotate by 90 degrees clockwise, that is:
  11337. @example
  11338. L.R l.L
  11339. . . -> . .
  11340. l.r r.R
  11341. @end example
  11342. @item 2, 6, cclock
  11343. Rotate by 90 degrees counterclockwise, that is:
  11344. @example
  11345. L.R R.r
  11346. . . -> . .
  11347. l.r L.l
  11348. @end example
  11349. @item 3, 7, clock_flip
  11350. Rotate by 90 degrees clockwise and vertically flip, that is:
  11351. @example
  11352. L.R r.R
  11353. . . -> . .
  11354. l.r l.L
  11355. @end example
  11356. @end table
  11357. For values between 4-7, the transposition is only done if the input
  11358. video geometry is portrait and not landscape. These values are
  11359. deprecated, the @code{passthrough} option should be used instead.
  11360. Numerical values are deprecated, and should be dropped in favor of
  11361. symbolic constants.
  11362. @item passthrough
  11363. Do not apply the transposition if the input geometry matches the one
  11364. specified by the specified value. It accepts the following values:
  11365. @table @samp
  11366. @item none
  11367. Always apply transposition.
  11368. @item portrait
  11369. Preserve portrait geometry (when @var{height} >= @var{width}).
  11370. @item landscape
  11371. Preserve landscape geometry (when @var{width} >= @var{height}).
  11372. @end table
  11373. Default value is @code{none}.
  11374. @end table
  11375. For example to rotate by 90 degrees clockwise and preserve portrait
  11376. layout:
  11377. @example
  11378. transpose=dir=1:passthrough=portrait
  11379. @end example
  11380. The command above can also be specified as:
  11381. @example
  11382. transpose=1:portrait
  11383. @end example
  11384. @section trim
  11385. Trim the input so that the output contains one continuous subpart of the input.
  11386. It accepts the following parameters:
  11387. @table @option
  11388. @item start
  11389. Specify the time of the start of the kept section, i.e. the frame with the
  11390. timestamp @var{start} will be the first frame in the output.
  11391. @item end
  11392. Specify the time of the first frame that will be dropped, i.e. the frame
  11393. immediately preceding the one with the timestamp @var{end} will be the last
  11394. frame in the output.
  11395. @item start_pts
  11396. This is the same as @var{start}, except this option sets the start timestamp
  11397. in timebase units instead of seconds.
  11398. @item end_pts
  11399. This is the same as @var{end}, except this option sets the end timestamp
  11400. in timebase units instead of seconds.
  11401. @item duration
  11402. The maximum duration of the output in seconds.
  11403. @item start_frame
  11404. The number of the first frame that should be passed to the output.
  11405. @item end_frame
  11406. The number of the first frame that should be dropped.
  11407. @end table
  11408. @option{start}, @option{end}, and @option{duration} are expressed as time
  11409. duration specifications; see
  11410. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11411. for the accepted syntax.
  11412. Note that the first two sets of the start/end options and the @option{duration}
  11413. option look at the frame timestamp, while the _frame variants simply count the
  11414. frames that pass through the filter. Also note that this filter does not modify
  11415. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11416. setpts filter after the trim filter.
  11417. If multiple start or end options are set, this filter tries to be greedy and
  11418. keep all the frames that match at least one of the specified constraints. To keep
  11419. only the part that matches all the constraints at once, chain multiple trim
  11420. filters.
  11421. The defaults are such that all the input is kept. So it is possible to set e.g.
  11422. just the end values to keep everything before the specified time.
  11423. Examples:
  11424. @itemize
  11425. @item
  11426. Drop everything except the second minute of input:
  11427. @example
  11428. ffmpeg -i INPUT -vf trim=60:120
  11429. @end example
  11430. @item
  11431. Keep only the first second:
  11432. @example
  11433. ffmpeg -i INPUT -vf trim=duration=1
  11434. @end example
  11435. @end itemize
  11436. @section unpremultiply
  11437. Apply alpha unpremultiply effect to input video stream using first plane
  11438. of second stream as alpha.
  11439. Both streams must have same dimensions and same pixel format.
  11440. The filter accepts the following option:
  11441. @table @option
  11442. @item planes
  11443. Set which planes will be processed, unprocessed planes will be copied.
  11444. By default value 0xf, all planes will be processed.
  11445. If the format has 1 or 2 components, then luma is bit 0.
  11446. If the format has 3 or 4 components:
  11447. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11448. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11449. If present, the alpha channel is always the last bit.
  11450. @item inplace
  11451. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11452. @end table
  11453. @anchor{unsharp}
  11454. @section unsharp
  11455. Sharpen or blur the input video.
  11456. It accepts the following parameters:
  11457. @table @option
  11458. @item luma_msize_x, lx
  11459. Set the luma matrix horizontal size. It must be an odd integer between
  11460. 3 and 23. The default value is 5.
  11461. @item luma_msize_y, ly
  11462. Set the luma matrix vertical size. It must be an odd integer between 3
  11463. and 23. The default value is 5.
  11464. @item luma_amount, la
  11465. Set the luma effect strength. It must be a floating point number, reasonable
  11466. values lay between -1.5 and 1.5.
  11467. Negative values will blur the input video, while positive values will
  11468. sharpen it, a value of zero will disable the effect.
  11469. Default value is 1.0.
  11470. @item chroma_msize_x, cx
  11471. Set the chroma matrix horizontal size. It must be an odd integer
  11472. between 3 and 23. The default value is 5.
  11473. @item chroma_msize_y, cy
  11474. Set the chroma matrix vertical size. It must be an odd integer
  11475. between 3 and 23. The default value is 5.
  11476. @item chroma_amount, ca
  11477. Set the chroma effect strength. It must be a floating point number, reasonable
  11478. values lay between -1.5 and 1.5.
  11479. Negative values will blur the input video, while positive values will
  11480. sharpen it, a value of zero will disable the effect.
  11481. Default value is 0.0.
  11482. @item opencl
  11483. If set to 1, specify using OpenCL capabilities, only available if
  11484. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  11485. @end table
  11486. All parameters are optional and default to the equivalent of the
  11487. string '5:5:1.0:5:5:0.0'.
  11488. @subsection Examples
  11489. @itemize
  11490. @item
  11491. Apply strong luma sharpen effect:
  11492. @example
  11493. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11494. @end example
  11495. @item
  11496. Apply a strong blur of both luma and chroma parameters:
  11497. @example
  11498. unsharp=7:7:-2:7:7:-2
  11499. @end example
  11500. @end itemize
  11501. @section uspp
  11502. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11503. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11504. shifts and average the results.
  11505. The way this differs from the behavior of spp is that uspp actually encodes &
  11506. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11507. DCT similar to MJPEG.
  11508. The filter accepts the following options:
  11509. @table @option
  11510. @item quality
  11511. Set quality. This option defines the number of levels for averaging. It accepts
  11512. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11513. effect. A value of @code{8} means the higher quality. For each increment of
  11514. that value the speed drops by a factor of approximately 2. Default value is
  11515. @code{3}.
  11516. @item qp
  11517. Force a constant quantization parameter. If not set, the filter will use the QP
  11518. from the video stream (if available).
  11519. @end table
  11520. @section vaguedenoiser
  11521. Apply a wavelet based denoiser.
  11522. It transforms each frame from the video input into the wavelet domain,
  11523. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11524. the obtained coefficients. It does an inverse wavelet transform after.
  11525. Due to wavelet properties, it should give a nice smoothed result, and
  11526. reduced noise, without blurring picture features.
  11527. This filter accepts the following options:
  11528. @table @option
  11529. @item threshold
  11530. The filtering strength. The higher, the more filtered the video will be.
  11531. Hard thresholding can use a higher threshold than soft thresholding
  11532. before the video looks overfiltered. Default value is 2.
  11533. @item method
  11534. The filtering method the filter will use.
  11535. It accepts the following values:
  11536. @table @samp
  11537. @item hard
  11538. All values under the threshold will be zeroed.
  11539. @item soft
  11540. All values under the threshold will be zeroed. All values above will be
  11541. reduced by the threshold.
  11542. @item garrote
  11543. Scales or nullifies coefficients - intermediary between (more) soft and
  11544. (less) hard thresholding.
  11545. @end table
  11546. Default is garrote.
  11547. @item nsteps
  11548. Number of times, the wavelet will decompose the picture. Picture can't
  11549. be decomposed beyond a particular point (typically, 8 for a 640x480
  11550. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  11551. @item percent
  11552. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  11553. @item planes
  11554. A list of the planes to process. By default all planes are processed.
  11555. @end table
  11556. @section vectorscope
  11557. Display 2 color component values in the two dimensional graph (which is called
  11558. a vectorscope).
  11559. This filter accepts the following options:
  11560. @table @option
  11561. @item mode, m
  11562. Set vectorscope mode.
  11563. It accepts the following values:
  11564. @table @samp
  11565. @item gray
  11566. Gray values are displayed on graph, higher brightness means more pixels have
  11567. same component color value on location in graph. This is the default mode.
  11568. @item color
  11569. Gray values are displayed on graph. Surrounding pixels values which are not
  11570. present in video frame are drawn in gradient of 2 color components which are
  11571. set by option @code{x} and @code{y}. The 3rd color component is static.
  11572. @item color2
  11573. Actual color components values present in video frame are displayed on graph.
  11574. @item color3
  11575. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11576. on graph increases value of another color component, which is luminance by
  11577. default values of @code{x} and @code{y}.
  11578. @item color4
  11579. Actual colors present in video frame are displayed on graph. If two different
  11580. colors map to same position on graph then color with higher value of component
  11581. not present in graph is picked.
  11582. @item color5
  11583. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11584. component picked from radial gradient.
  11585. @end table
  11586. @item x
  11587. Set which color component will be represented on X-axis. Default is @code{1}.
  11588. @item y
  11589. Set which color component will be represented on Y-axis. Default is @code{2}.
  11590. @item intensity, i
  11591. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11592. of color component which represents frequency of (X, Y) location in graph.
  11593. @item envelope, e
  11594. @table @samp
  11595. @item none
  11596. No envelope, this is default.
  11597. @item instant
  11598. Instant envelope, even darkest single pixel will be clearly highlighted.
  11599. @item peak
  11600. Hold maximum and minimum values presented in graph over time. This way you
  11601. can still spot out of range values without constantly looking at vectorscope.
  11602. @item peak+instant
  11603. Peak and instant envelope combined together.
  11604. @end table
  11605. @item graticule, g
  11606. Set what kind of graticule to draw.
  11607. @table @samp
  11608. @item none
  11609. @item green
  11610. @item color
  11611. @end table
  11612. @item opacity, o
  11613. Set graticule opacity.
  11614. @item flags, f
  11615. Set graticule flags.
  11616. @table @samp
  11617. @item white
  11618. Draw graticule for white point.
  11619. @item black
  11620. Draw graticule for black point.
  11621. @item name
  11622. Draw color points short names.
  11623. @end table
  11624. @item bgopacity, b
  11625. Set background opacity.
  11626. @item lthreshold, l
  11627. Set low threshold for color component not represented on X or Y axis.
  11628. Values lower than this value will be ignored. Default is 0.
  11629. Note this value is multiplied with actual max possible value one pixel component
  11630. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11631. is 0.1 * 255 = 25.
  11632. @item hthreshold, h
  11633. Set high threshold for color component not represented on X or Y axis.
  11634. Values higher than this value will be ignored. Default is 1.
  11635. Note this value is multiplied with actual max possible value one pixel component
  11636. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11637. is 0.9 * 255 = 230.
  11638. @item colorspace, c
  11639. Set what kind of colorspace to use when drawing graticule.
  11640. @table @samp
  11641. @item auto
  11642. @item 601
  11643. @item 709
  11644. @end table
  11645. Default is auto.
  11646. @end table
  11647. @anchor{vidstabdetect}
  11648. @section vidstabdetect
  11649. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11650. @ref{vidstabtransform} for pass 2.
  11651. This filter generates a file with relative translation and rotation
  11652. transform information about subsequent frames, which is then used by
  11653. the @ref{vidstabtransform} filter.
  11654. To enable compilation of this filter you need to configure FFmpeg with
  11655. @code{--enable-libvidstab}.
  11656. This filter accepts the following options:
  11657. @table @option
  11658. @item result
  11659. Set the path to the file used to write the transforms information.
  11660. Default value is @file{transforms.trf}.
  11661. @item shakiness
  11662. Set how shaky the video is and how quick the camera is. It accepts an
  11663. integer in the range 1-10, a value of 1 means little shakiness, a
  11664. value of 10 means strong shakiness. Default value is 5.
  11665. @item accuracy
  11666. Set the accuracy of the detection process. It must be a value in the
  11667. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11668. accuracy. Default value is 15.
  11669. @item stepsize
  11670. Set stepsize of the search process. The region around minimum is
  11671. scanned with 1 pixel resolution. Default value is 6.
  11672. @item mincontrast
  11673. Set minimum contrast. Below this value a local measurement field is
  11674. discarded. Must be a floating point value in the range 0-1. Default
  11675. value is 0.3.
  11676. @item tripod
  11677. Set reference frame number for tripod mode.
  11678. If enabled, the motion of the frames is compared to a reference frame
  11679. in the filtered stream, identified by the specified number. The idea
  11680. is to compensate all movements in a more-or-less static scene and keep
  11681. the camera view absolutely still.
  11682. If set to 0, it is disabled. The frames are counted starting from 1.
  11683. @item show
  11684. Show fields and transforms in the resulting frames. It accepts an
  11685. integer in the range 0-2. Default value is 0, which disables any
  11686. visualization.
  11687. @end table
  11688. @subsection Examples
  11689. @itemize
  11690. @item
  11691. Use default values:
  11692. @example
  11693. vidstabdetect
  11694. @end example
  11695. @item
  11696. Analyze strongly shaky movie and put the results in file
  11697. @file{mytransforms.trf}:
  11698. @example
  11699. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11700. @end example
  11701. @item
  11702. Visualize the result of internal transformations in the resulting
  11703. video:
  11704. @example
  11705. vidstabdetect=show=1
  11706. @end example
  11707. @item
  11708. Analyze a video with medium shakiness using @command{ffmpeg}:
  11709. @example
  11710. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11711. @end example
  11712. @end itemize
  11713. @anchor{vidstabtransform}
  11714. @section vidstabtransform
  11715. Video stabilization/deshaking: pass 2 of 2,
  11716. see @ref{vidstabdetect} for pass 1.
  11717. Read a file with transform information for each frame and
  11718. apply/compensate them. Together with the @ref{vidstabdetect}
  11719. filter this can be used to deshake videos. See also
  11720. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11721. the @ref{unsharp} filter, see below.
  11722. To enable compilation of this filter you need to configure FFmpeg with
  11723. @code{--enable-libvidstab}.
  11724. @subsection Options
  11725. @table @option
  11726. @item input
  11727. Set path to the file used to read the transforms. Default value is
  11728. @file{transforms.trf}.
  11729. @item smoothing
  11730. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11731. camera movements. Default value is 10.
  11732. For example a number of 10 means that 21 frames are used (10 in the
  11733. past and 10 in the future) to smoothen the motion in the video. A
  11734. larger value leads to a smoother video, but limits the acceleration of
  11735. the camera (pan/tilt movements). 0 is a special case where a static
  11736. camera is simulated.
  11737. @item optalgo
  11738. Set the camera path optimization algorithm.
  11739. Accepted values are:
  11740. @table @samp
  11741. @item gauss
  11742. gaussian kernel low-pass filter on camera motion (default)
  11743. @item avg
  11744. averaging on transformations
  11745. @end table
  11746. @item maxshift
  11747. Set maximal number of pixels to translate frames. Default value is -1,
  11748. meaning no limit.
  11749. @item maxangle
  11750. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11751. value is -1, meaning no limit.
  11752. @item crop
  11753. Specify how to deal with borders that may be visible due to movement
  11754. compensation.
  11755. Available values are:
  11756. @table @samp
  11757. @item keep
  11758. keep image information from previous frame (default)
  11759. @item black
  11760. fill the border black
  11761. @end table
  11762. @item invert
  11763. Invert transforms if set to 1. Default value is 0.
  11764. @item relative
  11765. Consider transforms as relative to previous frame if set to 1,
  11766. absolute if set to 0. Default value is 0.
  11767. @item zoom
  11768. Set percentage to zoom. A positive value will result in a zoom-in
  11769. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11770. zoom).
  11771. @item optzoom
  11772. Set optimal zooming to avoid borders.
  11773. Accepted values are:
  11774. @table @samp
  11775. @item 0
  11776. disabled
  11777. @item 1
  11778. optimal static zoom value is determined (only very strong movements
  11779. will lead to visible borders) (default)
  11780. @item 2
  11781. optimal adaptive zoom value is determined (no borders will be
  11782. visible), see @option{zoomspeed}
  11783. @end table
  11784. Note that the value given at zoom is added to the one calculated here.
  11785. @item zoomspeed
  11786. Set percent to zoom maximally each frame (enabled when
  11787. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11788. 0.25.
  11789. @item interpol
  11790. Specify type of interpolation.
  11791. Available values are:
  11792. @table @samp
  11793. @item no
  11794. no interpolation
  11795. @item linear
  11796. linear only horizontal
  11797. @item bilinear
  11798. linear in both directions (default)
  11799. @item bicubic
  11800. cubic in both directions (slow)
  11801. @end table
  11802. @item tripod
  11803. Enable virtual tripod mode if set to 1, which is equivalent to
  11804. @code{relative=0:smoothing=0}. Default value is 0.
  11805. Use also @code{tripod} option of @ref{vidstabdetect}.
  11806. @item debug
  11807. Increase log verbosity if set to 1. Also the detected global motions
  11808. are written to the temporary file @file{global_motions.trf}. Default
  11809. value is 0.
  11810. @end table
  11811. @subsection Examples
  11812. @itemize
  11813. @item
  11814. Use @command{ffmpeg} for a typical stabilization with default values:
  11815. @example
  11816. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11817. @end example
  11818. Note the use of the @ref{unsharp} filter which is always recommended.
  11819. @item
  11820. Zoom in a bit more and load transform data from a given file:
  11821. @example
  11822. vidstabtransform=zoom=5:input="mytransforms.trf"
  11823. @end example
  11824. @item
  11825. Smoothen the video even more:
  11826. @example
  11827. vidstabtransform=smoothing=30
  11828. @end example
  11829. @end itemize
  11830. @section vflip
  11831. Flip the input video vertically.
  11832. For example, to vertically flip a video with @command{ffmpeg}:
  11833. @example
  11834. ffmpeg -i in.avi -vf "vflip" out.avi
  11835. @end example
  11836. @anchor{vignette}
  11837. @section vignette
  11838. Make or reverse a natural vignetting effect.
  11839. The filter accepts the following options:
  11840. @table @option
  11841. @item angle, a
  11842. Set lens angle expression as a number of radians.
  11843. The value is clipped in the @code{[0,PI/2]} range.
  11844. Default value: @code{"PI/5"}
  11845. @item x0
  11846. @item y0
  11847. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11848. by default.
  11849. @item mode
  11850. Set forward/backward mode.
  11851. Available modes are:
  11852. @table @samp
  11853. @item forward
  11854. The larger the distance from the central point, the darker the image becomes.
  11855. @item backward
  11856. The larger the distance from the central point, the brighter the image becomes.
  11857. This can be used to reverse a vignette effect, though there is no automatic
  11858. detection to extract the lens @option{angle} and other settings (yet). It can
  11859. also be used to create a burning effect.
  11860. @end table
  11861. Default value is @samp{forward}.
  11862. @item eval
  11863. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11864. It accepts the following values:
  11865. @table @samp
  11866. @item init
  11867. Evaluate expressions only once during the filter initialization.
  11868. @item frame
  11869. Evaluate expressions for each incoming frame. This is way slower than the
  11870. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11871. allows advanced dynamic expressions.
  11872. @end table
  11873. Default value is @samp{init}.
  11874. @item dither
  11875. Set dithering to reduce the circular banding effects. Default is @code{1}
  11876. (enabled).
  11877. @item aspect
  11878. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11879. Setting this value to the SAR of the input will make a rectangular vignetting
  11880. following the dimensions of the video.
  11881. Default is @code{1/1}.
  11882. @end table
  11883. @subsection Expressions
  11884. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11885. following parameters.
  11886. @table @option
  11887. @item w
  11888. @item h
  11889. input width and height
  11890. @item n
  11891. the number of input frame, starting from 0
  11892. @item pts
  11893. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11894. @var{TB} units, NAN if undefined
  11895. @item r
  11896. frame rate of the input video, NAN if the input frame rate is unknown
  11897. @item t
  11898. the PTS (Presentation TimeStamp) of the filtered video frame,
  11899. expressed in seconds, NAN if undefined
  11900. @item tb
  11901. time base of the input video
  11902. @end table
  11903. @subsection Examples
  11904. @itemize
  11905. @item
  11906. Apply simple strong vignetting effect:
  11907. @example
  11908. vignette=PI/4
  11909. @end example
  11910. @item
  11911. Make a flickering vignetting:
  11912. @example
  11913. vignette='PI/4+random(1)*PI/50':eval=frame
  11914. @end example
  11915. @end itemize
  11916. @section vmafmotion
  11917. Obtain the average vmaf motion score of a video.
  11918. It is one of the component filters of VMAF.
  11919. The obtained average motion score is printed through the logging system.
  11920. In the below example the input file @file{ref.mpg} is being processed and score
  11921. is computed.
  11922. @example
  11923. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  11924. @end example
  11925. @section vstack
  11926. Stack input videos vertically.
  11927. All streams must be of same pixel format and of same width.
  11928. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11929. to create same output.
  11930. The filter accept the following option:
  11931. @table @option
  11932. @item inputs
  11933. Set number of input streams. Default is 2.
  11934. @item shortest
  11935. If set to 1, force the output to terminate when the shortest input
  11936. terminates. Default value is 0.
  11937. @end table
  11938. @section w3fdif
  11939. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11940. Deinterlacing Filter").
  11941. Based on the process described by Martin Weston for BBC R&D, and
  11942. implemented based on the de-interlace algorithm written by Jim
  11943. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11944. uses filter coefficients calculated by BBC R&D.
  11945. There are two sets of filter coefficients, so called "simple":
  11946. and "complex". Which set of filter coefficients is used can
  11947. be set by passing an optional parameter:
  11948. @table @option
  11949. @item filter
  11950. Set the interlacing filter coefficients. Accepts one of the following values:
  11951. @table @samp
  11952. @item simple
  11953. Simple filter coefficient set.
  11954. @item complex
  11955. More-complex filter coefficient set.
  11956. @end table
  11957. Default value is @samp{complex}.
  11958. @item deint
  11959. Specify which frames to deinterlace. Accept one of the following values:
  11960. @table @samp
  11961. @item all
  11962. Deinterlace all frames,
  11963. @item interlaced
  11964. Only deinterlace frames marked as interlaced.
  11965. @end table
  11966. Default value is @samp{all}.
  11967. @end table
  11968. @section waveform
  11969. Video waveform monitor.
  11970. The waveform monitor plots color component intensity. By default luminance
  11971. only. Each column of the waveform corresponds to a column of pixels in the
  11972. source video.
  11973. It accepts the following options:
  11974. @table @option
  11975. @item mode, m
  11976. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11977. In row mode, the graph on the left side represents color component value 0 and
  11978. the right side represents value = 255. In column mode, the top side represents
  11979. color component value = 0 and bottom side represents value = 255.
  11980. @item intensity, i
  11981. Set intensity. Smaller values are useful to find out how many values of the same
  11982. luminance are distributed across input rows/columns.
  11983. Default value is @code{0.04}. Allowed range is [0, 1].
  11984. @item mirror, r
  11985. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11986. In mirrored mode, higher values will be represented on the left
  11987. side for @code{row} mode and at the top for @code{column} mode. Default is
  11988. @code{1} (mirrored).
  11989. @item display, d
  11990. Set display mode.
  11991. It accepts the following values:
  11992. @table @samp
  11993. @item overlay
  11994. Presents information identical to that in the @code{parade}, except
  11995. that the graphs representing color components are superimposed directly
  11996. over one another.
  11997. This display mode makes it easier to spot relative differences or similarities
  11998. in overlapping areas of the color components that are supposed to be identical,
  11999. such as neutral whites, grays, or blacks.
  12000. @item stack
  12001. Display separate graph for the color components side by side in
  12002. @code{row} mode or one below the other in @code{column} mode.
  12003. @item parade
  12004. Display separate graph for the color components side by side in
  12005. @code{column} mode or one below the other in @code{row} mode.
  12006. Using this display mode makes it easy to spot color casts in the highlights
  12007. and shadows of an image, by comparing the contours of the top and the bottom
  12008. graphs of each waveform. Since whites, grays, and blacks are characterized
  12009. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12010. should display three waveforms of roughly equal width/height. If not, the
  12011. correction is easy to perform by making level adjustments the three waveforms.
  12012. @end table
  12013. Default is @code{stack}.
  12014. @item components, c
  12015. Set which color components to display. Default is 1, which means only luminance
  12016. or red color component if input is in RGB colorspace. If is set for example to
  12017. 7 it will display all 3 (if) available color components.
  12018. @item envelope, e
  12019. @table @samp
  12020. @item none
  12021. No envelope, this is default.
  12022. @item instant
  12023. Instant envelope, minimum and maximum values presented in graph will be easily
  12024. visible even with small @code{step} value.
  12025. @item peak
  12026. Hold minimum and maximum values presented in graph across time. This way you
  12027. can still spot out of range values without constantly looking at waveforms.
  12028. @item peak+instant
  12029. Peak and instant envelope combined together.
  12030. @end table
  12031. @item filter, f
  12032. @table @samp
  12033. @item lowpass
  12034. No filtering, this is default.
  12035. @item flat
  12036. Luma and chroma combined together.
  12037. @item aflat
  12038. Similar as above, but shows difference between blue and red chroma.
  12039. @item chroma
  12040. Displays only chroma.
  12041. @item color
  12042. Displays actual color value on waveform.
  12043. @item acolor
  12044. Similar as above, but with luma showing frequency of chroma values.
  12045. @end table
  12046. @item graticule, g
  12047. Set which graticule to display.
  12048. @table @samp
  12049. @item none
  12050. Do not display graticule.
  12051. @item green
  12052. Display green graticule showing legal broadcast ranges.
  12053. @end table
  12054. @item opacity, o
  12055. Set graticule opacity.
  12056. @item flags, fl
  12057. Set graticule flags.
  12058. @table @samp
  12059. @item numbers
  12060. Draw numbers above lines. By default enabled.
  12061. @item dots
  12062. Draw dots instead of lines.
  12063. @end table
  12064. @item scale, s
  12065. Set scale used for displaying graticule.
  12066. @table @samp
  12067. @item digital
  12068. @item millivolts
  12069. @item ire
  12070. @end table
  12071. Default is digital.
  12072. @item bgopacity, b
  12073. Set background opacity.
  12074. @end table
  12075. @section weave, doubleweave
  12076. The @code{weave} takes a field-based video input and join
  12077. each two sequential fields into single frame, producing a new double
  12078. height clip with half the frame rate and half the frame count.
  12079. The @code{doubleweave} works same as @code{weave} but without
  12080. halving frame rate and frame count.
  12081. It accepts the following option:
  12082. @table @option
  12083. @item first_field
  12084. Set first field. Available values are:
  12085. @table @samp
  12086. @item top, t
  12087. Set the frame as top-field-first.
  12088. @item bottom, b
  12089. Set the frame as bottom-field-first.
  12090. @end table
  12091. @end table
  12092. @subsection Examples
  12093. @itemize
  12094. @item
  12095. Interlace video using @ref{select} and @ref{separatefields} filter:
  12096. @example
  12097. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12098. @end example
  12099. @end itemize
  12100. @section xbr
  12101. Apply the xBR high-quality magnification filter which is designed for pixel
  12102. art. It follows a set of edge-detection rules, see
  12103. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12104. It accepts the following option:
  12105. @table @option
  12106. @item n
  12107. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12108. @code{3xBR} and @code{4} for @code{4xBR}.
  12109. Default is @code{3}.
  12110. @end table
  12111. @anchor{yadif}
  12112. @section yadif
  12113. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12114. filter").
  12115. It accepts the following parameters:
  12116. @table @option
  12117. @item mode
  12118. The interlacing mode to adopt. It accepts one of the following values:
  12119. @table @option
  12120. @item 0, send_frame
  12121. Output one frame for each frame.
  12122. @item 1, send_field
  12123. Output one frame for each field.
  12124. @item 2, send_frame_nospatial
  12125. Like @code{send_frame}, but it skips the spatial interlacing check.
  12126. @item 3, send_field_nospatial
  12127. Like @code{send_field}, but it skips the spatial interlacing check.
  12128. @end table
  12129. The default value is @code{send_frame}.
  12130. @item parity
  12131. The picture field parity assumed for the input interlaced video. It accepts one
  12132. of the following values:
  12133. @table @option
  12134. @item 0, tff
  12135. Assume the top field is first.
  12136. @item 1, bff
  12137. Assume the bottom field is first.
  12138. @item -1, auto
  12139. Enable automatic detection of field parity.
  12140. @end table
  12141. The default value is @code{auto}.
  12142. If the interlacing is unknown or the decoder does not export this information,
  12143. top field first will be assumed.
  12144. @item deint
  12145. Specify which frames to deinterlace. Accept one of the following
  12146. values:
  12147. @table @option
  12148. @item 0, all
  12149. Deinterlace all frames.
  12150. @item 1, interlaced
  12151. Only deinterlace frames marked as interlaced.
  12152. @end table
  12153. The default value is @code{all}.
  12154. @end table
  12155. @section zoompan
  12156. Apply Zoom & Pan effect.
  12157. This filter accepts the following options:
  12158. @table @option
  12159. @item zoom, z
  12160. Set the zoom expression. Default is 1.
  12161. @item x
  12162. @item y
  12163. Set the x and y expression. Default is 0.
  12164. @item d
  12165. Set the duration expression in number of frames.
  12166. This sets for how many number of frames effect will last for
  12167. single input image.
  12168. @item s
  12169. Set the output image size, default is 'hd720'.
  12170. @item fps
  12171. Set the output frame rate, default is '25'.
  12172. @end table
  12173. Each expression can contain the following constants:
  12174. @table @option
  12175. @item in_w, iw
  12176. Input width.
  12177. @item in_h, ih
  12178. Input height.
  12179. @item out_w, ow
  12180. Output width.
  12181. @item out_h, oh
  12182. Output height.
  12183. @item in
  12184. Input frame count.
  12185. @item on
  12186. Output frame count.
  12187. @item x
  12188. @item y
  12189. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12190. for current input frame.
  12191. @item px
  12192. @item py
  12193. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12194. not yet such frame (first input frame).
  12195. @item zoom
  12196. Last calculated zoom from 'z' expression for current input frame.
  12197. @item pzoom
  12198. Last calculated zoom of last output frame of previous input frame.
  12199. @item duration
  12200. Number of output frames for current input frame. Calculated from 'd' expression
  12201. for each input frame.
  12202. @item pduration
  12203. number of output frames created for previous input frame
  12204. @item a
  12205. Rational number: input width / input height
  12206. @item sar
  12207. sample aspect ratio
  12208. @item dar
  12209. display aspect ratio
  12210. @end table
  12211. @subsection Examples
  12212. @itemize
  12213. @item
  12214. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12215. @example
  12216. 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
  12217. @end example
  12218. @item
  12219. Zoom-in up to 1.5 and pan always at center of picture:
  12220. @example
  12221. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12222. @end example
  12223. @item
  12224. Same as above but without pausing:
  12225. @example
  12226. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12227. @end example
  12228. @end itemize
  12229. @anchor{zscale}
  12230. @section zscale
  12231. Scale (resize) the input video, using the z.lib library:
  12232. https://github.com/sekrit-twc/zimg.
  12233. The zscale filter forces the output display aspect ratio to be the same
  12234. as the input, by changing the output sample aspect ratio.
  12235. If the input image format is different from the format requested by
  12236. the next filter, the zscale filter will convert the input to the
  12237. requested format.
  12238. @subsection Options
  12239. The filter accepts the following options.
  12240. @table @option
  12241. @item width, w
  12242. @item height, h
  12243. Set the output video dimension expression. Default value is the input
  12244. dimension.
  12245. If the @var{width} or @var{w} value is 0, the input width is used for
  12246. the output. If the @var{height} or @var{h} value is 0, the input height
  12247. is used for the output.
  12248. If one and only one of the values is -n with n >= 1, the zscale filter
  12249. will use a value that maintains the aspect ratio of the input image,
  12250. calculated from the other specified dimension. After that it will,
  12251. however, make sure that the calculated dimension is divisible by n and
  12252. adjust the value if necessary.
  12253. If both values are -n with n >= 1, the behavior will be identical to
  12254. both values being set to 0 as previously detailed.
  12255. See below for the list of accepted constants for use in the dimension
  12256. expression.
  12257. @item size, s
  12258. Set the video size. For the syntax of this option, check the
  12259. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12260. @item dither, d
  12261. Set the dither type.
  12262. Possible values are:
  12263. @table @var
  12264. @item none
  12265. @item ordered
  12266. @item random
  12267. @item error_diffusion
  12268. @end table
  12269. Default is none.
  12270. @item filter, f
  12271. Set the resize filter type.
  12272. Possible values are:
  12273. @table @var
  12274. @item point
  12275. @item bilinear
  12276. @item bicubic
  12277. @item spline16
  12278. @item spline36
  12279. @item lanczos
  12280. @end table
  12281. Default is bilinear.
  12282. @item range, r
  12283. Set the color range.
  12284. Possible values are:
  12285. @table @var
  12286. @item input
  12287. @item limited
  12288. @item full
  12289. @end table
  12290. Default is same as input.
  12291. @item primaries, p
  12292. Set the color primaries.
  12293. Possible values are:
  12294. @table @var
  12295. @item input
  12296. @item 709
  12297. @item unspecified
  12298. @item 170m
  12299. @item 240m
  12300. @item 2020
  12301. @end table
  12302. Default is same as input.
  12303. @item transfer, t
  12304. Set the transfer characteristics.
  12305. Possible values are:
  12306. @table @var
  12307. @item input
  12308. @item 709
  12309. @item unspecified
  12310. @item 601
  12311. @item linear
  12312. @item 2020_10
  12313. @item 2020_12
  12314. @item smpte2084
  12315. @item iec61966-2-1
  12316. @item arib-std-b67
  12317. @end table
  12318. Default is same as input.
  12319. @item matrix, m
  12320. Set the colorspace matrix.
  12321. Possible value are:
  12322. @table @var
  12323. @item input
  12324. @item 709
  12325. @item unspecified
  12326. @item 470bg
  12327. @item 170m
  12328. @item 2020_ncl
  12329. @item 2020_cl
  12330. @end table
  12331. Default is same as input.
  12332. @item rangein, rin
  12333. Set the input color range.
  12334. Possible values are:
  12335. @table @var
  12336. @item input
  12337. @item limited
  12338. @item full
  12339. @end table
  12340. Default is same as input.
  12341. @item primariesin, pin
  12342. Set the input color primaries.
  12343. Possible values are:
  12344. @table @var
  12345. @item input
  12346. @item 709
  12347. @item unspecified
  12348. @item 170m
  12349. @item 240m
  12350. @item 2020
  12351. @end table
  12352. Default is same as input.
  12353. @item transferin, tin
  12354. Set the input transfer characteristics.
  12355. Possible values are:
  12356. @table @var
  12357. @item input
  12358. @item 709
  12359. @item unspecified
  12360. @item 601
  12361. @item linear
  12362. @item 2020_10
  12363. @item 2020_12
  12364. @end table
  12365. Default is same as input.
  12366. @item matrixin, min
  12367. Set the input colorspace matrix.
  12368. Possible value are:
  12369. @table @var
  12370. @item input
  12371. @item 709
  12372. @item unspecified
  12373. @item 470bg
  12374. @item 170m
  12375. @item 2020_ncl
  12376. @item 2020_cl
  12377. @end table
  12378. @item chromal, c
  12379. Set the output chroma location.
  12380. Possible values are:
  12381. @table @var
  12382. @item input
  12383. @item left
  12384. @item center
  12385. @item topleft
  12386. @item top
  12387. @item bottomleft
  12388. @item bottom
  12389. @end table
  12390. @item chromalin, cin
  12391. Set the input chroma location.
  12392. Possible values are:
  12393. @table @var
  12394. @item input
  12395. @item left
  12396. @item center
  12397. @item topleft
  12398. @item top
  12399. @item bottomleft
  12400. @item bottom
  12401. @end table
  12402. @item npl
  12403. Set the nominal peak luminance.
  12404. @end table
  12405. The values of the @option{w} and @option{h} options are expressions
  12406. containing the following constants:
  12407. @table @var
  12408. @item in_w
  12409. @item in_h
  12410. The input width and height
  12411. @item iw
  12412. @item ih
  12413. These are the same as @var{in_w} and @var{in_h}.
  12414. @item out_w
  12415. @item out_h
  12416. The output (scaled) width and height
  12417. @item ow
  12418. @item oh
  12419. These are the same as @var{out_w} and @var{out_h}
  12420. @item a
  12421. The same as @var{iw} / @var{ih}
  12422. @item sar
  12423. input sample aspect ratio
  12424. @item dar
  12425. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12426. @item hsub
  12427. @item vsub
  12428. horizontal and vertical input chroma subsample values. For example for the
  12429. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12430. @item ohsub
  12431. @item ovsub
  12432. horizontal and vertical output chroma subsample values. For example for the
  12433. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12434. @end table
  12435. @table @option
  12436. @end table
  12437. @c man end VIDEO FILTERS
  12438. @chapter Video Sources
  12439. @c man begin VIDEO SOURCES
  12440. Below is a description of the currently available video sources.
  12441. @section buffer
  12442. Buffer video frames, and make them available to the filter chain.
  12443. This source is mainly intended for a programmatic use, in particular
  12444. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12445. It accepts the following parameters:
  12446. @table @option
  12447. @item video_size
  12448. Specify the size (width and height) of the buffered video frames. For the
  12449. syntax of this option, check the
  12450. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12451. @item width
  12452. The input video width.
  12453. @item height
  12454. The input video height.
  12455. @item pix_fmt
  12456. A string representing the pixel format of the buffered video frames.
  12457. It may be a number corresponding to a pixel format, or a pixel format
  12458. name.
  12459. @item time_base
  12460. Specify the timebase assumed by the timestamps of the buffered frames.
  12461. @item frame_rate
  12462. Specify the frame rate expected for the video stream.
  12463. @item pixel_aspect, sar
  12464. The sample (pixel) aspect ratio of the input video.
  12465. @item sws_param
  12466. Specify the optional parameters to be used for the scale filter which
  12467. is automatically inserted when an input change is detected in the
  12468. input size or format.
  12469. @item hw_frames_ctx
  12470. When using a hardware pixel format, this should be a reference to an
  12471. AVHWFramesContext describing input frames.
  12472. @end table
  12473. For example:
  12474. @example
  12475. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12476. @end example
  12477. will instruct the source to accept video frames with size 320x240 and
  12478. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12479. square pixels (1:1 sample aspect ratio).
  12480. Since the pixel format with name "yuv410p" corresponds to the number 6
  12481. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12482. this example corresponds to:
  12483. @example
  12484. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12485. @end example
  12486. Alternatively, the options can be specified as a flat string, but this
  12487. syntax is deprecated:
  12488. @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}]
  12489. @section cellauto
  12490. Create a pattern generated by an elementary cellular automaton.
  12491. The initial state of the cellular automaton can be defined through the
  12492. @option{filename} and @option{pattern} options. If such options are
  12493. not specified an initial state is created randomly.
  12494. At each new frame a new row in the video is filled with the result of
  12495. the cellular automaton next generation. The behavior when the whole
  12496. frame is filled is defined by the @option{scroll} option.
  12497. This source accepts the following options:
  12498. @table @option
  12499. @item filename, f
  12500. Read the initial cellular automaton state, i.e. the starting row, from
  12501. the specified file.
  12502. In the file, each non-whitespace character is considered an alive
  12503. cell, a newline will terminate the row, and further characters in the
  12504. file will be ignored.
  12505. @item pattern, p
  12506. Read the initial cellular automaton state, i.e. the starting row, from
  12507. the specified string.
  12508. Each non-whitespace character in the string is considered an alive
  12509. cell, a newline will terminate the row, and further characters in the
  12510. string will be ignored.
  12511. @item rate, r
  12512. Set the video rate, that is the number of frames generated per second.
  12513. Default is 25.
  12514. @item random_fill_ratio, ratio
  12515. Set the random fill ratio for the initial cellular automaton row. It
  12516. is a floating point number value ranging from 0 to 1, defaults to
  12517. 1/PHI.
  12518. This option is ignored when a file or a pattern is specified.
  12519. @item random_seed, seed
  12520. Set the seed for filling randomly the initial row, must be an integer
  12521. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12522. set to -1, the filter will try to use a good random seed on a best
  12523. effort basis.
  12524. @item rule
  12525. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12526. Default value is 110.
  12527. @item size, s
  12528. Set the size of the output video. For the syntax of this option, check the
  12529. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12530. If @option{filename} or @option{pattern} is specified, the size is set
  12531. by default to the width of the specified initial state row, and the
  12532. height is set to @var{width} * PHI.
  12533. If @option{size} is set, it must contain the width of the specified
  12534. pattern string, and the specified pattern will be centered in the
  12535. larger row.
  12536. If a filename or a pattern string is not specified, the size value
  12537. defaults to "320x518" (used for a randomly generated initial state).
  12538. @item scroll
  12539. If set to 1, scroll the output upward when all the rows in the output
  12540. have been already filled. If set to 0, the new generated row will be
  12541. written over the top row just after the bottom row is filled.
  12542. Defaults to 1.
  12543. @item start_full, full
  12544. If set to 1, completely fill the output with generated rows before
  12545. outputting the first frame.
  12546. This is the default behavior, for disabling set the value to 0.
  12547. @item stitch
  12548. If set to 1, stitch the left and right row edges together.
  12549. This is the default behavior, for disabling set the value to 0.
  12550. @end table
  12551. @subsection Examples
  12552. @itemize
  12553. @item
  12554. Read the initial state from @file{pattern}, and specify an output of
  12555. size 200x400.
  12556. @example
  12557. cellauto=f=pattern:s=200x400
  12558. @end example
  12559. @item
  12560. Generate a random initial row with a width of 200 cells, with a fill
  12561. ratio of 2/3:
  12562. @example
  12563. cellauto=ratio=2/3:s=200x200
  12564. @end example
  12565. @item
  12566. Create a pattern generated by rule 18 starting by a single alive cell
  12567. centered on an initial row with width 100:
  12568. @example
  12569. cellauto=p=@@:s=100x400:full=0:rule=18
  12570. @end example
  12571. @item
  12572. Specify a more elaborated initial pattern:
  12573. @example
  12574. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12575. @end example
  12576. @end itemize
  12577. @anchor{coreimagesrc}
  12578. @section coreimagesrc
  12579. Video source generated on GPU using Apple's CoreImage API on OSX.
  12580. This video source is a specialized version of the @ref{coreimage} video filter.
  12581. Use a core image generator at the beginning of the applied filterchain to
  12582. generate the content.
  12583. The coreimagesrc video source accepts the following options:
  12584. @table @option
  12585. @item list_generators
  12586. List all available generators along with all their respective options as well as
  12587. possible minimum and maximum values along with the default values.
  12588. @example
  12589. list_generators=true
  12590. @end example
  12591. @item size, s
  12592. Specify the size of the sourced video. For the syntax of this option, check the
  12593. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12594. The default value is @code{320x240}.
  12595. @item rate, r
  12596. Specify the frame rate of the sourced video, as the number of frames
  12597. generated per second. It has to be a string in the format
  12598. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12599. number or a valid video frame rate abbreviation. The default value is
  12600. "25".
  12601. @item sar
  12602. Set the sample aspect ratio of the sourced video.
  12603. @item duration, d
  12604. Set the duration of the sourced video. See
  12605. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12606. for the accepted syntax.
  12607. If not specified, or the expressed duration is negative, the video is
  12608. supposed to be generated forever.
  12609. @end table
  12610. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12611. A complete filterchain can be used for further processing of the
  12612. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12613. and examples for details.
  12614. @subsection Examples
  12615. @itemize
  12616. @item
  12617. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12618. given as complete and escaped command-line for Apple's standard bash shell:
  12619. @example
  12620. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12621. @end example
  12622. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12623. need for a nullsrc video source.
  12624. @end itemize
  12625. @section mandelbrot
  12626. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12627. point specified with @var{start_x} and @var{start_y}.
  12628. This source accepts the following options:
  12629. @table @option
  12630. @item end_pts
  12631. Set the terminal pts value. Default value is 400.
  12632. @item end_scale
  12633. Set the terminal scale value.
  12634. Must be a floating point value. Default value is 0.3.
  12635. @item inner
  12636. Set the inner coloring mode, that is the algorithm used to draw the
  12637. Mandelbrot fractal internal region.
  12638. It shall assume one of the following values:
  12639. @table @option
  12640. @item black
  12641. Set black mode.
  12642. @item convergence
  12643. Show time until convergence.
  12644. @item mincol
  12645. Set color based on point closest to the origin of the iterations.
  12646. @item period
  12647. Set period mode.
  12648. @end table
  12649. Default value is @var{mincol}.
  12650. @item bailout
  12651. Set the bailout value. Default value is 10.0.
  12652. @item maxiter
  12653. Set the maximum of iterations performed by the rendering
  12654. algorithm. Default value is 7189.
  12655. @item outer
  12656. Set outer coloring mode.
  12657. It shall assume one of following values:
  12658. @table @option
  12659. @item iteration_count
  12660. Set iteration cound mode.
  12661. @item normalized_iteration_count
  12662. set normalized iteration count mode.
  12663. @end table
  12664. Default value is @var{normalized_iteration_count}.
  12665. @item rate, r
  12666. Set frame rate, expressed as number of frames per second. Default
  12667. value is "25".
  12668. @item size, s
  12669. Set frame size. For the syntax of this option, check the "Video
  12670. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12671. @item start_scale
  12672. Set the initial scale value. Default value is 3.0.
  12673. @item start_x
  12674. Set the initial x position. Must be a floating point value between
  12675. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12676. @item start_y
  12677. Set the initial y position. Must be a floating point value between
  12678. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12679. @end table
  12680. @section mptestsrc
  12681. Generate various test patterns, as generated by the MPlayer test filter.
  12682. The size of the generated video is fixed, and is 256x256.
  12683. This source is useful in particular for testing encoding features.
  12684. This source accepts the following options:
  12685. @table @option
  12686. @item rate, r
  12687. Specify the frame rate of the sourced video, as the number of frames
  12688. generated per second. It has to be a string in the format
  12689. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12690. number or a valid video frame rate abbreviation. The default value is
  12691. "25".
  12692. @item duration, d
  12693. Set the duration of the sourced video. See
  12694. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12695. for the accepted syntax.
  12696. If not specified, or the expressed duration is negative, the video is
  12697. supposed to be generated forever.
  12698. @item test, t
  12699. Set the number or the name of the test to perform. Supported tests are:
  12700. @table @option
  12701. @item dc_luma
  12702. @item dc_chroma
  12703. @item freq_luma
  12704. @item freq_chroma
  12705. @item amp_luma
  12706. @item amp_chroma
  12707. @item cbp
  12708. @item mv
  12709. @item ring1
  12710. @item ring2
  12711. @item all
  12712. @end table
  12713. Default value is "all", which will cycle through the list of all tests.
  12714. @end table
  12715. Some examples:
  12716. @example
  12717. mptestsrc=t=dc_luma
  12718. @end example
  12719. will generate a "dc_luma" test pattern.
  12720. @section frei0r_src
  12721. Provide a frei0r source.
  12722. To enable compilation of this filter you need to install the frei0r
  12723. header and configure FFmpeg with @code{--enable-frei0r}.
  12724. This source accepts the following parameters:
  12725. @table @option
  12726. @item size
  12727. The size of the video to generate. For the syntax of this option, check the
  12728. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12729. @item framerate
  12730. The framerate of the generated video. It may be a string of the form
  12731. @var{num}/@var{den} or a frame rate abbreviation.
  12732. @item filter_name
  12733. The name to the frei0r source to load. For more information regarding frei0r and
  12734. how to set the parameters, read the @ref{frei0r} section in the video filters
  12735. documentation.
  12736. @item filter_params
  12737. A '|'-separated list of parameters to pass to the frei0r source.
  12738. @end table
  12739. For example, to generate a frei0r partik0l source with size 200x200
  12740. and frame rate 10 which is overlaid on the overlay filter main input:
  12741. @example
  12742. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12743. @end example
  12744. @section life
  12745. Generate a life pattern.
  12746. This source is based on a generalization of John Conway's life game.
  12747. The sourced input represents a life grid, each pixel represents a cell
  12748. which can be in one of two possible states, alive or dead. Every cell
  12749. interacts with its eight neighbours, which are the cells that are
  12750. horizontally, vertically, or diagonally adjacent.
  12751. At each interaction the grid evolves according to the adopted rule,
  12752. which specifies the number of neighbor alive cells which will make a
  12753. cell stay alive or born. The @option{rule} option allows one to specify
  12754. the rule to adopt.
  12755. This source accepts the following options:
  12756. @table @option
  12757. @item filename, f
  12758. Set the file from which to read the initial grid state. In the file,
  12759. each non-whitespace character is considered an alive cell, and newline
  12760. is used to delimit the end of each row.
  12761. If this option is not specified, the initial grid is generated
  12762. randomly.
  12763. @item rate, r
  12764. Set the video rate, that is the number of frames generated per second.
  12765. Default is 25.
  12766. @item random_fill_ratio, ratio
  12767. Set the random fill ratio for the initial random grid. It is a
  12768. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12769. It is ignored when a file is specified.
  12770. @item random_seed, seed
  12771. Set the seed for filling the initial random grid, must be an integer
  12772. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12773. set to -1, the filter will try to use a good random seed on a best
  12774. effort basis.
  12775. @item rule
  12776. Set the life rule.
  12777. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12778. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12779. @var{NS} specifies the number of alive neighbor cells which make a
  12780. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12781. which make a dead cell to become alive (i.e. to "born").
  12782. "s" and "b" can be used in place of "S" and "B", respectively.
  12783. Alternatively a rule can be specified by an 18-bits integer. The 9
  12784. high order bits are used to encode the next cell state if it is alive
  12785. for each number of neighbor alive cells, the low order bits specify
  12786. the rule for "borning" new cells. Higher order bits encode for an
  12787. higher number of neighbor cells.
  12788. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12789. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12790. Default value is "S23/B3", which is the original Conway's game of life
  12791. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12792. cells, and will born a new cell if there are three alive cells around
  12793. a dead cell.
  12794. @item size, s
  12795. Set the size of the output video. For the syntax of this option, check the
  12796. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12797. If @option{filename} is specified, the size is set by default to the
  12798. same size of the input file. If @option{size} is set, it must contain
  12799. the size specified in the input file, and the initial grid defined in
  12800. that file is centered in the larger resulting area.
  12801. If a filename is not specified, the size value defaults to "320x240"
  12802. (used for a randomly generated initial grid).
  12803. @item stitch
  12804. If set to 1, stitch the left and right grid edges together, and the
  12805. top and bottom edges also. Defaults to 1.
  12806. @item mold
  12807. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12808. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12809. value from 0 to 255.
  12810. @item life_color
  12811. Set the color of living (or new born) cells.
  12812. @item death_color
  12813. Set the color of dead cells. If @option{mold} is set, this is the first color
  12814. used to represent a dead cell.
  12815. @item mold_color
  12816. Set mold color, for definitely dead and moldy cells.
  12817. For the syntax of these 3 color options, check the "Color" section in the
  12818. ffmpeg-utils manual.
  12819. @end table
  12820. @subsection Examples
  12821. @itemize
  12822. @item
  12823. Read a grid from @file{pattern}, and center it on a grid of size
  12824. 300x300 pixels:
  12825. @example
  12826. life=f=pattern:s=300x300
  12827. @end example
  12828. @item
  12829. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12830. @example
  12831. life=ratio=2/3:s=200x200
  12832. @end example
  12833. @item
  12834. Specify a custom rule for evolving a randomly generated grid:
  12835. @example
  12836. life=rule=S14/B34
  12837. @end example
  12838. @item
  12839. Full example with slow death effect (mold) using @command{ffplay}:
  12840. @example
  12841. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12842. @end example
  12843. @end itemize
  12844. @anchor{allrgb}
  12845. @anchor{allyuv}
  12846. @anchor{color}
  12847. @anchor{haldclutsrc}
  12848. @anchor{nullsrc}
  12849. @anchor{rgbtestsrc}
  12850. @anchor{smptebars}
  12851. @anchor{smptehdbars}
  12852. @anchor{testsrc}
  12853. @anchor{testsrc2}
  12854. @anchor{yuvtestsrc}
  12855. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12856. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12857. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12858. The @code{color} source provides an uniformly colored input.
  12859. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12860. @ref{haldclut} filter.
  12861. The @code{nullsrc} source returns unprocessed video frames. It is
  12862. mainly useful to be employed in analysis / debugging tools, or as the
  12863. source for filters which ignore the input data.
  12864. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12865. detecting RGB vs BGR issues. You should see a red, green and blue
  12866. stripe from top to bottom.
  12867. The @code{smptebars} source generates a color bars pattern, based on
  12868. the SMPTE Engineering Guideline EG 1-1990.
  12869. The @code{smptehdbars} source generates a color bars pattern, based on
  12870. the SMPTE RP 219-2002.
  12871. The @code{testsrc} source generates a test video pattern, showing a
  12872. color pattern, a scrolling gradient and a timestamp. This is mainly
  12873. intended for testing purposes.
  12874. The @code{testsrc2} source is similar to testsrc, but supports more
  12875. pixel formats instead of just @code{rgb24}. This allows using it as an
  12876. input for other tests without requiring a format conversion.
  12877. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12878. see a y, cb and cr stripe from top to bottom.
  12879. The sources accept the following parameters:
  12880. @table @option
  12881. @item alpha
  12882. Specify the alpha (opacity) of the background, only available in the
  12883. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  12884. 255 (fully opaque, the default).
  12885. @item color, c
  12886. Specify the color of the source, only available in the @code{color}
  12887. source. For the syntax of this option, check the "Color" section in the
  12888. ffmpeg-utils manual.
  12889. @item level
  12890. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12891. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12892. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12893. coded on a @code{1/(N*N)} scale.
  12894. @item size, s
  12895. Specify the size of the sourced video. For the syntax of this option, check the
  12896. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12897. The default value is @code{320x240}.
  12898. This option is not available with the @code{haldclutsrc} filter.
  12899. @item rate, r
  12900. Specify the frame rate of the sourced video, as the number of frames
  12901. generated per second. It has to be a string in the format
  12902. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12903. number or a valid video frame rate abbreviation. The default value is
  12904. "25".
  12905. @item sar
  12906. Set the sample aspect ratio of the sourced video.
  12907. @item duration, d
  12908. Set the duration of the sourced video. See
  12909. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12910. for the accepted syntax.
  12911. If not specified, or the expressed duration is negative, the video is
  12912. supposed to be generated forever.
  12913. @item decimals, n
  12914. Set the number of decimals to show in the timestamp, only available in the
  12915. @code{testsrc} source.
  12916. The displayed timestamp value will correspond to the original
  12917. timestamp value multiplied by the power of 10 of the specified
  12918. value. Default value is 0.
  12919. @end table
  12920. For example the following:
  12921. @example
  12922. testsrc=duration=5.3:size=qcif:rate=10
  12923. @end example
  12924. will generate a video with a duration of 5.3 seconds, with size
  12925. 176x144 and a frame rate of 10 frames per second.
  12926. The following graph description will generate a red source
  12927. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12928. frames per second.
  12929. @example
  12930. color=c=red@@0.2:s=qcif:r=10
  12931. @end example
  12932. If the input content is to be ignored, @code{nullsrc} can be used. The
  12933. following command generates noise in the luminance plane by employing
  12934. the @code{geq} filter:
  12935. @example
  12936. nullsrc=s=256x256, geq=random(1)*255:128:128
  12937. @end example
  12938. @subsection Commands
  12939. The @code{color} source supports the following commands:
  12940. @table @option
  12941. @item c, color
  12942. Set the color of the created image. Accepts the same syntax of the
  12943. corresponding @option{color} option.
  12944. @end table
  12945. @c man end VIDEO SOURCES
  12946. @chapter Video Sinks
  12947. @c man begin VIDEO SINKS
  12948. Below is a description of the currently available video sinks.
  12949. @section buffersink
  12950. Buffer video frames, and make them available to the end of the filter
  12951. graph.
  12952. This sink is mainly intended for programmatic use, in particular
  12953. through the interface defined in @file{libavfilter/buffersink.h}
  12954. or the options system.
  12955. It accepts a pointer to an AVBufferSinkContext structure, which
  12956. defines the incoming buffers' formats, to be passed as the opaque
  12957. parameter to @code{avfilter_init_filter} for initialization.
  12958. @section nullsink
  12959. Null video sink: do absolutely nothing with the input video. It is
  12960. mainly useful as a template and for use in analysis / debugging
  12961. tools.
  12962. @c man end VIDEO SINKS
  12963. @chapter Multimedia Filters
  12964. @c man begin MULTIMEDIA FILTERS
  12965. Below is a description of the currently available multimedia filters.
  12966. @section abitscope
  12967. Convert input audio to a video output, displaying the audio bit scope.
  12968. The filter accepts the following options:
  12969. @table @option
  12970. @item rate, r
  12971. Set frame rate, expressed as number of frames per second. Default
  12972. value is "25".
  12973. @item size, s
  12974. Specify the video size for the output. For the syntax of this option, check the
  12975. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12976. Default value is @code{1024x256}.
  12977. @item colors
  12978. Specify list of colors separated by space or by '|' which will be used to
  12979. draw channels. Unrecognized or missing colors will be replaced
  12980. by white color.
  12981. @end table
  12982. @section ahistogram
  12983. Convert input audio to a video output, displaying the volume histogram.
  12984. The filter accepts the following options:
  12985. @table @option
  12986. @item dmode
  12987. Specify how histogram is calculated.
  12988. It accepts the following values:
  12989. @table @samp
  12990. @item single
  12991. Use single histogram for all channels.
  12992. @item separate
  12993. Use separate histogram for each channel.
  12994. @end table
  12995. Default is @code{single}.
  12996. @item rate, r
  12997. Set frame rate, expressed as number of frames per second. Default
  12998. value is "25".
  12999. @item size, s
  13000. Specify the video size for the output. For the syntax of this option, check the
  13001. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13002. Default value is @code{hd720}.
  13003. @item scale
  13004. Set display scale.
  13005. It accepts the following values:
  13006. @table @samp
  13007. @item log
  13008. logarithmic
  13009. @item sqrt
  13010. square root
  13011. @item cbrt
  13012. cubic root
  13013. @item lin
  13014. linear
  13015. @item rlog
  13016. reverse logarithmic
  13017. @end table
  13018. Default is @code{log}.
  13019. @item ascale
  13020. Set amplitude scale.
  13021. It accepts the following values:
  13022. @table @samp
  13023. @item log
  13024. logarithmic
  13025. @item lin
  13026. linear
  13027. @end table
  13028. Default is @code{log}.
  13029. @item acount
  13030. Set how much frames to accumulate in histogram.
  13031. Defauls is 1. Setting this to -1 accumulates all frames.
  13032. @item rheight
  13033. Set histogram ratio of window height.
  13034. @item slide
  13035. Set sonogram sliding.
  13036. It accepts the following values:
  13037. @table @samp
  13038. @item replace
  13039. replace old rows with new ones.
  13040. @item scroll
  13041. scroll from top to bottom.
  13042. @end table
  13043. Default is @code{replace}.
  13044. @end table
  13045. @section aphasemeter
  13046. Convert input audio to a video output, displaying the audio phase.
  13047. The filter accepts the following options:
  13048. @table @option
  13049. @item rate, r
  13050. Set the output frame rate. Default value is @code{25}.
  13051. @item size, s
  13052. Set the video size for the output. For the syntax of this option, check the
  13053. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13054. Default value is @code{800x400}.
  13055. @item rc
  13056. @item gc
  13057. @item bc
  13058. Specify the red, green, blue contrast. Default values are @code{2},
  13059. @code{7} and @code{1}.
  13060. Allowed range is @code{[0, 255]}.
  13061. @item mpc
  13062. Set color which will be used for drawing median phase. If color is
  13063. @code{none} which is default, no median phase value will be drawn.
  13064. @item video
  13065. Enable video output. Default is enabled.
  13066. @end table
  13067. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13068. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13069. The @code{-1} means left and right channels are completely out of phase and
  13070. @code{1} means channels are in phase.
  13071. @section avectorscope
  13072. Convert input audio to a video output, representing the audio vector
  13073. scope.
  13074. The filter is used to measure the difference between channels of stereo
  13075. audio stream. A monoaural signal, consisting of identical left and right
  13076. signal, results in straight vertical line. Any stereo separation is visible
  13077. as a deviation from this line, creating a Lissajous figure.
  13078. If the straight (or deviation from it) but horizontal line appears this
  13079. indicates that the left and right channels are out of phase.
  13080. The filter accepts the following options:
  13081. @table @option
  13082. @item mode, m
  13083. Set the vectorscope mode.
  13084. Available values are:
  13085. @table @samp
  13086. @item lissajous
  13087. Lissajous rotated by 45 degrees.
  13088. @item lissajous_xy
  13089. Same as above but not rotated.
  13090. @item polar
  13091. Shape resembling half of circle.
  13092. @end table
  13093. Default value is @samp{lissajous}.
  13094. @item size, s
  13095. Set the video size for the output. For the syntax of this option, check the
  13096. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13097. Default value is @code{400x400}.
  13098. @item rate, r
  13099. Set the output frame rate. Default value is @code{25}.
  13100. @item rc
  13101. @item gc
  13102. @item bc
  13103. @item ac
  13104. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13105. @code{160}, @code{80} and @code{255}.
  13106. Allowed range is @code{[0, 255]}.
  13107. @item rf
  13108. @item gf
  13109. @item bf
  13110. @item af
  13111. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13112. @code{10}, @code{5} and @code{5}.
  13113. Allowed range is @code{[0, 255]}.
  13114. @item zoom
  13115. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13116. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13117. @item draw
  13118. Set the vectorscope drawing mode.
  13119. Available values are:
  13120. @table @samp
  13121. @item dot
  13122. Draw dot for each sample.
  13123. @item line
  13124. Draw line between previous and current sample.
  13125. @end table
  13126. Default value is @samp{dot}.
  13127. @item scale
  13128. Specify amplitude scale of audio samples.
  13129. Available values are:
  13130. @table @samp
  13131. @item lin
  13132. Linear.
  13133. @item sqrt
  13134. Square root.
  13135. @item cbrt
  13136. Cubic root.
  13137. @item log
  13138. Logarithmic.
  13139. @end table
  13140. @end table
  13141. @subsection Examples
  13142. @itemize
  13143. @item
  13144. Complete example using @command{ffplay}:
  13145. @example
  13146. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13147. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13148. @end example
  13149. @end itemize
  13150. @section bench, abench
  13151. Benchmark part of a filtergraph.
  13152. The filter accepts the following options:
  13153. @table @option
  13154. @item action
  13155. Start or stop a timer.
  13156. Available values are:
  13157. @table @samp
  13158. @item start
  13159. Get the current time, set it as frame metadata (using the key
  13160. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13161. @item stop
  13162. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13163. the input frame metadata to get the time difference. Time difference, average,
  13164. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13165. @code{min}) are then printed. The timestamps are expressed in seconds.
  13166. @end table
  13167. @end table
  13168. @subsection Examples
  13169. @itemize
  13170. @item
  13171. Benchmark @ref{selectivecolor} filter:
  13172. @example
  13173. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13174. @end example
  13175. @end itemize
  13176. @section concat
  13177. Concatenate audio and video streams, joining them together one after the
  13178. other.
  13179. The filter works on segments of synchronized video and audio streams. All
  13180. segments must have the same number of streams of each type, and that will
  13181. also be the number of streams at output.
  13182. The filter accepts the following options:
  13183. @table @option
  13184. @item n
  13185. Set the number of segments. Default is 2.
  13186. @item v
  13187. Set the number of output video streams, that is also the number of video
  13188. streams in each segment. Default is 1.
  13189. @item a
  13190. Set the number of output audio streams, that is also the number of audio
  13191. streams in each segment. Default is 0.
  13192. @item unsafe
  13193. Activate unsafe mode: do not fail if segments have a different format.
  13194. @end table
  13195. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13196. @var{a} audio outputs.
  13197. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13198. segment, in the same order as the outputs, then the inputs for the second
  13199. segment, etc.
  13200. Related streams do not always have exactly the same duration, for various
  13201. reasons including codec frame size or sloppy authoring. For that reason,
  13202. related synchronized streams (e.g. a video and its audio track) should be
  13203. concatenated at once. The concat filter will use the duration of the longest
  13204. stream in each segment (except the last one), and if necessary pad shorter
  13205. audio streams with silence.
  13206. For this filter to work correctly, all segments must start at timestamp 0.
  13207. All corresponding streams must have the same parameters in all segments; the
  13208. filtering system will automatically select a common pixel format for video
  13209. streams, and a common sample format, sample rate and channel layout for
  13210. audio streams, but other settings, such as resolution, must be converted
  13211. explicitly by the user.
  13212. Different frame rates are acceptable but will result in variable frame rate
  13213. at output; be sure to configure the output file to handle it.
  13214. @subsection Examples
  13215. @itemize
  13216. @item
  13217. Concatenate an opening, an episode and an ending, all in bilingual version
  13218. (video in stream 0, audio in streams 1 and 2):
  13219. @example
  13220. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13221. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13222. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13223. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13224. @end example
  13225. @item
  13226. Concatenate two parts, handling audio and video separately, using the
  13227. (a)movie sources, and adjusting the resolution:
  13228. @example
  13229. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13230. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13231. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13232. @end example
  13233. Note that a desync will happen at the stitch if the audio and video streams
  13234. do not have exactly the same duration in the first file.
  13235. @end itemize
  13236. @section drawgraph, adrawgraph
  13237. Draw a graph using input video or audio metadata.
  13238. It accepts the following parameters:
  13239. @table @option
  13240. @item m1
  13241. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13242. @item fg1
  13243. Set 1st foreground color expression.
  13244. @item m2
  13245. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13246. @item fg2
  13247. Set 2nd foreground color expression.
  13248. @item m3
  13249. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13250. @item fg3
  13251. Set 3rd foreground color expression.
  13252. @item m4
  13253. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13254. @item fg4
  13255. Set 4th foreground color expression.
  13256. @item min
  13257. Set minimal value of metadata value.
  13258. @item max
  13259. Set maximal value of metadata value.
  13260. @item bg
  13261. Set graph background color. Default is white.
  13262. @item mode
  13263. Set graph mode.
  13264. Available values for mode is:
  13265. @table @samp
  13266. @item bar
  13267. @item dot
  13268. @item line
  13269. @end table
  13270. Default is @code{line}.
  13271. @item slide
  13272. Set slide mode.
  13273. Available values for slide is:
  13274. @table @samp
  13275. @item frame
  13276. Draw new frame when right border is reached.
  13277. @item replace
  13278. Replace old columns with new ones.
  13279. @item scroll
  13280. Scroll from right to left.
  13281. @item rscroll
  13282. Scroll from left to right.
  13283. @item picture
  13284. Draw single picture.
  13285. @end table
  13286. Default is @code{frame}.
  13287. @item size
  13288. Set size of graph video. For the syntax of this option, check the
  13289. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13290. The default value is @code{900x256}.
  13291. The foreground color expressions can use the following variables:
  13292. @table @option
  13293. @item MIN
  13294. Minimal value of metadata value.
  13295. @item MAX
  13296. Maximal value of metadata value.
  13297. @item VAL
  13298. Current metadata key value.
  13299. @end table
  13300. The color is defined as 0xAABBGGRR.
  13301. @end table
  13302. Example using metadata from @ref{signalstats} filter:
  13303. @example
  13304. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13305. @end example
  13306. Example using metadata from @ref{ebur128} filter:
  13307. @example
  13308. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13309. @end example
  13310. @anchor{ebur128}
  13311. @section ebur128
  13312. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13313. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13314. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13315. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13316. The filter also has a video output (see the @var{video} option) with a real
  13317. time graph to observe the loudness evolution. The graphic contains the logged
  13318. message mentioned above, so it is not printed anymore when this option is set,
  13319. unless the verbose logging is set. The main graphing area contains the
  13320. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13321. the momentary loudness (400 milliseconds).
  13322. More information about the Loudness Recommendation EBU R128 on
  13323. @url{http://tech.ebu.ch/loudness}.
  13324. The filter accepts the following options:
  13325. @table @option
  13326. @item video
  13327. Activate the video output. The audio stream is passed unchanged whether this
  13328. option is set or no. The video stream will be the first output stream if
  13329. activated. Default is @code{0}.
  13330. @item size
  13331. Set the video size. This option is for video only. For the syntax of this
  13332. option, check the
  13333. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13334. Default and minimum resolution is @code{640x480}.
  13335. @item meter
  13336. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13337. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13338. other integer value between this range is allowed.
  13339. @item metadata
  13340. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13341. into 100ms output frames, each of them containing various loudness information
  13342. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13343. Default is @code{0}.
  13344. @item framelog
  13345. Force the frame logging level.
  13346. Available values are:
  13347. @table @samp
  13348. @item info
  13349. information logging level
  13350. @item verbose
  13351. verbose logging level
  13352. @end table
  13353. By default, the logging level is set to @var{info}. If the @option{video} or
  13354. the @option{metadata} options are set, it switches to @var{verbose}.
  13355. @item peak
  13356. Set peak mode(s).
  13357. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13358. values are:
  13359. @table @samp
  13360. @item none
  13361. Disable any peak mode (default).
  13362. @item sample
  13363. Enable sample-peak mode.
  13364. Simple peak mode looking for the higher sample value. It logs a message
  13365. for sample-peak (identified by @code{SPK}).
  13366. @item true
  13367. Enable true-peak mode.
  13368. If enabled, the peak lookup is done on an over-sampled version of the input
  13369. stream for better peak accuracy. It logs a message for true-peak.
  13370. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13371. This mode requires a build with @code{libswresample}.
  13372. @end table
  13373. @item dualmono
  13374. Treat mono input files as "dual mono". If a mono file is intended for playback
  13375. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13376. If set to @code{true}, this option will compensate for this effect.
  13377. Multi-channel input files are not affected by this option.
  13378. @item panlaw
  13379. Set a specific pan law to be used for the measurement of dual mono files.
  13380. This parameter is optional, and has a default value of -3.01dB.
  13381. @end table
  13382. @subsection Examples
  13383. @itemize
  13384. @item
  13385. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13386. @example
  13387. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13388. @end example
  13389. @item
  13390. Run an analysis with @command{ffmpeg}:
  13391. @example
  13392. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13393. @end example
  13394. @end itemize
  13395. @section interleave, ainterleave
  13396. Temporally interleave frames from several inputs.
  13397. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13398. These filters read frames from several inputs and send the oldest
  13399. queued frame to the output.
  13400. Input streams must have well defined, monotonically increasing frame
  13401. timestamp values.
  13402. In order to submit one frame to output, these filters need to enqueue
  13403. at least one frame for each input, so they cannot work in case one
  13404. input is not yet terminated and will not receive incoming frames.
  13405. For example consider the case when one input is a @code{select} filter
  13406. which always drops input frames. The @code{interleave} filter will keep
  13407. reading from that input, but it will never be able to send new frames
  13408. to output until the input sends an end-of-stream signal.
  13409. Also, depending on inputs synchronization, the filters will drop
  13410. frames in case one input receives more frames than the other ones, and
  13411. the queue is already filled.
  13412. These filters accept the following options:
  13413. @table @option
  13414. @item nb_inputs, n
  13415. Set the number of different inputs, it is 2 by default.
  13416. @end table
  13417. @subsection Examples
  13418. @itemize
  13419. @item
  13420. Interleave frames belonging to different streams using @command{ffmpeg}:
  13421. @example
  13422. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13423. @end example
  13424. @item
  13425. Add flickering blur effect:
  13426. @example
  13427. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13428. @end example
  13429. @end itemize
  13430. @section metadata, ametadata
  13431. Manipulate frame metadata.
  13432. This filter accepts the following options:
  13433. @table @option
  13434. @item mode
  13435. Set mode of operation of the filter.
  13436. Can be one of the following:
  13437. @table @samp
  13438. @item select
  13439. If both @code{value} and @code{key} is set, select frames
  13440. which have such metadata. If only @code{key} is set, select
  13441. every frame that has such key in metadata.
  13442. @item add
  13443. Add new metadata @code{key} and @code{value}. If key is already available
  13444. do nothing.
  13445. @item modify
  13446. Modify value of already present key.
  13447. @item delete
  13448. If @code{value} is set, delete only keys that have such value.
  13449. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13450. the frame.
  13451. @item print
  13452. Print key and its value if metadata was found. If @code{key} is not set print all
  13453. metadata values available in frame.
  13454. @end table
  13455. @item key
  13456. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13457. @item value
  13458. Set metadata value which will be used. This option is mandatory for
  13459. @code{modify} and @code{add} mode.
  13460. @item function
  13461. Which function to use when comparing metadata value and @code{value}.
  13462. Can be one of following:
  13463. @table @samp
  13464. @item same_str
  13465. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13466. @item starts_with
  13467. Values are interpreted as strings, returns true if metadata value starts with
  13468. the @code{value} option string.
  13469. @item less
  13470. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13471. @item equal
  13472. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13473. @item greater
  13474. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13475. @item expr
  13476. Values are interpreted as floats, returns true if expression from option @code{expr}
  13477. evaluates to true.
  13478. @end table
  13479. @item expr
  13480. Set expression which is used when @code{function} is set to @code{expr}.
  13481. The expression is evaluated through the eval API and can contain the following
  13482. constants:
  13483. @table @option
  13484. @item VALUE1
  13485. Float representation of @code{value} from metadata key.
  13486. @item VALUE2
  13487. Float representation of @code{value} as supplied by user in @code{value} option.
  13488. @end table
  13489. @item file
  13490. If specified in @code{print} mode, output is written to the named file. Instead of
  13491. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13492. for standard output. If @code{file} option is not set, output is written to the log
  13493. with AV_LOG_INFO loglevel.
  13494. @end table
  13495. @subsection Examples
  13496. @itemize
  13497. @item
  13498. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  13499. between 0 and 1.
  13500. @example
  13501. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13502. @end example
  13503. @item
  13504. Print silencedetect output to file @file{metadata.txt}.
  13505. @example
  13506. silencedetect,ametadata=mode=print:file=metadata.txt
  13507. @end example
  13508. @item
  13509. Direct all metadata to a pipe with file descriptor 4.
  13510. @example
  13511. metadata=mode=print:file='pipe\:4'
  13512. @end example
  13513. @end itemize
  13514. @section perms, aperms
  13515. Set read/write permissions for the output frames.
  13516. These filters are mainly aimed at developers to test direct path in the
  13517. following filter in the filtergraph.
  13518. The filters accept the following options:
  13519. @table @option
  13520. @item mode
  13521. Select the permissions mode.
  13522. It accepts the following values:
  13523. @table @samp
  13524. @item none
  13525. Do nothing. This is the default.
  13526. @item ro
  13527. Set all the output frames read-only.
  13528. @item rw
  13529. Set all the output frames directly writable.
  13530. @item toggle
  13531. Make the frame read-only if writable, and writable if read-only.
  13532. @item random
  13533. Set each output frame read-only or writable randomly.
  13534. @end table
  13535. @item seed
  13536. Set the seed for the @var{random} mode, must be an integer included between
  13537. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13538. @code{-1}, the filter will try to use a good random seed on a best effort
  13539. basis.
  13540. @end table
  13541. Note: in case of auto-inserted filter between the permission filter and the
  13542. following one, the permission might not be received as expected in that
  13543. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13544. perms/aperms filter can avoid this problem.
  13545. @section realtime, arealtime
  13546. Slow down filtering to match real time approximately.
  13547. These filters will pause the filtering for a variable amount of time to
  13548. match the output rate with the input timestamps.
  13549. They are similar to the @option{re} option to @code{ffmpeg}.
  13550. They accept the following options:
  13551. @table @option
  13552. @item limit
  13553. Time limit for the pauses. Any pause longer than that will be considered
  13554. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13555. @end table
  13556. @anchor{select}
  13557. @section select, aselect
  13558. Select frames to pass in output.
  13559. This filter accepts the following options:
  13560. @table @option
  13561. @item expr, e
  13562. Set expression, which is evaluated for each input frame.
  13563. If the expression is evaluated to zero, the frame is discarded.
  13564. If the evaluation result is negative or NaN, the frame is sent to the
  13565. first output; otherwise it is sent to the output with index
  13566. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13567. For example a value of @code{1.2} corresponds to the output with index
  13568. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13569. @item outputs, n
  13570. Set the number of outputs. The output to which to send the selected
  13571. frame is based on the result of the evaluation. Default value is 1.
  13572. @end table
  13573. The expression can contain the following constants:
  13574. @table @option
  13575. @item n
  13576. The (sequential) number of the filtered frame, starting from 0.
  13577. @item selected_n
  13578. The (sequential) number of the selected frame, starting from 0.
  13579. @item prev_selected_n
  13580. The sequential number of the last selected frame. It's NAN if undefined.
  13581. @item TB
  13582. The timebase of the input timestamps.
  13583. @item pts
  13584. The PTS (Presentation TimeStamp) of the filtered video frame,
  13585. expressed in @var{TB} units. It's NAN if undefined.
  13586. @item t
  13587. The PTS of the filtered video frame,
  13588. expressed in seconds. It's NAN if undefined.
  13589. @item prev_pts
  13590. The PTS of the previously filtered video frame. It's NAN if undefined.
  13591. @item prev_selected_pts
  13592. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13593. @item prev_selected_t
  13594. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  13595. @item start_pts
  13596. The PTS of the first video frame in the video. It's NAN if undefined.
  13597. @item start_t
  13598. The time of the first video frame in the video. It's NAN if undefined.
  13599. @item pict_type @emph{(video only)}
  13600. The type of the filtered frame. It can assume one of the following
  13601. values:
  13602. @table @option
  13603. @item I
  13604. @item P
  13605. @item B
  13606. @item S
  13607. @item SI
  13608. @item SP
  13609. @item BI
  13610. @end table
  13611. @item interlace_type @emph{(video only)}
  13612. The frame interlace type. It can assume one of the following values:
  13613. @table @option
  13614. @item PROGRESSIVE
  13615. The frame is progressive (not interlaced).
  13616. @item TOPFIRST
  13617. The frame is top-field-first.
  13618. @item BOTTOMFIRST
  13619. The frame is bottom-field-first.
  13620. @end table
  13621. @item consumed_sample_n @emph{(audio only)}
  13622. the number of selected samples before the current frame
  13623. @item samples_n @emph{(audio only)}
  13624. the number of samples in the current frame
  13625. @item sample_rate @emph{(audio only)}
  13626. the input sample rate
  13627. @item key
  13628. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13629. @item pos
  13630. the position in the file of the filtered frame, -1 if the information
  13631. is not available (e.g. for synthetic video)
  13632. @item scene @emph{(video only)}
  13633. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13634. probability for the current frame to introduce a new scene, while a higher
  13635. value means the current frame is more likely to be one (see the example below)
  13636. @item concatdec_select
  13637. The concat demuxer can select only part of a concat input file by setting an
  13638. inpoint and an outpoint, but the output packets may not be entirely contained
  13639. in the selected interval. By using this variable, it is possible to skip frames
  13640. generated by the concat demuxer which are not exactly contained in the selected
  13641. interval.
  13642. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13643. and the @var{lavf.concat.duration} packet metadata values which are also
  13644. present in the decoded frames.
  13645. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13646. start_time and either the duration metadata is missing or the frame pts is less
  13647. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13648. missing.
  13649. That basically means that an input frame is selected if its pts is within the
  13650. interval set by the concat demuxer.
  13651. @end table
  13652. The default value of the select expression is "1".
  13653. @subsection Examples
  13654. @itemize
  13655. @item
  13656. Select all frames in input:
  13657. @example
  13658. select
  13659. @end example
  13660. The example above is the same as:
  13661. @example
  13662. select=1
  13663. @end example
  13664. @item
  13665. Skip all frames:
  13666. @example
  13667. select=0
  13668. @end example
  13669. @item
  13670. Select only I-frames:
  13671. @example
  13672. select='eq(pict_type\,I)'
  13673. @end example
  13674. @item
  13675. Select one frame every 100:
  13676. @example
  13677. select='not(mod(n\,100))'
  13678. @end example
  13679. @item
  13680. Select only frames contained in the 10-20 time interval:
  13681. @example
  13682. select=between(t\,10\,20)
  13683. @end example
  13684. @item
  13685. Select only I-frames contained in the 10-20 time interval:
  13686. @example
  13687. select=between(t\,10\,20)*eq(pict_type\,I)
  13688. @end example
  13689. @item
  13690. Select frames with a minimum distance of 10 seconds:
  13691. @example
  13692. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13693. @end example
  13694. @item
  13695. Use aselect to select only audio frames with samples number > 100:
  13696. @example
  13697. aselect='gt(samples_n\,100)'
  13698. @end example
  13699. @item
  13700. Create a mosaic of the first scenes:
  13701. @example
  13702. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13703. @end example
  13704. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13705. choice.
  13706. @item
  13707. Send even and odd frames to separate outputs, and compose them:
  13708. @example
  13709. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13710. @end example
  13711. @item
  13712. Select useful frames from an ffconcat file which is using inpoints and
  13713. outpoints but where the source files are not intra frame only.
  13714. @example
  13715. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13716. @end example
  13717. @end itemize
  13718. @section sendcmd, asendcmd
  13719. Send commands to filters in the filtergraph.
  13720. These filters read commands to be sent to other filters in the
  13721. filtergraph.
  13722. @code{sendcmd} must be inserted between two video filters,
  13723. @code{asendcmd} must be inserted between two audio filters, but apart
  13724. from that they act the same way.
  13725. The specification of commands can be provided in the filter arguments
  13726. with the @var{commands} option, or in a file specified by the
  13727. @var{filename} option.
  13728. These filters accept the following options:
  13729. @table @option
  13730. @item commands, c
  13731. Set the commands to be read and sent to the other filters.
  13732. @item filename, f
  13733. Set the filename of the commands to be read and sent to the other
  13734. filters.
  13735. @end table
  13736. @subsection Commands syntax
  13737. A commands description consists of a sequence of interval
  13738. specifications, comprising a list of commands to be executed when a
  13739. particular event related to that interval occurs. The occurring event
  13740. is typically the current frame time entering or leaving a given time
  13741. interval.
  13742. An interval is specified by the following syntax:
  13743. @example
  13744. @var{START}[-@var{END}] @var{COMMANDS};
  13745. @end example
  13746. The time interval is specified by the @var{START} and @var{END} times.
  13747. @var{END} is optional and defaults to the maximum time.
  13748. The current frame time is considered within the specified interval if
  13749. it is included in the interval [@var{START}, @var{END}), that is when
  13750. the time is greater or equal to @var{START} and is lesser than
  13751. @var{END}.
  13752. @var{COMMANDS} consists of a sequence of one or more command
  13753. specifications, separated by ",", relating to that interval. The
  13754. syntax of a command specification is given by:
  13755. @example
  13756. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13757. @end example
  13758. @var{FLAGS} is optional and specifies the type of events relating to
  13759. the time interval which enable sending the specified command, and must
  13760. be a non-null sequence of identifier flags separated by "+" or "|" and
  13761. enclosed between "[" and "]".
  13762. The following flags are recognized:
  13763. @table @option
  13764. @item enter
  13765. The command is sent when the current frame timestamp enters the
  13766. specified interval. In other words, the command is sent when the
  13767. previous frame timestamp was not in the given interval, and the
  13768. current is.
  13769. @item leave
  13770. The command is sent when the current frame timestamp leaves the
  13771. specified interval. In other words, the command is sent when the
  13772. previous frame timestamp was in the given interval, and the
  13773. current is not.
  13774. @end table
  13775. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13776. assumed.
  13777. @var{TARGET} specifies the target of the command, usually the name of
  13778. the filter class or a specific filter instance name.
  13779. @var{COMMAND} specifies the name of the command for the target filter.
  13780. @var{ARG} is optional and specifies the optional list of argument for
  13781. the given @var{COMMAND}.
  13782. Between one interval specification and another, whitespaces, or
  13783. sequences of characters starting with @code{#} until the end of line,
  13784. are ignored and can be used to annotate comments.
  13785. A simplified BNF description of the commands specification syntax
  13786. follows:
  13787. @example
  13788. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13789. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13790. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13791. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13792. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13793. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13794. @end example
  13795. @subsection Examples
  13796. @itemize
  13797. @item
  13798. Specify audio tempo change at second 4:
  13799. @example
  13800. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13801. @end example
  13802. @item
  13803. Target a specific filter instance:
  13804. @example
  13805. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13806. @end example
  13807. @item
  13808. Specify a list of drawtext and hue commands in a file.
  13809. @example
  13810. # show text in the interval 5-10
  13811. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13812. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13813. # desaturate the image in the interval 15-20
  13814. 15.0-20.0 [enter] hue s 0,
  13815. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13816. [leave] hue s 1,
  13817. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13818. # apply an exponential saturation fade-out effect, starting from time 25
  13819. 25 [enter] hue s exp(25-t)
  13820. @end example
  13821. A filtergraph allowing to read and process the above command list
  13822. stored in a file @file{test.cmd}, can be specified with:
  13823. @example
  13824. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13825. @end example
  13826. @end itemize
  13827. @anchor{setpts}
  13828. @section setpts, asetpts
  13829. Change the PTS (presentation timestamp) of the input frames.
  13830. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13831. This filter accepts the following options:
  13832. @table @option
  13833. @item expr
  13834. The expression which is evaluated for each frame to construct its timestamp.
  13835. @end table
  13836. The expression is evaluated through the eval API and can contain the following
  13837. constants:
  13838. @table @option
  13839. @item FRAME_RATE
  13840. frame rate, only defined for constant frame-rate video
  13841. @item PTS
  13842. The presentation timestamp in input
  13843. @item N
  13844. The count of the input frame for video or the number of consumed samples,
  13845. not including the current frame for audio, starting from 0.
  13846. @item NB_CONSUMED_SAMPLES
  13847. The number of consumed samples, not including the current frame (only
  13848. audio)
  13849. @item NB_SAMPLES, S
  13850. The number of samples in the current frame (only audio)
  13851. @item SAMPLE_RATE, SR
  13852. The audio sample rate.
  13853. @item STARTPTS
  13854. The PTS of the first frame.
  13855. @item STARTT
  13856. the time in seconds of the first frame
  13857. @item INTERLACED
  13858. State whether the current frame is interlaced.
  13859. @item T
  13860. the time in seconds of the current frame
  13861. @item POS
  13862. original position in the file of the frame, or undefined if undefined
  13863. for the current frame
  13864. @item PREV_INPTS
  13865. The previous input PTS.
  13866. @item PREV_INT
  13867. previous input time in seconds
  13868. @item PREV_OUTPTS
  13869. The previous output PTS.
  13870. @item PREV_OUTT
  13871. previous output time in seconds
  13872. @item RTCTIME
  13873. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13874. instead.
  13875. @item RTCSTART
  13876. The wallclock (RTC) time at the start of the movie in microseconds.
  13877. @item TB
  13878. The timebase of the input timestamps.
  13879. @end table
  13880. @subsection Examples
  13881. @itemize
  13882. @item
  13883. Start counting PTS from zero
  13884. @example
  13885. setpts=PTS-STARTPTS
  13886. @end example
  13887. @item
  13888. Apply fast motion effect:
  13889. @example
  13890. setpts=0.5*PTS
  13891. @end example
  13892. @item
  13893. Apply slow motion effect:
  13894. @example
  13895. setpts=2.0*PTS
  13896. @end example
  13897. @item
  13898. Set fixed rate of 25 frames per second:
  13899. @example
  13900. setpts=N/(25*TB)
  13901. @end example
  13902. @item
  13903. Set fixed rate 25 fps with some jitter:
  13904. @example
  13905. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13906. @end example
  13907. @item
  13908. Apply an offset of 10 seconds to the input PTS:
  13909. @example
  13910. setpts=PTS+10/TB
  13911. @end example
  13912. @item
  13913. Generate timestamps from a "live source" and rebase onto the current timebase:
  13914. @example
  13915. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13916. @end example
  13917. @item
  13918. Generate timestamps by counting samples:
  13919. @example
  13920. asetpts=N/SR/TB
  13921. @end example
  13922. @end itemize
  13923. @section settb, asettb
  13924. Set the timebase to use for the output frames timestamps.
  13925. It is mainly useful for testing timebase configuration.
  13926. It accepts the following parameters:
  13927. @table @option
  13928. @item expr, tb
  13929. The expression which is evaluated into the output timebase.
  13930. @end table
  13931. The value for @option{tb} is an arithmetic expression representing a
  13932. rational. The expression can contain the constants "AVTB" (the default
  13933. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13934. audio only). Default value is "intb".
  13935. @subsection Examples
  13936. @itemize
  13937. @item
  13938. Set the timebase to 1/25:
  13939. @example
  13940. settb=expr=1/25
  13941. @end example
  13942. @item
  13943. Set the timebase to 1/10:
  13944. @example
  13945. settb=expr=0.1
  13946. @end example
  13947. @item
  13948. Set the timebase to 1001/1000:
  13949. @example
  13950. settb=1+0.001
  13951. @end example
  13952. @item
  13953. Set the timebase to 2*intb:
  13954. @example
  13955. settb=2*intb
  13956. @end example
  13957. @item
  13958. Set the default timebase value:
  13959. @example
  13960. settb=AVTB
  13961. @end example
  13962. @end itemize
  13963. @section showcqt
  13964. Convert input audio to a video output representing frequency spectrum
  13965. logarithmically using Brown-Puckette constant Q transform algorithm with
  13966. direct frequency domain coefficient calculation (but the transform itself
  13967. is not really constant Q, instead the Q factor is actually variable/clamped),
  13968. with musical tone scale, from E0 to D#10.
  13969. The filter accepts the following options:
  13970. @table @option
  13971. @item size, s
  13972. Specify the video size for the output. It must be even. For the syntax of this option,
  13973. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13974. Default value is @code{1920x1080}.
  13975. @item fps, rate, r
  13976. Set the output frame rate. Default value is @code{25}.
  13977. @item bar_h
  13978. Set the bargraph height. It must be even. Default value is @code{-1} which
  13979. computes the bargraph height automatically.
  13980. @item axis_h
  13981. Set the axis height. It must be even. Default value is @code{-1} which computes
  13982. the axis height automatically.
  13983. @item sono_h
  13984. Set the sonogram height. It must be even. Default value is @code{-1} which
  13985. computes the sonogram height automatically.
  13986. @item fullhd
  13987. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13988. instead. Default value is @code{1}.
  13989. @item sono_v, volume
  13990. Specify the sonogram volume expression. It can contain variables:
  13991. @table @option
  13992. @item bar_v
  13993. the @var{bar_v} evaluated expression
  13994. @item frequency, freq, f
  13995. the frequency where it is evaluated
  13996. @item timeclamp, tc
  13997. the value of @var{timeclamp} option
  13998. @end table
  13999. and functions:
  14000. @table @option
  14001. @item a_weighting(f)
  14002. A-weighting of equal loudness
  14003. @item b_weighting(f)
  14004. B-weighting of equal loudness
  14005. @item c_weighting(f)
  14006. C-weighting of equal loudness.
  14007. @end table
  14008. Default value is @code{16}.
  14009. @item bar_v, volume2
  14010. Specify the bargraph volume expression. It can contain variables:
  14011. @table @option
  14012. @item sono_v
  14013. the @var{sono_v} evaluated expression
  14014. @item frequency, freq, f
  14015. the frequency where it is evaluated
  14016. @item timeclamp, tc
  14017. the value of @var{timeclamp} option
  14018. @end table
  14019. and functions:
  14020. @table @option
  14021. @item a_weighting(f)
  14022. A-weighting of equal loudness
  14023. @item b_weighting(f)
  14024. B-weighting of equal loudness
  14025. @item c_weighting(f)
  14026. C-weighting of equal loudness.
  14027. @end table
  14028. Default value is @code{sono_v}.
  14029. @item sono_g, gamma
  14030. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14031. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14032. Acceptable range is @code{[1, 7]}.
  14033. @item bar_g, gamma2
  14034. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14035. @code{[1, 7]}.
  14036. @item bar_t
  14037. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14038. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14039. @item timeclamp, tc
  14040. Specify the transform timeclamp. At low frequency, there is trade-off between
  14041. accuracy in time domain and frequency domain. If timeclamp is lower,
  14042. event in time domain is represented more accurately (such as fast bass drum),
  14043. otherwise event in frequency domain is represented more accurately
  14044. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14045. @item attack
  14046. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14047. limits future samples by applying asymmetric windowing in time domain, useful
  14048. when low latency is required. Accepted range is @code{[0, 1]}.
  14049. @item basefreq
  14050. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14051. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14052. @item endfreq
  14053. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14054. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14055. @item coeffclamp
  14056. This option is deprecated and ignored.
  14057. @item tlength
  14058. Specify the transform length in time domain. Use this option to control accuracy
  14059. trade-off between time domain and frequency domain at every frequency sample.
  14060. It can contain variables:
  14061. @table @option
  14062. @item frequency, freq, f
  14063. the frequency where it is evaluated
  14064. @item timeclamp, tc
  14065. the value of @var{timeclamp} option.
  14066. @end table
  14067. Default value is @code{384*tc/(384+tc*f)}.
  14068. @item count
  14069. Specify the transform count for every video frame. Default value is @code{6}.
  14070. Acceptable range is @code{[1, 30]}.
  14071. @item fcount
  14072. Specify the transform count for every single pixel. Default value is @code{0},
  14073. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14074. @item fontfile
  14075. Specify font file for use with freetype to draw the axis. If not specified,
  14076. use embedded font. Note that drawing with font file or embedded font is not
  14077. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14078. option instead.
  14079. @item font
  14080. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14081. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14082. @item fontcolor
  14083. Specify font color expression. This is arithmetic expression that should return
  14084. integer value 0xRRGGBB. It can contain variables:
  14085. @table @option
  14086. @item frequency, freq, f
  14087. the frequency where it is evaluated
  14088. @item timeclamp, tc
  14089. the value of @var{timeclamp} option
  14090. @end table
  14091. and functions:
  14092. @table @option
  14093. @item midi(f)
  14094. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14095. @item r(x), g(x), b(x)
  14096. red, green, and blue value of intensity x.
  14097. @end table
  14098. Default value is @code{st(0, (midi(f)-59.5)/12);
  14099. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14100. r(1-ld(1)) + b(ld(1))}.
  14101. @item axisfile
  14102. Specify image file to draw the axis. This option override @var{fontfile} and
  14103. @var{fontcolor} option.
  14104. @item axis, text
  14105. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14106. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14107. Default value is @code{1}.
  14108. @item csp
  14109. Set colorspace. The accepted values are:
  14110. @table @samp
  14111. @item unspecified
  14112. Unspecified (default)
  14113. @item bt709
  14114. BT.709
  14115. @item fcc
  14116. FCC
  14117. @item bt470bg
  14118. BT.470BG or BT.601-6 625
  14119. @item smpte170m
  14120. SMPTE-170M or BT.601-6 525
  14121. @item smpte240m
  14122. SMPTE-240M
  14123. @item bt2020ncl
  14124. BT.2020 with non-constant luminance
  14125. @end table
  14126. @item cscheme
  14127. Set spectrogram color scheme. This is list of floating point values with format
  14128. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14129. The default is @code{1|0.5|0|0|0.5|1}.
  14130. @end table
  14131. @subsection Examples
  14132. @itemize
  14133. @item
  14134. Playing audio while showing the spectrum:
  14135. @example
  14136. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14137. @end example
  14138. @item
  14139. Same as above, but with frame rate 30 fps:
  14140. @example
  14141. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14142. @end example
  14143. @item
  14144. Playing at 1280x720:
  14145. @example
  14146. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14147. @end example
  14148. @item
  14149. Disable sonogram display:
  14150. @example
  14151. sono_h=0
  14152. @end example
  14153. @item
  14154. A1 and its harmonics: A1, A2, (near)E3, A3:
  14155. @example
  14156. 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),
  14157. asplit[a][out1]; [a] showcqt [out0]'
  14158. @end example
  14159. @item
  14160. Same as above, but with more accuracy in frequency domain:
  14161. @example
  14162. 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),
  14163. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14164. @end example
  14165. @item
  14166. Custom volume:
  14167. @example
  14168. bar_v=10:sono_v=bar_v*a_weighting(f)
  14169. @end example
  14170. @item
  14171. Custom gamma, now spectrum is linear to the amplitude.
  14172. @example
  14173. bar_g=2:sono_g=2
  14174. @end example
  14175. @item
  14176. Custom tlength equation:
  14177. @example
  14178. 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)))'
  14179. @end example
  14180. @item
  14181. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14182. @example
  14183. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14184. @end example
  14185. @item
  14186. Custom font using fontconfig:
  14187. @example
  14188. font='Courier New,Monospace,mono|bold'
  14189. @end example
  14190. @item
  14191. Custom frequency range with custom axis using image file:
  14192. @example
  14193. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14194. @end example
  14195. @end itemize
  14196. @section showfreqs
  14197. Convert input audio to video output representing the audio power spectrum.
  14198. Audio amplitude is on Y-axis while frequency is on X-axis.
  14199. The filter accepts the following options:
  14200. @table @option
  14201. @item size, s
  14202. Specify size of video. For the syntax of this option, check the
  14203. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14204. Default is @code{1024x512}.
  14205. @item mode
  14206. Set display mode.
  14207. This set how each frequency bin will be represented.
  14208. It accepts the following values:
  14209. @table @samp
  14210. @item line
  14211. @item bar
  14212. @item dot
  14213. @end table
  14214. Default is @code{bar}.
  14215. @item ascale
  14216. Set amplitude scale.
  14217. It accepts the following values:
  14218. @table @samp
  14219. @item lin
  14220. Linear scale.
  14221. @item sqrt
  14222. Square root scale.
  14223. @item cbrt
  14224. Cubic root scale.
  14225. @item log
  14226. Logarithmic scale.
  14227. @end table
  14228. Default is @code{log}.
  14229. @item fscale
  14230. Set frequency scale.
  14231. It accepts the following values:
  14232. @table @samp
  14233. @item lin
  14234. Linear scale.
  14235. @item log
  14236. Logarithmic scale.
  14237. @item rlog
  14238. Reverse logarithmic scale.
  14239. @end table
  14240. Default is @code{lin}.
  14241. @item win_size
  14242. Set window size.
  14243. It accepts the following values:
  14244. @table @samp
  14245. @item w16
  14246. @item w32
  14247. @item w64
  14248. @item w128
  14249. @item w256
  14250. @item w512
  14251. @item w1024
  14252. @item w2048
  14253. @item w4096
  14254. @item w8192
  14255. @item w16384
  14256. @item w32768
  14257. @item w65536
  14258. @end table
  14259. Default is @code{w2048}
  14260. @item win_func
  14261. Set windowing function.
  14262. It accepts the following values:
  14263. @table @samp
  14264. @item rect
  14265. @item bartlett
  14266. @item hanning
  14267. @item hamming
  14268. @item blackman
  14269. @item welch
  14270. @item flattop
  14271. @item bharris
  14272. @item bnuttall
  14273. @item bhann
  14274. @item sine
  14275. @item nuttall
  14276. @item lanczos
  14277. @item gauss
  14278. @item tukey
  14279. @item dolph
  14280. @item cauchy
  14281. @item parzen
  14282. @item poisson
  14283. @end table
  14284. Default is @code{hanning}.
  14285. @item overlap
  14286. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14287. which means optimal overlap for selected window function will be picked.
  14288. @item averaging
  14289. Set time averaging. Setting this to 0 will display current maximal peaks.
  14290. Default is @code{1}, which means time averaging is disabled.
  14291. @item colors
  14292. Specify list of colors separated by space or by '|' which will be used to
  14293. draw channel frequencies. Unrecognized or missing colors will be replaced
  14294. by white color.
  14295. @item cmode
  14296. Set channel display mode.
  14297. It accepts the following values:
  14298. @table @samp
  14299. @item combined
  14300. @item separate
  14301. @end table
  14302. Default is @code{combined}.
  14303. @item minamp
  14304. Set minimum amplitude used in @code{log} amplitude scaler.
  14305. @end table
  14306. @anchor{showspectrum}
  14307. @section showspectrum
  14308. Convert input audio to a video output, representing the audio frequency
  14309. spectrum.
  14310. The filter accepts the following options:
  14311. @table @option
  14312. @item size, s
  14313. Specify the video size for the output. For the syntax of this option, check the
  14314. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14315. Default value is @code{640x512}.
  14316. @item slide
  14317. Specify how the spectrum should slide along the window.
  14318. It accepts the following values:
  14319. @table @samp
  14320. @item replace
  14321. the samples start again on the left when they reach the right
  14322. @item scroll
  14323. the samples scroll from right to left
  14324. @item fullframe
  14325. frames are only produced when the samples reach the right
  14326. @item rscroll
  14327. the samples scroll from left to right
  14328. @end table
  14329. Default value is @code{replace}.
  14330. @item mode
  14331. Specify display mode.
  14332. It accepts the following values:
  14333. @table @samp
  14334. @item combined
  14335. all channels are displayed in the same row
  14336. @item separate
  14337. all channels are displayed in separate rows
  14338. @end table
  14339. Default value is @samp{combined}.
  14340. @item color
  14341. Specify display color mode.
  14342. It accepts the following values:
  14343. @table @samp
  14344. @item channel
  14345. each channel is displayed in a separate color
  14346. @item intensity
  14347. each channel is displayed using the same color scheme
  14348. @item rainbow
  14349. each channel is displayed using the rainbow color scheme
  14350. @item moreland
  14351. each channel is displayed using the moreland color scheme
  14352. @item nebulae
  14353. each channel is displayed using the nebulae color scheme
  14354. @item fire
  14355. each channel is displayed using the fire color scheme
  14356. @item fiery
  14357. each channel is displayed using the fiery color scheme
  14358. @item fruit
  14359. each channel is displayed using the fruit color scheme
  14360. @item cool
  14361. each channel is displayed using the cool color scheme
  14362. @end table
  14363. Default value is @samp{channel}.
  14364. @item scale
  14365. Specify scale used for calculating intensity color values.
  14366. It accepts the following values:
  14367. @table @samp
  14368. @item lin
  14369. linear
  14370. @item sqrt
  14371. square root, default
  14372. @item cbrt
  14373. cubic root
  14374. @item log
  14375. logarithmic
  14376. @item 4thrt
  14377. 4th root
  14378. @item 5thrt
  14379. 5th root
  14380. @end table
  14381. Default value is @samp{sqrt}.
  14382. @item saturation
  14383. Set saturation modifier for displayed colors. Negative values provide
  14384. alternative color scheme. @code{0} is no saturation at all.
  14385. Saturation must be in [-10.0, 10.0] range.
  14386. Default value is @code{1}.
  14387. @item win_func
  14388. Set window function.
  14389. It accepts the following values:
  14390. @table @samp
  14391. @item rect
  14392. @item bartlett
  14393. @item hann
  14394. @item hanning
  14395. @item hamming
  14396. @item blackman
  14397. @item welch
  14398. @item flattop
  14399. @item bharris
  14400. @item bnuttall
  14401. @item bhann
  14402. @item sine
  14403. @item nuttall
  14404. @item lanczos
  14405. @item gauss
  14406. @item tukey
  14407. @item dolph
  14408. @item cauchy
  14409. @item parzen
  14410. @item poisson
  14411. @end table
  14412. Default value is @code{hann}.
  14413. @item orientation
  14414. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14415. @code{horizontal}. Default is @code{vertical}.
  14416. @item overlap
  14417. Set ratio of overlap window. Default value is @code{0}.
  14418. When value is @code{1} overlap is set to recommended size for specific
  14419. window function currently used.
  14420. @item gain
  14421. Set scale gain for calculating intensity color values.
  14422. Default value is @code{1}.
  14423. @item data
  14424. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14425. @item rotation
  14426. Set color rotation, must be in [-1.0, 1.0] range.
  14427. Default value is @code{0}.
  14428. @end table
  14429. The usage is very similar to the showwaves filter; see the examples in that
  14430. section.
  14431. @subsection Examples
  14432. @itemize
  14433. @item
  14434. Large window with logarithmic color scaling:
  14435. @example
  14436. showspectrum=s=1280x480:scale=log
  14437. @end example
  14438. @item
  14439. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14440. @example
  14441. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14442. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14443. @end example
  14444. @end itemize
  14445. @section showspectrumpic
  14446. Convert input audio to a single video frame, representing the audio frequency
  14447. spectrum.
  14448. The filter accepts the following options:
  14449. @table @option
  14450. @item size, s
  14451. Specify the video size for the output. For the syntax of this option, check the
  14452. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14453. Default value is @code{4096x2048}.
  14454. @item mode
  14455. Specify display mode.
  14456. It accepts the following values:
  14457. @table @samp
  14458. @item combined
  14459. all channels are displayed in the same row
  14460. @item separate
  14461. all channels are displayed in separate rows
  14462. @end table
  14463. Default value is @samp{combined}.
  14464. @item color
  14465. Specify display color mode.
  14466. It accepts the following values:
  14467. @table @samp
  14468. @item channel
  14469. each channel is displayed in a separate color
  14470. @item intensity
  14471. each channel is displayed using the same color scheme
  14472. @item rainbow
  14473. each channel is displayed using the rainbow color scheme
  14474. @item moreland
  14475. each channel is displayed using the moreland color scheme
  14476. @item nebulae
  14477. each channel is displayed using the nebulae color scheme
  14478. @item fire
  14479. each channel is displayed using the fire color scheme
  14480. @item fiery
  14481. each channel is displayed using the fiery color scheme
  14482. @item fruit
  14483. each channel is displayed using the fruit color scheme
  14484. @item cool
  14485. each channel is displayed using the cool color scheme
  14486. @end table
  14487. Default value is @samp{intensity}.
  14488. @item scale
  14489. Specify scale used for calculating intensity color values.
  14490. It accepts the following values:
  14491. @table @samp
  14492. @item lin
  14493. linear
  14494. @item sqrt
  14495. square root, default
  14496. @item cbrt
  14497. cubic root
  14498. @item log
  14499. logarithmic
  14500. @item 4thrt
  14501. 4th root
  14502. @item 5thrt
  14503. 5th root
  14504. @end table
  14505. Default value is @samp{log}.
  14506. @item saturation
  14507. Set saturation modifier for displayed colors. Negative values provide
  14508. alternative color scheme. @code{0} is no saturation at all.
  14509. Saturation must be in [-10.0, 10.0] range.
  14510. Default value is @code{1}.
  14511. @item win_func
  14512. Set window function.
  14513. It accepts the following values:
  14514. @table @samp
  14515. @item rect
  14516. @item bartlett
  14517. @item hann
  14518. @item hanning
  14519. @item hamming
  14520. @item blackman
  14521. @item welch
  14522. @item flattop
  14523. @item bharris
  14524. @item bnuttall
  14525. @item bhann
  14526. @item sine
  14527. @item nuttall
  14528. @item lanczos
  14529. @item gauss
  14530. @item tukey
  14531. @item dolph
  14532. @item cauchy
  14533. @item parzen
  14534. @item poisson
  14535. @end table
  14536. Default value is @code{hann}.
  14537. @item orientation
  14538. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14539. @code{horizontal}. Default is @code{vertical}.
  14540. @item gain
  14541. Set scale gain for calculating intensity color values.
  14542. Default value is @code{1}.
  14543. @item legend
  14544. Draw time and frequency axes and legends. Default is enabled.
  14545. @item rotation
  14546. Set color rotation, must be in [-1.0, 1.0] range.
  14547. Default value is @code{0}.
  14548. @end table
  14549. @subsection Examples
  14550. @itemize
  14551. @item
  14552. Extract an audio spectrogram of a whole audio track
  14553. in a 1024x1024 picture using @command{ffmpeg}:
  14554. @example
  14555. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14556. @end example
  14557. @end itemize
  14558. @section showvolume
  14559. Convert input audio volume to a video output.
  14560. The filter accepts the following options:
  14561. @table @option
  14562. @item rate, r
  14563. Set video rate.
  14564. @item b
  14565. Set border width, allowed range is [0, 5]. Default is 1.
  14566. @item w
  14567. Set channel width, allowed range is [80, 8192]. Default is 400.
  14568. @item h
  14569. Set channel height, allowed range is [1, 900]. Default is 20.
  14570. @item f
  14571. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14572. @item c
  14573. Set volume color expression.
  14574. The expression can use the following variables:
  14575. @table @option
  14576. @item VOLUME
  14577. Current max volume of channel in dB.
  14578. @item PEAK
  14579. Current peak.
  14580. @item CHANNEL
  14581. Current channel number, starting from 0.
  14582. @end table
  14583. @item t
  14584. If set, displays channel names. Default is enabled.
  14585. @item v
  14586. If set, displays volume values. Default is enabled.
  14587. @item o
  14588. Set orientation, can be @code{horizontal} or @code{vertical},
  14589. default is @code{horizontal}.
  14590. @item s
  14591. Set step size, allowed range s [0, 5]. Default is 0, which means
  14592. step is disabled.
  14593. @end table
  14594. @section showwaves
  14595. Convert input audio to a video output, representing the samples waves.
  14596. The filter accepts the following options:
  14597. @table @option
  14598. @item size, s
  14599. Specify the video size for the output. For the syntax of this option, check the
  14600. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14601. Default value is @code{600x240}.
  14602. @item mode
  14603. Set display mode.
  14604. Available values are:
  14605. @table @samp
  14606. @item point
  14607. Draw a point for each sample.
  14608. @item line
  14609. Draw a vertical line for each sample.
  14610. @item p2p
  14611. Draw a point for each sample and a line between them.
  14612. @item cline
  14613. Draw a centered vertical line for each sample.
  14614. @end table
  14615. Default value is @code{point}.
  14616. @item n
  14617. Set the number of samples which are printed on the same column. A
  14618. larger value will decrease the frame rate. Must be a positive
  14619. integer. This option can be set only if the value for @var{rate}
  14620. is not explicitly specified.
  14621. @item rate, r
  14622. Set the (approximate) output frame rate. This is done by setting the
  14623. option @var{n}. Default value is "25".
  14624. @item split_channels
  14625. Set if channels should be drawn separately or overlap. Default value is 0.
  14626. @item colors
  14627. Set colors separated by '|' which are going to be used for drawing of each channel.
  14628. @item scale
  14629. Set amplitude scale.
  14630. Available values are:
  14631. @table @samp
  14632. @item lin
  14633. Linear.
  14634. @item log
  14635. Logarithmic.
  14636. @item sqrt
  14637. Square root.
  14638. @item cbrt
  14639. Cubic root.
  14640. @end table
  14641. Default is linear.
  14642. @end table
  14643. @subsection Examples
  14644. @itemize
  14645. @item
  14646. Output the input file audio and the corresponding video representation
  14647. at the same time:
  14648. @example
  14649. amovie=a.mp3,asplit[out0],showwaves[out1]
  14650. @end example
  14651. @item
  14652. Create a synthetic signal and show it with showwaves, forcing a
  14653. frame rate of 30 frames per second:
  14654. @example
  14655. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14656. @end example
  14657. @end itemize
  14658. @section showwavespic
  14659. Convert input audio to a single video frame, representing the samples waves.
  14660. The filter accepts the following options:
  14661. @table @option
  14662. @item size, s
  14663. Specify the video size for the output. For the syntax of this option, check the
  14664. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14665. Default value is @code{600x240}.
  14666. @item split_channels
  14667. Set if channels should be drawn separately or overlap. Default value is 0.
  14668. @item colors
  14669. Set colors separated by '|' which are going to be used for drawing of each channel.
  14670. @item scale
  14671. Set amplitude scale.
  14672. Available values are:
  14673. @table @samp
  14674. @item lin
  14675. Linear.
  14676. @item log
  14677. Logarithmic.
  14678. @item sqrt
  14679. Square root.
  14680. @item cbrt
  14681. Cubic root.
  14682. @end table
  14683. Default is linear.
  14684. @end table
  14685. @subsection Examples
  14686. @itemize
  14687. @item
  14688. Extract a channel split representation of the wave form of a whole audio track
  14689. in a 1024x800 picture using @command{ffmpeg}:
  14690. @example
  14691. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14692. @end example
  14693. @end itemize
  14694. @section sidedata, asidedata
  14695. Delete frame side data, or select frames based on it.
  14696. This filter accepts the following options:
  14697. @table @option
  14698. @item mode
  14699. Set mode of operation of the filter.
  14700. Can be one of the following:
  14701. @table @samp
  14702. @item select
  14703. Select every frame with side data of @code{type}.
  14704. @item delete
  14705. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14706. data in the frame.
  14707. @end table
  14708. @item type
  14709. Set side data type used with all modes. Must be set for @code{select} mode. For
  14710. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14711. in @file{libavutil/frame.h}. For example, to choose
  14712. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14713. @end table
  14714. @section spectrumsynth
  14715. Sythesize audio from 2 input video spectrums, first input stream represents
  14716. magnitude across time and second represents phase across time.
  14717. The filter will transform from frequency domain as displayed in videos back
  14718. to time domain as presented in audio output.
  14719. This filter is primarily created for reversing processed @ref{showspectrum}
  14720. filter outputs, but can synthesize sound from other spectrograms too.
  14721. But in such case results are going to be poor if the phase data is not
  14722. available, because in such cases phase data need to be recreated, usually
  14723. its just recreated from random noise.
  14724. For best results use gray only output (@code{channel} color mode in
  14725. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14726. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14727. @code{data} option. Inputs videos should generally use @code{fullframe}
  14728. slide mode as that saves resources needed for decoding video.
  14729. The filter accepts the following options:
  14730. @table @option
  14731. @item sample_rate
  14732. Specify sample rate of output audio, the sample rate of audio from which
  14733. spectrum was generated may differ.
  14734. @item channels
  14735. Set number of channels represented in input video spectrums.
  14736. @item scale
  14737. Set scale which was used when generating magnitude input spectrum.
  14738. Can be @code{lin} or @code{log}. Default is @code{log}.
  14739. @item slide
  14740. Set slide which was used when generating inputs spectrums.
  14741. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14742. Default is @code{fullframe}.
  14743. @item win_func
  14744. Set window function used for resynthesis.
  14745. @item overlap
  14746. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14747. which means optimal overlap for selected window function will be picked.
  14748. @item orientation
  14749. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14750. Default is @code{vertical}.
  14751. @end table
  14752. @subsection Examples
  14753. @itemize
  14754. @item
  14755. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14756. then resynthesize videos back to audio with spectrumsynth:
  14757. @example
  14758. 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
  14759. 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
  14760. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14761. @end example
  14762. @end itemize
  14763. @section split, asplit
  14764. Split input into several identical outputs.
  14765. @code{asplit} works with audio input, @code{split} with video.
  14766. The filter accepts a single parameter which specifies the number of outputs. If
  14767. unspecified, it defaults to 2.
  14768. @subsection Examples
  14769. @itemize
  14770. @item
  14771. Create two separate outputs from the same input:
  14772. @example
  14773. [in] split [out0][out1]
  14774. @end example
  14775. @item
  14776. To create 3 or more outputs, you need to specify the number of
  14777. outputs, like in:
  14778. @example
  14779. [in] asplit=3 [out0][out1][out2]
  14780. @end example
  14781. @item
  14782. Create two separate outputs from the same input, one cropped and
  14783. one padded:
  14784. @example
  14785. [in] split [splitout1][splitout2];
  14786. [splitout1] crop=100:100:0:0 [cropout];
  14787. [splitout2] pad=200:200:100:100 [padout];
  14788. @end example
  14789. @item
  14790. Create 5 copies of the input audio with @command{ffmpeg}:
  14791. @example
  14792. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14793. @end example
  14794. @end itemize
  14795. @section zmq, azmq
  14796. Receive commands sent through a libzmq client, and forward them to
  14797. filters in the filtergraph.
  14798. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14799. must be inserted between two video filters, @code{azmq} between two
  14800. audio filters.
  14801. To enable these filters you need to install the libzmq library and
  14802. headers and configure FFmpeg with @code{--enable-libzmq}.
  14803. For more information about libzmq see:
  14804. @url{http://www.zeromq.org/}
  14805. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14806. receives messages sent through a network interface defined by the
  14807. @option{bind_address} option.
  14808. The received message must be in the form:
  14809. @example
  14810. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14811. @end example
  14812. @var{TARGET} specifies the target of the command, usually the name of
  14813. the filter class or a specific filter instance name.
  14814. @var{COMMAND} specifies the name of the command for the target filter.
  14815. @var{ARG} is optional and specifies the optional argument list for the
  14816. given @var{COMMAND}.
  14817. Upon reception, the message is processed and the corresponding command
  14818. is injected into the filtergraph. Depending on the result, the filter
  14819. will send a reply to the client, adopting the format:
  14820. @example
  14821. @var{ERROR_CODE} @var{ERROR_REASON}
  14822. @var{MESSAGE}
  14823. @end example
  14824. @var{MESSAGE} is optional.
  14825. @subsection Examples
  14826. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14827. be used to send commands processed by these filters.
  14828. Consider the following filtergraph generated by @command{ffplay}
  14829. @example
  14830. ffplay -dumpgraph 1 -f lavfi "
  14831. color=s=100x100:c=red [l];
  14832. color=s=100x100:c=blue [r];
  14833. nullsrc=s=200x100, zmq [bg];
  14834. [bg][l] overlay [bg+l];
  14835. [bg+l][r] overlay=x=100 "
  14836. @end example
  14837. To change the color of the left side of the video, the following
  14838. command can be used:
  14839. @example
  14840. echo Parsed_color_0 c yellow | tools/zmqsend
  14841. @end example
  14842. To change the right side:
  14843. @example
  14844. echo Parsed_color_1 c pink | tools/zmqsend
  14845. @end example
  14846. @c man end MULTIMEDIA FILTERS
  14847. @chapter Multimedia Sources
  14848. @c man begin MULTIMEDIA SOURCES
  14849. Below is a description of the currently available multimedia sources.
  14850. @section amovie
  14851. This is the same as @ref{movie} source, except it selects an audio
  14852. stream by default.
  14853. @anchor{movie}
  14854. @section movie
  14855. Read audio and/or video stream(s) from a movie container.
  14856. It accepts the following parameters:
  14857. @table @option
  14858. @item filename
  14859. The name of the resource to read (not necessarily a file; it can also be a
  14860. device or a stream accessed through some protocol).
  14861. @item format_name, f
  14862. Specifies the format assumed for the movie to read, and can be either
  14863. the name of a container or an input device. If not specified, the
  14864. format is guessed from @var{movie_name} or by probing.
  14865. @item seek_point, sp
  14866. Specifies the seek point in seconds. The frames will be output
  14867. starting from this seek point. The parameter is evaluated with
  14868. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14869. postfix. The default value is "0".
  14870. @item streams, s
  14871. Specifies the streams to read. Several streams can be specified,
  14872. separated by "+". The source will then have as many outputs, in the
  14873. same order. The syntax is explained in the ``Stream specifiers''
  14874. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14875. respectively the default (best suited) video and audio stream. Default
  14876. is "dv", or "da" if the filter is called as "amovie".
  14877. @item stream_index, si
  14878. Specifies the index of the video stream to read. If the value is -1,
  14879. the most suitable video stream will be automatically selected. The default
  14880. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14881. audio instead of video.
  14882. @item loop
  14883. Specifies how many times to read the stream in sequence.
  14884. If the value is 0, the stream will be looped infinitely.
  14885. Default value is "1".
  14886. Note that when the movie is looped the source timestamps are not
  14887. changed, so it will generate non monotonically increasing timestamps.
  14888. @item discontinuity
  14889. Specifies the time difference between frames above which the point is
  14890. considered a timestamp discontinuity which is removed by adjusting the later
  14891. timestamps.
  14892. @end table
  14893. It allows overlaying a second video on top of the main input of
  14894. a filtergraph, as shown in this graph:
  14895. @example
  14896. input -----------> deltapts0 --> overlay --> output
  14897. ^
  14898. |
  14899. movie --> scale--> deltapts1 -------+
  14900. @end example
  14901. @subsection Examples
  14902. @itemize
  14903. @item
  14904. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14905. on top of the input labelled "in":
  14906. @example
  14907. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14908. [in] setpts=PTS-STARTPTS [main];
  14909. [main][over] overlay=16:16 [out]
  14910. @end example
  14911. @item
  14912. Read from a video4linux2 device, and overlay it on top of the input
  14913. labelled "in":
  14914. @example
  14915. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14916. [in] setpts=PTS-STARTPTS [main];
  14917. [main][over] overlay=16:16 [out]
  14918. @end example
  14919. @item
  14920. Read the first video stream and the audio stream with id 0x81 from
  14921. dvd.vob; the video is connected to the pad named "video" and the audio is
  14922. connected to the pad named "audio":
  14923. @example
  14924. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14925. @end example
  14926. @end itemize
  14927. @subsection Commands
  14928. Both movie and amovie support the following commands:
  14929. @table @option
  14930. @item seek
  14931. Perform seek using "av_seek_frame".
  14932. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14933. @itemize
  14934. @item
  14935. @var{stream_index}: If stream_index is -1, a default
  14936. stream is selected, and @var{timestamp} is automatically converted
  14937. from AV_TIME_BASE units to the stream specific time_base.
  14938. @item
  14939. @var{timestamp}: Timestamp in AVStream.time_base units
  14940. or, if no stream is specified, in AV_TIME_BASE units.
  14941. @item
  14942. @var{flags}: Flags which select direction and seeking mode.
  14943. @end itemize
  14944. @item get_duration
  14945. Get movie duration in AV_TIME_BASE units.
  14946. @end table
  14947. @c man end MULTIMEDIA SOURCES