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.

18034 lines
480KB

  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{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.
  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{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section acrusher
  353. Reduce audio bit resolution.
  354. This filter is bit crusher with enhanced functionality. A bit crusher
  355. is used to audibly reduce number of bits an audio signal is sampled
  356. with. This doesn't change the bit depth at all, it just produces the
  357. effect. Material reduced in bit depth sounds more harsh and "digital".
  358. This filter is able to even round to continuous values instead of discrete
  359. bit depths.
  360. Additionally it has a D/C offset which results in different crushing of
  361. the lower and the upper half of the signal.
  362. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  363. Another feature of this filter is the logarithmic mode.
  364. This setting switches from linear distances between bits to logarithmic ones.
  365. The result is a much more "natural" sounding crusher which doesn't gate low
  366. signals for example. The human ear has a logarithmic perception, too
  367. so this kind of crushing is much more pleasant.
  368. Logarithmic crushing is also able to get anti-aliased.
  369. The filter accepts the following options:
  370. @table @option
  371. @item level_in
  372. Set level in.
  373. @item level_out
  374. Set level out.
  375. @item bits
  376. Set bit reduction.
  377. @item mix
  378. Set mixing amount.
  379. @item mode
  380. Can be linear: @code{lin} or logarithmic: @code{log}.
  381. @item dc
  382. Set DC.
  383. @item aa
  384. Set anti-aliasing.
  385. @item samples
  386. Set sample reduction.
  387. @item lfo
  388. Enable LFO. By default disabled.
  389. @item lforange
  390. Set LFO range.
  391. @item lforate
  392. Set LFO rate.
  393. @end table
  394. @section adelay
  395. Delay one or more audio channels.
  396. Samples in delayed channel are filled with silence.
  397. The filter accepts the following option:
  398. @table @option
  399. @item delays
  400. Set list of delays in milliseconds for each channel separated by '|'.
  401. At least one delay greater than 0 should be provided.
  402. Unused delays will be silently ignored. If number of given delays is
  403. smaller than number of channels all remaining channels will not be delayed.
  404. If you want to delay exact number of samples, append 'S' to number.
  405. @end table
  406. @subsection Examples
  407. @itemize
  408. @item
  409. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  410. the second channel (and any other channels that may be present) unchanged.
  411. @example
  412. adelay=1500|0|500
  413. @end example
  414. @item
  415. Delay second channel by 500 samples, the third channel by 700 samples and leave
  416. the first channel (and any other channels that may be present) unchanged.
  417. @example
  418. adelay=0|500S|700S
  419. @end example
  420. @end itemize
  421. @section aecho
  422. Apply echoing to the input audio.
  423. Echoes are reflected sound and can occur naturally amongst mountains
  424. (and sometimes large buildings) when talking or shouting; digital echo
  425. effects emulate this behaviour and are often used to help fill out the
  426. sound of a single instrument or vocal. The time difference between the
  427. original signal and the reflection is the @code{delay}, and the
  428. loudness of the reflected signal is the @code{decay}.
  429. Multiple echoes can have different delays and decays.
  430. A description of the accepted parameters follows.
  431. @table @option
  432. @item in_gain
  433. Set input gain of reflected signal. Default is @code{0.6}.
  434. @item out_gain
  435. Set output gain of reflected signal. Default is @code{0.3}.
  436. @item delays
  437. Set list of time intervals in milliseconds between original signal and reflections
  438. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  439. Default is @code{1000}.
  440. @item decays
  441. Set list of loudnesses of reflected signals separated by '|'.
  442. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  443. Default is @code{0.5}.
  444. @end table
  445. @subsection Examples
  446. @itemize
  447. @item
  448. Make it sound as if there are twice as many instruments as are actually playing:
  449. @example
  450. aecho=0.8:0.88:60:0.4
  451. @end example
  452. @item
  453. If delay is very short, then it sound like a (metallic) robot playing music:
  454. @example
  455. aecho=0.8:0.88:6:0.4
  456. @end example
  457. @item
  458. A longer delay will sound like an open air concert in the mountains:
  459. @example
  460. aecho=0.8:0.9:1000:0.3
  461. @end example
  462. @item
  463. Same as above but with one more mountain:
  464. @example
  465. aecho=0.8:0.9:1000|1800:0.3|0.25
  466. @end example
  467. @end itemize
  468. @section aemphasis
  469. Audio emphasis filter creates or restores material directly taken from LPs or
  470. emphased CDs with different filter curves. E.g. to store music on vinyl the
  471. signal has to be altered by a filter first to even out the disadvantages of
  472. this recording medium.
  473. Once the material is played back the inverse filter has to be applied to
  474. restore the distortion of the frequency response.
  475. The filter accepts the following options:
  476. @table @option
  477. @item level_in
  478. Set input gain.
  479. @item level_out
  480. Set output gain.
  481. @item mode
  482. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  483. use @code{production} mode. Default is @code{reproduction} mode.
  484. @item type
  485. Set filter type. Selects medium. Can be one of the following:
  486. @table @option
  487. @item col
  488. select Columbia.
  489. @item emi
  490. select EMI.
  491. @item bsi
  492. select BSI (78RPM).
  493. @item riaa
  494. select RIAA.
  495. @item cd
  496. select Compact Disc (CD).
  497. @item 50fm
  498. select 50µs (FM).
  499. @item 75fm
  500. select 75µs (FM).
  501. @item 50kf
  502. select 50µs (FM-KF).
  503. @item 75kf
  504. select 75µs (FM-KF).
  505. @end table
  506. @end table
  507. @section aeval
  508. Modify an audio signal according to the specified expressions.
  509. This filter accepts one or more expressions (one for each channel),
  510. which are evaluated and used to modify a corresponding audio signal.
  511. It accepts the following parameters:
  512. @table @option
  513. @item exprs
  514. Set the '|'-separated expressions list for each separate channel. If
  515. the number of input channels is greater than the number of
  516. expressions, the last specified expression is used for the remaining
  517. output channels.
  518. @item channel_layout, c
  519. Set output channel layout. If not specified, the channel layout is
  520. specified by the number of expressions. If set to @samp{same}, it will
  521. use by default the same input channel layout.
  522. @end table
  523. Each expression in @var{exprs} can contain the following constants and functions:
  524. @table @option
  525. @item ch
  526. channel number of the current expression
  527. @item n
  528. number of the evaluated sample, starting from 0
  529. @item s
  530. sample rate
  531. @item t
  532. time of the evaluated sample expressed in seconds
  533. @item nb_in_channels
  534. @item nb_out_channels
  535. input and output number of channels
  536. @item val(CH)
  537. the value of input channel with number @var{CH}
  538. @end table
  539. Note: this filter is slow. For faster processing you should use a
  540. dedicated filter.
  541. @subsection Examples
  542. @itemize
  543. @item
  544. Half volume:
  545. @example
  546. aeval=val(ch)/2:c=same
  547. @end example
  548. @item
  549. Invert phase of the second channel:
  550. @example
  551. aeval=val(0)|-val(1)
  552. @end example
  553. @end itemize
  554. @anchor{afade}
  555. @section afade
  556. Apply fade-in/out effect to input audio.
  557. A description of the accepted parameters follows.
  558. @table @option
  559. @item type, t
  560. Specify the effect type, can be either @code{in} for fade-in, or
  561. @code{out} for a fade-out effect. Default is @code{in}.
  562. @item start_sample, ss
  563. Specify the number of the start sample for starting to apply the fade
  564. effect. Default is 0.
  565. @item nb_samples, ns
  566. Specify the number of samples for which the fade effect has to last. At
  567. the end of the fade-in effect the output audio will have the same
  568. volume as the input audio, at the end of the fade-out transition
  569. the output audio will be silence. Default is 44100.
  570. @item start_time, st
  571. Specify the start time of the fade effect. Default is 0.
  572. The value must be specified as a time duration; see
  573. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  574. for the accepted syntax.
  575. If set this option is used instead of @var{start_sample}.
  576. @item duration, d
  577. Specify the duration of the fade effect. See
  578. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  579. for the accepted syntax.
  580. At the end of the fade-in effect the output audio will have the same
  581. volume as the input audio, at the end of the fade-out transition
  582. the output audio will be silence.
  583. By default the duration is determined by @var{nb_samples}.
  584. If set this option is used instead of @var{nb_samples}.
  585. @item curve
  586. Set curve for fade transition.
  587. It accepts the following values:
  588. @table @option
  589. @item tri
  590. select triangular, linear slope (default)
  591. @item qsin
  592. select quarter of sine wave
  593. @item hsin
  594. select half of sine wave
  595. @item esin
  596. select exponential sine wave
  597. @item log
  598. select logarithmic
  599. @item ipar
  600. select inverted parabola
  601. @item qua
  602. select quadratic
  603. @item cub
  604. select cubic
  605. @item squ
  606. select square root
  607. @item cbr
  608. select cubic root
  609. @item par
  610. select parabola
  611. @item exp
  612. select exponential
  613. @item iqsin
  614. select inverted quarter of sine wave
  615. @item ihsin
  616. select inverted half of sine wave
  617. @item dese
  618. select double-exponential seat
  619. @item desi
  620. select double-exponential sigmoid
  621. @end table
  622. @end table
  623. @subsection Examples
  624. @itemize
  625. @item
  626. Fade in first 15 seconds of audio:
  627. @example
  628. afade=t=in:ss=0:d=15
  629. @end example
  630. @item
  631. Fade out last 25 seconds of a 900 seconds audio:
  632. @example
  633. afade=t=out:st=875:d=25
  634. @end example
  635. @end itemize
  636. @section afftfilt
  637. Apply arbitrary expressions to samples in frequency domain.
  638. @table @option
  639. @item real
  640. Set frequency domain real expression for each separate channel separated
  641. by '|'. Default is "1".
  642. If the number of input channels is greater than the number of
  643. expressions, the last specified expression is used for the remaining
  644. output channels.
  645. @item imag
  646. Set frequency domain imaginary expression for each separate channel
  647. separated by '|'. If not set, @var{real} option is used.
  648. Each expression in @var{real} and @var{imag} can contain the following
  649. constants:
  650. @table @option
  651. @item sr
  652. sample rate
  653. @item b
  654. current frequency bin number
  655. @item nb
  656. number of available bins
  657. @item ch
  658. channel number of the current expression
  659. @item chs
  660. number of channels
  661. @item pts
  662. current frame pts
  663. @end table
  664. @item win_size
  665. Set window size.
  666. It accepts the following values:
  667. @table @samp
  668. @item w16
  669. @item w32
  670. @item w64
  671. @item w128
  672. @item w256
  673. @item w512
  674. @item w1024
  675. @item w2048
  676. @item w4096
  677. @item w8192
  678. @item w16384
  679. @item w32768
  680. @item w65536
  681. @end table
  682. Default is @code{w4096}
  683. @item win_func
  684. Set window function. Default is @code{hann}.
  685. @item overlap
  686. Set window overlap. If set to 1, the recommended overlap for selected
  687. window function will be picked. Default is @code{0.75}.
  688. @end table
  689. @subsection Examples
  690. @itemize
  691. @item
  692. Leave almost only low frequencies in audio:
  693. @example
  694. afftfilt="1-clip((b/nb)*b,0,1)"
  695. @end example
  696. @end itemize
  697. @anchor{aformat}
  698. @section aformat
  699. Set output format constraints for the input audio. The framework will
  700. negotiate the most appropriate format to minimize conversions.
  701. It accepts the following parameters:
  702. @table @option
  703. @item sample_fmts
  704. A '|'-separated list of requested sample formats.
  705. @item sample_rates
  706. A '|'-separated list of requested sample rates.
  707. @item channel_layouts
  708. A '|'-separated list of requested channel layouts.
  709. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  710. for the required syntax.
  711. @end table
  712. If a parameter is omitted, all values are allowed.
  713. Force the output to either unsigned 8-bit or signed 16-bit stereo
  714. @example
  715. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  716. @end example
  717. @section agate
  718. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  719. processing reduces disturbing noise between useful signals.
  720. Gating is done by detecting the volume below a chosen level @var{threshold}
  721. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  722. floor is set via @var{range}. Because an exact manipulation of the signal
  723. would cause distortion of the waveform the reduction can be levelled over
  724. time. This is done by setting @var{attack} and @var{release}.
  725. @var{attack} determines how long the signal has to fall below the threshold
  726. before any reduction will occur and @var{release} sets the time the signal
  727. has to rise above the threshold to reduce the reduction again.
  728. Shorter signals than the chosen attack time will be left untouched.
  729. @table @option
  730. @item level_in
  731. Set input level before filtering.
  732. Default is 1. Allowed range is from 0.015625 to 64.
  733. @item range
  734. Set the level of gain reduction when the signal is below the threshold.
  735. Default is 0.06125. Allowed range is from 0 to 1.
  736. @item threshold
  737. If a signal rises above this level the gain reduction is released.
  738. Default is 0.125. Allowed range is from 0 to 1.
  739. @item ratio
  740. Set a ratio by which the signal is reduced.
  741. Default is 2. Allowed range is from 1 to 9000.
  742. @item attack
  743. Amount of milliseconds the signal has to rise above the threshold before gain
  744. reduction stops.
  745. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  746. @item release
  747. Amount of milliseconds the signal has to fall below the threshold before the
  748. reduction is increased again. Default is 250 milliseconds.
  749. Allowed range is from 0.01 to 9000.
  750. @item makeup
  751. Set amount of amplification of signal after processing.
  752. Default is 1. Allowed range is from 1 to 64.
  753. @item knee
  754. Curve the sharp knee around the threshold to enter gain reduction more softly.
  755. Default is 2.828427125. Allowed range is from 1 to 8.
  756. @item detection
  757. Choose if exact signal should be taken for detection or an RMS like one.
  758. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  759. @item link
  760. Choose if the average level between all channels or the louder channel affects
  761. the reduction.
  762. Default is @code{average}. Can be @code{average} or @code{maximum}.
  763. @end table
  764. @section alimiter
  765. The limiter prevents an input signal from rising over a desired threshold.
  766. This limiter uses lookahead technology to prevent your signal from distorting.
  767. It means that there is a small delay after the signal is processed. Keep in mind
  768. that the delay it produces is the attack time you set.
  769. The filter accepts the following options:
  770. @table @option
  771. @item level_in
  772. Set input gain. Default is 1.
  773. @item level_out
  774. Set output gain. Default is 1.
  775. @item limit
  776. Don't let signals above this level pass the limiter. Default is 1.
  777. @item attack
  778. The limiter will reach its attenuation level in this amount of time in
  779. milliseconds. Default is 5 milliseconds.
  780. @item release
  781. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  782. Default is 50 milliseconds.
  783. @item asc
  784. When gain reduction is always needed ASC takes care of releasing to an
  785. average reduction level rather than reaching a reduction of 0 in the release
  786. time.
  787. @item asc_level
  788. Select how much the release time is affected by ASC, 0 means nearly no changes
  789. in release time while 1 produces higher release times.
  790. @item level
  791. Auto level output signal. Default is enabled.
  792. This normalizes audio back to 0dB if enabled.
  793. @end table
  794. Depending on picked setting it is recommended to upsample input 2x or 4x times
  795. with @ref{aresample} before applying this filter.
  796. @section allpass
  797. Apply a two-pole all-pass filter with central frequency (in Hz)
  798. @var{frequency}, and filter-width @var{width}.
  799. An all-pass filter changes the audio's frequency to phase relationship
  800. without changing its frequency to amplitude relationship.
  801. The filter accepts the following options:
  802. @table @option
  803. @item frequency, f
  804. Set frequency in Hz.
  805. @item width_type
  806. Set method to specify band-width of filter.
  807. @table @option
  808. @item h
  809. Hz
  810. @item q
  811. Q-Factor
  812. @item o
  813. octave
  814. @item s
  815. slope
  816. @end table
  817. @item width, w
  818. Specify the band-width of a filter in width_type units.
  819. @end table
  820. @section aloop
  821. Loop audio samples.
  822. The filter accepts the following options:
  823. @table @option
  824. @item loop
  825. Set the number of loops.
  826. @item size
  827. Set maximal number of samples.
  828. @item start
  829. Set first sample of loop.
  830. @end table
  831. @anchor{amerge}
  832. @section amerge
  833. Merge two or more audio streams into a single multi-channel stream.
  834. The filter accepts the following options:
  835. @table @option
  836. @item inputs
  837. Set the number of inputs. Default is 2.
  838. @end table
  839. If the channel layouts of the inputs are disjoint, and therefore compatible,
  840. the channel layout of the output will be set accordingly and the channels
  841. will be reordered as necessary. If the channel layouts of the inputs are not
  842. disjoint, the output will have all the channels of the first input then all
  843. the channels of the second input, in that order, and the channel layout of
  844. the output will be the default value corresponding to the total number of
  845. channels.
  846. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  847. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  848. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  849. first input, b1 is the first channel of the second input).
  850. On the other hand, if both input are in stereo, the output channels will be
  851. in the default order: a1, a2, b1, b2, and the channel layout will be
  852. arbitrarily set to 4.0, which may or may not be the expected value.
  853. All inputs must have the same sample rate, and format.
  854. If inputs do not have the same duration, the output will stop with the
  855. shortest.
  856. @subsection Examples
  857. @itemize
  858. @item
  859. Merge two mono files into a stereo stream:
  860. @example
  861. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  862. @end example
  863. @item
  864. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  865. @example
  866. 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
  867. @end example
  868. @end itemize
  869. @section amix
  870. Mixes multiple audio inputs into a single output.
  871. Note that this filter only supports float samples (the @var{amerge}
  872. and @var{pan} audio filters support many formats). If the @var{amix}
  873. input has integer samples then @ref{aresample} will be automatically
  874. inserted to perform the conversion to float samples.
  875. For example
  876. @example
  877. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  878. @end example
  879. will mix 3 input audio streams to a single output with the same duration as the
  880. first input and a dropout transition time of 3 seconds.
  881. It accepts the following parameters:
  882. @table @option
  883. @item inputs
  884. The number of inputs. If unspecified, it defaults to 2.
  885. @item duration
  886. How to determine the end-of-stream.
  887. @table @option
  888. @item longest
  889. The duration of the longest input. (default)
  890. @item shortest
  891. The duration of the shortest input.
  892. @item first
  893. The duration of the first input.
  894. @end table
  895. @item dropout_transition
  896. The transition time, in seconds, for volume renormalization when an input
  897. stream ends. The default value is 2 seconds.
  898. @end table
  899. @section anequalizer
  900. High-order parametric multiband equalizer for each channel.
  901. It accepts the following parameters:
  902. @table @option
  903. @item params
  904. This option string is in format:
  905. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  906. Each equalizer band is separated by '|'.
  907. @table @option
  908. @item chn
  909. Set channel number to which equalization will be applied.
  910. If input doesn't have that channel the entry is ignored.
  911. @item f
  912. Set central frequency for band.
  913. If input doesn't have that frequency the entry is ignored.
  914. @item w
  915. Set band width in hertz.
  916. @item g
  917. Set band gain in dB.
  918. @item t
  919. Set filter type for band, optional, can be:
  920. @table @samp
  921. @item 0
  922. Butterworth, this is default.
  923. @item 1
  924. Chebyshev type 1.
  925. @item 2
  926. Chebyshev type 2.
  927. @end table
  928. @end table
  929. @item curves
  930. With this option activated frequency response of anequalizer is displayed
  931. in video stream.
  932. @item size
  933. Set video stream size. Only useful if curves option is activated.
  934. @item mgain
  935. Set max gain that will be displayed. Only useful if curves option is activated.
  936. Setting this to a reasonable value makes it possible to display gain which is derived from
  937. neighbour bands which are too close to each other and thus produce higher gain
  938. when both are activated.
  939. @item fscale
  940. Set frequency scale used to draw frequency response in video output.
  941. Can be linear or logarithmic. Default is logarithmic.
  942. @item colors
  943. Set color for each channel curve which is going to be displayed in video stream.
  944. This is list of color names separated by space or by '|'.
  945. Unrecognised or missing colors will be replaced by white color.
  946. @end table
  947. @subsection Examples
  948. @itemize
  949. @item
  950. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  951. for first 2 channels using Chebyshev type 1 filter:
  952. @example
  953. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  954. @end example
  955. @end itemize
  956. @subsection Commands
  957. This filter supports the following commands:
  958. @table @option
  959. @item change
  960. Alter existing filter parameters.
  961. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  962. @var{fN} is existing filter number, starting from 0, if no such filter is available
  963. error is returned.
  964. @var{freq} set new frequency parameter.
  965. @var{width} set new width parameter in herz.
  966. @var{gain} set new gain parameter in dB.
  967. Full filter invocation with asendcmd may look like this:
  968. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  969. @end table
  970. @section anull
  971. Pass the audio source unchanged to the output.
  972. @section apad
  973. Pad the end of an audio stream with silence.
  974. This can be used together with @command{ffmpeg} @option{-shortest} to
  975. extend audio streams to the same length as the video stream.
  976. A description of the accepted options follows.
  977. @table @option
  978. @item packet_size
  979. Set silence packet size. Default value is 4096.
  980. @item pad_len
  981. Set the number of samples of silence to add to the end. After the
  982. value is reached, the stream is terminated. This option is mutually
  983. exclusive with @option{whole_len}.
  984. @item whole_len
  985. Set the minimum total number of samples in the output audio stream. If
  986. the value is longer than the input audio length, silence is added to
  987. the end, until the value is reached. This option is mutually exclusive
  988. with @option{pad_len}.
  989. @end table
  990. If neither the @option{pad_len} nor the @option{whole_len} option is
  991. set, the filter will add silence to the end of the input stream
  992. indefinitely.
  993. @subsection Examples
  994. @itemize
  995. @item
  996. Add 1024 samples of silence to the end of the input:
  997. @example
  998. apad=pad_len=1024
  999. @end example
  1000. @item
  1001. Make sure the audio output will contain at least 10000 samples, pad
  1002. the input with silence if required:
  1003. @example
  1004. apad=whole_len=10000
  1005. @end example
  1006. @item
  1007. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1008. video stream will always result the shortest and will be converted
  1009. until the end in the output file when using the @option{shortest}
  1010. option:
  1011. @example
  1012. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1013. @end example
  1014. @end itemize
  1015. @section aphaser
  1016. Add a phasing effect to the input audio.
  1017. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1018. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1019. A description of the accepted parameters follows.
  1020. @table @option
  1021. @item in_gain
  1022. Set input gain. Default is 0.4.
  1023. @item out_gain
  1024. Set output gain. Default is 0.74
  1025. @item delay
  1026. Set delay in milliseconds. Default is 3.0.
  1027. @item decay
  1028. Set decay. Default is 0.4.
  1029. @item speed
  1030. Set modulation speed in Hz. Default is 0.5.
  1031. @item type
  1032. Set modulation type. Default is triangular.
  1033. It accepts the following values:
  1034. @table @samp
  1035. @item triangular, t
  1036. @item sinusoidal, s
  1037. @end table
  1038. @end table
  1039. @section apulsator
  1040. Audio pulsator is something between an autopanner and a tremolo.
  1041. But it can produce funny stereo effects as well. Pulsator changes the volume
  1042. of the left and right channel based on a LFO (low frequency oscillator) with
  1043. different waveforms and shifted phases.
  1044. This filter have the ability to define an offset between left and right
  1045. channel. An offset of 0 means that both LFO shapes match each other.
  1046. The left and right channel are altered equally - a conventional tremolo.
  1047. An offset of 50% means that the shape of the right channel is exactly shifted
  1048. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1049. an autopanner. At 1 both curves match again. Every setting in between moves the
  1050. phase shift gapless between all stages and produces some "bypassing" sounds with
  1051. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1052. the 0.5) the faster the signal passes from the left to the right speaker.
  1053. The filter accepts the following options:
  1054. @table @option
  1055. @item level_in
  1056. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1057. @item level_out
  1058. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1059. @item mode
  1060. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1061. sawup or sawdown. Default is sine.
  1062. @item amount
  1063. Set modulation. Define how much of original signal is affected by the LFO.
  1064. @item offset_l
  1065. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1066. @item offset_r
  1067. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1068. @item width
  1069. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1070. @item timing
  1071. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1072. @item bpm
  1073. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1074. is set to bpm.
  1075. @item ms
  1076. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1077. is set to ms.
  1078. @item hz
  1079. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1080. if timing is set to hz.
  1081. @end table
  1082. @anchor{aresample}
  1083. @section aresample
  1084. Resample the input audio to the specified parameters, using the
  1085. libswresample library. If none are specified then the filter will
  1086. automatically convert between its input and output.
  1087. This filter is also able to stretch/squeeze the audio data to make it match
  1088. the timestamps or to inject silence / cut out audio to make it match the
  1089. timestamps, do a combination of both or do neither.
  1090. The filter accepts the syntax
  1091. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1092. expresses a sample rate and @var{resampler_options} is a list of
  1093. @var{key}=@var{value} pairs, separated by ":". See the
  1094. ffmpeg-resampler manual for the complete list of supported options.
  1095. @subsection Examples
  1096. @itemize
  1097. @item
  1098. Resample the input audio to 44100Hz:
  1099. @example
  1100. aresample=44100
  1101. @end example
  1102. @item
  1103. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1104. samples per second compensation:
  1105. @example
  1106. aresample=async=1000
  1107. @end example
  1108. @end itemize
  1109. @section areverse
  1110. Reverse an audio clip.
  1111. Warning: This filter requires memory to buffer the entire clip, so trimming
  1112. is suggested.
  1113. @subsection Examples
  1114. @itemize
  1115. @item
  1116. Take the first 5 seconds of a clip, and reverse it.
  1117. @example
  1118. atrim=end=5,areverse
  1119. @end example
  1120. @end itemize
  1121. @section asetnsamples
  1122. Set the number of samples per each output audio frame.
  1123. The last output packet may contain a different number of samples, as
  1124. the filter will flush all the remaining samples when the input audio
  1125. signals its end.
  1126. The filter accepts the following options:
  1127. @table @option
  1128. @item nb_out_samples, n
  1129. Set the number of frames per each output audio frame. The number is
  1130. intended as the number of samples @emph{per each channel}.
  1131. Default value is 1024.
  1132. @item pad, p
  1133. If set to 1, the filter will pad the last audio frame with zeroes, so
  1134. that the last frame will contain the same number of samples as the
  1135. previous ones. Default value is 1.
  1136. @end table
  1137. For example, to set the number of per-frame samples to 1234 and
  1138. disable padding for the last frame, use:
  1139. @example
  1140. asetnsamples=n=1234:p=0
  1141. @end example
  1142. @section asetrate
  1143. Set the sample rate without altering the PCM data.
  1144. This will result in a change of speed and pitch.
  1145. The filter accepts the following options:
  1146. @table @option
  1147. @item sample_rate, r
  1148. Set the output sample rate. Default is 44100 Hz.
  1149. @end table
  1150. @section ashowinfo
  1151. Show a line containing various information for each input audio frame.
  1152. The input audio is not modified.
  1153. The shown line contains a sequence of key/value pairs of the form
  1154. @var{key}:@var{value}.
  1155. The following values are shown in the output:
  1156. @table @option
  1157. @item n
  1158. The (sequential) number of the input frame, starting from 0.
  1159. @item pts
  1160. The presentation timestamp of the input frame, in time base units; the time base
  1161. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1162. @item pts_time
  1163. The presentation timestamp of the input frame in seconds.
  1164. @item pos
  1165. position of the frame in the input stream, -1 if this information in
  1166. unavailable and/or meaningless (for example in case of synthetic audio)
  1167. @item fmt
  1168. The sample format.
  1169. @item chlayout
  1170. The channel layout.
  1171. @item rate
  1172. The sample rate for the audio frame.
  1173. @item nb_samples
  1174. The number of samples (per channel) in the frame.
  1175. @item checksum
  1176. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1177. audio, the data is treated as if all the planes were concatenated.
  1178. @item plane_checksums
  1179. A list of Adler-32 checksums for each data plane.
  1180. @end table
  1181. @anchor{astats}
  1182. @section astats
  1183. Display time domain statistical information about the audio channels.
  1184. Statistics are calculated and displayed for each audio channel and,
  1185. where applicable, an overall figure is also given.
  1186. It accepts the following option:
  1187. @table @option
  1188. @item length
  1189. Short window length in seconds, used for peak and trough RMS measurement.
  1190. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1191. @item metadata
  1192. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1193. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1194. disabled.
  1195. Available keys for each channel are:
  1196. DC_offset
  1197. Min_level
  1198. Max_level
  1199. Min_difference
  1200. Max_difference
  1201. Mean_difference
  1202. Peak_level
  1203. RMS_peak
  1204. RMS_trough
  1205. Crest_factor
  1206. Flat_factor
  1207. Peak_count
  1208. Bit_depth
  1209. and for Overall:
  1210. DC_offset
  1211. Min_level
  1212. Max_level
  1213. Min_difference
  1214. Max_difference
  1215. Mean_difference
  1216. Peak_level
  1217. RMS_level
  1218. RMS_peak
  1219. RMS_trough
  1220. Flat_factor
  1221. Peak_count
  1222. Bit_depth
  1223. Number_of_samples
  1224. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1225. this @code{lavfi.astats.Overall.Peak_count}.
  1226. For description what each key means read below.
  1227. @item reset
  1228. Set number of frame after which stats are going to be recalculated.
  1229. Default is disabled.
  1230. @end table
  1231. A description of each shown parameter follows:
  1232. @table @option
  1233. @item DC offset
  1234. Mean amplitude displacement from zero.
  1235. @item Min level
  1236. Minimal sample level.
  1237. @item Max level
  1238. Maximal sample level.
  1239. @item Min difference
  1240. Minimal difference between two consecutive samples.
  1241. @item Max difference
  1242. Maximal difference between two consecutive samples.
  1243. @item Mean difference
  1244. Mean difference between two consecutive samples.
  1245. The average of each difference between two consecutive samples.
  1246. @item Peak level dB
  1247. @item RMS level dB
  1248. Standard peak and RMS level measured in dBFS.
  1249. @item RMS peak dB
  1250. @item RMS trough dB
  1251. Peak and trough values for RMS level measured over a short window.
  1252. @item Crest factor
  1253. Standard ratio of peak to RMS level (note: not in dB).
  1254. @item Flat factor
  1255. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1256. (i.e. either @var{Min level} or @var{Max level}).
  1257. @item Peak count
  1258. Number of occasions (not the number of samples) that the signal attained either
  1259. @var{Min level} or @var{Max level}.
  1260. @item Bit depth
  1261. Overall bit depth of audio. Number of bits used for each sample.
  1262. @end table
  1263. @section asyncts
  1264. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1265. dropping samples/adding silence when needed.
  1266. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1267. It accepts the following parameters:
  1268. @table @option
  1269. @item compensate
  1270. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1271. by default. When disabled, time gaps are covered with silence.
  1272. @item min_delta
  1273. The minimum difference between timestamps and audio data (in seconds) to trigger
  1274. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1275. sync with this filter, try setting this parameter to 0.
  1276. @item max_comp
  1277. The maximum compensation in samples per second. Only relevant with compensate=1.
  1278. The default value is 500.
  1279. @item first_pts
  1280. Assume that the first PTS should be this value. The time base is 1 / sample
  1281. rate. This allows for padding/trimming at the start of the stream. By default,
  1282. no assumption is made about the first frame's expected PTS, so no padding or
  1283. trimming is done. For example, this could be set to 0 to pad the beginning with
  1284. silence if an audio stream starts after the video stream or to trim any samples
  1285. with a negative PTS due to encoder delay.
  1286. @end table
  1287. @section atempo
  1288. Adjust audio tempo.
  1289. The filter accepts exactly one parameter, the audio tempo. If not
  1290. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1291. be in the [0.5, 2.0] range.
  1292. @subsection Examples
  1293. @itemize
  1294. @item
  1295. Slow down audio to 80% tempo:
  1296. @example
  1297. atempo=0.8
  1298. @end example
  1299. @item
  1300. To speed up audio to 125% tempo:
  1301. @example
  1302. atempo=1.25
  1303. @end example
  1304. @end itemize
  1305. @section atrim
  1306. Trim the input so that the output contains one continuous subpart of the input.
  1307. It accepts the following parameters:
  1308. @table @option
  1309. @item start
  1310. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1311. sample with the timestamp @var{start} will be the first sample in the output.
  1312. @item end
  1313. Specify time of the first audio sample that will be dropped, i.e. the
  1314. audio sample immediately preceding the one with the timestamp @var{end} will be
  1315. the last sample in the output.
  1316. @item start_pts
  1317. Same as @var{start}, except this option sets the start timestamp in samples
  1318. instead of seconds.
  1319. @item end_pts
  1320. Same as @var{end}, except this option sets the end timestamp in samples instead
  1321. of seconds.
  1322. @item duration
  1323. The maximum duration of the output in seconds.
  1324. @item start_sample
  1325. The number of the first sample that should be output.
  1326. @item end_sample
  1327. The number of the first sample that should be dropped.
  1328. @end table
  1329. @option{start}, @option{end}, and @option{duration} are expressed as time
  1330. duration specifications; see
  1331. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1332. Note that the first two sets of the start/end options and the @option{duration}
  1333. option look at the frame timestamp, while the _sample options simply count the
  1334. samples that pass through the filter. So start/end_pts and start/end_sample will
  1335. give different results when the timestamps are wrong, inexact or do not start at
  1336. zero. Also note that this filter does not modify the timestamps. If you wish
  1337. to have the output timestamps start at zero, insert the asetpts filter after the
  1338. atrim filter.
  1339. If multiple start or end options are set, this filter tries to be greedy and
  1340. keep all samples that match at least one of the specified constraints. To keep
  1341. only the part that matches all the constraints at once, chain multiple atrim
  1342. filters.
  1343. The defaults are such that all the input is kept. So it is possible to set e.g.
  1344. just the end values to keep everything before the specified time.
  1345. Examples:
  1346. @itemize
  1347. @item
  1348. Drop everything except the second minute of input:
  1349. @example
  1350. ffmpeg -i INPUT -af atrim=60:120
  1351. @end example
  1352. @item
  1353. Keep only the first 1000 samples:
  1354. @example
  1355. ffmpeg -i INPUT -af atrim=end_sample=1000
  1356. @end example
  1357. @end itemize
  1358. @section bandpass
  1359. Apply a two-pole Butterworth band-pass filter with central
  1360. frequency @var{frequency}, and (3dB-point) band-width width.
  1361. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1362. instead of the default: constant 0dB peak gain.
  1363. The filter roll off at 6dB per octave (20dB per decade).
  1364. The filter accepts the following options:
  1365. @table @option
  1366. @item frequency, f
  1367. Set the filter's central frequency. Default is @code{3000}.
  1368. @item csg
  1369. Constant skirt gain if set to 1. Defaults to 0.
  1370. @item width_type
  1371. Set method to specify band-width of filter.
  1372. @table @option
  1373. @item h
  1374. Hz
  1375. @item q
  1376. Q-Factor
  1377. @item o
  1378. octave
  1379. @item s
  1380. slope
  1381. @end table
  1382. @item width, w
  1383. Specify the band-width of a filter in width_type units.
  1384. @end table
  1385. @section bandreject
  1386. Apply a two-pole Butterworth band-reject filter with central
  1387. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1388. The filter roll off at 6dB per octave (20dB per decade).
  1389. The filter accepts the following options:
  1390. @table @option
  1391. @item frequency, f
  1392. Set the filter's central frequency. Default is @code{3000}.
  1393. @item width_type
  1394. Set method to specify band-width of filter.
  1395. @table @option
  1396. @item h
  1397. Hz
  1398. @item q
  1399. Q-Factor
  1400. @item o
  1401. octave
  1402. @item s
  1403. slope
  1404. @end table
  1405. @item width, w
  1406. Specify the band-width of a filter in width_type units.
  1407. @end table
  1408. @section bass
  1409. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1410. shelving filter with a response similar to that of a standard
  1411. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1412. The filter accepts the following options:
  1413. @table @option
  1414. @item gain, g
  1415. Give the gain at 0 Hz. Its useful range is about -20
  1416. (for a large cut) to +20 (for a large boost).
  1417. Beware of clipping when using a positive gain.
  1418. @item frequency, f
  1419. Set the filter's central frequency and so can be used
  1420. to extend or reduce the frequency range to be boosted or cut.
  1421. The default value is @code{100} Hz.
  1422. @item width_type
  1423. Set method to specify band-width of filter.
  1424. @table @option
  1425. @item h
  1426. Hz
  1427. @item q
  1428. Q-Factor
  1429. @item o
  1430. octave
  1431. @item s
  1432. slope
  1433. @end table
  1434. @item width, w
  1435. Determine how steep is the filter's shelf transition.
  1436. @end table
  1437. @section biquad
  1438. Apply a biquad IIR filter with the given coefficients.
  1439. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1440. are the numerator and denominator coefficients respectively.
  1441. @section bs2b
  1442. Bauer stereo to binaural transformation, which improves headphone listening of
  1443. stereo audio records.
  1444. It accepts the following parameters:
  1445. @table @option
  1446. @item profile
  1447. Pre-defined crossfeed level.
  1448. @table @option
  1449. @item default
  1450. Default level (fcut=700, feed=50).
  1451. @item cmoy
  1452. Chu Moy circuit (fcut=700, feed=60).
  1453. @item jmeier
  1454. Jan Meier circuit (fcut=650, feed=95).
  1455. @end table
  1456. @item fcut
  1457. Cut frequency (in Hz).
  1458. @item feed
  1459. Feed level (in Hz).
  1460. @end table
  1461. @section channelmap
  1462. Remap input channels to new locations.
  1463. It accepts the following parameters:
  1464. @table @option
  1465. @item channel_layout
  1466. The channel layout of the output stream.
  1467. @item map
  1468. Map channels from input to output. The argument is a '|'-separated list of
  1469. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1470. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1471. channel (e.g. FL for front left) or its index in the input channel layout.
  1472. @var{out_channel} is the name of the output channel or its index in the output
  1473. channel layout. If @var{out_channel} is not given then it is implicitly an
  1474. index, starting with zero and increasing by one for each mapping.
  1475. @end table
  1476. If no mapping is present, the filter will implicitly map input channels to
  1477. output channels, preserving indices.
  1478. For example, assuming a 5.1+downmix input MOV file,
  1479. @example
  1480. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1481. @end example
  1482. will create an output WAV file tagged as stereo from the downmix channels of
  1483. the input.
  1484. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1485. @example
  1486. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1487. @end example
  1488. @section channelsplit
  1489. Split each channel from an input audio stream into a separate output stream.
  1490. It accepts the following parameters:
  1491. @table @option
  1492. @item channel_layout
  1493. The channel layout of the input stream. The default is "stereo".
  1494. @end table
  1495. For example, assuming a stereo input MP3 file,
  1496. @example
  1497. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1498. @end example
  1499. will create an output Matroska file with two audio streams, one containing only
  1500. the left channel and the other the right channel.
  1501. Split a 5.1 WAV file into per-channel files:
  1502. @example
  1503. ffmpeg -i in.wav -filter_complex
  1504. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1505. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1506. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1507. side_right.wav
  1508. @end example
  1509. @section chorus
  1510. Add a chorus effect to the audio.
  1511. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1512. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1513. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1514. The modulation depth defines the range the modulated delay is played before or after
  1515. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1516. sound tuned around the original one, like in a chorus where some vocals are slightly
  1517. off key.
  1518. It accepts the following parameters:
  1519. @table @option
  1520. @item in_gain
  1521. Set input gain. Default is 0.4.
  1522. @item out_gain
  1523. Set output gain. Default is 0.4.
  1524. @item delays
  1525. Set delays. A typical delay is around 40ms to 60ms.
  1526. @item decays
  1527. Set decays.
  1528. @item speeds
  1529. Set speeds.
  1530. @item depths
  1531. Set depths.
  1532. @end table
  1533. @subsection Examples
  1534. @itemize
  1535. @item
  1536. A single delay:
  1537. @example
  1538. chorus=0.7:0.9:55:0.4:0.25:2
  1539. @end example
  1540. @item
  1541. Two delays:
  1542. @example
  1543. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1544. @end example
  1545. @item
  1546. Fuller sounding chorus with three delays:
  1547. @example
  1548. 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
  1549. @end example
  1550. @end itemize
  1551. @section compand
  1552. Compress or expand the audio's dynamic range.
  1553. It accepts the following parameters:
  1554. @table @option
  1555. @item attacks
  1556. @item decays
  1557. A list of times in seconds for each channel over which the instantaneous level
  1558. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1559. increase of volume and @var{decays} refers to decrease of volume. For most
  1560. situations, the attack time (response to the audio getting louder) should be
  1561. shorter than the decay time, because the human ear is more sensitive to sudden
  1562. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1563. a typical value for decay is 0.8 seconds.
  1564. If specified number of attacks & decays is lower than number of channels, the last
  1565. set attack/decay will be used for all remaining channels.
  1566. @item points
  1567. A list of points for the transfer function, specified in dB relative to the
  1568. maximum possible signal amplitude. Each key points list must be defined using
  1569. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1570. @code{x0/y0 x1/y1 x2/y2 ....}
  1571. The input values must be in strictly increasing order but the transfer function
  1572. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1573. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1574. function are @code{-70/-70|-60/-20}.
  1575. @item soft-knee
  1576. Set the curve radius in dB for all joints. It defaults to 0.01.
  1577. @item gain
  1578. Set the additional gain in dB to be applied at all points on the transfer
  1579. function. This allows for easy adjustment of the overall gain.
  1580. It defaults to 0.
  1581. @item volume
  1582. Set an initial volume, in dB, to be assumed for each channel when filtering
  1583. starts. This permits the user to supply a nominal level initially, so that, for
  1584. example, a very large gain is not applied to initial signal levels before the
  1585. companding has begun to operate. A typical value for audio which is initially
  1586. quiet is -90 dB. It defaults to 0.
  1587. @item delay
  1588. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1589. delayed before being fed to the volume adjuster. Specifying a delay
  1590. approximately equal to the attack/decay times allows the filter to effectively
  1591. operate in predictive rather than reactive mode. It defaults to 0.
  1592. @end table
  1593. @subsection Examples
  1594. @itemize
  1595. @item
  1596. Make music with both quiet and loud passages suitable for listening to in a
  1597. noisy environment:
  1598. @example
  1599. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1600. @end example
  1601. Another example for audio with whisper and explosion parts:
  1602. @example
  1603. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1604. @end example
  1605. @item
  1606. A noise gate for when the noise is at a lower level than the signal:
  1607. @example
  1608. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1609. @end example
  1610. @item
  1611. Here is another noise gate, this time for when the noise is at a higher level
  1612. than the signal (making it, in some ways, similar to squelch):
  1613. @example
  1614. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1615. @end example
  1616. @item
  1617. 2:1 compression starting at -6dB:
  1618. @example
  1619. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1620. @end example
  1621. @item
  1622. 2:1 compression starting at -9dB:
  1623. @example
  1624. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1625. @end example
  1626. @item
  1627. 2:1 compression starting at -12dB:
  1628. @example
  1629. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1630. @end example
  1631. @item
  1632. 2:1 compression starting at -18dB:
  1633. @example
  1634. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1635. @end example
  1636. @item
  1637. 3:1 compression starting at -15dB:
  1638. @example
  1639. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1640. @end example
  1641. @item
  1642. Compressor/Gate:
  1643. @example
  1644. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1645. @end example
  1646. @item
  1647. Expander:
  1648. @example
  1649. 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
  1650. @end example
  1651. @item
  1652. Hard limiter at -6dB:
  1653. @example
  1654. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1655. @end example
  1656. @item
  1657. Hard limiter at -12dB:
  1658. @example
  1659. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1660. @end example
  1661. @item
  1662. Hard noise gate at -35 dB:
  1663. @example
  1664. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1665. @end example
  1666. @item
  1667. Soft limiter:
  1668. @example
  1669. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1670. @end example
  1671. @end itemize
  1672. @section compensationdelay
  1673. Compensation Delay Line is a metric based delay to compensate differing
  1674. positions of microphones or speakers.
  1675. For example, you have recorded guitar with two microphones placed in
  1676. different location. Because the front of sound wave has fixed speed in
  1677. normal conditions, the phasing of microphones can vary and depends on
  1678. their location and interposition. The best sound mix can be achieved when
  1679. these microphones are in phase (synchronized). Note that distance of
  1680. ~30 cm between microphones makes one microphone to capture signal in
  1681. antiphase to another microphone. That makes the final mix sounding moody.
  1682. This filter helps to solve phasing problems by adding different delays
  1683. to each microphone track and make them synchronized.
  1684. The best result can be reached when you take one track as base and
  1685. synchronize other tracks one by one with it.
  1686. Remember that synchronization/delay tolerance depends on sample rate, too.
  1687. Higher sample rates will give more tolerance.
  1688. It accepts the following parameters:
  1689. @table @option
  1690. @item mm
  1691. Set millimeters distance. This is compensation distance for fine tuning.
  1692. Default is 0.
  1693. @item cm
  1694. Set cm distance. This is compensation distance for tightening distance setup.
  1695. Default is 0.
  1696. @item m
  1697. Set meters distance. This is compensation distance for hard distance setup.
  1698. Default is 0.
  1699. @item dry
  1700. Set dry amount. Amount of unprocessed (dry) signal.
  1701. Default is 0.
  1702. @item wet
  1703. Set wet amount. Amount of processed (wet) signal.
  1704. Default is 1.
  1705. @item temp
  1706. Set temperature degree in Celsius. This is the temperature of the environment.
  1707. Default is 20.
  1708. @end table
  1709. @section crystalizer
  1710. Simple algorithm to expand audio dynamic range.
  1711. The filter accepts the following options:
  1712. @table @option
  1713. @item i
  1714. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1715. (unchanged sound) to 10.0 (maximum effect).
  1716. @item c
  1717. Enable clipping. By default is enabled.
  1718. @end table
  1719. @section dcshift
  1720. Apply a DC shift to the audio.
  1721. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1722. in the recording chain) from the audio. The effect of a DC offset is reduced
  1723. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1724. a signal has a DC offset.
  1725. @table @option
  1726. @item shift
  1727. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1728. the audio.
  1729. @item limitergain
  1730. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1731. used to prevent clipping.
  1732. @end table
  1733. @section dynaudnorm
  1734. Dynamic Audio Normalizer.
  1735. This filter applies a certain amount of gain to the input audio in order
  1736. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1737. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1738. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1739. This allows for applying extra gain to the "quiet" sections of the audio
  1740. while avoiding distortions or clipping the "loud" sections. In other words:
  1741. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1742. sections, in the sense that the volume of each section is brought to the
  1743. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1744. this goal *without* applying "dynamic range compressing". It will retain 100%
  1745. of the dynamic range *within* each section of the audio file.
  1746. @table @option
  1747. @item f
  1748. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1749. Default is 500 milliseconds.
  1750. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1751. referred to as frames. This is required, because a peak magnitude has no
  1752. meaning for just a single sample value. Instead, we need to determine the
  1753. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1754. normalizer would simply use the peak magnitude of the complete file, the
  1755. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1756. frame. The length of a frame is specified in milliseconds. By default, the
  1757. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1758. been found to give good results with most files.
  1759. Note that the exact frame length, in number of samples, will be determined
  1760. automatically, based on the sampling rate of the individual input audio file.
  1761. @item g
  1762. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1763. number. Default is 31.
  1764. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1765. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1766. is specified in frames, centered around the current frame. For the sake of
  1767. simplicity, this must be an odd number. Consequently, the default value of 31
  1768. takes into account the current frame, as well as the 15 preceding frames and
  1769. the 15 subsequent frames. Using a larger window results in a stronger
  1770. smoothing effect and thus in less gain variation, i.e. slower gain
  1771. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1772. effect and thus in more gain variation, i.e. faster gain adaptation.
  1773. In other words, the more you increase this value, the more the Dynamic Audio
  1774. Normalizer will behave like a "traditional" normalization filter. On the
  1775. contrary, the more you decrease this value, the more the Dynamic Audio
  1776. Normalizer will behave like a dynamic range compressor.
  1777. @item p
  1778. Set the target peak value. This specifies the highest permissible magnitude
  1779. level for the normalized audio input. This filter will try to approach the
  1780. target peak magnitude as closely as possible, but at the same time it also
  1781. makes sure that the normalized signal will never exceed the peak magnitude.
  1782. A frame's maximum local gain factor is imposed directly by the target peak
  1783. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1784. It is not recommended to go above this value.
  1785. @item m
  1786. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1787. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1788. factor for each input frame, i.e. the maximum gain factor that does not
  1789. result in clipping or distortion. The maximum gain factor is determined by
  1790. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1791. additionally bounds the frame's maximum gain factor by a predetermined
  1792. (global) maximum gain factor. This is done in order to avoid excessive gain
  1793. factors in "silent" or almost silent frames. By default, the maximum gain
  1794. factor is 10.0, For most inputs the default value should be sufficient and
  1795. it usually is not recommended to increase this value. Though, for input
  1796. with an extremely low overall volume level, it may be necessary to allow even
  1797. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1798. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1799. Instead, a "sigmoid" threshold function will be applied. This way, the
  1800. gain factors will smoothly approach the threshold value, but never exceed that
  1801. value.
  1802. @item r
  1803. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1804. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1805. This means that the maximum local gain factor for each frame is defined
  1806. (only) by the frame's highest magnitude sample. This way, the samples can
  1807. be amplified as much as possible without exceeding the maximum signal
  1808. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1809. Normalizer can also take into account the frame's root mean square,
  1810. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1811. determine the power of a time-varying signal. It is therefore considered
  1812. that the RMS is a better approximation of the "perceived loudness" than
  1813. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1814. frames to a constant RMS value, a uniform "perceived loudness" can be
  1815. established. If a target RMS value has been specified, a frame's local gain
  1816. factor is defined as the factor that would result in exactly that RMS value.
  1817. Note, however, that the maximum local gain factor is still restricted by the
  1818. frame's highest magnitude sample, in order to prevent clipping.
  1819. @item n
  1820. Enable channels coupling. By default is enabled.
  1821. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1822. amount. This means the same gain factor will be applied to all channels, i.e.
  1823. the maximum possible gain factor is determined by the "loudest" channel.
  1824. However, in some recordings, it may happen that the volume of the different
  1825. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1826. In this case, this option can be used to disable the channel coupling. This way,
  1827. the gain factor will be determined independently for each channel, depending
  1828. only on the individual channel's highest magnitude sample. This allows for
  1829. harmonizing the volume of the different channels.
  1830. @item c
  1831. Enable DC bias correction. By default is disabled.
  1832. An audio signal (in the time domain) is a sequence of sample values.
  1833. In the Dynamic Audio Normalizer these sample values are represented in the
  1834. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1835. audio signal, or "waveform", should be centered around the zero point.
  1836. That means if we calculate the mean value of all samples in a file, or in a
  1837. single frame, then the result should be 0.0 or at least very close to that
  1838. value. If, however, there is a significant deviation of the mean value from
  1839. 0.0, in either positive or negative direction, this is referred to as a
  1840. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1841. Audio Normalizer provides optional DC bias correction.
  1842. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1843. the mean value, or "DC correction" offset, of each input frame and subtract
  1844. that value from all of the frame's sample values which ensures those samples
  1845. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1846. boundaries, the DC correction offset values will be interpolated smoothly
  1847. between neighbouring frames.
  1848. @item b
  1849. Enable alternative boundary mode. By default is disabled.
  1850. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1851. around each frame. This includes the preceding frames as well as the
  1852. subsequent frames. However, for the "boundary" frames, located at the very
  1853. beginning and at the very end of the audio file, not all neighbouring
  1854. frames are available. In particular, for the first few frames in the audio
  1855. file, the preceding frames are not known. And, similarly, for the last few
  1856. frames in the audio file, the subsequent frames are not known. Thus, the
  1857. question arises which gain factors should be assumed for the missing frames
  1858. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1859. to deal with this situation. The default boundary mode assumes a gain factor
  1860. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1861. "fade out" at the beginning and at the end of the input, respectively.
  1862. @item s
  1863. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1864. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1865. compression. This means that signal peaks will not be pruned and thus the
  1866. full dynamic range will be retained within each local neighbourhood. However,
  1867. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1868. normalization algorithm with a more "traditional" compression.
  1869. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1870. (thresholding) function. If (and only if) the compression feature is enabled,
  1871. all input frames will be processed by a soft knee thresholding function prior
  1872. to the actual normalization process. Put simply, the thresholding function is
  1873. going to prune all samples whose magnitude exceeds a certain threshold value.
  1874. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1875. value. Instead, the threshold value will be adjusted for each individual
  1876. frame.
  1877. In general, smaller parameters result in stronger compression, and vice versa.
  1878. Values below 3.0 are not recommended, because audible distortion may appear.
  1879. @end table
  1880. @section earwax
  1881. Make audio easier to listen to on headphones.
  1882. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1883. so that when listened to on headphones the stereo image is moved from
  1884. inside your head (standard for headphones) to outside and in front of
  1885. the listener (standard for speakers).
  1886. Ported from SoX.
  1887. @section equalizer
  1888. Apply a two-pole peaking equalisation (EQ) filter. With this
  1889. filter, the signal-level at and around a selected frequency can
  1890. be increased or decreased, whilst (unlike bandpass and bandreject
  1891. filters) that at all other frequencies is unchanged.
  1892. In order to produce complex equalisation curves, this filter can
  1893. be given several times, each with a different central frequency.
  1894. The filter accepts the following options:
  1895. @table @option
  1896. @item frequency, f
  1897. Set the filter's central frequency in Hz.
  1898. @item width_type
  1899. Set method to specify band-width of filter.
  1900. @table @option
  1901. @item h
  1902. Hz
  1903. @item q
  1904. Q-Factor
  1905. @item o
  1906. octave
  1907. @item s
  1908. slope
  1909. @end table
  1910. @item width, w
  1911. Specify the band-width of a filter in width_type units.
  1912. @item gain, g
  1913. Set the required gain or attenuation in dB.
  1914. Beware of clipping when using a positive gain.
  1915. @end table
  1916. @subsection Examples
  1917. @itemize
  1918. @item
  1919. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1920. @example
  1921. equalizer=f=1000:width_type=h:width=200:g=-10
  1922. @end example
  1923. @item
  1924. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1925. @example
  1926. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1927. @end example
  1928. @end itemize
  1929. @section extrastereo
  1930. Linearly increases the difference between left and right channels which
  1931. adds some sort of "live" effect to playback.
  1932. The filter accepts the following options:
  1933. @table @option
  1934. @item m
  1935. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1936. (average of both channels), with 1.0 sound will be unchanged, with
  1937. -1.0 left and right channels will be swapped.
  1938. @item c
  1939. Enable clipping. By default is enabled.
  1940. @end table
  1941. @section firequalizer
  1942. Apply FIR Equalization using arbitrary frequency response.
  1943. The filter accepts the following option:
  1944. @table @option
  1945. @item gain
  1946. Set gain curve equation (in dB). The expression can contain variables:
  1947. @table @option
  1948. @item f
  1949. the evaluated frequency
  1950. @item sr
  1951. sample rate
  1952. @item ch
  1953. channel number, set to 0 when multichannels evaluation is disabled
  1954. @item chid
  1955. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1956. multichannels evaluation is disabled
  1957. @item chs
  1958. number of channels
  1959. @item chlayout
  1960. channel_layout, see libavutil/channel_layout.h
  1961. @end table
  1962. and functions:
  1963. @table @option
  1964. @item gain_interpolate(f)
  1965. interpolate gain on frequency f based on gain_entry
  1966. @item cubic_interpolate(f)
  1967. same as gain_interpolate, but smoother
  1968. @end table
  1969. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1970. @item gain_entry
  1971. Set gain entry for gain_interpolate function. The expression can
  1972. contain functions:
  1973. @table @option
  1974. @item entry(f, g)
  1975. store gain entry at frequency f with value g
  1976. @end table
  1977. This option is also available as command.
  1978. @item delay
  1979. Set filter delay in seconds. Higher value means more accurate.
  1980. Default is @code{0.01}.
  1981. @item accuracy
  1982. Set filter accuracy in Hz. Lower value means more accurate.
  1983. Default is @code{5}.
  1984. @item wfunc
  1985. Set window function. Acceptable values are:
  1986. @table @option
  1987. @item rectangular
  1988. rectangular window, useful when gain curve is already smooth
  1989. @item hann
  1990. hann window (default)
  1991. @item hamming
  1992. hamming window
  1993. @item blackman
  1994. blackman window
  1995. @item nuttall3
  1996. 3-terms continuous 1st derivative nuttall window
  1997. @item mnuttall3
  1998. minimum 3-terms discontinuous nuttall window
  1999. @item nuttall
  2000. 4-terms continuous 1st derivative nuttall window
  2001. @item bnuttall
  2002. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2003. @item bharris
  2004. blackman-harris window
  2005. @item tukey
  2006. tukey window
  2007. @end table
  2008. @item fixed
  2009. If enabled, use fixed number of audio samples. This improves speed when
  2010. filtering with large delay. Default is disabled.
  2011. @item multi
  2012. Enable multichannels evaluation on gain. Default is disabled.
  2013. @item zero_phase
  2014. Enable zero phase mode by subtracting timestamp to compensate delay.
  2015. Default is disabled.
  2016. @item scale
  2017. Set scale used by gain. Acceptable values are:
  2018. @table @option
  2019. @item linlin
  2020. linear frequency, linear gain
  2021. @item linlog
  2022. linear frequency, logarithmic (in dB) gain (default)
  2023. @item loglin
  2024. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2025. @item loglog
  2026. logarithmic frequency, logarithmic gain
  2027. @end table
  2028. @item dumpfile
  2029. Set file for dumping, suitable for gnuplot.
  2030. @item dumpscale
  2031. Set scale for dumpfile. Acceptable values are same with scale option.
  2032. Default is linlog.
  2033. @item fft2
  2034. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2035. Default is disabled.
  2036. @end table
  2037. @subsection Examples
  2038. @itemize
  2039. @item
  2040. lowpass at 1000 Hz:
  2041. @example
  2042. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2043. @end example
  2044. @item
  2045. lowpass at 1000 Hz with gain_entry:
  2046. @example
  2047. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2048. @end example
  2049. @item
  2050. custom equalization:
  2051. @example
  2052. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2053. @end example
  2054. @item
  2055. higher delay with zero phase to compensate delay:
  2056. @example
  2057. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2058. @end example
  2059. @item
  2060. lowpass on left channel, highpass on right channel:
  2061. @example
  2062. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2063. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2064. @end example
  2065. @end itemize
  2066. @section flanger
  2067. Apply a flanging effect to the audio.
  2068. The filter accepts the following options:
  2069. @table @option
  2070. @item delay
  2071. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2072. @item depth
  2073. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2074. @item regen
  2075. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2076. Default value is 0.
  2077. @item width
  2078. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2079. Default value is 71.
  2080. @item speed
  2081. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2082. @item shape
  2083. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2084. Default value is @var{sinusoidal}.
  2085. @item phase
  2086. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2087. Default value is 25.
  2088. @item interp
  2089. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2090. Default is @var{linear}.
  2091. @end table
  2092. @section hdcd
  2093. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2094. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2095. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2096. of HDCD, and detects the Transient Filter flag.
  2097. @example
  2098. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2099. @end example
  2100. When using the filter with wav, note the default encoding for wav is 16-bit,
  2101. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2102. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2103. @example
  2104. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2105. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2106. @end example
  2107. The filter accepts the following options:
  2108. @table @option
  2109. @item disable_autoconvert
  2110. Disable any automatic format conversion or resampling in the filter graph.
  2111. @item process_stereo
  2112. Process the stereo channels together. If target_gain does not match between
  2113. channels, consider it invalid and use the last valid target_gain.
  2114. @item cdt_ms
  2115. Set the code detect timer period in ms.
  2116. @item force_pe
  2117. Always extend peaks above -3dBFS even if PE isn't signaled.
  2118. @item analyze_mode
  2119. Replace audio with a solid tone and adjust the amplitude to signal some
  2120. specific aspect of the decoding process. The output file can be loaded in
  2121. an audio editor alongside the original to aid analysis.
  2122. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2123. Modes are:
  2124. @table @samp
  2125. @item 0, off
  2126. Disabled
  2127. @item 1, lle
  2128. Gain adjustment level at each sample
  2129. @item 2, pe
  2130. Samples where peak extend occurs
  2131. @item 3, cdt
  2132. Samples where the code detect timer is active
  2133. @item 4, tgm
  2134. Samples where the target gain does not match between channels
  2135. @end table
  2136. @end table
  2137. @section highpass
  2138. Apply a high-pass filter with 3dB point frequency.
  2139. The filter can be either single-pole, or double-pole (the default).
  2140. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2141. The filter accepts the following options:
  2142. @table @option
  2143. @item frequency, f
  2144. Set frequency in Hz. Default is 3000.
  2145. @item poles, p
  2146. Set number of poles. Default is 2.
  2147. @item width_type
  2148. Set method to specify band-width of filter.
  2149. @table @option
  2150. @item h
  2151. Hz
  2152. @item q
  2153. Q-Factor
  2154. @item o
  2155. octave
  2156. @item s
  2157. slope
  2158. @end table
  2159. @item width, w
  2160. Specify the band-width of a filter in width_type units.
  2161. Applies only to double-pole filter.
  2162. The default is 0.707q and gives a Butterworth response.
  2163. @end table
  2164. @section join
  2165. Join multiple input streams into one multi-channel stream.
  2166. It accepts the following parameters:
  2167. @table @option
  2168. @item inputs
  2169. The number of input streams. It defaults to 2.
  2170. @item channel_layout
  2171. The desired output channel layout. It defaults to stereo.
  2172. @item map
  2173. Map channels from inputs to output. The argument is a '|'-separated list of
  2174. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2175. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2176. can be either the name of the input channel (e.g. FL for front left) or its
  2177. index in the specified input stream. @var{out_channel} is the name of the output
  2178. channel.
  2179. @end table
  2180. The filter will attempt to guess the mappings when they are not specified
  2181. explicitly. It does so by first trying to find an unused matching input channel
  2182. and if that fails it picks the first unused input channel.
  2183. Join 3 inputs (with properly set channel layouts):
  2184. @example
  2185. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2186. @end example
  2187. Build a 5.1 output from 6 single-channel streams:
  2188. @example
  2189. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2190. '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'
  2191. out
  2192. @end example
  2193. @section ladspa
  2194. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2195. To enable compilation of this filter you need to configure FFmpeg with
  2196. @code{--enable-ladspa}.
  2197. @table @option
  2198. @item file, f
  2199. Specifies the name of LADSPA plugin library to load. If the environment
  2200. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2201. each one of the directories specified by the colon separated list in
  2202. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2203. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2204. @file{/usr/lib/ladspa/}.
  2205. @item plugin, p
  2206. Specifies the plugin within the library. Some libraries contain only
  2207. one plugin, but others contain many of them. If this is not set filter
  2208. will list all available plugins within the specified library.
  2209. @item controls, c
  2210. Set the '|' separated list of controls which are zero or more floating point
  2211. values that determine the behavior of the loaded plugin (for example delay,
  2212. threshold or gain).
  2213. Controls need to be defined using the following syntax:
  2214. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2215. @var{valuei} is the value set on the @var{i}-th control.
  2216. Alternatively they can be also defined using the following syntax:
  2217. @var{value0}|@var{value1}|@var{value2}|..., where
  2218. @var{valuei} is the value set on the @var{i}-th control.
  2219. If @option{controls} is set to @code{help}, all available controls and
  2220. their valid ranges are printed.
  2221. @item sample_rate, s
  2222. Specify the sample rate, default to 44100. Only used if plugin have
  2223. zero inputs.
  2224. @item nb_samples, n
  2225. Set the number of samples per channel per each output frame, default
  2226. is 1024. Only used if plugin have zero inputs.
  2227. @item duration, d
  2228. Set the minimum duration of the sourced audio. See
  2229. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2230. for the accepted syntax.
  2231. Note that the resulting duration may be greater than the specified duration,
  2232. as the generated audio is always cut at the end of a complete frame.
  2233. If not specified, or the expressed duration is negative, the audio is
  2234. supposed to be generated forever.
  2235. Only used if plugin have zero inputs.
  2236. @end table
  2237. @subsection Examples
  2238. @itemize
  2239. @item
  2240. List all available plugins within amp (LADSPA example plugin) library:
  2241. @example
  2242. ladspa=file=amp
  2243. @end example
  2244. @item
  2245. List all available controls and their valid ranges for @code{vcf_notch}
  2246. plugin from @code{VCF} library:
  2247. @example
  2248. ladspa=f=vcf:p=vcf_notch:c=help
  2249. @end example
  2250. @item
  2251. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2252. plugin library:
  2253. @example
  2254. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2255. @end example
  2256. @item
  2257. Add reverberation to the audio using TAP-plugins
  2258. (Tom's Audio Processing plugins):
  2259. @example
  2260. ladspa=file=tap_reverb:tap_reverb
  2261. @end example
  2262. @item
  2263. Generate white noise, with 0.2 amplitude:
  2264. @example
  2265. ladspa=file=cmt:noise_source_white:c=c0=.2
  2266. @end example
  2267. @item
  2268. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2269. @code{C* Audio Plugin Suite} (CAPS) library:
  2270. @example
  2271. ladspa=file=caps:Click:c=c1=20'
  2272. @end example
  2273. @item
  2274. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2275. @example
  2276. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2277. @end example
  2278. @item
  2279. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2280. @code{SWH Plugins} collection:
  2281. @example
  2282. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2283. @end example
  2284. @item
  2285. Attenuate low frequencies using Multiband EQ from Steve Harris
  2286. @code{SWH Plugins} collection:
  2287. @example
  2288. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2289. @end example
  2290. @end itemize
  2291. @subsection Commands
  2292. This filter supports the following commands:
  2293. @table @option
  2294. @item cN
  2295. Modify the @var{N}-th control value.
  2296. If the specified value is not valid, it is ignored and prior one is kept.
  2297. @end table
  2298. @section loudnorm
  2299. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2300. Support for both single pass (livestreams, files) and double pass (files) modes.
  2301. This algorithm can target IL, LRA, and maximum true peak.
  2302. The filter accepts the following options:
  2303. @table @option
  2304. @item I, i
  2305. Set integrated loudness target.
  2306. Range is -70.0 - -5.0. Default value is -24.0.
  2307. @item LRA, lra
  2308. Set loudness range target.
  2309. Range is 1.0 - 20.0. Default value is 7.0.
  2310. @item TP, tp
  2311. Set maximum true peak.
  2312. Range is -9.0 - +0.0. Default value is -2.0.
  2313. @item measured_I, measured_i
  2314. Measured IL of input file.
  2315. Range is -99.0 - +0.0.
  2316. @item measured_LRA, measured_lra
  2317. Measured LRA of input file.
  2318. Range is 0.0 - 99.0.
  2319. @item measured_TP, measured_tp
  2320. Measured true peak of input file.
  2321. Range is -99.0 - +99.0.
  2322. @item measured_thresh
  2323. Measured threshold of input file.
  2324. Range is -99.0 - +0.0.
  2325. @item offset
  2326. Set offset gain. Gain is applied before the true-peak limiter.
  2327. Range is -99.0 - +99.0. Default is +0.0.
  2328. @item linear
  2329. Normalize linearly if possible.
  2330. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2331. to be specified in order to use this mode.
  2332. Options are true or false. Default is true.
  2333. @item dual_mono
  2334. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2335. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2336. If set to @code{true}, this option will compensate for this effect.
  2337. Multi-channel input files are not affected by this option.
  2338. Options are true or false. Default is false.
  2339. @item print_format
  2340. Set print format for stats. Options are summary, json, or none.
  2341. Default value is none.
  2342. @end table
  2343. @section lowpass
  2344. Apply a low-pass filter with 3dB point frequency.
  2345. The filter can be either single-pole or double-pole (the default).
  2346. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2347. The filter accepts the following options:
  2348. @table @option
  2349. @item frequency, f
  2350. Set frequency in Hz. Default is 500.
  2351. @item poles, p
  2352. Set number of poles. Default is 2.
  2353. @item width_type
  2354. Set method to specify band-width of filter.
  2355. @table @option
  2356. @item h
  2357. Hz
  2358. @item q
  2359. Q-Factor
  2360. @item o
  2361. octave
  2362. @item s
  2363. slope
  2364. @end table
  2365. @item width, w
  2366. Specify the band-width of a filter in width_type units.
  2367. Applies only to double-pole filter.
  2368. The default is 0.707q and gives a Butterworth response.
  2369. @end table
  2370. @anchor{pan}
  2371. @section pan
  2372. Mix channels with specific gain levels. The filter accepts the output
  2373. channel layout followed by a set of channels definitions.
  2374. This filter is also designed to efficiently remap the channels of an audio
  2375. stream.
  2376. The filter accepts parameters of the form:
  2377. "@var{l}|@var{outdef}|@var{outdef}|..."
  2378. @table @option
  2379. @item l
  2380. output channel layout or number of channels
  2381. @item outdef
  2382. output channel specification, of the form:
  2383. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2384. @item out_name
  2385. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2386. number (c0, c1, etc.)
  2387. @item gain
  2388. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2389. @item in_name
  2390. input channel to use, see out_name for details; it is not possible to mix
  2391. named and numbered input channels
  2392. @end table
  2393. If the `=' in a channel specification is replaced by `<', then the gains for
  2394. that specification will be renormalized so that the total is 1, thus
  2395. avoiding clipping noise.
  2396. @subsection Mixing examples
  2397. For example, if you want to down-mix from stereo to mono, but with a bigger
  2398. factor for the left channel:
  2399. @example
  2400. pan=1c|c0=0.9*c0+0.1*c1
  2401. @end example
  2402. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2403. 7-channels surround:
  2404. @example
  2405. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2406. @end example
  2407. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2408. that should be preferred (see "-ac" option) unless you have very specific
  2409. needs.
  2410. @subsection Remapping examples
  2411. The channel remapping will be effective if, and only if:
  2412. @itemize
  2413. @item gain coefficients are zeroes or ones,
  2414. @item only one input per channel output,
  2415. @end itemize
  2416. If all these conditions are satisfied, the filter will notify the user ("Pure
  2417. channel mapping detected"), and use an optimized and lossless method to do the
  2418. remapping.
  2419. For example, if you have a 5.1 source and want a stereo audio stream by
  2420. dropping the extra channels:
  2421. @example
  2422. pan="stereo| c0=FL | c1=FR"
  2423. @end example
  2424. Given the same source, you can also switch front left and front right channels
  2425. and keep the input channel layout:
  2426. @example
  2427. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2428. @end example
  2429. If the input is a stereo audio stream, you can mute the front left channel (and
  2430. still keep the stereo channel layout) with:
  2431. @example
  2432. pan="stereo|c1=c1"
  2433. @end example
  2434. Still with a stereo audio stream input, you can copy the right channel in both
  2435. front left and right:
  2436. @example
  2437. pan="stereo| c0=FR | c1=FR"
  2438. @end example
  2439. @section replaygain
  2440. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2441. outputs it unchanged.
  2442. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2443. @section resample
  2444. Convert the audio sample format, sample rate and channel layout. It is
  2445. not meant to be used directly.
  2446. @section rubberband
  2447. Apply time-stretching and pitch-shifting with librubberband.
  2448. The filter accepts the following options:
  2449. @table @option
  2450. @item tempo
  2451. Set tempo scale factor.
  2452. @item pitch
  2453. Set pitch scale factor.
  2454. @item transients
  2455. Set transients detector.
  2456. Possible values are:
  2457. @table @var
  2458. @item crisp
  2459. @item mixed
  2460. @item smooth
  2461. @end table
  2462. @item detector
  2463. Set detector.
  2464. Possible values are:
  2465. @table @var
  2466. @item compound
  2467. @item percussive
  2468. @item soft
  2469. @end table
  2470. @item phase
  2471. Set phase.
  2472. Possible values are:
  2473. @table @var
  2474. @item laminar
  2475. @item independent
  2476. @end table
  2477. @item window
  2478. Set processing window size.
  2479. Possible values are:
  2480. @table @var
  2481. @item standard
  2482. @item short
  2483. @item long
  2484. @end table
  2485. @item smoothing
  2486. Set smoothing.
  2487. Possible values are:
  2488. @table @var
  2489. @item off
  2490. @item on
  2491. @end table
  2492. @item formant
  2493. Enable formant preservation when shift pitching.
  2494. Possible values are:
  2495. @table @var
  2496. @item shifted
  2497. @item preserved
  2498. @end table
  2499. @item pitchq
  2500. Set pitch quality.
  2501. Possible values are:
  2502. @table @var
  2503. @item quality
  2504. @item speed
  2505. @item consistency
  2506. @end table
  2507. @item channels
  2508. Set channels.
  2509. Possible values are:
  2510. @table @var
  2511. @item apart
  2512. @item together
  2513. @end table
  2514. @end table
  2515. @section sidechaincompress
  2516. This filter acts like normal compressor but has the ability to compress
  2517. detected signal using second input signal.
  2518. It needs two input streams and returns one output stream.
  2519. First input stream will be processed depending on second stream signal.
  2520. The filtered signal then can be filtered with other filters in later stages of
  2521. processing. See @ref{pan} and @ref{amerge} filter.
  2522. The filter accepts the following options:
  2523. @table @option
  2524. @item level_in
  2525. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2526. @item threshold
  2527. If a signal of second stream raises above this level it will affect the gain
  2528. reduction of first stream.
  2529. By default is 0.125. Range is between 0.00097563 and 1.
  2530. @item ratio
  2531. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2532. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2533. Default is 2. Range is between 1 and 20.
  2534. @item attack
  2535. Amount of milliseconds the signal has to rise above the threshold before gain
  2536. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2537. @item release
  2538. Amount of milliseconds the signal has to fall below the threshold before
  2539. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2540. @item makeup
  2541. Set the amount by how much signal will be amplified after processing.
  2542. Default is 2. Range is from 1 and 64.
  2543. @item knee
  2544. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2545. Default is 2.82843. Range is between 1 and 8.
  2546. @item link
  2547. Choose if the @code{average} level between all channels of side-chain stream
  2548. or the louder(@code{maximum}) channel of side-chain stream affects the
  2549. reduction. Default is @code{average}.
  2550. @item detection
  2551. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2552. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2553. @item level_sc
  2554. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2555. @item mix
  2556. How much to use compressed signal in output. Default is 1.
  2557. Range is between 0 and 1.
  2558. @end table
  2559. @subsection Examples
  2560. @itemize
  2561. @item
  2562. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2563. depending on the signal of 2nd input and later compressed signal to be
  2564. merged with 2nd input:
  2565. @example
  2566. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2567. @end example
  2568. @end itemize
  2569. @section sidechaingate
  2570. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2571. filter the detected signal before sending it to the gain reduction stage.
  2572. Normally a gate uses the full range signal to detect a level above the
  2573. threshold.
  2574. For example: If you cut all lower frequencies from your sidechain signal
  2575. the gate will decrease the volume of your track only if not enough highs
  2576. appear. With this technique you are able to reduce the resonation of a
  2577. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2578. guitar.
  2579. It needs two input streams and returns one output stream.
  2580. First input stream will be processed depending on second stream signal.
  2581. The filter accepts the following options:
  2582. @table @option
  2583. @item level_in
  2584. Set input level before filtering.
  2585. Default is 1. Allowed range is from 0.015625 to 64.
  2586. @item range
  2587. Set the level of gain reduction when the signal is below the threshold.
  2588. Default is 0.06125. Allowed range is from 0 to 1.
  2589. @item threshold
  2590. If a signal rises above this level the gain reduction is released.
  2591. Default is 0.125. Allowed range is from 0 to 1.
  2592. @item ratio
  2593. Set a ratio about which the signal is reduced.
  2594. Default is 2. Allowed range is from 1 to 9000.
  2595. @item attack
  2596. Amount of milliseconds the signal has to rise above the threshold before gain
  2597. reduction stops.
  2598. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2599. @item release
  2600. Amount of milliseconds the signal has to fall below the threshold before the
  2601. reduction is increased again. Default is 250 milliseconds.
  2602. Allowed range is from 0.01 to 9000.
  2603. @item makeup
  2604. Set amount of amplification of signal after processing.
  2605. Default is 1. Allowed range is from 1 to 64.
  2606. @item knee
  2607. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2608. Default is 2.828427125. Allowed range is from 1 to 8.
  2609. @item detection
  2610. Choose if exact signal should be taken for detection or an RMS like one.
  2611. Default is rms. Can be peak or rms.
  2612. @item link
  2613. Choose if the average level between all channels or the louder channel affects
  2614. the reduction.
  2615. Default is average. Can be average or maximum.
  2616. @item level_sc
  2617. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2618. @end table
  2619. @section silencedetect
  2620. Detect silence in an audio stream.
  2621. This filter logs a message when it detects that the input audio volume is less
  2622. or equal to a noise tolerance value for a duration greater or equal to the
  2623. minimum detected noise duration.
  2624. The printed times and duration are expressed in seconds.
  2625. The filter accepts the following options:
  2626. @table @option
  2627. @item duration, d
  2628. Set silence duration until notification (default is 2 seconds).
  2629. @item noise, n
  2630. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2631. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2632. @end table
  2633. @subsection Examples
  2634. @itemize
  2635. @item
  2636. Detect 5 seconds of silence with -50dB noise tolerance:
  2637. @example
  2638. silencedetect=n=-50dB:d=5
  2639. @end example
  2640. @item
  2641. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2642. tolerance in @file{silence.mp3}:
  2643. @example
  2644. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2645. @end example
  2646. @end itemize
  2647. @section silenceremove
  2648. Remove silence from the beginning, middle or end of the audio.
  2649. The filter accepts the following options:
  2650. @table @option
  2651. @item start_periods
  2652. This value is used to indicate if audio should be trimmed at beginning of
  2653. the audio. A value of zero indicates no silence should be trimmed from the
  2654. beginning. When specifying a non-zero value, it trims audio up until it
  2655. finds non-silence. Normally, when trimming silence from beginning of audio
  2656. the @var{start_periods} will be @code{1} but it can be increased to higher
  2657. values to trim all audio up to specific count of non-silence periods.
  2658. Default value is @code{0}.
  2659. @item start_duration
  2660. Specify the amount of time that non-silence must be detected before it stops
  2661. trimming audio. By increasing the duration, bursts of noises can be treated
  2662. as silence and trimmed off. Default value is @code{0}.
  2663. @item start_threshold
  2664. This indicates what sample value should be treated as silence. For digital
  2665. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2666. you may wish to increase the value to account for background noise.
  2667. Can be specified in dB (in case "dB" is appended to the specified value)
  2668. or amplitude ratio. Default value is @code{0}.
  2669. @item stop_periods
  2670. Set the count for trimming silence from the end of audio.
  2671. To remove silence from the middle of a file, specify a @var{stop_periods}
  2672. that is negative. This value is then treated as a positive value and is
  2673. used to indicate the effect should restart processing as specified by
  2674. @var{start_periods}, making it suitable for removing periods of silence
  2675. in the middle of the audio.
  2676. Default value is @code{0}.
  2677. @item stop_duration
  2678. Specify a duration of silence that must exist before audio is not copied any
  2679. more. By specifying a higher duration, silence that is wanted can be left in
  2680. the audio.
  2681. Default value is @code{0}.
  2682. @item stop_threshold
  2683. This is the same as @option{start_threshold} but for trimming silence from
  2684. the end of audio.
  2685. Can be specified in dB (in case "dB" is appended to the specified value)
  2686. or amplitude ratio. Default value is @code{0}.
  2687. @item leave_silence
  2688. This indicates that @var{stop_duration} length of audio should be left intact
  2689. at the beginning of each period of silence.
  2690. For example, if you want to remove long pauses between words but do not want
  2691. to remove the pauses completely. Default value is @code{0}.
  2692. @item detection
  2693. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2694. and works better with digital silence which is exactly 0.
  2695. Default value is @code{rms}.
  2696. @item window
  2697. Set ratio used to calculate size of window for detecting silence.
  2698. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2699. @end table
  2700. @subsection Examples
  2701. @itemize
  2702. @item
  2703. The following example shows how this filter can be used to start a recording
  2704. that does not contain the delay at the start which usually occurs between
  2705. pressing the record button and the start of the performance:
  2706. @example
  2707. silenceremove=1:5:0.02
  2708. @end example
  2709. @item
  2710. Trim all silence encountered from beginning to end where there is more than 1
  2711. second of silence in audio:
  2712. @example
  2713. silenceremove=0:0:0:-1:1:-90dB
  2714. @end example
  2715. @end itemize
  2716. @section sofalizer
  2717. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2718. loudspeakers around the user for binaural listening via headphones (audio
  2719. formats up to 9 channels supported).
  2720. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2721. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2722. Austrian Academy of Sciences.
  2723. To enable compilation of this filter you need to configure FFmpeg with
  2724. @code{--enable-netcdf}.
  2725. The filter accepts the following options:
  2726. @table @option
  2727. @item sofa
  2728. Set the SOFA file used for rendering.
  2729. @item gain
  2730. Set gain applied to audio. Value is in dB. Default is 0.
  2731. @item rotation
  2732. Set rotation of virtual loudspeakers in deg. Default is 0.
  2733. @item elevation
  2734. Set elevation of virtual speakers in deg. Default is 0.
  2735. @item radius
  2736. Set distance in meters between loudspeakers and the listener with near-field
  2737. HRTFs. Default is 1.
  2738. @item type
  2739. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2740. processing audio in time domain which is slow.
  2741. @var{freq} is processing audio in frequency domain which is fast.
  2742. Default is @var{freq}.
  2743. @item speakers
  2744. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2745. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2746. Each virtual loudspeaker is described with short channel name following with
  2747. azimuth and elevation in degreees.
  2748. Each virtual loudspeaker description is separated by '|'.
  2749. For example to override front left and front right channel positions use:
  2750. 'speakers=FL 45 15|FR 345 15'.
  2751. Descriptions with unrecognised channel names are ignored.
  2752. @end table
  2753. @subsection Examples
  2754. @itemize
  2755. @item
  2756. Using ClubFritz6 sofa file:
  2757. @example
  2758. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2759. @end example
  2760. @item
  2761. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2762. @example
  2763. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2764. @end example
  2765. @item
  2766. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2767. and also with custom gain:
  2768. @example
  2769. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2770. @end example
  2771. @end itemize
  2772. @section stereotools
  2773. This filter has some handy utilities to manage stereo signals, for converting
  2774. M/S stereo recordings to L/R signal while having control over the parameters
  2775. or spreading the stereo image of master track.
  2776. The filter accepts the following options:
  2777. @table @option
  2778. @item level_in
  2779. Set input level before filtering for both channels. Defaults is 1.
  2780. Allowed range is from 0.015625 to 64.
  2781. @item level_out
  2782. Set output level after filtering for both channels. Defaults is 1.
  2783. Allowed range is from 0.015625 to 64.
  2784. @item balance_in
  2785. Set input balance between both channels. Default is 0.
  2786. Allowed range is from -1 to 1.
  2787. @item balance_out
  2788. Set output balance between both channels. Default is 0.
  2789. Allowed range is from -1 to 1.
  2790. @item softclip
  2791. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2792. clipping. Disabled by default.
  2793. @item mutel
  2794. Mute the left channel. Disabled by default.
  2795. @item muter
  2796. Mute the right channel. Disabled by default.
  2797. @item phasel
  2798. Change the phase of the left channel. Disabled by default.
  2799. @item phaser
  2800. Change the phase of the right channel. Disabled by default.
  2801. @item mode
  2802. Set stereo mode. Available values are:
  2803. @table @samp
  2804. @item lr>lr
  2805. Left/Right to Left/Right, this is default.
  2806. @item lr>ms
  2807. Left/Right to Mid/Side.
  2808. @item ms>lr
  2809. Mid/Side to Left/Right.
  2810. @item lr>ll
  2811. Left/Right to Left/Left.
  2812. @item lr>rr
  2813. Left/Right to Right/Right.
  2814. @item lr>l+r
  2815. Left/Right to Left + Right.
  2816. @item lr>rl
  2817. Left/Right to Right/Left.
  2818. @end table
  2819. @item slev
  2820. Set level of side signal. Default is 1.
  2821. Allowed range is from 0.015625 to 64.
  2822. @item sbal
  2823. Set balance of side signal. Default is 0.
  2824. Allowed range is from -1 to 1.
  2825. @item mlev
  2826. Set level of the middle signal. Default is 1.
  2827. Allowed range is from 0.015625 to 64.
  2828. @item mpan
  2829. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2830. @item base
  2831. Set stereo base between mono and inversed channels. Default is 0.
  2832. Allowed range is from -1 to 1.
  2833. @item delay
  2834. Set delay in milliseconds how much to delay left from right channel and
  2835. vice versa. Default is 0. Allowed range is from -20 to 20.
  2836. @item sclevel
  2837. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2838. @item phase
  2839. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2840. @end table
  2841. @subsection Examples
  2842. @itemize
  2843. @item
  2844. Apply karaoke like effect:
  2845. @example
  2846. stereotools=mlev=0.015625
  2847. @end example
  2848. @item
  2849. Convert M/S signal to L/R:
  2850. @example
  2851. "stereotools=mode=ms>lr"
  2852. @end example
  2853. @end itemize
  2854. @section stereowiden
  2855. This filter enhance the stereo effect by suppressing signal common to both
  2856. channels and by delaying the signal of left into right and vice versa,
  2857. thereby widening the stereo effect.
  2858. The filter accepts the following options:
  2859. @table @option
  2860. @item delay
  2861. Time in milliseconds of the delay of left signal into right and vice versa.
  2862. Default is 20 milliseconds.
  2863. @item feedback
  2864. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2865. effect of left signal in right output and vice versa which gives widening
  2866. effect. Default is 0.3.
  2867. @item crossfeed
  2868. Cross feed of left into right with inverted phase. This helps in suppressing
  2869. the mono. If the value is 1 it will cancel all the signal common to both
  2870. channels. Default is 0.3.
  2871. @item drymix
  2872. Set level of input signal of original channel. Default is 0.8.
  2873. @end table
  2874. @section treble
  2875. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2876. shelving filter with a response similar to that of a standard
  2877. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2878. The filter accepts the following options:
  2879. @table @option
  2880. @item gain, g
  2881. Give the gain at whichever is the lower of ~22 kHz and the
  2882. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2883. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2884. @item frequency, f
  2885. Set the filter's central frequency and so can be used
  2886. to extend or reduce the frequency range to be boosted or cut.
  2887. The default value is @code{3000} Hz.
  2888. @item width_type
  2889. Set method to specify band-width of filter.
  2890. @table @option
  2891. @item h
  2892. Hz
  2893. @item q
  2894. Q-Factor
  2895. @item o
  2896. octave
  2897. @item s
  2898. slope
  2899. @end table
  2900. @item width, w
  2901. Determine how steep is the filter's shelf transition.
  2902. @end table
  2903. @section tremolo
  2904. Sinusoidal amplitude modulation.
  2905. The filter accepts the following options:
  2906. @table @option
  2907. @item f
  2908. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2909. (20 Hz or lower) will result in a tremolo effect.
  2910. This filter may also be used as a ring modulator by specifying
  2911. a modulation frequency higher than 20 Hz.
  2912. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2913. @item d
  2914. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2915. Default value is 0.5.
  2916. @end table
  2917. @section vibrato
  2918. Sinusoidal phase modulation.
  2919. The filter accepts the following options:
  2920. @table @option
  2921. @item f
  2922. Modulation frequency in Hertz.
  2923. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2924. @item d
  2925. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2926. Default value is 0.5.
  2927. @end table
  2928. @section volume
  2929. Adjust the input audio volume.
  2930. It accepts the following parameters:
  2931. @table @option
  2932. @item volume
  2933. Set audio volume expression.
  2934. Output values are clipped to the maximum value.
  2935. The output audio volume is given by the relation:
  2936. @example
  2937. @var{output_volume} = @var{volume} * @var{input_volume}
  2938. @end example
  2939. The default value for @var{volume} is "1.0".
  2940. @item precision
  2941. This parameter represents the mathematical precision.
  2942. It determines which input sample formats will be allowed, which affects the
  2943. precision of the volume scaling.
  2944. @table @option
  2945. @item fixed
  2946. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2947. @item float
  2948. 32-bit floating-point; this limits input sample format to FLT. (default)
  2949. @item double
  2950. 64-bit floating-point; this limits input sample format to DBL.
  2951. @end table
  2952. @item replaygain
  2953. Choose the behaviour on encountering ReplayGain side data in input frames.
  2954. @table @option
  2955. @item drop
  2956. Remove ReplayGain side data, ignoring its contents (the default).
  2957. @item ignore
  2958. Ignore ReplayGain side data, but leave it in the frame.
  2959. @item track
  2960. Prefer the track gain, if present.
  2961. @item album
  2962. Prefer the album gain, if present.
  2963. @end table
  2964. @item replaygain_preamp
  2965. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2966. Default value for @var{replaygain_preamp} is 0.0.
  2967. @item eval
  2968. Set when the volume expression is evaluated.
  2969. It accepts the following values:
  2970. @table @samp
  2971. @item once
  2972. only evaluate expression once during the filter initialization, or
  2973. when the @samp{volume} command is sent
  2974. @item frame
  2975. evaluate expression for each incoming frame
  2976. @end table
  2977. Default value is @samp{once}.
  2978. @end table
  2979. The volume expression can contain the following parameters.
  2980. @table @option
  2981. @item n
  2982. frame number (starting at zero)
  2983. @item nb_channels
  2984. number of channels
  2985. @item nb_consumed_samples
  2986. number of samples consumed by the filter
  2987. @item nb_samples
  2988. number of samples in the current frame
  2989. @item pos
  2990. original frame position in the file
  2991. @item pts
  2992. frame PTS
  2993. @item sample_rate
  2994. sample rate
  2995. @item startpts
  2996. PTS at start of stream
  2997. @item startt
  2998. time at start of stream
  2999. @item t
  3000. frame time
  3001. @item tb
  3002. timestamp timebase
  3003. @item volume
  3004. last set volume value
  3005. @end table
  3006. Note that when @option{eval} is set to @samp{once} only the
  3007. @var{sample_rate} and @var{tb} variables are available, all other
  3008. variables will evaluate to NAN.
  3009. @subsection Commands
  3010. This filter supports the following commands:
  3011. @table @option
  3012. @item volume
  3013. Modify the volume expression.
  3014. The command accepts the same syntax of the corresponding option.
  3015. If the specified expression is not valid, it is kept at its current
  3016. value.
  3017. @item replaygain_noclip
  3018. Prevent clipping by limiting the gain applied.
  3019. Default value for @var{replaygain_noclip} is 1.
  3020. @end table
  3021. @subsection Examples
  3022. @itemize
  3023. @item
  3024. Halve the input audio volume:
  3025. @example
  3026. volume=volume=0.5
  3027. volume=volume=1/2
  3028. volume=volume=-6.0206dB
  3029. @end example
  3030. In all the above example the named key for @option{volume} can be
  3031. omitted, for example like in:
  3032. @example
  3033. volume=0.5
  3034. @end example
  3035. @item
  3036. Increase input audio power by 6 decibels using fixed-point precision:
  3037. @example
  3038. volume=volume=6dB:precision=fixed
  3039. @end example
  3040. @item
  3041. Fade volume after time 10 with an annihilation period of 5 seconds:
  3042. @example
  3043. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3044. @end example
  3045. @end itemize
  3046. @section volumedetect
  3047. Detect the volume of the input video.
  3048. The filter has no parameters. The input is not modified. Statistics about
  3049. the volume will be printed in the log when the input stream end is reached.
  3050. In particular it will show the mean volume (root mean square), maximum
  3051. volume (on a per-sample basis), and the beginning of a histogram of the
  3052. registered volume values (from the maximum value to a cumulated 1/1000 of
  3053. the samples).
  3054. All volumes are in decibels relative to the maximum PCM value.
  3055. @subsection Examples
  3056. Here is an excerpt of the output:
  3057. @example
  3058. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3059. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3060. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3061. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3062. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3063. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3064. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3065. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3066. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3067. @end example
  3068. It means that:
  3069. @itemize
  3070. @item
  3071. The mean square energy is approximately -27 dB, or 10^-2.7.
  3072. @item
  3073. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3074. @item
  3075. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3076. @end itemize
  3077. In other words, raising the volume by +4 dB does not cause any clipping,
  3078. raising it by +5 dB causes clipping for 6 samples, etc.
  3079. @c man end AUDIO FILTERS
  3080. @chapter Audio Sources
  3081. @c man begin AUDIO SOURCES
  3082. Below is a description of the currently available audio sources.
  3083. @section abuffer
  3084. Buffer audio frames, and make them available to the filter chain.
  3085. This source is mainly intended for a programmatic use, in particular
  3086. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3087. It accepts the following parameters:
  3088. @table @option
  3089. @item time_base
  3090. The timebase which will be used for timestamps of submitted frames. It must be
  3091. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3092. @item sample_rate
  3093. The sample rate of the incoming audio buffers.
  3094. @item sample_fmt
  3095. The sample format of the incoming audio buffers.
  3096. Either a sample format name or its corresponding integer representation from
  3097. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3098. @item channel_layout
  3099. The channel layout of the incoming audio buffers.
  3100. Either a channel layout name from channel_layout_map in
  3101. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3102. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3103. @item channels
  3104. The number of channels of the incoming audio buffers.
  3105. If both @var{channels} and @var{channel_layout} are specified, then they
  3106. must be consistent.
  3107. @end table
  3108. @subsection Examples
  3109. @example
  3110. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3111. @end example
  3112. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3113. Since the sample format with name "s16p" corresponds to the number
  3114. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3115. equivalent to:
  3116. @example
  3117. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3118. @end example
  3119. @section aevalsrc
  3120. Generate an audio signal specified by an expression.
  3121. This source accepts in input one or more expressions (one for each
  3122. channel), which are evaluated and used to generate a corresponding
  3123. audio signal.
  3124. This source accepts the following options:
  3125. @table @option
  3126. @item exprs
  3127. Set the '|'-separated expressions list for each separate channel. In case the
  3128. @option{channel_layout} option is not specified, the selected channel layout
  3129. depends on the number of provided expressions. Otherwise the last
  3130. specified expression is applied to the remaining output channels.
  3131. @item channel_layout, c
  3132. Set the channel layout. The number of channels in the specified layout
  3133. must be equal to the number of specified expressions.
  3134. @item duration, d
  3135. Set the minimum duration of the sourced audio. See
  3136. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3137. for the accepted syntax.
  3138. Note that the resulting duration may be greater than the specified
  3139. duration, as the generated audio is always cut at the end of a
  3140. complete frame.
  3141. If not specified, or the expressed duration is negative, the audio is
  3142. supposed to be generated forever.
  3143. @item nb_samples, n
  3144. Set the number of samples per channel per each output frame,
  3145. default to 1024.
  3146. @item sample_rate, s
  3147. Specify the sample rate, default to 44100.
  3148. @end table
  3149. Each expression in @var{exprs} can contain the following constants:
  3150. @table @option
  3151. @item n
  3152. number of the evaluated sample, starting from 0
  3153. @item t
  3154. time of the evaluated sample expressed in seconds, starting from 0
  3155. @item s
  3156. sample rate
  3157. @end table
  3158. @subsection Examples
  3159. @itemize
  3160. @item
  3161. Generate silence:
  3162. @example
  3163. aevalsrc=0
  3164. @end example
  3165. @item
  3166. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3167. 8000 Hz:
  3168. @example
  3169. aevalsrc="sin(440*2*PI*t):s=8000"
  3170. @end example
  3171. @item
  3172. Generate a two channels signal, specify the channel layout (Front
  3173. Center + Back Center) explicitly:
  3174. @example
  3175. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3176. @end example
  3177. @item
  3178. Generate white noise:
  3179. @example
  3180. aevalsrc="-2+random(0)"
  3181. @end example
  3182. @item
  3183. Generate an amplitude modulated signal:
  3184. @example
  3185. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3186. @end example
  3187. @item
  3188. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3189. @example
  3190. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3191. @end example
  3192. @end itemize
  3193. @section anullsrc
  3194. The null audio source, return unprocessed audio frames. It is mainly useful
  3195. as a template and to be employed in analysis / debugging tools, or as
  3196. the source for filters which ignore the input data (for example the sox
  3197. synth filter).
  3198. This source accepts the following options:
  3199. @table @option
  3200. @item channel_layout, cl
  3201. Specifies the channel layout, and can be either an integer or a string
  3202. representing a channel layout. The default value of @var{channel_layout}
  3203. is "stereo".
  3204. Check the channel_layout_map definition in
  3205. @file{libavutil/channel_layout.c} for the mapping between strings and
  3206. channel layout values.
  3207. @item sample_rate, r
  3208. Specifies the sample rate, and defaults to 44100.
  3209. @item nb_samples, n
  3210. Set the number of samples per requested frames.
  3211. @end table
  3212. @subsection Examples
  3213. @itemize
  3214. @item
  3215. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3216. @example
  3217. anullsrc=r=48000:cl=4
  3218. @end example
  3219. @item
  3220. Do the same operation with a more obvious syntax:
  3221. @example
  3222. anullsrc=r=48000:cl=mono
  3223. @end example
  3224. @end itemize
  3225. All the parameters need to be explicitly defined.
  3226. @section flite
  3227. Synthesize a voice utterance using the libflite library.
  3228. To enable compilation of this filter you need to configure FFmpeg with
  3229. @code{--enable-libflite}.
  3230. Note that the flite library is not thread-safe.
  3231. The filter accepts the following options:
  3232. @table @option
  3233. @item list_voices
  3234. If set to 1, list the names of the available voices and exit
  3235. immediately. Default value is 0.
  3236. @item nb_samples, n
  3237. Set the maximum number of samples per frame. Default value is 512.
  3238. @item textfile
  3239. Set the filename containing the text to speak.
  3240. @item text
  3241. Set the text to speak.
  3242. @item voice, v
  3243. Set the voice to use for the speech synthesis. Default value is
  3244. @code{kal}. See also the @var{list_voices} option.
  3245. @end table
  3246. @subsection Examples
  3247. @itemize
  3248. @item
  3249. Read from file @file{speech.txt}, and synthesize the text using the
  3250. standard flite voice:
  3251. @example
  3252. flite=textfile=speech.txt
  3253. @end example
  3254. @item
  3255. Read the specified text selecting the @code{slt} voice:
  3256. @example
  3257. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3258. @end example
  3259. @item
  3260. Input text to ffmpeg:
  3261. @example
  3262. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3263. @end example
  3264. @item
  3265. Make @file{ffplay} speak the specified text, using @code{flite} and
  3266. the @code{lavfi} device:
  3267. @example
  3268. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3269. @end example
  3270. @end itemize
  3271. For more information about libflite, check:
  3272. @url{http://www.speech.cs.cmu.edu/flite/}
  3273. @section anoisesrc
  3274. Generate a noise audio signal.
  3275. The filter accepts the following options:
  3276. @table @option
  3277. @item sample_rate, r
  3278. Specify the sample rate. Default value is 48000 Hz.
  3279. @item amplitude, a
  3280. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3281. is 1.0.
  3282. @item duration, d
  3283. Specify the duration of the generated audio stream. Not specifying this option
  3284. results in noise with an infinite length.
  3285. @item color, colour, c
  3286. Specify the color of noise. Available noise colors are white, pink, and brown.
  3287. Default color is white.
  3288. @item seed, s
  3289. Specify a value used to seed the PRNG.
  3290. @item nb_samples, n
  3291. Set the number of samples per each output frame, default is 1024.
  3292. @end table
  3293. @subsection Examples
  3294. @itemize
  3295. @item
  3296. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3297. @example
  3298. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3299. @end example
  3300. @end itemize
  3301. @section sine
  3302. Generate an audio signal made of a sine wave with amplitude 1/8.
  3303. The audio signal is bit-exact.
  3304. The filter accepts the following options:
  3305. @table @option
  3306. @item frequency, f
  3307. Set the carrier frequency. Default is 440 Hz.
  3308. @item beep_factor, b
  3309. Enable a periodic beep every second with frequency @var{beep_factor} times
  3310. the carrier frequency. Default is 0, meaning the beep is disabled.
  3311. @item sample_rate, r
  3312. Specify the sample rate, default is 44100.
  3313. @item duration, d
  3314. Specify the duration of the generated audio stream.
  3315. @item samples_per_frame
  3316. Set the number of samples per output frame.
  3317. The expression can contain the following constants:
  3318. @table @option
  3319. @item n
  3320. The (sequential) number of the output audio frame, starting from 0.
  3321. @item pts
  3322. The PTS (Presentation TimeStamp) of the output audio frame,
  3323. expressed in @var{TB} units.
  3324. @item t
  3325. The PTS of the output audio frame, expressed in seconds.
  3326. @item TB
  3327. The timebase of the output audio frames.
  3328. @end table
  3329. Default is @code{1024}.
  3330. @end table
  3331. @subsection Examples
  3332. @itemize
  3333. @item
  3334. Generate a simple 440 Hz sine wave:
  3335. @example
  3336. sine
  3337. @end example
  3338. @item
  3339. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3340. @example
  3341. sine=220:4:d=5
  3342. sine=f=220:b=4:d=5
  3343. sine=frequency=220:beep_factor=4:duration=5
  3344. @end example
  3345. @item
  3346. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3347. pattern:
  3348. @example
  3349. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3350. @end example
  3351. @end itemize
  3352. @c man end AUDIO SOURCES
  3353. @chapter Audio Sinks
  3354. @c man begin AUDIO SINKS
  3355. Below is a description of the currently available audio sinks.
  3356. @section abuffersink
  3357. Buffer audio frames, and make them available to the end of filter chain.
  3358. This sink is mainly intended for programmatic use, in particular
  3359. through the interface defined in @file{libavfilter/buffersink.h}
  3360. or the options system.
  3361. It accepts a pointer to an AVABufferSinkContext structure, which
  3362. defines the incoming buffers' formats, to be passed as the opaque
  3363. parameter to @code{avfilter_init_filter} for initialization.
  3364. @section anullsink
  3365. Null audio sink; do absolutely nothing with the input audio. It is
  3366. mainly useful as a template and for use in analysis / debugging
  3367. tools.
  3368. @c man end AUDIO SINKS
  3369. @chapter Video Filters
  3370. @c man begin VIDEO FILTERS
  3371. When you configure your FFmpeg build, you can disable any of the
  3372. existing filters using @code{--disable-filters}.
  3373. The configure output will show the video filters included in your
  3374. build.
  3375. Below is a description of the currently available video filters.
  3376. @section alphaextract
  3377. Extract the alpha component from the input as a grayscale video. This
  3378. is especially useful with the @var{alphamerge} filter.
  3379. @section alphamerge
  3380. Add or replace the alpha component of the primary input with the
  3381. grayscale value of a second input. This is intended for use with
  3382. @var{alphaextract} to allow the transmission or storage of frame
  3383. sequences that have alpha in a format that doesn't support an alpha
  3384. channel.
  3385. For example, to reconstruct full frames from a normal YUV-encoded video
  3386. and a separate video created with @var{alphaextract}, you might use:
  3387. @example
  3388. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3389. @end example
  3390. Since this filter is designed for reconstruction, it operates on frame
  3391. sequences without considering timestamps, and terminates when either
  3392. input reaches end of stream. This will cause problems if your encoding
  3393. pipeline drops frames. If you're trying to apply an image as an
  3394. overlay to a video stream, consider the @var{overlay} filter instead.
  3395. @section ass
  3396. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3397. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3398. Substation Alpha) subtitles files.
  3399. This filter accepts the following option in addition to the common options from
  3400. the @ref{subtitles} filter:
  3401. @table @option
  3402. @item shaping
  3403. Set the shaping engine
  3404. Available values are:
  3405. @table @samp
  3406. @item auto
  3407. The default libass shaping engine, which is the best available.
  3408. @item simple
  3409. Fast, font-agnostic shaper that can do only substitutions
  3410. @item complex
  3411. Slower shaper using OpenType for substitutions and positioning
  3412. @end table
  3413. The default is @code{auto}.
  3414. @end table
  3415. @section atadenoise
  3416. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3417. The filter accepts the following options:
  3418. @table @option
  3419. @item 0a
  3420. Set threshold A for 1st plane. Default is 0.02.
  3421. Valid range is 0 to 0.3.
  3422. @item 0b
  3423. Set threshold B for 1st plane. Default is 0.04.
  3424. Valid range is 0 to 5.
  3425. @item 1a
  3426. Set threshold A for 2nd plane. Default is 0.02.
  3427. Valid range is 0 to 0.3.
  3428. @item 1b
  3429. Set threshold B for 2nd plane. Default is 0.04.
  3430. Valid range is 0 to 5.
  3431. @item 2a
  3432. Set threshold A for 3rd plane. Default is 0.02.
  3433. Valid range is 0 to 0.3.
  3434. @item 2b
  3435. Set threshold B for 3rd plane. Default is 0.04.
  3436. Valid range is 0 to 5.
  3437. Threshold A is designed to react on abrupt changes in the input signal and
  3438. threshold B is designed to react on continuous changes in the input signal.
  3439. @item s
  3440. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3441. number in range [5, 129].
  3442. @item p
  3443. Set what planes of frame filter will use for averaging. Default is all.
  3444. @end table
  3445. @section avgblur
  3446. Apply average blur filter.
  3447. The filter accepts the following options:
  3448. @table @option
  3449. @item sizeX
  3450. Set horizontal kernel size.
  3451. @item planes
  3452. Set which planes to filter. By default all planes are filtered.
  3453. @item sizeY
  3454. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3455. Default is @code{0}.
  3456. @end table
  3457. @section bbox
  3458. Compute the bounding box for the non-black pixels in the input frame
  3459. luminance plane.
  3460. This filter computes the bounding box containing all the pixels with a
  3461. luminance value greater than the minimum allowed value.
  3462. The parameters describing the bounding box are printed on the filter
  3463. log.
  3464. The filter accepts the following option:
  3465. @table @option
  3466. @item min_val
  3467. Set the minimal luminance value. Default is @code{16}.
  3468. @end table
  3469. @section bitplanenoise
  3470. Show and measure bit plane noise.
  3471. The filter accepts the following options:
  3472. @table @option
  3473. @item bitplane
  3474. Set which plane to analyze. Default is @code{1}.
  3475. @item filter
  3476. Filter out noisy pixels from @code{bitplane} set above.
  3477. Default is disabled.
  3478. @end table
  3479. @section blackdetect
  3480. Detect video intervals that are (almost) completely black. Can be
  3481. useful to detect chapter transitions, commercials, or invalid
  3482. recordings. Output lines contains the time for the start, end and
  3483. duration of the detected black interval expressed in seconds.
  3484. In order to display the output lines, you need to set the loglevel at
  3485. least to the AV_LOG_INFO value.
  3486. The filter accepts the following options:
  3487. @table @option
  3488. @item black_min_duration, d
  3489. Set the minimum detected black duration expressed in seconds. It must
  3490. be a non-negative floating point number.
  3491. Default value is 2.0.
  3492. @item picture_black_ratio_th, pic_th
  3493. Set the threshold for considering a picture "black".
  3494. Express the minimum value for the ratio:
  3495. @example
  3496. @var{nb_black_pixels} / @var{nb_pixels}
  3497. @end example
  3498. for which a picture is considered black.
  3499. Default value is 0.98.
  3500. @item pixel_black_th, pix_th
  3501. Set the threshold for considering a pixel "black".
  3502. The threshold expresses the maximum pixel luminance value for which a
  3503. pixel is considered "black". The provided value is scaled according to
  3504. the following equation:
  3505. @example
  3506. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3507. @end example
  3508. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3509. the input video format, the range is [0-255] for YUV full-range
  3510. formats and [16-235] for YUV non full-range formats.
  3511. Default value is 0.10.
  3512. @end table
  3513. The following example sets the maximum pixel threshold to the minimum
  3514. value, and detects only black intervals of 2 or more seconds:
  3515. @example
  3516. blackdetect=d=2:pix_th=0.00
  3517. @end example
  3518. @section blackframe
  3519. Detect frames that are (almost) completely black. Can be useful to
  3520. detect chapter transitions or commercials. Output lines consist of
  3521. the frame number of the detected frame, the percentage of blackness,
  3522. the position in the file if known or -1 and the timestamp in seconds.
  3523. In order to display the output lines, you need to set the loglevel at
  3524. least to the AV_LOG_INFO value.
  3525. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3526. The value represents the percentage of pixels in the picture that
  3527. are below the threshold value.
  3528. It accepts the following parameters:
  3529. @table @option
  3530. @item amount
  3531. The percentage of the pixels that have to be below the threshold; it defaults to
  3532. @code{98}.
  3533. @item threshold, thresh
  3534. The threshold below which a pixel value is considered black; it defaults to
  3535. @code{32}.
  3536. @end table
  3537. @section blend, tblend
  3538. Blend two video frames into each other.
  3539. The @code{blend} filter takes two input streams and outputs one
  3540. stream, the first input is the "top" layer and second input is
  3541. "bottom" layer. By default, the output terminates when the longest input terminates.
  3542. The @code{tblend} (time blend) filter takes two consecutive frames
  3543. from one single stream, and outputs the result obtained by blending
  3544. the new frame on top of the old frame.
  3545. A description of the accepted options follows.
  3546. @table @option
  3547. @item c0_mode
  3548. @item c1_mode
  3549. @item c2_mode
  3550. @item c3_mode
  3551. @item all_mode
  3552. Set blend mode for specific pixel component or all pixel components in case
  3553. of @var{all_mode}. Default value is @code{normal}.
  3554. Available values for component modes are:
  3555. @table @samp
  3556. @item addition
  3557. @item addition128
  3558. @item and
  3559. @item average
  3560. @item burn
  3561. @item darken
  3562. @item difference
  3563. @item difference128
  3564. @item divide
  3565. @item dodge
  3566. @item freeze
  3567. @item exclusion
  3568. @item glow
  3569. @item hardlight
  3570. @item hardmix
  3571. @item heat
  3572. @item lighten
  3573. @item linearlight
  3574. @item multiply
  3575. @item multiply128
  3576. @item negation
  3577. @item normal
  3578. @item or
  3579. @item overlay
  3580. @item phoenix
  3581. @item pinlight
  3582. @item reflect
  3583. @item screen
  3584. @item softlight
  3585. @item subtract
  3586. @item vividlight
  3587. @item xor
  3588. @end table
  3589. @item c0_opacity
  3590. @item c1_opacity
  3591. @item c2_opacity
  3592. @item c3_opacity
  3593. @item all_opacity
  3594. Set blend opacity for specific pixel component or all pixel components in case
  3595. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3596. @item c0_expr
  3597. @item c1_expr
  3598. @item c2_expr
  3599. @item c3_expr
  3600. @item all_expr
  3601. Set blend expression for specific pixel component or all pixel components in case
  3602. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3603. The expressions can use the following variables:
  3604. @table @option
  3605. @item N
  3606. The sequential number of the filtered frame, starting from @code{0}.
  3607. @item X
  3608. @item Y
  3609. the coordinates of the current sample
  3610. @item W
  3611. @item H
  3612. the width and height of currently filtered plane
  3613. @item SW
  3614. @item SH
  3615. Width and height scale depending on the currently filtered plane. It is the
  3616. ratio between the corresponding luma plane number of pixels and the current
  3617. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3618. @code{0.5,0.5} for chroma planes.
  3619. @item T
  3620. Time of the current frame, expressed in seconds.
  3621. @item TOP, A
  3622. Value of pixel component at current location for first video frame (top layer).
  3623. @item BOTTOM, B
  3624. Value of pixel component at current location for second video frame (bottom layer).
  3625. @end table
  3626. @item shortest
  3627. Force termination when the shortest input terminates. Default is
  3628. @code{0}. This option is only defined for the @code{blend} filter.
  3629. @item repeatlast
  3630. Continue applying the last bottom frame after the end of the stream. A value of
  3631. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3632. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3633. @end table
  3634. @subsection Examples
  3635. @itemize
  3636. @item
  3637. Apply transition from bottom layer to top layer in first 10 seconds:
  3638. @example
  3639. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3640. @end example
  3641. @item
  3642. Apply 1x1 checkerboard effect:
  3643. @example
  3644. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3645. @end example
  3646. @item
  3647. Apply uncover left effect:
  3648. @example
  3649. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3650. @end example
  3651. @item
  3652. Apply uncover down effect:
  3653. @example
  3654. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3655. @end example
  3656. @item
  3657. Apply uncover up-left effect:
  3658. @example
  3659. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3660. @end example
  3661. @item
  3662. Split diagonally video and shows top and bottom layer on each side:
  3663. @example
  3664. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3665. @end example
  3666. @item
  3667. Display differences between the current and the previous frame:
  3668. @example
  3669. tblend=all_mode=difference128
  3670. @end example
  3671. @end itemize
  3672. @section boxblur
  3673. Apply a boxblur algorithm to the input video.
  3674. It accepts the following parameters:
  3675. @table @option
  3676. @item luma_radius, lr
  3677. @item luma_power, lp
  3678. @item chroma_radius, cr
  3679. @item chroma_power, cp
  3680. @item alpha_radius, ar
  3681. @item alpha_power, ap
  3682. @end table
  3683. A description of the accepted options follows.
  3684. @table @option
  3685. @item luma_radius, lr
  3686. @item chroma_radius, cr
  3687. @item alpha_radius, ar
  3688. Set an expression for the box radius in pixels used for blurring the
  3689. corresponding input plane.
  3690. The radius value must be a non-negative number, and must not be
  3691. greater than the value of the expression @code{min(w,h)/2} for the
  3692. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3693. planes.
  3694. Default value for @option{luma_radius} is "2". If not specified,
  3695. @option{chroma_radius} and @option{alpha_radius} default to the
  3696. corresponding value set for @option{luma_radius}.
  3697. The expressions can contain the following constants:
  3698. @table @option
  3699. @item w
  3700. @item h
  3701. The input width and height in pixels.
  3702. @item cw
  3703. @item ch
  3704. The input chroma image width and height in pixels.
  3705. @item hsub
  3706. @item vsub
  3707. The horizontal and vertical chroma subsample values. For example, for the
  3708. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3709. @end table
  3710. @item luma_power, lp
  3711. @item chroma_power, cp
  3712. @item alpha_power, ap
  3713. Specify how many times the boxblur filter is applied to the
  3714. corresponding plane.
  3715. Default value for @option{luma_power} is 2. If not specified,
  3716. @option{chroma_power} and @option{alpha_power} default to the
  3717. corresponding value set for @option{luma_power}.
  3718. A value of 0 will disable the effect.
  3719. @end table
  3720. @subsection Examples
  3721. @itemize
  3722. @item
  3723. Apply a boxblur filter with the luma, chroma, and alpha radii
  3724. set to 2:
  3725. @example
  3726. boxblur=luma_radius=2:luma_power=1
  3727. boxblur=2:1
  3728. @end example
  3729. @item
  3730. Set the luma radius to 2, and alpha and chroma radius to 0:
  3731. @example
  3732. boxblur=2:1:cr=0:ar=0
  3733. @end example
  3734. @item
  3735. Set the luma and chroma radii to a fraction of the video dimension:
  3736. @example
  3737. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3738. @end example
  3739. @end itemize
  3740. @section bwdif
  3741. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3742. Deinterlacing Filter").
  3743. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3744. interpolation algorithms.
  3745. It accepts the following parameters:
  3746. @table @option
  3747. @item mode
  3748. The interlacing mode to adopt. It accepts one of the following values:
  3749. @table @option
  3750. @item 0, send_frame
  3751. Output one frame for each frame.
  3752. @item 1, send_field
  3753. Output one frame for each field.
  3754. @end table
  3755. The default value is @code{send_field}.
  3756. @item parity
  3757. The picture field parity assumed for the input interlaced video. It accepts one
  3758. of the following values:
  3759. @table @option
  3760. @item 0, tff
  3761. Assume the top field is first.
  3762. @item 1, bff
  3763. Assume the bottom field is first.
  3764. @item -1, auto
  3765. Enable automatic detection of field parity.
  3766. @end table
  3767. The default value is @code{auto}.
  3768. If the interlacing is unknown or the decoder does not export this information,
  3769. top field first will be assumed.
  3770. @item deint
  3771. Specify which frames to deinterlace. Accept one of the following
  3772. values:
  3773. @table @option
  3774. @item 0, all
  3775. Deinterlace all frames.
  3776. @item 1, interlaced
  3777. Only deinterlace frames marked as interlaced.
  3778. @end table
  3779. The default value is @code{all}.
  3780. @end table
  3781. @section chromakey
  3782. YUV colorspace color/chroma keying.
  3783. The filter accepts the following options:
  3784. @table @option
  3785. @item color
  3786. The color which will be replaced with transparency.
  3787. @item similarity
  3788. Similarity percentage with the key color.
  3789. 0.01 matches only the exact key color, while 1.0 matches everything.
  3790. @item blend
  3791. Blend percentage.
  3792. 0.0 makes pixels either fully transparent, or not transparent at all.
  3793. Higher values result in semi-transparent pixels, with a higher transparency
  3794. the more similar the pixels color is to the key color.
  3795. @item yuv
  3796. Signals that the color passed is already in YUV instead of RGB.
  3797. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3798. This can be used to pass exact YUV values as hexadecimal numbers.
  3799. @end table
  3800. @subsection Examples
  3801. @itemize
  3802. @item
  3803. Make every green pixel in the input image transparent:
  3804. @example
  3805. ffmpeg -i input.png -vf chromakey=green out.png
  3806. @end example
  3807. @item
  3808. Overlay a greenscreen-video on top of a static black background.
  3809. @example
  3810. 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
  3811. @end example
  3812. @end itemize
  3813. @section ciescope
  3814. Display CIE color diagram with pixels overlaid onto it.
  3815. The filter accepts the following options:
  3816. @table @option
  3817. @item system
  3818. Set color system.
  3819. @table @samp
  3820. @item ntsc, 470m
  3821. @item ebu, 470bg
  3822. @item smpte
  3823. @item 240m
  3824. @item apple
  3825. @item widergb
  3826. @item cie1931
  3827. @item rec709, hdtv
  3828. @item uhdtv, rec2020
  3829. @end table
  3830. @item cie
  3831. Set CIE system.
  3832. @table @samp
  3833. @item xyy
  3834. @item ucs
  3835. @item luv
  3836. @end table
  3837. @item gamuts
  3838. Set what gamuts to draw.
  3839. See @code{system} option for available values.
  3840. @item size, s
  3841. Set ciescope size, by default set to 512.
  3842. @item intensity, i
  3843. Set intensity used to map input pixel values to CIE diagram.
  3844. @item contrast
  3845. Set contrast used to draw tongue colors that are out of active color system gamut.
  3846. @item corrgamma
  3847. Correct gamma displayed on scope, by default enabled.
  3848. @item showwhite
  3849. Show white point on CIE diagram, by default disabled.
  3850. @item gamma
  3851. Set input gamma. Used only with XYZ input color space.
  3852. @end table
  3853. @section codecview
  3854. Visualize information exported by some codecs.
  3855. Some codecs can export information through frames using side-data or other
  3856. means. For example, some MPEG based codecs export motion vectors through the
  3857. @var{export_mvs} flag in the codec @option{flags2} option.
  3858. The filter accepts the following option:
  3859. @table @option
  3860. @item mv
  3861. Set motion vectors to visualize.
  3862. Available flags for @var{mv} are:
  3863. @table @samp
  3864. @item pf
  3865. forward predicted MVs of P-frames
  3866. @item bf
  3867. forward predicted MVs of B-frames
  3868. @item bb
  3869. backward predicted MVs of B-frames
  3870. @end table
  3871. @item qp
  3872. Display quantization parameters using the chroma planes.
  3873. @item mv_type, mvt
  3874. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3875. Available flags for @var{mv_type} are:
  3876. @table @samp
  3877. @item fp
  3878. forward predicted MVs
  3879. @item bp
  3880. backward predicted MVs
  3881. @end table
  3882. @item frame_type, ft
  3883. Set frame type to visualize motion vectors of.
  3884. Available flags for @var{frame_type} are:
  3885. @table @samp
  3886. @item if
  3887. intra-coded frames (I-frames)
  3888. @item pf
  3889. predicted frames (P-frames)
  3890. @item bf
  3891. bi-directionally predicted frames (B-frames)
  3892. @end table
  3893. @end table
  3894. @subsection Examples
  3895. @itemize
  3896. @item
  3897. Visualize forward predicted MVs of all frames using @command{ffplay}:
  3898. @example
  3899. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  3900. @end example
  3901. @item
  3902. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  3903. @example
  3904. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  3905. @end example
  3906. @end itemize
  3907. @section colorbalance
  3908. Modify intensity of primary colors (red, green and blue) of input frames.
  3909. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3910. regions for the red-cyan, green-magenta or blue-yellow balance.
  3911. A positive adjustment value shifts the balance towards the primary color, a negative
  3912. value towards the complementary color.
  3913. The filter accepts the following options:
  3914. @table @option
  3915. @item rs
  3916. @item gs
  3917. @item bs
  3918. Adjust red, green and blue shadows (darkest pixels).
  3919. @item rm
  3920. @item gm
  3921. @item bm
  3922. Adjust red, green and blue midtones (medium pixels).
  3923. @item rh
  3924. @item gh
  3925. @item bh
  3926. Adjust red, green and blue highlights (brightest pixels).
  3927. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3928. @end table
  3929. @subsection Examples
  3930. @itemize
  3931. @item
  3932. Add red color cast to shadows:
  3933. @example
  3934. colorbalance=rs=.3
  3935. @end example
  3936. @end itemize
  3937. @section colorkey
  3938. RGB colorspace color keying.
  3939. The filter accepts the following options:
  3940. @table @option
  3941. @item color
  3942. The color which will be replaced with transparency.
  3943. @item similarity
  3944. Similarity percentage with the key color.
  3945. 0.01 matches only the exact key color, while 1.0 matches everything.
  3946. @item blend
  3947. Blend percentage.
  3948. 0.0 makes pixels either fully transparent, or not transparent at all.
  3949. Higher values result in semi-transparent pixels, with a higher transparency
  3950. the more similar the pixels color is to the key color.
  3951. @end table
  3952. @subsection Examples
  3953. @itemize
  3954. @item
  3955. Make every green pixel in the input image transparent:
  3956. @example
  3957. ffmpeg -i input.png -vf colorkey=green out.png
  3958. @end example
  3959. @item
  3960. Overlay a greenscreen-video on top of a static background image.
  3961. @example
  3962. 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
  3963. @end example
  3964. @end itemize
  3965. @section colorlevels
  3966. Adjust video input frames using levels.
  3967. The filter accepts the following options:
  3968. @table @option
  3969. @item rimin
  3970. @item gimin
  3971. @item bimin
  3972. @item aimin
  3973. Adjust red, green, blue and alpha input black point.
  3974. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3975. @item rimax
  3976. @item gimax
  3977. @item bimax
  3978. @item aimax
  3979. Adjust red, green, blue and alpha input white point.
  3980. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3981. Input levels are used to lighten highlights (bright tones), darken shadows
  3982. (dark tones), change the balance of bright and dark tones.
  3983. @item romin
  3984. @item gomin
  3985. @item bomin
  3986. @item aomin
  3987. Adjust red, green, blue and alpha output black point.
  3988. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3989. @item romax
  3990. @item gomax
  3991. @item bomax
  3992. @item aomax
  3993. Adjust red, green, blue and alpha output white point.
  3994. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3995. Output levels allows manual selection of a constrained output level range.
  3996. @end table
  3997. @subsection Examples
  3998. @itemize
  3999. @item
  4000. Make video output darker:
  4001. @example
  4002. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4003. @end example
  4004. @item
  4005. Increase contrast:
  4006. @example
  4007. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4008. @end example
  4009. @item
  4010. Make video output lighter:
  4011. @example
  4012. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4013. @end example
  4014. @item
  4015. Increase brightness:
  4016. @example
  4017. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4018. @end example
  4019. @end itemize
  4020. @section colorchannelmixer
  4021. Adjust video input frames by re-mixing color channels.
  4022. This filter modifies a color channel by adding the values associated to
  4023. the other channels of the same pixels. For example if the value to
  4024. modify is red, the output value will be:
  4025. @example
  4026. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4027. @end example
  4028. The filter accepts the following options:
  4029. @table @option
  4030. @item rr
  4031. @item rg
  4032. @item rb
  4033. @item ra
  4034. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4035. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4036. @item gr
  4037. @item gg
  4038. @item gb
  4039. @item ga
  4040. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4041. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4042. @item br
  4043. @item bg
  4044. @item bb
  4045. @item ba
  4046. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4047. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4048. @item ar
  4049. @item ag
  4050. @item ab
  4051. @item aa
  4052. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4053. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4054. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4055. @end table
  4056. @subsection Examples
  4057. @itemize
  4058. @item
  4059. Convert source to grayscale:
  4060. @example
  4061. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4062. @end example
  4063. @item
  4064. Simulate sepia tones:
  4065. @example
  4066. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4067. @end example
  4068. @end itemize
  4069. @section colormatrix
  4070. Convert color matrix.
  4071. The filter accepts the following options:
  4072. @table @option
  4073. @item src
  4074. @item dst
  4075. Specify the source and destination color matrix. Both values must be
  4076. specified.
  4077. The accepted values are:
  4078. @table @samp
  4079. @item bt709
  4080. BT.709
  4081. @item bt601
  4082. BT.601
  4083. @item smpte240m
  4084. SMPTE-240M
  4085. @item fcc
  4086. FCC
  4087. @item bt2020
  4088. BT.2020
  4089. @end table
  4090. @end table
  4091. For example to convert from BT.601 to SMPTE-240M, use the command:
  4092. @example
  4093. colormatrix=bt601:smpte240m
  4094. @end example
  4095. @section colorspace
  4096. Convert colorspace, transfer characteristics or color primaries.
  4097. Input video needs to have an even size.
  4098. The filter accepts the following options:
  4099. @table @option
  4100. @anchor{all}
  4101. @item all
  4102. Specify all color properties at once.
  4103. The accepted values are:
  4104. @table @samp
  4105. @item bt470m
  4106. BT.470M
  4107. @item bt470bg
  4108. BT.470BG
  4109. @item bt601-6-525
  4110. BT.601-6 525
  4111. @item bt601-6-625
  4112. BT.601-6 625
  4113. @item bt709
  4114. BT.709
  4115. @item smpte170m
  4116. SMPTE-170M
  4117. @item smpte240m
  4118. SMPTE-240M
  4119. @item bt2020
  4120. BT.2020
  4121. @end table
  4122. @anchor{space}
  4123. @item space
  4124. Specify output colorspace.
  4125. The accepted values are:
  4126. @table @samp
  4127. @item bt709
  4128. BT.709
  4129. @item fcc
  4130. FCC
  4131. @item bt470bg
  4132. BT.470BG or BT.601-6 625
  4133. @item smpte170m
  4134. SMPTE-170M or BT.601-6 525
  4135. @item smpte240m
  4136. SMPTE-240M
  4137. @item ycgco
  4138. YCgCo
  4139. @item bt2020ncl
  4140. BT.2020 with non-constant luminance
  4141. @end table
  4142. @anchor{trc}
  4143. @item trc
  4144. Specify output transfer characteristics.
  4145. The accepted values are:
  4146. @table @samp
  4147. @item bt709
  4148. BT.709
  4149. @item bt470m
  4150. BT.470M
  4151. @item bt470bg
  4152. BT.470BG
  4153. @item gamma22
  4154. Constant gamma of 2.2
  4155. @item gamma28
  4156. Constant gamma of 2.8
  4157. @item smpte170m
  4158. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4159. @item smpte240m
  4160. SMPTE-240M
  4161. @item srgb
  4162. SRGB
  4163. @item iec61966-2-1
  4164. iec61966-2-1
  4165. @item iec61966-2-4
  4166. iec61966-2-4
  4167. @item xvycc
  4168. xvycc
  4169. @item bt2020-10
  4170. BT.2020 for 10-bits content
  4171. @item bt2020-12
  4172. BT.2020 for 12-bits content
  4173. @end table
  4174. @anchor{primaries}
  4175. @item primaries
  4176. Specify output color primaries.
  4177. The accepted values are:
  4178. @table @samp
  4179. @item bt709
  4180. BT.709
  4181. @item bt470m
  4182. BT.470M
  4183. @item bt470bg
  4184. BT.470BG or BT.601-6 625
  4185. @item smpte170m
  4186. SMPTE-170M or BT.601-6 525
  4187. @item smpte240m
  4188. SMPTE-240M
  4189. @item film
  4190. film
  4191. @item smpte431
  4192. SMPTE-431
  4193. @item smpte432
  4194. SMPTE-432
  4195. @item bt2020
  4196. BT.2020
  4197. @end table
  4198. @anchor{range}
  4199. @item range
  4200. Specify output color range.
  4201. The accepted values are:
  4202. @table @samp
  4203. @item tv
  4204. TV (restricted) range
  4205. @item mpeg
  4206. MPEG (restricted) range
  4207. @item pc
  4208. PC (full) range
  4209. @item jpeg
  4210. JPEG (full) range
  4211. @end table
  4212. @item format
  4213. Specify output color format.
  4214. The accepted values are:
  4215. @table @samp
  4216. @item yuv420p
  4217. YUV 4:2:0 planar 8-bits
  4218. @item yuv420p10
  4219. YUV 4:2:0 planar 10-bits
  4220. @item yuv420p12
  4221. YUV 4:2:0 planar 12-bits
  4222. @item yuv422p
  4223. YUV 4:2:2 planar 8-bits
  4224. @item yuv422p10
  4225. YUV 4:2:2 planar 10-bits
  4226. @item yuv422p12
  4227. YUV 4:2:2 planar 12-bits
  4228. @item yuv444p
  4229. YUV 4:4:4 planar 8-bits
  4230. @item yuv444p10
  4231. YUV 4:4:4 planar 10-bits
  4232. @item yuv444p12
  4233. YUV 4:4:4 planar 12-bits
  4234. @end table
  4235. @item fast
  4236. Do a fast conversion, which skips gamma/primary correction. This will take
  4237. significantly less CPU, but will be mathematically incorrect. To get output
  4238. compatible with that produced by the colormatrix filter, use fast=1.
  4239. @item dither
  4240. Specify dithering mode.
  4241. The accepted values are:
  4242. @table @samp
  4243. @item none
  4244. No dithering
  4245. @item fsb
  4246. Floyd-Steinberg dithering
  4247. @end table
  4248. @item wpadapt
  4249. Whitepoint adaptation mode.
  4250. The accepted values are:
  4251. @table @samp
  4252. @item bradford
  4253. Bradford whitepoint adaptation
  4254. @item vonkries
  4255. von Kries whitepoint adaptation
  4256. @item identity
  4257. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4258. @end table
  4259. @item iall
  4260. Override all input properties at once. Same accepted values as @ref{all}.
  4261. @item ispace
  4262. Override input colorspace. Same accepted values as @ref{space}.
  4263. @item iprimaries
  4264. Override input color primaries. Same accepted values as @ref{primaries}.
  4265. @item itrc
  4266. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4267. @item irange
  4268. Override input color range. Same accepted values as @ref{range}.
  4269. @end table
  4270. The filter converts the transfer characteristics, color space and color
  4271. primaries to the specified user values. The output value, if not specified,
  4272. is set to a default value based on the "all" property. If that property is
  4273. also not specified, the filter will log an error. The output color range and
  4274. format default to the same value as the input color range and format. The
  4275. input transfer characteristics, color space, color primaries and color range
  4276. should be set on the input data. If any of these are missing, the filter will
  4277. log an error and no conversion will take place.
  4278. For example to convert the input to SMPTE-240M, use the command:
  4279. @example
  4280. colorspace=smpte240m
  4281. @end example
  4282. @section convolution
  4283. Apply convolution 3x3 or 5x5 filter.
  4284. The filter accepts the following options:
  4285. @table @option
  4286. @item 0m
  4287. @item 1m
  4288. @item 2m
  4289. @item 3m
  4290. Set matrix for each plane.
  4291. Matrix is sequence of 9 or 25 signed integers.
  4292. @item 0rdiv
  4293. @item 1rdiv
  4294. @item 2rdiv
  4295. @item 3rdiv
  4296. Set multiplier for calculated value for each plane.
  4297. @item 0bias
  4298. @item 1bias
  4299. @item 2bias
  4300. @item 3bias
  4301. Set bias for each plane. This value is added to the result of the multiplication.
  4302. Useful for making the overall image brighter or darker. Default is 0.0.
  4303. @end table
  4304. @subsection Examples
  4305. @itemize
  4306. @item
  4307. Apply sharpen:
  4308. @example
  4309. 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"
  4310. @end example
  4311. @item
  4312. Apply blur:
  4313. @example
  4314. 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"
  4315. @end example
  4316. @item
  4317. Apply edge enhance:
  4318. @example
  4319. 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"
  4320. @end example
  4321. @item
  4322. Apply edge detect:
  4323. @example
  4324. 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"
  4325. @end example
  4326. @item
  4327. Apply emboss:
  4328. @example
  4329. 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"
  4330. @end example
  4331. @end itemize
  4332. @section copy
  4333. Copy the input source unchanged to the output. This is mainly useful for
  4334. testing purposes.
  4335. @anchor{coreimage}
  4336. @section coreimage
  4337. Video filtering on GPU using Apple's CoreImage API on OSX.
  4338. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4339. processed by video hardware. However, software-based OpenGL implementations
  4340. exist which means there is no guarantee for hardware processing. It depends on
  4341. the respective OSX.
  4342. There are many filters and image generators provided by Apple that come with a
  4343. large variety of options. The filter has to be referenced by its name along
  4344. with its options.
  4345. The coreimage filter accepts the following options:
  4346. @table @option
  4347. @item list_filters
  4348. List all available filters and generators along with all their respective
  4349. options as well as possible minimum and maximum values along with the default
  4350. values.
  4351. @example
  4352. list_filters=true
  4353. @end example
  4354. @item filter
  4355. Specify all filters by their respective name and options.
  4356. Use @var{list_filters} to determine all valid filter names and options.
  4357. Numerical options are specified by a float value and are automatically clamped
  4358. to their respective value range. Vector and color options have to be specified
  4359. by a list of space separated float values. Character escaping has to be done.
  4360. A special option name @code{default} is available to use default options for a
  4361. filter.
  4362. It is required to specify either @code{default} or at least one of the filter options.
  4363. All omitted options are used with their default values.
  4364. The syntax of the filter string is as follows:
  4365. @example
  4366. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4367. @end example
  4368. @item output_rect
  4369. Specify a rectangle where the output of the filter chain is copied into the
  4370. input image. It is given by a list of space separated float values:
  4371. @example
  4372. output_rect=x\ y\ width\ height
  4373. @end example
  4374. If not given, the output rectangle equals the dimensions of the input image.
  4375. The output rectangle is automatically cropped at the borders of the input
  4376. image. Negative values are valid for each component.
  4377. @example
  4378. output_rect=25\ 25\ 100\ 100
  4379. @end example
  4380. @end table
  4381. Several filters can be chained for successive processing without GPU-HOST
  4382. transfers allowing for fast processing of complex filter chains.
  4383. Currently, only filters with zero (generators) or exactly one (filters) input
  4384. image and one output image are supported. Also, transition filters are not yet
  4385. usable as intended.
  4386. Some filters generate output images with additional padding depending on the
  4387. respective filter kernel. The padding is automatically removed to ensure the
  4388. filter output has the same size as the input image.
  4389. For image generators, the size of the output image is determined by the
  4390. previous output image of the filter chain or the input image of the whole
  4391. filterchain, respectively. The generators do not use the pixel information of
  4392. this image to generate their output. However, the generated output is
  4393. blended onto this image, resulting in partial or complete coverage of the
  4394. output image.
  4395. The @ref{coreimagesrc} video source can be used for generating input images
  4396. which are directly fed into the filter chain. By using it, providing input
  4397. images by another video source or an input video is not required.
  4398. @subsection Examples
  4399. @itemize
  4400. @item
  4401. List all filters available:
  4402. @example
  4403. coreimage=list_filters=true
  4404. @end example
  4405. @item
  4406. Use the CIBoxBlur filter with default options to blur an image:
  4407. @example
  4408. coreimage=filter=CIBoxBlur@@default
  4409. @end example
  4410. @item
  4411. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4412. its center at 100x100 and a radius of 50 pixels:
  4413. @example
  4414. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4415. @end example
  4416. @item
  4417. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4418. given as complete and escaped command-line for Apple's standard bash shell:
  4419. @example
  4420. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4421. @end example
  4422. @end itemize
  4423. @section crop
  4424. Crop the input video to given dimensions.
  4425. It accepts the following parameters:
  4426. @table @option
  4427. @item w, out_w
  4428. The width of the output video. It defaults to @code{iw}.
  4429. This expression is evaluated only once during the filter
  4430. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4431. @item h, out_h
  4432. The height of the output video. It defaults to @code{ih}.
  4433. This expression is evaluated only once during the filter
  4434. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4435. @item x
  4436. The horizontal position, in the input video, of the left edge of the output
  4437. video. It defaults to @code{(in_w-out_w)/2}.
  4438. This expression is evaluated per-frame.
  4439. @item y
  4440. The vertical position, in the input video, of the top edge of the output video.
  4441. It defaults to @code{(in_h-out_h)/2}.
  4442. This expression is evaluated per-frame.
  4443. @item keep_aspect
  4444. If set to 1 will force the output display aspect ratio
  4445. to be the same of the input, by changing the output sample aspect
  4446. ratio. It defaults to 0.
  4447. @item exact
  4448. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4449. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4450. It defaults to 0.
  4451. @end table
  4452. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4453. expressions containing the following constants:
  4454. @table @option
  4455. @item x
  4456. @item y
  4457. The computed values for @var{x} and @var{y}. They are evaluated for
  4458. each new frame.
  4459. @item in_w
  4460. @item in_h
  4461. The input width and height.
  4462. @item iw
  4463. @item ih
  4464. These are the same as @var{in_w} and @var{in_h}.
  4465. @item out_w
  4466. @item out_h
  4467. The output (cropped) width and height.
  4468. @item ow
  4469. @item oh
  4470. These are the same as @var{out_w} and @var{out_h}.
  4471. @item a
  4472. same as @var{iw} / @var{ih}
  4473. @item sar
  4474. input sample aspect ratio
  4475. @item dar
  4476. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4477. @item hsub
  4478. @item vsub
  4479. horizontal and vertical chroma subsample values. For example for the
  4480. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4481. @item n
  4482. The number of the input frame, starting from 0.
  4483. @item pos
  4484. the position in the file of the input frame, NAN if unknown
  4485. @item t
  4486. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4487. @end table
  4488. The expression for @var{out_w} may depend on the value of @var{out_h},
  4489. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4490. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4491. evaluated after @var{out_w} and @var{out_h}.
  4492. The @var{x} and @var{y} parameters specify the expressions for the
  4493. position of the top-left corner of the output (non-cropped) area. They
  4494. are evaluated for each frame. If the evaluated value is not valid, it
  4495. is approximated to the nearest valid value.
  4496. The expression for @var{x} may depend on @var{y}, and the expression
  4497. for @var{y} may depend on @var{x}.
  4498. @subsection Examples
  4499. @itemize
  4500. @item
  4501. Crop area with size 100x100 at position (12,34).
  4502. @example
  4503. crop=100:100:12:34
  4504. @end example
  4505. Using named options, the example above becomes:
  4506. @example
  4507. crop=w=100:h=100:x=12:y=34
  4508. @end example
  4509. @item
  4510. Crop the central input area with size 100x100:
  4511. @example
  4512. crop=100:100
  4513. @end example
  4514. @item
  4515. Crop the central input area with size 2/3 of the input video:
  4516. @example
  4517. crop=2/3*in_w:2/3*in_h
  4518. @end example
  4519. @item
  4520. Crop the input video central square:
  4521. @example
  4522. crop=out_w=in_h
  4523. crop=in_h
  4524. @end example
  4525. @item
  4526. Delimit the rectangle with the top-left corner placed at position
  4527. 100:100 and the right-bottom corner corresponding to the right-bottom
  4528. corner of the input image.
  4529. @example
  4530. crop=in_w-100:in_h-100:100:100
  4531. @end example
  4532. @item
  4533. Crop 10 pixels from the left and right borders, and 20 pixels from
  4534. the top and bottom borders
  4535. @example
  4536. crop=in_w-2*10:in_h-2*20
  4537. @end example
  4538. @item
  4539. Keep only the bottom right quarter of the input image:
  4540. @example
  4541. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4542. @end example
  4543. @item
  4544. Crop height for getting Greek harmony:
  4545. @example
  4546. crop=in_w:1/PHI*in_w
  4547. @end example
  4548. @item
  4549. Apply trembling effect:
  4550. @example
  4551. 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)
  4552. @end example
  4553. @item
  4554. Apply erratic camera effect depending on timestamp:
  4555. @example
  4556. 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)"
  4557. @end example
  4558. @item
  4559. Set x depending on the value of y:
  4560. @example
  4561. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4562. @end example
  4563. @end itemize
  4564. @subsection Commands
  4565. This filter supports the following commands:
  4566. @table @option
  4567. @item w, out_w
  4568. @item h, out_h
  4569. @item x
  4570. @item y
  4571. Set width/height of the output video and the horizontal/vertical position
  4572. in the input video.
  4573. The command accepts the same syntax of the corresponding option.
  4574. If the specified expression is not valid, it is kept at its current
  4575. value.
  4576. @end table
  4577. @section cropdetect
  4578. Auto-detect the crop size.
  4579. It calculates the necessary cropping parameters and prints the
  4580. recommended parameters via the logging system. The detected dimensions
  4581. correspond to the non-black area of the input video.
  4582. It accepts the following parameters:
  4583. @table @option
  4584. @item limit
  4585. Set higher black value threshold, which can be optionally specified
  4586. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4587. value greater to the set value is considered non-black. It defaults to 24.
  4588. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4589. on the bitdepth of the pixel format.
  4590. @item round
  4591. The value which the width/height should be divisible by. It defaults to
  4592. 16. The offset is automatically adjusted to center the video. Use 2 to
  4593. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4594. encoding to most video codecs.
  4595. @item reset_count, reset
  4596. Set the counter that determines after how many frames cropdetect will
  4597. reset the previously detected largest video area and start over to
  4598. detect the current optimal crop area. Default value is 0.
  4599. This can be useful when channel logos distort the video area. 0
  4600. indicates 'never reset', and returns the largest area encountered during
  4601. playback.
  4602. @end table
  4603. @anchor{curves}
  4604. @section curves
  4605. Apply color adjustments using curves.
  4606. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4607. component (red, green and blue) has its values defined by @var{N} key points
  4608. tied from each other using a smooth curve. The x-axis represents the pixel
  4609. values from the input frame, and the y-axis the new pixel values to be set for
  4610. the output frame.
  4611. By default, a component curve is defined by the two points @var{(0;0)} and
  4612. @var{(1;1)}. This creates a straight line where each original pixel value is
  4613. "adjusted" to its own value, which means no change to the image.
  4614. The filter allows you to redefine these two points and add some more. A new
  4615. curve (using a natural cubic spline interpolation) will be define to pass
  4616. smoothly through all these new coordinates. The new defined points needs to be
  4617. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4618. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4619. the vector spaces, the values will be clipped accordingly.
  4620. The filter accepts the following options:
  4621. @table @option
  4622. @item preset
  4623. Select one of the available color presets. This option can be used in addition
  4624. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4625. options takes priority on the preset values.
  4626. Available presets are:
  4627. @table @samp
  4628. @item none
  4629. @item color_negative
  4630. @item cross_process
  4631. @item darker
  4632. @item increase_contrast
  4633. @item lighter
  4634. @item linear_contrast
  4635. @item medium_contrast
  4636. @item negative
  4637. @item strong_contrast
  4638. @item vintage
  4639. @end table
  4640. Default is @code{none}.
  4641. @item master, m
  4642. Set the master key points. These points will define a second pass mapping. It
  4643. is sometimes called a "luminance" or "value" mapping. It can be used with
  4644. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4645. post-processing LUT.
  4646. @item red, r
  4647. Set the key points for the red component.
  4648. @item green, g
  4649. Set the key points for the green component.
  4650. @item blue, b
  4651. Set the key points for the blue component.
  4652. @item all
  4653. Set the key points for all components (not including master).
  4654. Can be used in addition to the other key points component
  4655. options. In this case, the unset component(s) will fallback on this
  4656. @option{all} setting.
  4657. @item psfile
  4658. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4659. @item plot
  4660. Save Gnuplot script of the curves in specified file.
  4661. @end table
  4662. To avoid some filtergraph syntax conflicts, each key points list need to be
  4663. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4664. @subsection Examples
  4665. @itemize
  4666. @item
  4667. Increase slightly the middle level of blue:
  4668. @example
  4669. curves=blue='0/0 0.5/0.58 1/1'
  4670. @end example
  4671. @item
  4672. Vintage effect:
  4673. @example
  4674. 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'
  4675. @end example
  4676. Here we obtain the following coordinates for each components:
  4677. @table @var
  4678. @item red
  4679. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4680. @item green
  4681. @code{(0;0) (0.50;0.48) (1;1)}
  4682. @item blue
  4683. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4684. @end table
  4685. @item
  4686. The previous example can also be achieved with the associated built-in preset:
  4687. @example
  4688. curves=preset=vintage
  4689. @end example
  4690. @item
  4691. Or simply:
  4692. @example
  4693. curves=vintage
  4694. @end example
  4695. @item
  4696. Use a Photoshop preset and redefine the points of the green component:
  4697. @example
  4698. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4699. @end example
  4700. @item
  4701. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4702. and @command{gnuplot}:
  4703. @example
  4704. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4705. gnuplot -p /tmp/curves.plt
  4706. @end example
  4707. @end itemize
  4708. @section datascope
  4709. Video data analysis filter.
  4710. This filter shows hexadecimal pixel values of part of video.
  4711. The filter accepts the following options:
  4712. @table @option
  4713. @item size, s
  4714. Set output video size.
  4715. @item x
  4716. Set x offset from where to pick pixels.
  4717. @item y
  4718. Set y offset from where to pick pixels.
  4719. @item mode
  4720. Set scope mode, can be one of the following:
  4721. @table @samp
  4722. @item mono
  4723. Draw hexadecimal pixel values with white color on black background.
  4724. @item color
  4725. Draw hexadecimal pixel values with input video pixel color on black
  4726. background.
  4727. @item color2
  4728. Draw hexadecimal pixel values on color background picked from input video,
  4729. the text color is picked in such way so its always visible.
  4730. @end table
  4731. @item axis
  4732. Draw rows and columns numbers on left and top of video.
  4733. @item opacity
  4734. Set background opacity.
  4735. @end table
  4736. @section dctdnoiz
  4737. Denoise frames using 2D DCT (frequency domain filtering).
  4738. This filter is not designed for real time.
  4739. The filter accepts the following options:
  4740. @table @option
  4741. @item sigma, s
  4742. Set the noise sigma constant.
  4743. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4744. coefficient (absolute value) below this threshold with be dropped.
  4745. If you need a more advanced filtering, see @option{expr}.
  4746. Default is @code{0}.
  4747. @item overlap
  4748. Set number overlapping pixels for each block. Since the filter can be slow, you
  4749. may want to reduce this value, at the cost of a less effective filter and the
  4750. risk of various artefacts.
  4751. If the overlapping value doesn't permit processing the whole input width or
  4752. height, a warning will be displayed and according borders won't be denoised.
  4753. Default value is @var{blocksize}-1, which is the best possible setting.
  4754. @item expr, e
  4755. Set the coefficient factor expression.
  4756. For each coefficient of a DCT block, this expression will be evaluated as a
  4757. multiplier value for the coefficient.
  4758. If this is option is set, the @option{sigma} option will be ignored.
  4759. The absolute value of the coefficient can be accessed through the @var{c}
  4760. variable.
  4761. @item n
  4762. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4763. @var{blocksize}, which is the width and height of the processed blocks.
  4764. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4765. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4766. on the speed processing. Also, a larger block size does not necessarily means a
  4767. better de-noising.
  4768. @end table
  4769. @subsection Examples
  4770. Apply a denoise with a @option{sigma} of @code{4.5}:
  4771. @example
  4772. dctdnoiz=4.5
  4773. @end example
  4774. The same operation can be achieved using the expression system:
  4775. @example
  4776. dctdnoiz=e='gte(c, 4.5*3)'
  4777. @end example
  4778. Violent denoise using a block size of @code{16x16}:
  4779. @example
  4780. dctdnoiz=15:n=4
  4781. @end example
  4782. @section deband
  4783. Remove banding artifacts from input video.
  4784. It works by replacing banded pixels with average value of referenced pixels.
  4785. The filter accepts the following options:
  4786. @table @option
  4787. @item 1thr
  4788. @item 2thr
  4789. @item 3thr
  4790. @item 4thr
  4791. Set banding detection threshold for each plane. Default is 0.02.
  4792. Valid range is 0.00003 to 0.5.
  4793. If difference between current pixel and reference pixel is less than threshold,
  4794. it will be considered as banded.
  4795. @item range, r
  4796. Banding detection range in pixels. Default is 16. If positive, random number
  4797. in range 0 to set value will be used. If negative, exact absolute value
  4798. will be used.
  4799. The range defines square of four pixels around current pixel.
  4800. @item direction, d
  4801. Set direction in radians from which four pixel will be compared. If positive,
  4802. random direction from 0 to set direction will be picked. If negative, exact of
  4803. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4804. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4805. column.
  4806. @item blur, b
  4807. If enabled, current pixel is compared with average value of all four
  4808. surrounding pixels. The default is enabled. If disabled current pixel is
  4809. compared with all four surrounding pixels. The pixel is considered banded
  4810. if only all four differences with surrounding pixels are less than threshold.
  4811. @item coupling, c
  4812. If enabled, current pixel is changed if and only if all pixel components are banded,
  4813. e.g. banding detection threshold is triggered for all color components.
  4814. The default is disabled.
  4815. @end table
  4816. @anchor{decimate}
  4817. @section decimate
  4818. Drop duplicated frames at regular intervals.
  4819. The filter accepts the following options:
  4820. @table @option
  4821. @item cycle
  4822. Set the number of frames from which one will be dropped. Setting this to
  4823. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4824. Default is @code{5}.
  4825. @item dupthresh
  4826. Set the threshold for duplicate detection. If the difference metric for a frame
  4827. is less than or equal to this value, then it is declared as duplicate. Default
  4828. is @code{1.1}
  4829. @item scthresh
  4830. Set scene change threshold. Default is @code{15}.
  4831. @item blockx
  4832. @item blocky
  4833. Set the size of the x and y-axis blocks used during metric calculations.
  4834. Larger blocks give better noise suppression, but also give worse detection of
  4835. small movements. Must be a power of two. Default is @code{32}.
  4836. @item ppsrc
  4837. Mark main input as a pre-processed input and activate clean source input
  4838. stream. This allows the input to be pre-processed with various filters to help
  4839. the metrics calculation while keeping the frame selection lossless. When set to
  4840. @code{1}, the first stream is for the pre-processed input, and the second
  4841. stream is the clean source from where the kept frames are chosen. Default is
  4842. @code{0}.
  4843. @item chroma
  4844. Set whether or not chroma is considered in the metric calculations. Default is
  4845. @code{1}.
  4846. @end table
  4847. @section deflate
  4848. Apply deflate effect to the video.
  4849. This filter replaces the pixel by the local(3x3) average by taking into account
  4850. only values lower than the pixel.
  4851. It accepts the following options:
  4852. @table @option
  4853. @item threshold0
  4854. @item threshold1
  4855. @item threshold2
  4856. @item threshold3
  4857. Limit the maximum change for each plane, default is 65535.
  4858. If 0, plane will remain unchanged.
  4859. @end table
  4860. @section dejudder
  4861. Remove judder produced by partially interlaced telecined content.
  4862. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4863. source was partially telecined content then the output of @code{pullup,dejudder}
  4864. will have a variable frame rate. May change the recorded frame rate of the
  4865. container. Aside from that change, this filter will not affect constant frame
  4866. rate video.
  4867. The option available in this filter is:
  4868. @table @option
  4869. @item cycle
  4870. Specify the length of the window over which the judder repeats.
  4871. Accepts any integer greater than 1. Useful values are:
  4872. @table @samp
  4873. @item 4
  4874. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4875. @item 5
  4876. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4877. @item 20
  4878. If a mixture of the two.
  4879. @end table
  4880. The default is @samp{4}.
  4881. @end table
  4882. @section delogo
  4883. Suppress a TV station logo by a simple interpolation of the surrounding
  4884. pixels. Just set a rectangle covering the logo and watch it disappear
  4885. (and sometimes something even uglier appear - your mileage may vary).
  4886. It accepts the following parameters:
  4887. @table @option
  4888. @item x
  4889. @item y
  4890. Specify the top left corner coordinates of the logo. They must be
  4891. specified.
  4892. @item w
  4893. @item h
  4894. Specify the width and height of the logo to clear. They must be
  4895. specified.
  4896. @item band, t
  4897. Specify the thickness of the fuzzy edge of the rectangle (added to
  4898. @var{w} and @var{h}). The default value is 1. This option is
  4899. deprecated, setting higher values should no longer be necessary and
  4900. is not recommended.
  4901. @item show
  4902. When set to 1, a green rectangle is drawn on the screen to simplify
  4903. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4904. The default value is 0.
  4905. The rectangle is drawn on the outermost pixels which will be (partly)
  4906. replaced with interpolated values. The values of the next pixels
  4907. immediately outside this rectangle in each direction will be used to
  4908. compute the interpolated pixel values inside the rectangle.
  4909. @end table
  4910. @subsection Examples
  4911. @itemize
  4912. @item
  4913. Set a rectangle covering the area with top left corner coordinates 0,0
  4914. and size 100x77, and a band of size 10:
  4915. @example
  4916. delogo=x=0:y=0:w=100:h=77:band=10
  4917. @end example
  4918. @end itemize
  4919. @section deshake
  4920. Attempt to fix small changes in horizontal and/or vertical shift. This
  4921. filter helps remove camera shake from hand-holding a camera, bumping a
  4922. tripod, moving on a vehicle, etc.
  4923. The filter accepts the following options:
  4924. @table @option
  4925. @item x
  4926. @item y
  4927. @item w
  4928. @item h
  4929. Specify a rectangular area where to limit the search for motion
  4930. vectors.
  4931. If desired the search for motion vectors can be limited to a
  4932. rectangular area of the frame defined by its top left corner, width
  4933. and height. These parameters have the same meaning as the drawbox
  4934. filter which can be used to visualise the position of the bounding
  4935. box.
  4936. This is useful when simultaneous movement of subjects within the frame
  4937. might be confused for camera motion by the motion vector search.
  4938. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4939. then the full frame is used. This allows later options to be set
  4940. without specifying the bounding box for the motion vector search.
  4941. Default - search the whole frame.
  4942. @item rx
  4943. @item ry
  4944. Specify the maximum extent of movement in x and y directions in the
  4945. range 0-64 pixels. Default 16.
  4946. @item edge
  4947. Specify how to generate pixels to fill blanks at the edge of the
  4948. frame. Available values are:
  4949. @table @samp
  4950. @item blank, 0
  4951. Fill zeroes at blank locations
  4952. @item original, 1
  4953. Original image at blank locations
  4954. @item clamp, 2
  4955. Extruded edge value at blank locations
  4956. @item mirror, 3
  4957. Mirrored edge at blank locations
  4958. @end table
  4959. Default value is @samp{mirror}.
  4960. @item blocksize
  4961. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4962. default 8.
  4963. @item contrast
  4964. Specify the contrast threshold for blocks. Only blocks with more than
  4965. the specified contrast (difference between darkest and lightest
  4966. pixels) will be considered. Range 1-255, default 125.
  4967. @item search
  4968. Specify the search strategy. Available values are:
  4969. @table @samp
  4970. @item exhaustive, 0
  4971. Set exhaustive search
  4972. @item less, 1
  4973. Set less exhaustive search.
  4974. @end table
  4975. Default value is @samp{exhaustive}.
  4976. @item filename
  4977. If set then a detailed log of the motion search is written to the
  4978. specified file.
  4979. @item opencl
  4980. If set to 1, specify using OpenCL capabilities, only available if
  4981. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4982. @end table
  4983. @section detelecine
  4984. Apply an exact inverse of the telecine operation. It requires a predefined
  4985. pattern specified using the pattern option which must be the same as that passed
  4986. to the telecine filter.
  4987. This filter accepts the following options:
  4988. @table @option
  4989. @item first_field
  4990. @table @samp
  4991. @item top, t
  4992. top field first
  4993. @item bottom, b
  4994. bottom field first
  4995. The default value is @code{top}.
  4996. @end table
  4997. @item pattern
  4998. A string of numbers representing the pulldown pattern you wish to apply.
  4999. The default value is @code{23}.
  5000. @item start_frame
  5001. A number representing position of the first frame with respect to the telecine
  5002. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5003. @end table
  5004. @section dilation
  5005. Apply dilation effect to the video.
  5006. This filter replaces the pixel by the local(3x3) maximum.
  5007. It accepts the following options:
  5008. @table @option
  5009. @item threshold0
  5010. @item threshold1
  5011. @item threshold2
  5012. @item threshold3
  5013. Limit the maximum change for each plane, default is 65535.
  5014. If 0, plane will remain unchanged.
  5015. @item coordinates
  5016. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5017. pixels are used.
  5018. Flags to local 3x3 coordinates maps like this:
  5019. 1 2 3
  5020. 4 5
  5021. 6 7 8
  5022. @end table
  5023. @section displace
  5024. Displace pixels as indicated by second and third input stream.
  5025. It takes three input streams and outputs one stream, the first input is the
  5026. source, and second and third input are displacement maps.
  5027. The second input specifies how much to displace pixels along the
  5028. x-axis, while the third input specifies how much to displace pixels
  5029. along the y-axis.
  5030. If one of displacement map streams terminates, last frame from that
  5031. displacement map will be used.
  5032. Note that once generated, displacements maps can be reused over and over again.
  5033. A description of the accepted options follows.
  5034. @table @option
  5035. @item edge
  5036. Set displace behavior for pixels that are out of range.
  5037. Available values are:
  5038. @table @samp
  5039. @item blank
  5040. Missing pixels are replaced by black pixels.
  5041. @item smear
  5042. Adjacent pixels will spread out to replace missing pixels.
  5043. @item wrap
  5044. Out of range pixels are wrapped so they point to pixels of other side.
  5045. @end table
  5046. Default is @samp{smear}.
  5047. @end table
  5048. @subsection Examples
  5049. @itemize
  5050. @item
  5051. Add ripple effect to rgb input of video size hd720:
  5052. @example
  5053. 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
  5054. @end example
  5055. @item
  5056. Add wave effect to rgb input of video size hd720:
  5057. @example
  5058. 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
  5059. @end example
  5060. @end itemize
  5061. @section drawbox
  5062. Draw a colored box on the input image.
  5063. It accepts the following parameters:
  5064. @table @option
  5065. @item x
  5066. @item y
  5067. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5068. @item width, w
  5069. @item height, h
  5070. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5071. the input width and height. It defaults to 0.
  5072. @item color, c
  5073. Specify the color of the box to write. For the general syntax of this option,
  5074. check the "Color" section in the ffmpeg-utils manual. If the special
  5075. value @code{invert} is used, the box edge color is the same as the
  5076. video with inverted luma.
  5077. @item thickness, t
  5078. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5079. See below for the list of accepted constants.
  5080. @end table
  5081. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5082. following constants:
  5083. @table @option
  5084. @item dar
  5085. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5086. @item hsub
  5087. @item vsub
  5088. horizontal and vertical chroma subsample values. For example for the
  5089. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5090. @item in_h, ih
  5091. @item in_w, iw
  5092. The input width and height.
  5093. @item sar
  5094. The input sample aspect ratio.
  5095. @item x
  5096. @item y
  5097. The x and y offset coordinates where the box is drawn.
  5098. @item w
  5099. @item h
  5100. The width and height of the drawn box.
  5101. @item t
  5102. The thickness of the drawn box.
  5103. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5104. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5105. @end table
  5106. @subsection Examples
  5107. @itemize
  5108. @item
  5109. Draw a black box around the edge of the input image:
  5110. @example
  5111. drawbox
  5112. @end example
  5113. @item
  5114. Draw a box with color red and an opacity of 50%:
  5115. @example
  5116. drawbox=10:20:200:60:red@@0.5
  5117. @end example
  5118. The previous example can be specified as:
  5119. @example
  5120. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5121. @end example
  5122. @item
  5123. Fill the box with pink color:
  5124. @example
  5125. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5126. @end example
  5127. @item
  5128. Draw a 2-pixel red 2.40:1 mask:
  5129. @example
  5130. 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
  5131. @end example
  5132. @end itemize
  5133. @section drawgrid
  5134. Draw a grid on the input image.
  5135. It accepts the following parameters:
  5136. @table @option
  5137. @item x
  5138. @item y
  5139. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5140. @item width, w
  5141. @item height, h
  5142. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5143. input width and height, respectively, minus @code{thickness}, so image gets
  5144. framed. Default to 0.
  5145. @item color, c
  5146. Specify the color of the grid. For the general syntax of this option,
  5147. check the "Color" section in the ffmpeg-utils manual. If the special
  5148. value @code{invert} is used, the grid color is the same as the
  5149. video with inverted luma.
  5150. @item thickness, t
  5151. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5152. See below for the list of accepted constants.
  5153. @end table
  5154. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5155. following constants:
  5156. @table @option
  5157. @item dar
  5158. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5159. @item hsub
  5160. @item vsub
  5161. horizontal and vertical chroma subsample values. For example for the
  5162. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5163. @item in_h, ih
  5164. @item in_w, iw
  5165. The input grid cell width and height.
  5166. @item sar
  5167. The input sample aspect ratio.
  5168. @item x
  5169. @item y
  5170. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5171. @item w
  5172. @item h
  5173. The width and height of the drawn cell.
  5174. @item t
  5175. The thickness of the drawn cell.
  5176. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5177. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5178. @end table
  5179. @subsection Examples
  5180. @itemize
  5181. @item
  5182. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5183. @example
  5184. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5185. @end example
  5186. @item
  5187. Draw a white 3x3 grid with an opacity of 50%:
  5188. @example
  5189. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5190. @end example
  5191. @end itemize
  5192. @anchor{drawtext}
  5193. @section drawtext
  5194. Draw a text string or text from a specified file on top of a video, using the
  5195. libfreetype library.
  5196. To enable compilation of this filter, you need to configure FFmpeg with
  5197. @code{--enable-libfreetype}.
  5198. To enable default font fallback and the @var{font} option you need to
  5199. configure FFmpeg with @code{--enable-libfontconfig}.
  5200. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5201. @code{--enable-libfribidi}.
  5202. @subsection Syntax
  5203. It accepts the following parameters:
  5204. @table @option
  5205. @item box
  5206. Used to draw a box around text using the background color.
  5207. The value must be either 1 (enable) or 0 (disable).
  5208. The default value of @var{box} is 0.
  5209. @item boxborderw
  5210. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5211. The default value of @var{boxborderw} is 0.
  5212. @item boxcolor
  5213. The color to be used for drawing box around text. For the syntax of this
  5214. option, check the "Color" section in the ffmpeg-utils manual.
  5215. The default value of @var{boxcolor} is "white".
  5216. @item borderw
  5217. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5218. The default value of @var{borderw} is 0.
  5219. @item bordercolor
  5220. Set the color to be used for drawing border around text. For the syntax of this
  5221. option, check the "Color" section in the ffmpeg-utils manual.
  5222. The default value of @var{bordercolor} is "black".
  5223. @item expansion
  5224. Select how the @var{text} is expanded. Can be either @code{none},
  5225. @code{strftime} (deprecated) or
  5226. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5227. below for details.
  5228. @item fix_bounds
  5229. If true, check and fix text coords to avoid clipping.
  5230. @item fontcolor
  5231. The color to be used for drawing fonts. For the syntax of this option, check
  5232. the "Color" section in the ffmpeg-utils manual.
  5233. The default value of @var{fontcolor} is "black".
  5234. @item fontcolor_expr
  5235. String which is expanded the same way as @var{text} to obtain dynamic
  5236. @var{fontcolor} value. By default this option has empty value and is not
  5237. processed. When this option is set, it overrides @var{fontcolor} option.
  5238. @item font
  5239. The font family to be used for drawing text. By default Sans.
  5240. @item fontfile
  5241. The font file to be used for drawing text. The path must be included.
  5242. This parameter is mandatory if the fontconfig support is disabled.
  5243. @item draw
  5244. This option does not exist, please see the timeline system
  5245. @item alpha
  5246. Draw the text applying alpha blending. The value can
  5247. be a number between 0.0 and 1.0.
  5248. The expression accepts the same variables @var{x, y} as well.
  5249. The default value is 1.
  5250. Please see @var{fontcolor_expr}.
  5251. @item fontsize
  5252. The font size to be used for drawing text.
  5253. The default value of @var{fontsize} is 16.
  5254. @item text_shaping
  5255. If set to 1, attempt to shape the text (for example, reverse the order of
  5256. right-to-left text and join Arabic characters) before drawing it.
  5257. Otherwise, just draw the text exactly as given.
  5258. By default 1 (if supported).
  5259. @item ft_load_flags
  5260. The flags to be used for loading the fonts.
  5261. The flags map the corresponding flags supported by libfreetype, and are
  5262. a combination of the following values:
  5263. @table @var
  5264. @item default
  5265. @item no_scale
  5266. @item no_hinting
  5267. @item render
  5268. @item no_bitmap
  5269. @item vertical_layout
  5270. @item force_autohint
  5271. @item crop_bitmap
  5272. @item pedantic
  5273. @item ignore_global_advance_width
  5274. @item no_recurse
  5275. @item ignore_transform
  5276. @item monochrome
  5277. @item linear_design
  5278. @item no_autohint
  5279. @end table
  5280. Default value is "default".
  5281. For more information consult the documentation for the FT_LOAD_*
  5282. libfreetype flags.
  5283. @item shadowcolor
  5284. The color to be used for drawing a shadow behind the drawn text. For the
  5285. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5286. The default value of @var{shadowcolor} is "black".
  5287. @item shadowx
  5288. @item shadowy
  5289. The x and y offsets for the text shadow position with respect to the
  5290. position of the text. They can be either positive or negative
  5291. values. The default value for both is "0".
  5292. @item start_number
  5293. The starting frame number for the n/frame_num variable. The default value
  5294. is "0".
  5295. @item tabsize
  5296. The size in number of spaces to use for rendering the tab.
  5297. Default value is 4.
  5298. @item timecode
  5299. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5300. format. It can be used with or without text parameter. @var{timecode_rate}
  5301. option must be specified.
  5302. @item timecode_rate, rate, r
  5303. Set the timecode frame rate (timecode only).
  5304. @item text
  5305. The text string to be drawn. The text must be a sequence of UTF-8
  5306. encoded characters.
  5307. This parameter is mandatory if no file is specified with the parameter
  5308. @var{textfile}.
  5309. @item textfile
  5310. A text file containing text to be drawn. The text must be a sequence
  5311. of UTF-8 encoded characters.
  5312. This parameter is mandatory if no text string is specified with the
  5313. parameter @var{text}.
  5314. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5315. @item reload
  5316. If set to 1, the @var{textfile} will be reloaded before each frame.
  5317. Be sure to update it atomically, or it may be read partially, or even fail.
  5318. @item x
  5319. @item y
  5320. The expressions which specify the offsets where text will be drawn
  5321. within the video frame. They are relative to the top/left border of the
  5322. output image.
  5323. The default value of @var{x} and @var{y} is "0".
  5324. See below for the list of accepted constants and functions.
  5325. @end table
  5326. The parameters for @var{x} and @var{y} are expressions containing the
  5327. following constants and functions:
  5328. @table @option
  5329. @item dar
  5330. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5331. @item hsub
  5332. @item vsub
  5333. horizontal and vertical chroma subsample values. For example for the
  5334. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5335. @item line_h, lh
  5336. the height of each text line
  5337. @item main_h, h, H
  5338. the input height
  5339. @item main_w, w, W
  5340. the input width
  5341. @item max_glyph_a, ascent
  5342. the maximum distance from the baseline to the highest/upper grid
  5343. coordinate used to place a glyph outline point, for all the rendered
  5344. glyphs.
  5345. It is a positive value, due to the grid's orientation with the Y axis
  5346. upwards.
  5347. @item max_glyph_d, descent
  5348. the maximum distance from the baseline to the lowest grid coordinate
  5349. used to place a glyph outline point, for all the rendered glyphs.
  5350. This is a negative value, due to the grid's orientation, with the Y axis
  5351. upwards.
  5352. @item max_glyph_h
  5353. maximum glyph height, that is the maximum height for all the glyphs
  5354. contained in the rendered text, it is equivalent to @var{ascent} -
  5355. @var{descent}.
  5356. @item max_glyph_w
  5357. maximum glyph width, that is the maximum width for all the glyphs
  5358. contained in the rendered text
  5359. @item n
  5360. the number of input frame, starting from 0
  5361. @item rand(min, max)
  5362. return a random number included between @var{min} and @var{max}
  5363. @item sar
  5364. The input sample aspect ratio.
  5365. @item t
  5366. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5367. @item text_h, th
  5368. the height of the rendered text
  5369. @item text_w, tw
  5370. the width of the rendered text
  5371. @item x
  5372. @item y
  5373. the x and y offset coordinates where the text is drawn.
  5374. These parameters allow the @var{x} and @var{y} expressions to refer
  5375. each other, so you can for example specify @code{y=x/dar}.
  5376. @end table
  5377. @anchor{drawtext_expansion}
  5378. @subsection Text expansion
  5379. If @option{expansion} is set to @code{strftime},
  5380. the filter recognizes strftime() sequences in the provided text and
  5381. expands them accordingly. Check the documentation of strftime(). This
  5382. feature is deprecated.
  5383. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5384. If @option{expansion} is set to @code{normal} (which is the default),
  5385. the following expansion mechanism is used.
  5386. The backslash character @samp{\}, followed by any character, always expands to
  5387. the second character.
  5388. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5389. braces is a function name, possibly followed by arguments separated by ':'.
  5390. If the arguments contain special characters or delimiters (':' or '@}'),
  5391. they should be escaped.
  5392. Note that they probably must also be escaped as the value for the
  5393. @option{text} option in the filter argument string and as the filter
  5394. argument in the filtergraph description, and possibly also for the shell,
  5395. that makes up to four levels of escaping; using a text file avoids these
  5396. problems.
  5397. The following functions are available:
  5398. @table @command
  5399. @item expr, e
  5400. The expression evaluation result.
  5401. It must take one argument specifying the expression to be evaluated,
  5402. which accepts the same constants and functions as the @var{x} and
  5403. @var{y} values. Note that not all constants should be used, for
  5404. example the text size is not known when evaluating the expression, so
  5405. the constants @var{text_w} and @var{text_h} will have an undefined
  5406. value.
  5407. @item expr_int_format, eif
  5408. Evaluate the expression's value and output as formatted integer.
  5409. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5410. The second argument specifies the output format. Allowed values are @samp{x},
  5411. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5412. @code{printf} function.
  5413. The third parameter is optional and sets the number of positions taken by the output.
  5414. It can be used to add padding with zeros from the left.
  5415. @item gmtime
  5416. The time at which the filter is running, expressed in UTC.
  5417. It can accept an argument: a strftime() format string.
  5418. @item localtime
  5419. The time at which the filter is running, expressed in the local time zone.
  5420. It can accept an argument: a strftime() format string.
  5421. @item metadata
  5422. Frame metadata. Takes one or two arguments.
  5423. The first argument is mandatory and specifies the metadata key.
  5424. The second argument is optional and specifies a default value, used when the
  5425. metadata key is not found or empty.
  5426. @item n, frame_num
  5427. The frame number, starting from 0.
  5428. @item pict_type
  5429. A 1 character description of the current picture type.
  5430. @item pts
  5431. The timestamp of the current frame.
  5432. It can take up to three arguments.
  5433. The first argument is the format of the timestamp; it defaults to @code{flt}
  5434. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5435. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5436. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5437. @code{localtime} stands for the timestamp of the frame formatted as
  5438. local time zone time.
  5439. The second argument is an offset added to the timestamp.
  5440. If the format is set to @code{localtime} or @code{gmtime},
  5441. a third argument may be supplied: a strftime() format string.
  5442. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5443. @end table
  5444. @subsection Examples
  5445. @itemize
  5446. @item
  5447. Draw "Test Text" with font FreeSerif, using the default values for the
  5448. optional parameters.
  5449. @example
  5450. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5451. @end example
  5452. @item
  5453. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5454. and y=50 (counting from the top-left corner of the screen), text is
  5455. yellow with a red box around it. Both the text and the box have an
  5456. opacity of 20%.
  5457. @example
  5458. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5459. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5460. @end example
  5461. Note that the double quotes are not necessary if spaces are not used
  5462. within the parameter list.
  5463. @item
  5464. Show the text at the center of the video frame:
  5465. @example
  5466. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5467. @end example
  5468. @item
  5469. Show the text at a random position, switching to a new position every 30 seconds:
  5470. @example
  5471. 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)"
  5472. @end example
  5473. @item
  5474. Show a text line sliding from right to left in the last row of the video
  5475. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5476. with no newlines.
  5477. @example
  5478. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5479. @end example
  5480. @item
  5481. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5482. @example
  5483. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5484. @end example
  5485. @item
  5486. Draw a single green letter "g", at the center of the input video.
  5487. The glyph baseline is placed at half screen height.
  5488. @example
  5489. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5490. @end example
  5491. @item
  5492. Show text for 1 second every 3 seconds:
  5493. @example
  5494. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5495. @end example
  5496. @item
  5497. Use fontconfig to set the font. Note that the colons need to be escaped.
  5498. @example
  5499. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5500. @end example
  5501. @item
  5502. Print the date of a real-time encoding (see strftime(3)):
  5503. @example
  5504. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5505. @end example
  5506. @item
  5507. Show text fading in and out (appearing/disappearing):
  5508. @example
  5509. #!/bin/sh
  5510. DS=1.0 # display start
  5511. DE=10.0 # display end
  5512. FID=1.5 # fade in duration
  5513. FOD=5 # fade out duration
  5514. 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 @}"
  5515. @end example
  5516. @item
  5517. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5518. and the @option{fontsize} value are included in the @option{y} offset.
  5519. @example
  5520. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5521. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5522. @end example
  5523. @end itemize
  5524. For more information about libfreetype, check:
  5525. @url{http://www.freetype.org/}.
  5526. For more information about fontconfig, check:
  5527. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5528. For more information about libfribidi, check:
  5529. @url{http://fribidi.org/}.
  5530. @section edgedetect
  5531. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5532. The filter accepts the following options:
  5533. @table @option
  5534. @item low
  5535. @item high
  5536. Set low and high threshold values used by the Canny thresholding
  5537. algorithm.
  5538. The high threshold selects the "strong" edge pixels, which are then
  5539. connected through 8-connectivity with the "weak" edge pixels selected
  5540. by the low threshold.
  5541. @var{low} and @var{high} threshold values must be chosen in the range
  5542. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5543. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5544. is @code{50/255}.
  5545. @item mode
  5546. Define the drawing mode.
  5547. @table @samp
  5548. @item wires
  5549. Draw white/gray wires on black background.
  5550. @item colormix
  5551. Mix the colors to create a paint/cartoon effect.
  5552. @end table
  5553. Default value is @var{wires}.
  5554. @end table
  5555. @subsection Examples
  5556. @itemize
  5557. @item
  5558. Standard edge detection with custom values for the hysteresis thresholding:
  5559. @example
  5560. edgedetect=low=0.1:high=0.4
  5561. @end example
  5562. @item
  5563. Painting effect without thresholding:
  5564. @example
  5565. edgedetect=mode=colormix:high=0
  5566. @end example
  5567. @end itemize
  5568. @section eq
  5569. Set brightness, contrast, saturation and approximate gamma adjustment.
  5570. The filter accepts the following options:
  5571. @table @option
  5572. @item contrast
  5573. Set the contrast expression. The value must be a float value in range
  5574. @code{-2.0} to @code{2.0}. The default value is "1".
  5575. @item brightness
  5576. Set the brightness expression. The value must be a float value in
  5577. range @code{-1.0} to @code{1.0}. The default value is "0".
  5578. @item saturation
  5579. Set the saturation expression. The value must be a float in
  5580. range @code{0.0} to @code{3.0}. The default value is "1".
  5581. @item gamma
  5582. Set the gamma expression. The value must be a float in range
  5583. @code{0.1} to @code{10.0}. The default value is "1".
  5584. @item gamma_r
  5585. Set the gamma expression for red. The value must be a float in
  5586. range @code{0.1} to @code{10.0}. The default value is "1".
  5587. @item gamma_g
  5588. Set the gamma expression for green. The value must be a float in range
  5589. @code{0.1} to @code{10.0}. The default value is "1".
  5590. @item gamma_b
  5591. Set the gamma expression for blue. The value must be a float in range
  5592. @code{0.1} to @code{10.0}. The default value is "1".
  5593. @item gamma_weight
  5594. Set the gamma weight expression. It can be used to reduce the effect
  5595. of a high gamma value on bright image areas, e.g. keep them from
  5596. getting overamplified and just plain white. The value must be a float
  5597. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5598. gamma correction all the way down while @code{1.0} leaves it at its
  5599. full strength. Default is "1".
  5600. @item eval
  5601. Set when the expressions for brightness, contrast, saturation and
  5602. gamma expressions are evaluated.
  5603. It accepts the following values:
  5604. @table @samp
  5605. @item init
  5606. only evaluate expressions once during the filter initialization or
  5607. when a command is processed
  5608. @item frame
  5609. evaluate expressions for each incoming frame
  5610. @end table
  5611. Default value is @samp{init}.
  5612. @end table
  5613. The expressions accept the following parameters:
  5614. @table @option
  5615. @item n
  5616. frame count of the input frame starting from 0
  5617. @item pos
  5618. byte position of the corresponding packet in the input file, NAN if
  5619. unspecified
  5620. @item r
  5621. frame rate of the input video, NAN if the input frame rate is unknown
  5622. @item t
  5623. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5624. @end table
  5625. @subsection Commands
  5626. The filter supports the following commands:
  5627. @table @option
  5628. @item contrast
  5629. Set the contrast expression.
  5630. @item brightness
  5631. Set the brightness expression.
  5632. @item saturation
  5633. Set the saturation expression.
  5634. @item gamma
  5635. Set the gamma expression.
  5636. @item gamma_r
  5637. Set the gamma_r expression.
  5638. @item gamma_g
  5639. Set gamma_g expression.
  5640. @item gamma_b
  5641. Set gamma_b expression.
  5642. @item gamma_weight
  5643. Set gamma_weight expression.
  5644. The command accepts the same syntax of the corresponding option.
  5645. If the specified expression is not valid, it is kept at its current
  5646. value.
  5647. @end table
  5648. @section erosion
  5649. Apply erosion effect to the video.
  5650. This filter replaces the pixel by the local(3x3) minimum.
  5651. It accepts the following options:
  5652. @table @option
  5653. @item threshold0
  5654. @item threshold1
  5655. @item threshold2
  5656. @item threshold3
  5657. Limit the maximum change for each plane, default is 65535.
  5658. If 0, plane will remain unchanged.
  5659. @item coordinates
  5660. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5661. pixels are used.
  5662. Flags to local 3x3 coordinates maps like this:
  5663. 1 2 3
  5664. 4 5
  5665. 6 7 8
  5666. @end table
  5667. @section extractplanes
  5668. Extract color channel components from input video stream into
  5669. separate grayscale video streams.
  5670. The filter accepts the following option:
  5671. @table @option
  5672. @item planes
  5673. Set plane(s) to extract.
  5674. Available values for planes are:
  5675. @table @samp
  5676. @item y
  5677. @item u
  5678. @item v
  5679. @item a
  5680. @item r
  5681. @item g
  5682. @item b
  5683. @end table
  5684. Choosing planes not available in the input will result in an error.
  5685. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5686. with @code{y}, @code{u}, @code{v} planes at same time.
  5687. @end table
  5688. @subsection Examples
  5689. @itemize
  5690. @item
  5691. Extract luma, u and v color channel component from input video frame
  5692. into 3 grayscale outputs:
  5693. @example
  5694. 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
  5695. @end example
  5696. @end itemize
  5697. @section elbg
  5698. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5699. For each input image, the filter will compute the optimal mapping from
  5700. the input to the output given the codebook length, that is the number
  5701. of distinct output colors.
  5702. This filter accepts the following options.
  5703. @table @option
  5704. @item codebook_length, l
  5705. Set codebook length. The value must be a positive integer, and
  5706. represents the number of distinct output colors. Default value is 256.
  5707. @item nb_steps, n
  5708. Set the maximum number of iterations to apply for computing the optimal
  5709. mapping. The higher the value the better the result and the higher the
  5710. computation time. Default value is 1.
  5711. @item seed, s
  5712. Set a random seed, must be an integer included between 0 and
  5713. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5714. will try to use a good random seed on a best effort basis.
  5715. @item pal8
  5716. Set pal8 output pixel format. This option does not work with codebook
  5717. length greater than 256.
  5718. @end table
  5719. @section fade
  5720. Apply a fade-in/out effect to the input video.
  5721. It accepts the following parameters:
  5722. @table @option
  5723. @item type, t
  5724. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5725. effect.
  5726. Default is @code{in}.
  5727. @item start_frame, s
  5728. Specify the number of the frame to start applying the fade
  5729. effect at. Default is 0.
  5730. @item nb_frames, n
  5731. The number of frames that the fade effect lasts. At the end of the
  5732. fade-in effect, the output video will have the same intensity as the input video.
  5733. At the end of the fade-out transition, the output video will be filled with the
  5734. selected @option{color}.
  5735. Default is 25.
  5736. @item alpha
  5737. If set to 1, fade only alpha channel, if one exists on the input.
  5738. Default value is 0.
  5739. @item start_time, st
  5740. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5741. effect. If both start_frame and start_time are specified, the fade will start at
  5742. whichever comes last. Default is 0.
  5743. @item duration, d
  5744. The number of seconds for which the fade effect has to last. At the end of the
  5745. fade-in effect the output video will have the same intensity as the input video,
  5746. at the end of the fade-out transition the output video will be filled with the
  5747. selected @option{color}.
  5748. If both duration and nb_frames are specified, duration is used. Default is 0
  5749. (nb_frames is used by default).
  5750. @item color, c
  5751. Specify the color of the fade. Default is "black".
  5752. @end table
  5753. @subsection Examples
  5754. @itemize
  5755. @item
  5756. Fade in the first 30 frames of video:
  5757. @example
  5758. fade=in:0:30
  5759. @end example
  5760. The command above is equivalent to:
  5761. @example
  5762. fade=t=in:s=0:n=30
  5763. @end example
  5764. @item
  5765. Fade out the last 45 frames of a 200-frame video:
  5766. @example
  5767. fade=out:155:45
  5768. fade=type=out:start_frame=155:nb_frames=45
  5769. @end example
  5770. @item
  5771. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5772. @example
  5773. fade=in:0:25, fade=out:975:25
  5774. @end example
  5775. @item
  5776. Make the first 5 frames yellow, then fade in from frame 5-24:
  5777. @example
  5778. fade=in:5:20:color=yellow
  5779. @end example
  5780. @item
  5781. Fade in alpha over first 25 frames of video:
  5782. @example
  5783. fade=in:0:25:alpha=1
  5784. @end example
  5785. @item
  5786. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5787. @example
  5788. fade=t=in:st=5.5:d=0.5
  5789. @end example
  5790. @end itemize
  5791. @section fftfilt
  5792. Apply arbitrary expressions to samples in frequency domain
  5793. @table @option
  5794. @item dc_Y
  5795. Adjust the dc value (gain) of the luma plane of the image. The filter
  5796. accepts an integer value in range @code{0} to @code{1000}. The default
  5797. value is set to @code{0}.
  5798. @item dc_U
  5799. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5800. filter accepts an integer value in range @code{0} to @code{1000}. The
  5801. default value is set to @code{0}.
  5802. @item dc_V
  5803. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5804. filter accepts an integer value in range @code{0} to @code{1000}. The
  5805. default value is set to @code{0}.
  5806. @item weight_Y
  5807. Set the frequency domain weight expression for the luma plane.
  5808. @item weight_U
  5809. Set the frequency domain weight expression for the 1st chroma plane.
  5810. @item weight_V
  5811. Set the frequency domain weight expression for the 2nd chroma plane.
  5812. The filter accepts the following variables:
  5813. @item X
  5814. @item Y
  5815. The coordinates of the current sample.
  5816. @item W
  5817. @item H
  5818. The width and height of the image.
  5819. @end table
  5820. @subsection Examples
  5821. @itemize
  5822. @item
  5823. High-pass:
  5824. @example
  5825. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5826. @end example
  5827. @item
  5828. Low-pass:
  5829. @example
  5830. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5831. @end example
  5832. @item
  5833. Sharpen:
  5834. @example
  5835. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5836. @end example
  5837. @item
  5838. Blur:
  5839. @example
  5840. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5841. @end example
  5842. @end itemize
  5843. @section field
  5844. Extract a single field from an interlaced image using stride
  5845. arithmetic to avoid wasting CPU time. The output frames are marked as
  5846. non-interlaced.
  5847. The filter accepts the following options:
  5848. @table @option
  5849. @item type
  5850. Specify whether to extract the top (if the value is @code{0} or
  5851. @code{top}) or the bottom field (if the value is @code{1} or
  5852. @code{bottom}).
  5853. @end table
  5854. @section fieldhint
  5855. Create new frames by copying the top and bottom fields from surrounding frames
  5856. supplied as numbers by the hint file.
  5857. @table @option
  5858. @item hint
  5859. Set file containing hints: absolute/relative frame numbers.
  5860. There must be one line for each frame in a clip. Each line must contain two
  5861. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5862. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5863. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5864. for @code{relative} mode. First number tells from which frame to pick up top
  5865. field and second number tells from which frame to pick up bottom field.
  5866. If optionally followed by @code{+} output frame will be marked as interlaced,
  5867. else if followed by @code{-} output frame will be marked as progressive, else
  5868. it will be marked same as input frame.
  5869. If line starts with @code{#} or @code{;} that line is skipped.
  5870. @item mode
  5871. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5872. @end table
  5873. Example of first several lines of @code{hint} file for @code{relative} mode:
  5874. @example
  5875. 0,0 - # first frame
  5876. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5877. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5878. 1,0 -
  5879. 0,0 -
  5880. 0,0 -
  5881. 1,0 -
  5882. 1,0 -
  5883. 1,0 -
  5884. 0,0 -
  5885. 0,0 -
  5886. 1,0 -
  5887. 1,0 -
  5888. 1,0 -
  5889. 0,0 -
  5890. @end example
  5891. @section fieldmatch
  5892. Field matching filter for inverse telecine. It is meant to reconstruct the
  5893. progressive frames from a telecined stream. The filter does not drop duplicated
  5894. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5895. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5896. The separation of the field matching and the decimation is notably motivated by
  5897. the possibility of inserting a de-interlacing filter fallback between the two.
  5898. If the source has mixed telecined and real interlaced content,
  5899. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5900. But these remaining combed frames will be marked as interlaced, and thus can be
  5901. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5902. In addition to the various configuration options, @code{fieldmatch} can take an
  5903. optional second stream, activated through the @option{ppsrc} option. If
  5904. enabled, the frames reconstruction will be based on the fields and frames from
  5905. this second stream. This allows the first input to be pre-processed in order to
  5906. help the various algorithms of the filter, while keeping the output lossless
  5907. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5908. or brightness/contrast adjustments can help.
  5909. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5910. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5911. which @code{fieldmatch} is based on. While the semantic and usage are very
  5912. close, some behaviour and options names can differ.
  5913. The @ref{decimate} filter currently only works for constant frame rate input.
  5914. If your input has mixed telecined (30fps) and progressive content with a lower
  5915. framerate like 24fps use the following filterchain to produce the necessary cfr
  5916. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5917. The filter accepts the following options:
  5918. @table @option
  5919. @item order
  5920. Specify the assumed field order of the input stream. Available values are:
  5921. @table @samp
  5922. @item auto
  5923. Auto detect parity (use FFmpeg's internal parity value).
  5924. @item bff
  5925. Assume bottom field first.
  5926. @item tff
  5927. Assume top field first.
  5928. @end table
  5929. Note that it is sometimes recommended not to trust the parity announced by the
  5930. stream.
  5931. Default value is @var{auto}.
  5932. @item mode
  5933. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5934. sense that it won't risk creating jerkiness due to duplicate frames when
  5935. possible, but if there are bad edits or blended fields it will end up
  5936. outputting combed frames when a good match might actually exist. On the other
  5937. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5938. but will almost always find a good frame if there is one. The other values are
  5939. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5940. jerkiness and creating duplicate frames versus finding good matches in sections
  5941. with bad edits, orphaned fields, blended fields, etc.
  5942. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5943. Available values are:
  5944. @table @samp
  5945. @item pc
  5946. 2-way matching (p/c)
  5947. @item pc_n
  5948. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5949. @item pc_u
  5950. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5951. @item pc_n_ub
  5952. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5953. still combed (p/c + n + u/b)
  5954. @item pcn
  5955. 3-way matching (p/c/n)
  5956. @item pcn_ub
  5957. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5958. detected as combed (p/c/n + u/b)
  5959. @end table
  5960. The parenthesis at the end indicate the matches that would be used for that
  5961. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5962. @var{top}).
  5963. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5964. the slowest.
  5965. Default value is @var{pc_n}.
  5966. @item ppsrc
  5967. Mark the main input stream as a pre-processed input, and enable the secondary
  5968. input stream as the clean source to pick the fields from. See the filter
  5969. introduction for more details. It is similar to the @option{clip2} feature from
  5970. VFM/TFM.
  5971. Default value is @code{0} (disabled).
  5972. @item field
  5973. Set the field to match from. It is recommended to set this to the same value as
  5974. @option{order} unless you experience matching failures with that setting. In
  5975. certain circumstances changing the field that is used to match from can have a
  5976. large impact on matching performance. Available values are:
  5977. @table @samp
  5978. @item auto
  5979. Automatic (same value as @option{order}).
  5980. @item bottom
  5981. Match from the bottom field.
  5982. @item top
  5983. Match from the top field.
  5984. @end table
  5985. Default value is @var{auto}.
  5986. @item mchroma
  5987. Set whether or not chroma is included during the match comparisons. In most
  5988. cases it is recommended to leave this enabled. You should set this to @code{0}
  5989. only if your clip has bad chroma problems such as heavy rainbowing or other
  5990. artifacts. Setting this to @code{0} could also be used to speed things up at
  5991. the cost of some accuracy.
  5992. Default value is @code{1}.
  5993. @item y0
  5994. @item y1
  5995. These define an exclusion band which excludes the lines between @option{y0} and
  5996. @option{y1} from being included in the field matching decision. An exclusion
  5997. band can be used to ignore subtitles, a logo, or other things that may
  5998. interfere with the matching. @option{y0} sets the starting scan line and
  5999. @option{y1} sets the ending line; all lines in between @option{y0} and
  6000. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6001. @option{y0} and @option{y1} to the same value will disable the feature.
  6002. @option{y0} and @option{y1} defaults to @code{0}.
  6003. @item scthresh
  6004. Set the scene change detection threshold as a percentage of maximum change on
  6005. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6006. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6007. @option{scthresh} is @code{[0.0, 100.0]}.
  6008. Default value is @code{12.0}.
  6009. @item combmatch
  6010. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6011. account the combed scores of matches when deciding what match to use as the
  6012. final match. Available values are:
  6013. @table @samp
  6014. @item none
  6015. No final matching based on combed scores.
  6016. @item sc
  6017. Combed scores are only used when a scene change is detected.
  6018. @item full
  6019. Use combed scores all the time.
  6020. @end table
  6021. Default is @var{sc}.
  6022. @item combdbg
  6023. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6024. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6025. Available values are:
  6026. @table @samp
  6027. @item none
  6028. No forced calculation.
  6029. @item pcn
  6030. Force p/c/n calculations.
  6031. @item pcnub
  6032. Force p/c/n/u/b calculations.
  6033. @end table
  6034. Default value is @var{none}.
  6035. @item cthresh
  6036. This is the area combing threshold used for combed frame detection. This
  6037. essentially controls how "strong" or "visible" combing must be to be detected.
  6038. Larger values mean combing must be more visible and smaller values mean combing
  6039. can be less visible or strong and still be detected. Valid settings are from
  6040. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6041. be detected as combed). This is basically a pixel difference value. A good
  6042. range is @code{[8, 12]}.
  6043. Default value is @code{9}.
  6044. @item chroma
  6045. Sets whether or not chroma is considered in the combed frame decision. Only
  6046. disable this if your source has chroma problems (rainbowing, etc.) that are
  6047. causing problems for the combed frame detection with chroma enabled. Actually,
  6048. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6049. where there is chroma only combing in the source.
  6050. Default value is @code{0}.
  6051. @item blockx
  6052. @item blocky
  6053. Respectively set the x-axis and y-axis size of the window used during combed
  6054. frame detection. This has to do with the size of the area in which
  6055. @option{combpel} pixels are required to be detected as combed for a frame to be
  6056. declared combed. See the @option{combpel} parameter description for more info.
  6057. Possible values are any number that is a power of 2 starting at 4 and going up
  6058. to 512.
  6059. Default value is @code{16}.
  6060. @item combpel
  6061. The number of combed pixels inside any of the @option{blocky} by
  6062. @option{blockx} size blocks on the frame for the frame to be detected as
  6063. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6064. setting controls "how much" combing there must be in any localized area (a
  6065. window defined by the @option{blockx} and @option{blocky} settings) on the
  6066. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6067. which point no frames will ever be detected as combed). This setting is known
  6068. as @option{MI} in TFM/VFM vocabulary.
  6069. Default value is @code{80}.
  6070. @end table
  6071. @anchor{p/c/n/u/b meaning}
  6072. @subsection p/c/n/u/b meaning
  6073. @subsubsection p/c/n
  6074. We assume the following telecined stream:
  6075. @example
  6076. Top fields: 1 2 2 3 4
  6077. Bottom fields: 1 2 3 4 4
  6078. @end example
  6079. The numbers correspond to the progressive frame the fields relate to. Here, the
  6080. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6081. When @code{fieldmatch} is configured to run a matching from bottom
  6082. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6083. @example
  6084. Input stream:
  6085. T 1 2 2 3 4
  6086. B 1 2 3 4 4 <-- matching reference
  6087. Matches: c c n n c
  6088. Output stream:
  6089. T 1 2 3 4 4
  6090. B 1 2 3 4 4
  6091. @end example
  6092. As a result of the field matching, we can see that some frames get duplicated.
  6093. To perform a complete inverse telecine, you need to rely on a decimation filter
  6094. after this operation. See for instance the @ref{decimate} filter.
  6095. The same operation now matching from top fields (@option{field}=@var{top})
  6096. looks like this:
  6097. @example
  6098. Input stream:
  6099. T 1 2 2 3 4 <-- matching reference
  6100. B 1 2 3 4 4
  6101. Matches: c c p p c
  6102. Output stream:
  6103. T 1 2 2 3 4
  6104. B 1 2 2 3 4
  6105. @end example
  6106. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6107. basically, they refer to the frame and field of the opposite parity:
  6108. @itemize
  6109. @item @var{p} matches the field of the opposite parity in the previous frame
  6110. @item @var{c} matches the field of the opposite parity in the current frame
  6111. @item @var{n} matches the field of the opposite parity in the next frame
  6112. @end itemize
  6113. @subsubsection u/b
  6114. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6115. from the opposite parity flag. In the following examples, we assume that we are
  6116. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6117. 'x' is placed above and below each matched fields.
  6118. With bottom matching (@option{field}=@var{bottom}):
  6119. @example
  6120. Match: c p n b u
  6121. x x x x x
  6122. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6123. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6124. x x x x x
  6125. Output frames:
  6126. 2 1 2 2 2
  6127. 2 2 2 1 3
  6128. @end example
  6129. With top matching (@option{field}=@var{top}):
  6130. @example
  6131. Match: c p n b u
  6132. x x x x x
  6133. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6134. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6135. x x x x x
  6136. Output frames:
  6137. 2 2 2 1 2
  6138. 2 1 3 2 2
  6139. @end example
  6140. @subsection Examples
  6141. Simple IVTC of a top field first telecined stream:
  6142. @example
  6143. fieldmatch=order=tff:combmatch=none, decimate
  6144. @end example
  6145. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6146. @example
  6147. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6148. @end example
  6149. @section fieldorder
  6150. Transform the field order of the input video.
  6151. It accepts the following parameters:
  6152. @table @option
  6153. @item order
  6154. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6155. for bottom field first.
  6156. @end table
  6157. The default value is @samp{tff}.
  6158. The transformation is done by shifting the picture content up or down
  6159. by one line, and filling the remaining line with appropriate picture content.
  6160. This method is consistent with most broadcast field order converters.
  6161. If the input video is not flagged as being interlaced, or it is already
  6162. flagged as being of the required output field order, then this filter does
  6163. not alter the incoming video.
  6164. It is very useful when converting to or from PAL DV material,
  6165. which is bottom field first.
  6166. For example:
  6167. @example
  6168. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6169. @end example
  6170. @section fifo, afifo
  6171. Buffer input images and send them when they are requested.
  6172. It is mainly useful when auto-inserted by the libavfilter
  6173. framework.
  6174. It does not take parameters.
  6175. @section find_rect
  6176. Find a rectangular object
  6177. It accepts the following options:
  6178. @table @option
  6179. @item object
  6180. Filepath of the object image, needs to be in gray8.
  6181. @item threshold
  6182. Detection threshold, default is 0.5.
  6183. @item mipmaps
  6184. Number of mipmaps, default is 3.
  6185. @item xmin, ymin, xmax, ymax
  6186. Specifies the rectangle in which to search.
  6187. @end table
  6188. @subsection Examples
  6189. @itemize
  6190. @item
  6191. Generate a representative palette of a given video using @command{ffmpeg}:
  6192. @example
  6193. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6194. @end example
  6195. @end itemize
  6196. @section cover_rect
  6197. Cover a rectangular object
  6198. It accepts the following options:
  6199. @table @option
  6200. @item cover
  6201. Filepath of the optional cover image, needs to be in yuv420.
  6202. @item mode
  6203. Set covering mode.
  6204. It accepts the following values:
  6205. @table @samp
  6206. @item cover
  6207. cover it by the supplied image
  6208. @item blur
  6209. cover it by interpolating the surrounding pixels
  6210. @end table
  6211. Default value is @var{blur}.
  6212. @end table
  6213. @subsection Examples
  6214. @itemize
  6215. @item
  6216. Generate a representative palette of a given video using @command{ffmpeg}:
  6217. @example
  6218. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6219. @end example
  6220. @end itemize
  6221. @anchor{format}
  6222. @section format
  6223. Convert the input video to one of the specified pixel formats.
  6224. Libavfilter will try to pick one that is suitable as input to
  6225. the next filter.
  6226. It accepts the following parameters:
  6227. @table @option
  6228. @item pix_fmts
  6229. A '|'-separated list of pixel format names, such as
  6230. "pix_fmts=yuv420p|monow|rgb24".
  6231. @end table
  6232. @subsection Examples
  6233. @itemize
  6234. @item
  6235. Convert the input video to the @var{yuv420p} format
  6236. @example
  6237. format=pix_fmts=yuv420p
  6238. @end example
  6239. Convert the input video to any of the formats in the list
  6240. @example
  6241. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6242. @end example
  6243. @end itemize
  6244. @anchor{fps}
  6245. @section fps
  6246. Convert the video to specified constant frame rate by duplicating or dropping
  6247. frames as necessary.
  6248. It accepts the following parameters:
  6249. @table @option
  6250. @item fps
  6251. The desired output frame rate. The default is @code{25}.
  6252. @item round
  6253. Rounding method.
  6254. Possible values are:
  6255. @table @option
  6256. @item zero
  6257. zero round towards 0
  6258. @item inf
  6259. round away from 0
  6260. @item down
  6261. round towards -infinity
  6262. @item up
  6263. round towards +infinity
  6264. @item near
  6265. round to nearest
  6266. @end table
  6267. The default is @code{near}.
  6268. @item start_time
  6269. Assume the first PTS should be the given value, in seconds. This allows for
  6270. padding/trimming at the start of stream. By default, no assumption is made
  6271. about the first frame's expected PTS, so no padding or trimming is done.
  6272. For example, this could be set to 0 to pad the beginning with duplicates of
  6273. the first frame if a video stream starts after the audio stream or to trim any
  6274. frames with a negative PTS.
  6275. @end table
  6276. Alternatively, the options can be specified as a flat string:
  6277. @var{fps}[:@var{round}].
  6278. See also the @ref{setpts} filter.
  6279. @subsection Examples
  6280. @itemize
  6281. @item
  6282. A typical usage in order to set the fps to 25:
  6283. @example
  6284. fps=fps=25
  6285. @end example
  6286. @item
  6287. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6288. @example
  6289. fps=fps=film:round=near
  6290. @end example
  6291. @end itemize
  6292. @section framepack
  6293. Pack two different video streams into a stereoscopic video, setting proper
  6294. metadata on supported codecs. The two views should have the same size and
  6295. framerate and processing will stop when the shorter video ends. Please note
  6296. that you may conveniently adjust view properties with the @ref{scale} and
  6297. @ref{fps} filters.
  6298. It accepts the following parameters:
  6299. @table @option
  6300. @item format
  6301. The desired packing format. Supported values are:
  6302. @table @option
  6303. @item sbs
  6304. The views are next to each other (default).
  6305. @item tab
  6306. The views are on top of each other.
  6307. @item lines
  6308. The views are packed by line.
  6309. @item columns
  6310. The views are packed by column.
  6311. @item frameseq
  6312. The views are temporally interleaved.
  6313. @end table
  6314. @end table
  6315. Some examples:
  6316. @example
  6317. # Convert left and right views into a frame-sequential video
  6318. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6319. # Convert views into a side-by-side video with the same output resolution as the input
  6320. 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
  6321. @end example
  6322. @section framerate
  6323. Change the frame rate by interpolating new video output frames from the source
  6324. frames.
  6325. This filter is not designed to function correctly with interlaced media. If
  6326. you wish to change the frame rate of interlaced media then you are required
  6327. to deinterlace before this filter and re-interlace after this filter.
  6328. A description of the accepted options follows.
  6329. @table @option
  6330. @item fps
  6331. Specify the output frames per second. This option can also be specified
  6332. as a value alone. The default is @code{50}.
  6333. @item interp_start
  6334. Specify the start of a range where the output frame will be created as a
  6335. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6336. the default is @code{15}.
  6337. @item interp_end
  6338. Specify the end of a range where the output frame will be created as a
  6339. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6340. the default is @code{240}.
  6341. @item scene
  6342. Specify the level at which a scene change is detected as a value between
  6343. 0 and 100 to indicate a new scene; a low value reflects a low
  6344. probability for the current frame to introduce a new scene, while a higher
  6345. value means the current frame is more likely to be one.
  6346. The default is @code{7}.
  6347. @item flags
  6348. Specify flags influencing the filter process.
  6349. Available value for @var{flags} is:
  6350. @table @option
  6351. @item scene_change_detect, scd
  6352. Enable scene change detection using the value of the option @var{scene}.
  6353. This flag is enabled by default.
  6354. @end table
  6355. @end table
  6356. @section framestep
  6357. Select one frame every N-th frame.
  6358. This filter accepts the following option:
  6359. @table @option
  6360. @item step
  6361. Select frame after every @code{step} frames.
  6362. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6363. @end table
  6364. @anchor{frei0r}
  6365. @section frei0r
  6366. Apply a frei0r effect to the input video.
  6367. To enable the compilation of this filter, you need to install the frei0r
  6368. header and configure FFmpeg with @code{--enable-frei0r}.
  6369. It accepts the following parameters:
  6370. @table @option
  6371. @item filter_name
  6372. The name of the frei0r effect to load. If the environment variable
  6373. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6374. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6375. Otherwise, the standard frei0r paths are searched, in this order:
  6376. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6377. @file{/usr/lib/frei0r-1/}.
  6378. @item filter_params
  6379. A '|'-separated list of parameters to pass to the frei0r effect.
  6380. @end table
  6381. A frei0r effect parameter can be a boolean (its value is either
  6382. "y" or "n"), a double, a color (specified as
  6383. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6384. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6385. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6386. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6387. The number and types of parameters depend on the loaded effect. If an
  6388. effect parameter is not specified, the default value is set.
  6389. @subsection Examples
  6390. @itemize
  6391. @item
  6392. Apply the distort0r effect, setting the first two double parameters:
  6393. @example
  6394. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6395. @end example
  6396. @item
  6397. Apply the colordistance effect, taking a color as the first parameter:
  6398. @example
  6399. frei0r=colordistance:0.2/0.3/0.4
  6400. frei0r=colordistance:violet
  6401. frei0r=colordistance:0x112233
  6402. @end example
  6403. @item
  6404. Apply the perspective effect, specifying the top left and top right image
  6405. positions:
  6406. @example
  6407. frei0r=perspective:0.2/0.2|0.8/0.2
  6408. @end example
  6409. @end itemize
  6410. For more information, see
  6411. @url{http://frei0r.dyne.org}
  6412. @section fspp
  6413. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6414. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6415. processing filter, one of them is performed once per block, not per pixel.
  6416. This allows for much higher speed.
  6417. The filter accepts the following options:
  6418. @table @option
  6419. @item quality
  6420. Set quality. This option defines the number of levels for averaging. It accepts
  6421. an integer in the range 4-5. Default value is @code{4}.
  6422. @item qp
  6423. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6424. If not set, the filter will use the QP from the video stream (if available).
  6425. @item strength
  6426. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6427. more details but also more artifacts, while higher values make the image smoother
  6428. but also blurrier. Default value is @code{0} − PSNR optimal.
  6429. @item use_bframe_qp
  6430. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6431. option may cause flicker since the B-Frames have often larger QP. Default is
  6432. @code{0} (not enabled).
  6433. @end table
  6434. @section gblur
  6435. Apply Gaussian blur filter.
  6436. The filter accepts the following options:
  6437. @table @option
  6438. @item sigma
  6439. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6440. @item steps
  6441. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6442. @item planes
  6443. Set which planes to filter. By default all planes are filtered.
  6444. @item sigmaV
  6445. Set vertical sigma, if negative it will be same as @code{sigma}.
  6446. Default is @code{-1}.
  6447. @end table
  6448. @section geq
  6449. The filter accepts the following options:
  6450. @table @option
  6451. @item lum_expr, lum
  6452. Set the luminance expression.
  6453. @item cb_expr, cb
  6454. Set the chrominance blue expression.
  6455. @item cr_expr, cr
  6456. Set the chrominance red expression.
  6457. @item alpha_expr, a
  6458. Set the alpha expression.
  6459. @item red_expr, r
  6460. Set the red expression.
  6461. @item green_expr, g
  6462. Set the green expression.
  6463. @item blue_expr, b
  6464. Set the blue expression.
  6465. @end table
  6466. The colorspace is selected according to the specified options. If one
  6467. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6468. options is specified, the filter will automatically select a YCbCr
  6469. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6470. @option{blue_expr} options is specified, it will select an RGB
  6471. colorspace.
  6472. If one of the chrominance expression is not defined, it falls back on the other
  6473. one. If no alpha expression is specified it will evaluate to opaque value.
  6474. If none of chrominance expressions are specified, they will evaluate
  6475. to the luminance expression.
  6476. The expressions can use the following variables and functions:
  6477. @table @option
  6478. @item N
  6479. The sequential number of the filtered frame, starting from @code{0}.
  6480. @item X
  6481. @item Y
  6482. The coordinates of the current sample.
  6483. @item W
  6484. @item H
  6485. The width and height of the image.
  6486. @item SW
  6487. @item SH
  6488. Width and height scale depending on the currently filtered plane. It is the
  6489. ratio between the corresponding luma plane number of pixels and the current
  6490. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6491. @code{0.5,0.5} for chroma planes.
  6492. @item T
  6493. Time of the current frame, expressed in seconds.
  6494. @item p(x, y)
  6495. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6496. plane.
  6497. @item lum(x, y)
  6498. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6499. plane.
  6500. @item cb(x, y)
  6501. Return the value of the pixel at location (@var{x},@var{y}) of the
  6502. blue-difference chroma plane. Return 0 if there is no such plane.
  6503. @item cr(x, y)
  6504. Return the value of the pixel at location (@var{x},@var{y}) of the
  6505. red-difference chroma plane. Return 0 if there is no such plane.
  6506. @item r(x, y)
  6507. @item g(x, y)
  6508. @item b(x, y)
  6509. Return the value of the pixel at location (@var{x},@var{y}) of the
  6510. red/green/blue component. Return 0 if there is no such component.
  6511. @item alpha(x, y)
  6512. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6513. plane. Return 0 if there is no such plane.
  6514. @end table
  6515. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6516. automatically clipped to the closer edge.
  6517. @subsection Examples
  6518. @itemize
  6519. @item
  6520. Flip the image horizontally:
  6521. @example
  6522. geq=p(W-X\,Y)
  6523. @end example
  6524. @item
  6525. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6526. wavelength of 100 pixels:
  6527. @example
  6528. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6529. @end example
  6530. @item
  6531. Generate a fancy enigmatic moving light:
  6532. @example
  6533. 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
  6534. @end example
  6535. @item
  6536. Generate a quick emboss effect:
  6537. @example
  6538. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6539. @end example
  6540. @item
  6541. Modify RGB components depending on pixel position:
  6542. @example
  6543. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6544. @end example
  6545. @item
  6546. Create a radial gradient that is the same size as the input (also see
  6547. the @ref{vignette} filter):
  6548. @example
  6549. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6550. @end example
  6551. @end itemize
  6552. @section gradfun
  6553. Fix the banding artifacts that are sometimes introduced into nearly flat
  6554. regions by truncation to 8-bit color depth.
  6555. Interpolate the gradients that should go where the bands are, and
  6556. dither them.
  6557. It is designed for playback only. Do not use it prior to
  6558. lossy compression, because compression tends to lose the dither and
  6559. bring back the bands.
  6560. It accepts the following parameters:
  6561. @table @option
  6562. @item strength
  6563. The maximum amount by which the filter will change any one pixel. This is also
  6564. the threshold for detecting nearly flat regions. Acceptable values range from
  6565. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6566. valid range.
  6567. @item radius
  6568. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6569. gradients, but also prevents the filter from modifying the pixels near detailed
  6570. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6571. values will be clipped to the valid range.
  6572. @end table
  6573. Alternatively, the options can be specified as a flat string:
  6574. @var{strength}[:@var{radius}]
  6575. @subsection Examples
  6576. @itemize
  6577. @item
  6578. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6579. @example
  6580. gradfun=3.5:8
  6581. @end example
  6582. @item
  6583. Specify radius, omitting the strength (which will fall-back to the default
  6584. value):
  6585. @example
  6586. gradfun=radius=8
  6587. @end example
  6588. @end itemize
  6589. @anchor{haldclut}
  6590. @section haldclut
  6591. Apply a Hald CLUT to a video stream.
  6592. First input is the video stream to process, and second one is the Hald CLUT.
  6593. The Hald CLUT input can be a simple picture or a complete video stream.
  6594. The filter accepts the following options:
  6595. @table @option
  6596. @item shortest
  6597. Force termination when the shortest input terminates. Default is @code{0}.
  6598. @item repeatlast
  6599. Continue applying the last CLUT after the end of the stream. A value of
  6600. @code{0} disable the filter after the last frame of the CLUT is reached.
  6601. Default is @code{1}.
  6602. @end table
  6603. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6604. filters share the same internals).
  6605. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6606. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6607. @subsection Workflow examples
  6608. @subsubsection Hald CLUT video stream
  6609. Generate an identity Hald CLUT stream altered with various effects:
  6610. @example
  6611. 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
  6612. @end example
  6613. Note: make sure you use a lossless codec.
  6614. Then use it with @code{haldclut} to apply it on some random stream:
  6615. @example
  6616. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6617. @end example
  6618. The Hald CLUT will be applied to the 10 first seconds (duration of
  6619. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6620. to the remaining frames of the @code{mandelbrot} stream.
  6621. @subsubsection Hald CLUT with preview
  6622. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6623. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6624. biggest possible square starting at the top left of the picture. The remaining
  6625. padding pixels (bottom or right) will be ignored. This area can be used to add
  6626. a preview of the Hald CLUT.
  6627. Typically, the following generated Hald CLUT will be supported by the
  6628. @code{haldclut} filter:
  6629. @example
  6630. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6631. pad=iw+320 [padded_clut];
  6632. smptebars=s=320x256, split [a][b];
  6633. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6634. [main][b] overlay=W-320" -frames:v 1 clut.png
  6635. @end example
  6636. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6637. bars are displayed on the right-top, and below the same color bars processed by
  6638. the color changes.
  6639. Then, the effect of this Hald CLUT can be visualized with:
  6640. @example
  6641. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6642. @end example
  6643. @section hflip
  6644. Flip the input video horizontally.
  6645. For example, to horizontally flip the input video with @command{ffmpeg}:
  6646. @example
  6647. ffmpeg -i in.avi -vf "hflip" out.avi
  6648. @end example
  6649. @section histeq
  6650. This filter applies a global color histogram equalization on a
  6651. per-frame basis.
  6652. It can be used to correct video that has a compressed range of pixel
  6653. intensities. The filter redistributes the pixel intensities to
  6654. equalize their distribution across the intensity range. It may be
  6655. viewed as an "automatically adjusting contrast filter". This filter is
  6656. useful only for correcting degraded or poorly captured source
  6657. video.
  6658. The filter accepts the following options:
  6659. @table @option
  6660. @item strength
  6661. Determine the amount of equalization to be applied. As the strength
  6662. is reduced, the distribution of pixel intensities more-and-more
  6663. approaches that of the input frame. The value must be a float number
  6664. in the range [0,1] and defaults to 0.200.
  6665. @item intensity
  6666. Set the maximum intensity that can generated and scale the output
  6667. values appropriately. The strength should be set as desired and then
  6668. the intensity can be limited if needed to avoid washing-out. The value
  6669. must be a float number in the range [0,1] and defaults to 0.210.
  6670. @item antibanding
  6671. Set the antibanding level. If enabled the filter will randomly vary
  6672. the luminance of output pixels by a small amount to avoid banding of
  6673. the histogram. Possible values are @code{none}, @code{weak} or
  6674. @code{strong}. It defaults to @code{none}.
  6675. @end table
  6676. @section histogram
  6677. Compute and draw a color distribution histogram for the input video.
  6678. The computed histogram is a representation of the color component
  6679. distribution in an image.
  6680. Standard histogram displays the color components distribution in an image.
  6681. Displays color graph for each color component. Shows distribution of
  6682. the Y, U, V, A or R, G, B components, depending on input format, in the
  6683. current frame. Below each graph a color component scale meter is shown.
  6684. The filter accepts the following options:
  6685. @table @option
  6686. @item level_height
  6687. Set height of level. Default value is @code{200}.
  6688. Allowed range is [50, 2048].
  6689. @item scale_height
  6690. Set height of color scale. Default value is @code{12}.
  6691. Allowed range is [0, 40].
  6692. @item display_mode
  6693. Set display mode.
  6694. It accepts the following values:
  6695. @table @samp
  6696. @item parade
  6697. Per color component graphs are placed below each other.
  6698. @item overlay
  6699. Presents information identical to that in the @code{parade}, except
  6700. that the graphs representing color components are superimposed directly
  6701. over one another.
  6702. @end table
  6703. Default is @code{parade}.
  6704. @item levels_mode
  6705. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6706. Default is @code{linear}.
  6707. @item components
  6708. Set what color components to display.
  6709. Default is @code{7}.
  6710. @item fgopacity
  6711. Set foreground opacity. Default is @code{0.7}.
  6712. @item bgopacity
  6713. Set background opacity. Default is @code{0.5}.
  6714. @end table
  6715. @subsection Examples
  6716. @itemize
  6717. @item
  6718. Calculate and draw histogram:
  6719. @example
  6720. ffplay -i input -vf histogram
  6721. @end example
  6722. @end itemize
  6723. @anchor{hqdn3d}
  6724. @section hqdn3d
  6725. This is a high precision/quality 3d denoise filter. It aims to reduce
  6726. image noise, producing smooth images and making still images really
  6727. still. It should enhance compressibility.
  6728. It accepts the following optional parameters:
  6729. @table @option
  6730. @item luma_spatial
  6731. A non-negative floating point number which specifies spatial luma strength.
  6732. It defaults to 4.0.
  6733. @item chroma_spatial
  6734. A non-negative floating point number which specifies spatial chroma strength.
  6735. It defaults to 3.0*@var{luma_spatial}/4.0.
  6736. @item luma_tmp
  6737. A floating point number which specifies luma temporal strength. It defaults to
  6738. 6.0*@var{luma_spatial}/4.0.
  6739. @item chroma_tmp
  6740. A floating point number which specifies chroma temporal strength. It defaults to
  6741. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6742. @end table
  6743. @anchor{hwupload_cuda}
  6744. @section hwupload_cuda
  6745. Upload system memory frames to a CUDA device.
  6746. It accepts the following optional parameters:
  6747. @table @option
  6748. @item device
  6749. The number of the CUDA device to use
  6750. @end table
  6751. @section hqx
  6752. Apply a high-quality magnification filter designed for pixel art. This filter
  6753. was originally created by Maxim Stepin.
  6754. It accepts the following option:
  6755. @table @option
  6756. @item n
  6757. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6758. @code{hq3x} and @code{4} for @code{hq4x}.
  6759. Default is @code{3}.
  6760. @end table
  6761. @section hstack
  6762. Stack input videos horizontally.
  6763. All streams must be of same pixel format and of same height.
  6764. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6765. to create same output.
  6766. The filter accept the following option:
  6767. @table @option
  6768. @item inputs
  6769. Set number of input streams. Default is 2.
  6770. @item shortest
  6771. If set to 1, force the output to terminate when the shortest input
  6772. terminates. Default value is 0.
  6773. @end table
  6774. @section hue
  6775. Modify the hue and/or the saturation of the input.
  6776. It accepts the following parameters:
  6777. @table @option
  6778. @item h
  6779. Specify the hue angle as a number of degrees. It accepts an expression,
  6780. and defaults to "0".
  6781. @item s
  6782. Specify the saturation in the [-10,10] range. It accepts an expression and
  6783. defaults to "1".
  6784. @item H
  6785. Specify the hue angle as a number of radians. It accepts an
  6786. expression, and defaults to "0".
  6787. @item b
  6788. Specify the brightness in the [-10,10] range. It accepts an expression and
  6789. defaults to "0".
  6790. @end table
  6791. @option{h} and @option{H} are mutually exclusive, and can't be
  6792. specified at the same time.
  6793. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6794. expressions containing the following constants:
  6795. @table @option
  6796. @item n
  6797. frame count of the input frame starting from 0
  6798. @item pts
  6799. presentation timestamp of the input frame expressed in time base units
  6800. @item r
  6801. frame rate of the input video, NAN if the input frame rate is unknown
  6802. @item t
  6803. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6804. @item tb
  6805. time base of the input video
  6806. @end table
  6807. @subsection Examples
  6808. @itemize
  6809. @item
  6810. Set the hue to 90 degrees and the saturation to 1.0:
  6811. @example
  6812. hue=h=90:s=1
  6813. @end example
  6814. @item
  6815. Same command but expressing the hue in radians:
  6816. @example
  6817. hue=H=PI/2:s=1
  6818. @end example
  6819. @item
  6820. Rotate hue and make the saturation swing between 0
  6821. and 2 over a period of 1 second:
  6822. @example
  6823. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6824. @end example
  6825. @item
  6826. Apply a 3 seconds saturation fade-in effect starting at 0:
  6827. @example
  6828. hue="s=min(t/3\,1)"
  6829. @end example
  6830. The general fade-in expression can be written as:
  6831. @example
  6832. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6833. @end example
  6834. @item
  6835. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6836. @example
  6837. hue="s=max(0\, min(1\, (8-t)/3))"
  6838. @end example
  6839. The general fade-out expression can be written as:
  6840. @example
  6841. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6842. @end example
  6843. @end itemize
  6844. @subsection Commands
  6845. This filter supports the following commands:
  6846. @table @option
  6847. @item b
  6848. @item s
  6849. @item h
  6850. @item H
  6851. Modify the hue and/or the saturation and/or brightness of the input video.
  6852. The command accepts the same syntax of the corresponding option.
  6853. If the specified expression is not valid, it is kept at its current
  6854. value.
  6855. @end table
  6856. @section hysteresis
  6857. Grow first stream into second stream by connecting components.
  6858. This makes it possible to build more robust edge masks.
  6859. This filter accepts the following options:
  6860. @table @option
  6861. @item planes
  6862. Set which planes will be processed as bitmap, unprocessed planes will be
  6863. copied from first stream.
  6864. By default value 0xf, all planes will be processed.
  6865. @item threshold
  6866. Set threshold which is used in filtering. If pixel component value is higher than
  6867. this value filter algorithm for connecting components is activated.
  6868. By default value is 0.
  6869. @end table
  6870. @section idet
  6871. Detect video interlacing type.
  6872. This filter tries to detect if the input frames are interlaced, progressive,
  6873. top or bottom field first. It will also try to detect fields that are
  6874. repeated between adjacent frames (a sign of telecine).
  6875. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6876. Multiple frame detection incorporates the classification history of previous frames.
  6877. The filter will log these metadata values:
  6878. @table @option
  6879. @item single.current_frame
  6880. Detected type of current frame using single-frame detection. One of:
  6881. ``tff'' (top field first), ``bff'' (bottom field first),
  6882. ``progressive'', or ``undetermined''
  6883. @item single.tff
  6884. Cumulative number of frames detected as top field first using single-frame detection.
  6885. @item multiple.tff
  6886. Cumulative number of frames detected as top field first using multiple-frame detection.
  6887. @item single.bff
  6888. Cumulative number of frames detected as bottom field first using single-frame detection.
  6889. @item multiple.current_frame
  6890. Detected type of current frame using multiple-frame detection. One of:
  6891. ``tff'' (top field first), ``bff'' (bottom field first),
  6892. ``progressive'', or ``undetermined''
  6893. @item multiple.bff
  6894. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6895. @item single.progressive
  6896. Cumulative number of frames detected as progressive using single-frame detection.
  6897. @item multiple.progressive
  6898. Cumulative number of frames detected as progressive using multiple-frame detection.
  6899. @item single.undetermined
  6900. Cumulative number of frames that could not be classified using single-frame detection.
  6901. @item multiple.undetermined
  6902. Cumulative number of frames that could not be classified using multiple-frame detection.
  6903. @item repeated.current_frame
  6904. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6905. @item repeated.neither
  6906. Cumulative number of frames with no repeated field.
  6907. @item repeated.top
  6908. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6909. @item repeated.bottom
  6910. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6911. @end table
  6912. The filter accepts the following options:
  6913. @table @option
  6914. @item intl_thres
  6915. Set interlacing threshold.
  6916. @item prog_thres
  6917. Set progressive threshold.
  6918. @item rep_thres
  6919. Threshold for repeated field detection.
  6920. @item half_life
  6921. Number of frames after which a given frame's contribution to the
  6922. statistics is halved (i.e., it contributes only 0.5 to its
  6923. classification). The default of 0 means that all frames seen are given
  6924. full weight of 1.0 forever.
  6925. @item analyze_interlaced_flag
  6926. When this is not 0 then idet will use the specified number of frames to determine
  6927. if the interlaced flag is accurate, it will not count undetermined frames.
  6928. If the flag is found to be accurate it will be used without any further
  6929. computations, if it is found to be inaccurate it will be cleared without any
  6930. further computations. This allows inserting the idet filter as a low computational
  6931. method to clean up the interlaced flag
  6932. @end table
  6933. @section il
  6934. Deinterleave or interleave fields.
  6935. This filter allows one to process interlaced images fields without
  6936. deinterlacing them. Deinterleaving splits the input frame into 2
  6937. fields (so called half pictures). Odd lines are moved to the top
  6938. half of the output image, even lines to the bottom half.
  6939. You can process (filter) them independently and then re-interleave them.
  6940. The filter accepts the following options:
  6941. @table @option
  6942. @item luma_mode, l
  6943. @item chroma_mode, c
  6944. @item alpha_mode, a
  6945. Available values for @var{luma_mode}, @var{chroma_mode} and
  6946. @var{alpha_mode} are:
  6947. @table @samp
  6948. @item none
  6949. Do nothing.
  6950. @item deinterleave, d
  6951. Deinterleave fields, placing one above the other.
  6952. @item interleave, i
  6953. Interleave fields. Reverse the effect of deinterleaving.
  6954. @end table
  6955. Default value is @code{none}.
  6956. @item luma_swap, ls
  6957. @item chroma_swap, cs
  6958. @item alpha_swap, as
  6959. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6960. @end table
  6961. @section inflate
  6962. Apply inflate effect to the video.
  6963. This filter replaces the pixel by the local(3x3) average by taking into account
  6964. only values higher than the pixel.
  6965. It accepts the following options:
  6966. @table @option
  6967. @item threshold0
  6968. @item threshold1
  6969. @item threshold2
  6970. @item threshold3
  6971. Limit the maximum change for each plane, default is 65535.
  6972. If 0, plane will remain unchanged.
  6973. @end table
  6974. @section interlace
  6975. Simple interlacing filter from progressive contents. This interleaves upper (or
  6976. lower) lines from odd frames with lower (or upper) lines from even frames,
  6977. halving the frame rate and preserving image height.
  6978. @example
  6979. Original Original New Frame
  6980. Frame 'j' Frame 'j+1' (tff)
  6981. ========== =========== ==================
  6982. Line 0 --------------------> Frame 'j' Line 0
  6983. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6984. Line 2 ---------------------> Frame 'j' Line 2
  6985. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6986. ... ... ...
  6987. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6988. @end example
  6989. It accepts the following optional parameters:
  6990. @table @option
  6991. @item scan
  6992. This determines whether the interlaced frame is taken from the even
  6993. (tff - default) or odd (bff) lines of the progressive frame.
  6994. @item lowpass
  6995. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6996. interlacing and reduce moire patterns.
  6997. @end table
  6998. @section kerndeint
  6999. Deinterlace input video by applying Donald Graft's adaptive kernel
  7000. deinterling. Work on interlaced parts of a video to produce
  7001. progressive frames.
  7002. The description of the accepted parameters follows.
  7003. @table @option
  7004. @item thresh
  7005. Set the threshold which affects the filter's tolerance when
  7006. determining if a pixel line must be processed. It must be an integer
  7007. in the range [0,255] and defaults to 10. A value of 0 will result in
  7008. applying the process on every pixels.
  7009. @item map
  7010. Paint pixels exceeding the threshold value to white if set to 1.
  7011. Default is 0.
  7012. @item order
  7013. Set the fields order. Swap fields if set to 1, leave fields alone if
  7014. 0. Default is 0.
  7015. @item sharp
  7016. Enable additional sharpening if set to 1. Default is 0.
  7017. @item twoway
  7018. Enable twoway sharpening if set to 1. Default is 0.
  7019. @end table
  7020. @subsection Examples
  7021. @itemize
  7022. @item
  7023. Apply default values:
  7024. @example
  7025. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7026. @end example
  7027. @item
  7028. Enable additional sharpening:
  7029. @example
  7030. kerndeint=sharp=1
  7031. @end example
  7032. @item
  7033. Paint processed pixels in white:
  7034. @example
  7035. kerndeint=map=1
  7036. @end example
  7037. @end itemize
  7038. @section lenscorrection
  7039. Correct radial lens distortion
  7040. This filter can be used to correct for radial distortion as can result from the use
  7041. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7042. one can use tools available for example as part of opencv or simply trial-and-error.
  7043. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7044. and extract the k1 and k2 coefficients from the resulting matrix.
  7045. Note that effectively the same filter is available in the open-source tools Krita and
  7046. Digikam from the KDE project.
  7047. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7048. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7049. brightness distribution, so you may want to use both filters together in certain
  7050. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7051. be applied before or after lens correction.
  7052. @subsection Options
  7053. The filter accepts the following options:
  7054. @table @option
  7055. @item cx
  7056. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7057. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7058. width.
  7059. @item cy
  7060. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7061. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7062. height.
  7063. @item k1
  7064. Coefficient of the quadratic correction term. 0.5 means no correction.
  7065. @item k2
  7066. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7067. @end table
  7068. The formula that generates the correction is:
  7069. @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)
  7070. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7071. distances from the focal point in the source and target images, respectively.
  7072. @section loop
  7073. Loop video frames.
  7074. The filter accepts the following options:
  7075. @table @option
  7076. @item loop
  7077. Set the number of loops.
  7078. @item size
  7079. Set maximal size in number of frames.
  7080. @item start
  7081. Set first frame of loop.
  7082. @end table
  7083. @anchor{lut3d}
  7084. @section lut3d
  7085. Apply a 3D LUT to an input video.
  7086. The filter accepts the following options:
  7087. @table @option
  7088. @item file
  7089. Set the 3D LUT file name.
  7090. Currently supported formats:
  7091. @table @samp
  7092. @item 3dl
  7093. AfterEffects
  7094. @item cube
  7095. Iridas
  7096. @item dat
  7097. DaVinci
  7098. @item m3d
  7099. Pandora
  7100. @end table
  7101. @item interp
  7102. Select interpolation mode.
  7103. Available values are:
  7104. @table @samp
  7105. @item nearest
  7106. Use values from the nearest defined point.
  7107. @item trilinear
  7108. Interpolate values using the 8 points defining a cube.
  7109. @item tetrahedral
  7110. Interpolate values using a tetrahedron.
  7111. @end table
  7112. @end table
  7113. @section lut, lutrgb, lutyuv
  7114. Compute a look-up table for binding each pixel component input value
  7115. to an output value, and apply it to the input video.
  7116. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7117. to an RGB input video.
  7118. These filters accept the following parameters:
  7119. @table @option
  7120. @item c0
  7121. set first pixel component expression
  7122. @item c1
  7123. set second pixel component expression
  7124. @item c2
  7125. set third pixel component expression
  7126. @item c3
  7127. set fourth pixel component expression, corresponds to the alpha component
  7128. @item r
  7129. set red component expression
  7130. @item g
  7131. set green component expression
  7132. @item b
  7133. set blue component expression
  7134. @item a
  7135. alpha component expression
  7136. @item y
  7137. set Y/luminance component expression
  7138. @item u
  7139. set U/Cb component expression
  7140. @item v
  7141. set V/Cr component expression
  7142. @end table
  7143. Each of them specifies the expression to use for computing the lookup table for
  7144. the corresponding pixel component values.
  7145. The exact component associated to each of the @var{c*} options depends on the
  7146. format in input.
  7147. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7148. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7149. The expressions can contain the following constants and functions:
  7150. @table @option
  7151. @item w
  7152. @item h
  7153. The input width and height.
  7154. @item val
  7155. The input value for the pixel component.
  7156. @item clipval
  7157. The input value, clipped to the @var{minval}-@var{maxval} range.
  7158. @item maxval
  7159. The maximum value for the pixel component.
  7160. @item minval
  7161. The minimum value for the pixel component.
  7162. @item negval
  7163. The negated value for the pixel component value, clipped to the
  7164. @var{minval}-@var{maxval} range; it corresponds to the expression
  7165. "maxval-clipval+minval".
  7166. @item clip(val)
  7167. The computed value in @var{val}, clipped to the
  7168. @var{minval}-@var{maxval} range.
  7169. @item gammaval(gamma)
  7170. The computed gamma correction value of the pixel component value,
  7171. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7172. expression
  7173. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7174. @end table
  7175. All expressions default to "val".
  7176. @subsection Examples
  7177. @itemize
  7178. @item
  7179. Negate input video:
  7180. @example
  7181. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7182. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7183. @end example
  7184. The above is the same as:
  7185. @example
  7186. lutrgb="r=negval:g=negval:b=negval"
  7187. lutyuv="y=negval:u=negval:v=negval"
  7188. @end example
  7189. @item
  7190. Negate luminance:
  7191. @example
  7192. lutyuv=y=negval
  7193. @end example
  7194. @item
  7195. Remove chroma components, turning the video into a graytone image:
  7196. @example
  7197. lutyuv="u=128:v=128"
  7198. @end example
  7199. @item
  7200. Apply a luma burning effect:
  7201. @example
  7202. lutyuv="y=2*val"
  7203. @end example
  7204. @item
  7205. Remove green and blue components:
  7206. @example
  7207. lutrgb="g=0:b=0"
  7208. @end example
  7209. @item
  7210. Set a constant alpha channel value on input:
  7211. @example
  7212. format=rgba,lutrgb=a="maxval-minval/2"
  7213. @end example
  7214. @item
  7215. Correct luminance gamma by a factor of 0.5:
  7216. @example
  7217. lutyuv=y=gammaval(0.5)
  7218. @end example
  7219. @item
  7220. Discard least significant bits of luma:
  7221. @example
  7222. lutyuv=y='bitand(val, 128+64+32)'
  7223. @end example
  7224. @item
  7225. Technicolor like effect:
  7226. @example
  7227. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7228. @end example
  7229. @end itemize
  7230. @section lut2
  7231. Compute and apply a lookup table from two video inputs.
  7232. This filter accepts the following parameters:
  7233. @table @option
  7234. @item c0
  7235. set first pixel component expression
  7236. @item c1
  7237. set second pixel component expression
  7238. @item c2
  7239. set third pixel component expression
  7240. @item c3
  7241. set fourth pixel component expression, corresponds to the alpha component
  7242. @end table
  7243. Each of them specifies the expression to use for computing the lookup table for
  7244. the corresponding pixel component values.
  7245. The exact component associated to each of the @var{c*} options depends on the
  7246. format in inputs.
  7247. The expressions can contain the following constants:
  7248. @table @option
  7249. @item w
  7250. @item h
  7251. The input width and height.
  7252. @item x
  7253. The first input value for the pixel component.
  7254. @item y
  7255. The second input value for the pixel component.
  7256. @item bdx
  7257. The first input video bit depth.
  7258. @item bdy
  7259. The second input video bit depth.
  7260. @end table
  7261. All expressions default to "x".
  7262. @subsection Examples
  7263. @itemize
  7264. @item
  7265. Highlight differences between two RGB video streams:
  7266. @example
  7267. 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)'
  7268. @end example
  7269. @item
  7270. Highlight differences between two YUV video streams:
  7271. @example
  7272. 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)'
  7273. @end example
  7274. @end itemize
  7275. @section maskedclamp
  7276. Clamp the first input stream with the second input and third input stream.
  7277. Returns the value of first stream to be between second input
  7278. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7279. This filter accepts the following options:
  7280. @table @option
  7281. @item undershoot
  7282. Default value is @code{0}.
  7283. @item overshoot
  7284. Default value is @code{0}.
  7285. @item planes
  7286. Set which planes will be processed as bitmap, unprocessed planes will be
  7287. copied from first stream.
  7288. By default value 0xf, all planes will be processed.
  7289. @end table
  7290. @section maskedmerge
  7291. Merge the first input stream with the second input stream using per pixel
  7292. weights in the third input stream.
  7293. A value of 0 in the third stream pixel component means that pixel component
  7294. from first stream is returned unchanged, while maximum value (eg. 255 for
  7295. 8-bit videos) means that pixel component from second stream is returned
  7296. unchanged. Intermediate values define the amount of merging between both
  7297. input stream's pixel components.
  7298. This filter accepts the following options:
  7299. @table @option
  7300. @item planes
  7301. Set which planes will be processed as bitmap, unprocessed planes will be
  7302. copied from first stream.
  7303. By default value 0xf, all planes will be processed.
  7304. @end table
  7305. @section mcdeint
  7306. Apply motion-compensation deinterlacing.
  7307. It needs one field per frame as input and must thus be used together
  7308. with yadif=1/3 or equivalent.
  7309. This filter accepts the following options:
  7310. @table @option
  7311. @item mode
  7312. Set the deinterlacing mode.
  7313. It accepts one of the following values:
  7314. @table @samp
  7315. @item fast
  7316. @item medium
  7317. @item slow
  7318. use iterative motion estimation
  7319. @item extra_slow
  7320. like @samp{slow}, but use multiple reference frames.
  7321. @end table
  7322. Default value is @samp{fast}.
  7323. @item parity
  7324. Set the picture field parity assumed for the input video. It must be
  7325. one of the following values:
  7326. @table @samp
  7327. @item 0, tff
  7328. assume top field first
  7329. @item 1, bff
  7330. assume bottom field first
  7331. @end table
  7332. Default value is @samp{bff}.
  7333. @item qp
  7334. Set per-block quantization parameter (QP) used by the internal
  7335. encoder.
  7336. Higher values should result in a smoother motion vector field but less
  7337. optimal individual vectors. Default value is 1.
  7338. @end table
  7339. @section mergeplanes
  7340. Merge color channel components from several video streams.
  7341. The filter accepts up to 4 input streams, and merge selected input
  7342. planes to the output video.
  7343. This filter accepts the following options:
  7344. @table @option
  7345. @item mapping
  7346. Set input to output plane mapping. Default is @code{0}.
  7347. The mappings is specified as a bitmap. It should be specified as a
  7348. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7349. mapping for the first plane of the output stream. 'A' sets the number of
  7350. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7351. corresponding input to use (from 0 to 3). The rest of the mappings is
  7352. similar, 'Bb' describes the mapping for the output stream second
  7353. plane, 'Cc' describes the mapping for the output stream third plane and
  7354. 'Dd' describes the mapping for the output stream fourth plane.
  7355. @item format
  7356. Set output pixel format. Default is @code{yuva444p}.
  7357. @end table
  7358. @subsection Examples
  7359. @itemize
  7360. @item
  7361. Merge three gray video streams of same width and height into single video stream:
  7362. @example
  7363. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7364. @end example
  7365. @item
  7366. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7367. @example
  7368. [a0][a1]mergeplanes=0x00010210:yuva444p
  7369. @end example
  7370. @item
  7371. Swap Y and A plane in yuva444p stream:
  7372. @example
  7373. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7374. @end example
  7375. @item
  7376. Swap U and V plane in yuv420p stream:
  7377. @example
  7378. format=yuv420p,mergeplanes=0x000201:yuv420p
  7379. @end example
  7380. @item
  7381. Cast a rgb24 clip to yuv444p:
  7382. @example
  7383. format=rgb24,mergeplanes=0x000102:yuv444p
  7384. @end example
  7385. @end itemize
  7386. @section mestimate
  7387. Estimate and export motion vectors using block matching algorithms.
  7388. Motion vectors are stored in frame side data to be used by other filters.
  7389. This filter accepts the following options:
  7390. @table @option
  7391. @item method
  7392. Specify the motion estimation method. Accepts one of the following values:
  7393. @table @samp
  7394. @item esa
  7395. Exhaustive search algorithm.
  7396. @item tss
  7397. Three step search algorithm.
  7398. @item tdls
  7399. Two dimensional logarithmic search algorithm.
  7400. @item ntss
  7401. New three step search algorithm.
  7402. @item fss
  7403. Four step search algorithm.
  7404. @item ds
  7405. Diamond search algorithm.
  7406. @item hexbs
  7407. Hexagon-based search algorithm.
  7408. @item epzs
  7409. Enhanced predictive zonal search algorithm.
  7410. @item umh
  7411. Uneven multi-hexagon search algorithm.
  7412. @end table
  7413. Default value is @samp{esa}.
  7414. @item mb_size
  7415. Macroblock size. Default @code{16}.
  7416. @item search_param
  7417. Search parameter. Default @code{7}.
  7418. @end table
  7419. @section minterpolate
  7420. Convert the video to specified frame rate using motion interpolation.
  7421. This filter accepts the following options:
  7422. @table @option
  7423. @item fps
  7424. 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}.
  7425. @item mi_mode
  7426. Motion interpolation mode. Following values are accepted:
  7427. @table @samp
  7428. @item dup
  7429. Duplicate previous or next frame for interpolating new ones.
  7430. @item blend
  7431. Blend source frames. Interpolated frame is mean of previous and next frames.
  7432. @item mci
  7433. Motion compensated interpolation. Following options are effective when this mode is selected:
  7434. @table @samp
  7435. @item mc_mode
  7436. Motion compensation mode. Following values are accepted:
  7437. @table @samp
  7438. @item obmc
  7439. Overlapped block motion compensation.
  7440. @item aobmc
  7441. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7442. @end table
  7443. Default mode is @samp{obmc}.
  7444. @item me_mode
  7445. Motion estimation mode. Following values are accepted:
  7446. @table @samp
  7447. @item bidir
  7448. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7449. @item bilat
  7450. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7451. @end table
  7452. Default mode is @samp{bilat}.
  7453. @item me
  7454. The algorithm to be used for motion estimation. Following values are accepted:
  7455. @table @samp
  7456. @item esa
  7457. Exhaustive search algorithm.
  7458. @item tss
  7459. Three step search algorithm.
  7460. @item tdls
  7461. Two dimensional logarithmic search algorithm.
  7462. @item ntss
  7463. New three step search algorithm.
  7464. @item fss
  7465. Four step search algorithm.
  7466. @item ds
  7467. Diamond search algorithm.
  7468. @item hexbs
  7469. Hexagon-based search algorithm.
  7470. @item epzs
  7471. Enhanced predictive zonal search algorithm.
  7472. @item umh
  7473. Uneven multi-hexagon search algorithm.
  7474. @end table
  7475. Default algorithm is @samp{epzs}.
  7476. @item mb_size
  7477. Macroblock size. Default @code{16}.
  7478. @item search_param
  7479. Motion estimation search parameter. Default @code{32}.
  7480. @item vsbmc
  7481. 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).
  7482. @end table
  7483. @end table
  7484. @item scd
  7485. 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:
  7486. @table @samp
  7487. @item none
  7488. Disable scene change detection.
  7489. @item fdiff
  7490. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7491. @end table
  7492. Default method is @samp{fdiff}.
  7493. @item scd_threshold
  7494. Scene change detection threshold. Default is @code{5.0}.
  7495. @end table
  7496. @section mpdecimate
  7497. Drop frames that do not differ greatly from the previous frame in
  7498. order to reduce frame rate.
  7499. The main use of this filter is for very-low-bitrate encoding
  7500. (e.g. streaming over dialup modem), but it could in theory be used for
  7501. fixing movies that were inverse-telecined incorrectly.
  7502. A description of the accepted options follows.
  7503. @table @option
  7504. @item max
  7505. Set the maximum number of consecutive frames which can be dropped (if
  7506. positive), or the minimum interval between dropped frames (if
  7507. negative). If the value is 0, the frame is dropped unregarding the
  7508. number of previous sequentially dropped frames.
  7509. Default value is 0.
  7510. @item hi
  7511. @item lo
  7512. @item frac
  7513. Set the dropping threshold values.
  7514. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7515. represent actual pixel value differences, so a threshold of 64
  7516. corresponds to 1 unit of difference for each pixel, or the same spread
  7517. out differently over the block.
  7518. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7519. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7520. meaning the whole image) differ by more than a threshold of @option{lo}.
  7521. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7522. 64*5, and default value for @option{frac} is 0.33.
  7523. @end table
  7524. @section negate
  7525. Negate input video.
  7526. It accepts an integer in input; if non-zero it negates the
  7527. alpha component (if available). The default value in input is 0.
  7528. @section nlmeans
  7529. Denoise frames using Non-Local Means algorithm.
  7530. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7531. context similarity is defined by comparing their surrounding patches of size
  7532. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7533. around the pixel.
  7534. Note that the research area defines centers for patches, which means some
  7535. patches will be made of pixels outside that research area.
  7536. The filter accepts the following options.
  7537. @table @option
  7538. @item s
  7539. Set denoising strength.
  7540. @item p
  7541. Set patch size.
  7542. @item pc
  7543. Same as @option{p} but for chroma planes.
  7544. The default value is @var{0} and means automatic.
  7545. @item r
  7546. Set research size.
  7547. @item rc
  7548. Same as @option{r} but for chroma planes.
  7549. The default value is @var{0} and means automatic.
  7550. @end table
  7551. @section nnedi
  7552. Deinterlace video using neural network edge directed interpolation.
  7553. This filter accepts the following options:
  7554. @table @option
  7555. @item weights
  7556. Mandatory option, without binary file filter can not work.
  7557. Currently file can be found here:
  7558. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7559. @item deint
  7560. Set which frames to deinterlace, by default it is @code{all}.
  7561. Can be @code{all} or @code{interlaced}.
  7562. @item field
  7563. Set mode of operation.
  7564. Can be one of the following:
  7565. @table @samp
  7566. @item af
  7567. Use frame flags, both fields.
  7568. @item a
  7569. Use frame flags, single field.
  7570. @item t
  7571. Use top field only.
  7572. @item b
  7573. Use bottom field only.
  7574. @item tf
  7575. Use both fields, top first.
  7576. @item bf
  7577. Use both fields, bottom first.
  7578. @end table
  7579. @item planes
  7580. Set which planes to process, by default filter process all frames.
  7581. @item nsize
  7582. Set size of local neighborhood around each pixel, used by the predictor neural
  7583. network.
  7584. Can be one of the following:
  7585. @table @samp
  7586. @item s8x6
  7587. @item s16x6
  7588. @item s32x6
  7589. @item s48x6
  7590. @item s8x4
  7591. @item s16x4
  7592. @item s32x4
  7593. @end table
  7594. @item nns
  7595. Set the number of neurons in predicctor neural network.
  7596. Can be one of the following:
  7597. @table @samp
  7598. @item n16
  7599. @item n32
  7600. @item n64
  7601. @item n128
  7602. @item n256
  7603. @end table
  7604. @item qual
  7605. Controls the number of different neural network predictions that are blended
  7606. together to compute the final output value. Can be @code{fast}, default or
  7607. @code{slow}.
  7608. @item etype
  7609. Set which set of weights to use in the predictor.
  7610. Can be one of the following:
  7611. @table @samp
  7612. @item a
  7613. weights trained to minimize absolute error
  7614. @item s
  7615. weights trained to minimize squared error
  7616. @end table
  7617. @item pscrn
  7618. Controls whether or not the prescreener neural network is used to decide
  7619. which pixels should be processed by the predictor neural network and which
  7620. can be handled by simple cubic interpolation.
  7621. The prescreener is trained to know whether cubic interpolation will be
  7622. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7623. The computational complexity of the prescreener nn is much less than that of
  7624. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7625. using the prescreener generally results in much faster processing.
  7626. The prescreener is pretty accurate, so the difference between using it and not
  7627. using it is almost always unnoticeable.
  7628. Can be one of the following:
  7629. @table @samp
  7630. @item none
  7631. @item original
  7632. @item new
  7633. @end table
  7634. Default is @code{new}.
  7635. @item fapprox
  7636. Set various debugging flags.
  7637. @end table
  7638. @section noformat
  7639. Force libavfilter not to use any of the specified pixel formats for the
  7640. input to the next filter.
  7641. It accepts the following parameters:
  7642. @table @option
  7643. @item pix_fmts
  7644. A '|'-separated list of pixel format names, such as
  7645. apix_fmts=yuv420p|monow|rgb24".
  7646. @end table
  7647. @subsection Examples
  7648. @itemize
  7649. @item
  7650. Force libavfilter to use a format different from @var{yuv420p} for the
  7651. input to the vflip filter:
  7652. @example
  7653. noformat=pix_fmts=yuv420p,vflip
  7654. @end example
  7655. @item
  7656. Convert the input video to any of the formats not contained in the list:
  7657. @example
  7658. noformat=yuv420p|yuv444p|yuv410p
  7659. @end example
  7660. @end itemize
  7661. @section noise
  7662. Add noise on video input frame.
  7663. The filter accepts the following options:
  7664. @table @option
  7665. @item all_seed
  7666. @item c0_seed
  7667. @item c1_seed
  7668. @item c2_seed
  7669. @item c3_seed
  7670. Set noise seed for specific pixel component or all pixel components in case
  7671. of @var{all_seed}. Default value is @code{123457}.
  7672. @item all_strength, alls
  7673. @item c0_strength, c0s
  7674. @item c1_strength, c1s
  7675. @item c2_strength, c2s
  7676. @item c3_strength, c3s
  7677. Set noise strength for specific pixel component or all pixel components in case
  7678. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7679. @item all_flags, allf
  7680. @item c0_flags, c0f
  7681. @item c1_flags, c1f
  7682. @item c2_flags, c2f
  7683. @item c3_flags, c3f
  7684. Set pixel component flags or set flags for all components if @var{all_flags}.
  7685. Available values for component flags are:
  7686. @table @samp
  7687. @item a
  7688. averaged temporal noise (smoother)
  7689. @item p
  7690. mix random noise with a (semi)regular pattern
  7691. @item t
  7692. temporal noise (noise pattern changes between frames)
  7693. @item u
  7694. uniform noise (gaussian otherwise)
  7695. @end table
  7696. @end table
  7697. @subsection Examples
  7698. Add temporal and uniform noise to input video:
  7699. @example
  7700. noise=alls=20:allf=t+u
  7701. @end example
  7702. @section null
  7703. Pass the video source unchanged to the output.
  7704. @section ocr
  7705. Optical Character Recognition
  7706. This filter uses Tesseract for optical character recognition.
  7707. It accepts the following options:
  7708. @table @option
  7709. @item datapath
  7710. Set datapath to tesseract data. Default is to use whatever was
  7711. set at installation.
  7712. @item language
  7713. Set language, default is "eng".
  7714. @item whitelist
  7715. Set character whitelist.
  7716. @item blacklist
  7717. Set character blacklist.
  7718. @end table
  7719. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7720. @section ocv
  7721. Apply a video transform using libopencv.
  7722. To enable this filter, install the libopencv library and headers and
  7723. configure FFmpeg with @code{--enable-libopencv}.
  7724. It accepts the following parameters:
  7725. @table @option
  7726. @item filter_name
  7727. The name of the libopencv filter to apply.
  7728. @item filter_params
  7729. The parameters to pass to the libopencv filter. If not specified, the default
  7730. values are assumed.
  7731. @end table
  7732. Refer to the official libopencv documentation for more precise
  7733. information:
  7734. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7735. Several libopencv filters are supported; see the following subsections.
  7736. @anchor{dilate}
  7737. @subsection dilate
  7738. Dilate an image by using a specific structuring element.
  7739. It corresponds to the libopencv function @code{cvDilate}.
  7740. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7741. @var{struct_el} represents a structuring element, and has the syntax:
  7742. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7743. @var{cols} and @var{rows} represent the number of columns and rows of
  7744. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7745. point, and @var{shape} the shape for the structuring element. @var{shape}
  7746. must be "rect", "cross", "ellipse", or "custom".
  7747. If the value for @var{shape} is "custom", it must be followed by a
  7748. string of the form "=@var{filename}". The file with name
  7749. @var{filename} is assumed to represent a binary image, with each
  7750. printable character corresponding to a bright pixel. When a custom
  7751. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7752. or columns and rows of the read file are assumed instead.
  7753. The default value for @var{struct_el} is "3x3+0x0/rect".
  7754. @var{nb_iterations} specifies the number of times the transform is
  7755. applied to the image, and defaults to 1.
  7756. Some examples:
  7757. @example
  7758. # Use the default values
  7759. ocv=dilate
  7760. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7761. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7762. # Read the shape from the file diamond.shape, iterating two times.
  7763. # The file diamond.shape may contain a pattern of characters like this
  7764. # *
  7765. # ***
  7766. # *****
  7767. # ***
  7768. # *
  7769. # The specified columns and rows are ignored
  7770. # but the anchor point coordinates are not
  7771. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7772. @end example
  7773. @subsection erode
  7774. Erode an image by using a specific structuring element.
  7775. It corresponds to the libopencv function @code{cvErode}.
  7776. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7777. with the same syntax and semantics as the @ref{dilate} filter.
  7778. @subsection smooth
  7779. Smooth the input video.
  7780. The filter takes the following parameters:
  7781. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7782. @var{type} is the type of smooth filter to apply, and must be one of
  7783. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7784. or "bilateral". The default value is "gaussian".
  7785. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7786. depend on the smooth type. @var{param1} and
  7787. @var{param2} accept integer positive values or 0. @var{param3} and
  7788. @var{param4} accept floating point values.
  7789. The default value for @var{param1} is 3. The default value for the
  7790. other parameters is 0.
  7791. These parameters correspond to the parameters assigned to the
  7792. libopencv function @code{cvSmooth}.
  7793. @anchor{overlay}
  7794. @section overlay
  7795. Overlay one video on top of another.
  7796. It takes two inputs and has one output. The first input is the "main"
  7797. video on which the second input is overlaid.
  7798. It accepts the following parameters:
  7799. A description of the accepted options follows.
  7800. @table @option
  7801. @item x
  7802. @item y
  7803. Set the expression for the x and y coordinates of the overlaid video
  7804. on the main video. Default value is "0" for both expressions. In case
  7805. the expression is invalid, it is set to a huge value (meaning that the
  7806. overlay will not be displayed within the output visible area).
  7807. @item eof_action
  7808. The action to take when EOF is encountered on the secondary input; it accepts
  7809. one of the following values:
  7810. @table @option
  7811. @item repeat
  7812. Repeat the last frame (the default).
  7813. @item endall
  7814. End both streams.
  7815. @item pass
  7816. Pass the main input through.
  7817. @end table
  7818. @item eval
  7819. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7820. It accepts the following values:
  7821. @table @samp
  7822. @item init
  7823. only evaluate expressions once during the filter initialization or
  7824. when a command is processed
  7825. @item frame
  7826. evaluate expressions for each incoming frame
  7827. @end table
  7828. Default value is @samp{frame}.
  7829. @item shortest
  7830. If set to 1, force the output to terminate when the shortest input
  7831. terminates. Default value is 0.
  7832. @item format
  7833. Set the format for the output video.
  7834. It accepts the following values:
  7835. @table @samp
  7836. @item yuv420
  7837. force YUV420 output
  7838. @item yuv422
  7839. force YUV422 output
  7840. @item yuv444
  7841. force YUV444 output
  7842. @item rgb
  7843. force RGB output
  7844. @end table
  7845. Default value is @samp{yuv420}.
  7846. @item rgb @emph{(deprecated)}
  7847. If set to 1, force the filter to accept inputs in the RGB
  7848. color space. Default value is 0. This option is deprecated, use
  7849. @option{format} instead.
  7850. @item repeatlast
  7851. If set to 1, force the filter to draw the last overlay frame over the
  7852. main input until the end of the stream. A value of 0 disables this
  7853. behavior. Default value is 1.
  7854. @end table
  7855. The @option{x}, and @option{y} expressions can contain the following
  7856. parameters.
  7857. @table @option
  7858. @item main_w, W
  7859. @item main_h, H
  7860. The main input width and height.
  7861. @item overlay_w, w
  7862. @item overlay_h, h
  7863. The overlay input width and height.
  7864. @item x
  7865. @item y
  7866. The computed values for @var{x} and @var{y}. They are evaluated for
  7867. each new frame.
  7868. @item hsub
  7869. @item vsub
  7870. horizontal and vertical chroma subsample values of the output
  7871. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7872. @var{vsub} is 1.
  7873. @item n
  7874. the number of input frame, starting from 0
  7875. @item pos
  7876. the position in the file of the input frame, NAN if unknown
  7877. @item t
  7878. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7879. @end table
  7880. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7881. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7882. when @option{eval} is set to @samp{init}.
  7883. Be aware that frames are taken from each input video in timestamp
  7884. order, hence, if their initial timestamps differ, it is a good idea
  7885. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7886. have them begin in the same zero timestamp, as the example for
  7887. the @var{movie} filter does.
  7888. You can chain together more overlays but you should test the
  7889. efficiency of such approach.
  7890. @subsection Commands
  7891. This filter supports the following commands:
  7892. @table @option
  7893. @item x
  7894. @item y
  7895. Modify the x and y of the overlay input.
  7896. The command accepts the same syntax of the corresponding option.
  7897. If the specified expression is not valid, it is kept at its current
  7898. value.
  7899. @end table
  7900. @subsection Examples
  7901. @itemize
  7902. @item
  7903. Draw the overlay at 10 pixels from the bottom right corner of the main
  7904. video:
  7905. @example
  7906. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7907. @end example
  7908. Using named options the example above becomes:
  7909. @example
  7910. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7911. @end example
  7912. @item
  7913. Insert a transparent PNG logo in the bottom left corner of the input,
  7914. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7915. @example
  7916. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7917. @end example
  7918. @item
  7919. Insert 2 different transparent PNG logos (second logo on bottom
  7920. right corner) using the @command{ffmpeg} tool:
  7921. @example
  7922. 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
  7923. @end example
  7924. @item
  7925. Add a transparent color layer on top of the main video; @code{WxH}
  7926. must specify the size of the main input to the overlay filter:
  7927. @example
  7928. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7929. @end example
  7930. @item
  7931. Play an original video and a filtered version (here with the deshake
  7932. filter) side by side using the @command{ffplay} tool:
  7933. @example
  7934. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7935. @end example
  7936. The above command is the same as:
  7937. @example
  7938. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7939. @end example
  7940. @item
  7941. Make a sliding overlay appearing from the left to the right top part of the
  7942. screen starting since time 2:
  7943. @example
  7944. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7945. @end example
  7946. @item
  7947. Compose output by putting two input videos side to side:
  7948. @example
  7949. ffmpeg -i left.avi -i right.avi -filter_complex "
  7950. nullsrc=size=200x100 [background];
  7951. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7952. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7953. [background][left] overlay=shortest=1 [background+left];
  7954. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7955. "
  7956. @end example
  7957. @item
  7958. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7959. @example
  7960. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7961. -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]'
  7962. masked.avi
  7963. @end example
  7964. @item
  7965. Chain several overlays in cascade:
  7966. @example
  7967. nullsrc=s=200x200 [bg];
  7968. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7969. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7970. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7971. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7972. [in3] null, [mid2] overlay=100:100 [out0]
  7973. @end example
  7974. @end itemize
  7975. @section owdenoise
  7976. Apply Overcomplete Wavelet denoiser.
  7977. The filter accepts the following options:
  7978. @table @option
  7979. @item depth
  7980. Set depth.
  7981. Larger depth values will denoise lower frequency components more, but
  7982. slow down filtering.
  7983. Must be an int in the range 8-16, default is @code{8}.
  7984. @item luma_strength, ls
  7985. Set luma strength.
  7986. Must be a double value in the range 0-1000, default is @code{1.0}.
  7987. @item chroma_strength, cs
  7988. Set chroma strength.
  7989. Must be a double value in the range 0-1000, default is @code{1.0}.
  7990. @end table
  7991. @anchor{pad}
  7992. @section pad
  7993. Add paddings to the input image, and place the original input at the
  7994. provided @var{x}, @var{y} coordinates.
  7995. It accepts the following parameters:
  7996. @table @option
  7997. @item width, w
  7998. @item height, h
  7999. Specify an expression for the size of the output image with the
  8000. paddings added. If the value for @var{width} or @var{height} is 0, the
  8001. corresponding input size is used for the output.
  8002. The @var{width} expression can reference the value set by the
  8003. @var{height} expression, and vice versa.
  8004. The default value of @var{width} and @var{height} is 0.
  8005. @item x
  8006. @item y
  8007. Specify the offsets to place the input image at within the padded area,
  8008. with respect to the top/left border of the output image.
  8009. The @var{x} expression can reference the value set by the @var{y}
  8010. expression, and vice versa.
  8011. The default value of @var{x} and @var{y} is 0.
  8012. @item color
  8013. Specify the color of the padded area. For the syntax of this option,
  8014. check the "Color" section in the ffmpeg-utils manual.
  8015. The default value of @var{color} is "black".
  8016. @end table
  8017. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8018. options are expressions containing the following constants:
  8019. @table @option
  8020. @item in_w
  8021. @item in_h
  8022. The input video width and height.
  8023. @item iw
  8024. @item ih
  8025. These are the same as @var{in_w} and @var{in_h}.
  8026. @item out_w
  8027. @item out_h
  8028. The output width and height (the size of the padded area), as
  8029. specified by the @var{width} and @var{height} expressions.
  8030. @item ow
  8031. @item oh
  8032. These are the same as @var{out_w} and @var{out_h}.
  8033. @item x
  8034. @item y
  8035. The x and y offsets as specified by the @var{x} and @var{y}
  8036. expressions, or NAN if not yet specified.
  8037. @item a
  8038. same as @var{iw} / @var{ih}
  8039. @item sar
  8040. input sample aspect ratio
  8041. @item dar
  8042. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8043. @item hsub
  8044. @item vsub
  8045. The horizontal and vertical chroma subsample values. For example for the
  8046. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8047. @end table
  8048. @subsection Examples
  8049. @itemize
  8050. @item
  8051. Add paddings with the color "violet" to the input video. The output video
  8052. size is 640x480, and the top-left corner of the input video is placed at
  8053. column 0, row 40
  8054. @example
  8055. pad=640:480:0:40:violet
  8056. @end example
  8057. The example above is equivalent to the following command:
  8058. @example
  8059. pad=width=640:height=480:x=0:y=40:color=violet
  8060. @end example
  8061. @item
  8062. Pad the input to get an output with dimensions increased by 3/2,
  8063. and put the input video at the center of the padded area:
  8064. @example
  8065. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8066. @end example
  8067. @item
  8068. Pad the input to get a squared output with size equal to the maximum
  8069. value between the input width and height, and put the input video at
  8070. the center of the padded area:
  8071. @example
  8072. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8073. @end example
  8074. @item
  8075. Pad the input to get a final w/h ratio of 16:9:
  8076. @example
  8077. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8078. @end example
  8079. @item
  8080. In case of anamorphic video, in order to set the output display aspect
  8081. correctly, it is necessary to use @var{sar} in the expression,
  8082. according to the relation:
  8083. @example
  8084. (ih * X / ih) * sar = output_dar
  8085. X = output_dar / sar
  8086. @end example
  8087. Thus the previous example needs to be modified to:
  8088. @example
  8089. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8090. @end example
  8091. @item
  8092. Double the output size and put the input video in the bottom-right
  8093. corner of the output padded area:
  8094. @example
  8095. pad="2*iw:2*ih:ow-iw:oh-ih"
  8096. @end example
  8097. @end itemize
  8098. @anchor{palettegen}
  8099. @section palettegen
  8100. Generate one palette for a whole video stream.
  8101. It accepts the following options:
  8102. @table @option
  8103. @item max_colors
  8104. Set the maximum number of colors to quantize in the palette.
  8105. Note: the palette will still contain 256 colors; the unused palette entries
  8106. will be black.
  8107. @item reserve_transparent
  8108. Create a palette of 255 colors maximum and reserve the last one for
  8109. transparency. Reserving the transparency color is useful for GIF optimization.
  8110. If not set, the maximum of colors in the palette will be 256. You probably want
  8111. to disable this option for a standalone image.
  8112. Set by default.
  8113. @item stats_mode
  8114. Set statistics mode.
  8115. It accepts the following values:
  8116. @table @samp
  8117. @item full
  8118. Compute full frame histograms.
  8119. @item diff
  8120. Compute histograms only for the part that differs from previous frame. This
  8121. might be relevant to give more importance to the moving part of your input if
  8122. the background is static.
  8123. @item single
  8124. Compute new histogram for each frame.
  8125. @end table
  8126. Default value is @var{full}.
  8127. @end table
  8128. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8129. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8130. color quantization of the palette. This information is also visible at
  8131. @var{info} logging level.
  8132. @subsection Examples
  8133. @itemize
  8134. @item
  8135. Generate a representative palette of a given video using @command{ffmpeg}:
  8136. @example
  8137. ffmpeg -i input.mkv -vf palettegen palette.png
  8138. @end example
  8139. @end itemize
  8140. @section paletteuse
  8141. Use a palette to downsample an input video stream.
  8142. The filter takes two inputs: one video stream and a palette. The palette must
  8143. be a 256 pixels image.
  8144. It accepts the following options:
  8145. @table @option
  8146. @item dither
  8147. Select dithering mode. Available algorithms are:
  8148. @table @samp
  8149. @item bayer
  8150. Ordered 8x8 bayer dithering (deterministic)
  8151. @item heckbert
  8152. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8153. Note: this dithering is sometimes considered "wrong" and is included as a
  8154. reference.
  8155. @item floyd_steinberg
  8156. Floyd and Steingberg dithering (error diffusion)
  8157. @item sierra2
  8158. Frankie Sierra dithering v2 (error diffusion)
  8159. @item sierra2_4a
  8160. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8161. @end table
  8162. Default is @var{sierra2_4a}.
  8163. @item bayer_scale
  8164. When @var{bayer} dithering is selected, this option defines the scale of the
  8165. pattern (how much the crosshatch pattern is visible). A low value means more
  8166. visible pattern for less banding, and higher value means less visible pattern
  8167. at the cost of more banding.
  8168. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8169. @item diff_mode
  8170. If set, define the zone to process
  8171. @table @samp
  8172. @item rectangle
  8173. Only the changing rectangle will be reprocessed. This is similar to GIF
  8174. cropping/offsetting compression mechanism. This option can be useful for speed
  8175. if only a part of the image is changing, and has use cases such as limiting the
  8176. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8177. moving scene (it leads to more deterministic output if the scene doesn't change
  8178. much, and as a result less moving noise and better GIF compression).
  8179. @end table
  8180. Default is @var{none}.
  8181. @item new
  8182. Take new palette for each output frame.
  8183. @end table
  8184. @subsection Examples
  8185. @itemize
  8186. @item
  8187. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8188. using @command{ffmpeg}:
  8189. @example
  8190. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8191. @end example
  8192. @end itemize
  8193. @section perspective
  8194. Correct perspective of video not recorded perpendicular to the screen.
  8195. A description of the accepted parameters follows.
  8196. @table @option
  8197. @item x0
  8198. @item y0
  8199. @item x1
  8200. @item y1
  8201. @item x2
  8202. @item y2
  8203. @item x3
  8204. @item y3
  8205. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8206. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8207. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8208. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8209. then the corners of the source will be sent to the specified coordinates.
  8210. The expressions can use the following variables:
  8211. @table @option
  8212. @item W
  8213. @item H
  8214. the width and height of video frame.
  8215. @item in
  8216. Input frame count.
  8217. @item on
  8218. Output frame count.
  8219. @end table
  8220. @item interpolation
  8221. Set interpolation for perspective correction.
  8222. It accepts the following values:
  8223. @table @samp
  8224. @item linear
  8225. @item cubic
  8226. @end table
  8227. Default value is @samp{linear}.
  8228. @item sense
  8229. Set interpretation of coordinate options.
  8230. It accepts the following values:
  8231. @table @samp
  8232. @item 0, source
  8233. Send point in the source specified by the given coordinates to
  8234. the corners of the destination.
  8235. @item 1, destination
  8236. Send the corners of the source to the point in the destination specified
  8237. by the given coordinates.
  8238. Default value is @samp{source}.
  8239. @end table
  8240. @item eval
  8241. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8242. It accepts the following values:
  8243. @table @samp
  8244. @item init
  8245. only evaluate expressions once during the filter initialization or
  8246. when a command is processed
  8247. @item frame
  8248. evaluate expressions for each incoming frame
  8249. @end table
  8250. Default value is @samp{init}.
  8251. @end table
  8252. @section phase
  8253. Delay interlaced video by one field time so that the field order changes.
  8254. The intended use is to fix PAL movies that have been captured with the
  8255. opposite field order to the film-to-video transfer.
  8256. A description of the accepted parameters follows.
  8257. @table @option
  8258. @item mode
  8259. Set phase mode.
  8260. It accepts the following values:
  8261. @table @samp
  8262. @item t
  8263. Capture field order top-first, transfer bottom-first.
  8264. Filter will delay the bottom field.
  8265. @item b
  8266. Capture field order bottom-first, transfer top-first.
  8267. Filter will delay the top field.
  8268. @item p
  8269. Capture and transfer with the same field order. This mode only exists
  8270. for the documentation of the other options to refer to, but if you
  8271. actually select it, the filter will faithfully do nothing.
  8272. @item a
  8273. Capture field order determined automatically by field flags, transfer
  8274. opposite.
  8275. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8276. basis using field flags. If no field information is available,
  8277. then this works just like @samp{u}.
  8278. @item u
  8279. Capture unknown or varying, transfer opposite.
  8280. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8281. analyzing the images and selecting the alternative that produces best
  8282. match between the fields.
  8283. @item T
  8284. Capture top-first, transfer unknown or varying.
  8285. Filter selects among @samp{t} and @samp{p} using image analysis.
  8286. @item B
  8287. Capture bottom-first, transfer unknown or varying.
  8288. Filter selects among @samp{b} and @samp{p} using image analysis.
  8289. @item A
  8290. Capture determined by field flags, transfer unknown or varying.
  8291. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8292. image analysis. If no field information is available, then this works just
  8293. like @samp{U}. This is the default mode.
  8294. @item U
  8295. Both capture and transfer unknown or varying.
  8296. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8297. @end table
  8298. @end table
  8299. @section pixdesctest
  8300. Pixel format descriptor test filter, mainly useful for internal
  8301. testing. The output video should be equal to the input video.
  8302. For example:
  8303. @example
  8304. format=monow, pixdesctest
  8305. @end example
  8306. can be used to test the monowhite pixel format descriptor definition.
  8307. @section pp
  8308. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8309. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8310. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8311. Each subfilter and some options have a short and a long name that can be used
  8312. interchangeably, i.e. dr/dering are the same.
  8313. The filters accept the following options:
  8314. @table @option
  8315. @item subfilters
  8316. Set postprocessing subfilters string.
  8317. @end table
  8318. All subfilters share common options to determine their scope:
  8319. @table @option
  8320. @item a/autoq
  8321. Honor the quality commands for this subfilter.
  8322. @item c/chrom
  8323. Do chrominance filtering, too (default).
  8324. @item y/nochrom
  8325. Do luminance filtering only (no chrominance).
  8326. @item n/noluma
  8327. Do chrominance filtering only (no luminance).
  8328. @end table
  8329. These options can be appended after the subfilter name, separated by a '|'.
  8330. Available subfilters are:
  8331. @table @option
  8332. @item hb/hdeblock[|difference[|flatness]]
  8333. Horizontal deblocking filter
  8334. @table @option
  8335. @item difference
  8336. Difference factor where higher values mean more deblocking (default: @code{32}).
  8337. @item flatness
  8338. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8339. @end table
  8340. @item vb/vdeblock[|difference[|flatness]]
  8341. Vertical deblocking filter
  8342. @table @option
  8343. @item difference
  8344. Difference factor where higher values mean more deblocking (default: @code{32}).
  8345. @item flatness
  8346. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8347. @end table
  8348. @item ha/hadeblock[|difference[|flatness]]
  8349. Accurate horizontal deblocking filter
  8350. @table @option
  8351. @item difference
  8352. Difference factor where higher values mean more deblocking (default: @code{32}).
  8353. @item flatness
  8354. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8355. @end table
  8356. @item va/vadeblock[|difference[|flatness]]
  8357. Accurate vertical deblocking filter
  8358. @table @option
  8359. @item difference
  8360. Difference factor where higher values mean more deblocking (default: @code{32}).
  8361. @item flatness
  8362. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8363. @end table
  8364. @end table
  8365. The horizontal and vertical deblocking filters share the difference and
  8366. flatness values so you cannot set different horizontal and vertical
  8367. thresholds.
  8368. @table @option
  8369. @item h1/x1hdeblock
  8370. Experimental horizontal deblocking filter
  8371. @item v1/x1vdeblock
  8372. Experimental vertical deblocking filter
  8373. @item dr/dering
  8374. Deringing filter
  8375. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8376. @table @option
  8377. @item threshold1
  8378. larger -> stronger filtering
  8379. @item threshold2
  8380. larger -> stronger filtering
  8381. @item threshold3
  8382. larger -> stronger filtering
  8383. @end table
  8384. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8385. @table @option
  8386. @item f/fullyrange
  8387. Stretch luminance to @code{0-255}.
  8388. @end table
  8389. @item lb/linblenddeint
  8390. Linear blend deinterlacing filter that deinterlaces the given block by
  8391. filtering all lines with a @code{(1 2 1)} filter.
  8392. @item li/linipoldeint
  8393. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8394. linearly interpolating every second line.
  8395. @item ci/cubicipoldeint
  8396. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8397. cubically interpolating every second line.
  8398. @item md/mediandeint
  8399. Median deinterlacing filter that deinterlaces the given block by applying a
  8400. median filter to every second line.
  8401. @item fd/ffmpegdeint
  8402. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8403. second line with a @code{(-1 4 2 4 -1)} filter.
  8404. @item l5/lowpass5
  8405. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8406. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8407. @item fq/forceQuant[|quantizer]
  8408. Overrides the quantizer table from the input with the constant quantizer you
  8409. specify.
  8410. @table @option
  8411. @item quantizer
  8412. Quantizer to use
  8413. @end table
  8414. @item de/default
  8415. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8416. @item fa/fast
  8417. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8418. @item ac
  8419. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8420. @end table
  8421. @subsection Examples
  8422. @itemize
  8423. @item
  8424. Apply horizontal and vertical deblocking, deringing and automatic
  8425. brightness/contrast:
  8426. @example
  8427. pp=hb/vb/dr/al
  8428. @end example
  8429. @item
  8430. Apply default filters without brightness/contrast correction:
  8431. @example
  8432. pp=de/-al
  8433. @end example
  8434. @item
  8435. Apply default filters and temporal denoiser:
  8436. @example
  8437. pp=default/tmpnoise|1|2|3
  8438. @end example
  8439. @item
  8440. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8441. automatically depending on available CPU time:
  8442. @example
  8443. pp=hb|y/vb|a
  8444. @end example
  8445. @end itemize
  8446. @section pp7
  8447. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8448. similar to spp = 6 with 7 point DCT, where only the center sample is
  8449. used after IDCT.
  8450. The filter accepts the following options:
  8451. @table @option
  8452. @item qp
  8453. Force a constant quantization parameter. It accepts an integer in range
  8454. 0 to 63. If not set, the filter will use the QP from the video stream
  8455. (if available).
  8456. @item mode
  8457. Set thresholding mode. Available modes are:
  8458. @table @samp
  8459. @item hard
  8460. Set hard thresholding.
  8461. @item soft
  8462. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8463. @item medium
  8464. Set medium thresholding (good results, default).
  8465. @end table
  8466. @end table
  8467. @section premultiply
  8468. Apply alpha premultiply effect to input video stream using first plane
  8469. of second stream as alpha.
  8470. Both streams must have same dimensions and same pixel format.
  8471. @section prewitt
  8472. Apply prewitt operator to input video stream.
  8473. The filter accepts the following option:
  8474. @table @option
  8475. @item planes
  8476. Set which planes will be processed, unprocessed planes will be copied.
  8477. By default value 0xf, all planes will be processed.
  8478. @item scale
  8479. Set value which will be multiplied with filtered result.
  8480. @item delta
  8481. Set value which will be added to filtered result.
  8482. @end table
  8483. @section psnr
  8484. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8485. Ratio) between two input videos.
  8486. This filter takes in input two input videos, the first input is
  8487. considered the "main" source and is passed unchanged to the
  8488. output. The second input is used as a "reference" video for computing
  8489. the PSNR.
  8490. Both video inputs must have the same resolution and pixel format for
  8491. this filter to work correctly. Also it assumes that both inputs
  8492. have the same number of frames, which are compared one by one.
  8493. The obtained average PSNR is printed through the logging system.
  8494. The filter stores the accumulated MSE (mean squared error) of each
  8495. frame, and at the end of the processing it is averaged across all frames
  8496. equally, and the following formula is applied to obtain the PSNR:
  8497. @example
  8498. PSNR = 10*log10(MAX^2/MSE)
  8499. @end example
  8500. Where MAX is the average of the maximum values of each component of the
  8501. image.
  8502. The description of the accepted parameters follows.
  8503. @table @option
  8504. @item stats_file, f
  8505. If specified the filter will use the named file to save the PSNR of
  8506. each individual frame. When filename equals "-" the data is sent to
  8507. standard output.
  8508. @item stats_version
  8509. Specifies which version of the stats file format to use. Details of
  8510. each format are written below.
  8511. Default value is 1.
  8512. @item stats_add_max
  8513. Determines whether the max value is output to the stats log.
  8514. Default value is 0.
  8515. Requires stats_version >= 2. If this is set and stats_version < 2,
  8516. the filter will return an error.
  8517. @end table
  8518. The file printed if @var{stats_file} is selected, contains a sequence of
  8519. key/value pairs of the form @var{key}:@var{value} for each compared
  8520. couple of frames.
  8521. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8522. the list of per-frame-pair stats, with key value pairs following the frame
  8523. format with the following parameters:
  8524. @table @option
  8525. @item psnr_log_version
  8526. The version of the log file format. Will match @var{stats_version}.
  8527. @item fields
  8528. A comma separated list of the per-frame-pair parameters included in
  8529. the log.
  8530. @end table
  8531. A description of each shown per-frame-pair parameter follows:
  8532. @table @option
  8533. @item n
  8534. sequential number of the input frame, starting from 1
  8535. @item mse_avg
  8536. Mean Square Error pixel-by-pixel average difference of the compared
  8537. frames, averaged over all the image components.
  8538. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8539. Mean Square Error pixel-by-pixel average difference of the compared
  8540. frames for the component specified by the suffix.
  8541. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8542. Peak Signal to Noise ratio of the compared frames for the component
  8543. specified by the suffix.
  8544. @item max_avg, max_y, max_u, max_v
  8545. Maximum allowed value for each channel, and average over all
  8546. channels.
  8547. @end table
  8548. For example:
  8549. @example
  8550. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8551. [main][ref] psnr="stats_file=stats.log" [out]
  8552. @end example
  8553. On this example the input file being processed is compared with the
  8554. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8555. is stored in @file{stats.log}.
  8556. @anchor{pullup}
  8557. @section pullup
  8558. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8559. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8560. content.
  8561. The pullup filter is designed to take advantage of future context in making
  8562. its decisions. This filter is stateless in the sense that it does not lock
  8563. onto a pattern to follow, but it instead looks forward to the following
  8564. fields in order to identify matches and rebuild progressive frames.
  8565. To produce content with an even framerate, insert the fps filter after
  8566. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8567. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8568. The filter accepts the following options:
  8569. @table @option
  8570. @item jl
  8571. @item jr
  8572. @item jt
  8573. @item jb
  8574. These options set the amount of "junk" to ignore at the left, right, top, and
  8575. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8576. while top and bottom are in units of 2 lines.
  8577. The default is 8 pixels on each side.
  8578. @item sb
  8579. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8580. filter generating an occasional mismatched frame, but it may also cause an
  8581. excessive number of frames to be dropped during high motion sequences.
  8582. Conversely, setting it to -1 will make filter match fields more easily.
  8583. This may help processing of video where there is slight blurring between
  8584. the fields, but may also cause there to be interlaced frames in the output.
  8585. Default value is @code{0}.
  8586. @item mp
  8587. Set the metric plane to use. It accepts the following values:
  8588. @table @samp
  8589. @item l
  8590. Use luma plane.
  8591. @item u
  8592. Use chroma blue plane.
  8593. @item v
  8594. Use chroma red plane.
  8595. @end table
  8596. This option may be set to use chroma plane instead of the default luma plane
  8597. for doing filter's computations. This may improve accuracy on very clean
  8598. source material, but more likely will decrease accuracy, especially if there
  8599. is chroma noise (rainbow effect) or any grayscale video.
  8600. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8601. load and make pullup usable in realtime on slow machines.
  8602. @end table
  8603. For best results (without duplicated frames in the output file) it is
  8604. necessary to change the output frame rate. For example, to inverse
  8605. telecine NTSC input:
  8606. @example
  8607. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8608. @end example
  8609. @section qp
  8610. Change video quantization parameters (QP).
  8611. The filter accepts the following option:
  8612. @table @option
  8613. @item qp
  8614. Set expression for quantization parameter.
  8615. @end table
  8616. The expression is evaluated through the eval API and can contain, among others,
  8617. the following constants:
  8618. @table @var
  8619. @item known
  8620. 1 if index is not 129, 0 otherwise.
  8621. @item qp
  8622. Sequentional index starting from -129 to 128.
  8623. @end table
  8624. @subsection Examples
  8625. @itemize
  8626. @item
  8627. Some equation like:
  8628. @example
  8629. qp=2+2*sin(PI*qp)
  8630. @end example
  8631. @end itemize
  8632. @section random
  8633. Flush video frames from internal cache of frames into a random order.
  8634. No frame is discarded.
  8635. Inspired by @ref{frei0r} nervous filter.
  8636. @table @option
  8637. @item frames
  8638. Set size in number of frames of internal cache, in range from @code{2} to
  8639. @code{512}. Default is @code{30}.
  8640. @item seed
  8641. Set seed for random number generator, must be an integer included between
  8642. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8643. less than @code{0}, the filter will try to use a good random seed on a
  8644. best effort basis.
  8645. @end table
  8646. @section readvitc
  8647. Read vertical interval timecode (VITC) information from the top lines of a
  8648. video frame.
  8649. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8650. timecode value, if a valid timecode has been detected. Further metadata key
  8651. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8652. timecode data has been found or not.
  8653. This filter accepts the following options:
  8654. @table @option
  8655. @item scan_max
  8656. Set the maximum number of lines to scan for VITC data. If the value is set to
  8657. @code{-1} the full video frame is scanned. Default is @code{45}.
  8658. @item thr_b
  8659. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8660. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8661. @item thr_w
  8662. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8663. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8664. @end table
  8665. @subsection Examples
  8666. @itemize
  8667. @item
  8668. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8669. draw @code{--:--:--:--} as a placeholder:
  8670. @example
  8671. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8672. @end example
  8673. @end itemize
  8674. @section remap
  8675. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8676. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8677. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8678. value for pixel will be used for destination pixel.
  8679. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8680. will have Xmap/Ymap video stream dimensions.
  8681. Xmap and Ymap input video streams are 16bit depth, single channel.
  8682. @section removegrain
  8683. The removegrain filter is a spatial denoiser for progressive video.
  8684. @table @option
  8685. @item m0
  8686. Set mode for the first plane.
  8687. @item m1
  8688. Set mode for the second plane.
  8689. @item m2
  8690. Set mode for the third plane.
  8691. @item m3
  8692. Set mode for the fourth plane.
  8693. @end table
  8694. Range of mode is from 0 to 24. Description of each mode follows:
  8695. @table @var
  8696. @item 0
  8697. Leave input plane unchanged. Default.
  8698. @item 1
  8699. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8700. @item 2
  8701. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8702. @item 3
  8703. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8704. @item 4
  8705. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8706. This is equivalent to a median filter.
  8707. @item 5
  8708. Line-sensitive clipping giving the minimal change.
  8709. @item 6
  8710. Line-sensitive clipping, intermediate.
  8711. @item 7
  8712. Line-sensitive clipping, intermediate.
  8713. @item 8
  8714. Line-sensitive clipping, intermediate.
  8715. @item 9
  8716. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8717. @item 10
  8718. Replaces the target pixel with the closest neighbour.
  8719. @item 11
  8720. [1 2 1] horizontal and vertical kernel blur.
  8721. @item 12
  8722. Same as mode 11.
  8723. @item 13
  8724. Bob mode, interpolates top field from the line where the neighbours
  8725. pixels are the closest.
  8726. @item 14
  8727. Bob mode, interpolates bottom field from the line where the neighbours
  8728. pixels are the closest.
  8729. @item 15
  8730. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8731. interpolation formula.
  8732. @item 16
  8733. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8734. interpolation formula.
  8735. @item 17
  8736. Clips the pixel with the minimum and maximum of respectively the maximum and
  8737. minimum of each pair of opposite neighbour pixels.
  8738. @item 18
  8739. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8740. the current pixel is minimal.
  8741. @item 19
  8742. Replaces the pixel with the average of its 8 neighbours.
  8743. @item 20
  8744. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8745. @item 21
  8746. Clips pixels using the averages of opposite neighbour.
  8747. @item 22
  8748. Same as mode 21 but simpler and faster.
  8749. @item 23
  8750. Small edge and halo removal, but reputed useless.
  8751. @item 24
  8752. Similar as 23.
  8753. @end table
  8754. @section removelogo
  8755. Suppress a TV station logo, using an image file to determine which
  8756. pixels comprise the logo. It works by filling in the pixels that
  8757. comprise the logo with neighboring pixels.
  8758. The filter accepts the following options:
  8759. @table @option
  8760. @item filename, f
  8761. Set the filter bitmap file, which can be any image format supported by
  8762. libavformat. The width and height of the image file must match those of the
  8763. video stream being processed.
  8764. @end table
  8765. Pixels in the provided bitmap image with a value of zero are not
  8766. considered part of the logo, non-zero pixels are considered part of
  8767. the logo. If you use white (255) for the logo and black (0) for the
  8768. rest, you will be safe. For making the filter bitmap, it is
  8769. recommended to take a screen capture of a black frame with the logo
  8770. visible, and then using a threshold filter followed by the erode
  8771. filter once or twice.
  8772. If needed, little splotches can be fixed manually. Remember that if
  8773. logo pixels are not covered, the filter quality will be much
  8774. reduced. Marking too many pixels as part of the logo does not hurt as
  8775. much, but it will increase the amount of blurring needed to cover over
  8776. the image and will destroy more information than necessary, and extra
  8777. pixels will slow things down on a large logo.
  8778. @section repeatfields
  8779. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8780. fields based on its value.
  8781. @section reverse
  8782. Reverse a video clip.
  8783. Warning: This filter requires memory to buffer the entire clip, so trimming
  8784. is suggested.
  8785. @subsection Examples
  8786. @itemize
  8787. @item
  8788. Take the first 5 seconds of a clip, and reverse it.
  8789. @example
  8790. trim=end=5,reverse
  8791. @end example
  8792. @end itemize
  8793. @section rotate
  8794. Rotate video by an arbitrary angle expressed in radians.
  8795. The filter accepts the following options:
  8796. A description of the optional parameters follows.
  8797. @table @option
  8798. @item angle, a
  8799. Set an expression for the angle by which to rotate the input video
  8800. clockwise, expressed as a number of radians. A negative value will
  8801. result in a counter-clockwise rotation. By default it is set to "0".
  8802. This expression is evaluated for each frame.
  8803. @item out_w, ow
  8804. Set the output width expression, default value is "iw".
  8805. This expression is evaluated just once during configuration.
  8806. @item out_h, oh
  8807. Set the output height expression, default value is "ih".
  8808. This expression is evaluated just once during configuration.
  8809. @item bilinear
  8810. Enable bilinear interpolation if set to 1, a value of 0 disables
  8811. it. Default value is 1.
  8812. @item fillcolor, c
  8813. Set the color used to fill the output area not covered by the rotated
  8814. image. For the general syntax of this option, check the "Color" section in the
  8815. ffmpeg-utils manual. If the special value "none" is selected then no
  8816. background is printed (useful for example if the background is never shown).
  8817. Default value is "black".
  8818. @end table
  8819. The expressions for the angle and the output size can contain the
  8820. following constants and functions:
  8821. @table @option
  8822. @item n
  8823. sequential number of the input frame, starting from 0. It is always NAN
  8824. before the first frame is filtered.
  8825. @item t
  8826. time in seconds of the input frame, it is set to 0 when the filter is
  8827. configured. It is always NAN before the first frame is filtered.
  8828. @item hsub
  8829. @item vsub
  8830. horizontal and vertical chroma subsample values. For example for the
  8831. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8832. @item in_w, iw
  8833. @item in_h, ih
  8834. the input video width and height
  8835. @item out_w, ow
  8836. @item out_h, oh
  8837. the output width and height, that is the size of the padded area as
  8838. specified by the @var{width} and @var{height} expressions
  8839. @item rotw(a)
  8840. @item roth(a)
  8841. the minimal width/height required for completely containing the input
  8842. video rotated by @var{a} radians.
  8843. These are only available when computing the @option{out_w} and
  8844. @option{out_h} expressions.
  8845. @end table
  8846. @subsection Examples
  8847. @itemize
  8848. @item
  8849. Rotate the input by PI/6 radians clockwise:
  8850. @example
  8851. rotate=PI/6
  8852. @end example
  8853. @item
  8854. Rotate the input by PI/6 radians counter-clockwise:
  8855. @example
  8856. rotate=-PI/6
  8857. @end example
  8858. @item
  8859. Rotate the input by 45 degrees clockwise:
  8860. @example
  8861. rotate=45*PI/180
  8862. @end example
  8863. @item
  8864. Apply a constant rotation with period T, starting from an angle of PI/3:
  8865. @example
  8866. rotate=PI/3+2*PI*t/T
  8867. @end example
  8868. @item
  8869. Make the input video rotation oscillating with a period of T
  8870. seconds and an amplitude of A radians:
  8871. @example
  8872. rotate=A*sin(2*PI/T*t)
  8873. @end example
  8874. @item
  8875. Rotate the video, output size is chosen so that the whole rotating
  8876. input video is always completely contained in the output:
  8877. @example
  8878. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8879. @end example
  8880. @item
  8881. Rotate the video, reduce the output size so that no background is ever
  8882. shown:
  8883. @example
  8884. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8885. @end example
  8886. @end itemize
  8887. @subsection Commands
  8888. The filter supports the following commands:
  8889. @table @option
  8890. @item a, angle
  8891. Set the angle expression.
  8892. The command accepts the same syntax of the corresponding option.
  8893. If the specified expression is not valid, it is kept at its current
  8894. value.
  8895. @end table
  8896. @section sab
  8897. Apply Shape Adaptive Blur.
  8898. The filter accepts the following options:
  8899. @table @option
  8900. @item luma_radius, lr
  8901. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8902. value is 1.0. A greater value will result in a more blurred image, and
  8903. in slower processing.
  8904. @item luma_pre_filter_radius, lpfr
  8905. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8906. value is 1.0.
  8907. @item luma_strength, ls
  8908. Set luma maximum difference between pixels to still be considered, must
  8909. be a value in the 0.1-100.0 range, default value is 1.0.
  8910. @item chroma_radius, cr
  8911. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  8912. greater value will result in a more blurred image, and in slower
  8913. processing.
  8914. @item chroma_pre_filter_radius, cpfr
  8915. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  8916. @item chroma_strength, cs
  8917. Set chroma maximum difference between pixels to still be considered,
  8918. must be a value in the -0.9-100.0 range.
  8919. @end table
  8920. Each chroma option value, if not explicitly specified, is set to the
  8921. corresponding luma option value.
  8922. @anchor{scale}
  8923. @section scale
  8924. Scale (resize) the input video, using the libswscale library.
  8925. The scale filter forces the output display aspect ratio to be the same
  8926. of the input, by changing the output sample aspect ratio.
  8927. If the input image format is different from the format requested by
  8928. the next filter, the scale filter will convert the input to the
  8929. requested format.
  8930. @subsection Options
  8931. The filter accepts the following options, or any of the options
  8932. supported by the libswscale scaler.
  8933. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8934. the complete list of scaler options.
  8935. @table @option
  8936. @item width, w
  8937. @item height, h
  8938. Set the output video dimension expression. Default value is the input
  8939. dimension.
  8940. If the value is 0, the input width is used for the output.
  8941. If one of the values is -1, the scale filter will use a value that
  8942. maintains the aspect ratio of the input image, calculated from the
  8943. other specified dimension. If both of them are -1, the input size is
  8944. used
  8945. If one of the values is -n with n > 1, the scale filter will also use a value
  8946. that maintains the aspect ratio of the input image, calculated from the other
  8947. specified dimension. After that it will, however, make sure that the calculated
  8948. dimension is divisible by n and adjust the value if necessary.
  8949. See below for the list of accepted constants for use in the dimension
  8950. expression.
  8951. @item eval
  8952. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8953. @table @samp
  8954. @item init
  8955. Only evaluate expressions once during the filter initialization or when a command is processed.
  8956. @item frame
  8957. Evaluate expressions for each incoming frame.
  8958. @end table
  8959. Default value is @samp{init}.
  8960. @item interl
  8961. Set the interlacing mode. It accepts the following values:
  8962. @table @samp
  8963. @item 1
  8964. Force interlaced aware scaling.
  8965. @item 0
  8966. Do not apply interlaced scaling.
  8967. @item -1
  8968. Select interlaced aware scaling depending on whether the source frames
  8969. are flagged as interlaced or not.
  8970. @end table
  8971. Default value is @samp{0}.
  8972. @item flags
  8973. Set libswscale scaling flags. See
  8974. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8975. complete list of values. If not explicitly specified the filter applies
  8976. the default flags.
  8977. @item param0, param1
  8978. Set libswscale input parameters for scaling algorithms that need them. See
  8979. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8980. complete documentation. If not explicitly specified the filter applies
  8981. empty parameters.
  8982. @item size, s
  8983. Set the video size. For the syntax of this option, check the
  8984. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8985. @item in_color_matrix
  8986. @item out_color_matrix
  8987. Set in/output YCbCr color space type.
  8988. This allows the autodetected value to be overridden as well as allows forcing
  8989. a specific value used for the output and encoder.
  8990. If not specified, the color space type depends on the pixel format.
  8991. Possible values:
  8992. @table @samp
  8993. @item auto
  8994. Choose automatically.
  8995. @item bt709
  8996. Format conforming to International Telecommunication Union (ITU)
  8997. Recommendation BT.709.
  8998. @item fcc
  8999. Set color space conforming to the United States Federal Communications
  9000. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9001. @item bt601
  9002. Set color space conforming to:
  9003. @itemize
  9004. @item
  9005. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9006. @item
  9007. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9008. @item
  9009. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9010. @end itemize
  9011. @item smpte240m
  9012. Set color space conforming to SMPTE ST 240:1999.
  9013. @end table
  9014. @item in_range
  9015. @item out_range
  9016. Set in/output YCbCr sample range.
  9017. This allows the autodetected value to be overridden as well as allows forcing
  9018. a specific value used for the output and encoder. If not specified, the
  9019. range depends on the pixel format. Possible values:
  9020. @table @samp
  9021. @item auto
  9022. Choose automatically.
  9023. @item jpeg/full/pc
  9024. Set full range (0-255 in case of 8-bit luma).
  9025. @item mpeg/tv
  9026. Set "MPEG" range (16-235 in case of 8-bit luma).
  9027. @end table
  9028. @item force_original_aspect_ratio
  9029. Enable decreasing or increasing output video width or height if necessary to
  9030. keep the original aspect ratio. Possible values:
  9031. @table @samp
  9032. @item disable
  9033. Scale the video as specified and disable this feature.
  9034. @item decrease
  9035. The output video dimensions will automatically be decreased if needed.
  9036. @item increase
  9037. The output video dimensions will automatically be increased if needed.
  9038. @end table
  9039. One useful instance of this option is that when you know a specific device's
  9040. maximum allowed resolution, you can use this to limit the output video to
  9041. that, while retaining the aspect ratio. For example, device A allows
  9042. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9043. decrease) and specifying 1280x720 to the command line makes the output
  9044. 1280x533.
  9045. Please note that this is a different thing than specifying -1 for @option{w}
  9046. or @option{h}, you still need to specify the output resolution for this option
  9047. to work.
  9048. @end table
  9049. The values of the @option{w} and @option{h} options are expressions
  9050. containing the following constants:
  9051. @table @var
  9052. @item in_w
  9053. @item in_h
  9054. The input width and height
  9055. @item iw
  9056. @item ih
  9057. These are the same as @var{in_w} and @var{in_h}.
  9058. @item out_w
  9059. @item out_h
  9060. The output (scaled) width and height
  9061. @item ow
  9062. @item oh
  9063. These are the same as @var{out_w} and @var{out_h}
  9064. @item a
  9065. The same as @var{iw} / @var{ih}
  9066. @item sar
  9067. input sample aspect ratio
  9068. @item dar
  9069. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9070. @item hsub
  9071. @item vsub
  9072. horizontal and vertical input chroma subsample values. For example for the
  9073. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9074. @item ohsub
  9075. @item ovsub
  9076. horizontal and vertical output chroma subsample values. For example for the
  9077. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9078. @end table
  9079. @subsection Examples
  9080. @itemize
  9081. @item
  9082. Scale the input video to a size of 200x100
  9083. @example
  9084. scale=w=200:h=100
  9085. @end example
  9086. This is equivalent to:
  9087. @example
  9088. scale=200:100
  9089. @end example
  9090. or:
  9091. @example
  9092. scale=200x100
  9093. @end example
  9094. @item
  9095. Specify a size abbreviation for the output size:
  9096. @example
  9097. scale=qcif
  9098. @end example
  9099. which can also be written as:
  9100. @example
  9101. scale=size=qcif
  9102. @end example
  9103. @item
  9104. Scale the input to 2x:
  9105. @example
  9106. scale=w=2*iw:h=2*ih
  9107. @end example
  9108. @item
  9109. The above is the same as:
  9110. @example
  9111. scale=2*in_w:2*in_h
  9112. @end example
  9113. @item
  9114. Scale the input to 2x with forced interlaced scaling:
  9115. @example
  9116. scale=2*iw:2*ih:interl=1
  9117. @end example
  9118. @item
  9119. Scale the input to half size:
  9120. @example
  9121. scale=w=iw/2:h=ih/2
  9122. @end example
  9123. @item
  9124. Increase the width, and set the height to the same size:
  9125. @example
  9126. scale=3/2*iw:ow
  9127. @end example
  9128. @item
  9129. Seek Greek harmony:
  9130. @example
  9131. scale=iw:1/PHI*iw
  9132. scale=ih*PHI:ih
  9133. @end example
  9134. @item
  9135. Increase the height, and set the width to 3/2 of the height:
  9136. @example
  9137. scale=w=3/2*oh:h=3/5*ih
  9138. @end example
  9139. @item
  9140. Increase the size, making the size a multiple of the chroma
  9141. subsample values:
  9142. @example
  9143. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9144. @end example
  9145. @item
  9146. Increase the width to a maximum of 500 pixels,
  9147. keeping the same aspect ratio as the input:
  9148. @example
  9149. scale=w='min(500\, iw*3/2):h=-1'
  9150. @end example
  9151. @end itemize
  9152. @subsection Commands
  9153. This filter supports the following commands:
  9154. @table @option
  9155. @item width, w
  9156. @item height, h
  9157. Set the output video dimension expression.
  9158. The command accepts the same syntax of the corresponding option.
  9159. If the specified expression is not valid, it is kept at its current
  9160. value.
  9161. @end table
  9162. @section scale_npp
  9163. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9164. format conversion on CUDA video frames. Setting the output width and height
  9165. works in the same way as for the @var{scale} filter.
  9166. The following additional options are accepted:
  9167. @table @option
  9168. @item format
  9169. The pixel format of the output CUDA frames. If set to the string "same" (the
  9170. default), the input format will be kept. Note that automatic format negotiation
  9171. and conversion is not yet supported for hardware frames
  9172. @item interp_algo
  9173. The interpolation algorithm used for resizing. One of the following:
  9174. @table @option
  9175. @item nn
  9176. Nearest neighbour.
  9177. @item linear
  9178. @item cubic
  9179. @item cubic2p_bspline
  9180. 2-parameter cubic (B=1, C=0)
  9181. @item cubic2p_catmullrom
  9182. 2-parameter cubic (B=0, C=1/2)
  9183. @item cubic2p_b05c03
  9184. 2-parameter cubic (B=1/2, C=3/10)
  9185. @item super
  9186. Supersampling
  9187. @item lanczos
  9188. @end table
  9189. @end table
  9190. @section scale2ref
  9191. Scale (resize) the input video, based on a reference video.
  9192. See the scale filter for available options, scale2ref supports the same but
  9193. uses the reference video instead of the main input as basis.
  9194. @subsection Examples
  9195. @itemize
  9196. @item
  9197. Scale a subtitle stream to match the main video in size before overlaying
  9198. @example
  9199. 'scale2ref[b][a];[a][b]overlay'
  9200. @end example
  9201. @end itemize
  9202. @anchor{selectivecolor}
  9203. @section selectivecolor
  9204. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9205. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9206. by the "purity" of the color (that is, how saturated it already is).
  9207. This filter is similar to the Adobe Photoshop Selective Color tool.
  9208. The filter accepts the following options:
  9209. @table @option
  9210. @item correction_method
  9211. Select color correction method.
  9212. Available values are:
  9213. @table @samp
  9214. @item absolute
  9215. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9216. component value).
  9217. @item relative
  9218. Specified adjustments are relative to the original component value.
  9219. @end table
  9220. Default is @code{absolute}.
  9221. @item reds
  9222. Adjustments for red pixels (pixels where the red component is the maximum)
  9223. @item yellows
  9224. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9225. @item greens
  9226. Adjustments for green pixels (pixels where the green component is the maximum)
  9227. @item cyans
  9228. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9229. @item blues
  9230. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9231. @item magentas
  9232. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9233. @item whites
  9234. Adjustments for white pixels (pixels where all components are greater than 128)
  9235. @item neutrals
  9236. Adjustments for all pixels except pure black and pure white
  9237. @item blacks
  9238. Adjustments for black pixels (pixels where all components are lesser than 128)
  9239. @item psfile
  9240. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9241. @end table
  9242. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9243. 4 space separated floating point adjustment values in the [-1,1] range,
  9244. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9245. pixels of its range.
  9246. @subsection Examples
  9247. @itemize
  9248. @item
  9249. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9250. increase magenta by 27% in blue areas:
  9251. @example
  9252. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9253. @end example
  9254. @item
  9255. Use a Photoshop selective color preset:
  9256. @example
  9257. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9258. @end example
  9259. @end itemize
  9260. @anchor{separatefields}
  9261. @section separatefields
  9262. The @code{separatefields} takes a frame-based video input and splits
  9263. each frame into its components fields, producing a new half height clip
  9264. with twice the frame rate and twice the frame count.
  9265. This filter use field-dominance information in frame to decide which
  9266. of each pair of fields to place first in the output.
  9267. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9268. @section setdar, setsar
  9269. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9270. output video.
  9271. This is done by changing the specified Sample (aka Pixel) Aspect
  9272. Ratio, according to the following equation:
  9273. @example
  9274. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9275. @end example
  9276. Keep in mind that the @code{setdar} filter does not modify the pixel
  9277. dimensions of the video frame. Also, the display aspect ratio set by
  9278. this filter may be changed by later filters in the filterchain,
  9279. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9280. applied.
  9281. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9282. the filter output video.
  9283. Note that as a consequence of the application of this filter, the
  9284. output display aspect ratio will change according to the equation
  9285. above.
  9286. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9287. filter may be changed by later filters in the filterchain, e.g. if
  9288. another "setsar" or a "setdar" filter is applied.
  9289. It accepts the following parameters:
  9290. @table @option
  9291. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9292. Set the aspect ratio used by the filter.
  9293. The parameter can be a floating point number string, an expression, or
  9294. a string of the form @var{num}:@var{den}, where @var{num} and
  9295. @var{den} are the numerator and denominator of the aspect ratio. If
  9296. the parameter is not specified, it is assumed the value "0".
  9297. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9298. should be escaped.
  9299. @item max
  9300. Set the maximum integer value to use for expressing numerator and
  9301. denominator when reducing the expressed aspect ratio to a rational.
  9302. Default value is @code{100}.
  9303. @end table
  9304. The parameter @var{sar} is an expression containing
  9305. the following constants:
  9306. @table @option
  9307. @item E, PI, PHI
  9308. These are approximated values for the mathematical constants e
  9309. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9310. @item w, h
  9311. The input width and height.
  9312. @item a
  9313. These are the same as @var{w} / @var{h}.
  9314. @item sar
  9315. The input sample aspect ratio.
  9316. @item dar
  9317. The input display aspect ratio. It is the same as
  9318. (@var{w} / @var{h}) * @var{sar}.
  9319. @item hsub, vsub
  9320. Horizontal and vertical chroma subsample values. For example, for the
  9321. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9322. @end table
  9323. @subsection Examples
  9324. @itemize
  9325. @item
  9326. To change the display aspect ratio to 16:9, specify one of the following:
  9327. @example
  9328. setdar=dar=1.77777
  9329. setdar=dar=16/9
  9330. @end example
  9331. @item
  9332. To change the sample aspect ratio to 10:11, specify:
  9333. @example
  9334. setsar=sar=10/11
  9335. @end example
  9336. @item
  9337. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9338. 1000 in the aspect ratio reduction, use the command:
  9339. @example
  9340. setdar=ratio=16/9:max=1000
  9341. @end example
  9342. @end itemize
  9343. @anchor{setfield}
  9344. @section setfield
  9345. Force field for the output video frame.
  9346. The @code{setfield} filter marks the interlace type field for the
  9347. output frames. It does not change the input frame, but only sets the
  9348. corresponding property, which affects how the frame is treated by
  9349. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9350. The filter accepts the following options:
  9351. @table @option
  9352. @item mode
  9353. Available values are:
  9354. @table @samp
  9355. @item auto
  9356. Keep the same field property.
  9357. @item bff
  9358. Mark the frame as bottom-field-first.
  9359. @item tff
  9360. Mark the frame as top-field-first.
  9361. @item prog
  9362. Mark the frame as progressive.
  9363. @end table
  9364. @end table
  9365. @section showinfo
  9366. Show a line containing various information for each input video frame.
  9367. The input video is not modified.
  9368. The shown line contains a sequence of key/value pairs of the form
  9369. @var{key}:@var{value}.
  9370. The following values are shown in the output:
  9371. @table @option
  9372. @item n
  9373. The (sequential) number of the input frame, starting from 0.
  9374. @item pts
  9375. The Presentation TimeStamp of the input frame, expressed as a number of
  9376. time base units. The time base unit depends on the filter input pad.
  9377. @item pts_time
  9378. The Presentation TimeStamp of the input frame, expressed as a number of
  9379. seconds.
  9380. @item pos
  9381. The position of the frame in the input stream, or -1 if this information is
  9382. unavailable and/or meaningless (for example in case of synthetic video).
  9383. @item fmt
  9384. The pixel format name.
  9385. @item sar
  9386. The sample aspect ratio of the input frame, expressed in the form
  9387. @var{num}/@var{den}.
  9388. @item s
  9389. The size of the input frame. For the syntax of this option, check the
  9390. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9391. @item i
  9392. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9393. for bottom field first).
  9394. @item iskey
  9395. This is 1 if the frame is a key frame, 0 otherwise.
  9396. @item type
  9397. The picture type of the input frame ("I" for an I-frame, "P" for a
  9398. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9399. Also refer to the documentation of the @code{AVPictureType} enum and of
  9400. the @code{av_get_picture_type_char} function defined in
  9401. @file{libavutil/avutil.h}.
  9402. @item checksum
  9403. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9404. @item plane_checksum
  9405. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9406. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9407. @end table
  9408. @section showpalette
  9409. Displays the 256 colors palette of each frame. This filter is only relevant for
  9410. @var{pal8} pixel format frames.
  9411. It accepts the following option:
  9412. @table @option
  9413. @item s
  9414. Set the size of the box used to represent one palette color entry. Default is
  9415. @code{30} (for a @code{30x30} pixel box).
  9416. @end table
  9417. @section shuffleframes
  9418. Reorder and/or duplicate video frames.
  9419. It accepts the following parameters:
  9420. @table @option
  9421. @item mapping
  9422. Set the destination indexes of input frames.
  9423. This is space or '|' separated list of indexes that maps input frames to output
  9424. frames. Number of indexes also sets maximal value that each index may have.
  9425. @end table
  9426. The first frame has the index 0. The default is to keep the input unchanged.
  9427. @subsection Examples
  9428. @itemize
  9429. @item
  9430. Swap second and third frame of every three frames of the input:
  9431. @example
  9432. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9433. @end example
  9434. @item
  9435. Swap 10th and 1st frame of every ten frames of the input:
  9436. @example
  9437. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  9438. @end example
  9439. @end itemize
  9440. @section shuffleplanes
  9441. Reorder and/or duplicate video planes.
  9442. It accepts the following parameters:
  9443. @table @option
  9444. @item map0
  9445. The index of the input plane to be used as the first output plane.
  9446. @item map1
  9447. The index of the input plane to be used as the second output plane.
  9448. @item map2
  9449. The index of the input plane to be used as the third output plane.
  9450. @item map3
  9451. The index of the input plane to be used as the fourth output plane.
  9452. @end table
  9453. The first plane has the index 0. The default is to keep the input unchanged.
  9454. @subsection Examples
  9455. @itemize
  9456. @item
  9457. Swap the second and third planes of the input:
  9458. @example
  9459. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9460. @end example
  9461. @end itemize
  9462. @anchor{signalstats}
  9463. @section signalstats
  9464. Evaluate various visual metrics that assist in determining issues associated
  9465. with the digitization of analog video media.
  9466. By default the filter will log these metadata values:
  9467. @table @option
  9468. @item YMIN
  9469. Display the minimal Y value contained within the input frame. Expressed in
  9470. range of [0-255].
  9471. @item YLOW
  9472. Display the Y value at the 10% percentile within the input frame. Expressed in
  9473. range of [0-255].
  9474. @item YAVG
  9475. Display the average Y value within the input frame. Expressed in range of
  9476. [0-255].
  9477. @item YHIGH
  9478. Display the Y value at the 90% percentile within the input frame. Expressed in
  9479. range of [0-255].
  9480. @item YMAX
  9481. Display the maximum Y value contained within the input frame. Expressed in
  9482. range of [0-255].
  9483. @item UMIN
  9484. Display the minimal U value contained within the input frame. Expressed in
  9485. range of [0-255].
  9486. @item ULOW
  9487. Display the U value at the 10% percentile within the input frame. Expressed in
  9488. range of [0-255].
  9489. @item UAVG
  9490. Display the average U value within the input frame. Expressed in range of
  9491. [0-255].
  9492. @item UHIGH
  9493. Display the U value at the 90% percentile within the input frame. Expressed in
  9494. range of [0-255].
  9495. @item UMAX
  9496. Display the maximum U value contained within the input frame. Expressed in
  9497. range of [0-255].
  9498. @item VMIN
  9499. Display the minimal V value contained within the input frame. Expressed in
  9500. range of [0-255].
  9501. @item VLOW
  9502. Display the V value at the 10% percentile within the input frame. Expressed in
  9503. range of [0-255].
  9504. @item VAVG
  9505. Display the average V value within the input frame. Expressed in range of
  9506. [0-255].
  9507. @item VHIGH
  9508. Display the V value at the 90% percentile within the input frame. Expressed in
  9509. range of [0-255].
  9510. @item VMAX
  9511. Display the maximum V value contained within the input frame. Expressed in
  9512. range of [0-255].
  9513. @item SATMIN
  9514. Display the minimal saturation value contained within the input frame.
  9515. Expressed in range of [0-~181.02].
  9516. @item SATLOW
  9517. Display the saturation value at the 10% percentile within the input frame.
  9518. Expressed in range of [0-~181.02].
  9519. @item SATAVG
  9520. Display the average saturation value within the input frame. Expressed in range
  9521. of [0-~181.02].
  9522. @item SATHIGH
  9523. Display the saturation value at the 90% percentile within the input frame.
  9524. Expressed in range of [0-~181.02].
  9525. @item SATMAX
  9526. Display the maximum saturation value contained within the input frame.
  9527. Expressed in range of [0-~181.02].
  9528. @item HUEMED
  9529. Display the median value for hue within the input frame. Expressed in range of
  9530. [0-360].
  9531. @item HUEAVG
  9532. Display the average value for hue within the input frame. Expressed in range of
  9533. [0-360].
  9534. @item YDIF
  9535. Display the average of sample value difference between all values of the Y
  9536. plane in the current frame and corresponding values of the previous input frame.
  9537. Expressed in range of [0-255].
  9538. @item UDIF
  9539. Display the average of sample value difference between all values of the U
  9540. plane in the current frame and corresponding values of the previous input frame.
  9541. Expressed in range of [0-255].
  9542. @item VDIF
  9543. Display the average of sample value difference between all values of the V
  9544. plane in the current frame and corresponding values of the previous input frame.
  9545. Expressed in range of [0-255].
  9546. @item YBITDEPTH
  9547. Display bit depth of Y plane in current frame.
  9548. Expressed in range of [0-16].
  9549. @item UBITDEPTH
  9550. Display bit depth of U plane in current frame.
  9551. Expressed in range of [0-16].
  9552. @item VBITDEPTH
  9553. Display bit depth of V plane in current frame.
  9554. Expressed in range of [0-16].
  9555. @end table
  9556. The filter accepts the following options:
  9557. @table @option
  9558. @item stat
  9559. @item out
  9560. @option{stat} specify an additional form of image analysis.
  9561. @option{out} output video with the specified type of pixel highlighted.
  9562. Both options accept the following values:
  9563. @table @samp
  9564. @item tout
  9565. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9566. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9567. include the results of video dropouts, head clogs, or tape tracking issues.
  9568. @item vrep
  9569. Identify @var{vertical line repetition}. Vertical line repetition includes
  9570. similar rows of pixels within a frame. In born-digital video vertical line
  9571. repetition is common, but this pattern is uncommon in video digitized from an
  9572. analog source. When it occurs in video that results from the digitization of an
  9573. analog source it can indicate concealment from a dropout compensator.
  9574. @item brng
  9575. Identify pixels that fall outside of legal broadcast range.
  9576. @end table
  9577. @item color, c
  9578. Set the highlight color for the @option{out} option. The default color is
  9579. yellow.
  9580. @end table
  9581. @subsection Examples
  9582. @itemize
  9583. @item
  9584. Output data of various video metrics:
  9585. @example
  9586. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9587. @end example
  9588. @item
  9589. Output specific data about the minimum and maximum values of the Y plane per frame:
  9590. @example
  9591. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9592. @end example
  9593. @item
  9594. Playback video while highlighting pixels that are outside of broadcast range in red.
  9595. @example
  9596. ffplay example.mov -vf signalstats="out=brng:color=red"
  9597. @end example
  9598. @item
  9599. Playback video with signalstats metadata drawn over the frame.
  9600. @example
  9601. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9602. @end example
  9603. The contents of signalstat_drawtext.txt used in the command are:
  9604. @example
  9605. time %@{pts:hms@}
  9606. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9607. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9608. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9609. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9610. @end example
  9611. @end itemize
  9612. @anchor{smartblur}
  9613. @section smartblur
  9614. Blur the input video without impacting the outlines.
  9615. It accepts the following options:
  9616. @table @option
  9617. @item luma_radius, lr
  9618. Set the luma radius. The option value must be a float number in
  9619. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9620. used to blur the image (slower if larger). Default value is 1.0.
  9621. @item luma_strength, ls
  9622. Set the luma strength. The option value must be a float number
  9623. in the range [-1.0,1.0] that configures the blurring. A value included
  9624. in [0.0,1.0] will blur the image whereas a value included in
  9625. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9626. @item luma_threshold, lt
  9627. Set the luma threshold used as a coefficient to determine
  9628. whether a pixel should be blurred or not. The option value must be an
  9629. integer in the range [-30,30]. A value of 0 will filter all the image,
  9630. a value included in [0,30] will filter flat areas and a value included
  9631. in [-30,0] will filter edges. Default value is 0.
  9632. @item chroma_radius, cr
  9633. Set the chroma radius. The option value must be a float number in
  9634. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9635. used to blur the image (slower if larger). Default value is 1.0.
  9636. @item chroma_strength, cs
  9637. Set the chroma strength. The option value must be a float number
  9638. in the range [-1.0,1.0] that configures the blurring. A value included
  9639. in [0.0,1.0] will blur the image whereas a value included in
  9640. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9641. @item chroma_threshold, ct
  9642. Set the chroma threshold used as a coefficient to determine
  9643. whether a pixel should be blurred or not. The option value must be an
  9644. integer in the range [-30,30]. A value of 0 will filter all the image,
  9645. a value included in [0,30] will filter flat areas and a value included
  9646. in [-30,0] will filter edges. Default value is 0.
  9647. @end table
  9648. If a chroma option is not explicitly set, the corresponding luma value
  9649. is set.
  9650. @section ssim
  9651. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9652. This filter takes in input two input videos, the first input is
  9653. considered the "main" source and is passed unchanged to the
  9654. output. The second input is used as a "reference" video for computing
  9655. the SSIM.
  9656. Both video inputs must have the same resolution and pixel format for
  9657. this filter to work correctly. Also it assumes that both inputs
  9658. have the same number of frames, which are compared one by one.
  9659. The filter stores the calculated SSIM of each frame.
  9660. The description of the accepted parameters follows.
  9661. @table @option
  9662. @item stats_file, f
  9663. If specified the filter will use the named file to save the SSIM of
  9664. each individual frame. When filename equals "-" the data is sent to
  9665. standard output.
  9666. @end table
  9667. The file printed if @var{stats_file} is selected, contains a sequence of
  9668. key/value pairs of the form @var{key}:@var{value} for each compared
  9669. couple of frames.
  9670. A description of each shown parameter follows:
  9671. @table @option
  9672. @item n
  9673. sequential number of the input frame, starting from 1
  9674. @item Y, U, V, R, G, B
  9675. SSIM of the compared frames for the component specified by the suffix.
  9676. @item All
  9677. SSIM of the compared frames for the whole frame.
  9678. @item dB
  9679. Same as above but in dB representation.
  9680. @end table
  9681. For example:
  9682. @example
  9683. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9684. [main][ref] ssim="stats_file=stats.log" [out]
  9685. @end example
  9686. On this example the input file being processed is compared with the
  9687. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9688. is stored in @file{stats.log}.
  9689. Another example with both psnr and ssim at same time:
  9690. @example
  9691. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9692. @end example
  9693. @section stereo3d
  9694. Convert between different stereoscopic image formats.
  9695. The filters accept the following options:
  9696. @table @option
  9697. @item in
  9698. Set stereoscopic image format of input.
  9699. Available values for input image formats are:
  9700. @table @samp
  9701. @item sbsl
  9702. side by side parallel (left eye left, right eye right)
  9703. @item sbsr
  9704. side by side crosseye (right eye left, left eye right)
  9705. @item sbs2l
  9706. side by side parallel with half width resolution
  9707. (left eye left, right eye right)
  9708. @item sbs2r
  9709. side by side crosseye with half width resolution
  9710. (right eye left, left eye right)
  9711. @item abl
  9712. above-below (left eye above, right eye below)
  9713. @item abr
  9714. above-below (right eye above, left eye below)
  9715. @item ab2l
  9716. above-below with half height resolution
  9717. (left eye above, right eye below)
  9718. @item ab2r
  9719. above-below with half height resolution
  9720. (right eye above, left eye below)
  9721. @item al
  9722. alternating frames (left eye first, right eye second)
  9723. @item ar
  9724. alternating frames (right eye first, left eye second)
  9725. @item irl
  9726. interleaved rows (left eye has top row, right eye starts on next row)
  9727. @item irr
  9728. interleaved rows (right eye has top row, left eye starts on next row)
  9729. @item icl
  9730. interleaved columns, left eye first
  9731. @item icr
  9732. interleaved columns, right eye first
  9733. Default value is @samp{sbsl}.
  9734. @end table
  9735. @item out
  9736. Set stereoscopic image format of output.
  9737. @table @samp
  9738. @item sbsl
  9739. side by side parallel (left eye left, right eye right)
  9740. @item sbsr
  9741. side by side crosseye (right eye left, left eye right)
  9742. @item sbs2l
  9743. side by side parallel with half width resolution
  9744. (left eye left, right eye right)
  9745. @item sbs2r
  9746. side by side crosseye with half width resolution
  9747. (right eye left, left eye right)
  9748. @item abl
  9749. above-below (left eye above, right eye below)
  9750. @item abr
  9751. above-below (right eye above, left eye below)
  9752. @item ab2l
  9753. above-below with half height resolution
  9754. (left eye above, right eye below)
  9755. @item ab2r
  9756. above-below with half height resolution
  9757. (right eye above, left eye below)
  9758. @item al
  9759. alternating frames (left eye first, right eye second)
  9760. @item ar
  9761. alternating frames (right eye first, left eye second)
  9762. @item irl
  9763. interleaved rows (left eye has top row, right eye starts on next row)
  9764. @item irr
  9765. interleaved rows (right eye has top row, left eye starts on next row)
  9766. @item arbg
  9767. anaglyph red/blue gray
  9768. (red filter on left eye, blue filter on right eye)
  9769. @item argg
  9770. anaglyph red/green gray
  9771. (red filter on left eye, green filter on right eye)
  9772. @item arcg
  9773. anaglyph red/cyan gray
  9774. (red filter on left eye, cyan filter on right eye)
  9775. @item arch
  9776. anaglyph red/cyan half colored
  9777. (red filter on left eye, cyan filter on right eye)
  9778. @item arcc
  9779. anaglyph red/cyan color
  9780. (red filter on left eye, cyan filter on right eye)
  9781. @item arcd
  9782. anaglyph red/cyan color optimized with the least squares projection of dubois
  9783. (red filter on left eye, cyan filter on right eye)
  9784. @item agmg
  9785. anaglyph green/magenta gray
  9786. (green filter on left eye, magenta filter on right eye)
  9787. @item agmh
  9788. anaglyph green/magenta half colored
  9789. (green filter on left eye, magenta filter on right eye)
  9790. @item agmc
  9791. anaglyph green/magenta colored
  9792. (green filter on left eye, magenta filter on right eye)
  9793. @item agmd
  9794. anaglyph green/magenta color optimized with the least squares projection of dubois
  9795. (green filter on left eye, magenta filter on right eye)
  9796. @item aybg
  9797. anaglyph yellow/blue gray
  9798. (yellow filter on left eye, blue filter on right eye)
  9799. @item aybh
  9800. anaglyph yellow/blue half colored
  9801. (yellow filter on left eye, blue filter on right eye)
  9802. @item aybc
  9803. anaglyph yellow/blue colored
  9804. (yellow filter on left eye, blue filter on right eye)
  9805. @item aybd
  9806. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9807. (yellow filter on left eye, blue filter on right eye)
  9808. @item ml
  9809. mono output (left eye only)
  9810. @item mr
  9811. mono output (right eye only)
  9812. @item chl
  9813. checkerboard, left eye first
  9814. @item chr
  9815. checkerboard, right eye first
  9816. @item icl
  9817. interleaved columns, left eye first
  9818. @item icr
  9819. interleaved columns, right eye first
  9820. @item hdmi
  9821. HDMI frame pack
  9822. @end table
  9823. Default value is @samp{arcd}.
  9824. @end table
  9825. @subsection Examples
  9826. @itemize
  9827. @item
  9828. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9829. @example
  9830. stereo3d=sbsl:aybd
  9831. @end example
  9832. @item
  9833. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9834. @example
  9835. stereo3d=abl:sbsr
  9836. @end example
  9837. @end itemize
  9838. @section streamselect, astreamselect
  9839. Select video or audio streams.
  9840. The filter accepts the following options:
  9841. @table @option
  9842. @item inputs
  9843. Set number of inputs. Default is 2.
  9844. @item map
  9845. Set input indexes to remap to outputs.
  9846. @end table
  9847. @subsection Commands
  9848. The @code{streamselect} and @code{astreamselect} filter supports the following
  9849. commands:
  9850. @table @option
  9851. @item map
  9852. Set input indexes to remap to outputs.
  9853. @end table
  9854. @subsection Examples
  9855. @itemize
  9856. @item
  9857. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9858. @example
  9859. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9860. @end example
  9861. @item
  9862. Same as above, but for audio:
  9863. @example
  9864. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9865. @end example
  9866. @end itemize
  9867. @section sobel
  9868. Apply sobel operator to input video stream.
  9869. The filter accepts the following option:
  9870. @table @option
  9871. @item planes
  9872. Set which planes will be processed, unprocessed planes will be copied.
  9873. By default value 0xf, all planes will be processed.
  9874. @item scale
  9875. Set value which will be multiplied with filtered result.
  9876. @item delta
  9877. Set value which will be added to filtered result.
  9878. @end table
  9879. @anchor{spp}
  9880. @section spp
  9881. Apply a simple postprocessing filter that compresses and decompresses the image
  9882. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9883. and average the results.
  9884. The filter accepts the following options:
  9885. @table @option
  9886. @item quality
  9887. Set quality. This option defines the number of levels for averaging. It accepts
  9888. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9889. effect. A value of @code{6} means the higher quality. For each increment of
  9890. that value the speed drops by a factor of approximately 2. Default value is
  9891. @code{3}.
  9892. @item qp
  9893. Force a constant quantization parameter. If not set, the filter will use the QP
  9894. from the video stream (if available).
  9895. @item mode
  9896. Set thresholding mode. Available modes are:
  9897. @table @samp
  9898. @item hard
  9899. Set hard thresholding (default).
  9900. @item soft
  9901. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9902. @end table
  9903. @item use_bframe_qp
  9904. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9905. option may cause flicker since the B-Frames have often larger QP. Default is
  9906. @code{0} (not enabled).
  9907. @end table
  9908. @anchor{subtitles}
  9909. @section subtitles
  9910. Draw subtitles on top of input video using the libass library.
  9911. To enable compilation of this filter you need to configure FFmpeg with
  9912. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9913. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9914. Alpha) subtitles format.
  9915. The filter accepts the following options:
  9916. @table @option
  9917. @item filename, f
  9918. Set the filename of the subtitle file to read. It must be specified.
  9919. @item original_size
  9920. Specify the size of the original video, the video for which the ASS file
  9921. was composed. For the syntax of this option, check the
  9922. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9923. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9924. correctly scale the fonts if the aspect ratio has been changed.
  9925. @item fontsdir
  9926. Set a directory path containing fonts that can be used by the filter.
  9927. These fonts will be used in addition to whatever the font provider uses.
  9928. @item charenc
  9929. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9930. useful if not UTF-8.
  9931. @item stream_index, si
  9932. Set subtitles stream index. @code{subtitles} filter only.
  9933. @item force_style
  9934. Override default style or script info parameters of the subtitles. It accepts a
  9935. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9936. @end table
  9937. If the first key is not specified, it is assumed that the first value
  9938. specifies the @option{filename}.
  9939. For example, to render the file @file{sub.srt} on top of the input
  9940. video, use the command:
  9941. @example
  9942. subtitles=sub.srt
  9943. @end example
  9944. which is equivalent to:
  9945. @example
  9946. subtitles=filename=sub.srt
  9947. @end example
  9948. To render the default subtitles stream from file @file{video.mkv}, use:
  9949. @example
  9950. subtitles=video.mkv
  9951. @end example
  9952. To render the second subtitles stream from that file, use:
  9953. @example
  9954. subtitles=video.mkv:si=1
  9955. @end example
  9956. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9957. @code{DejaVu Serif}, use:
  9958. @example
  9959. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9960. @end example
  9961. @section super2xsai
  9962. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9963. Interpolate) pixel art scaling algorithm.
  9964. Useful for enlarging pixel art images without reducing sharpness.
  9965. @section swaprect
  9966. Swap two rectangular objects in video.
  9967. This filter accepts the following options:
  9968. @table @option
  9969. @item w
  9970. Set object width.
  9971. @item h
  9972. Set object height.
  9973. @item x1
  9974. Set 1st rect x coordinate.
  9975. @item y1
  9976. Set 1st rect y coordinate.
  9977. @item x2
  9978. Set 2nd rect x coordinate.
  9979. @item y2
  9980. Set 2nd rect y coordinate.
  9981. All expressions are evaluated once for each frame.
  9982. @end table
  9983. The all options are expressions containing the following constants:
  9984. @table @option
  9985. @item w
  9986. @item h
  9987. The input width and height.
  9988. @item a
  9989. same as @var{w} / @var{h}
  9990. @item sar
  9991. input sample aspect ratio
  9992. @item dar
  9993. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9994. @item n
  9995. The number of the input frame, starting from 0.
  9996. @item t
  9997. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9998. @item pos
  9999. the position in the file of the input frame, NAN if unknown
  10000. @end table
  10001. @section swapuv
  10002. Swap U & V plane.
  10003. @section telecine
  10004. Apply telecine process to the video.
  10005. This filter accepts the following options:
  10006. @table @option
  10007. @item first_field
  10008. @table @samp
  10009. @item top, t
  10010. top field first
  10011. @item bottom, b
  10012. bottom field first
  10013. The default value is @code{top}.
  10014. @end table
  10015. @item pattern
  10016. A string of numbers representing the pulldown pattern you wish to apply.
  10017. The default value is @code{23}.
  10018. @end table
  10019. @example
  10020. Some typical patterns:
  10021. NTSC output (30i):
  10022. 27.5p: 32222
  10023. 24p: 23 (classic)
  10024. 24p: 2332 (preferred)
  10025. 20p: 33
  10026. 18p: 334
  10027. 16p: 3444
  10028. PAL output (25i):
  10029. 27.5p: 12222
  10030. 24p: 222222222223 ("Euro pulldown")
  10031. 16.67p: 33
  10032. 16p: 33333334
  10033. @end example
  10034. @section thumbnail
  10035. Select the most representative frame in a given sequence of consecutive frames.
  10036. The filter accepts the following options:
  10037. @table @option
  10038. @item n
  10039. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10040. will pick one of them, and then handle the next batch of @var{n} frames until
  10041. the end. Default is @code{100}.
  10042. @end table
  10043. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10044. value will result in a higher memory usage, so a high value is not recommended.
  10045. @subsection Examples
  10046. @itemize
  10047. @item
  10048. Extract one picture each 50 frames:
  10049. @example
  10050. thumbnail=50
  10051. @end example
  10052. @item
  10053. Complete example of a thumbnail creation with @command{ffmpeg}:
  10054. @example
  10055. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10056. @end example
  10057. @end itemize
  10058. @section tile
  10059. Tile several successive frames together.
  10060. The filter accepts the following options:
  10061. @table @option
  10062. @item layout
  10063. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10064. this option, check the
  10065. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10066. @item nb_frames
  10067. Set the maximum number of frames to render in the given area. It must be less
  10068. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10069. the area will be used.
  10070. @item margin
  10071. Set the outer border margin in pixels.
  10072. @item padding
  10073. Set the inner border thickness (i.e. the number of pixels between frames). For
  10074. more advanced padding options (such as having different values for the edges),
  10075. refer to the pad video filter.
  10076. @item color
  10077. Specify the color of the unused area. For the syntax of this option, check the
  10078. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10079. is "black".
  10080. @end table
  10081. @subsection Examples
  10082. @itemize
  10083. @item
  10084. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10085. @example
  10086. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10087. @end example
  10088. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10089. duplicating each output frame to accommodate the originally detected frame
  10090. rate.
  10091. @item
  10092. Display @code{5} pictures in an area of @code{3x2} frames,
  10093. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10094. mixed flat and named options:
  10095. @example
  10096. tile=3x2:nb_frames=5:padding=7:margin=2
  10097. @end example
  10098. @end itemize
  10099. @section tinterlace
  10100. Perform various types of temporal field interlacing.
  10101. Frames are counted starting from 1, so the first input frame is
  10102. considered odd.
  10103. The filter accepts the following options:
  10104. @table @option
  10105. @item mode
  10106. Specify the mode of the interlacing. This option can also be specified
  10107. as a value alone. See below for a list of values for this option.
  10108. Available values are:
  10109. @table @samp
  10110. @item merge, 0
  10111. Move odd frames into the upper field, even into the lower field,
  10112. generating a double height frame at half frame rate.
  10113. @example
  10114. ------> time
  10115. Input:
  10116. Frame 1 Frame 2 Frame 3 Frame 4
  10117. 11111 22222 33333 44444
  10118. 11111 22222 33333 44444
  10119. 11111 22222 33333 44444
  10120. 11111 22222 33333 44444
  10121. Output:
  10122. 11111 33333
  10123. 22222 44444
  10124. 11111 33333
  10125. 22222 44444
  10126. 11111 33333
  10127. 22222 44444
  10128. 11111 33333
  10129. 22222 44444
  10130. @end example
  10131. @item drop_even, 1
  10132. Only output odd frames, even frames are dropped, generating a frame with
  10133. unchanged height at half frame rate.
  10134. @example
  10135. ------> time
  10136. Input:
  10137. Frame 1 Frame 2 Frame 3 Frame 4
  10138. 11111 22222 33333 44444
  10139. 11111 22222 33333 44444
  10140. 11111 22222 33333 44444
  10141. 11111 22222 33333 44444
  10142. Output:
  10143. 11111 33333
  10144. 11111 33333
  10145. 11111 33333
  10146. 11111 33333
  10147. @end example
  10148. @item drop_odd, 2
  10149. Only output even frames, odd frames are dropped, generating a frame with
  10150. unchanged height at half frame rate.
  10151. @example
  10152. ------> time
  10153. Input:
  10154. Frame 1 Frame 2 Frame 3 Frame 4
  10155. 11111 22222 33333 44444
  10156. 11111 22222 33333 44444
  10157. 11111 22222 33333 44444
  10158. 11111 22222 33333 44444
  10159. Output:
  10160. 22222 44444
  10161. 22222 44444
  10162. 22222 44444
  10163. 22222 44444
  10164. @end example
  10165. @item pad, 3
  10166. Expand each frame to full height, but pad alternate lines with black,
  10167. generating a frame with double height at the same input frame rate.
  10168. @example
  10169. ------> time
  10170. Input:
  10171. Frame 1 Frame 2 Frame 3 Frame 4
  10172. 11111 22222 33333 44444
  10173. 11111 22222 33333 44444
  10174. 11111 22222 33333 44444
  10175. 11111 22222 33333 44444
  10176. Output:
  10177. 11111 ..... 33333 .....
  10178. ..... 22222 ..... 44444
  10179. 11111 ..... 33333 .....
  10180. ..... 22222 ..... 44444
  10181. 11111 ..... 33333 .....
  10182. ..... 22222 ..... 44444
  10183. 11111 ..... 33333 .....
  10184. ..... 22222 ..... 44444
  10185. @end example
  10186. @item interleave_top, 4
  10187. Interleave the upper field from odd frames with the lower field from
  10188. even frames, generating a frame with unchanged height at half frame rate.
  10189. @example
  10190. ------> time
  10191. Input:
  10192. Frame 1 Frame 2 Frame 3 Frame 4
  10193. 11111<- 22222 33333<- 44444
  10194. 11111 22222<- 33333 44444<-
  10195. 11111<- 22222 33333<- 44444
  10196. 11111 22222<- 33333 44444<-
  10197. Output:
  10198. 11111 33333
  10199. 22222 44444
  10200. 11111 33333
  10201. 22222 44444
  10202. @end example
  10203. @item interleave_bottom, 5
  10204. Interleave the lower field from odd frames with the upper field from
  10205. even frames, generating a frame with unchanged height at half frame rate.
  10206. @example
  10207. ------> time
  10208. Input:
  10209. Frame 1 Frame 2 Frame 3 Frame 4
  10210. 11111 22222<- 33333 44444<-
  10211. 11111<- 22222 33333<- 44444
  10212. 11111 22222<- 33333 44444<-
  10213. 11111<- 22222 33333<- 44444
  10214. Output:
  10215. 22222 44444
  10216. 11111 33333
  10217. 22222 44444
  10218. 11111 33333
  10219. @end example
  10220. @item interlacex2, 6
  10221. Double frame rate with unchanged height. Frames are inserted each
  10222. containing the second temporal field from the previous input frame and
  10223. the first temporal field from the next input frame. This mode relies on
  10224. the top_field_first flag. Useful for interlaced video displays with no
  10225. field synchronisation.
  10226. @example
  10227. ------> time
  10228. Input:
  10229. Frame 1 Frame 2 Frame 3 Frame 4
  10230. 11111 22222 33333 44444
  10231. 11111 22222 33333 44444
  10232. 11111 22222 33333 44444
  10233. 11111 22222 33333 44444
  10234. Output:
  10235. 11111 22222 22222 33333 33333 44444 44444
  10236. 11111 11111 22222 22222 33333 33333 44444
  10237. 11111 22222 22222 33333 33333 44444 44444
  10238. 11111 11111 22222 22222 33333 33333 44444
  10239. @end example
  10240. @item mergex2, 7
  10241. Move odd frames into the upper field, even into the lower field,
  10242. generating a double height frame at same frame rate.
  10243. @example
  10244. ------> time
  10245. Input:
  10246. Frame 1 Frame 2 Frame 3 Frame 4
  10247. 11111 22222 33333 44444
  10248. 11111 22222 33333 44444
  10249. 11111 22222 33333 44444
  10250. 11111 22222 33333 44444
  10251. Output:
  10252. 11111 33333 33333 55555
  10253. 22222 22222 44444 44444
  10254. 11111 33333 33333 55555
  10255. 22222 22222 44444 44444
  10256. 11111 33333 33333 55555
  10257. 22222 22222 44444 44444
  10258. 11111 33333 33333 55555
  10259. 22222 22222 44444 44444
  10260. @end example
  10261. @end table
  10262. Numeric values are deprecated but are accepted for backward
  10263. compatibility reasons.
  10264. Default mode is @code{merge}.
  10265. @item flags
  10266. Specify flags influencing the filter process.
  10267. Available value for @var{flags} is:
  10268. @table @option
  10269. @item low_pass_filter, vlfp
  10270. Enable vertical low-pass filtering in the filter.
  10271. Vertical low-pass filtering is required when creating an interlaced
  10272. destination from a progressive source which contains high-frequency
  10273. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10274. patterning.
  10275. Vertical low-pass filtering can only be enabled for @option{mode}
  10276. @var{interleave_top} and @var{interleave_bottom}.
  10277. @end table
  10278. @end table
  10279. @section transpose
  10280. Transpose rows with columns in the input video and optionally flip it.
  10281. It accepts the following parameters:
  10282. @table @option
  10283. @item dir
  10284. Specify the transposition direction.
  10285. Can assume the following values:
  10286. @table @samp
  10287. @item 0, 4, cclock_flip
  10288. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  10289. @example
  10290. L.R L.l
  10291. . . -> . .
  10292. l.r R.r
  10293. @end example
  10294. @item 1, 5, clock
  10295. Rotate by 90 degrees clockwise, that is:
  10296. @example
  10297. L.R l.L
  10298. . . -> . .
  10299. l.r r.R
  10300. @end example
  10301. @item 2, 6, cclock
  10302. Rotate by 90 degrees counterclockwise, that is:
  10303. @example
  10304. L.R R.r
  10305. . . -> . .
  10306. l.r L.l
  10307. @end example
  10308. @item 3, 7, clock_flip
  10309. Rotate by 90 degrees clockwise and vertically flip, that is:
  10310. @example
  10311. L.R r.R
  10312. . . -> . .
  10313. l.r l.L
  10314. @end example
  10315. @end table
  10316. For values between 4-7, the transposition is only done if the input
  10317. video geometry is portrait and not landscape. These values are
  10318. deprecated, the @code{passthrough} option should be used instead.
  10319. Numerical values are deprecated, and should be dropped in favor of
  10320. symbolic constants.
  10321. @item passthrough
  10322. Do not apply the transposition if the input geometry matches the one
  10323. specified by the specified value. It accepts the following values:
  10324. @table @samp
  10325. @item none
  10326. Always apply transposition.
  10327. @item portrait
  10328. Preserve portrait geometry (when @var{height} >= @var{width}).
  10329. @item landscape
  10330. Preserve landscape geometry (when @var{width} >= @var{height}).
  10331. @end table
  10332. Default value is @code{none}.
  10333. @end table
  10334. For example to rotate by 90 degrees clockwise and preserve portrait
  10335. layout:
  10336. @example
  10337. transpose=dir=1:passthrough=portrait
  10338. @end example
  10339. The command above can also be specified as:
  10340. @example
  10341. transpose=1:portrait
  10342. @end example
  10343. @section trim
  10344. Trim the input so that the output contains one continuous subpart of the input.
  10345. It accepts the following parameters:
  10346. @table @option
  10347. @item start
  10348. Specify the time of the start of the kept section, i.e. the frame with the
  10349. timestamp @var{start} will be the first frame in the output.
  10350. @item end
  10351. Specify the time of the first frame that will be dropped, i.e. the frame
  10352. immediately preceding the one with the timestamp @var{end} will be the last
  10353. frame in the output.
  10354. @item start_pts
  10355. This is the same as @var{start}, except this option sets the start timestamp
  10356. in timebase units instead of seconds.
  10357. @item end_pts
  10358. This is the same as @var{end}, except this option sets the end timestamp
  10359. in timebase units instead of seconds.
  10360. @item duration
  10361. The maximum duration of the output in seconds.
  10362. @item start_frame
  10363. The number of the first frame that should be passed to the output.
  10364. @item end_frame
  10365. The number of the first frame that should be dropped.
  10366. @end table
  10367. @option{start}, @option{end}, and @option{duration} are expressed as time
  10368. duration specifications; see
  10369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10370. for the accepted syntax.
  10371. Note that the first two sets of the start/end options and the @option{duration}
  10372. option look at the frame timestamp, while the _frame variants simply count the
  10373. frames that pass through the filter. Also note that this filter does not modify
  10374. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10375. setpts filter after the trim filter.
  10376. If multiple start or end options are set, this filter tries to be greedy and
  10377. keep all the frames that match at least one of the specified constraints. To keep
  10378. only the part that matches all the constraints at once, chain multiple trim
  10379. filters.
  10380. The defaults are such that all the input is kept. So it is possible to set e.g.
  10381. just the end values to keep everything before the specified time.
  10382. Examples:
  10383. @itemize
  10384. @item
  10385. Drop everything except the second minute of input:
  10386. @example
  10387. ffmpeg -i INPUT -vf trim=60:120
  10388. @end example
  10389. @item
  10390. Keep only the first second:
  10391. @example
  10392. ffmpeg -i INPUT -vf trim=duration=1
  10393. @end example
  10394. @end itemize
  10395. @anchor{unsharp}
  10396. @section unsharp
  10397. Sharpen or blur the input video.
  10398. It accepts the following parameters:
  10399. @table @option
  10400. @item luma_msize_x, lx
  10401. Set the luma matrix horizontal size. It must be an odd integer between
  10402. 3 and 23. The default value is 5.
  10403. @item luma_msize_y, ly
  10404. Set the luma matrix vertical size. It must be an odd integer between 3
  10405. and 23. The default value is 5.
  10406. @item luma_amount, la
  10407. Set the luma effect strength. It must be a floating point number, reasonable
  10408. values lay between -1.5 and 1.5.
  10409. Negative values will blur the input video, while positive values will
  10410. sharpen it, a value of zero will disable the effect.
  10411. Default value is 1.0.
  10412. @item chroma_msize_x, cx
  10413. Set the chroma matrix horizontal size. It must be an odd integer
  10414. between 3 and 23. The default value is 5.
  10415. @item chroma_msize_y, cy
  10416. Set the chroma matrix vertical size. It must be an odd integer
  10417. between 3 and 23. The default value is 5.
  10418. @item chroma_amount, ca
  10419. Set the chroma effect strength. It must be a floating point number, reasonable
  10420. values lay between -1.5 and 1.5.
  10421. Negative values will blur the input video, while positive values will
  10422. sharpen it, a value of zero will disable the effect.
  10423. Default value is 0.0.
  10424. @item opencl
  10425. If set to 1, specify using OpenCL capabilities, only available if
  10426. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10427. @end table
  10428. All parameters are optional and default to the equivalent of the
  10429. string '5:5:1.0:5:5:0.0'.
  10430. @subsection Examples
  10431. @itemize
  10432. @item
  10433. Apply strong luma sharpen effect:
  10434. @example
  10435. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10436. @end example
  10437. @item
  10438. Apply a strong blur of both luma and chroma parameters:
  10439. @example
  10440. unsharp=7:7:-2:7:7:-2
  10441. @end example
  10442. @end itemize
  10443. @section uspp
  10444. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10445. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10446. shifts and average the results.
  10447. The way this differs from the behavior of spp is that uspp actually encodes &
  10448. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10449. DCT similar to MJPEG.
  10450. The filter accepts the following options:
  10451. @table @option
  10452. @item quality
  10453. Set quality. This option defines the number of levels for averaging. It accepts
  10454. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10455. effect. A value of @code{8} means the higher quality. For each increment of
  10456. that value the speed drops by a factor of approximately 2. Default value is
  10457. @code{3}.
  10458. @item qp
  10459. Force a constant quantization parameter. If not set, the filter will use the QP
  10460. from the video stream (if available).
  10461. @end table
  10462. @section vaguedenoiser
  10463. Apply a wavelet based denoiser.
  10464. It transforms each frame from the video input into the wavelet domain,
  10465. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  10466. the obtained coefficients. It does an inverse wavelet transform after.
  10467. Due to wavelet properties, it should give a nice smoothed result, and
  10468. reduced noise, without blurring picture features.
  10469. This filter accepts the following options:
  10470. @table @option
  10471. @item threshold
  10472. The filtering strength. The higher, the more filtered the video will be.
  10473. Hard thresholding can use a higher threshold than soft thresholding
  10474. before the video looks overfiltered.
  10475. @item method
  10476. The filtering method the filter will use.
  10477. It accepts the following values:
  10478. @table @samp
  10479. @item hard
  10480. All values under the threshold will be zeroed.
  10481. @item soft
  10482. All values under the threshold will be zeroed. All values above will be
  10483. reduced by the threshold.
  10484. @item garrote
  10485. Scales or nullifies coefficients - intermediary between (more) soft and
  10486. (less) hard thresholding.
  10487. @end table
  10488. @item nsteps
  10489. Number of times, the wavelet will decompose the picture. Picture can't
  10490. be decomposed beyond a particular point (typically, 8 for a 640x480
  10491. frame - as 2^9 = 512 > 480)
  10492. @item percent
  10493. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  10494. @item planes
  10495. A list of the planes to process. By default all planes are processed.
  10496. @end table
  10497. @section vectorscope
  10498. Display 2 color component values in the two dimensional graph (which is called
  10499. a vectorscope).
  10500. This filter accepts the following options:
  10501. @table @option
  10502. @item mode, m
  10503. Set vectorscope mode.
  10504. It accepts the following values:
  10505. @table @samp
  10506. @item gray
  10507. Gray values are displayed on graph, higher brightness means more pixels have
  10508. same component color value on location in graph. This is the default mode.
  10509. @item color
  10510. Gray values are displayed on graph. Surrounding pixels values which are not
  10511. present in video frame are drawn in gradient of 2 color components which are
  10512. set by option @code{x} and @code{y}. The 3rd color component is static.
  10513. @item color2
  10514. Actual color components values present in video frame are displayed on graph.
  10515. @item color3
  10516. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10517. on graph increases value of another color component, which is luminance by
  10518. default values of @code{x} and @code{y}.
  10519. @item color4
  10520. Actual colors present in video frame are displayed on graph. If two different
  10521. colors map to same position on graph then color with higher value of component
  10522. not present in graph is picked.
  10523. @item color5
  10524. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10525. component picked from radial gradient.
  10526. @end table
  10527. @item x
  10528. Set which color component will be represented on X-axis. Default is @code{1}.
  10529. @item y
  10530. Set which color component will be represented on Y-axis. Default is @code{2}.
  10531. @item intensity, i
  10532. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10533. of color component which represents frequency of (X, Y) location in graph.
  10534. @item envelope, e
  10535. @table @samp
  10536. @item none
  10537. No envelope, this is default.
  10538. @item instant
  10539. Instant envelope, even darkest single pixel will be clearly highlighted.
  10540. @item peak
  10541. Hold maximum and minimum values presented in graph over time. This way you
  10542. can still spot out of range values without constantly looking at vectorscope.
  10543. @item peak+instant
  10544. Peak and instant envelope combined together.
  10545. @end table
  10546. @item graticule, g
  10547. Set what kind of graticule to draw.
  10548. @table @samp
  10549. @item none
  10550. @item green
  10551. @item color
  10552. @end table
  10553. @item opacity, o
  10554. Set graticule opacity.
  10555. @item flags, f
  10556. Set graticule flags.
  10557. @table @samp
  10558. @item white
  10559. Draw graticule for white point.
  10560. @item black
  10561. Draw graticule for black point.
  10562. @item name
  10563. Draw color points short names.
  10564. @end table
  10565. @item bgopacity, b
  10566. Set background opacity.
  10567. @item lthreshold, l
  10568. Set low threshold for color component not represented on X or Y axis.
  10569. Values lower than this value will be ignored. Default is 0.
  10570. Note this value is multiplied with actual max possible value one pixel component
  10571. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10572. is 0.1 * 255 = 25.
  10573. @item hthreshold, h
  10574. Set high threshold for color component not represented on X or Y axis.
  10575. Values higher than this value will be ignored. Default is 1.
  10576. Note this value is multiplied with actual max possible value one pixel component
  10577. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10578. is 0.9 * 255 = 230.
  10579. @item colorspace, c
  10580. Set what kind of colorspace to use when drawing graticule.
  10581. @table @samp
  10582. @item auto
  10583. @item 601
  10584. @item 709
  10585. @end table
  10586. Default is auto.
  10587. @end table
  10588. @anchor{vidstabdetect}
  10589. @section vidstabdetect
  10590. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10591. @ref{vidstabtransform} for pass 2.
  10592. This filter generates a file with relative translation and rotation
  10593. transform information about subsequent frames, which is then used by
  10594. the @ref{vidstabtransform} filter.
  10595. To enable compilation of this filter you need to configure FFmpeg with
  10596. @code{--enable-libvidstab}.
  10597. This filter accepts the following options:
  10598. @table @option
  10599. @item result
  10600. Set the path to the file used to write the transforms information.
  10601. Default value is @file{transforms.trf}.
  10602. @item shakiness
  10603. Set how shaky the video is and how quick the camera is. It accepts an
  10604. integer in the range 1-10, a value of 1 means little shakiness, a
  10605. value of 10 means strong shakiness. Default value is 5.
  10606. @item accuracy
  10607. Set the accuracy of the detection process. It must be a value in the
  10608. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10609. accuracy. Default value is 15.
  10610. @item stepsize
  10611. Set stepsize of the search process. The region around minimum is
  10612. scanned with 1 pixel resolution. Default value is 6.
  10613. @item mincontrast
  10614. Set minimum contrast. Below this value a local measurement field is
  10615. discarded. Must be a floating point value in the range 0-1. Default
  10616. value is 0.3.
  10617. @item tripod
  10618. Set reference frame number for tripod mode.
  10619. If enabled, the motion of the frames is compared to a reference frame
  10620. in the filtered stream, identified by the specified number. The idea
  10621. is to compensate all movements in a more-or-less static scene and keep
  10622. the camera view absolutely still.
  10623. If set to 0, it is disabled. The frames are counted starting from 1.
  10624. @item show
  10625. Show fields and transforms in the resulting frames. It accepts an
  10626. integer in the range 0-2. Default value is 0, which disables any
  10627. visualization.
  10628. @end table
  10629. @subsection Examples
  10630. @itemize
  10631. @item
  10632. Use default values:
  10633. @example
  10634. vidstabdetect
  10635. @end example
  10636. @item
  10637. Analyze strongly shaky movie and put the results in file
  10638. @file{mytransforms.trf}:
  10639. @example
  10640. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10641. @end example
  10642. @item
  10643. Visualize the result of internal transformations in the resulting
  10644. video:
  10645. @example
  10646. vidstabdetect=show=1
  10647. @end example
  10648. @item
  10649. Analyze a video with medium shakiness using @command{ffmpeg}:
  10650. @example
  10651. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10652. @end example
  10653. @end itemize
  10654. @anchor{vidstabtransform}
  10655. @section vidstabtransform
  10656. Video stabilization/deshaking: pass 2 of 2,
  10657. see @ref{vidstabdetect} for pass 1.
  10658. Read a file with transform information for each frame and
  10659. apply/compensate them. Together with the @ref{vidstabdetect}
  10660. filter this can be used to deshake videos. See also
  10661. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10662. the @ref{unsharp} filter, see below.
  10663. To enable compilation of this filter you need to configure FFmpeg with
  10664. @code{--enable-libvidstab}.
  10665. @subsection Options
  10666. @table @option
  10667. @item input
  10668. Set path to the file used to read the transforms. Default value is
  10669. @file{transforms.trf}.
  10670. @item smoothing
  10671. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10672. camera movements. Default value is 10.
  10673. For example a number of 10 means that 21 frames are used (10 in the
  10674. past and 10 in the future) to smoothen the motion in the video. A
  10675. larger value leads to a smoother video, but limits the acceleration of
  10676. the camera (pan/tilt movements). 0 is a special case where a static
  10677. camera is simulated.
  10678. @item optalgo
  10679. Set the camera path optimization algorithm.
  10680. Accepted values are:
  10681. @table @samp
  10682. @item gauss
  10683. gaussian kernel low-pass filter on camera motion (default)
  10684. @item avg
  10685. averaging on transformations
  10686. @end table
  10687. @item maxshift
  10688. Set maximal number of pixels to translate frames. Default value is -1,
  10689. meaning no limit.
  10690. @item maxangle
  10691. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10692. value is -1, meaning no limit.
  10693. @item crop
  10694. Specify how to deal with borders that may be visible due to movement
  10695. compensation.
  10696. Available values are:
  10697. @table @samp
  10698. @item keep
  10699. keep image information from previous frame (default)
  10700. @item black
  10701. fill the border black
  10702. @end table
  10703. @item invert
  10704. Invert transforms if set to 1. Default value is 0.
  10705. @item relative
  10706. Consider transforms as relative to previous frame if set to 1,
  10707. absolute if set to 0. Default value is 0.
  10708. @item zoom
  10709. Set percentage to zoom. A positive value will result in a zoom-in
  10710. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10711. zoom).
  10712. @item optzoom
  10713. Set optimal zooming to avoid borders.
  10714. Accepted values are:
  10715. @table @samp
  10716. @item 0
  10717. disabled
  10718. @item 1
  10719. optimal static zoom value is determined (only very strong movements
  10720. will lead to visible borders) (default)
  10721. @item 2
  10722. optimal adaptive zoom value is determined (no borders will be
  10723. visible), see @option{zoomspeed}
  10724. @end table
  10725. Note that the value given at zoom is added to the one calculated here.
  10726. @item zoomspeed
  10727. Set percent to zoom maximally each frame (enabled when
  10728. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10729. 0.25.
  10730. @item interpol
  10731. Specify type of interpolation.
  10732. Available values are:
  10733. @table @samp
  10734. @item no
  10735. no interpolation
  10736. @item linear
  10737. linear only horizontal
  10738. @item bilinear
  10739. linear in both directions (default)
  10740. @item bicubic
  10741. cubic in both directions (slow)
  10742. @end table
  10743. @item tripod
  10744. Enable virtual tripod mode if set to 1, which is equivalent to
  10745. @code{relative=0:smoothing=0}. Default value is 0.
  10746. Use also @code{tripod} option of @ref{vidstabdetect}.
  10747. @item debug
  10748. Increase log verbosity if set to 1. Also the detected global motions
  10749. are written to the temporary file @file{global_motions.trf}. Default
  10750. value is 0.
  10751. @end table
  10752. @subsection Examples
  10753. @itemize
  10754. @item
  10755. Use @command{ffmpeg} for a typical stabilization with default values:
  10756. @example
  10757. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10758. @end example
  10759. Note the use of the @ref{unsharp} filter which is always recommended.
  10760. @item
  10761. Zoom in a bit more and load transform data from a given file:
  10762. @example
  10763. vidstabtransform=zoom=5:input="mytransforms.trf"
  10764. @end example
  10765. @item
  10766. Smoothen the video even more:
  10767. @example
  10768. vidstabtransform=smoothing=30
  10769. @end example
  10770. @end itemize
  10771. @section vflip
  10772. Flip the input video vertically.
  10773. For example, to vertically flip a video with @command{ffmpeg}:
  10774. @example
  10775. ffmpeg -i in.avi -vf "vflip" out.avi
  10776. @end example
  10777. @anchor{vignette}
  10778. @section vignette
  10779. Make or reverse a natural vignetting effect.
  10780. The filter accepts the following options:
  10781. @table @option
  10782. @item angle, a
  10783. Set lens angle expression as a number of radians.
  10784. The value is clipped in the @code{[0,PI/2]} range.
  10785. Default value: @code{"PI/5"}
  10786. @item x0
  10787. @item y0
  10788. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10789. by default.
  10790. @item mode
  10791. Set forward/backward mode.
  10792. Available modes are:
  10793. @table @samp
  10794. @item forward
  10795. The larger the distance from the central point, the darker the image becomes.
  10796. @item backward
  10797. The larger the distance from the central point, the brighter the image becomes.
  10798. This can be used to reverse a vignette effect, though there is no automatic
  10799. detection to extract the lens @option{angle} and other settings (yet). It can
  10800. also be used to create a burning effect.
  10801. @end table
  10802. Default value is @samp{forward}.
  10803. @item eval
  10804. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10805. It accepts the following values:
  10806. @table @samp
  10807. @item init
  10808. Evaluate expressions only once during the filter initialization.
  10809. @item frame
  10810. Evaluate expressions for each incoming frame. This is way slower than the
  10811. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10812. allows advanced dynamic expressions.
  10813. @end table
  10814. Default value is @samp{init}.
  10815. @item dither
  10816. Set dithering to reduce the circular banding effects. Default is @code{1}
  10817. (enabled).
  10818. @item aspect
  10819. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10820. Setting this value to the SAR of the input will make a rectangular vignetting
  10821. following the dimensions of the video.
  10822. Default is @code{1/1}.
  10823. @end table
  10824. @subsection Expressions
  10825. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10826. following parameters.
  10827. @table @option
  10828. @item w
  10829. @item h
  10830. input width and height
  10831. @item n
  10832. the number of input frame, starting from 0
  10833. @item pts
  10834. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10835. @var{TB} units, NAN if undefined
  10836. @item r
  10837. frame rate of the input video, NAN if the input frame rate is unknown
  10838. @item t
  10839. the PTS (Presentation TimeStamp) of the filtered video frame,
  10840. expressed in seconds, NAN if undefined
  10841. @item tb
  10842. time base of the input video
  10843. @end table
  10844. @subsection Examples
  10845. @itemize
  10846. @item
  10847. Apply simple strong vignetting effect:
  10848. @example
  10849. vignette=PI/4
  10850. @end example
  10851. @item
  10852. Make a flickering vignetting:
  10853. @example
  10854. vignette='PI/4+random(1)*PI/50':eval=frame
  10855. @end example
  10856. @end itemize
  10857. @section vstack
  10858. Stack input videos vertically.
  10859. All streams must be of same pixel format and of same width.
  10860. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10861. to create same output.
  10862. The filter accept the following option:
  10863. @table @option
  10864. @item inputs
  10865. Set number of input streams. Default is 2.
  10866. @item shortest
  10867. If set to 1, force the output to terminate when the shortest input
  10868. terminates. Default value is 0.
  10869. @end table
  10870. @section w3fdif
  10871. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  10872. Deinterlacing Filter").
  10873. Based on the process described by Martin Weston for BBC R&D, and
  10874. implemented based on the de-interlace algorithm written by Jim
  10875. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  10876. uses filter coefficients calculated by BBC R&D.
  10877. There are two sets of filter coefficients, so called "simple":
  10878. and "complex". Which set of filter coefficients is used can
  10879. be set by passing an optional parameter:
  10880. @table @option
  10881. @item filter
  10882. Set the interlacing filter coefficients. Accepts one of the following values:
  10883. @table @samp
  10884. @item simple
  10885. Simple filter coefficient set.
  10886. @item complex
  10887. More-complex filter coefficient set.
  10888. @end table
  10889. Default value is @samp{complex}.
  10890. @item deint
  10891. Specify which frames to deinterlace. Accept one of the following values:
  10892. @table @samp
  10893. @item all
  10894. Deinterlace all frames,
  10895. @item interlaced
  10896. Only deinterlace frames marked as interlaced.
  10897. @end table
  10898. Default value is @samp{all}.
  10899. @end table
  10900. @section waveform
  10901. Video waveform monitor.
  10902. The waveform monitor plots color component intensity. By default luminance
  10903. only. Each column of the waveform corresponds to a column of pixels in the
  10904. source video.
  10905. It accepts the following options:
  10906. @table @option
  10907. @item mode, m
  10908. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10909. In row mode, the graph on the left side represents color component value 0 and
  10910. the right side represents value = 255. In column mode, the top side represents
  10911. color component value = 0 and bottom side represents value = 255.
  10912. @item intensity, i
  10913. Set intensity. Smaller values are useful to find out how many values of the same
  10914. luminance are distributed across input rows/columns.
  10915. Default value is @code{0.04}. Allowed range is [0, 1].
  10916. @item mirror, r
  10917. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10918. In mirrored mode, higher values will be represented on the left
  10919. side for @code{row} mode and at the top for @code{column} mode. Default is
  10920. @code{1} (mirrored).
  10921. @item display, d
  10922. Set display mode.
  10923. It accepts the following values:
  10924. @table @samp
  10925. @item overlay
  10926. Presents information identical to that in the @code{parade}, except
  10927. that the graphs representing color components are superimposed directly
  10928. over one another.
  10929. This display mode makes it easier to spot relative differences or similarities
  10930. in overlapping areas of the color components that are supposed to be identical,
  10931. such as neutral whites, grays, or blacks.
  10932. @item stack
  10933. Display separate graph for the color components side by side in
  10934. @code{row} mode or one below the other in @code{column} mode.
  10935. @item parade
  10936. Display separate graph for the color components side by side in
  10937. @code{column} mode or one below the other in @code{row} mode.
  10938. Using this display mode makes it easy to spot color casts in the highlights
  10939. and shadows of an image, by comparing the contours of the top and the bottom
  10940. graphs of each waveform. Since whites, grays, and blacks are characterized
  10941. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10942. should display three waveforms of roughly equal width/height. If not, the
  10943. correction is easy to perform by making level adjustments the three waveforms.
  10944. @end table
  10945. Default is @code{stack}.
  10946. @item components, c
  10947. Set which color components to display. Default is 1, which means only luminance
  10948. or red color component if input is in RGB colorspace. If is set for example to
  10949. 7 it will display all 3 (if) available color components.
  10950. @item envelope, e
  10951. @table @samp
  10952. @item none
  10953. No envelope, this is default.
  10954. @item instant
  10955. Instant envelope, minimum and maximum values presented in graph will be easily
  10956. visible even with small @code{step} value.
  10957. @item peak
  10958. Hold minimum and maximum values presented in graph across time. This way you
  10959. can still spot out of range values without constantly looking at waveforms.
  10960. @item peak+instant
  10961. Peak and instant envelope combined together.
  10962. @end table
  10963. @item filter, f
  10964. @table @samp
  10965. @item lowpass
  10966. No filtering, this is default.
  10967. @item flat
  10968. Luma and chroma combined together.
  10969. @item aflat
  10970. Similar as above, but shows difference between blue and red chroma.
  10971. @item chroma
  10972. Displays only chroma.
  10973. @item color
  10974. Displays actual color value on waveform.
  10975. @item acolor
  10976. Similar as above, but with luma showing frequency of chroma values.
  10977. @end table
  10978. @item graticule, g
  10979. Set which graticule to display.
  10980. @table @samp
  10981. @item none
  10982. Do not display graticule.
  10983. @item green
  10984. Display green graticule showing legal broadcast ranges.
  10985. @end table
  10986. @item opacity, o
  10987. Set graticule opacity.
  10988. @item flags, fl
  10989. Set graticule flags.
  10990. @table @samp
  10991. @item numbers
  10992. Draw numbers above lines. By default enabled.
  10993. @item dots
  10994. Draw dots instead of lines.
  10995. @end table
  10996. @item scale, s
  10997. Set scale used for displaying graticule.
  10998. @table @samp
  10999. @item digital
  11000. @item millivolts
  11001. @item ire
  11002. @end table
  11003. Default is digital.
  11004. @item bgopacity, b
  11005. Set background opacity.
  11006. @end table
  11007. @section weave
  11008. The @code{weave} takes a field-based video input and join
  11009. each two sequential fields into single frame, producing a new double
  11010. height clip with half the frame rate and half the frame count.
  11011. It accepts the following option:
  11012. @table @option
  11013. @item first_field
  11014. Set first field. Available values are:
  11015. @table @samp
  11016. @item top, t
  11017. Set the frame as top-field-first.
  11018. @item bottom, b
  11019. Set the frame as bottom-field-first.
  11020. @end table
  11021. @end table
  11022. @subsection Examples
  11023. @itemize
  11024. @item
  11025. Interlace video using @ref{select} and @ref{separatefields} filter:
  11026. @example
  11027. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11028. @end example
  11029. @end itemize
  11030. @section xbr
  11031. Apply the xBR high-quality magnification filter which is designed for pixel
  11032. art. It follows a set of edge-detection rules, see
  11033. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11034. It accepts the following option:
  11035. @table @option
  11036. @item n
  11037. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11038. @code{3xBR} and @code{4} for @code{4xBR}.
  11039. Default is @code{3}.
  11040. @end table
  11041. @anchor{yadif}
  11042. @section yadif
  11043. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11044. filter").
  11045. It accepts the following parameters:
  11046. @table @option
  11047. @item mode
  11048. The interlacing mode to adopt. It accepts one of the following values:
  11049. @table @option
  11050. @item 0, send_frame
  11051. Output one frame for each frame.
  11052. @item 1, send_field
  11053. Output one frame for each field.
  11054. @item 2, send_frame_nospatial
  11055. Like @code{send_frame}, but it skips the spatial interlacing check.
  11056. @item 3, send_field_nospatial
  11057. Like @code{send_field}, but it skips the spatial interlacing check.
  11058. @end table
  11059. The default value is @code{send_frame}.
  11060. @item parity
  11061. The picture field parity assumed for the input interlaced video. It accepts one
  11062. of the following values:
  11063. @table @option
  11064. @item 0, tff
  11065. Assume the top field is first.
  11066. @item 1, bff
  11067. Assume the bottom field is first.
  11068. @item -1, auto
  11069. Enable automatic detection of field parity.
  11070. @end table
  11071. The default value is @code{auto}.
  11072. If the interlacing is unknown or the decoder does not export this information,
  11073. top field first will be assumed.
  11074. @item deint
  11075. Specify which frames to deinterlace. Accept one of the following
  11076. values:
  11077. @table @option
  11078. @item 0, all
  11079. Deinterlace all frames.
  11080. @item 1, interlaced
  11081. Only deinterlace frames marked as interlaced.
  11082. @end table
  11083. The default value is @code{all}.
  11084. @end table
  11085. @section zoompan
  11086. Apply Zoom & Pan effect.
  11087. This filter accepts the following options:
  11088. @table @option
  11089. @item zoom, z
  11090. Set the zoom expression. Default is 1.
  11091. @item x
  11092. @item y
  11093. Set the x and y expression. Default is 0.
  11094. @item d
  11095. Set the duration expression in number of frames.
  11096. This sets for how many number of frames effect will last for
  11097. single input image.
  11098. @item s
  11099. Set the output image size, default is 'hd720'.
  11100. @item fps
  11101. Set the output frame rate, default is '25'.
  11102. @end table
  11103. Each expression can contain the following constants:
  11104. @table @option
  11105. @item in_w, iw
  11106. Input width.
  11107. @item in_h, ih
  11108. Input height.
  11109. @item out_w, ow
  11110. Output width.
  11111. @item out_h, oh
  11112. Output height.
  11113. @item in
  11114. Input frame count.
  11115. @item on
  11116. Output frame count.
  11117. @item x
  11118. @item y
  11119. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11120. for current input frame.
  11121. @item px
  11122. @item py
  11123. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11124. not yet such frame (first input frame).
  11125. @item zoom
  11126. Last calculated zoom from 'z' expression for current input frame.
  11127. @item pzoom
  11128. Last calculated zoom of last output frame of previous input frame.
  11129. @item duration
  11130. Number of output frames for current input frame. Calculated from 'd' expression
  11131. for each input frame.
  11132. @item pduration
  11133. number of output frames created for previous input frame
  11134. @item a
  11135. Rational number: input width / input height
  11136. @item sar
  11137. sample aspect ratio
  11138. @item dar
  11139. display aspect ratio
  11140. @end table
  11141. @subsection Examples
  11142. @itemize
  11143. @item
  11144. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11145. @example
  11146. 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
  11147. @end example
  11148. @item
  11149. Zoom-in up to 1.5 and pan always at center of picture:
  11150. @example
  11151. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11152. @end example
  11153. @item
  11154. Same as above but without pausing:
  11155. @example
  11156. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11157. @end example
  11158. @end itemize
  11159. @section zscale
  11160. Scale (resize) the input video, using the z.lib library:
  11161. https://github.com/sekrit-twc/zimg.
  11162. The zscale filter forces the output display aspect ratio to be the same
  11163. as the input, by changing the output sample aspect ratio.
  11164. If the input image format is different from the format requested by
  11165. the next filter, the zscale filter will convert the input to the
  11166. requested format.
  11167. @subsection Options
  11168. The filter accepts the following options.
  11169. @table @option
  11170. @item width, w
  11171. @item height, h
  11172. Set the output video dimension expression. Default value is the input
  11173. dimension.
  11174. If the @var{width} or @var{w} is 0, the input width is used for the output.
  11175. If the @var{height} or @var{h} is 0, the input height is used for the output.
  11176. If one of the values is -1, the zscale filter will use a value that
  11177. maintains the aspect ratio of the input image, calculated from the
  11178. other specified dimension. If both of them are -1, the input size is
  11179. used
  11180. If one of the values is -n with n > 1, the zscale filter will also use a value
  11181. that maintains the aspect ratio of the input image, calculated from the other
  11182. specified dimension. After that it will, however, make sure that the calculated
  11183. dimension is divisible by n and adjust the value if necessary.
  11184. See below for the list of accepted constants for use in the dimension
  11185. expression.
  11186. @item size, s
  11187. Set the video size. For the syntax of this option, check the
  11188. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11189. @item dither, d
  11190. Set the dither type.
  11191. Possible values are:
  11192. @table @var
  11193. @item none
  11194. @item ordered
  11195. @item random
  11196. @item error_diffusion
  11197. @end table
  11198. Default is none.
  11199. @item filter, f
  11200. Set the resize filter type.
  11201. Possible values are:
  11202. @table @var
  11203. @item point
  11204. @item bilinear
  11205. @item bicubic
  11206. @item spline16
  11207. @item spline36
  11208. @item lanczos
  11209. @end table
  11210. Default is bilinear.
  11211. @item range, r
  11212. Set the color range.
  11213. Possible values are:
  11214. @table @var
  11215. @item input
  11216. @item limited
  11217. @item full
  11218. @end table
  11219. Default is same as input.
  11220. @item primaries, p
  11221. Set the color primaries.
  11222. Possible values are:
  11223. @table @var
  11224. @item input
  11225. @item 709
  11226. @item unspecified
  11227. @item 170m
  11228. @item 240m
  11229. @item 2020
  11230. @end table
  11231. Default is same as input.
  11232. @item transfer, t
  11233. Set the transfer characteristics.
  11234. Possible values are:
  11235. @table @var
  11236. @item input
  11237. @item 709
  11238. @item unspecified
  11239. @item 601
  11240. @item linear
  11241. @item 2020_10
  11242. @item 2020_12
  11243. @item smpte2084
  11244. @item iec61966-2-1
  11245. @item arib-std-b67
  11246. @end table
  11247. Default is same as input.
  11248. @item matrix, m
  11249. Set the colorspace matrix.
  11250. Possible value are:
  11251. @table @var
  11252. @item input
  11253. @item 709
  11254. @item unspecified
  11255. @item 470bg
  11256. @item 170m
  11257. @item 2020_ncl
  11258. @item 2020_cl
  11259. @end table
  11260. Default is same as input.
  11261. @item rangein, rin
  11262. Set the input color range.
  11263. Possible values are:
  11264. @table @var
  11265. @item input
  11266. @item limited
  11267. @item full
  11268. @end table
  11269. Default is same as input.
  11270. @item primariesin, pin
  11271. Set the input color primaries.
  11272. Possible values are:
  11273. @table @var
  11274. @item input
  11275. @item 709
  11276. @item unspecified
  11277. @item 170m
  11278. @item 240m
  11279. @item 2020
  11280. @end table
  11281. Default is same as input.
  11282. @item transferin, tin
  11283. Set the input transfer characteristics.
  11284. Possible values are:
  11285. @table @var
  11286. @item input
  11287. @item 709
  11288. @item unspecified
  11289. @item 601
  11290. @item linear
  11291. @item 2020_10
  11292. @item 2020_12
  11293. @end table
  11294. Default is same as input.
  11295. @item matrixin, min
  11296. Set the input colorspace matrix.
  11297. Possible value are:
  11298. @table @var
  11299. @item input
  11300. @item 709
  11301. @item unspecified
  11302. @item 470bg
  11303. @item 170m
  11304. @item 2020_ncl
  11305. @item 2020_cl
  11306. @end table
  11307. @item chromal, c
  11308. Set the output chroma location.
  11309. Possible values are:
  11310. @table @var
  11311. @item input
  11312. @item left
  11313. @item center
  11314. @item topleft
  11315. @item top
  11316. @item bottomleft
  11317. @item bottom
  11318. @end table
  11319. @item chromalin, cin
  11320. Set the input chroma location.
  11321. Possible values are:
  11322. @table @var
  11323. @item input
  11324. @item left
  11325. @item center
  11326. @item topleft
  11327. @item top
  11328. @item bottomleft
  11329. @item bottom
  11330. @end table
  11331. @item npl
  11332. Set the nominal peak luminance.
  11333. @end table
  11334. The values of the @option{w} and @option{h} options are expressions
  11335. containing the following constants:
  11336. @table @var
  11337. @item in_w
  11338. @item in_h
  11339. The input width and height
  11340. @item iw
  11341. @item ih
  11342. These are the same as @var{in_w} and @var{in_h}.
  11343. @item out_w
  11344. @item out_h
  11345. The output (scaled) width and height
  11346. @item ow
  11347. @item oh
  11348. These are the same as @var{out_w} and @var{out_h}
  11349. @item a
  11350. The same as @var{iw} / @var{ih}
  11351. @item sar
  11352. input sample aspect ratio
  11353. @item dar
  11354. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11355. @item hsub
  11356. @item vsub
  11357. horizontal and vertical input chroma subsample values. For example for the
  11358. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11359. @item ohsub
  11360. @item ovsub
  11361. horizontal and vertical output chroma subsample values. For example for the
  11362. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11363. @end table
  11364. @table @option
  11365. @end table
  11366. @c man end VIDEO FILTERS
  11367. @chapter Video Sources
  11368. @c man begin VIDEO SOURCES
  11369. Below is a description of the currently available video sources.
  11370. @section buffer
  11371. Buffer video frames, and make them available to the filter chain.
  11372. This source is mainly intended for a programmatic use, in particular
  11373. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  11374. It accepts the following parameters:
  11375. @table @option
  11376. @item video_size
  11377. Specify the size (width and height) of the buffered video frames. For the
  11378. syntax of this option, check the
  11379. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11380. @item width
  11381. The input video width.
  11382. @item height
  11383. The input video height.
  11384. @item pix_fmt
  11385. A string representing the pixel format of the buffered video frames.
  11386. It may be a number corresponding to a pixel format, or a pixel format
  11387. name.
  11388. @item time_base
  11389. Specify the timebase assumed by the timestamps of the buffered frames.
  11390. @item frame_rate
  11391. Specify the frame rate expected for the video stream.
  11392. @item pixel_aspect, sar
  11393. The sample (pixel) aspect ratio of the input video.
  11394. @item sws_param
  11395. Specify the optional parameters to be used for the scale filter which
  11396. is automatically inserted when an input change is detected in the
  11397. input size or format.
  11398. @item hw_frames_ctx
  11399. When using a hardware pixel format, this should be a reference to an
  11400. AVHWFramesContext describing input frames.
  11401. @end table
  11402. For example:
  11403. @example
  11404. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  11405. @end example
  11406. will instruct the source to accept video frames with size 320x240 and
  11407. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  11408. square pixels (1:1 sample aspect ratio).
  11409. Since the pixel format with name "yuv410p" corresponds to the number 6
  11410. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  11411. this example corresponds to:
  11412. @example
  11413. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  11414. @end example
  11415. Alternatively, the options can be specified as a flat string, but this
  11416. syntax is deprecated:
  11417. @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}]
  11418. @section cellauto
  11419. Create a pattern generated by an elementary cellular automaton.
  11420. The initial state of the cellular automaton can be defined through the
  11421. @option{filename} and @option{pattern} options. If such options are
  11422. not specified an initial state is created randomly.
  11423. At each new frame a new row in the video is filled with the result of
  11424. the cellular automaton next generation. The behavior when the whole
  11425. frame is filled is defined by the @option{scroll} option.
  11426. This source accepts the following options:
  11427. @table @option
  11428. @item filename, f
  11429. Read the initial cellular automaton state, i.e. the starting row, from
  11430. the specified file.
  11431. In the file, each non-whitespace character is considered an alive
  11432. cell, a newline will terminate the row, and further characters in the
  11433. file will be ignored.
  11434. @item pattern, p
  11435. Read the initial cellular automaton state, i.e. the starting row, from
  11436. the specified string.
  11437. Each non-whitespace character in the string is considered an alive
  11438. cell, a newline will terminate the row, and further characters in the
  11439. string will be ignored.
  11440. @item rate, r
  11441. Set the video rate, that is the number of frames generated per second.
  11442. Default is 25.
  11443. @item random_fill_ratio, ratio
  11444. Set the random fill ratio for the initial cellular automaton row. It
  11445. is a floating point number value ranging from 0 to 1, defaults to
  11446. 1/PHI.
  11447. This option is ignored when a file or a pattern is specified.
  11448. @item random_seed, seed
  11449. Set the seed for filling randomly the initial row, must be an integer
  11450. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11451. set to -1, the filter will try to use a good random seed on a best
  11452. effort basis.
  11453. @item rule
  11454. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  11455. Default value is 110.
  11456. @item size, s
  11457. Set the size of the output video. For the syntax of this option, check the
  11458. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11459. If @option{filename} or @option{pattern} is specified, the size is set
  11460. by default to the width of the specified initial state row, and the
  11461. height is set to @var{width} * PHI.
  11462. If @option{size} is set, it must contain the width of the specified
  11463. pattern string, and the specified pattern will be centered in the
  11464. larger row.
  11465. If a filename or a pattern string is not specified, the size value
  11466. defaults to "320x518" (used for a randomly generated initial state).
  11467. @item scroll
  11468. If set to 1, scroll the output upward when all the rows in the output
  11469. have been already filled. If set to 0, the new generated row will be
  11470. written over the top row just after the bottom row is filled.
  11471. Defaults to 1.
  11472. @item start_full, full
  11473. If set to 1, completely fill the output with generated rows before
  11474. outputting the first frame.
  11475. This is the default behavior, for disabling set the value to 0.
  11476. @item stitch
  11477. If set to 1, stitch the left and right row edges together.
  11478. This is the default behavior, for disabling set the value to 0.
  11479. @end table
  11480. @subsection Examples
  11481. @itemize
  11482. @item
  11483. Read the initial state from @file{pattern}, and specify an output of
  11484. size 200x400.
  11485. @example
  11486. cellauto=f=pattern:s=200x400
  11487. @end example
  11488. @item
  11489. Generate a random initial row with a width of 200 cells, with a fill
  11490. ratio of 2/3:
  11491. @example
  11492. cellauto=ratio=2/3:s=200x200
  11493. @end example
  11494. @item
  11495. Create a pattern generated by rule 18 starting by a single alive cell
  11496. centered on an initial row with width 100:
  11497. @example
  11498. cellauto=p=@@:s=100x400:full=0:rule=18
  11499. @end example
  11500. @item
  11501. Specify a more elaborated initial pattern:
  11502. @example
  11503. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11504. @end example
  11505. @end itemize
  11506. @anchor{coreimagesrc}
  11507. @section coreimagesrc
  11508. Video source generated on GPU using Apple's CoreImage API on OSX.
  11509. This video source is a specialized version of the @ref{coreimage} video filter.
  11510. Use a core image generator at the beginning of the applied filterchain to
  11511. generate the content.
  11512. The coreimagesrc video source accepts the following options:
  11513. @table @option
  11514. @item list_generators
  11515. List all available generators along with all their respective options as well as
  11516. possible minimum and maximum values along with the default values.
  11517. @example
  11518. list_generators=true
  11519. @end example
  11520. @item size, s
  11521. Specify the size of the sourced video. For the syntax of this option, check the
  11522. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11523. The default value is @code{320x240}.
  11524. @item rate, r
  11525. Specify the frame rate of the sourced video, as the number of frames
  11526. generated per second. It has to be a string in the format
  11527. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11528. number or a valid video frame rate abbreviation. The default value is
  11529. "25".
  11530. @item sar
  11531. Set the sample aspect ratio of the sourced video.
  11532. @item duration, d
  11533. Set the duration of the sourced video. See
  11534. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11535. for the accepted syntax.
  11536. If not specified, or the expressed duration is negative, the video is
  11537. supposed to be generated forever.
  11538. @end table
  11539. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11540. A complete filterchain can be used for further processing of the
  11541. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11542. and examples for details.
  11543. @subsection Examples
  11544. @itemize
  11545. @item
  11546. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11547. given as complete and escaped command-line for Apple's standard bash shell:
  11548. @example
  11549. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11550. @end example
  11551. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11552. need for a nullsrc video source.
  11553. @end itemize
  11554. @section mandelbrot
  11555. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11556. point specified with @var{start_x} and @var{start_y}.
  11557. This source accepts the following options:
  11558. @table @option
  11559. @item end_pts
  11560. Set the terminal pts value. Default value is 400.
  11561. @item end_scale
  11562. Set the terminal scale value.
  11563. Must be a floating point value. Default value is 0.3.
  11564. @item inner
  11565. Set the inner coloring mode, that is the algorithm used to draw the
  11566. Mandelbrot fractal internal region.
  11567. It shall assume one of the following values:
  11568. @table @option
  11569. @item black
  11570. Set black mode.
  11571. @item convergence
  11572. Show time until convergence.
  11573. @item mincol
  11574. Set color based on point closest to the origin of the iterations.
  11575. @item period
  11576. Set period mode.
  11577. @end table
  11578. Default value is @var{mincol}.
  11579. @item bailout
  11580. Set the bailout value. Default value is 10.0.
  11581. @item maxiter
  11582. Set the maximum of iterations performed by the rendering
  11583. algorithm. Default value is 7189.
  11584. @item outer
  11585. Set outer coloring mode.
  11586. It shall assume one of following values:
  11587. @table @option
  11588. @item iteration_count
  11589. Set iteration cound mode.
  11590. @item normalized_iteration_count
  11591. set normalized iteration count mode.
  11592. @end table
  11593. Default value is @var{normalized_iteration_count}.
  11594. @item rate, r
  11595. Set frame rate, expressed as number of frames per second. Default
  11596. value is "25".
  11597. @item size, s
  11598. Set frame size. For the syntax of this option, check the "Video
  11599. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11600. @item start_scale
  11601. Set the initial scale value. Default value is 3.0.
  11602. @item start_x
  11603. Set the initial x position. Must be a floating point value between
  11604. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11605. @item start_y
  11606. Set the initial y position. Must be a floating point value between
  11607. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11608. @end table
  11609. @section mptestsrc
  11610. Generate various test patterns, as generated by the MPlayer test filter.
  11611. The size of the generated video is fixed, and is 256x256.
  11612. This source is useful in particular for testing encoding features.
  11613. This source accepts the following options:
  11614. @table @option
  11615. @item rate, r
  11616. Specify the frame rate of the sourced video, as the number of frames
  11617. generated per second. It has to be a string in the format
  11618. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11619. number or a valid video frame rate abbreviation. The default value is
  11620. "25".
  11621. @item duration, d
  11622. Set the duration of the sourced video. See
  11623. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11624. for the accepted syntax.
  11625. If not specified, or the expressed duration is negative, the video is
  11626. supposed to be generated forever.
  11627. @item test, t
  11628. Set the number or the name of the test to perform. Supported tests are:
  11629. @table @option
  11630. @item dc_luma
  11631. @item dc_chroma
  11632. @item freq_luma
  11633. @item freq_chroma
  11634. @item amp_luma
  11635. @item amp_chroma
  11636. @item cbp
  11637. @item mv
  11638. @item ring1
  11639. @item ring2
  11640. @item all
  11641. @end table
  11642. Default value is "all", which will cycle through the list of all tests.
  11643. @end table
  11644. Some examples:
  11645. @example
  11646. mptestsrc=t=dc_luma
  11647. @end example
  11648. will generate a "dc_luma" test pattern.
  11649. @section frei0r_src
  11650. Provide a frei0r source.
  11651. To enable compilation of this filter you need to install the frei0r
  11652. header and configure FFmpeg with @code{--enable-frei0r}.
  11653. This source accepts the following parameters:
  11654. @table @option
  11655. @item size
  11656. The size of the video to generate. For the syntax of this option, check the
  11657. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11658. @item framerate
  11659. The framerate of the generated video. It may be a string of the form
  11660. @var{num}/@var{den} or a frame rate abbreviation.
  11661. @item filter_name
  11662. The name to the frei0r source to load. For more information regarding frei0r and
  11663. how to set the parameters, read the @ref{frei0r} section in the video filters
  11664. documentation.
  11665. @item filter_params
  11666. A '|'-separated list of parameters to pass to the frei0r source.
  11667. @end table
  11668. For example, to generate a frei0r partik0l source with size 200x200
  11669. and frame rate 10 which is overlaid on the overlay filter main input:
  11670. @example
  11671. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11672. @end example
  11673. @section life
  11674. Generate a life pattern.
  11675. This source is based on a generalization of John Conway's life game.
  11676. The sourced input represents a life grid, each pixel represents a cell
  11677. which can be in one of two possible states, alive or dead. Every cell
  11678. interacts with its eight neighbours, which are the cells that are
  11679. horizontally, vertically, or diagonally adjacent.
  11680. At each interaction the grid evolves according to the adopted rule,
  11681. which specifies the number of neighbor alive cells which will make a
  11682. cell stay alive or born. The @option{rule} option allows one to specify
  11683. the rule to adopt.
  11684. This source accepts the following options:
  11685. @table @option
  11686. @item filename, f
  11687. Set the file from which to read the initial grid state. In the file,
  11688. each non-whitespace character is considered an alive cell, and newline
  11689. is used to delimit the end of each row.
  11690. If this option is not specified, the initial grid is generated
  11691. randomly.
  11692. @item rate, r
  11693. Set the video rate, that is the number of frames generated per second.
  11694. Default is 25.
  11695. @item random_fill_ratio, ratio
  11696. Set the random fill ratio for the initial random grid. It is a
  11697. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11698. It is ignored when a file is specified.
  11699. @item random_seed, seed
  11700. Set the seed for filling the initial random grid, must be an integer
  11701. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11702. set to -1, the filter will try to use a good random seed on a best
  11703. effort basis.
  11704. @item rule
  11705. Set the life rule.
  11706. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11707. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11708. @var{NS} specifies the number of alive neighbor cells which make a
  11709. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11710. which make a dead cell to become alive (i.e. to "born").
  11711. "s" and "b" can be used in place of "S" and "B", respectively.
  11712. Alternatively a rule can be specified by an 18-bits integer. The 9
  11713. high order bits are used to encode the next cell state if it is alive
  11714. for each number of neighbor alive cells, the low order bits specify
  11715. the rule for "borning" new cells. Higher order bits encode for an
  11716. higher number of neighbor cells.
  11717. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11718. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11719. Default value is "S23/B3", which is the original Conway's game of life
  11720. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11721. cells, and will born a new cell if there are three alive cells around
  11722. a dead cell.
  11723. @item size, s
  11724. Set the size of the output video. For the syntax of this option, check the
  11725. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11726. If @option{filename} is specified, the size is set by default to the
  11727. same size of the input file. If @option{size} is set, it must contain
  11728. the size specified in the input file, and the initial grid defined in
  11729. that file is centered in the larger resulting area.
  11730. If a filename is not specified, the size value defaults to "320x240"
  11731. (used for a randomly generated initial grid).
  11732. @item stitch
  11733. If set to 1, stitch the left and right grid edges together, and the
  11734. top and bottom edges also. Defaults to 1.
  11735. @item mold
  11736. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11737. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11738. value from 0 to 255.
  11739. @item life_color
  11740. Set the color of living (or new born) cells.
  11741. @item death_color
  11742. Set the color of dead cells. If @option{mold} is set, this is the first color
  11743. used to represent a dead cell.
  11744. @item mold_color
  11745. Set mold color, for definitely dead and moldy cells.
  11746. For the syntax of these 3 color options, check the "Color" section in the
  11747. ffmpeg-utils manual.
  11748. @end table
  11749. @subsection Examples
  11750. @itemize
  11751. @item
  11752. Read a grid from @file{pattern}, and center it on a grid of size
  11753. 300x300 pixels:
  11754. @example
  11755. life=f=pattern:s=300x300
  11756. @end example
  11757. @item
  11758. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11759. @example
  11760. life=ratio=2/3:s=200x200
  11761. @end example
  11762. @item
  11763. Specify a custom rule for evolving a randomly generated grid:
  11764. @example
  11765. life=rule=S14/B34
  11766. @end example
  11767. @item
  11768. Full example with slow death effect (mold) using @command{ffplay}:
  11769. @example
  11770. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11771. @end example
  11772. @end itemize
  11773. @anchor{allrgb}
  11774. @anchor{allyuv}
  11775. @anchor{color}
  11776. @anchor{haldclutsrc}
  11777. @anchor{nullsrc}
  11778. @anchor{rgbtestsrc}
  11779. @anchor{smptebars}
  11780. @anchor{smptehdbars}
  11781. @anchor{testsrc}
  11782. @anchor{testsrc2}
  11783. @anchor{yuvtestsrc}
  11784. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  11785. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11786. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11787. The @code{color} source provides an uniformly colored input.
  11788. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11789. @ref{haldclut} filter.
  11790. The @code{nullsrc} source returns unprocessed video frames. It is
  11791. mainly useful to be employed in analysis / debugging tools, or as the
  11792. source for filters which ignore the input data.
  11793. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11794. detecting RGB vs BGR issues. You should see a red, green and blue
  11795. stripe from top to bottom.
  11796. The @code{smptebars} source generates a color bars pattern, based on
  11797. the SMPTE Engineering Guideline EG 1-1990.
  11798. The @code{smptehdbars} source generates a color bars pattern, based on
  11799. the SMPTE RP 219-2002.
  11800. The @code{testsrc} source generates a test video pattern, showing a
  11801. color pattern, a scrolling gradient and a timestamp. This is mainly
  11802. intended for testing purposes.
  11803. The @code{testsrc2} source is similar to testsrc, but supports more
  11804. pixel formats instead of just @code{rgb24}. This allows using it as an
  11805. input for other tests without requiring a format conversion.
  11806. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  11807. see a y, cb and cr stripe from top to bottom.
  11808. The sources accept the following parameters:
  11809. @table @option
  11810. @item color, c
  11811. Specify the color of the source, only available in the @code{color}
  11812. source. For the syntax of this option, check the "Color" section in the
  11813. ffmpeg-utils manual.
  11814. @item level
  11815. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11816. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11817. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11818. coded on a @code{1/(N*N)} scale.
  11819. @item size, s
  11820. Specify the size of the sourced video. For the syntax of this option, check the
  11821. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11822. The default value is @code{320x240}.
  11823. This option is not available with the @code{haldclutsrc} filter.
  11824. @item rate, r
  11825. Specify the frame rate of the sourced video, as the number of frames
  11826. generated per second. It has to be a string in the format
  11827. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11828. number or a valid video frame rate abbreviation. The default value is
  11829. "25".
  11830. @item sar
  11831. Set the sample aspect ratio of the sourced video.
  11832. @item duration, d
  11833. Set the duration of the sourced video. See
  11834. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11835. for the accepted syntax.
  11836. If not specified, or the expressed duration is negative, the video is
  11837. supposed to be generated forever.
  11838. @item decimals, n
  11839. Set the number of decimals to show in the timestamp, only available in the
  11840. @code{testsrc} source.
  11841. The displayed timestamp value will correspond to the original
  11842. timestamp value multiplied by the power of 10 of the specified
  11843. value. Default value is 0.
  11844. @end table
  11845. For example the following:
  11846. @example
  11847. testsrc=duration=5.3:size=qcif:rate=10
  11848. @end example
  11849. will generate a video with a duration of 5.3 seconds, with size
  11850. 176x144 and a frame rate of 10 frames per second.
  11851. The following graph description will generate a red source
  11852. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11853. frames per second.
  11854. @example
  11855. color=c=red@@0.2:s=qcif:r=10
  11856. @end example
  11857. If the input content is to be ignored, @code{nullsrc} can be used. The
  11858. following command generates noise in the luminance plane by employing
  11859. the @code{geq} filter:
  11860. @example
  11861. nullsrc=s=256x256, geq=random(1)*255:128:128
  11862. @end example
  11863. @subsection Commands
  11864. The @code{color} source supports the following commands:
  11865. @table @option
  11866. @item c, color
  11867. Set the color of the created image. Accepts the same syntax of the
  11868. corresponding @option{color} option.
  11869. @end table
  11870. @c man end VIDEO SOURCES
  11871. @chapter Video Sinks
  11872. @c man begin VIDEO SINKS
  11873. Below is a description of the currently available video sinks.
  11874. @section buffersink
  11875. Buffer video frames, and make them available to the end of the filter
  11876. graph.
  11877. This sink is mainly intended for programmatic use, in particular
  11878. through the interface defined in @file{libavfilter/buffersink.h}
  11879. or the options system.
  11880. It accepts a pointer to an AVBufferSinkContext structure, which
  11881. defines the incoming buffers' formats, to be passed as the opaque
  11882. parameter to @code{avfilter_init_filter} for initialization.
  11883. @section nullsink
  11884. Null video sink: do absolutely nothing with the input video. It is
  11885. mainly useful as a template and for use in analysis / debugging
  11886. tools.
  11887. @c man end VIDEO SINKS
  11888. @chapter Multimedia Filters
  11889. @c man begin MULTIMEDIA FILTERS
  11890. Below is a description of the currently available multimedia filters.
  11891. @section ahistogram
  11892. Convert input audio to a video output, displaying the volume histogram.
  11893. The filter accepts the following options:
  11894. @table @option
  11895. @item dmode
  11896. Specify how histogram is calculated.
  11897. It accepts the following values:
  11898. @table @samp
  11899. @item single
  11900. Use single histogram for all channels.
  11901. @item separate
  11902. Use separate histogram for each channel.
  11903. @end table
  11904. Default is @code{single}.
  11905. @item rate, r
  11906. Set frame rate, expressed as number of frames per second. Default
  11907. value is "25".
  11908. @item size, s
  11909. Specify the video size for the output. For the syntax of this option, check the
  11910. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11911. Default value is @code{hd720}.
  11912. @item scale
  11913. Set display scale.
  11914. It accepts the following values:
  11915. @table @samp
  11916. @item log
  11917. logarithmic
  11918. @item sqrt
  11919. square root
  11920. @item cbrt
  11921. cubic root
  11922. @item lin
  11923. linear
  11924. @item rlog
  11925. reverse logarithmic
  11926. @end table
  11927. Default is @code{log}.
  11928. @item ascale
  11929. Set amplitude scale.
  11930. It accepts the following values:
  11931. @table @samp
  11932. @item log
  11933. logarithmic
  11934. @item lin
  11935. linear
  11936. @end table
  11937. Default is @code{log}.
  11938. @item acount
  11939. Set how much frames to accumulate in histogram.
  11940. Defauls is 1. Setting this to -1 accumulates all frames.
  11941. @item rheight
  11942. Set histogram ratio of window height.
  11943. @item slide
  11944. Set sonogram sliding.
  11945. It accepts the following values:
  11946. @table @samp
  11947. @item replace
  11948. replace old rows with new ones.
  11949. @item scroll
  11950. scroll from top to bottom.
  11951. @end table
  11952. Default is @code{replace}.
  11953. @end table
  11954. @section aphasemeter
  11955. Convert input audio to a video output, displaying the audio phase.
  11956. The filter accepts the following options:
  11957. @table @option
  11958. @item rate, r
  11959. Set the output frame rate. Default value is @code{25}.
  11960. @item size, s
  11961. Set the video size for the output. For the syntax of this option, check the
  11962. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11963. Default value is @code{800x400}.
  11964. @item rc
  11965. @item gc
  11966. @item bc
  11967. Specify the red, green, blue contrast. Default values are @code{2},
  11968. @code{7} and @code{1}.
  11969. Allowed range is @code{[0, 255]}.
  11970. @item mpc
  11971. Set color which will be used for drawing median phase. If color is
  11972. @code{none} which is default, no median phase value will be drawn.
  11973. @end table
  11974. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  11975. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  11976. The @code{-1} means left and right channels are completely out of phase and
  11977. @code{1} means channels are in phase.
  11978. @section avectorscope
  11979. Convert input audio to a video output, representing the audio vector
  11980. scope.
  11981. The filter is used to measure the difference between channels of stereo
  11982. audio stream. A monoaural signal, consisting of identical left and right
  11983. signal, results in straight vertical line. Any stereo separation is visible
  11984. as a deviation from this line, creating a Lissajous figure.
  11985. If the straight (or deviation from it) but horizontal line appears this
  11986. indicates that the left and right channels are out of phase.
  11987. The filter accepts the following options:
  11988. @table @option
  11989. @item mode, m
  11990. Set the vectorscope mode.
  11991. Available values are:
  11992. @table @samp
  11993. @item lissajous
  11994. Lissajous rotated by 45 degrees.
  11995. @item lissajous_xy
  11996. Same as above but not rotated.
  11997. @item polar
  11998. Shape resembling half of circle.
  11999. @end table
  12000. Default value is @samp{lissajous}.
  12001. @item size, s
  12002. Set the video size for the output. For the syntax of this option, check the
  12003. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12004. Default value is @code{400x400}.
  12005. @item rate, r
  12006. Set the output frame rate. Default value is @code{25}.
  12007. @item rc
  12008. @item gc
  12009. @item bc
  12010. @item ac
  12011. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12012. @code{160}, @code{80} and @code{255}.
  12013. Allowed range is @code{[0, 255]}.
  12014. @item rf
  12015. @item gf
  12016. @item bf
  12017. @item af
  12018. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12019. @code{10}, @code{5} and @code{5}.
  12020. Allowed range is @code{[0, 255]}.
  12021. @item zoom
  12022. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12023. @item draw
  12024. Set the vectorscope drawing mode.
  12025. Available values are:
  12026. @table @samp
  12027. @item dot
  12028. Draw dot for each sample.
  12029. @item line
  12030. Draw line between previous and current sample.
  12031. @end table
  12032. Default value is @samp{dot}.
  12033. @item scale
  12034. Specify amplitude scale of audio samples.
  12035. Available values are:
  12036. @table @samp
  12037. @item lin
  12038. Linear.
  12039. @item sqrt
  12040. Square root.
  12041. @item cbrt
  12042. Cubic root.
  12043. @item log
  12044. Logarithmic.
  12045. @end table
  12046. @end table
  12047. @subsection Examples
  12048. @itemize
  12049. @item
  12050. Complete example using @command{ffplay}:
  12051. @example
  12052. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12053. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12054. @end example
  12055. @end itemize
  12056. @section bench, abench
  12057. Benchmark part of a filtergraph.
  12058. The filter accepts the following options:
  12059. @table @option
  12060. @item action
  12061. Start or stop a timer.
  12062. Available values are:
  12063. @table @samp
  12064. @item start
  12065. Get the current time, set it as frame metadata (using the key
  12066. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12067. @item stop
  12068. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12069. the input frame metadata to get the time difference. Time difference, average,
  12070. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12071. @code{min}) are then printed. The timestamps are expressed in seconds.
  12072. @end table
  12073. @end table
  12074. @subsection Examples
  12075. @itemize
  12076. @item
  12077. Benchmark @ref{selectivecolor} filter:
  12078. @example
  12079. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12080. @end example
  12081. @end itemize
  12082. @section concat
  12083. Concatenate audio and video streams, joining them together one after the
  12084. other.
  12085. The filter works on segments of synchronized video and audio streams. All
  12086. segments must have the same number of streams of each type, and that will
  12087. also be the number of streams at output.
  12088. The filter accepts the following options:
  12089. @table @option
  12090. @item n
  12091. Set the number of segments. Default is 2.
  12092. @item v
  12093. Set the number of output video streams, that is also the number of video
  12094. streams in each segment. Default is 1.
  12095. @item a
  12096. Set the number of output audio streams, that is also the number of audio
  12097. streams in each segment. Default is 0.
  12098. @item unsafe
  12099. Activate unsafe mode: do not fail if segments have a different format.
  12100. @end table
  12101. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12102. @var{a} audio outputs.
  12103. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12104. segment, in the same order as the outputs, then the inputs for the second
  12105. segment, etc.
  12106. Related streams do not always have exactly the same duration, for various
  12107. reasons including codec frame size or sloppy authoring. For that reason,
  12108. related synchronized streams (e.g. a video and its audio track) should be
  12109. concatenated at once. The concat filter will use the duration of the longest
  12110. stream in each segment (except the last one), and if necessary pad shorter
  12111. audio streams with silence.
  12112. For this filter to work correctly, all segments must start at timestamp 0.
  12113. All corresponding streams must have the same parameters in all segments; the
  12114. filtering system will automatically select a common pixel format for video
  12115. streams, and a common sample format, sample rate and channel layout for
  12116. audio streams, but other settings, such as resolution, must be converted
  12117. explicitly by the user.
  12118. Different frame rates are acceptable but will result in variable frame rate
  12119. at output; be sure to configure the output file to handle it.
  12120. @subsection Examples
  12121. @itemize
  12122. @item
  12123. Concatenate an opening, an episode and an ending, all in bilingual version
  12124. (video in stream 0, audio in streams 1 and 2):
  12125. @example
  12126. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12127. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12128. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12129. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12130. @end example
  12131. @item
  12132. Concatenate two parts, handling audio and video separately, using the
  12133. (a)movie sources, and adjusting the resolution:
  12134. @example
  12135. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12136. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12137. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12138. @end example
  12139. Note that a desync will happen at the stitch if the audio and video streams
  12140. do not have exactly the same duration in the first file.
  12141. @end itemize
  12142. @section drawgraph, adrawgraph
  12143. Draw a graph using input video or audio metadata.
  12144. It accepts the following parameters:
  12145. @table @option
  12146. @item m1
  12147. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12148. @item fg1
  12149. Set 1st foreground color expression.
  12150. @item m2
  12151. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12152. @item fg2
  12153. Set 2nd foreground color expression.
  12154. @item m3
  12155. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12156. @item fg3
  12157. Set 3rd foreground color expression.
  12158. @item m4
  12159. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12160. @item fg4
  12161. Set 4th foreground color expression.
  12162. @item min
  12163. Set minimal value of metadata value.
  12164. @item max
  12165. Set maximal value of metadata value.
  12166. @item bg
  12167. Set graph background color. Default is white.
  12168. @item mode
  12169. Set graph mode.
  12170. Available values for mode is:
  12171. @table @samp
  12172. @item bar
  12173. @item dot
  12174. @item line
  12175. @end table
  12176. Default is @code{line}.
  12177. @item slide
  12178. Set slide mode.
  12179. Available values for slide is:
  12180. @table @samp
  12181. @item frame
  12182. Draw new frame when right border is reached.
  12183. @item replace
  12184. Replace old columns with new ones.
  12185. @item scroll
  12186. Scroll from right to left.
  12187. @item rscroll
  12188. Scroll from left to right.
  12189. @item picture
  12190. Draw single picture.
  12191. @end table
  12192. Default is @code{frame}.
  12193. @item size
  12194. Set size of graph video. For the syntax of this option, check the
  12195. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12196. The default value is @code{900x256}.
  12197. The foreground color expressions can use the following variables:
  12198. @table @option
  12199. @item MIN
  12200. Minimal value of metadata value.
  12201. @item MAX
  12202. Maximal value of metadata value.
  12203. @item VAL
  12204. Current metadata key value.
  12205. @end table
  12206. The color is defined as 0xAABBGGRR.
  12207. @end table
  12208. Example using metadata from @ref{signalstats} filter:
  12209. @example
  12210. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12211. @end example
  12212. Example using metadata from @ref{ebur128} filter:
  12213. @example
  12214. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12215. @end example
  12216. @anchor{ebur128}
  12217. @section ebur128
  12218. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12219. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12220. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12221. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12222. The filter also has a video output (see the @var{video} option) with a real
  12223. time graph to observe the loudness evolution. The graphic contains the logged
  12224. message mentioned above, so it is not printed anymore when this option is set,
  12225. unless the verbose logging is set. The main graphing area contains the
  12226. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12227. the momentary loudness (400 milliseconds).
  12228. More information about the Loudness Recommendation EBU R128 on
  12229. @url{http://tech.ebu.ch/loudness}.
  12230. The filter accepts the following options:
  12231. @table @option
  12232. @item video
  12233. Activate the video output. The audio stream is passed unchanged whether this
  12234. option is set or no. The video stream will be the first output stream if
  12235. activated. Default is @code{0}.
  12236. @item size
  12237. Set the video size. This option is for video only. For the syntax of this
  12238. option, check the
  12239. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12240. Default and minimum resolution is @code{640x480}.
  12241. @item meter
  12242. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12243. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12244. other integer value between this range is allowed.
  12245. @item metadata
  12246. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12247. into 100ms output frames, each of them containing various loudness information
  12248. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12249. Default is @code{0}.
  12250. @item framelog
  12251. Force the frame logging level.
  12252. Available values are:
  12253. @table @samp
  12254. @item info
  12255. information logging level
  12256. @item verbose
  12257. verbose logging level
  12258. @end table
  12259. By default, the logging level is set to @var{info}. If the @option{video} or
  12260. the @option{metadata} options are set, it switches to @var{verbose}.
  12261. @item peak
  12262. Set peak mode(s).
  12263. Available modes can be cumulated (the option is a @code{flag} type). Possible
  12264. values are:
  12265. @table @samp
  12266. @item none
  12267. Disable any peak mode (default).
  12268. @item sample
  12269. Enable sample-peak mode.
  12270. Simple peak mode looking for the higher sample value. It logs a message
  12271. for sample-peak (identified by @code{SPK}).
  12272. @item true
  12273. Enable true-peak mode.
  12274. If enabled, the peak lookup is done on an over-sampled version of the input
  12275. stream for better peak accuracy. It logs a message for true-peak.
  12276. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  12277. This mode requires a build with @code{libswresample}.
  12278. @end table
  12279. @item dualmono
  12280. Treat mono input files as "dual mono". If a mono file is intended for playback
  12281. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  12282. If set to @code{true}, this option will compensate for this effect.
  12283. Multi-channel input files are not affected by this option.
  12284. @item panlaw
  12285. Set a specific pan law to be used for the measurement of dual mono files.
  12286. This parameter is optional, and has a default value of -3.01dB.
  12287. @end table
  12288. @subsection Examples
  12289. @itemize
  12290. @item
  12291. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  12292. @example
  12293. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  12294. @end example
  12295. @item
  12296. Run an analysis with @command{ffmpeg}:
  12297. @example
  12298. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  12299. @end example
  12300. @end itemize
  12301. @section interleave, ainterleave
  12302. Temporally interleave frames from several inputs.
  12303. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  12304. These filters read frames from several inputs and send the oldest
  12305. queued frame to the output.
  12306. Input streams must have well defined, monotonically increasing frame
  12307. timestamp values.
  12308. In order to submit one frame to output, these filters need to enqueue
  12309. at least one frame for each input, so they cannot work in case one
  12310. input is not yet terminated and will not receive incoming frames.
  12311. For example consider the case when one input is a @code{select} filter
  12312. which always drops input frames. The @code{interleave} filter will keep
  12313. reading from that input, but it will never be able to send new frames
  12314. to output until the input sends an end-of-stream signal.
  12315. Also, depending on inputs synchronization, the filters will drop
  12316. frames in case one input receives more frames than the other ones, and
  12317. the queue is already filled.
  12318. These filters accept the following options:
  12319. @table @option
  12320. @item nb_inputs, n
  12321. Set the number of different inputs, it is 2 by default.
  12322. @end table
  12323. @subsection Examples
  12324. @itemize
  12325. @item
  12326. Interleave frames belonging to different streams using @command{ffmpeg}:
  12327. @example
  12328. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  12329. @end example
  12330. @item
  12331. Add flickering blur effect:
  12332. @example
  12333. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  12334. @end example
  12335. @end itemize
  12336. @section metadata, ametadata
  12337. Manipulate frame metadata.
  12338. This filter accepts the following options:
  12339. @table @option
  12340. @item mode
  12341. Set mode of operation of the filter.
  12342. Can be one of the following:
  12343. @table @samp
  12344. @item select
  12345. If both @code{value} and @code{key} is set, select frames
  12346. which have such metadata. If only @code{key} is set, select
  12347. every frame that has such key in metadata.
  12348. @item add
  12349. Add new metadata @code{key} and @code{value}. If key is already available
  12350. do nothing.
  12351. @item modify
  12352. Modify value of already present key.
  12353. @item delete
  12354. If @code{value} is set, delete only keys that have such value.
  12355. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  12356. the frame.
  12357. @item print
  12358. Print key and its value if metadata was found. If @code{key} is not set print all
  12359. metadata values available in frame.
  12360. @end table
  12361. @item key
  12362. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  12363. @item value
  12364. Set metadata value which will be used. This option is mandatory for
  12365. @code{modify} and @code{add} mode.
  12366. @item function
  12367. Which function to use when comparing metadata value and @code{value}.
  12368. Can be one of following:
  12369. @table @samp
  12370. @item same_str
  12371. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  12372. @item starts_with
  12373. Values are interpreted as strings, returns true if metadata value starts with
  12374. the @code{value} option string.
  12375. @item less
  12376. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  12377. @item equal
  12378. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  12379. @item greater
  12380. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  12381. @item expr
  12382. Values are interpreted as floats, returns true if expression from option @code{expr}
  12383. evaluates to true.
  12384. @end table
  12385. @item expr
  12386. Set expression which is used when @code{function} is set to @code{expr}.
  12387. The expression is evaluated through the eval API and can contain the following
  12388. constants:
  12389. @table @option
  12390. @item VALUE1
  12391. Float representation of @code{value} from metadata key.
  12392. @item VALUE2
  12393. Float representation of @code{value} as supplied by user in @code{value} option.
  12394. @item file
  12395. If specified in @code{print} mode, output is written to the named file. Instead of
  12396. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  12397. for standard output. If @code{file} option is not set, output is written to the log
  12398. with AV_LOG_INFO loglevel.
  12399. @end table
  12400. @end table
  12401. @subsection Examples
  12402. @itemize
  12403. @item
  12404. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  12405. between 0 and 1.
  12406. @example
  12407. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  12408. @end example
  12409. @item
  12410. Print silencedetect output to file @file{metadata.txt}.
  12411. @example
  12412. silencedetect,ametadata=mode=print:file=metadata.txt
  12413. @end example
  12414. @item
  12415. Direct all metadata to a pipe with file descriptor 4.
  12416. @example
  12417. metadata=mode=print:file='pipe\:4'
  12418. @end example
  12419. @end itemize
  12420. @section perms, aperms
  12421. Set read/write permissions for the output frames.
  12422. These filters are mainly aimed at developers to test direct path in the
  12423. following filter in the filtergraph.
  12424. The filters accept the following options:
  12425. @table @option
  12426. @item mode
  12427. Select the permissions mode.
  12428. It accepts the following values:
  12429. @table @samp
  12430. @item none
  12431. Do nothing. This is the default.
  12432. @item ro
  12433. Set all the output frames read-only.
  12434. @item rw
  12435. Set all the output frames directly writable.
  12436. @item toggle
  12437. Make the frame read-only if writable, and writable if read-only.
  12438. @item random
  12439. Set each output frame read-only or writable randomly.
  12440. @end table
  12441. @item seed
  12442. Set the seed for the @var{random} mode, must be an integer included between
  12443. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12444. @code{-1}, the filter will try to use a good random seed on a best effort
  12445. basis.
  12446. @end table
  12447. Note: in case of auto-inserted filter between the permission filter and the
  12448. following one, the permission might not be received as expected in that
  12449. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  12450. perms/aperms filter can avoid this problem.
  12451. @section realtime, arealtime
  12452. Slow down filtering to match real time approximatively.
  12453. These filters will pause the filtering for a variable amount of time to
  12454. match the output rate with the input timestamps.
  12455. They are similar to the @option{re} option to @code{ffmpeg}.
  12456. They accept the following options:
  12457. @table @option
  12458. @item limit
  12459. Time limit for the pauses. Any pause longer than that will be considered
  12460. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  12461. @end table
  12462. @anchor{select}
  12463. @section select, aselect
  12464. Select frames to pass in output.
  12465. This filter accepts the following options:
  12466. @table @option
  12467. @item expr, e
  12468. Set expression, which is evaluated for each input frame.
  12469. If the expression is evaluated to zero, the frame is discarded.
  12470. If the evaluation result is negative or NaN, the frame is sent to the
  12471. first output; otherwise it is sent to the output with index
  12472. @code{ceil(val)-1}, assuming that the input index starts from 0.
  12473. For example a value of @code{1.2} corresponds to the output with index
  12474. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  12475. @item outputs, n
  12476. Set the number of outputs. The output to which to send the selected
  12477. frame is based on the result of the evaluation. Default value is 1.
  12478. @end table
  12479. The expression can contain the following constants:
  12480. @table @option
  12481. @item n
  12482. The (sequential) number of the filtered frame, starting from 0.
  12483. @item selected_n
  12484. The (sequential) number of the selected frame, starting from 0.
  12485. @item prev_selected_n
  12486. The sequential number of the last selected frame. It's NAN if undefined.
  12487. @item TB
  12488. The timebase of the input timestamps.
  12489. @item pts
  12490. The PTS (Presentation TimeStamp) of the filtered video frame,
  12491. expressed in @var{TB} units. It's NAN if undefined.
  12492. @item t
  12493. The PTS of the filtered video frame,
  12494. expressed in seconds. It's NAN if undefined.
  12495. @item prev_pts
  12496. The PTS of the previously filtered video frame. It's NAN if undefined.
  12497. @item prev_selected_pts
  12498. The PTS of the last previously filtered video frame. It's NAN if undefined.
  12499. @item prev_selected_t
  12500. The PTS of the last previously selected video frame. It's NAN if undefined.
  12501. @item start_pts
  12502. The PTS of the first video frame in the video. It's NAN if undefined.
  12503. @item start_t
  12504. The time of the first video frame in the video. It's NAN if undefined.
  12505. @item pict_type @emph{(video only)}
  12506. The type of the filtered frame. It can assume one of the following
  12507. values:
  12508. @table @option
  12509. @item I
  12510. @item P
  12511. @item B
  12512. @item S
  12513. @item SI
  12514. @item SP
  12515. @item BI
  12516. @end table
  12517. @item interlace_type @emph{(video only)}
  12518. The frame interlace type. It can assume one of the following values:
  12519. @table @option
  12520. @item PROGRESSIVE
  12521. The frame is progressive (not interlaced).
  12522. @item TOPFIRST
  12523. The frame is top-field-first.
  12524. @item BOTTOMFIRST
  12525. The frame is bottom-field-first.
  12526. @end table
  12527. @item consumed_sample_n @emph{(audio only)}
  12528. the number of selected samples before the current frame
  12529. @item samples_n @emph{(audio only)}
  12530. the number of samples in the current frame
  12531. @item sample_rate @emph{(audio only)}
  12532. the input sample rate
  12533. @item key
  12534. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  12535. @item pos
  12536. the position in the file of the filtered frame, -1 if the information
  12537. is not available (e.g. for synthetic video)
  12538. @item scene @emph{(video only)}
  12539. value between 0 and 1 to indicate a new scene; a low value reflects a low
  12540. probability for the current frame to introduce a new scene, while a higher
  12541. value means the current frame is more likely to be one (see the example below)
  12542. @item concatdec_select
  12543. The concat demuxer can select only part of a concat input file by setting an
  12544. inpoint and an outpoint, but the output packets may not be entirely contained
  12545. in the selected interval. By using this variable, it is possible to skip frames
  12546. generated by the concat demuxer which are not exactly contained in the selected
  12547. interval.
  12548. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  12549. and the @var{lavf.concat.duration} packet metadata values which are also
  12550. present in the decoded frames.
  12551. The @var{concatdec_select} variable is -1 if the frame pts is at least
  12552. start_time and either the duration metadata is missing or the frame pts is less
  12553. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  12554. missing.
  12555. That basically means that an input frame is selected if its pts is within the
  12556. interval set by the concat demuxer.
  12557. @end table
  12558. The default value of the select expression is "1".
  12559. @subsection Examples
  12560. @itemize
  12561. @item
  12562. Select all frames in input:
  12563. @example
  12564. select
  12565. @end example
  12566. The example above is the same as:
  12567. @example
  12568. select=1
  12569. @end example
  12570. @item
  12571. Skip all frames:
  12572. @example
  12573. select=0
  12574. @end example
  12575. @item
  12576. Select only I-frames:
  12577. @example
  12578. select='eq(pict_type\,I)'
  12579. @end example
  12580. @item
  12581. Select one frame every 100:
  12582. @example
  12583. select='not(mod(n\,100))'
  12584. @end example
  12585. @item
  12586. Select only frames contained in the 10-20 time interval:
  12587. @example
  12588. select=between(t\,10\,20)
  12589. @end example
  12590. @item
  12591. Select only I-frames contained in the 10-20 time interval:
  12592. @example
  12593. select=between(t\,10\,20)*eq(pict_type\,I)
  12594. @end example
  12595. @item
  12596. Select frames with a minimum distance of 10 seconds:
  12597. @example
  12598. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  12599. @end example
  12600. @item
  12601. Use aselect to select only audio frames with samples number > 100:
  12602. @example
  12603. aselect='gt(samples_n\,100)'
  12604. @end example
  12605. @item
  12606. Create a mosaic of the first scenes:
  12607. @example
  12608. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  12609. @end example
  12610. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  12611. choice.
  12612. @item
  12613. Send even and odd frames to separate outputs, and compose them:
  12614. @example
  12615. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  12616. @end example
  12617. @item
  12618. Select useful frames from an ffconcat file which is using inpoints and
  12619. outpoints but where the source files are not intra frame only.
  12620. @example
  12621. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  12622. @end example
  12623. @end itemize
  12624. @section sendcmd, asendcmd
  12625. Send commands to filters in the filtergraph.
  12626. These filters read commands to be sent to other filters in the
  12627. filtergraph.
  12628. @code{sendcmd} must be inserted between two video filters,
  12629. @code{asendcmd} must be inserted between two audio filters, but apart
  12630. from that they act the same way.
  12631. The specification of commands can be provided in the filter arguments
  12632. with the @var{commands} option, or in a file specified by the
  12633. @var{filename} option.
  12634. These filters accept the following options:
  12635. @table @option
  12636. @item commands, c
  12637. Set the commands to be read and sent to the other filters.
  12638. @item filename, f
  12639. Set the filename of the commands to be read and sent to the other
  12640. filters.
  12641. @end table
  12642. @subsection Commands syntax
  12643. A commands description consists of a sequence of interval
  12644. specifications, comprising a list of commands to be executed when a
  12645. particular event related to that interval occurs. The occurring event
  12646. is typically the current frame time entering or leaving a given time
  12647. interval.
  12648. An interval is specified by the following syntax:
  12649. @example
  12650. @var{START}[-@var{END}] @var{COMMANDS};
  12651. @end example
  12652. The time interval is specified by the @var{START} and @var{END} times.
  12653. @var{END} is optional and defaults to the maximum time.
  12654. The current frame time is considered within the specified interval if
  12655. it is included in the interval [@var{START}, @var{END}), that is when
  12656. the time is greater or equal to @var{START} and is lesser than
  12657. @var{END}.
  12658. @var{COMMANDS} consists of a sequence of one or more command
  12659. specifications, separated by ",", relating to that interval. The
  12660. syntax of a command specification is given by:
  12661. @example
  12662. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  12663. @end example
  12664. @var{FLAGS} is optional and specifies the type of events relating to
  12665. the time interval which enable sending the specified command, and must
  12666. be a non-null sequence of identifier flags separated by "+" or "|" and
  12667. enclosed between "[" and "]".
  12668. The following flags are recognized:
  12669. @table @option
  12670. @item enter
  12671. The command is sent when the current frame timestamp enters the
  12672. specified interval. In other words, the command is sent when the
  12673. previous frame timestamp was not in the given interval, and the
  12674. current is.
  12675. @item leave
  12676. The command is sent when the current frame timestamp leaves the
  12677. specified interval. In other words, the command is sent when the
  12678. previous frame timestamp was in the given interval, and the
  12679. current is not.
  12680. @end table
  12681. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  12682. assumed.
  12683. @var{TARGET} specifies the target of the command, usually the name of
  12684. the filter class or a specific filter instance name.
  12685. @var{COMMAND} specifies the name of the command for the target filter.
  12686. @var{ARG} is optional and specifies the optional list of argument for
  12687. the given @var{COMMAND}.
  12688. Between one interval specification and another, whitespaces, or
  12689. sequences of characters starting with @code{#} until the end of line,
  12690. are ignored and can be used to annotate comments.
  12691. A simplified BNF description of the commands specification syntax
  12692. follows:
  12693. @example
  12694. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12695. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12696. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12697. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12698. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12699. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12700. @end example
  12701. @subsection Examples
  12702. @itemize
  12703. @item
  12704. Specify audio tempo change at second 4:
  12705. @example
  12706. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12707. @end example
  12708. @item
  12709. Specify a list of drawtext and hue commands in a file.
  12710. @example
  12711. # show text in the interval 5-10
  12712. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12713. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12714. # desaturate the image in the interval 15-20
  12715. 15.0-20.0 [enter] hue s 0,
  12716. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12717. [leave] hue s 1,
  12718. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12719. # apply an exponential saturation fade-out effect, starting from time 25
  12720. 25 [enter] hue s exp(25-t)
  12721. @end example
  12722. A filtergraph allowing to read and process the above command list
  12723. stored in a file @file{test.cmd}, can be specified with:
  12724. @example
  12725. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12726. @end example
  12727. @end itemize
  12728. @anchor{setpts}
  12729. @section setpts, asetpts
  12730. Change the PTS (presentation timestamp) of the input frames.
  12731. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12732. This filter accepts the following options:
  12733. @table @option
  12734. @item expr
  12735. The expression which is evaluated for each frame to construct its timestamp.
  12736. @end table
  12737. The expression is evaluated through the eval API and can contain the following
  12738. constants:
  12739. @table @option
  12740. @item FRAME_RATE
  12741. frame rate, only defined for constant frame-rate video
  12742. @item PTS
  12743. The presentation timestamp in input
  12744. @item N
  12745. The count of the input frame for video or the number of consumed samples,
  12746. not including the current frame for audio, starting from 0.
  12747. @item NB_CONSUMED_SAMPLES
  12748. The number of consumed samples, not including the current frame (only
  12749. audio)
  12750. @item NB_SAMPLES, S
  12751. The number of samples in the current frame (only audio)
  12752. @item SAMPLE_RATE, SR
  12753. The audio sample rate.
  12754. @item STARTPTS
  12755. The PTS of the first frame.
  12756. @item STARTT
  12757. the time in seconds of the first frame
  12758. @item INTERLACED
  12759. State whether the current frame is interlaced.
  12760. @item T
  12761. the time in seconds of the current frame
  12762. @item POS
  12763. original position in the file of the frame, or undefined if undefined
  12764. for the current frame
  12765. @item PREV_INPTS
  12766. The previous input PTS.
  12767. @item PREV_INT
  12768. previous input time in seconds
  12769. @item PREV_OUTPTS
  12770. The previous output PTS.
  12771. @item PREV_OUTT
  12772. previous output time in seconds
  12773. @item RTCTIME
  12774. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12775. instead.
  12776. @item RTCSTART
  12777. The wallclock (RTC) time at the start of the movie in microseconds.
  12778. @item TB
  12779. The timebase of the input timestamps.
  12780. @end table
  12781. @subsection Examples
  12782. @itemize
  12783. @item
  12784. Start counting PTS from zero
  12785. @example
  12786. setpts=PTS-STARTPTS
  12787. @end example
  12788. @item
  12789. Apply fast motion effect:
  12790. @example
  12791. setpts=0.5*PTS
  12792. @end example
  12793. @item
  12794. Apply slow motion effect:
  12795. @example
  12796. setpts=2.0*PTS
  12797. @end example
  12798. @item
  12799. Set fixed rate of 25 frames per second:
  12800. @example
  12801. setpts=N/(25*TB)
  12802. @end example
  12803. @item
  12804. Set fixed rate 25 fps with some jitter:
  12805. @example
  12806. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12807. @end example
  12808. @item
  12809. Apply an offset of 10 seconds to the input PTS:
  12810. @example
  12811. setpts=PTS+10/TB
  12812. @end example
  12813. @item
  12814. Generate timestamps from a "live source" and rebase onto the current timebase:
  12815. @example
  12816. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12817. @end example
  12818. @item
  12819. Generate timestamps by counting samples:
  12820. @example
  12821. asetpts=N/SR/TB
  12822. @end example
  12823. @end itemize
  12824. @section settb, asettb
  12825. Set the timebase to use for the output frames timestamps.
  12826. It is mainly useful for testing timebase configuration.
  12827. It accepts the following parameters:
  12828. @table @option
  12829. @item expr, tb
  12830. The expression which is evaluated into the output timebase.
  12831. @end table
  12832. The value for @option{tb} is an arithmetic expression representing a
  12833. rational. The expression can contain the constants "AVTB" (the default
  12834. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12835. audio only). Default value is "intb".
  12836. @subsection Examples
  12837. @itemize
  12838. @item
  12839. Set the timebase to 1/25:
  12840. @example
  12841. settb=expr=1/25
  12842. @end example
  12843. @item
  12844. Set the timebase to 1/10:
  12845. @example
  12846. settb=expr=0.1
  12847. @end example
  12848. @item
  12849. Set the timebase to 1001/1000:
  12850. @example
  12851. settb=1+0.001
  12852. @end example
  12853. @item
  12854. Set the timebase to 2*intb:
  12855. @example
  12856. settb=2*intb
  12857. @end example
  12858. @item
  12859. Set the default timebase value:
  12860. @example
  12861. settb=AVTB
  12862. @end example
  12863. @end itemize
  12864. @section showcqt
  12865. Convert input audio to a video output representing frequency spectrum
  12866. logarithmically using Brown-Puckette constant Q transform algorithm with
  12867. direct frequency domain coefficient calculation (but the transform itself
  12868. is not really constant Q, instead the Q factor is actually variable/clamped),
  12869. with musical tone scale, from E0 to D#10.
  12870. The filter accepts the following options:
  12871. @table @option
  12872. @item size, s
  12873. Specify the video size for the output. It must be even. For the syntax of this option,
  12874. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12875. Default value is @code{1920x1080}.
  12876. @item fps, rate, r
  12877. Set the output frame rate. Default value is @code{25}.
  12878. @item bar_h
  12879. Set the bargraph height. It must be even. Default value is @code{-1} which
  12880. computes the bargraph height automatically.
  12881. @item axis_h
  12882. Set the axis height. It must be even. Default value is @code{-1} which computes
  12883. the axis height automatically.
  12884. @item sono_h
  12885. Set the sonogram height. It must be even. Default value is @code{-1} which
  12886. computes the sonogram height automatically.
  12887. @item fullhd
  12888. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  12889. instead. Default value is @code{1}.
  12890. @item sono_v, volume
  12891. Specify the sonogram volume expression. It can contain variables:
  12892. @table @option
  12893. @item bar_v
  12894. the @var{bar_v} evaluated expression
  12895. @item frequency, freq, f
  12896. the frequency where it is evaluated
  12897. @item timeclamp, tc
  12898. the value of @var{timeclamp} option
  12899. @end table
  12900. and functions:
  12901. @table @option
  12902. @item a_weighting(f)
  12903. A-weighting of equal loudness
  12904. @item b_weighting(f)
  12905. B-weighting of equal loudness
  12906. @item c_weighting(f)
  12907. C-weighting of equal loudness.
  12908. @end table
  12909. Default value is @code{16}.
  12910. @item bar_v, volume2
  12911. Specify the bargraph volume expression. It can contain variables:
  12912. @table @option
  12913. @item sono_v
  12914. the @var{sono_v} evaluated expression
  12915. @item frequency, freq, f
  12916. the frequency where it is evaluated
  12917. @item timeclamp, tc
  12918. the value of @var{timeclamp} option
  12919. @end table
  12920. and functions:
  12921. @table @option
  12922. @item a_weighting(f)
  12923. A-weighting of equal loudness
  12924. @item b_weighting(f)
  12925. B-weighting of equal loudness
  12926. @item c_weighting(f)
  12927. C-weighting of equal loudness.
  12928. @end table
  12929. Default value is @code{sono_v}.
  12930. @item sono_g, gamma
  12931. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  12932. higher gamma makes the spectrum having more range. Default value is @code{3}.
  12933. Acceptable range is @code{[1, 7]}.
  12934. @item bar_g, gamma2
  12935. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  12936. @code{[1, 7]}.
  12937. @item bar_t
  12938. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  12939. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  12940. @item timeclamp, tc
  12941. Specify the transform timeclamp. At low frequency, there is trade-off between
  12942. accuracy in time domain and frequency domain. If timeclamp is lower,
  12943. event in time domain is represented more accurately (such as fast bass drum),
  12944. otherwise event in frequency domain is represented more accurately
  12945. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  12946. @item basefreq
  12947. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  12948. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  12949. @item endfreq
  12950. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  12951. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  12952. @item coeffclamp
  12953. This option is deprecated and ignored.
  12954. @item tlength
  12955. Specify the transform length in time domain. Use this option to control accuracy
  12956. trade-off between time domain and frequency domain at every frequency sample.
  12957. It can contain variables:
  12958. @table @option
  12959. @item frequency, freq, f
  12960. the frequency where it is evaluated
  12961. @item timeclamp, tc
  12962. the value of @var{timeclamp} option.
  12963. @end table
  12964. Default value is @code{384*tc/(384+tc*f)}.
  12965. @item count
  12966. Specify the transform count for every video frame. Default value is @code{6}.
  12967. Acceptable range is @code{[1, 30]}.
  12968. @item fcount
  12969. Specify the transform count for every single pixel. Default value is @code{0},
  12970. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  12971. @item fontfile
  12972. Specify font file for use with freetype to draw the axis. If not specified,
  12973. use embedded font. Note that drawing with font file or embedded font is not
  12974. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  12975. option instead.
  12976. @item font
  12977. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  12978. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  12979. @item fontcolor
  12980. Specify font color expression. This is arithmetic expression that should return
  12981. integer value 0xRRGGBB. It can contain variables:
  12982. @table @option
  12983. @item frequency, freq, f
  12984. the frequency where it is evaluated
  12985. @item timeclamp, tc
  12986. the value of @var{timeclamp} option
  12987. @end table
  12988. and functions:
  12989. @table @option
  12990. @item midi(f)
  12991. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  12992. @item r(x), g(x), b(x)
  12993. red, green, and blue value of intensity x.
  12994. @end table
  12995. Default value is @code{st(0, (midi(f)-59.5)/12);
  12996. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  12997. r(1-ld(1)) + b(ld(1))}.
  12998. @item axisfile
  12999. Specify image file to draw the axis. This option override @var{fontfile} and
  13000. @var{fontcolor} option.
  13001. @item axis, text
  13002. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13003. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13004. Default value is @code{1}.
  13005. @item csp
  13006. Set colorspace. The accepted values are:
  13007. @table @samp
  13008. @item unspecified
  13009. Unspecified (default)
  13010. @item bt709
  13011. BT.709
  13012. @item fcc
  13013. FCC
  13014. @item bt470bg
  13015. BT.470BG or BT.601-6 625
  13016. @item smpte170m
  13017. SMPTE-170M or BT.601-6 525
  13018. @item smpte240m
  13019. SMPTE-240M
  13020. @item bt2020ncl
  13021. BT.2020 with non-constant luminance
  13022. @end table
  13023. @item cscheme
  13024. Set spectrogram color scheme. This is list of floating point values with format
  13025. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13026. The default is @code{1|0.5|0|0|0.5|1}.
  13027. @end table
  13028. @subsection Examples
  13029. @itemize
  13030. @item
  13031. Playing audio while showing the spectrum:
  13032. @example
  13033. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13034. @end example
  13035. @item
  13036. Same as above, but with frame rate 30 fps:
  13037. @example
  13038. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13039. @end example
  13040. @item
  13041. Playing at 1280x720:
  13042. @example
  13043. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13044. @end example
  13045. @item
  13046. Disable sonogram display:
  13047. @example
  13048. sono_h=0
  13049. @end example
  13050. @item
  13051. A1 and its harmonics: A1, A2, (near)E3, A3:
  13052. @example
  13053. 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),
  13054. asplit[a][out1]; [a] showcqt [out0]'
  13055. @end example
  13056. @item
  13057. Same as above, but with more accuracy in frequency domain:
  13058. @example
  13059. 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),
  13060. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13061. @end example
  13062. @item
  13063. Custom volume:
  13064. @example
  13065. bar_v=10:sono_v=bar_v*a_weighting(f)
  13066. @end example
  13067. @item
  13068. Custom gamma, now spectrum is linear to the amplitude.
  13069. @example
  13070. bar_g=2:sono_g=2
  13071. @end example
  13072. @item
  13073. Custom tlength equation:
  13074. @example
  13075. 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)))'
  13076. @end example
  13077. @item
  13078. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13079. @example
  13080. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13081. @end example
  13082. @item
  13083. Custom font using fontconfig:
  13084. @example
  13085. font='Courier New,Monospace,mono|bold'
  13086. @end example
  13087. @item
  13088. Custom frequency range with custom axis using image file:
  13089. @example
  13090. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13091. @end example
  13092. @end itemize
  13093. @section showfreqs
  13094. Convert input audio to video output representing the audio power spectrum.
  13095. Audio amplitude is on Y-axis while frequency is on X-axis.
  13096. The filter accepts the following options:
  13097. @table @option
  13098. @item size, s
  13099. Specify size of video. For the syntax of this option, check the
  13100. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13101. Default is @code{1024x512}.
  13102. @item mode
  13103. Set display mode.
  13104. This set how each frequency bin will be represented.
  13105. It accepts the following values:
  13106. @table @samp
  13107. @item line
  13108. @item bar
  13109. @item dot
  13110. @end table
  13111. Default is @code{bar}.
  13112. @item ascale
  13113. Set amplitude scale.
  13114. It accepts the following values:
  13115. @table @samp
  13116. @item lin
  13117. Linear scale.
  13118. @item sqrt
  13119. Square root scale.
  13120. @item cbrt
  13121. Cubic root scale.
  13122. @item log
  13123. Logarithmic scale.
  13124. @end table
  13125. Default is @code{log}.
  13126. @item fscale
  13127. Set frequency scale.
  13128. It accepts the following values:
  13129. @table @samp
  13130. @item lin
  13131. Linear scale.
  13132. @item log
  13133. Logarithmic scale.
  13134. @item rlog
  13135. Reverse logarithmic scale.
  13136. @end table
  13137. Default is @code{lin}.
  13138. @item win_size
  13139. Set window size.
  13140. It accepts the following values:
  13141. @table @samp
  13142. @item w16
  13143. @item w32
  13144. @item w64
  13145. @item w128
  13146. @item w256
  13147. @item w512
  13148. @item w1024
  13149. @item w2048
  13150. @item w4096
  13151. @item w8192
  13152. @item w16384
  13153. @item w32768
  13154. @item w65536
  13155. @end table
  13156. Default is @code{w2048}
  13157. @item win_func
  13158. Set windowing function.
  13159. It accepts the following values:
  13160. @table @samp
  13161. @item rect
  13162. @item bartlett
  13163. @item hanning
  13164. @item hamming
  13165. @item blackman
  13166. @item welch
  13167. @item flattop
  13168. @item bharris
  13169. @item bnuttall
  13170. @item bhann
  13171. @item sine
  13172. @item nuttall
  13173. @item lanczos
  13174. @item gauss
  13175. @item tukey
  13176. @item dolph
  13177. @item cauchy
  13178. @item parzen
  13179. @item poisson
  13180. @end table
  13181. Default is @code{hanning}.
  13182. @item overlap
  13183. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13184. which means optimal overlap for selected window function will be picked.
  13185. @item averaging
  13186. Set time averaging. Setting this to 0 will display current maximal peaks.
  13187. Default is @code{1}, which means time averaging is disabled.
  13188. @item colors
  13189. Specify list of colors separated by space or by '|' which will be used to
  13190. draw channel frequencies. Unrecognized or missing colors will be replaced
  13191. by white color.
  13192. @item cmode
  13193. Set channel display mode.
  13194. It accepts the following values:
  13195. @table @samp
  13196. @item combined
  13197. @item separate
  13198. @end table
  13199. Default is @code{combined}.
  13200. @item minamp
  13201. Set minimum amplitude used in @code{log} amplitude scaler.
  13202. @end table
  13203. @anchor{showspectrum}
  13204. @section showspectrum
  13205. Convert input audio to a video output, representing the audio frequency
  13206. spectrum.
  13207. The filter accepts the following options:
  13208. @table @option
  13209. @item size, s
  13210. Specify the video size for the output. For the syntax of this option, check the
  13211. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13212. Default value is @code{640x512}.
  13213. @item slide
  13214. Specify how the spectrum should slide along the window.
  13215. It accepts the following values:
  13216. @table @samp
  13217. @item replace
  13218. the samples start again on the left when they reach the right
  13219. @item scroll
  13220. the samples scroll from right to left
  13221. @item fullframe
  13222. frames are only produced when the samples reach the right
  13223. @item rscroll
  13224. the samples scroll from left to right
  13225. @end table
  13226. Default value is @code{replace}.
  13227. @item mode
  13228. Specify display mode.
  13229. It accepts the following values:
  13230. @table @samp
  13231. @item combined
  13232. all channels are displayed in the same row
  13233. @item separate
  13234. all channels are displayed in separate rows
  13235. @end table
  13236. Default value is @samp{combined}.
  13237. @item color
  13238. Specify display color mode.
  13239. It accepts the following values:
  13240. @table @samp
  13241. @item channel
  13242. each channel is displayed in a separate color
  13243. @item intensity
  13244. each channel is displayed using the same color scheme
  13245. @item rainbow
  13246. each channel is displayed using the rainbow color scheme
  13247. @item moreland
  13248. each channel is displayed using the moreland color scheme
  13249. @item nebulae
  13250. each channel is displayed using the nebulae color scheme
  13251. @item fire
  13252. each channel is displayed using the fire color scheme
  13253. @item fiery
  13254. each channel is displayed using the fiery color scheme
  13255. @item fruit
  13256. each channel is displayed using the fruit color scheme
  13257. @item cool
  13258. each channel is displayed using the cool color scheme
  13259. @end table
  13260. Default value is @samp{channel}.
  13261. @item scale
  13262. Specify scale used for calculating intensity color values.
  13263. It accepts the following values:
  13264. @table @samp
  13265. @item lin
  13266. linear
  13267. @item sqrt
  13268. square root, default
  13269. @item cbrt
  13270. cubic root
  13271. @item log
  13272. logarithmic
  13273. @item 4thrt
  13274. 4th root
  13275. @item 5thrt
  13276. 5th root
  13277. @end table
  13278. Default value is @samp{sqrt}.
  13279. @item saturation
  13280. Set saturation modifier for displayed colors. Negative values provide
  13281. alternative color scheme. @code{0} is no saturation at all.
  13282. Saturation must be in [-10.0, 10.0] range.
  13283. Default value is @code{1}.
  13284. @item win_func
  13285. Set window function.
  13286. It accepts the following values:
  13287. @table @samp
  13288. @item rect
  13289. @item bartlett
  13290. @item hann
  13291. @item hanning
  13292. @item hamming
  13293. @item blackman
  13294. @item welch
  13295. @item flattop
  13296. @item bharris
  13297. @item bnuttall
  13298. @item bhann
  13299. @item sine
  13300. @item nuttall
  13301. @item lanczos
  13302. @item gauss
  13303. @item tukey
  13304. @item dolph
  13305. @item cauchy
  13306. @item parzen
  13307. @item poisson
  13308. @end table
  13309. Default value is @code{hann}.
  13310. @item orientation
  13311. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13312. @code{horizontal}. Default is @code{vertical}.
  13313. @item overlap
  13314. Set ratio of overlap window. Default value is @code{0}.
  13315. When value is @code{1} overlap is set to recommended size for specific
  13316. window function currently used.
  13317. @item gain
  13318. Set scale gain for calculating intensity color values.
  13319. Default value is @code{1}.
  13320. @item data
  13321. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  13322. @item rotation
  13323. Set color rotation, must be in [-1.0, 1.0] range.
  13324. Default value is @code{0}.
  13325. @end table
  13326. The usage is very similar to the showwaves filter; see the examples in that
  13327. section.
  13328. @subsection Examples
  13329. @itemize
  13330. @item
  13331. Large window with logarithmic color scaling:
  13332. @example
  13333. showspectrum=s=1280x480:scale=log
  13334. @end example
  13335. @item
  13336. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  13337. @example
  13338. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13339. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  13340. @end example
  13341. @end itemize
  13342. @section showspectrumpic
  13343. Convert input audio to a single video frame, representing the audio frequency
  13344. spectrum.
  13345. The filter accepts the following options:
  13346. @table @option
  13347. @item size, s
  13348. Specify the video size for the output. For the syntax of this option, check the
  13349. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13350. Default value is @code{4096x2048}.
  13351. @item mode
  13352. Specify display mode.
  13353. It accepts the following values:
  13354. @table @samp
  13355. @item combined
  13356. all channels are displayed in the same row
  13357. @item separate
  13358. all channels are displayed in separate rows
  13359. @end table
  13360. Default value is @samp{combined}.
  13361. @item color
  13362. Specify display color mode.
  13363. It accepts the following values:
  13364. @table @samp
  13365. @item channel
  13366. each channel is displayed in a separate color
  13367. @item intensity
  13368. each channel is displayed using the same color scheme
  13369. @item rainbow
  13370. each channel is displayed using the rainbow color scheme
  13371. @item moreland
  13372. each channel is displayed using the moreland color scheme
  13373. @item nebulae
  13374. each channel is displayed using the nebulae color scheme
  13375. @item fire
  13376. each channel is displayed using the fire color scheme
  13377. @item fiery
  13378. each channel is displayed using the fiery color scheme
  13379. @item fruit
  13380. each channel is displayed using the fruit color scheme
  13381. @item cool
  13382. each channel is displayed using the cool color scheme
  13383. @end table
  13384. Default value is @samp{intensity}.
  13385. @item scale
  13386. Specify scale used for calculating intensity color values.
  13387. It accepts the following values:
  13388. @table @samp
  13389. @item lin
  13390. linear
  13391. @item sqrt
  13392. square root, default
  13393. @item cbrt
  13394. cubic root
  13395. @item log
  13396. logarithmic
  13397. @item 4thrt
  13398. 4th root
  13399. @item 5thrt
  13400. 5th root
  13401. @end table
  13402. Default value is @samp{log}.
  13403. @item saturation
  13404. Set saturation modifier for displayed colors. Negative values provide
  13405. alternative color scheme. @code{0} is no saturation at all.
  13406. Saturation must be in [-10.0, 10.0] range.
  13407. Default value is @code{1}.
  13408. @item win_func
  13409. Set window function.
  13410. It accepts the following values:
  13411. @table @samp
  13412. @item rect
  13413. @item bartlett
  13414. @item hann
  13415. @item hanning
  13416. @item hamming
  13417. @item blackman
  13418. @item welch
  13419. @item flattop
  13420. @item bharris
  13421. @item bnuttall
  13422. @item bhann
  13423. @item sine
  13424. @item nuttall
  13425. @item lanczos
  13426. @item gauss
  13427. @item tukey
  13428. @item dolph
  13429. @item cauchy
  13430. @item parzen
  13431. @item poisson
  13432. @end table
  13433. Default value is @code{hann}.
  13434. @item orientation
  13435. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13436. @code{horizontal}. Default is @code{vertical}.
  13437. @item gain
  13438. Set scale gain for calculating intensity color values.
  13439. Default value is @code{1}.
  13440. @item legend
  13441. Draw time and frequency axes and legends. Default is enabled.
  13442. @item rotation
  13443. Set color rotation, must be in [-1.0, 1.0] range.
  13444. Default value is @code{0}.
  13445. @end table
  13446. @subsection Examples
  13447. @itemize
  13448. @item
  13449. Extract an audio spectrogram of a whole audio track
  13450. in a 1024x1024 picture using @command{ffmpeg}:
  13451. @example
  13452. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  13453. @end example
  13454. @end itemize
  13455. @section showvolume
  13456. Convert input audio volume to a video output.
  13457. The filter accepts the following options:
  13458. @table @option
  13459. @item rate, r
  13460. Set video rate.
  13461. @item b
  13462. Set border width, allowed range is [0, 5]. Default is 1.
  13463. @item w
  13464. Set channel width, allowed range is [80, 8192]. Default is 400.
  13465. @item h
  13466. Set channel height, allowed range is [1, 900]. Default is 20.
  13467. @item f
  13468. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  13469. @item c
  13470. Set volume color expression.
  13471. The expression can use the following variables:
  13472. @table @option
  13473. @item VOLUME
  13474. Current max volume of channel in dB.
  13475. @item PEAK
  13476. Current peak.
  13477. @item CHANNEL
  13478. Current channel number, starting from 0.
  13479. @end table
  13480. @item t
  13481. If set, displays channel names. Default is enabled.
  13482. @item v
  13483. If set, displays volume values. Default is enabled.
  13484. @item o
  13485. Set orientation, can be @code{horizontal} or @code{vertical},
  13486. default is @code{horizontal}.
  13487. @item s
  13488. Set step size, allowed range s [0, 5]. Default is 0, which means
  13489. step is disabled.
  13490. @end table
  13491. @section showwaves
  13492. Convert input audio to a video output, representing the samples waves.
  13493. The filter accepts the following options:
  13494. @table @option
  13495. @item size, s
  13496. Specify the video size for the output. For the syntax of this option, check the
  13497. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13498. Default value is @code{600x240}.
  13499. @item mode
  13500. Set display mode.
  13501. Available values are:
  13502. @table @samp
  13503. @item point
  13504. Draw a point for each sample.
  13505. @item line
  13506. Draw a vertical line for each sample.
  13507. @item p2p
  13508. Draw a point for each sample and a line between them.
  13509. @item cline
  13510. Draw a centered vertical line for each sample.
  13511. @end table
  13512. Default value is @code{point}.
  13513. @item n
  13514. Set the number of samples which are printed on the same column. A
  13515. larger value will decrease the frame rate. Must be a positive
  13516. integer. This option can be set only if the value for @var{rate}
  13517. is not explicitly specified.
  13518. @item rate, r
  13519. Set the (approximate) output frame rate. This is done by setting the
  13520. option @var{n}. Default value is "25".
  13521. @item split_channels
  13522. Set if channels should be drawn separately or overlap. Default value is 0.
  13523. @item colors
  13524. Set colors separated by '|' which are going to be used for drawing of each channel.
  13525. @item scale
  13526. Set amplitude scale.
  13527. Available values are:
  13528. @table @samp
  13529. @item lin
  13530. Linear.
  13531. @item log
  13532. Logarithmic.
  13533. @item sqrt
  13534. Square root.
  13535. @item cbrt
  13536. Cubic root.
  13537. @end table
  13538. Default is linear.
  13539. @end table
  13540. @subsection Examples
  13541. @itemize
  13542. @item
  13543. Output the input file audio and the corresponding video representation
  13544. at the same time:
  13545. @example
  13546. amovie=a.mp3,asplit[out0],showwaves[out1]
  13547. @end example
  13548. @item
  13549. Create a synthetic signal and show it with showwaves, forcing a
  13550. frame rate of 30 frames per second:
  13551. @example
  13552. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  13553. @end example
  13554. @end itemize
  13555. @section showwavespic
  13556. Convert input audio to a single video frame, representing the samples waves.
  13557. The filter accepts the following options:
  13558. @table @option
  13559. @item size, s
  13560. Specify the video size for the output. For the syntax of this option, check the
  13561. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13562. Default value is @code{600x240}.
  13563. @item split_channels
  13564. Set if channels should be drawn separately or overlap. Default value is 0.
  13565. @item colors
  13566. Set colors separated by '|' which are going to be used for drawing of each channel.
  13567. @item scale
  13568. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  13569. Default is linear.
  13570. @end table
  13571. @subsection Examples
  13572. @itemize
  13573. @item
  13574. Extract a channel split representation of the wave form of a whole audio track
  13575. in a 1024x800 picture using @command{ffmpeg}:
  13576. @example
  13577. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  13578. @end example
  13579. @end itemize
  13580. @section sidedata, asidedata
  13581. Delete frame side data, or select frames based on it.
  13582. This filter accepts the following options:
  13583. @table @option
  13584. @item mode
  13585. Set mode of operation of the filter.
  13586. Can be one of the following:
  13587. @table @samp
  13588. @item select
  13589. Select every frame with side data of @code{type}.
  13590. @item delete
  13591. Delete side data of @code{type}. If @code{type} is not set, delete all side
  13592. data in the frame.
  13593. @end table
  13594. @item type
  13595. Set side data type used with all modes. Must be set for @code{select} mode. For
  13596. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  13597. in @file{libavutil/frame.h}. For example, to choose
  13598. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  13599. @end table
  13600. @section spectrumsynth
  13601. Sythesize audio from 2 input video spectrums, first input stream represents
  13602. magnitude across time and second represents phase across time.
  13603. The filter will transform from frequency domain as displayed in videos back
  13604. to time domain as presented in audio output.
  13605. This filter is primarily created for reversing processed @ref{showspectrum}
  13606. filter outputs, but can synthesize sound from other spectrograms too.
  13607. But in such case results are going to be poor if the phase data is not
  13608. available, because in such cases phase data need to be recreated, usually
  13609. its just recreated from random noise.
  13610. For best results use gray only output (@code{channel} color mode in
  13611. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  13612. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  13613. @code{data} option. Inputs videos should generally use @code{fullframe}
  13614. slide mode as that saves resources needed for decoding video.
  13615. The filter accepts the following options:
  13616. @table @option
  13617. @item sample_rate
  13618. Specify sample rate of output audio, the sample rate of audio from which
  13619. spectrum was generated may differ.
  13620. @item channels
  13621. Set number of channels represented in input video spectrums.
  13622. @item scale
  13623. Set scale which was used when generating magnitude input spectrum.
  13624. Can be @code{lin} or @code{log}. Default is @code{log}.
  13625. @item slide
  13626. Set slide which was used when generating inputs spectrums.
  13627. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  13628. Default is @code{fullframe}.
  13629. @item win_func
  13630. Set window function used for resynthesis.
  13631. @item overlap
  13632. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13633. which means optimal overlap for selected window function will be picked.
  13634. @item orientation
  13635. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  13636. Default is @code{vertical}.
  13637. @end table
  13638. @subsection Examples
  13639. @itemize
  13640. @item
  13641. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  13642. then resynthesize videos back to audio with spectrumsynth:
  13643. @example
  13644. 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
  13645. 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
  13646. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  13647. @end example
  13648. @end itemize
  13649. @section split, asplit
  13650. Split input into several identical outputs.
  13651. @code{asplit} works with audio input, @code{split} with video.
  13652. The filter accepts a single parameter which specifies the number of outputs. If
  13653. unspecified, it defaults to 2.
  13654. @subsection Examples
  13655. @itemize
  13656. @item
  13657. Create two separate outputs from the same input:
  13658. @example
  13659. [in] split [out0][out1]
  13660. @end example
  13661. @item
  13662. To create 3 or more outputs, you need to specify the number of
  13663. outputs, like in:
  13664. @example
  13665. [in] asplit=3 [out0][out1][out2]
  13666. @end example
  13667. @item
  13668. Create two separate outputs from the same input, one cropped and
  13669. one padded:
  13670. @example
  13671. [in] split [splitout1][splitout2];
  13672. [splitout1] crop=100:100:0:0 [cropout];
  13673. [splitout2] pad=200:200:100:100 [padout];
  13674. @end example
  13675. @item
  13676. Create 5 copies of the input audio with @command{ffmpeg}:
  13677. @example
  13678. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  13679. @end example
  13680. @end itemize
  13681. @section zmq, azmq
  13682. Receive commands sent through a libzmq client, and forward them to
  13683. filters in the filtergraph.
  13684. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  13685. must be inserted between two video filters, @code{azmq} between two
  13686. audio filters.
  13687. To enable these filters you need to install the libzmq library and
  13688. headers and configure FFmpeg with @code{--enable-libzmq}.
  13689. For more information about libzmq see:
  13690. @url{http://www.zeromq.org/}
  13691. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  13692. receives messages sent through a network interface defined by the
  13693. @option{bind_address} option.
  13694. The received message must be in the form:
  13695. @example
  13696. @var{TARGET} @var{COMMAND} [@var{ARG}]
  13697. @end example
  13698. @var{TARGET} specifies the target of the command, usually the name of
  13699. the filter class or a specific filter instance name.
  13700. @var{COMMAND} specifies the name of the command for the target filter.
  13701. @var{ARG} is optional and specifies the optional argument list for the
  13702. given @var{COMMAND}.
  13703. Upon reception, the message is processed and the corresponding command
  13704. is injected into the filtergraph. Depending on the result, the filter
  13705. will send a reply to the client, adopting the format:
  13706. @example
  13707. @var{ERROR_CODE} @var{ERROR_REASON}
  13708. @var{MESSAGE}
  13709. @end example
  13710. @var{MESSAGE} is optional.
  13711. @subsection Examples
  13712. Look at @file{tools/zmqsend} for an example of a zmq client which can
  13713. be used to send commands processed by these filters.
  13714. Consider the following filtergraph generated by @command{ffplay}
  13715. @example
  13716. ffplay -dumpgraph 1 -f lavfi "
  13717. color=s=100x100:c=red [l];
  13718. color=s=100x100:c=blue [r];
  13719. nullsrc=s=200x100, zmq [bg];
  13720. [bg][l] overlay [bg+l];
  13721. [bg+l][r] overlay=x=100 "
  13722. @end example
  13723. To change the color of the left side of the video, the following
  13724. command can be used:
  13725. @example
  13726. echo Parsed_color_0 c yellow | tools/zmqsend
  13727. @end example
  13728. To change the right side:
  13729. @example
  13730. echo Parsed_color_1 c pink | tools/zmqsend
  13731. @end example
  13732. @c man end MULTIMEDIA FILTERS
  13733. @chapter Multimedia Sources
  13734. @c man begin MULTIMEDIA SOURCES
  13735. Below is a description of the currently available multimedia sources.
  13736. @section amovie
  13737. This is the same as @ref{movie} source, except it selects an audio
  13738. stream by default.
  13739. @anchor{movie}
  13740. @section movie
  13741. Read audio and/or video stream(s) from a movie container.
  13742. It accepts the following parameters:
  13743. @table @option
  13744. @item filename
  13745. The name of the resource to read (not necessarily a file; it can also be a
  13746. device or a stream accessed through some protocol).
  13747. @item format_name, f
  13748. Specifies the format assumed for the movie to read, and can be either
  13749. the name of a container or an input device. If not specified, the
  13750. format is guessed from @var{movie_name} or by probing.
  13751. @item seek_point, sp
  13752. Specifies the seek point in seconds. The frames will be output
  13753. starting from this seek point. The parameter is evaluated with
  13754. @code{av_strtod}, so the numerical value may be suffixed by an IS
  13755. postfix. The default value is "0".
  13756. @item streams, s
  13757. Specifies the streams to read. Several streams can be specified,
  13758. separated by "+". The source will then have as many outputs, in the
  13759. same order. The syntax is explained in the ``Stream specifiers''
  13760. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  13761. respectively the default (best suited) video and audio stream. Default
  13762. is "dv", or "da" if the filter is called as "amovie".
  13763. @item stream_index, si
  13764. Specifies the index of the video stream to read. If the value is -1,
  13765. the most suitable video stream will be automatically selected. The default
  13766. value is "-1". Deprecated. If the filter is called "amovie", it will select
  13767. audio instead of video.
  13768. @item loop
  13769. Specifies how many times to read the stream in sequence.
  13770. If the value is less than 1, the stream will be read again and again.
  13771. Default value is "1".
  13772. Note that when the movie is looped the source timestamps are not
  13773. changed, so it will generate non monotonically increasing timestamps.
  13774. @item discontinuity
  13775. Specifies the time difference between frames above which the point is
  13776. considered a timestamp discontinuity which is removed by adjusting the later
  13777. timestamps.
  13778. @end table
  13779. It allows overlaying a second video on top of the main input of
  13780. a filtergraph, as shown in this graph:
  13781. @example
  13782. input -----------> deltapts0 --> overlay --> output
  13783. ^
  13784. |
  13785. movie --> scale--> deltapts1 -------+
  13786. @end example
  13787. @subsection Examples
  13788. @itemize
  13789. @item
  13790. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13791. on top of the input labelled "in":
  13792. @example
  13793. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13794. [in] setpts=PTS-STARTPTS [main];
  13795. [main][over] overlay=16:16 [out]
  13796. @end example
  13797. @item
  13798. Read from a video4linux2 device, and overlay it on top of the input
  13799. labelled "in":
  13800. @example
  13801. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13802. [in] setpts=PTS-STARTPTS [main];
  13803. [main][over] overlay=16:16 [out]
  13804. @end example
  13805. @item
  13806. Read the first video stream and the audio stream with id 0x81 from
  13807. dvd.vob; the video is connected to the pad named "video" and the audio is
  13808. connected to the pad named "audio":
  13809. @example
  13810. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13811. @end example
  13812. @end itemize
  13813. @subsection Commands
  13814. Both movie and amovie support the following commands:
  13815. @table @option
  13816. @item seek
  13817. Perform seek using "av_seek_frame".
  13818. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13819. @itemize
  13820. @item
  13821. @var{stream_index}: If stream_index is -1, a default
  13822. stream is selected, and @var{timestamp} is automatically converted
  13823. from AV_TIME_BASE units to the stream specific time_base.
  13824. @item
  13825. @var{timestamp}: Timestamp in AVStream.time_base units
  13826. or, if no stream is specified, in AV_TIME_BASE units.
  13827. @item
  13828. @var{flags}: Flags which select direction and seeking mode.
  13829. @end itemize
  13830. @item get_duration
  13831. Get movie duration in AV_TIME_BASE units.
  13832. @end table
  13833. @c man end MULTIMEDIA SOURCES