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.

14818 lines
405KB

  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 adelay
  353. Delay one or more audio channels.
  354. Samples in delayed channel are filled with silence.
  355. The filter accepts the following option:
  356. @table @option
  357. @item delays
  358. Set list of delays in milliseconds for each channel separated by '|'.
  359. At least one delay greater than 0 should be provided.
  360. Unused delays will be silently ignored. If number of given delays is
  361. smaller than number of channels all remaining channels will not be delayed.
  362. @end table
  363. @subsection Examples
  364. @itemize
  365. @item
  366. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  367. the second channel (and any other channels that may be present) unchanged.
  368. @example
  369. adelay=1500|0|500
  370. @end example
  371. @end itemize
  372. @section aecho
  373. Apply echoing to the input audio.
  374. Echoes are reflected sound and can occur naturally amongst mountains
  375. (and sometimes large buildings) when talking or shouting; digital echo
  376. effects emulate this behaviour and are often used to help fill out the
  377. sound of a single instrument or vocal. The time difference between the
  378. original signal and the reflection is the @code{delay}, and the
  379. loudness of the reflected signal is the @code{decay}.
  380. Multiple echoes can have different delays and decays.
  381. A description of the accepted parameters follows.
  382. @table @option
  383. @item in_gain
  384. Set input gain of reflected signal. Default is @code{0.6}.
  385. @item out_gain
  386. Set output gain of reflected signal. Default is @code{0.3}.
  387. @item delays
  388. Set list of time intervals in milliseconds between original signal and reflections
  389. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  390. Default is @code{1000}.
  391. @item decays
  392. Set list of loudnesses of reflected signals separated by '|'.
  393. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  394. Default is @code{0.5}.
  395. @end table
  396. @subsection Examples
  397. @itemize
  398. @item
  399. Make it sound as if there are twice as many instruments as are actually playing:
  400. @example
  401. aecho=0.8:0.88:60:0.4
  402. @end example
  403. @item
  404. If delay is very short, then it sound like a (metallic) robot playing music:
  405. @example
  406. aecho=0.8:0.88:6:0.4
  407. @end example
  408. @item
  409. A longer delay will sound like an open air concert in the mountains:
  410. @example
  411. aecho=0.8:0.9:1000:0.3
  412. @end example
  413. @item
  414. Same as above but with one more mountain:
  415. @example
  416. aecho=0.8:0.9:1000|1800:0.3|0.25
  417. @end example
  418. @end itemize
  419. @section aemphasis
  420. Audio emphasis filter creates or restores material directly taken from LPs or
  421. emphased CDs with different filter curves. E.g. to store music on vinyl the
  422. signal has to be altered by a filter first to even out the disadvantages of
  423. this recording medium.
  424. Once the material is played back the inverse filter has to be applied to
  425. restore the distortion of the frequency response.
  426. The filter accepts the following options:
  427. @table @option
  428. @item level_in
  429. Set input gain.
  430. @item level_out
  431. Set output gain.
  432. @item mode
  433. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  434. use @code{production} mode. Default is @code{reproduction} mode.
  435. @item type
  436. Set filter type. Selects medium. Can be one of the following:
  437. @table @option
  438. @item col
  439. select Columbia.
  440. @item emi
  441. select EMI.
  442. @item bsi
  443. select BSI (78RPM).
  444. @item riaa
  445. select RIAA.
  446. @item cd
  447. select Compact Disc (CD).
  448. @item 50fm
  449. select 50µs (FM).
  450. @item 75fm
  451. select 75µs (FM).
  452. @item 50kf
  453. select 50µs (FM-KF).
  454. @item 75kf
  455. select 75µs (FM-KF).
  456. @end table
  457. @end table
  458. @section aeval
  459. Modify an audio signal according to the specified expressions.
  460. This filter accepts one or more expressions (one for each channel),
  461. which are evaluated and used to modify a corresponding audio signal.
  462. It accepts the following parameters:
  463. @table @option
  464. @item exprs
  465. Set the '|'-separated expressions list for each separate channel. If
  466. the number of input channels is greater than the number of
  467. expressions, the last specified expression is used for the remaining
  468. output channels.
  469. @item channel_layout, c
  470. Set output channel layout. If not specified, the channel layout is
  471. specified by the number of expressions. If set to @samp{same}, it will
  472. use by default the same input channel layout.
  473. @end table
  474. Each expression in @var{exprs} can contain the following constants and functions:
  475. @table @option
  476. @item ch
  477. channel number of the current expression
  478. @item n
  479. number of the evaluated sample, starting from 0
  480. @item s
  481. sample rate
  482. @item t
  483. time of the evaluated sample expressed in seconds
  484. @item nb_in_channels
  485. @item nb_out_channels
  486. input and output number of channels
  487. @item val(CH)
  488. the value of input channel with number @var{CH}
  489. @end table
  490. Note: this filter is slow. For faster processing you should use a
  491. dedicated filter.
  492. @subsection Examples
  493. @itemize
  494. @item
  495. Half volume:
  496. @example
  497. aeval=val(ch)/2:c=same
  498. @end example
  499. @item
  500. Invert phase of the second channel:
  501. @example
  502. aeval=val(0)|-val(1)
  503. @end example
  504. @end itemize
  505. @anchor{afade}
  506. @section afade
  507. Apply fade-in/out effect to input audio.
  508. A description of the accepted parameters follows.
  509. @table @option
  510. @item type, t
  511. Specify the effect type, can be either @code{in} for fade-in, or
  512. @code{out} for a fade-out effect. Default is @code{in}.
  513. @item start_sample, ss
  514. Specify the number of the start sample for starting to apply the fade
  515. effect. Default is 0.
  516. @item nb_samples, ns
  517. Specify the number of samples for which the fade effect has to last. At
  518. the end of the fade-in effect the output audio will have the same
  519. volume as the input audio, at the end of the fade-out transition
  520. the output audio will be silence. Default is 44100.
  521. @item start_time, st
  522. Specify the start time of the fade effect. Default is 0.
  523. The value must be specified as a time duration; see
  524. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  525. for the accepted syntax.
  526. If set this option is used instead of @var{start_sample}.
  527. @item duration, d
  528. Specify the duration of the fade effect. See
  529. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  530. for the accepted syntax.
  531. At the end of the fade-in effect the output audio will have the same
  532. volume as the input audio, at the end of the fade-out transition
  533. the output audio will be silence.
  534. By default the duration is determined by @var{nb_samples}.
  535. If set this option is used instead of @var{nb_samples}.
  536. @item curve
  537. Set curve for fade transition.
  538. It accepts the following values:
  539. @table @option
  540. @item tri
  541. select triangular, linear slope (default)
  542. @item qsin
  543. select quarter of sine wave
  544. @item hsin
  545. select half of sine wave
  546. @item esin
  547. select exponential sine wave
  548. @item log
  549. select logarithmic
  550. @item ipar
  551. select inverted parabola
  552. @item qua
  553. select quadratic
  554. @item cub
  555. select cubic
  556. @item squ
  557. select square root
  558. @item cbr
  559. select cubic root
  560. @item par
  561. select parabola
  562. @item exp
  563. select exponential
  564. @item iqsin
  565. select inverted quarter of sine wave
  566. @item ihsin
  567. select inverted half of sine wave
  568. @item dese
  569. select double-exponential seat
  570. @item desi
  571. select double-exponential sigmoid
  572. @end table
  573. @end table
  574. @subsection Examples
  575. @itemize
  576. @item
  577. Fade in first 15 seconds of audio:
  578. @example
  579. afade=t=in:ss=0:d=15
  580. @end example
  581. @item
  582. Fade out last 25 seconds of a 900 seconds audio:
  583. @example
  584. afade=t=out:st=875:d=25
  585. @end example
  586. @end itemize
  587. @anchor{aformat}
  588. @section aformat
  589. Set output format constraints for the input audio. The framework will
  590. negotiate the most appropriate format to minimize conversions.
  591. It accepts the following parameters:
  592. @table @option
  593. @item sample_fmts
  594. A '|'-separated list of requested sample formats.
  595. @item sample_rates
  596. A '|'-separated list of requested sample rates.
  597. @item channel_layouts
  598. A '|'-separated list of requested channel layouts.
  599. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  600. for the required syntax.
  601. @end table
  602. If a parameter is omitted, all values are allowed.
  603. Force the output to either unsigned 8-bit or signed 16-bit stereo
  604. @example
  605. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  606. @end example
  607. @section agate
  608. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  609. processing reduces disturbing noise between useful signals.
  610. Gating is done by detecting the volume below a chosen level @var{threshold}
  611. and divide it by the factor set with @var{ratio}. The bottom of the noise
  612. floor is set via @var{range}. Because an exact manipulation of the signal
  613. would cause distortion of the waveform the reduction can be levelled over
  614. time. This is done by setting @var{attack} and @var{release}.
  615. @var{attack} determines how long the signal has to fall below the threshold
  616. before any reduction will occur and @var{release} sets the time the signal
  617. has to raise above the threshold to reduce the reduction again.
  618. Shorter signals than the chosen attack time will be left untouched.
  619. @table @option
  620. @item level_in
  621. Set input level before filtering.
  622. Default is 1. Allowed range is from 0.015625 to 64.
  623. @item range
  624. Set the level of gain reduction when the signal is below the threshold.
  625. Default is 0.06125. Allowed range is from 0 to 1.
  626. @item threshold
  627. If a signal rises above this level the gain reduction is released.
  628. Default is 0.125. Allowed range is from 0 to 1.
  629. @item ratio
  630. Set a ratio about which the signal is reduced.
  631. Default is 2. Allowed range is from 1 to 9000.
  632. @item attack
  633. Amount of milliseconds the signal has to rise above the threshold before gain
  634. reduction stops.
  635. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  636. @item release
  637. Amount of milliseconds the signal has to fall below the threshold before the
  638. reduction is increased again. Default is 250 milliseconds.
  639. Allowed range is from 0.01 to 9000.
  640. @item makeup
  641. Set amount of amplification of signal after processing.
  642. Default is 1. Allowed range is from 1 to 64.
  643. @item knee
  644. Curve the sharp knee around the threshold to enter gain reduction more softly.
  645. Default is 2.828427125. Allowed range is from 1 to 8.
  646. @item detection
  647. Choose if exact signal should be taken for detection or an RMS like one.
  648. Default is rms. Can be peak or rms.
  649. @item link
  650. Choose if the average level between all channels or the louder channel affects
  651. the reduction.
  652. Default is average. Can be average or maximum.
  653. @end table
  654. @section alimiter
  655. The limiter prevents input signal from raising over a desired threshold.
  656. This limiter uses lookahead technology to prevent your signal from distorting.
  657. It means that there is a small delay after signal is processed. Keep in mind
  658. that the delay it produces is the attack time you set.
  659. The filter accepts the following options:
  660. @table @option
  661. @item level_in
  662. Set input gain. Default is 1.
  663. @item level_out
  664. Set output gain. Default is 1.
  665. @item limit
  666. Don't let signals above this level pass the limiter. Default is 1.
  667. @item attack
  668. The limiter will reach its attenuation level in this amount of time in
  669. milliseconds. Default is 5 milliseconds.
  670. @item release
  671. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  672. Default is 50 milliseconds.
  673. @item asc
  674. When gain reduction is always needed ASC takes care of releasing to an
  675. average reduction level rather than reaching a reduction of 0 in the release
  676. time.
  677. @item asc_level
  678. Select how much the release time is affected by ASC, 0 means nearly no changes
  679. in release time while 1 produces higher release times.
  680. @item level
  681. Auto level output signal. Default is enabled.
  682. This normalizes audio back to 0dB if enabled.
  683. @end table
  684. Depending on picked setting it is recommended to upsample input 2x or 4x times
  685. with @ref{aresample} before applying this filter.
  686. @section allpass
  687. Apply a two-pole all-pass filter with central frequency (in Hz)
  688. @var{frequency}, and filter-width @var{width}.
  689. An all-pass filter changes the audio's frequency to phase relationship
  690. without changing its frequency to amplitude relationship.
  691. The filter accepts the following options:
  692. @table @option
  693. @item frequency, f
  694. Set frequency in Hz.
  695. @item width_type
  696. Set method to specify band-width of filter.
  697. @table @option
  698. @item h
  699. Hz
  700. @item q
  701. Q-Factor
  702. @item o
  703. octave
  704. @item s
  705. slope
  706. @end table
  707. @item width, w
  708. Specify the band-width of a filter in width_type units.
  709. @end table
  710. @anchor{amerge}
  711. @section amerge
  712. Merge two or more audio streams into a single multi-channel stream.
  713. The filter accepts the following options:
  714. @table @option
  715. @item inputs
  716. Set the number of inputs. Default is 2.
  717. @end table
  718. If the channel layouts of the inputs are disjoint, and therefore compatible,
  719. the channel layout of the output will be set accordingly and the channels
  720. will be reordered as necessary. If the channel layouts of the inputs are not
  721. disjoint, the output will have all the channels of the first input then all
  722. the channels of the second input, in that order, and the channel layout of
  723. the output will be the default value corresponding to the total number of
  724. channels.
  725. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  726. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  727. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  728. first input, b1 is the first channel of the second input).
  729. On the other hand, if both input are in stereo, the output channels will be
  730. in the default order: a1, a2, b1, b2, and the channel layout will be
  731. arbitrarily set to 4.0, which may or may not be the expected value.
  732. All inputs must have the same sample rate, and format.
  733. If inputs do not have the same duration, the output will stop with the
  734. shortest.
  735. @subsection Examples
  736. @itemize
  737. @item
  738. Merge two mono files into a stereo stream:
  739. @example
  740. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  741. @end example
  742. @item
  743. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  744. @example
  745. 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
  746. @end example
  747. @end itemize
  748. @section amix
  749. Mixes multiple audio inputs into a single output.
  750. Note that this filter only supports float samples (the @var{amerge}
  751. and @var{pan} audio filters support many formats). If the @var{amix}
  752. input has integer samples then @ref{aresample} will be automatically
  753. inserted to perform the conversion to float samples.
  754. For example
  755. @example
  756. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  757. @end example
  758. will mix 3 input audio streams to a single output with the same duration as the
  759. first input and a dropout transition time of 3 seconds.
  760. It accepts the following parameters:
  761. @table @option
  762. @item inputs
  763. The number of inputs. If unspecified, it defaults to 2.
  764. @item duration
  765. How to determine the end-of-stream.
  766. @table @option
  767. @item longest
  768. The duration of the longest input. (default)
  769. @item shortest
  770. The duration of the shortest input.
  771. @item first
  772. The duration of the first input.
  773. @end table
  774. @item dropout_transition
  775. The transition time, in seconds, for volume renormalization when an input
  776. stream ends. The default value is 2 seconds.
  777. @end table
  778. @section anull
  779. Pass the audio source unchanged to the output.
  780. @section apad
  781. Pad the end of an audio stream with silence.
  782. This can be used together with @command{ffmpeg} @option{-shortest} to
  783. extend audio streams to the same length as the video stream.
  784. A description of the accepted options follows.
  785. @table @option
  786. @item packet_size
  787. Set silence packet size. Default value is 4096.
  788. @item pad_len
  789. Set the number of samples of silence to add to the end. After the
  790. value is reached, the stream is terminated. This option is mutually
  791. exclusive with @option{whole_len}.
  792. @item whole_len
  793. Set the minimum total number of samples in the output audio stream. If
  794. the value is longer than the input audio length, silence is added to
  795. the end, until the value is reached. This option is mutually exclusive
  796. with @option{pad_len}.
  797. @end table
  798. If neither the @option{pad_len} nor the @option{whole_len} option is
  799. set, the filter will add silence to the end of the input stream
  800. indefinitely.
  801. @subsection Examples
  802. @itemize
  803. @item
  804. Add 1024 samples of silence to the end of the input:
  805. @example
  806. apad=pad_len=1024
  807. @end example
  808. @item
  809. Make sure the audio output will contain at least 10000 samples, pad
  810. the input with silence if required:
  811. @example
  812. apad=whole_len=10000
  813. @end example
  814. @item
  815. Use @command{ffmpeg} to pad the audio input with silence, so that the
  816. video stream will always result the shortest and will be converted
  817. until the end in the output file when using the @option{shortest}
  818. option:
  819. @example
  820. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  821. @end example
  822. @end itemize
  823. @section aphaser
  824. Add a phasing effect to the input audio.
  825. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  826. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  827. A description of the accepted parameters follows.
  828. @table @option
  829. @item in_gain
  830. Set input gain. Default is 0.4.
  831. @item out_gain
  832. Set output gain. Default is 0.74
  833. @item delay
  834. Set delay in milliseconds. Default is 3.0.
  835. @item decay
  836. Set decay. Default is 0.4.
  837. @item speed
  838. Set modulation speed in Hz. Default is 0.5.
  839. @item type
  840. Set modulation type. Default is triangular.
  841. It accepts the following values:
  842. @table @samp
  843. @item triangular, t
  844. @item sinusoidal, s
  845. @end table
  846. @end table
  847. @section apulsator
  848. Audio pulsator is something between an autopanner and a tremolo.
  849. But it can produce funny stereo effects as well. Pulsator changes the volume
  850. of the left and right channel based on a LFO (low frequency oscillator) with
  851. different waveforms and shifted phases.
  852. This filter have the ability to define an offset between left and right
  853. channel. An offset of 0 means that both LFO shapes match each other.
  854. The left and right channel are altered equally - a conventional tremolo.
  855. An offset of 50% means that the shape of the right channel is exactly shifted
  856. in phase (or moved backwards about half of the frequency) - pulsator acts as
  857. an autopanner. At 1 both curves match again. Every setting in between moves the
  858. phase shift gapless between all stages and produces some "bypassing" sounds with
  859. sine and triangle waveforms. The more you set the offset near 1 (starting from
  860. the 0.5) the faster the signal passes from the left to the right speaker.
  861. The filter accepts the following options:
  862. @table @option
  863. @item level_in
  864. Set input gain. By default it is 1. Range is [0.015625 - 64].
  865. @item level_out
  866. Set output gain. By default it is 1. Range is [0.015625 - 64].
  867. @item mode
  868. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  869. sawup or sawdown. Default is sine.
  870. @item amount
  871. Set modulation. Define how much of original signal is affected by the LFO.
  872. @item offset_l
  873. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  874. @item offset_r
  875. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  876. @item width
  877. Set pulse width. Default is 1. Allowed range is [0 - 2].
  878. @item timing
  879. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  880. @item bpm
  881. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  882. is set to bpm.
  883. @item ms
  884. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  885. is set to ms.
  886. @item hz
  887. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  888. if timing is set to hz.
  889. @end table
  890. @anchor{aresample}
  891. @section aresample
  892. Resample the input audio to the specified parameters, using the
  893. libswresample library. If none are specified then the filter will
  894. automatically convert between its input and output.
  895. This filter is also able to stretch/squeeze the audio data to make it match
  896. the timestamps or to inject silence / cut out audio to make it match the
  897. timestamps, do a combination of both or do neither.
  898. The filter accepts the syntax
  899. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  900. expresses a sample rate and @var{resampler_options} is a list of
  901. @var{key}=@var{value} pairs, separated by ":". See the
  902. ffmpeg-resampler manual for the complete list of supported options.
  903. @subsection Examples
  904. @itemize
  905. @item
  906. Resample the input audio to 44100Hz:
  907. @example
  908. aresample=44100
  909. @end example
  910. @item
  911. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  912. samples per second compensation:
  913. @example
  914. aresample=async=1000
  915. @end example
  916. @end itemize
  917. @section asetnsamples
  918. Set the number of samples per each output audio frame.
  919. The last output packet may contain a different number of samples, as
  920. the filter will flush all the remaining samples when the input audio
  921. signal its end.
  922. The filter accepts the following options:
  923. @table @option
  924. @item nb_out_samples, n
  925. Set the number of frames per each output audio frame. The number is
  926. intended as the number of samples @emph{per each channel}.
  927. Default value is 1024.
  928. @item pad, p
  929. If set to 1, the filter will pad the last audio frame with zeroes, so
  930. that the last frame will contain the same number of samples as the
  931. previous ones. Default value is 1.
  932. @end table
  933. For example, to set the number of per-frame samples to 1234 and
  934. disable padding for the last frame, use:
  935. @example
  936. asetnsamples=n=1234:p=0
  937. @end example
  938. @section asetrate
  939. Set the sample rate without altering the PCM data.
  940. This will result in a change of speed and pitch.
  941. The filter accepts the following options:
  942. @table @option
  943. @item sample_rate, r
  944. Set the output sample rate. Default is 44100 Hz.
  945. @end table
  946. @section ashowinfo
  947. Show a line containing various information for each input audio frame.
  948. The input audio is not modified.
  949. The shown line contains a sequence of key/value pairs of the form
  950. @var{key}:@var{value}.
  951. The following values are shown in the output:
  952. @table @option
  953. @item n
  954. The (sequential) number of the input frame, starting from 0.
  955. @item pts
  956. The presentation timestamp of the input frame, in time base units; the time base
  957. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  958. @item pts_time
  959. The presentation timestamp of the input frame in seconds.
  960. @item pos
  961. position of the frame in the input stream, -1 if this information in
  962. unavailable and/or meaningless (for example in case of synthetic audio)
  963. @item fmt
  964. The sample format.
  965. @item chlayout
  966. The channel layout.
  967. @item rate
  968. The sample rate for the audio frame.
  969. @item nb_samples
  970. The number of samples (per channel) in the frame.
  971. @item checksum
  972. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  973. audio, the data is treated as if all the planes were concatenated.
  974. @item plane_checksums
  975. A list of Adler-32 checksums for each data plane.
  976. @end table
  977. @anchor{astats}
  978. @section astats
  979. Display time domain statistical information about the audio channels.
  980. Statistics are calculated and displayed for each audio channel and,
  981. where applicable, an overall figure is also given.
  982. It accepts the following option:
  983. @table @option
  984. @item length
  985. Short window length in seconds, used for peak and trough RMS measurement.
  986. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  987. @item metadata
  988. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  989. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  990. disabled.
  991. Available keys for each channel are:
  992. DC_offset
  993. Min_level
  994. Max_level
  995. Min_difference
  996. Max_difference
  997. Mean_difference
  998. Peak_level
  999. RMS_peak
  1000. RMS_trough
  1001. Crest_factor
  1002. Flat_factor
  1003. Peak_count
  1004. Bit_depth
  1005. and for Overall:
  1006. DC_offset
  1007. Min_level
  1008. Max_level
  1009. Min_difference
  1010. Max_difference
  1011. Mean_difference
  1012. Peak_level
  1013. RMS_level
  1014. RMS_peak
  1015. RMS_trough
  1016. Flat_factor
  1017. Peak_count
  1018. Bit_depth
  1019. Number_of_samples
  1020. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1021. this @code{lavfi.astats.Overall.Peak_count}.
  1022. For description what each key means read below.
  1023. @item reset
  1024. Set number of frame after which stats are going to be recalculated.
  1025. Default is disabled.
  1026. @end table
  1027. A description of each shown parameter follows:
  1028. @table @option
  1029. @item DC offset
  1030. Mean amplitude displacement from zero.
  1031. @item Min level
  1032. Minimal sample level.
  1033. @item Max level
  1034. Maximal sample level.
  1035. @item Min difference
  1036. Minimal difference between two consecutive samples.
  1037. @item Max difference
  1038. Maximal difference between two consecutive samples.
  1039. @item Mean difference
  1040. Mean difference between two consecutive samples.
  1041. The average of each difference between two consecutive samples.
  1042. @item Peak level dB
  1043. @item RMS level dB
  1044. Standard peak and RMS level measured in dBFS.
  1045. @item RMS peak dB
  1046. @item RMS trough dB
  1047. Peak and trough values for RMS level measured over a short window.
  1048. @item Crest factor
  1049. Standard ratio of peak to RMS level (note: not in dB).
  1050. @item Flat factor
  1051. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1052. (i.e. either @var{Min level} or @var{Max level}).
  1053. @item Peak count
  1054. Number of occasions (not the number of samples) that the signal attained either
  1055. @var{Min level} or @var{Max level}.
  1056. @item Bit depth
  1057. Overall bit depth of audio. Number of bits used for each sample.
  1058. @end table
  1059. @section asyncts
  1060. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1061. dropping samples/adding silence when needed.
  1062. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1063. It accepts the following parameters:
  1064. @table @option
  1065. @item compensate
  1066. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1067. by default. When disabled, time gaps are covered with silence.
  1068. @item min_delta
  1069. The minimum difference between timestamps and audio data (in seconds) to trigger
  1070. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1071. sync with this filter, try setting this parameter to 0.
  1072. @item max_comp
  1073. The maximum compensation in samples per second. Only relevant with compensate=1.
  1074. The default value is 500.
  1075. @item first_pts
  1076. Assume that the first PTS should be this value. The time base is 1 / sample
  1077. rate. This allows for padding/trimming at the start of the stream. By default,
  1078. no assumption is made about the first frame's expected PTS, so no padding or
  1079. trimming is done. For example, this could be set to 0 to pad the beginning with
  1080. silence if an audio stream starts after the video stream or to trim any samples
  1081. with a negative PTS due to encoder delay.
  1082. @end table
  1083. @section atempo
  1084. Adjust audio tempo.
  1085. The filter accepts exactly one parameter, the audio tempo. If not
  1086. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1087. be in the [0.5, 2.0] range.
  1088. @subsection Examples
  1089. @itemize
  1090. @item
  1091. Slow down audio to 80% tempo:
  1092. @example
  1093. atempo=0.8
  1094. @end example
  1095. @item
  1096. To speed up audio to 125% tempo:
  1097. @example
  1098. atempo=1.25
  1099. @end example
  1100. @end itemize
  1101. @section atrim
  1102. Trim the input so that the output contains one continuous subpart of the input.
  1103. It accepts the following parameters:
  1104. @table @option
  1105. @item start
  1106. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1107. sample with the timestamp @var{start} will be the first sample in the output.
  1108. @item end
  1109. Specify time of the first audio sample that will be dropped, i.e. the
  1110. audio sample immediately preceding the one with the timestamp @var{end} will be
  1111. the last sample in the output.
  1112. @item start_pts
  1113. Same as @var{start}, except this option sets the start timestamp in samples
  1114. instead of seconds.
  1115. @item end_pts
  1116. Same as @var{end}, except this option sets the end timestamp in samples instead
  1117. of seconds.
  1118. @item duration
  1119. The maximum duration of the output in seconds.
  1120. @item start_sample
  1121. The number of the first sample that should be output.
  1122. @item end_sample
  1123. The number of the first sample that should be dropped.
  1124. @end table
  1125. @option{start}, @option{end}, and @option{duration} are expressed as time
  1126. duration specifications; see
  1127. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1128. Note that the first two sets of the start/end options and the @option{duration}
  1129. option look at the frame timestamp, while the _sample options simply count the
  1130. samples that pass through the filter. So start/end_pts and start/end_sample will
  1131. give different results when the timestamps are wrong, inexact or do not start at
  1132. zero. Also note that this filter does not modify the timestamps. If you wish
  1133. to have the output timestamps start at zero, insert the asetpts filter after the
  1134. atrim filter.
  1135. If multiple start or end options are set, this filter tries to be greedy and
  1136. keep all samples that match at least one of the specified constraints. To keep
  1137. only the part that matches all the constraints at once, chain multiple atrim
  1138. filters.
  1139. The defaults are such that all the input is kept. So it is possible to set e.g.
  1140. just the end values to keep everything before the specified time.
  1141. Examples:
  1142. @itemize
  1143. @item
  1144. Drop everything except the second minute of input:
  1145. @example
  1146. ffmpeg -i INPUT -af atrim=60:120
  1147. @end example
  1148. @item
  1149. Keep only the first 1000 samples:
  1150. @example
  1151. ffmpeg -i INPUT -af atrim=end_sample=1000
  1152. @end example
  1153. @end itemize
  1154. @section bandpass
  1155. Apply a two-pole Butterworth band-pass filter with central
  1156. frequency @var{frequency}, and (3dB-point) band-width width.
  1157. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1158. instead of the default: constant 0dB peak gain.
  1159. The filter roll off at 6dB per octave (20dB per decade).
  1160. The filter accepts the following options:
  1161. @table @option
  1162. @item frequency, f
  1163. Set the filter's central frequency. Default is @code{3000}.
  1164. @item csg
  1165. Constant skirt gain if set to 1. Defaults to 0.
  1166. @item width_type
  1167. Set method to specify band-width of filter.
  1168. @table @option
  1169. @item h
  1170. Hz
  1171. @item q
  1172. Q-Factor
  1173. @item o
  1174. octave
  1175. @item s
  1176. slope
  1177. @end table
  1178. @item width, w
  1179. Specify the band-width of a filter in width_type units.
  1180. @end table
  1181. @section bandreject
  1182. Apply a two-pole Butterworth band-reject filter with central
  1183. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1184. The filter roll off at 6dB per octave (20dB per decade).
  1185. The filter accepts the following options:
  1186. @table @option
  1187. @item frequency, f
  1188. Set the filter's central frequency. Default is @code{3000}.
  1189. @item width_type
  1190. Set method to specify band-width of filter.
  1191. @table @option
  1192. @item h
  1193. Hz
  1194. @item q
  1195. Q-Factor
  1196. @item o
  1197. octave
  1198. @item s
  1199. slope
  1200. @end table
  1201. @item width, w
  1202. Specify the band-width of a filter in width_type units.
  1203. @end table
  1204. @section bass
  1205. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1206. shelving filter with a response similar to that of a standard
  1207. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1208. The filter accepts the following options:
  1209. @table @option
  1210. @item gain, g
  1211. Give the gain at 0 Hz. Its useful range is about -20
  1212. (for a large cut) to +20 (for a large boost).
  1213. Beware of clipping when using a positive gain.
  1214. @item frequency, f
  1215. Set the filter's central frequency and so can be used
  1216. to extend or reduce the frequency range to be boosted or cut.
  1217. The default value is @code{100} Hz.
  1218. @item width_type
  1219. Set method to specify band-width of filter.
  1220. @table @option
  1221. @item h
  1222. Hz
  1223. @item q
  1224. Q-Factor
  1225. @item o
  1226. octave
  1227. @item s
  1228. slope
  1229. @end table
  1230. @item width, w
  1231. Determine how steep is the filter's shelf transition.
  1232. @end table
  1233. @section biquad
  1234. Apply a biquad IIR filter with the given coefficients.
  1235. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1236. are the numerator and denominator coefficients respectively.
  1237. @section bs2b
  1238. Bauer stereo to binaural transformation, which improves headphone listening of
  1239. stereo audio records.
  1240. It accepts the following parameters:
  1241. @table @option
  1242. @item profile
  1243. Pre-defined crossfeed level.
  1244. @table @option
  1245. @item default
  1246. Default level (fcut=700, feed=50).
  1247. @item cmoy
  1248. Chu Moy circuit (fcut=700, feed=60).
  1249. @item jmeier
  1250. Jan Meier circuit (fcut=650, feed=95).
  1251. @end table
  1252. @item fcut
  1253. Cut frequency (in Hz).
  1254. @item feed
  1255. Feed level (in Hz).
  1256. @end table
  1257. @section channelmap
  1258. Remap input channels to new locations.
  1259. It accepts the following parameters:
  1260. @table @option
  1261. @item channel_layout
  1262. The channel layout of the output stream.
  1263. @item map
  1264. Map channels from input to output. The argument is a '|'-separated list of
  1265. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1266. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1267. channel (e.g. FL for front left) or its index in the input channel layout.
  1268. @var{out_channel} is the name of the output channel or its index in the output
  1269. channel layout. If @var{out_channel} is not given then it is implicitly an
  1270. index, starting with zero and increasing by one for each mapping.
  1271. @end table
  1272. If no mapping is present, the filter will implicitly map input channels to
  1273. output channels, preserving indices.
  1274. For example, assuming a 5.1+downmix input MOV file,
  1275. @example
  1276. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1277. @end example
  1278. will create an output WAV file tagged as stereo from the downmix channels of
  1279. the input.
  1280. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1281. @example
  1282. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1283. @end example
  1284. @section channelsplit
  1285. Split each channel from an input audio stream into a separate output stream.
  1286. It accepts the following parameters:
  1287. @table @option
  1288. @item channel_layout
  1289. The channel layout of the input stream. The default is "stereo".
  1290. @end table
  1291. For example, assuming a stereo input MP3 file,
  1292. @example
  1293. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1294. @end example
  1295. will create an output Matroska file with two audio streams, one containing only
  1296. the left channel and the other the right channel.
  1297. Split a 5.1 WAV file into per-channel files:
  1298. @example
  1299. ffmpeg -i in.wav -filter_complex
  1300. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1301. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1302. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1303. side_right.wav
  1304. @end example
  1305. @section chorus
  1306. Add a chorus effect to the audio.
  1307. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1308. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1309. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1310. The modulation depth defines the range the modulated delay is played before or after
  1311. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1312. sound tuned around the original one, like in a chorus where some vocals are slightly
  1313. off key.
  1314. It accepts the following parameters:
  1315. @table @option
  1316. @item in_gain
  1317. Set input gain. Default is 0.4.
  1318. @item out_gain
  1319. Set output gain. Default is 0.4.
  1320. @item delays
  1321. Set delays. A typical delay is around 40ms to 60ms.
  1322. @item decays
  1323. Set decays.
  1324. @item speeds
  1325. Set speeds.
  1326. @item depths
  1327. Set depths.
  1328. @end table
  1329. @subsection Examples
  1330. @itemize
  1331. @item
  1332. A single delay:
  1333. @example
  1334. chorus=0.7:0.9:55:0.4:0.25:2
  1335. @end example
  1336. @item
  1337. Two delays:
  1338. @example
  1339. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1340. @end example
  1341. @item
  1342. Fuller sounding chorus with three delays:
  1343. @example
  1344. 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
  1345. @end example
  1346. @end itemize
  1347. @section compand
  1348. Compress or expand the audio's dynamic range.
  1349. It accepts the following parameters:
  1350. @table @option
  1351. @item attacks
  1352. @item decays
  1353. A list of times in seconds for each channel over which the instantaneous level
  1354. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1355. increase of volume and @var{decays} refers to decrease of volume. For most
  1356. situations, the attack time (response to the audio getting louder) should be
  1357. shorter than the decay time, because the human ear is more sensitive to sudden
  1358. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1359. a typical value for decay is 0.8 seconds.
  1360. If specified number of attacks & decays is lower than number of channels, the last
  1361. set attack/decay will be used for all remaining channels.
  1362. @item points
  1363. A list of points for the transfer function, specified in dB relative to the
  1364. maximum possible signal amplitude. Each key points list must be defined using
  1365. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1366. @code{x0/y0 x1/y1 x2/y2 ....}
  1367. The input values must be in strictly increasing order but the transfer function
  1368. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1369. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1370. function are @code{-70/-70|-60/-20}.
  1371. @item soft-knee
  1372. Set the curve radius in dB for all joints. It defaults to 0.01.
  1373. @item gain
  1374. Set the additional gain in dB to be applied at all points on the transfer
  1375. function. This allows for easy adjustment of the overall gain.
  1376. It defaults to 0.
  1377. @item volume
  1378. Set an initial volume, in dB, to be assumed for each channel when filtering
  1379. starts. This permits the user to supply a nominal level initially, so that, for
  1380. example, a very large gain is not applied to initial signal levels before the
  1381. companding has begun to operate. A typical value for audio which is initially
  1382. quiet is -90 dB. It defaults to 0.
  1383. @item delay
  1384. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1385. delayed before being fed to the volume adjuster. Specifying a delay
  1386. approximately equal to the attack/decay times allows the filter to effectively
  1387. operate in predictive rather than reactive mode. It defaults to 0.
  1388. @end table
  1389. @subsection Examples
  1390. @itemize
  1391. @item
  1392. Make music with both quiet and loud passages suitable for listening to in a
  1393. noisy environment:
  1394. @example
  1395. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1396. @end example
  1397. Another example for audio with whisper and explosion parts:
  1398. @example
  1399. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1400. @end example
  1401. @item
  1402. A noise gate for when the noise is at a lower level than the signal:
  1403. @example
  1404. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1405. @end example
  1406. @item
  1407. Here is another noise gate, this time for when the noise is at a higher level
  1408. than the signal (making it, in some ways, similar to squelch):
  1409. @example
  1410. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1411. @end example
  1412. @item
  1413. 2:1 compression starting at -6dB:
  1414. @example
  1415. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1416. @end example
  1417. @item
  1418. 2:1 compression starting at -9dB:
  1419. @example
  1420. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1421. @end example
  1422. @item
  1423. 2:1 compression starting at -12dB:
  1424. @example
  1425. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1426. @end example
  1427. @item
  1428. 2:1 compression starting at -18dB:
  1429. @example
  1430. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1431. @end example
  1432. @item
  1433. 3:1 compression starting at -15dB:
  1434. @example
  1435. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1436. @end example
  1437. @item
  1438. Compressor/Gate:
  1439. @example
  1440. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1441. @end example
  1442. @item
  1443. Expander:
  1444. @example
  1445. 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
  1446. @end example
  1447. @item
  1448. Hard limiter at -6dB:
  1449. @example
  1450. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1451. @end example
  1452. @item
  1453. Hard limiter at -12dB:
  1454. @example
  1455. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1456. @end example
  1457. @item
  1458. Hard noise gate at -35 dB:
  1459. @example
  1460. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1461. @end example
  1462. @item
  1463. Soft limiter:
  1464. @example
  1465. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1466. @end example
  1467. @end itemize
  1468. @section compensationdelay
  1469. Compensation Delay Line is a metric based delay to compensate differing
  1470. positions of microphones or speakers.
  1471. For example, you have recorded guitar with two microphones placed in
  1472. different location. Because the front of sound wave has fixed speed in
  1473. normal conditions, the phasing of microphones can vary and depends on
  1474. their location and interposition. The best sound mix can be achieved when
  1475. these microphones are in phase (synchronized). Note that distance of
  1476. ~30 cm between microphones makes one microphone to capture signal in
  1477. antiphase to another microphone. That makes the final mix sounding moody.
  1478. This filter helps to solve phasing problems by adding different delays
  1479. to each microphone track and make them synchronized.
  1480. The best result can be reached when you take one track as base and
  1481. synchronize other tracks one by one with it.
  1482. Remember that synchronization/delay tolerance depends on sample rate, too.
  1483. Higher sample rates will give more tolerance.
  1484. It accepts the following parameters:
  1485. @table @option
  1486. @item mm
  1487. Set millimeters distance. This is compensation distance for fine tuning.
  1488. Default is 0.
  1489. @item cm
  1490. Set cm distance. This is compensation distance for tightening distance setup.
  1491. Default is 0.
  1492. @item m
  1493. Set meters distance. This is compensation distance for hard distance setup.
  1494. Default is 0.
  1495. @item dry
  1496. Set dry amount. Amount of unprocessed (dry) signal.
  1497. Default is 0.
  1498. @item wet
  1499. Set wet amount. Amount of processed (wet) signal.
  1500. Default is 1.
  1501. @item temp
  1502. Set temperature degree in Celsius. This is the temperature of the environment.
  1503. Default is 20.
  1504. @end table
  1505. @section dcshift
  1506. Apply a DC shift to the audio.
  1507. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1508. in the recording chain) from the audio. The effect of a DC offset is reduced
  1509. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1510. a signal has a DC offset.
  1511. @table @option
  1512. @item shift
  1513. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1514. the audio.
  1515. @item limitergain
  1516. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1517. used to prevent clipping.
  1518. @end table
  1519. @section dynaudnorm
  1520. Dynamic Audio Normalizer.
  1521. This filter applies a certain amount of gain to the input audio in order
  1522. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1523. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1524. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1525. This allows for applying extra gain to the "quiet" sections of the audio
  1526. while avoiding distortions or clipping the "loud" sections. In other words:
  1527. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1528. sections, in the sense that the volume of each section is brought to the
  1529. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1530. this goal *without* applying "dynamic range compressing". It will retain 100%
  1531. of the dynamic range *within* each section of the audio file.
  1532. @table @option
  1533. @item f
  1534. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1535. Default is 500 milliseconds.
  1536. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1537. referred to as frames. This is required, because a peak magnitude has no
  1538. meaning for just a single sample value. Instead, we need to determine the
  1539. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1540. normalizer would simply use the peak magnitude of the complete file, the
  1541. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1542. frame. The length of a frame is specified in milliseconds. By default, the
  1543. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1544. been found to give good results with most files.
  1545. Note that the exact frame length, in number of samples, will be determined
  1546. automatically, based on the sampling rate of the individual input audio file.
  1547. @item g
  1548. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1549. number. Default is 31.
  1550. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1551. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1552. is specified in frames, centered around the current frame. For the sake of
  1553. simplicity, this must be an odd number. Consequently, the default value of 31
  1554. takes into account the current frame, as well as the 15 preceding frames and
  1555. the 15 subsequent frames. Using a larger window results in a stronger
  1556. smoothing effect and thus in less gain variation, i.e. slower gain
  1557. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1558. effect and thus in more gain variation, i.e. faster gain adaptation.
  1559. In other words, the more you increase this value, the more the Dynamic Audio
  1560. Normalizer will behave like a "traditional" normalization filter. On the
  1561. contrary, the more you decrease this value, the more the Dynamic Audio
  1562. Normalizer will behave like a dynamic range compressor.
  1563. @item p
  1564. Set the target peak value. This specifies the highest permissible magnitude
  1565. level for the normalized audio input. This filter will try to approach the
  1566. target peak magnitude as closely as possible, but at the same time it also
  1567. makes sure that the normalized signal will never exceed the peak magnitude.
  1568. A frame's maximum local gain factor is imposed directly by the target peak
  1569. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1570. It is not recommended to go above this value.
  1571. @item m
  1572. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1573. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1574. factor for each input frame, i.e. the maximum gain factor that does not
  1575. result in clipping or distortion. The maximum gain factor is determined by
  1576. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1577. additionally bounds the frame's maximum gain factor by a predetermined
  1578. (global) maximum gain factor. This is done in order to avoid excessive gain
  1579. factors in "silent" or almost silent frames. By default, the maximum gain
  1580. factor is 10.0, For most inputs the default value should be sufficient and
  1581. it usually is not recommended to increase this value. Though, for input
  1582. with an extremely low overall volume level, it may be necessary to allow even
  1583. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1584. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1585. Instead, a "sigmoid" threshold function will be applied. This way, the
  1586. gain factors will smoothly approach the threshold value, but never exceed that
  1587. value.
  1588. @item r
  1589. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1590. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1591. This means that the maximum local gain factor for each frame is defined
  1592. (only) by the frame's highest magnitude sample. This way, the samples can
  1593. be amplified as much as possible without exceeding the maximum signal
  1594. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1595. Normalizer can also take into account the frame's root mean square,
  1596. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1597. determine the power of a time-varying signal. It is therefore considered
  1598. that the RMS is a better approximation of the "perceived loudness" than
  1599. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1600. frames to a constant RMS value, a uniform "perceived loudness" can be
  1601. established. If a target RMS value has been specified, a frame's local gain
  1602. factor is defined as the factor that would result in exactly that RMS value.
  1603. Note, however, that the maximum local gain factor is still restricted by the
  1604. frame's highest magnitude sample, in order to prevent clipping.
  1605. @item n
  1606. Enable channels coupling. By default is enabled.
  1607. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1608. amount. This means the same gain factor will be applied to all channels, i.e.
  1609. the maximum possible gain factor is determined by the "loudest" channel.
  1610. However, in some recordings, it may happen that the volume of the different
  1611. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1612. In this case, this option can be used to disable the channel coupling. This way,
  1613. the gain factor will be determined independently for each channel, depending
  1614. only on the individual channel's highest magnitude sample. This allows for
  1615. harmonizing the volume of the different channels.
  1616. @item c
  1617. Enable DC bias correction. By default is disabled.
  1618. An audio signal (in the time domain) is a sequence of sample values.
  1619. In the Dynamic Audio Normalizer these sample values are represented in the
  1620. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1621. audio signal, or "waveform", should be centered around the zero point.
  1622. That means if we calculate the mean value of all samples in a file, or in a
  1623. single frame, then the result should be 0.0 or at least very close to that
  1624. value. If, however, there is a significant deviation of the mean value from
  1625. 0.0, in either positive or negative direction, this is referred to as a
  1626. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1627. Audio Normalizer provides optional DC bias correction.
  1628. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1629. the mean value, or "DC correction" offset, of each input frame and subtract
  1630. that value from all of the frame's sample values which ensures those samples
  1631. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1632. boundaries, the DC correction offset values will be interpolated smoothly
  1633. between neighbouring frames.
  1634. @item b
  1635. Enable alternative boundary mode. By default is disabled.
  1636. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1637. around each frame. This includes the preceding frames as well as the
  1638. subsequent frames. However, for the "boundary" frames, located at the very
  1639. beginning and at the very end of the audio file, not all neighbouring
  1640. frames are available. In particular, for the first few frames in the audio
  1641. file, the preceding frames are not known. And, similarly, for the last few
  1642. frames in the audio file, the subsequent frames are not known. Thus, the
  1643. question arises which gain factors should be assumed for the missing frames
  1644. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1645. to deal with this situation. The default boundary mode assumes a gain factor
  1646. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1647. "fade out" at the beginning and at the end of the input, respectively.
  1648. @item s
  1649. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1650. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1651. compression. This means that signal peaks will not be pruned and thus the
  1652. full dynamic range will be retained within each local neighbourhood. However,
  1653. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1654. normalization algorithm with a more "traditional" compression.
  1655. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1656. (thresholding) function. If (and only if) the compression feature is enabled,
  1657. all input frames will be processed by a soft knee thresholding function prior
  1658. to the actual normalization process. Put simply, the thresholding function is
  1659. going to prune all samples whose magnitude exceeds a certain threshold value.
  1660. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1661. value. Instead, the threshold value will be adjusted for each individual
  1662. frame.
  1663. In general, smaller parameters result in stronger compression, and vice versa.
  1664. Values below 3.0 are not recommended, because audible distortion may appear.
  1665. @end table
  1666. @section earwax
  1667. Make audio easier to listen to on headphones.
  1668. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1669. so that when listened to on headphones the stereo image is moved from
  1670. inside your head (standard for headphones) to outside and in front of
  1671. the listener (standard for speakers).
  1672. Ported from SoX.
  1673. @section equalizer
  1674. Apply a two-pole peaking equalisation (EQ) filter. With this
  1675. filter, the signal-level at and around a selected frequency can
  1676. be increased or decreased, whilst (unlike bandpass and bandreject
  1677. filters) that at all other frequencies is unchanged.
  1678. In order to produce complex equalisation curves, this filter can
  1679. be given several times, each with a different central frequency.
  1680. The filter accepts the following options:
  1681. @table @option
  1682. @item frequency, f
  1683. Set the filter's central frequency in Hz.
  1684. @item width_type
  1685. Set method to specify band-width of filter.
  1686. @table @option
  1687. @item h
  1688. Hz
  1689. @item q
  1690. Q-Factor
  1691. @item o
  1692. octave
  1693. @item s
  1694. slope
  1695. @end table
  1696. @item width, w
  1697. Specify the band-width of a filter in width_type units.
  1698. @item gain, g
  1699. Set the required gain or attenuation in dB.
  1700. Beware of clipping when using a positive gain.
  1701. @end table
  1702. @subsection Examples
  1703. @itemize
  1704. @item
  1705. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1706. @example
  1707. equalizer=f=1000:width_type=h:width=200:g=-10
  1708. @end example
  1709. @item
  1710. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1711. @example
  1712. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1713. @end example
  1714. @end itemize
  1715. @section extrastereo
  1716. Linearly increases the difference between left and right channels which
  1717. adds some sort of "live" effect to playback.
  1718. The filter accepts the following option:
  1719. @table @option
  1720. @item m
  1721. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1722. (average of both channels), with 1.0 sound will be unchanged, with
  1723. -1.0 left and right channels will be swapped.
  1724. @item c
  1725. Enable clipping. By default is enabled.
  1726. @end table
  1727. @section flanger
  1728. Apply a flanging effect to the audio.
  1729. The filter accepts the following options:
  1730. @table @option
  1731. @item delay
  1732. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1733. @item depth
  1734. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1735. @item regen
  1736. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1737. Default value is 0.
  1738. @item width
  1739. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1740. Default value is 71.
  1741. @item speed
  1742. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1743. @item shape
  1744. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1745. Default value is @var{sinusoidal}.
  1746. @item phase
  1747. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1748. Default value is 25.
  1749. @item interp
  1750. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1751. Default is @var{linear}.
  1752. @end table
  1753. @section highpass
  1754. Apply a high-pass filter with 3dB point frequency.
  1755. The filter can be either single-pole, or double-pole (the default).
  1756. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1757. The filter accepts the following options:
  1758. @table @option
  1759. @item frequency, f
  1760. Set frequency in Hz. Default is 3000.
  1761. @item poles, p
  1762. Set number of poles. Default is 2.
  1763. @item width_type
  1764. Set method to specify band-width of filter.
  1765. @table @option
  1766. @item h
  1767. Hz
  1768. @item q
  1769. Q-Factor
  1770. @item o
  1771. octave
  1772. @item s
  1773. slope
  1774. @end table
  1775. @item width, w
  1776. Specify the band-width of a filter in width_type units.
  1777. Applies only to double-pole filter.
  1778. The default is 0.707q and gives a Butterworth response.
  1779. @end table
  1780. @section join
  1781. Join multiple input streams into one multi-channel stream.
  1782. It accepts the following parameters:
  1783. @table @option
  1784. @item inputs
  1785. The number of input streams. It defaults to 2.
  1786. @item channel_layout
  1787. The desired output channel layout. It defaults to stereo.
  1788. @item map
  1789. Map channels from inputs to output. The argument is a '|'-separated list of
  1790. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  1791. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  1792. can be either the name of the input channel (e.g. FL for front left) or its
  1793. index in the specified input stream. @var{out_channel} is the name of the output
  1794. channel.
  1795. @end table
  1796. The filter will attempt to guess the mappings when they are not specified
  1797. explicitly. It does so by first trying to find an unused matching input channel
  1798. and if that fails it picks the first unused input channel.
  1799. Join 3 inputs (with properly set channel layouts):
  1800. @example
  1801. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1802. @end example
  1803. Build a 5.1 output from 6 single-channel streams:
  1804. @example
  1805. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1806. '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'
  1807. out
  1808. @end example
  1809. @section ladspa
  1810. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  1811. To enable compilation of this filter you need to configure FFmpeg with
  1812. @code{--enable-ladspa}.
  1813. @table @option
  1814. @item file, f
  1815. Specifies the name of LADSPA plugin library to load. If the environment
  1816. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  1817. each one of the directories specified by the colon separated list in
  1818. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  1819. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  1820. @file{/usr/lib/ladspa/}.
  1821. @item plugin, p
  1822. Specifies the plugin within the library. Some libraries contain only
  1823. one plugin, but others contain many of them. If this is not set filter
  1824. will list all available plugins within the specified library.
  1825. @item controls, c
  1826. Set the '|' separated list of controls which are zero or more floating point
  1827. values that determine the behavior of the loaded plugin (for example delay,
  1828. threshold or gain).
  1829. Controls need to be defined using the following syntax:
  1830. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  1831. @var{valuei} is the value set on the @var{i}-th control.
  1832. Alternatively they can be also defined using the following syntax:
  1833. @var{value0}|@var{value1}|@var{value2}|..., where
  1834. @var{valuei} is the value set on the @var{i}-th control.
  1835. If @option{controls} is set to @code{help}, all available controls and
  1836. their valid ranges are printed.
  1837. @item sample_rate, s
  1838. Specify the sample rate, default to 44100. Only used if plugin have
  1839. zero inputs.
  1840. @item nb_samples, n
  1841. Set the number of samples per channel per each output frame, default
  1842. is 1024. Only used if plugin have zero inputs.
  1843. @item duration, d
  1844. Set the minimum duration of the sourced audio. See
  1845. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1846. for the accepted syntax.
  1847. Note that the resulting duration may be greater than the specified duration,
  1848. as the generated audio is always cut at the end of a complete frame.
  1849. If not specified, or the expressed duration is negative, the audio is
  1850. supposed to be generated forever.
  1851. Only used if plugin have zero inputs.
  1852. @end table
  1853. @subsection Examples
  1854. @itemize
  1855. @item
  1856. List all available plugins within amp (LADSPA example plugin) library:
  1857. @example
  1858. ladspa=file=amp
  1859. @end example
  1860. @item
  1861. List all available controls and their valid ranges for @code{vcf_notch}
  1862. plugin from @code{VCF} library:
  1863. @example
  1864. ladspa=f=vcf:p=vcf_notch:c=help
  1865. @end example
  1866. @item
  1867. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  1868. plugin library:
  1869. @example
  1870. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  1871. @end example
  1872. @item
  1873. Add reverberation to the audio using TAP-plugins
  1874. (Tom's Audio Processing plugins):
  1875. @example
  1876. ladspa=file=tap_reverb:tap_reverb
  1877. @end example
  1878. @item
  1879. Generate white noise, with 0.2 amplitude:
  1880. @example
  1881. ladspa=file=cmt:noise_source_white:c=c0=.2
  1882. @end example
  1883. @item
  1884. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  1885. @code{C* Audio Plugin Suite} (CAPS) library:
  1886. @example
  1887. ladspa=file=caps:Click:c=c1=20'
  1888. @end example
  1889. @item
  1890. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  1891. @example
  1892. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  1893. @end example
  1894. @item
  1895. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  1896. @code{SWH Plugins} collection:
  1897. @example
  1898. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  1899. @end example
  1900. @item
  1901. Attenuate low frequencies using Multiband EQ from Steve Harris
  1902. @code{SWH Plugins} collection:
  1903. @example
  1904. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  1905. @end example
  1906. @end itemize
  1907. @subsection Commands
  1908. This filter supports the following commands:
  1909. @table @option
  1910. @item cN
  1911. Modify the @var{N}-th control value.
  1912. If the specified value is not valid, it is ignored and prior one is kept.
  1913. @end table
  1914. @section lowpass
  1915. Apply a low-pass filter with 3dB point frequency.
  1916. The filter can be either single-pole or double-pole (the default).
  1917. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1918. The filter accepts the following options:
  1919. @table @option
  1920. @item frequency, f
  1921. Set frequency in Hz. Default is 500.
  1922. @item poles, p
  1923. Set number of poles. Default is 2.
  1924. @item width_type
  1925. Set method to specify band-width of filter.
  1926. @table @option
  1927. @item h
  1928. Hz
  1929. @item q
  1930. Q-Factor
  1931. @item o
  1932. octave
  1933. @item s
  1934. slope
  1935. @end table
  1936. @item width, w
  1937. Specify the band-width of a filter in width_type units.
  1938. Applies only to double-pole filter.
  1939. The default is 0.707q and gives a Butterworth response.
  1940. @end table
  1941. @anchor{pan}
  1942. @section pan
  1943. Mix channels with specific gain levels. The filter accepts the output
  1944. channel layout followed by a set of channels definitions.
  1945. This filter is also designed to efficiently remap the channels of an audio
  1946. stream.
  1947. The filter accepts parameters of the form:
  1948. "@var{l}|@var{outdef}|@var{outdef}|..."
  1949. @table @option
  1950. @item l
  1951. output channel layout or number of channels
  1952. @item outdef
  1953. output channel specification, of the form:
  1954. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  1955. @item out_name
  1956. output channel to define, either a channel name (FL, FR, etc.) or a channel
  1957. number (c0, c1, etc.)
  1958. @item gain
  1959. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  1960. @item in_name
  1961. input channel to use, see out_name for details; it is not possible to mix
  1962. named and numbered input channels
  1963. @end table
  1964. If the `=' in a channel specification is replaced by `<', then the gains for
  1965. that specification will be renormalized so that the total is 1, thus
  1966. avoiding clipping noise.
  1967. @subsection Mixing examples
  1968. For example, if you want to down-mix from stereo to mono, but with a bigger
  1969. factor for the left channel:
  1970. @example
  1971. pan=1c|c0=0.9*c0+0.1*c1
  1972. @end example
  1973. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  1974. 7-channels surround:
  1975. @example
  1976. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  1977. @end example
  1978. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  1979. that should be preferred (see "-ac" option) unless you have very specific
  1980. needs.
  1981. @subsection Remapping examples
  1982. The channel remapping will be effective if, and only if:
  1983. @itemize
  1984. @item gain coefficients are zeroes or ones,
  1985. @item only one input per channel output,
  1986. @end itemize
  1987. If all these conditions are satisfied, the filter will notify the user ("Pure
  1988. channel mapping detected"), and use an optimized and lossless method to do the
  1989. remapping.
  1990. For example, if you have a 5.1 source and want a stereo audio stream by
  1991. dropping the extra channels:
  1992. @example
  1993. pan="stereo| c0=FL | c1=FR"
  1994. @end example
  1995. Given the same source, you can also switch front left and front right channels
  1996. and keep the input channel layout:
  1997. @example
  1998. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  1999. @end example
  2000. If the input is a stereo audio stream, you can mute the front left channel (and
  2001. still keep the stereo channel layout) with:
  2002. @example
  2003. pan="stereo|c1=c1"
  2004. @end example
  2005. Still with a stereo audio stream input, you can copy the right channel in both
  2006. front left and right:
  2007. @example
  2008. pan="stereo| c0=FR | c1=FR"
  2009. @end example
  2010. @section replaygain
  2011. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2012. outputs it unchanged.
  2013. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2014. @section resample
  2015. Convert the audio sample format, sample rate and channel layout. It is
  2016. not meant to be used directly.
  2017. @section rubberband
  2018. Apply time-stretching and pitch-shifting with librubberband.
  2019. The filter accepts the following options:
  2020. @table @option
  2021. @item tempo
  2022. Set tempo scale factor.
  2023. @item pitch
  2024. Set pitch scale factor.
  2025. @item transients
  2026. Set transients detector.
  2027. Possible values are:
  2028. @table @var
  2029. @item crisp
  2030. @item mixed
  2031. @item smooth
  2032. @end table
  2033. @item detector
  2034. Set detector.
  2035. Possible values are:
  2036. @table @var
  2037. @item compound
  2038. @item percussive
  2039. @item soft
  2040. @end table
  2041. @item phase
  2042. Set phase.
  2043. Possible values are:
  2044. @table @var
  2045. @item laminar
  2046. @item independent
  2047. @end table
  2048. @item window
  2049. Set processing window size.
  2050. Possible values are:
  2051. @table @var
  2052. @item standard
  2053. @item short
  2054. @item long
  2055. @end table
  2056. @item smoothing
  2057. Set smoothing.
  2058. Possible values are:
  2059. @table @var
  2060. @item off
  2061. @item on
  2062. @end table
  2063. @item formant
  2064. Enable formant preservation when shift pitching.
  2065. Possible values are:
  2066. @table @var
  2067. @item shifted
  2068. @item preserved
  2069. @end table
  2070. @item pitchq
  2071. Set pitch quality.
  2072. Possible values are:
  2073. @table @var
  2074. @item quality
  2075. @item speed
  2076. @item consistency
  2077. @end table
  2078. @item channels
  2079. Set channels.
  2080. Possible values are:
  2081. @table @var
  2082. @item apart
  2083. @item together
  2084. @end table
  2085. @end table
  2086. @section sidechaincompress
  2087. This filter acts like normal compressor but has the ability to compress
  2088. detected signal using second input signal.
  2089. It needs two input streams and returns one output stream.
  2090. First input stream will be processed depending on second stream signal.
  2091. The filtered signal then can be filtered with other filters in later stages of
  2092. processing. See @ref{pan} and @ref{amerge} filter.
  2093. The filter accepts the following options:
  2094. @table @option
  2095. @item level_in
  2096. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2097. @item threshold
  2098. If a signal of second stream raises above this level it will affect the gain
  2099. reduction of first stream.
  2100. By default is 0.125. Range is between 0.00097563 and 1.
  2101. @item ratio
  2102. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2103. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2104. Default is 2. Range is between 1 and 20.
  2105. @item attack
  2106. Amount of milliseconds the signal has to rise above the threshold before gain
  2107. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2108. @item release
  2109. Amount of milliseconds the signal has to fall below the threshold before
  2110. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2111. @item makeup
  2112. Set the amount by how much signal will be amplified after processing.
  2113. Default is 2. Range is from 1 and 64.
  2114. @item knee
  2115. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2116. Default is 2.82843. Range is between 1 and 8.
  2117. @item link
  2118. Choose if the @code{average} level between all channels of side-chain stream
  2119. or the louder(@code{maximum}) channel of side-chain stream affects the
  2120. reduction. Default is @code{average}.
  2121. @item detection
  2122. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2123. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2124. @item level_sc
  2125. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2126. @item mix
  2127. How much to use compressed signal in output. Default is 1.
  2128. Range is between 0 and 1.
  2129. @end table
  2130. @subsection Examples
  2131. @itemize
  2132. @item
  2133. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2134. depending on the signal of 2nd input and later compressed signal to be
  2135. merged with 2nd input:
  2136. @example
  2137. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2138. @end example
  2139. @end itemize
  2140. @section sidechaingate
  2141. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2142. filter the detected signal before sending it to the gain reduction stage.
  2143. Normally a gate uses the full range signal to detect a level above the
  2144. threshold.
  2145. For example: If you cut all lower frequencies from your sidechain signal
  2146. the gate will decrease the volume of your track only if not enough highs
  2147. appear. With this technique you are able to reduce the resonation of a
  2148. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2149. guitar.
  2150. It needs two input streams and returns one output stream.
  2151. First input stream will be processed depending on second stream signal.
  2152. The filter accepts the following options:
  2153. @table @option
  2154. @item level_in
  2155. Set input level before filtering.
  2156. Default is 1. Allowed range is from 0.015625 to 64.
  2157. @item range
  2158. Set the level of gain reduction when the signal is below the threshold.
  2159. Default is 0.06125. Allowed range is from 0 to 1.
  2160. @item threshold
  2161. If a signal rises above this level the gain reduction is released.
  2162. Default is 0.125. Allowed range is from 0 to 1.
  2163. @item ratio
  2164. Set a ratio about which the signal is reduced.
  2165. Default is 2. Allowed range is from 1 to 9000.
  2166. @item attack
  2167. Amount of milliseconds the signal has to rise above the threshold before gain
  2168. reduction stops.
  2169. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2170. @item release
  2171. Amount of milliseconds the signal has to fall below the threshold before the
  2172. reduction is increased again. Default is 250 milliseconds.
  2173. Allowed range is from 0.01 to 9000.
  2174. @item makeup
  2175. Set amount of amplification of signal after processing.
  2176. Default is 1. Allowed range is from 1 to 64.
  2177. @item knee
  2178. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2179. Default is 2.828427125. Allowed range is from 1 to 8.
  2180. @item detection
  2181. Choose if exact signal should be taken for detection or an RMS like one.
  2182. Default is rms. Can be peak or rms.
  2183. @item link
  2184. Choose if the average level between all channels or the louder channel affects
  2185. the reduction.
  2186. Default is average. Can be average or maximum.
  2187. @item level_sc
  2188. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2189. @end table
  2190. @section silencedetect
  2191. Detect silence in an audio stream.
  2192. This filter logs a message when it detects that the input audio volume is less
  2193. or equal to a noise tolerance value for a duration greater or equal to the
  2194. minimum detected noise duration.
  2195. The printed times and duration are expressed in seconds.
  2196. The filter accepts the following options:
  2197. @table @option
  2198. @item duration, d
  2199. Set silence duration until notification (default is 2 seconds).
  2200. @item noise, n
  2201. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2202. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2203. @end table
  2204. @subsection Examples
  2205. @itemize
  2206. @item
  2207. Detect 5 seconds of silence with -50dB noise tolerance:
  2208. @example
  2209. silencedetect=n=-50dB:d=5
  2210. @end example
  2211. @item
  2212. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2213. tolerance in @file{silence.mp3}:
  2214. @example
  2215. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2216. @end example
  2217. @end itemize
  2218. @section silenceremove
  2219. Remove silence from the beginning, middle or end of the audio.
  2220. The filter accepts the following options:
  2221. @table @option
  2222. @item start_periods
  2223. This value is used to indicate if audio should be trimmed at beginning of
  2224. the audio. A value of zero indicates no silence should be trimmed from the
  2225. beginning. When specifying a non-zero value, it trims audio up until it
  2226. finds non-silence. Normally, when trimming silence from beginning of audio
  2227. the @var{start_periods} will be @code{1} but it can be increased to higher
  2228. values to trim all audio up to specific count of non-silence periods.
  2229. Default value is @code{0}.
  2230. @item start_duration
  2231. Specify the amount of time that non-silence must be detected before it stops
  2232. trimming audio. By increasing the duration, bursts of noises can be treated
  2233. as silence and trimmed off. Default value is @code{0}.
  2234. @item start_threshold
  2235. This indicates what sample value should be treated as silence. For digital
  2236. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2237. you may wish to increase the value to account for background noise.
  2238. Can be specified in dB (in case "dB" is appended to the specified value)
  2239. or amplitude ratio. Default value is @code{0}.
  2240. @item stop_periods
  2241. Set the count for trimming silence from the end of audio.
  2242. To remove silence from the middle of a file, specify a @var{stop_periods}
  2243. that is negative. This value is then treated as a positive value and is
  2244. used to indicate the effect should restart processing as specified by
  2245. @var{start_periods}, making it suitable for removing periods of silence
  2246. in the middle of the audio.
  2247. Default value is @code{0}.
  2248. @item stop_duration
  2249. Specify a duration of silence that must exist before audio is not copied any
  2250. more. By specifying a higher duration, silence that is wanted can be left in
  2251. the audio.
  2252. Default value is @code{0}.
  2253. @item stop_threshold
  2254. This is the same as @option{start_threshold} but for trimming silence from
  2255. the end of audio.
  2256. Can be specified in dB (in case "dB" is appended to the specified value)
  2257. or amplitude ratio. Default value is @code{0}.
  2258. @item leave_silence
  2259. This indicate that @var{stop_duration} length of audio should be left intact
  2260. at the beginning of each period of silence.
  2261. For example, if you want to remove long pauses between words but do not want
  2262. to remove the pauses completely. Default value is @code{0}.
  2263. @end table
  2264. @subsection Examples
  2265. @itemize
  2266. @item
  2267. The following example shows how this filter can be used to start a recording
  2268. that does not contain the delay at the start which usually occurs between
  2269. pressing the record button and the start of the performance:
  2270. @example
  2271. silenceremove=1:5:0.02
  2272. @end example
  2273. @end itemize
  2274. @section stereotools
  2275. This filter has some handy utilities to manage stereo signals, for converting
  2276. M/S stereo recordings to L/R signal while having control over the parameters
  2277. or spreading the stereo image of master track.
  2278. The filter accepts the following options:
  2279. @table @option
  2280. @item level_in
  2281. Set input level before filtering for both channels. Defaults is 1.
  2282. Allowed range is from 0.015625 to 64.
  2283. @item level_out
  2284. Set output level after filtering for both channels. Defaults is 1.
  2285. Allowed range is from 0.015625 to 64.
  2286. @item balance_in
  2287. Set input balance between both channels. Default is 0.
  2288. Allowed range is from -1 to 1.
  2289. @item balance_out
  2290. Set output balance between both channels. Default is 0.
  2291. Allowed range is from -1 to 1.
  2292. @item softclip
  2293. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2294. clipping. Disabled by default.
  2295. @item mutel
  2296. Mute the left channel. Disabled by default.
  2297. @item muter
  2298. Mute the right channel. Disabled by default.
  2299. @item phasel
  2300. Change the phase of the left channel. Disabled by default.
  2301. @item phaser
  2302. Change the phase of the right channel. Disabled by default.
  2303. @item mode
  2304. Set stereo mode. Available values are:
  2305. @table @samp
  2306. @item lr>lr
  2307. Left/Right to Left/Right, this is default.
  2308. @item lr>ms
  2309. Left/Right to Mid/Side.
  2310. @item ms>lr
  2311. Mid/Side to Left/Right.
  2312. @item lr>ll
  2313. Left/Right to Left/Left.
  2314. @item lr>rr
  2315. Left/Right to Right/Right.
  2316. @item lr>l+r
  2317. Left/Right to Left + Right.
  2318. @item lr>rl
  2319. Left/Right to Right/Left.
  2320. @end table
  2321. @item slev
  2322. Set level of side signal. Default is 1.
  2323. Allowed range is from 0.015625 to 64.
  2324. @item sbal
  2325. Set balance of side signal. Default is 0.
  2326. Allowed range is from -1 to 1.
  2327. @item mlev
  2328. Set level of the middle signal. Default is 1.
  2329. Allowed range is from 0.015625 to 64.
  2330. @item mpan
  2331. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2332. @item base
  2333. Set stereo base between mono and inversed channels. Default is 0.
  2334. Allowed range is from -1 to 1.
  2335. @item delay
  2336. Set delay in milliseconds how much to delay left from right channel and
  2337. vice versa. Default is 0. Allowed range is from -20 to 20.
  2338. @item sclevel
  2339. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2340. @item phase
  2341. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2342. @end table
  2343. @section stereowiden
  2344. This filter enhance the stereo effect by suppressing signal common to both
  2345. channels and by delaying the signal of left into right and vice versa,
  2346. thereby widening the stereo effect.
  2347. The filter accepts the following options:
  2348. @table @option
  2349. @item delay
  2350. Time in milliseconds of the delay of left signal into right and vice versa.
  2351. Default is 20 milliseconds.
  2352. @item feedback
  2353. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2354. effect of left signal in right output and vice versa which gives widening
  2355. effect. Default is 0.3.
  2356. @item crossfeed
  2357. Cross feed of left into right with inverted phase. This helps in suppressing
  2358. the mono. If the value is 1 it will cancel all the signal common to both
  2359. channels. Default is 0.3.
  2360. @item drymix
  2361. Set level of input signal of original channel. Default is 0.8.
  2362. @end table
  2363. @section treble
  2364. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2365. shelving filter with a response similar to that of a standard
  2366. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2367. The filter accepts the following options:
  2368. @table @option
  2369. @item gain, g
  2370. Give the gain at whichever is the lower of ~22 kHz and the
  2371. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2372. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2373. @item frequency, f
  2374. Set the filter's central frequency and so can be used
  2375. to extend or reduce the frequency range to be boosted or cut.
  2376. The default value is @code{3000} Hz.
  2377. @item width_type
  2378. Set method to specify band-width of filter.
  2379. @table @option
  2380. @item h
  2381. Hz
  2382. @item q
  2383. Q-Factor
  2384. @item o
  2385. octave
  2386. @item s
  2387. slope
  2388. @end table
  2389. @item width, w
  2390. Determine how steep is the filter's shelf transition.
  2391. @end table
  2392. @section tremolo
  2393. Sinusoidal amplitude modulation.
  2394. The filter accepts the following options:
  2395. @table @option
  2396. @item f
  2397. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2398. (20 Hz or lower) will result in a tremolo effect.
  2399. This filter may also be used as a ring modulator by specifying
  2400. a modulation frequency higher than 20 Hz.
  2401. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2402. @item d
  2403. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2404. Default value is 0.5.
  2405. @end table
  2406. @section vibrato
  2407. Sinusoidal phase modulation.
  2408. The filter accepts the following options:
  2409. @table @option
  2410. @item f
  2411. Modulation frequency in Hertz.
  2412. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2413. @item d
  2414. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2415. Default value is 0.5.
  2416. @end table
  2417. @section volume
  2418. Adjust the input audio volume.
  2419. It accepts the following parameters:
  2420. @table @option
  2421. @item volume
  2422. Set audio volume expression.
  2423. Output values are clipped to the maximum value.
  2424. The output audio volume is given by the relation:
  2425. @example
  2426. @var{output_volume} = @var{volume} * @var{input_volume}
  2427. @end example
  2428. The default value for @var{volume} is "1.0".
  2429. @item precision
  2430. This parameter represents the mathematical precision.
  2431. It determines which input sample formats will be allowed, which affects the
  2432. precision of the volume scaling.
  2433. @table @option
  2434. @item fixed
  2435. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2436. @item float
  2437. 32-bit floating-point; this limits input sample format to FLT. (default)
  2438. @item double
  2439. 64-bit floating-point; this limits input sample format to DBL.
  2440. @end table
  2441. @item replaygain
  2442. Choose the behaviour on encountering ReplayGain side data in input frames.
  2443. @table @option
  2444. @item drop
  2445. Remove ReplayGain side data, ignoring its contents (the default).
  2446. @item ignore
  2447. Ignore ReplayGain side data, but leave it in the frame.
  2448. @item track
  2449. Prefer the track gain, if present.
  2450. @item album
  2451. Prefer the album gain, if present.
  2452. @end table
  2453. @item replaygain_preamp
  2454. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2455. Default value for @var{replaygain_preamp} is 0.0.
  2456. @item eval
  2457. Set when the volume expression is evaluated.
  2458. It accepts the following values:
  2459. @table @samp
  2460. @item once
  2461. only evaluate expression once during the filter initialization, or
  2462. when the @samp{volume} command is sent
  2463. @item frame
  2464. evaluate expression for each incoming frame
  2465. @end table
  2466. Default value is @samp{once}.
  2467. @end table
  2468. The volume expression can contain the following parameters.
  2469. @table @option
  2470. @item n
  2471. frame number (starting at zero)
  2472. @item nb_channels
  2473. number of channels
  2474. @item nb_consumed_samples
  2475. number of samples consumed by the filter
  2476. @item nb_samples
  2477. number of samples in the current frame
  2478. @item pos
  2479. original frame position in the file
  2480. @item pts
  2481. frame PTS
  2482. @item sample_rate
  2483. sample rate
  2484. @item startpts
  2485. PTS at start of stream
  2486. @item startt
  2487. time at start of stream
  2488. @item t
  2489. frame time
  2490. @item tb
  2491. timestamp timebase
  2492. @item volume
  2493. last set volume value
  2494. @end table
  2495. Note that when @option{eval} is set to @samp{once} only the
  2496. @var{sample_rate} and @var{tb} variables are available, all other
  2497. variables will evaluate to NAN.
  2498. @subsection Commands
  2499. This filter supports the following commands:
  2500. @table @option
  2501. @item volume
  2502. Modify the volume expression.
  2503. The command accepts the same syntax of the corresponding option.
  2504. If the specified expression is not valid, it is kept at its current
  2505. value.
  2506. @item replaygain_noclip
  2507. Prevent clipping by limiting the gain applied.
  2508. Default value for @var{replaygain_noclip} is 1.
  2509. @end table
  2510. @subsection Examples
  2511. @itemize
  2512. @item
  2513. Halve the input audio volume:
  2514. @example
  2515. volume=volume=0.5
  2516. volume=volume=1/2
  2517. volume=volume=-6.0206dB
  2518. @end example
  2519. In all the above example the named key for @option{volume} can be
  2520. omitted, for example like in:
  2521. @example
  2522. volume=0.5
  2523. @end example
  2524. @item
  2525. Increase input audio power by 6 decibels using fixed-point precision:
  2526. @example
  2527. volume=volume=6dB:precision=fixed
  2528. @end example
  2529. @item
  2530. Fade volume after time 10 with an annihilation period of 5 seconds:
  2531. @example
  2532. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2533. @end example
  2534. @end itemize
  2535. @section volumedetect
  2536. Detect the volume of the input video.
  2537. The filter has no parameters. The input is not modified. Statistics about
  2538. the volume will be printed in the log when the input stream end is reached.
  2539. In particular it will show the mean volume (root mean square), maximum
  2540. volume (on a per-sample basis), and the beginning of a histogram of the
  2541. registered volume values (from the maximum value to a cumulated 1/1000 of
  2542. the samples).
  2543. All volumes are in decibels relative to the maximum PCM value.
  2544. @subsection Examples
  2545. Here is an excerpt of the output:
  2546. @example
  2547. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2548. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2549. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2550. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2551. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2552. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2553. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2554. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2555. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2556. @end example
  2557. It means that:
  2558. @itemize
  2559. @item
  2560. The mean square energy is approximately -27 dB, or 10^-2.7.
  2561. @item
  2562. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2563. @item
  2564. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2565. @end itemize
  2566. In other words, raising the volume by +4 dB does not cause any clipping,
  2567. raising it by +5 dB causes clipping for 6 samples, etc.
  2568. @c man end AUDIO FILTERS
  2569. @chapter Audio Sources
  2570. @c man begin AUDIO SOURCES
  2571. Below is a description of the currently available audio sources.
  2572. @section abuffer
  2573. Buffer audio frames, and make them available to the filter chain.
  2574. This source is mainly intended for a programmatic use, in particular
  2575. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2576. It accepts the following parameters:
  2577. @table @option
  2578. @item time_base
  2579. The timebase which will be used for timestamps of submitted frames. It must be
  2580. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2581. @item sample_rate
  2582. The sample rate of the incoming audio buffers.
  2583. @item sample_fmt
  2584. The sample format of the incoming audio buffers.
  2585. Either a sample format name or its corresponding integer representation from
  2586. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2587. @item channel_layout
  2588. The channel layout of the incoming audio buffers.
  2589. Either a channel layout name from channel_layout_map in
  2590. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2591. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2592. @item channels
  2593. The number of channels of the incoming audio buffers.
  2594. If both @var{channels} and @var{channel_layout} are specified, then they
  2595. must be consistent.
  2596. @end table
  2597. @subsection Examples
  2598. @example
  2599. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2600. @end example
  2601. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2602. Since the sample format with name "s16p" corresponds to the number
  2603. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2604. equivalent to:
  2605. @example
  2606. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2607. @end example
  2608. @section aevalsrc
  2609. Generate an audio signal specified by an expression.
  2610. This source accepts in input one or more expressions (one for each
  2611. channel), which are evaluated and used to generate a corresponding
  2612. audio signal.
  2613. This source accepts the following options:
  2614. @table @option
  2615. @item exprs
  2616. Set the '|'-separated expressions list for each separate channel. In case the
  2617. @option{channel_layout} option is not specified, the selected channel layout
  2618. depends on the number of provided expressions. Otherwise the last
  2619. specified expression is applied to the remaining output channels.
  2620. @item channel_layout, c
  2621. Set the channel layout. The number of channels in the specified layout
  2622. must be equal to the number of specified expressions.
  2623. @item duration, d
  2624. Set the minimum duration of the sourced audio. See
  2625. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2626. for the accepted syntax.
  2627. Note that the resulting duration may be greater than the specified
  2628. duration, as the generated audio is always cut at the end of a
  2629. complete frame.
  2630. If not specified, or the expressed duration is negative, the audio is
  2631. supposed to be generated forever.
  2632. @item nb_samples, n
  2633. Set the number of samples per channel per each output frame,
  2634. default to 1024.
  2635. @item sample_rate, s
  2636. Specify the sample rate, default to 44100.
  2637. @end table
  2638. Each expression in @var{exprs} can contain the following constants:
  2639. @table @option
  2640. @item n
  2641. number of the evaluated sample, starting from 0
  2642. @item t
  2643. time of the evaluated sample expressed in seconds, starting from 0
  2644. @item s
  2645. sample rate
  2646. @end table
  2647. @subsection Examples
  2648. @itemize
  2649. @item
  2650. Generate silence:
  2651. @example
  2652. aevalsrc=0
  2653. @end example
  2654. @item
  2655. Generate a sin signal with frequency of 440 Hz, set sample rate to
  2656. 8000 Hz:
  2657. @example
  2658. aevalsrc="sin(440*2*PI*t):s=8000"
  2659. @end example
  2660. @item
  2661. Generate a two channels signal, specify the channel layout (Front
  2662. Center + Back Center) explicitly:
  2663. @example
  2664. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  2665. @end example
  2666. @item
  2667. Generate white noise:
  2668. @example
  2669. aevalsrc="-2+random(0)"
  2670. @end example
  2671. @item
  2672. Generate an amplitude modulated signal:
  2673. @example
  2674. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  2675. @end example
  2676. @item
  2677. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  2678. @example
  2679. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  2680. @end example
  2681. @end itemize
  2682. @section anullsrc
  2683. The null audio source, return unprocessed audio frames. It is mainly useful
  2684. as a template and to be employed in analysis / debugging tools, or as
  2685. the source for filters which ignore the input data (for example the sox
  2686. synth filter).
  2687. This source accepts the following options:
  2688. @table @option
  2689. @item channel_layout, cl
  2690. Specifies the channel layout, and can be either an integer or a string
  2691. representing a channel layout. The default value of @var{channel_layout}
  2692. is "stereo".
  2693. Check the channel_layout_map definition in
  2694. @file{libavutil/channel_layout.c} for the mapping between strings and
  2695. channel layout values.
  2696. @item sample_rate, r
  2697. Specifies the sample rate, and defaults to 44100.
  2698. @item nb_samples, n
  2699. Set the number of samples per requested frames.
  2700. @end table
  2701. @subsection Examples
  2702. @itemize
  2703. @item
  2704. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  2705. @example
  2706. anullsrc=r=48000:cl=4
  2707. @end example
  2708. @item
  2709. Do the same operation with a more obvious syntax:
  2710. @example
  2711. anullsrc=r=48000:cl=mono
  2712. @end example
  2713. @end itemize
  2714. All the parameters need to be explicitly defined.
  2715. @section flite
  2716. Synthesize a voice utterance using the libflite library.
  2717. To enable compilation of this filter you need to configure FFmpeg with
  2718. @code{--enable-libflite}.
  2719. Note that the flite library is not thread-safe.
  2720. The filter accepts the following options:
  2721. @table @option
  2722. @item list_voices
  2723. If set to 1, list the names of the available voices and exit
  2724. immediately. Default value is 0.
  2725. @item nb_samples, n
  2726. Set the maximum number of samples per frame. Default value is 512.
  2727. @item textfile
  2728. Set the filename containing the text to speak.
  2729. @item text
  2730. Set the text to speak.
  2731. @item voice, v
  2732. Set the voice to use for the speech synthesis. Default value is
  2733. @code{kal}. See also the @var{list_voices} option.
  2734. @end table
  2735. @subsection Examples
  2736. @itemize
  2737. @item
  2738. Read from file @file{speech.txt}, and synthesize the text using the
  2739. standard flite voice:
  2740. @example
  2741. flite=textfile=speech.txt
  2742. @end example
  2743. @item
  2744. Read the specified text selecting the @code{slt} voice:
  2745. @example
  2746. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2747. @end example
  2748. @item
  2749. Input text to ffmpeg:
  2750. @example
  2751. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2752. @end example
  2753. @item
  2754. Make @file{ffplay} speak the specified text, using @code{flite} and
  2755. the @code{lavfi} device:
  2756. @example
  2757. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  2758. @end example
  2759. @end itemize
  2760. For more information about libflite, check:
  2761. @url{http://www.speech.cs.cmu.edu/flite/}
  2762. @section anoisesrc
  2763. Generate a noise audio signal.
  2764. The filter accepts the following options:
  2765. @table @option
  2766. @item sample_rate, r
  2767. Specify the sample rate. Default value is 48000 Hz.
  2768. @item amplitude, a
  2769. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  2770. is 1.0.
  2771. @item duration, d
  2772. Specify the duration of the generated audio stream. Not specifying this option
  2773. results in noise with an infinite length.
  2774. @item color, colour, c
  2775. Specify the color of noise. Available noise colors are white, pink, and brown.
  2776. Default color is white.
  2777. @item seed, s
  2778. Specify a value used to seed the PRNG.
  2779. @item nb_samples, n
  2780. Set the number of samples per each output frame, default is 1024.
  2781. @end table
  2782. @subsection Examples
  2783. @itemize
  2784. @item
  2785. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  2786. @example
  2787. anoisesrc=d=60:c=pink:r=44100:a=0.5
  2788. @end example
  2789. @end itemize
  2790. @section sine
  2791. Generate an audio signal made of a sine wave with amplitude 1/8.
  2792. The audio signal is bit-exact.
  2793. The filter accepts the following options:
  2794. @table @option
  2795. @item frequency, f
  2796. Set the carrier frequency. Default is 440 Hz.
  2797. @item beep_factor, b
  2798. Enable a periodic beep every second with frequency @var{beep_factor} times
  2799. the carrier frequency. Default is 0, meaning the beep is disabled.
  2800. @item sample_rate, r
  2801. Specify the sample rate, default is 44100.
  2802. @item duration, d
  2803. Specify the duration of the generated audio stream.
  2804. @item samples_per_frame
  2805. Set the number of samples per output frame.
  2806. The expression can contain the following constants:
  2807. @table @option
  2808. @item n
  2809. The (sequential) number of the output audio frame, starting from 0.
  2810. @item pts
  2811. The PTS (Presentation TimeStamp) of the output audio frame,
  2812. expressed in @var{TB} units.
  2813. @item t
  2814. The PTS of the output audio frame, expressed in seconds.
  2815. @item TB
  2816. The timebase of the output audio frames.
  2817. @end table
  2818. Default is @code{1024}.
  2819. @end table
  2820. @subsection Examples
  2821. @itemize
  2822. @item
  2823. Generate a simple 440 Hz sine wave:
  2824. @example
  2825. sine
  2826. @end example
  2827. @item
  2828. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  2829. @example
  2830. sine=220:4:d=5
  2831. sine=f=220:b=4:d=5
  2832. sine=frequency=220:beep_factor=4:duration=5
  2833. @end example
  2834. @item
  2835. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  2836. pattern:
  2837. @example
  2838. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  2839. @end example
  2840. @end itemize
  2841. @c man end AUDIO SOURCES
  2842. @chapter Audio Sinks
  2843. @c man begin AUDIO SINKS
  2844. Below is a description of the currently available audio sinks.
  2845. @section abuffersink
  2846. Buffer audio frames, and make them available to the end of filter chain.
  2847. This sink is mainly intended for programmatic use, in particular
  2848. through the interface defined in @file{libavfilter/buffersink.h}
  2849. or the options system.
  2850. It accepts a pointer to an AVABufferSinkContext structure, which
  2851. defines the incoming buffers' formats, to be passed as the opaque
  2852. parameter to @code{avfilter_init_filter} for initialization.
  2853. @section anullsink
  2854. Null audio sink; do absolutely nothing with the input audio. It is
  2855. mainly useful as a template and for use in analysis / debugging
  2856. tools.
  2857. @c man end AUDIO SINKS
  2858. @chapter Video Filters
  2859. @c man begin VIDEO FILTERS
  2860. When you configure your FFmpeg build, you can disable any of the
  2861. existing filters using @code{--disable-filters}.
  2862. The configure output will show the video filters included in your
  2863. build.
  2864. Below is a description of the currently available video filters.
  2865. @section alphaextract
  2866. Extract the alpha component from the input as a grayscale video. This
  2867. is especially useful with the @var{alphamerge} filter.
  2868. @section alphamerge
  2869. Add or replace the alpha component of the primary input with the
  2870. grayscale value of a second input. This is intended for use with
  2871. @var{alphaextract} to allow the transmission or storage of frame
  2872. sequences that have alpha in a format that doesn't support an alpha
  2873. channel.
  2874. For example, to reconstruct full frames from a normal YUV-encoded video
  2875. and a separate video created with @var{alphaextract}, you might use:
  2876. @example
  2877. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  2878. @end example
  2879. Since this filter is designed for reconstruction, it operates on frame
  2880. sequences without considering timestamps, and terminates when either
  2881. input reaches end of stream. This will cause problems if your encoding
  2882. pipeline drops frames. If you're trying to apply an image as an
  2883. overlay to a video stream, consider the @var{overlay} filter instead.
  2884. @section ass
  2885. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  2886. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  2887. Substation Alpha) subtitles files.
  2888. This filter accepts the following option in addition to the common options from
  2889. the @ref{subtitles} filter:
  2890. @table @option
  2891. @item shaping
  2892. Set the shaping engine
  2893. Available values are:
  2894. @table @samp
  2895. @item auto
  2896. The default libass shaping engine, which is the best available.
  2897. @item simple
  2898. Fast, font-agnostic shaper that can do only substitutions
  2899. @item complex
  2900. Slower shaper using OpenType for substitutions and positioning
  2901. @end table
  2902. The default is @code{auto}.
  2903. @end table
  2904. @section atadenoise
  2905. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  2906. The filter accepts the following options:
  2907. @table @option
  2908. @item 0a
  2909. Set threshold A for 1st plane. Default is 0.02.
  2910. Valid range is 0 to 0.3.
  2911. @item 0b
  2912. Set threshold B for 1st plane. Default is 0.04.
  2913. Valid range is 0 to 5.
  2914. @item 1a
  2915. Set threshold A for 2nd plane. Default is 0.02.
  2916. Valid range is 0 to 0.3.
  2917. @item 1b
  2918. Set threshold B for 2nd plane. Default is 0.04.
  2919. Valid range is 0 to 5.
  2920. @item 2a
  2921. Set threshold A for 3rd plane. Default is 0.02.
  2922. Valid range is 0 to 0.3.
  2923. @item 2b
  2924. Set threshold B for 3rd plane. Default is 0.04.
  2925. Valid range is 0 to 5.
  2926. Threshold A is designed to react on abrupt changes in the input signal and
  2927. threshold B is designed to react on continuous changes in the input signal.
  2928. @item s
  2929. Set number of frames filter will use for averaging. Default is 33. Must be odd
  2930. number in range [5, 129].
  2931. @end table
  2932. @section bbox
  2933. Compute the bounding box for the non-black pixels in the input frame
  2934. luminance plane.
  2935. This filter computes the bounding box containing all the pixels with a
  2936. luminance value greater than the minimum allowed value.
  2937. The parameters describing the bounding box are printed on the filter
  2938. log.
  2939. The filter accepts the following option:
  2940. @table @option
  2941. @item min_val
  2942. Set the minimal luminance value. Default is @code{16}.
  2943. @end table
  2944. @section blackdetect
  2945. Detect video intervals that are (almost) completely black. Can be
  2946. useful to detect chapter transitions, commercials, or invalid
  2947. recordings. Output lines contains the time for the start, end and
  2948. duration of the detected black interval expressed in seconds.
  2949. In order to display the output lines, you need to set the loglevel at
  2950. least to the AV_LOG_INFO value.
  2951. The filter accepts the following options:
  2952. @table @option
  2953. @item black_min_duration, d
  2954. Set the minimum detected black duration expressed in seconds. It must
  2955. be a non-negative floating point number.
  2956. Default value is 2.0.
  2957. @item picture_black_ratio_th, pic_th
  2958. Set the threshold for considering a picture "black".
  2959. Express the minimum value for the ratio:
  2960. @example
  2961. @var{nb_black_pixels} / @var{nb_pixels}
  2962. @end example
  2963. for which a picture is considered black.
  2964. Default value is 0.98.
  2965. @item pixel_black_th, pix_th
  2966. Set the threshold for considering a pixel "black".
  2967. The threshold expresses the maximum pixel luminance value for which a
  2968. pixel is considered "black". The provided value is scaled according to
  2969. the following equation:
  2970. @example
  2971. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  2972. @end example
  2973. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  2974. the input video format, the range is [0-255] for YUV full-range
  2975. formats and [16-235] for YUV non full-range formats.
  2976. Default value is 0.10.
  2977. @end table
  2978. The following example sets the maximum pixel threshold to the minimum
  2979. value, and detects only black intervals of 2 or more seconds:
  2980. @example
  2981. blackdetect=d=2:pix_th=0.00
  2982. @end example
  2983. @section blackframe
  2984. Detect frames that are (almost) completely black. Can be useful to
  2985. detect chapter transitions or commercials. Output lines consist of
  2986. the frame number of the detected frame, the percentage of blackness,
  2987. the position in the file if known or -1 and the timestamp in seconds.
  2988. In order to display the output lines, you need to set the loglevel at
  2989. least to the AV_LOG_INFO value.
  2990. It accepts the following parameters:
  2991. @table @option
  2992. @item amount
  2993. The percentage of the pixels that have to be below the threshold; it defaults to
  2994. @code{98}.
  2995. @item threshold, thresh
  2996. The threshold below which a pixel value is considered black; it defaults to
  2997. @code{32}.
  2998. @end table
  2999. @section blend, tblend
  3000. Blend two video frames into each other.
  3001. The @code{blend} filter takes two input streams and outputs one
  3002. stream, the first input is the "top" layer and second input is
  3003. "bottom" layer. Output terminates when shortest input terminates.
  3004. The @code{tblend} (time blend) filter takes two consecutive frames
  3005. from one single stream, and outputs the result obtained by blending
  3006. the new frame on top of the old frame.
  3007. A description of the accepted options follows.
  3008. @table @option
  3009. @item c0_mode
  3010. @item c1_mode
  3011. @item c2_mode
  3012. @item c3_mode
  3013. @item all_mode
  3014. Set blend mode for specific pixel component or all pixel components in case
  3015. of @var{all_mode}. Default value is @code{normal}.
  3016. Available values for component modes are:
  3017. @table @samp
  3018. @item addition
  3019. @item addition128
  3020. @item and
  3021. @item average
  3022. @item burn
  3023. @item darken
  3024. @item difference
  3025. @item difference128
  3026. @item divide
  3027. @item dodge
  3028. @item exclusion
  3029. @item glow
  3030. @item hardlight
  3031. @item hardmix
  3032. @item lighten
  3033. @item linearlight
  3034. @item multiply
  3035. @item negation
  3036. @item normal
  3037. @item or
  3038. @item overlay
  3039. @item phoenix
  3040. @item pinlight
  3041. @item reflect
  3042. @item screen
  3043. @item softlight
  3044. @item subtract
  3045. @item vividlight
  3046. @item xor
  3047. @end table
  3048. @item c0_opacity
  3049. @item c1_opacity
  3050. @item c2_opacity
  3051. @item c3_opacity
  3052. @item all_opacity
  3053. Set blend opacity for specific pixel component or all pixel components in case
  3054. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3055. @item c0_expr
  3056. @item c1_expr
  3057. @item c2_expr
  3058. @item c3_expr
  3059. @item all_expr
  3060. Set blend expression for specific pixel component or all pixel components in case
  3061. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3062. The expressions can use the following variables:
  3063. @table @option
  3064. @item N
  3065. The sequential number of the filtered frame, starting from @code{0}.
  3066. @item X
  3067. @item Y
  3068. the coordinates of the current sample
  3069. @item W
  3070. @item H
  3071. the width and height of currently filtered plane
  3072. @item SW
  3073. @item SH
  3074. Width and height scale depending on the currently filtered plane. It is the
  3075. ratio between the corresponding luma plane number of pixels and the current
  3076. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3077. @code{0.5,0.5} for chroma planes.
  3078. @item T
  3079. Time of the current frame, expressed in seconds.
  3080. @item TOP, A
  3081. Value of pixel component at current location for first video frame (top layer).
  3082. @item BOTTOM, B
  3083. Value of pixel component at current location for second video frame (bottom layer).
  3084. @end table
  3085. @item shortest
  3086. Force termination when the shortest input terminates. Default is
  3087. @code{0}. This option is only defined for the @code{blend} filter.
  3088. @item repeatlast
  3089. Continue applying the last bottom frame after the end of the stream. A value of
  3090. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3091. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3092. @end table
  3093. @subsection Examples
  3094. @itemize
  3095. @item
  3096. Apply transition from bottom layer to top layer in first 10 seconds:
  3097. @example
  3098. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3099. @end example
  3100. @item
  3101. Apply 1x1 checkerboard effect:
  3102. @example
  3103. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3104. @end example
  3105. @item
  3106. Apply uncover left effect:
  3107. @example
  3108. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3109. @end example
  3110. @item
  3111. Apply uncover down effect:
  3112. @example
  3113. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3114. @end example
  3115. @item
  3116. Apply uncover up-left effect:
  3117. @example
  3118. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3119. @end example
  3120. @item
  3121. Display differences between the current and the previous frame:
  3122. @example
  3123. tblend=all_mode=difference128
  3124. @end example
  3125. @end itemize
  3126. @section boxblur
  3127. Apply a boxblur algorithm to the input video.
  3128. It accepts the following parameters:
  3129. @table @option
  3130. @item luma_radius, lr
  3131. @item luma_power, lp
  3132. @item chroma_radius, cr
  3133. @item chroma_power, cp
  3134. @item alpha_radius, ar
  3135. @item alpha_power, ap
  3136. @end table
  3137. A description of the accepted options follows.
  3138. @table @option
  3139. @item luma_radius, lr
  3140. @item chroma_radius, cr
  3141. @item alpha_radius, ar
  3142. Set an expression for the box radius in pixels used for blurring the
  3143. corresponding input plane.
  3144. The radius value must be a non-negative number, and must not be
  3145. greater than the value of the expression @code{min(w,h)/2} for the
  3146. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3147. planes.
  3148. Default value for @option{luma_radius} is "2". If not specified,
  3149. @option{chroma_radius} and @option{alpha_radius} default to the
  3150. corresponding value set for @option{luma_radius}.
  3151. The expressions can contain the following constants:
  3152. @table @option
  3153. @item w
  3154. @item h
  3155. The input width and height in pixels.
  3156. @item cw
  3157. @item ch
  3158. The input chroma image width and height in pixels.
  3159. @item hsub
  3160. @item vsub
  3161. The horizontal and vertical chroma subsample values. For example, for the
  3162. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3163. @end table
  3164. @item luma_power, lp
  3165. @item chroma_power, cp
  3166. @item alpha_power, ap
  3167. Specify how many times the boxblur filter is applied to the
  3168. corresponding plane.
  3169. Default value for @option{luma_power} is 2. If not specified,
  3170. @option{chroma_power} and @option{alpha_power} default to the
  3171. corresponding value set for @option{luma_power}.
  3172. A value of 0 will disable the effect.
  3173. @end table
  3174. @subsection Examples
  3175. @itemize
  3176. @item
  3177. Apply a boxblur filter with the luma, chroma, and alpha radii
  3178. set to 2:
  3179. @example
  3180. boxblur=luma_radius=2:luma_power=1
  3181. boxblur=2:1
  3182. @end example
  3183. @item
  3184. Set the luma radius to 2, and alpha and chroma radius to 0:
  3185. @example
  3186. boxblur=2:1:cr=0:ar=0
  3187. @end example
  3188. @item
  3189. Set the luma and chroma radii to a fraction of the video dimension:
  3190. @example
  3191. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3192. @end example
  3193. @end itemize
  3194. @section chromakey
  3195. YUV colorspace color/chroma keying.
  3196. The filter accepts the following options:
  3197. @table @option
  3198. @item color
  3199. The color which will be replaced with transparency.
  3200. @item similarity
  3201. Similarity percentage with the key color.
  3202. 0.01 matches only the exact key color, while 1.0 matches everything.
  3203. @item blend
  3204. Blend percentage.
  3205. 0.0 makes pixels either fully transparent, or not transparent at all.
  3206. Higher values result in semi-transparent pixels, with a higher transparency
  3207. the more similar the pixels color is to the key color.
  3208. @item yuv
  3209. Signals that the color passed is already in YUV instead of RGB.
  3210. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3211. This can be used to pass exact YUV values as hexadecimal numbers.
  3212. @end table
  3213. @subsection Examples
  3214. @itemize
  3215. @item
  3216. Make every green pixel in the input image transparent:
  3217. @example
  3218. ffmpeg -i input.png -vf chromakey=green out.png
  3219. @end example
  3220. @item
  3221. Overlay a greenscreen-video on top of a static black background.
  3222. @example
  3223. 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
  3224. @end example
  3225. @end itemize
  3226. @section codecview
  3227. Visualize information exported by some codecs.
  3228. Some codecs can export information through frames using side-data or other
  3229. means. For example, some MPEG based codecs export motion vectors through the
  3230. @var{export_mvs} flag in the codec @option{flags2} option.
  3231. The filter accepts the following option:
  3232. @table @option
  3233. @item mv
  3234. Set motion vectors to visualize.
  3235. Available flags for @var{mv} are:
  3236. @table @samp
  3237. @item pf
  3238. forward predicted MVs of P-frames
  3239. @item bf
  3240. forward predicted MVs of B-frames
  3241. @item bb
  3242. backward predicted MVs of B-frames
  3243. @end table
  3244. @item qp
  3245. Display quantization parameters using the chroma planes
  3246. @end table
  3247. @subsection Examples
  3248. @itemize
  3249. @item
  3250. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  3251. @example
  3252. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  3253. @end example
  3254. @end itemize
  3255. @section colorbalance
  3256. Modify intensity of primary colors (red, green and blue) of input frames.
  3257. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3258. regions for the red-cyan, green-magenta or blue-yellow balance.
  3259. A positive adjustment value shifts the balance towards the primary color, a negative
  3260. value towards the complementary color.
  3261. The filter accepts the following options:
  3262. @table @option
  3263. @item rs
  3264. @item gs
  3265. @item bs
  3266. Adjust red, green and blue shadows (darkest pixels).
  3267. @item rm
  3268. @item gm
  3269. @item bm
  3270. Adjust red, green and blue midtones (medium pixels).
  3271. @item rh
  3272. @item gh
  3273. @item bh
  3274. Adjust red, green and blue highlights (brightest pixels).
  3275. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3276. @end table
  3277. @subsection Examples
  3278. @itemize
  3279. @item
  3280. Add red color cast to shadows:
  3281. @example
  3282. colorbalance=rs=.3
  3283. @end example
  3284. @end itemize
  3285. @section colorkey
  3286. RGB colorspace color keying.
  3287. The filter accepts the following options:
  3288. @table @option
  3289. @item color
  3290. The color which will be replaced with transparency.
  3291. @item similarity
  3292. Similarity percentage with the key color.
  3293. 0.01 matches only the exact key color, while 1.0 matches everything.
  3294. @item blend
  3295. Blend percentage.
  3296. 0.0 makes pixels either fully transparent, or not transparent at all.
  3297. Higher values result in semi-transparent pixels, with a higher transparency
  3298. the more similar the pixels color is to the key color.
  3299. @end table
  3300. @subsection Examples
  3301. @itemize
  3302. @item
  3303. Make every green pixel in the input image transparent:
  3304. @example
  3305. ffmpeg -i input.png -vf colorkey=green out.png
  3306. @end example
  3307. @item
  3308. Overlay a greenscreen-video on top of a static background image.
  3309. @example
  3310. 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
  3311. @end example
  3312. @end itemize
  3313. @section colorlevels
  3314. Adjust video input frames using levels.
  3315. The filter accepts the following options:
  3316. @table @option
  3317. @item rimin
  3318. @item gimin
  3319. @item bimin
  3320. @item aimin
  3321. Adjust red, green, blue and alpha input black point.
  3322. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3323. @item rimax
  3324. @item gimax
  3325. @item bimax
  3326. @item aimax
  3327. Adjust red, green, blue and alpha input white point.
  3328. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3329. Input levels are used to lighten highlights (bright tones), darken shadows
  3330. (dark tones), change the balance of bright and dark tones.
  3331. @item romin
  3332. @item gomin
  3333. @item bomin
  3334. @item aomin
  3335. Adjust red, green, blue and alpha output black point.
  3336. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3337. @item romax
  3338. @item gomax
  3339. @item bomax
  3340. @item aomax
  3341. Adjust red, green, blue and alpha output white point.
  3342. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3343. Output levels allows manual selection of a constrained output level range.
  3344. @end table
  3345. @subsection Examples
  3346. @itemize
  3347. @item
  3348. Make video output darker:
  3349. @example
  3350. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3351. @end example
  3352. @item
  3353. Increase contrast:
  3354. @example
  3355. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3356. @end example
  3357. @item
  3358. Make video output lighter:
  3359. @example
  3360. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3361. @end example
  3362. @item
  3363. Increase brightness:
  3364. @example
  3365. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3366. @end example
  3367. @end itemize
  3368. @section colorchannelmixer
  3369. Adjust video input frames by re-mixing color channels.
  3370. This filter modifies a color channel by adding the values associated to
  3371. the other channels of the same pixels. For example if the value to
  3372. modify is red, the output value will be:
  3373. @example
  3374. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3375. @end example
  3376. The filter accepts the following options:
  3377. @table @option
  3378. @item rr
  3379. @item rg
  3380. @item rb
  3381. @item ra
  3382. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3383. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3384. @item gr
  3385. @item gg
  3386. @item gb
  3387. @item ga
  3388. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3389. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3390. @item br
  3391. @item bg
  3392. @item bb
  3393. @item ba
  3394. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3395. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3396. @item ar
  3397. @item ag
  3398. @item ab
  3399. @item aa
  3400. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3401. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3402. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3403. @end table
  3404. @subsection Examples
  3405. @itemize
  3406. @item
  3407. Convert source to grayscale:
  3408. @example
  3409. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3410. @end example
  3411. @item
  3412. Simulate sepia tones:
  3413. @example
  3414. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3415. @end example
  3416. @end itemize
  3417. @section colormatrix
  3418. Convert color matrix.
  3419. The filter accepts the following options:
  3420. @table @option
  3421. @item src
  3422. @item dst
  3423. Specify the source and destination color matrix. Both values must be
  3424. specified.
  3425. The accepted values are:
  3426. @table @samp
  3427. @item bt709
  3428. BT.709
  3429. @item bt601
  3430. BT.601
  3431. @item smpte240m
  3432. SMPTE-240M
  3433. @item fcc
  3434. FCC
  3435. @end table
  3436. @end table
  3437. For example to convert from BT.601 to SMPTE-240M, use the command:
  3438. @example
  3439. colormatrix=bt601:smpte240m
  3440. @end example
  3441. @section copy
  3442. Copy the input source unchanged to the output. This is mainly useful for
  3443. testing purposes.
  3444. @section crop
  3445. Crop the input video to given dimensions.
  3446. It accepts the following parameters:
  3447. @table @option
  3448. @item w, out_w
  3449. The width of the output video. It defaults to @code{iw}.
  3450. This expression is evaluated only once during the filter
  3451. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  3452. @item h, out_h
  3453. The height of the output video. It defaults to @code{ih}.
  3454. This expression is evaluated only once during the filter
  3455. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  3456. @item x
  3457. The horizontal position, in the input video, of the left edge of the output
  3458. video. It defaults to @code{(in_w-out_w)/2}.
  3459. This expression is evaluated per-frame.
  3460. @item y
  3461. The vertical position, in the input video, of the top edge of the output video.
  3462. It defaults to @code{(in_h-out_h)/2}.
  3463. This expression is evaluated per-frame.
  3464. @item keep_aspect
  3465. If set to 1 will force the output display aspect ratio
  3466. to be the same of the input, by changing the output sample aspect
  3467. ratio. It defaults to 0.
  3468. @end table
  3469. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  3470. expressions containing the following constants:
  3471. @table @option
  3472. @item x
  3473. @item y
  3474. The computed values for @var{x} and @var{y}. They are evaluated for
  3475. each new frame.
  3476. @item in_w
  3477. @item in_h
  3478. The input width and height.
  3479. @item iw
  3480. @item ih
  3481. These are the same as @var{in_w} and @var{in_h}.
  3482. @item out_w
  3483. @item out_h
  3484. The output (cropped) width and height.
  3485. @item ow
  3486. @item oh
  3487. These are the same as @var{out_w} and @var{out_h}.
  3488. @item a
  3489. same as @var{iw} / @var{ih}
  3490. @item sar
  3491. input sample aspect ratio
  3492. @item dar
  3493. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  3494. @item hsub
  3495. @item vsub
  3496. horizontal and vertical chroma subsample values. For example for the
  3497. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3498. @item n
  3499. The number of the input frame, starting from 0.
  3500. @item pos
  3501. the position in the file of the input frame, NAN if unknown
  3502. @item t
  3503. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  3504. @end table
  3505. The expression for @var{out_w} may depend on the value of @var{out_h},
  3506. and the expression for @var{out_h} may depend on @var{out_w}, but they
  3507. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  3508. evaluated after @var{out_w} and @var{out_h}.
  3509. The @var{x} and @var{y} parameters specify the expressions for the
  3510. position of the top-left corner of the output (non-cropped) area. They
  3511. are evaluated for each frame. If the evaluated value is not valid, it
  3512. is approximated to the nearest valid value.
  3513. The expression for @var{x} may depend on @var{y}, and the expression
  3514. for @var{y} may depend on @var{x}.
  3515. @subsection Examples
  3516. @itemize
  3517. @item
  3518. Crop area with size 100x100 at position (12,34).
  3519. @example
  3520. crop=100:100:12:34
  3521. @end example
  3522. Using named options, the example above becomes:
  3523. @example
  3524. crop=w=100:h=100:x=12:y=34
  3525. @end example
  3526. @item
  3527. Crop the central input area with size 100x100:
  3528. @example
  3529. crop=100:100
  3530. @end example
  3531. @item
  3532. Crop the central input area with size 2/3 of the input video:
  3533. @example
  3534. crop=2/3*in_w:2/3*in_h
  3535. @end example
  3536. @item
  3537. Crop the input video central square:
  3538. @example
  3539. crop=out_w=in_h
  3540. crop=in_h
  3541. @end example
  3542. @item
  3543. Delimit the rectangle with the top-left corner placed at position
  3544. 100:100 and the right-bottom corner corresponding to the right-bottom
  3545. corner of the input image.
  3546. @example
  3547. crop=in_w-100:in_h-100:100:100
  3548. @end example
  3549. @item
  3550. Crop 10 pixels from the left and right borders, and 20 pixels from
  3551. the top and bottom borders
  3552. @example
  3553. crop=in_w-2*10:in_h-2*20
  3554. @end example
  3555. @item
  3556. Keep only the bottom right quarter of the input image:
  3557. @example
  3558. crop=in_w/2:in_h/2:in_w/2:in_h/2
  3559. @end example
  3560. @item
  3561. Crop height for getting Greek harmony:
  3562. @example
  3563. crop=in_w:1/PHI*in_w
  3564. @end example
  3565. @item
  3566. Apply trembling effect:
  3567. @example
  3568. 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)
  3569. @end example
  3570. @item
  3571. Apply erratic camera effect depending on timestamp:
  3572. @example
  3573. 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)"
  3574. @end example
  3575. @item
  3576. Set x depending on the value of y:
  3577. @example
  3578. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  3579. @end example
  3580. @end itemize
  3581. @subsection Commands
  3582. This filter supports the following commands:
  3583. @table @option
  3584. @item w, out_w
  3585. @item h, out_h
  3586. @item x
  3587. @item y
  3588. Set width/height of the output video and the horizontal/vertical position
  3589. in the input video.
  3590. The command accepts the same syntax of the corresponding option.
  3591. If the specified expression is not valid, it is kept at its current
  3592. value.
  3593. @end table
  3594. @section cropdetect
  3595. Auto-detect the crop size.
  3596. It calculates the necessary cropping parameters and prints the
  3597. recommended parameters via the logging system. The detected dimensions
  3598. correspond to the non-black area of the input video.
  3599. It accepts the following parameters:
  3600. @table @option
  3601. @item limit
  3602. Set higher black value threshold, which can be optionally specified
  3603. from nothing (0) to everything (255 for 8bit based formats). An intensity
  3604. value greater to the set value is considered non-black. It defaults to 24.
  3605. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  3606. on the bitdepth of the pixel format.
  3607. @item round
  3608. The value which the width/height should be divisible by. It defaults to
  3609. 16. The offset is automatically adjusted to center the video. Use 2 to
  3610. get only even dimensions (needed for 4:2:2 video). 16 is best when
  3611. encoding to most video codecs.
  3612. @item reset_count, reset
  3613. Set the counter that determines after how many frames cropdetect will
  3614. reset the previously detected largest video area and start over to
  3615. detect the current optimal crop area. Default value is 0.
  3616. This can be useful when channel logos distort the video area. 0
  3617. indicates 'never reset', and returns the largest area encountered during
  3618. playback.
  3619. @end table
  3620. @anchor{curves}
  3621. @section curves
  3622. Apply color adjustments using curves.
  3623. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  3624. component (red, green and blue) has its values defined by @var{N} key points
  3625. tied from each other using a smooth curve. The x-axis represents the pixel
  3626. values from the input frame, and the y-axis the new pixel values to be set for
  3627. the output frame.
  3628. By default, a component curve is defined by the two points @var{(0;0)} and
  3629. @var{(1;1)}. This creates a straight line where each original pixel value is
  3630. "adjusted" to its own value, which means no change to the image.
  3631. The filter allows you to redefine these two points and add some more. A new
  3632. curve (using a natural cubic spline interpolation) will be define to pass
  3633. smoothly through all these new coordinates. The new defined points needs to be
  3634. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  3635. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  3636. the vector spaces, the values will be clipped accordingly.
  3637. If there is no key point defined in @code{x=0}, the filter will automatically
  3638. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  3639. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  3640. The filter accepts the following options:
  3641. @table @option
  3642. @item preset
  3643. Select one of the available color presets. This option can be used in addition
  3644. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  3645. options takes priority on the preset values.
  3646. Available presets are:
  3647. @table @samp
  3648. @item none
  3649. @item color_negative
  3650. @item cross_process
  3651. @item darker
  3652. @item increase_contrast
  3653. @item lighter
  3654. @item linear_contrast
  3655. @item medium_contrast
  3656. @item negative
  3657. @item strong_contrast
  3658. @item vintage
  3659. @end table
  3660. Default is @code{none}.
  3661. @item master, m
  3662. Set the master key points. These points will define a second pass mapping. It
  3663. is sometimes called a "luminance" or "value" mapping. It can be used with
  3664. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  3665. post-processing LUT.
  3666. @item red, r
  3667. Set the key points for the red component.
  3668. @item green, g
  3669. Set the key points for the green component.
  3670. @item blue, b
  3671. Set the key points for the blue component.
  3672. @item all
  3673. Set the key points for all components (not including master).
  3674. Can be used in addition to the other key points component
  3675. options. In this case, the unset component(s) will fallback on this
  3676. @option{all} setting.
  3677. @item psfile
  3678. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  3679. @end table
  3680. To avoid some filtergraph syntax conflicts, each key points list need to be
  3681. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  3682. @subsection Examples
  3683. @itemize
  3684. @item
  3685. Increase slightly the middle level of blue:
  3686. @example
  3687. curves=blue='0.5/0.58'
  3688. @end example
  3689. @item
  3690. Vintage effect:
  3691. @example
  3692. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  3693. @end example
  3694. Here we obtain the following coordinates for each components:
  3695. @table @var
  3696. @item red
  3697. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  3698. @item green
  3699. @code{(0;0) (0.50;0.48) (1;1)}
  3700. @item blue
  3701. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  3702. @end table
  3703. @item
  3704. The previous example can also be achieved with the associated built-in preset:
  3705. @example
  3706. curves=preset=vintage
  3707. @end example
  3708. @item
  3709. Or simply:
  3710. @example
  3711. curves=vintage
  3712. @end example
  3713. @item
  3714. Use a Photoshop preset and redefine the points of the green component:
  3715. @example
  3716. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  3717. @end example
  3718. @end itemize
  3719. @section dctdnoiz
  3720. Denoise frames using 2D DCT (frequency domain filtering).
  3721. This filter is not designed for real time.
  3722. The filter accepts the following options:
  3723. @table @option
  3724. @item sigma, s
  3725. Set the noise sigma constant.
  3726. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  3727. coefficient (absolute value) below this threshold with be dropped.
  3728. If you need a more advanced filtering, see @option{expr}.
  3729. Default is @code{0}.
  3730. @item overlap
  3731. Set number overlapping pixels for each block. Since the filter can be slow, you
  3732. may want to reduce this value, at the cost of a less effective filter and the
  3733. risk of various artefacts.
  3734. If the overlapping value doesn't permit processing the whole input width or
  3735. height, a warning will be displayed and according borders won't be denoised.
  3736. Default value is @var{blocksize}-1, which is the best possible setting.
  3737. @item expr, e
  3738. Set the coefficient factor expression.
  3739. For each coefficient of a DCT block, this expression will be evaluated as a
  3740. multiplier value for the coefficient.
  3741. If this is option is set, the @option{sigma} option will be ignored.
  3742. The absolute value of the coefficient can be accessed through the @var{c}
  3743. variable.
  3744. @item n
  3745. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  3746. @var{blocksize}, which is the width and height of the processed blocks.
  3747. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  3748. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  3749. on the speed processing. Also, a larger block size does not necessarily means a
  3750. better de-noising.
  3751. @end table
  3752. @subsection Examples
  3753. Apply a denoise with a @option{sigma} of @code{4.5}:
  3754. @example
  3755. dctdnoiz=4.5
  3756. @end example
  3757. The same operation can be achieved using the expression system:
  3758. @example
  3759. dctdnoiz=e='gte(c, 4.5*3)'
  3760. @end example
  3761. Violent denoise using a block size of @code{16x16}:
  3762. @example
  3763. dctdnoiz=15:n=4
  3764. @end example
  3765. @section deband
  3766. Remove banding artifacts from input video.
  3767. It works by replacing banded pixels with average value of referenced pixels.
  3768. The filter accepts the following options:
  3769. @table @option
  3770. @item 1thr
  3771. @item 2thr
  3772. @item 3thr
  3773. @item 4thr
  3774. Set banding detection threshold for each plane. Default is 0.02.
  3775. Valid range is 0.00003 to 0.5.
  3776. If difference between current pixel and reference pixel is less than threshold,
  3777. it will be considered as banded.
  3778. @item range, r
  3779. Banding detection range in pixels. Default is 16. If positive, random number
  3780. in range 0 to set value will be used. If negative, exact absolute value
  3781. will be used.
  3782. The range defines square of four pixels around current pixel.
  3783. @item direction, d
  3784. Set direction in radians from which four pixel will be compared. If positive,
  3785. random direction from 0 to set direction will be picked. If negative, exact of
  3786. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  3787. will pick only pixels on same row and -PI/2 will pick only pixels on same
  3788. column.
  3789. @item blur
  3790. If enabled, current pixel is compared with average value of all four
  3791. surrounding pixels. The default is enabled. If disabled current pixel is
  3792. compared with all four surrounding pixels. The pixel is considered banded
  3793. if only all four differences with surrounding pixels are less than threshold.
  3794. @end table
  3795. @anchor{decimate}
  3796. @section decimate
  3797. Drop duplicated frames at regular intervals.
  3798. The filter accepts the following options:
  3799. @table @option
  3800. @item cycle
  3801. Set the number of frames from which one will be dropped. Setting this to
  3802. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  3803. Default is @code{5}.
  3804. @item dupthresh
  3805. Set the threshold for duplicate detection. If the difference metric for a frame
  3806. is less than or equal to this value, then it is declared as duplicate. Default
  3807. is @code{1.1}
  3808. @item scthresh
  3809. Set scene change threshold. Default is @code{15}.
  3810. @item blockx
  3811. @item blocky
  3812. Set the size of the x and y-axis blocks used during metric calculations.
  3813. Larger blocks give better noise suppression, but also give worse detection of
  3814. small movements. Must be a power of two. Default is @code{32}.
  3815. @item ppsrc
  3816. Mark main input as a pre-processed input and activate clean source input
  3817. stream. This allows the input to be pre-processed with various filters to help
  3818. the metrics calculation while keeping the frame selection lossless. When set to
  3819. @code{1}, the first stream is for the pre-processed input, and the second
  3820. stream is the clean source from where the kept frames are chosen. Default is
  3821. @code{0}.
  3822. @item chroma
  3823. Set whether or not chroma is considered in the metric calculations. Default is
  3824. @code{1}.
  3825. @end table
  3826. @section deflate
  3827. Apply deflate effect to the video.
  3828. This filter replaces the pixel by the local(3x3) average by taking into account
  3829. only values lower than the pixel.
  3830. It accepts the following options:
  3831. @table @option
  3832. @item threshold0
  3833. @item threshold1
  3834. @item threshold2
  3835. @item threshold3
  3836. Limit the maximum change for each plane, default is 65535.
  3837. If 0, plane will remain unchanged.
  3838. @end table
  3839. @section dejudder
  3840. Remove judder produced by partially interlaced telecined content.
  3841. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  3842. source was partially telecined content then the output of @code{pullup,dejudder}
  3843. will have a variable frame rate. May change the recorded frame rate of the
  3844. container. Aside from that change, this filter will not affect constant frame
  3845. rate video.
  3846. The option available in this filter is:
  3847. @table @option
  3848. @item cycle
  3849. Specify the length of the window over which the judder repeats.
  3850. Accepts any integer greater than 1. Useful values are:
  3851. @table @samp
  3852. @item 4
  3853. If the original was telecined from 24 to 30 fps (Film to NTSC).
  3854. @item 5
  3855. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  3856. @item 20
  3857. If a mixture of the two.
  3858. @end table
  3859. The default is @samp{4}.
  3860. @end table
  3861. @section delogo
  3862. Suppress a TV station logo by a simple interpolation of the surrounding
  3863. pixels. Just set a rectangle covering the logo and watch it disappear
  3864. (and sometimes something even uglier appear - your mileage may vary).
  3865. It accepts the following parameters:
  3866. @table @option
  3867. @item x
  3868. @item y
  3869. Specify the top left corner coordinates of the logo. They must be
  3870. specified.
  3871. @item w
  3872. @item h
  3873. Specify the width and height of the logo to clear. They must be
  3874. specified.
  3875. @item band, t
  3876. Specify the thickness of the fuzzy edge of the rectangle (added to
  3877. @var{w} and @var{h}). The default value is 1. This option is
  3878. deprecated, setting higher values should no longer be necessary and
  3879. is not recommended.
  3880. @item show
  3881. When set to 1, a green rectangle is drawn on the screen to simplify
  3882. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  3883. The default value is 0.
  3884. The rectangle is drawn on the outermost pixels which will be (partly)
  3885. replaced with interpolated values. The values of the next pixels
  3886. immediately outside this rectangle in each direction will be used to
  3887. compute the interpolated pixel values inside the rectangle.
  3888. @end table
  3889. @subsection Examples
  3890. @itemize
  3891. @item
  3892. Set a rectangle covering the area with top left corner coordinates 0,0
  3893. and size 100x77, and a band of size 10:
  3894. @example
  3895. delogo=x=0:y=0:w=100:h=77:band=10
  3896. @end example
  3897. @end itemize
  3898. @section deshake
  3899. Attempt to fix small changes in horizontal and/or vertical shift. This
  3900. filter helps remove camera shake from hand-holding a camera, bumping a
  3901. tripod, moving on a vehicle, etc.
  3902. The filter accepts the following options:
  3903. @table @option
  3904. @item x
  3905. @item y
  3906. @item w
  3907. @item h
  3908. Specify a rectangular area where to limit the search for motion
  3909. vectors.
  3910. If desired the search for motion vectors can be limited to a
  3911. rectangular area of the frame defined by its top left corner, width
  3912. and height. These parameters have the same meaning as the drawbox
  3913. filter which can be used to visualise the position of the bounding
  3914. box.
  3915. This is useful when simultaneous movement of subjects within the frame
  3916. might be confused for camera motion by the motion vector search.
  3917. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  3918. then the full frame is used. This allows later options to be set
  3919. without specifying the bounding box for the motion vector search.
  3920. Default - search the whole frame.
  3921. @item rx
  3922. @item ry
  3923. Specify the maximum extent of movement in x and y directions in the
  3924. range 0-64 pixels. Default 16.
  3925. @item edge
  3926. Specify how to generate pixels to fill blanks at the edge of the
  3927. frame. Available values are:
  3928. @table @samp
  3929. @item blank, 0
  3930. Fill zeroes at blank locations
  3931. @item original, 1
  3932. Original image at blank locations
  3933. @item clamp, 2
  3934. Extruded edge value at blank locations
  3935. @item mirror, 3
  3936. Mirrored edge at blank locations
  3937. @end table
  3938. Default value is @samp{mirror}.
  3939. @item blocksize
  3940. Specify the blocksize to use for motion search. Range 4-128 pixels,
  3941. default 8.
  3942. @item contrast
  3943. Specify the contrast threshold for blocks. Only blocks with more than
  3944. the specified contrast (difference between darkest and lightest
  3945. pixels) will be considered. Range 1-255, default 125.
  3946. @item search
  3947. Specify the search strategy. Available values are:
  3948. @table @samp
  3949. @item exhaustive, 0
  3950. Set exhaustive search
  3951. @item less, 1
  3952. Set less exhaustive search.
  3953. @end table
  3954. Default value is @samp{exhaustive}.
  3955. @item filename
  3956. If set then a detailed log of the motion search is written to the
  3957. specified file.
  3958. @item opencl
  3959. If set to 1, specify using OpenCL capabilities, only available if
  3960. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  3961. @end table
  3962. @section detelecine
  3963. Apply an exact inverse of the telecine operation. It requires a predefined
  3964. pattern specified using the pattern option which must be the same as that passed
  3965. to the telecine filter.
  3966. This filter accepts the following options:
  3967. @table @option
  3968. @item first_field
  3969. @table @samp
  3970. @item top, t
  3971. top field first
  3972. @item bottom, b
  3973. bottom field first
  3974. The default value is @code{top}.
  3975. @end table
  3976. @item pattern
  3977. A string of numbers representing the pulldown pattern you wish to apply.
  3978. The default value is @code{23}.
  3979. @item start_frame
  3980. A number representing position of the first frame with respect to the telecine
  3981. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  3982. @end table
  3983. @section dilation
  3984. Apply dilation effect to the video.
  3985. This filter replaces the pixel by the local(3x3) maximum.
  3986. It accepts the following options:
  3987. @table @option
  3988. @item threshold0
  3989. @item threshold1
  3990. @item threshold2
  3991. @item threshold3
  3992. Limit the maximum change for each plane, default is 65535.
  3993. If 0, plane will remain unchanged.
  3994. @item coordinates
  3995. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  3996. pixels are used.
  3997. Flags to local 3x3 coordinates maps like this:
  3998. 1 2 3
  3999. 4 5
  4000. 6 7 8
  4001. @end table
  4002. @section displace
  4003. Displace pixels as indicated by second and third input stream.
  4004. It takes three input streams and outputs one stream, the first input is the
  4005. source, and second and third input are displacement maps.
  4006. The second input specifies how much to displace pixels along the
  4007. x-axis, while the third input specifies how much to displace pixels
  4008. along the y-axis.
  4009. If one of displacement map streams terminates, last frame from that
  4010. displacement map will be used.
  4011. Note that once generated, displacements maps can be reused over and over again.
  4012. A description of the accepted options follows.
  4013. @table @option
  4014. @item edge
  4015. Set displace behavior for pixels that are out of range.
  4016. Available values are:
  4017. @table @samp
  4018. @item blank
  4019. Missing pixels are replaced by black pixels.
  4020. @item smear
  4021. Adjacent pixels will spread out to replace missing pixels.
  4022. @item wrap
  4023. Out of range pixels are wrapped so they point to pixels of other side.
  4024. @end table
  4025. Default is @samp{smear}.
  4026. @end table
  4027. @subsection Examples
  4028. @itemize
  4029. @item
  4030. Add ripple effect to rgb input of video size hd720:
  4031. @example
  4032. 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
  4033. @end example
  4034. @item
  4035. Add wave effect to rgb input of video size hd720:
  4036. @example
  4037. 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
  4038. @end example
  4039. @end itemize
  4040. @section drawbox
  4041. Draw a colored box on the input image.
  4042. It accepts the following parameters:
  4043. @table @option
  4044. @item x
  4045. @item y
  4046. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4047. @item width, w
  4048. @item height, h
  4049. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4050. the input width and height. It defaults to 0.
  4051. @item color, c
  4052. Specify the color of the box to write. For the general syntax of this option,
  4053. check the "Color" section in the ffmpeg-utils manual. If the special
  4054. value @code{invert} is used, the box edge color is the same as the
  4055. video with inverted luma.
  4056. @item thickness, t
  4057. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4058. See below for the list of accepted constants.
  4059. @end table
  4060. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4061. following constants:
  4062. @table @option
  4063. @item dar
  4064. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4065. @item hsub
  4066. @item vsub
  4067. horizontal and vertical chroma subsample values. For example for the
  4068. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4069. @item in_h, ih
  4070. @item in_w, iw
  4071. The input width and height.
  4072. @item sar
  4073. The input sample aspect ratio.
  4074. @item x
  4075. @item y
  4076. The x and y offset coordinates where the box is drawn.
  4077. @item w
  4078. @item h
  4079. The width and height of the drawn box.
  4080. @item t
  4081. The thickness of the drawn box.
  4082. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4083. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4084. @end table
  4085. @subsection Examples
  4086. @itemize
  4087. @item
  4088. Draw a black box around the edge of the input image:
  4089. @example
  4090. drawbox
  4091. @end example
  4092. @item
  4093. Draw a box with color red and an opacity of 50%:
  4094. @example
  4095. drawbox=10:20:200:60:red@@0.5
  4096. @end example
  4097. The previous example can be specified as:
  4098. @example
  4099. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  4100. @end example
  4101. @item
  4102. Fill the box with pink color:
  4103. @example
  4104. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  4105. @end example
  4106. @item
  4107. Draw a 2-pixel red 2.40:1 mask:
  4108. @example
  4109. 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
  4110. @end example
  4111. @end itemize
  4112. @section drawgraph, adrawgraph
  4113. Draw a graph using input video or audio metadata.
  4114. It accepts the following parameters:
  4115. @table @option
  4116. @item m1
  4117. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  4118. @item fg1
  4119. Set 1st foreground color expression.
  4120. @item m2
  4121. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  4122. @item fg2
  4123. Set 2nd foreground color expression.
  4124. @item m3
  4125. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  4126. @item fg3
  4127. Set 3rd foreground color expression.
  4128. @item m4
  4129. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  4130. @item fg4
  4131. Set 4th foreground color expression.
  4132. @item min
  4133. Set minimal value of metadata value.
  4134. @item max
  4135. Set maximal value of metadata value.
  4136. @item bg
  4137. Set graph background color. Default is white.
  4138. @item mode
  4139. Set graph mode.
  4140. Available values for mode is:
  4141. @table @samp
  4142. @item bar
  4143. @item dot
  4144. @item line
  4145. @end table
  4146. Default is @code{line}.
  4147. @item slide
  4148. Set slide mode.
  4149. Available values for slide is:
  4150. @table @samp
  4151. @item frame
  4152. Draw new frame when right border is reached.
  4153. @item replace
  4154. Replace old columns with new ones.
  4155. @item scroll
  4156. Scroll from right to left.
  4157. @item rscroll
  4158. Scroll from left to right.
  4159. @end table
  4160. Default is @code{frame}.
  4161. @item size
  4162. Set size of graph video. For the syntax of this option, check the
  4163. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  4164. The default value is @code{900x256}.
  4165. The foreground color expressions can use the following variables:
  4166. @table @option
  4167. @item MIN
  4168. Minimal value of metadata value.
  4169. @item MAX
  4170. Maximal value of metadata value.
  4171. @item VAL
  4172. Current metadata key value.
  4173. @end table
  4174. The color is defined as 0xAABBGGRR.
  4175. @end table
  4176. Example using metadata from @ref{signalstats} filter:
  4177. @example
  4178. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  4179. @end example
  4180. Example using metadata from @ref{ebur128} filter:
  4181. @example
  4182. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  4183. @end example
  4184. @section drawgrid
  4185. Draw a grid on the input image.
  4186. It accepts the following parameters:
  4187. @table @option
  4188. @item x
  4189. @item y
  4190. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  4191. @item width, w
  4192. @item height, h
  4193. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  4194. input width and height, respectively, minus @code{thickness}, so image gets
  4195. framed. Default to 0.
  4196. @item color, c
  4197. Specify the color of the grid. For the general syntax of this option,
  4198. check the "Color" section in the ffmpeg-utils manual. If the special
  4199. value @code{invert} is used, the grid color is the same as the
  4200. video with inverted luma.
  4201. @item thickness, t
  4202. The expression which sets the thickness of the grid line. Default value is @code{1}.
  4203. See below for the list of accepted constants.
  4204. @end table
  4205. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4206. following constants:
  4207. @table @option
  4208. @item dar
  4209. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4210. @item hsub
  4211. @item vsub
  4212. horizontal and vertical chroma subsample values. For example for the
  4213. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4214. @item in_h, ih
  4215. @item in_w, iw
  4216. The input grid cell width and height.
  4217. @item sar
  4218. The input sample aspect ratio.
  4219. @item x
  4220. @item y
  4221. The x and y coordinates of some point of grid intersection (meant to configure offset).
  4222. @item w
  4223. @item h
  4224. The width and height of the drawn cell.
  4225. @item t
  4226. The thickness of the drawn cell.
  4227. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4228. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4229. @end table
  4230. @subsection Examples
  4231. @itemize
  4232. @item
  4233. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  4234. @example
  4235. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  4236. @end example
  4237. @item
  4238. Draw a white 3x3 grid with an opacity of 50%:
  4239. @example
  4240. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  4241. @end example
  4242. @end itemize
  4243. @anchor{drawtext}
  4244. @section drawtext
  4245. Draw a text string or text from a specified file on top of a video, using the
  4246. libfreetype library.
  4247. To enable compilation of this filter, you need to configure FFmpeg with
  4248. @code{--enable-libfreetype}.
  4249. To enable default font fallback and the @var{font} option you need to
  4250. configure FFmpeg with @code{--enable-libfontconfig}.
  4251. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  4252. @code{--enable-libfribidi}.
  4253. @subsection Syntax
  4254. It accepts the following parameters:
  4255. @table @option
  4256. @item box
  4257. Used to draw a box around text using the background color.
  4258. The value must be either 1 (enable) or 0 (disable).
  4259. The default value of @var{box} is 0.
  4260. @item boxborderw
  4261. Set the width of the border to be drawn around the box using @var{boxcolor}.
  4262. The default value of @var{boxborderw} is 0.
  4263. @item boxcolor
  4264. The color to be used for drawing box around text. For the syntax of this
  4265. option, check the "Color" section in the ffmpeg-utils manual.
  4266. The default value of @var{boxcolor} is "white".
  4267. @item borderw
  4268. Set the width of the border to be drawn around the text using @var{bordercolor}.
  4269. The default value of @var{borderw} is 0.
  4270. @item bordercolor
  4271. Set the color to be used for drawing border around text. For the syntax of this
  4272. option, check the "Color" section in the ffmpeg-utils manual.
  4273. The default value of @var{bordercolor} is "black".
  4274. @item expansion
  4275. Select how the @var{text} is expanded. Can be either @code{none},
  4276. @code{strftime} (deprecated) or
  4277. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  4278. below for details.
  4279. @item fix_bounds
  4280. If true, check and fix text coords to avoid clipping.
  4281. @item fontcolor
  4282. The color to be used for drawing fonts. For the syntax of this option, check
  4283. the "Color" section in the ffmpeg-utils manual.
  4284. The default value of @var{fontcolor} is "black".
  4285. @item fontcolor_expr
  4286. String which is expanded the same way as @var{text} to obtain dynamic
  4287. @var{fontcolor} value. By default this option has empty value and is not
  4288. processed. When this option is set, it overrides @var{fontcolor} option.
  4289. @item font
  4290. The font family to be used for drawing text. By default Sans.
  4291. @item fontfile
  4292. The font file to be used for drawing text. The path must be included.
  4293. This parameter is mandatory if the fontconfig support is disabled.
  4294. @item draw
  4295. This option does not exist, please see the timeline system
  4296. @item alpha
  4297. Draw the text applying alpha blending. The value can
  4298. be either a number between 0.0 and 1.0
  4299. The expression accepts the same variables @var{x, y} do.
  4300. The default value is 1.
  4301. Please see fontcolor_expr
  4302. @item fontsize
  4303. The font size to be used for drawing text.
  4304. The default value of @var{fontsize} is 16.
  4305. @item text_shaping
  4306. If set to 1, attempt to shape the text (for example, reverse the order of
  4307. right-to-left text and join Arabic characters) before drawing it.
  4308. Otherwise, just draw the text exactly as given.
  4309. By default 1 (if supported).
  4310. @item ft_load_flags
  4311. The flags to be used for loading the fonts.
  4312. The flags map the corresponding flags supported by libfreetype, and are
  4313. a combination of the following values:
  4314. @table @var
  4315. @item default
  4316. @item no_scale
  4317. @item no_hinting
  4318. @item render
  4319. @item no_bitmap
  4320. @item vertical_layout
  4321. @item force_autohint
  4322. @item crop_bitmap
  4323. @item pedantic
  4324. @item ignore_global_advance_width
  4325. @item no_recurse
  4326. @item ignore_transform
  4327. @item monochrome
  4328. @item linear_design
  4329. @item no_autohint
  4330. @end table
  4331. Default value is "default".
  4332. For more information consult the documentation for the FT_LOAD_*
  4333. libfreetype flags.
  4334. @item shadowcolor
  4335. The color to be used for drawing a shadow behind the drawn text. For the
  4336. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  4337. The default value of @var{shadowcolor} is "black".
  4338. @item shadowx
  4339. @item shadowy
  4340. The x and y offsets for the text shadow position with respect to the
  4341. position of the text. They can be either positive or negative
  4342. values. The default value for both is "0".
  4343. @item start_number
  4344. The starting frame number for the n/frame_num variable. The default value
  4345. is "0".
  4346. @item tabsize
  4347. The size in number of spaces to use for rendering the tab.
  4348. Default value is 4.
  4349. @item timecode
  4350. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  4351. format. It can be used with or without text parameter. @var{timecode_rate}
  4352. option must be specified.
  4353. @item timecode_rate, rate, r
  4354. Set the timecode frame rate (timecode only).
  4355. @item text
  4356. The text string to be drawn. The text must be a sequence of UTF-8
  4357. encoded characters.
  4358. This parameter is mandatory if no file is specified with the parameter
  4359. @var{textfile}.
  4360. @item textfile
  4361. A text file containing text to be drawn. The text must be a sequence
  4362. of UTF-8 encoded characters.
  4363. This parameter is mandatory if no text string is specified with the
  4364. parameter @var{text}.
  4365. If both @var{text} and @var{textfile} are specified, an error is thrown.
  4366. @item reload
  4367. If set to 1, the @var{textfile} will be reloaded before each frame.
  4368. Be sure to update it atomically, or it may be read partially, or even fail.
  4369. @item x
  4370. @item y
  4371. The expressions which specify the offsets where text will be drawn
  4372. within the video frame. They are relative to the top/left border of the
  4373. output image.
  4374. The default value of @var{x} and @var{y} is "0".
  4375. See below for the list of accepted constants and functions.
  4376. @end table
  4377. The parameters for @var{x} and @var{y} are expressions containing the
  4378. following constants and functions:
  4379. @table @option
  4380. @item dar
  4381. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  4382. @item hsub
  4383. @item vsub
  4384. horizontal and vertical chroma subsample values. For example for the
  4385. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4386. @item line_h, lh
  4387. the height of each text line
  4388. @item main_h, h, H
  4389. the input height
  4390. @item main_w, w, W
  4391. the input width
  4392. @item max_glyph_a, ascent
  4393. the maximum distance from the baseline to the highest/upper grid
  4394. coordinate used to place a glyph outline point, for all the rendered
  4395. glyphs.
  4396. It is a positive value, due to the grid's orientation with the Y axis
  4397. upwards.
  4398. @item max_glyph_d, descent
  4399. the maximum distance from the baseline to the lowest grid coordinate
  4400. used to place a glyph outline point, for all the rendered glyphs.
  4401. This is a negative value, due to the grid's orientation, with the Y axis
  4402. upwards.
  4403. @item max_glyph_h
  4404. maximum glyph height, that is the maximum height for all the glyphs
  4405. contained in the rendered text, it is equivalent to @var{ascent} -
  4406. @var{descent}.
  4407. @item max_glyph_w
  4408. maximum glyph width, that is the maximum width for all the glyphs
  4409. contained in the rendered text
  4410. @item n
  4411. the number of input frame, starting from 0
  4412. @item rand(min, max)
  4413. return a random number included between @var{min} and @var{max}
  4414. @item sar
  4415. The input sample aspect ratio.
  4416. @item t
  4417. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4418. @item text_h, th
  4419. the height of the rendered text
  4420. @item text_w, tw
  4421. the width of the rendered text
  4422. @item x
  4423. @item y
  4424. the x and y offset coordinates where the text is drawn.
  4425. These parameters allow the @var{x} and @var{y} expressions to refer
  4426. each other, so you can for example specify @code{y=x/dar}.
  4427. @end table
  4428. @anchor{drawtext_expansion}
  4429. @subsection Text expansion
  4430. If @option{expansion} is set to @code{strftime},
  4431. the filter recognizes strftime() sequences in the provided text and
  4432. expands them accordingly. Check the documentation of strftime(). This
  4433. feature is deprecated.
  4434. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  4435. If @option{expansion} is set to @code{normal} (which is the default),
  4436. the following expansion mechanism is used.
  4437. The backslash character @samp{\}, followed by any character, always expands to
  4438. the second character.
  4439. Sequence of the form @code{%@{...@}} are expanded. The text between the
  4440. braces is a function name, possibly followed by arguments separated by ':'.
  4441. If the arguments contain special characters or delimiters (':' or '@}'),
  4442. they should be escaped.
  4443. Note that they probably must also be escaped as the value for the
  4444. @option{text} option in the filter argument string and as the filter
  4445. argument in the filtergraph description, and possibly also for the shell,
  4446. that makes up to four levels of escaping; using a text file avoids these
  4447. problems.
  4448. The following functions are available:
  4449. @table @command
  4450. @item expr, e
  4451. The expression evaluation result.
  4452. It must take one argument specifying the expression to be evaluated,
  4453. which accepts the same constants and functions as the @var{x} and
  4454. @var{y} values. Note that not all constants should be used, for
  4455. example the text size is not known when evaluating the expression, so
  4456. the constants @var{text_w} and @var{text_h} will have an undefined
  4457. value.
  4458. @item expr_int_format, eif
  4459. Evaluate the expression's value and output as formatted integer.
  4460. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  4461. The second argument specifies the output format. Allowed values are @samp{x},
  4462. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  4463. @code{printf} function.
  4464. The third parameter is optional and sets the number of positions taken by the output.
  4465. It can be used to add padding with zeros from the left.
  4466. @item gmtime
  4467. The time at which the filter is running, expressed in UTC.
  4468. It can accept an argument: a strftime() format string.
  4469. @item localtime
  4470. The time at which the filter is running, expressed in the local time zone.
  4471. It can accept an argument: a strftime() format string.
  4472. @item metadata
  4473. Frame metadata. It must take one argument specifying metadata key.
  4474. @item n, frame_num
  4475. The frame number, starting from 0.
  4476. @item pict_type
  4477. A 1 character description of the current picture type.
  4478. @item pts
  4479. The timestamp of the current frame.
  4480. It can take up to three arguments.
  4481. The first argument is the format of the timestamp; it defaults to @code{flt}
  4482. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  4483. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  4484. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  4485. @code{localtime} stands for the timestamp of the frame formatted as
  4486. local time zone time.
  4487. The second argument is an offset added to the timestamp.
  4488. If the format is set to @code{localtime} or @code{gmtime},
  4489. a third argument may be supplied: a strftime() format string.
  4490. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  4491. @end table
  4492. @subsection Examples
  4493. @itemize
  4494. @item
  4495. Draw "Test Text" with font FreeSerif, using the default values for the
  4496. optional parameters.
  4497. @example
  4498. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  4499. @end example
  4500. @item
  4501. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  4502. and y=50 (counting from the top-left corner of the screen), text is
  4503. yellow with a red box around it. Both the text and the box have an
  4504. opacity of 20%.
  4505. @example
  4506. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  4507. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  4508. @end example
  4509. Note that the double quotes are not necessary if spaces are not used
  4510. within the parameter list.
  4511. @item
  4512. Show the text at the center of the video frame:
  4513. @example
  4514. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  4515. @end example
  4516. @item
  4517. Show a text line sliding from right to left in the last row of the video
  4518. frame. The file @file{LONG_LINE} is assumed to contain a single line
  4519. with no newlines.
  4520. @example
  4521. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  4522. @end example
  4523. @item
  4524. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  4525. @example
  4526. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  4527. @end example
  4528. @item
  4529. Draw a single green letter "g", at the center of the input video.
  4530. The glyph baseline is placed at half screen height.
  4531. @example
  4532. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  4533. @end example
  4534. @item
  4535. Show text for 1 second every 3 seconds:
  4536. @example
  4537. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  4538. @end example
  4539. @item
  4540. Use fontconfig to set the font. Note that the colons need to be escaped.
  4541. @example
  4542. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  4543. @end example
  4544. @item
  4545. Print the date of a real-time encoding (see strftime(3)):
  4546. @example
  4547. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  4548. @end example
  4549. @item
  4550. Show text fading in and out (appearing/disappearing):
  4551. @example
  4552. #!/bin/sh
  4553. DS=1.0 # display start
  4554. DE=10.0 # display end
  4555. FID=1.5 # fade in duration
  4556. FOD=5 # fade out duration
  4557. 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 @}"
  4558. @end example
  4559. @end itemize
  4560. For more information about libfreetype, check:
  4561. @url{http://www.freetype.org/}.
  4562. For more information about fontconfig, check:
  4563. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  4564. For more information about libfribidi, check:
  4565. @url{http://fribidi.org/}.
  4566. @section edgedetect
  4567. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  4568. The filter accepts the following options:
  4569. @table @option
  4570. @item low
  4571. @item high
  4572. Set low and high threshold values used by the Canny thresholding
  4573. algorithm.
  4574. The high threshold selects the "strong" edge pixels, which are then
  4575. connected through 8-connectivity with the "weak" edge pixels selected
  4576. by the low threshold.
  4577. @var{low} and @var{high} threshold values must be chosen in the range
  4578. [0,1], and @var{low} should be lesser or equal to @var{high}.
  4579. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  4580. is @code{50/255}.
  4581. @item mode
  4582. Define the drawing mode.
  4583. @table @samp
  4584. @item wires
  4585. Draw white/gray wires on black background.
  4586. @item colormix
  4587. Mix the colors to create a paint/cartoon effect.
  4588. @end table
  4589. Default value is @var{wires}.
  4590. @end table
  4591. @subsection Examples
  4592. @itemize
  4593. @item
  4594. Standard edge detection with custom values for the hysteresis thresholding:
  4595. @example
  4596. edgedetect=low=0.1:high=0.4
  4597. @end example
  4598. @item
  4599. Painting effect without thresholding:
  4600. @example
  4601. edgedetect=mode=colormix:high=0
  4602. @end example
  4603. @end itemize
  4604. @section eq
  4605. Set brightness, contrast, saturation and approximate gamma adjustment.
  4606. The filter accepts the following options:
  4607. @table @option
  4608. @item contrast
  4609. Set the contrast expression. The value must be a float value in range
  4610. @code{-2.0} to @code{2.0}. The default value is "1".
  4611. @item brightness
  4612. Set the brightness expression. The value must be a float value in
  4613. range @code{-1.0} to @code{1.0}. The default value is "0".
  4614. @item saturation
  4615. Set the saturation expression. The value must be a float in
  4616. range @code{0.0} to @code{3.0}. The default value is "1".
  4617. @item gamma
  4618. Set the gamma expression. The value must be a float in range
  4619. @code{0.1} to @code{10.0}. The default value is "1".
  4620. @item gamma_r
  4621. Set the gamma expression for red. The value must be a float in
  4622. range @code{0.1} to @code{10.0}. The default value is "1".
  4623. @item gamma_g
  4624. Set the gamma expression for green. The value must be a float in range
  4625. @code{0.1} to @code{10.0}. The default value is "1".
  4626. @item gamma_b
  4627. Set the gamma expression for blue. The value must be a float in range
  4628. @code{0.1} to @code{10.0}. The default value is "1".
  4629. @item gamma_weight
  4630. Set the gamma weight expression. It can be used to reduce the effect
  4631. of a high gamma value on bright image areas, e.g. keep them from
  4632. getting overamplified and just plain white. The value must be a float
  4633. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  4634. gamma correction all the way down while @code{1.0} leaves it at its
  4635. full strength. Default is "1".
  4636. @item eval
  4637. Set when the expressions for brightness, contrast, saturation and
  4638. gamma expressions are evaluated.
  4639. It accepts the following values:
  4640. @table @samp
  4641. @item init
  4642. only evaluate expressions once during the filter initialization or
  4643. when a command is processed
  4644. @item frame
  4645. evaluate expressions for each incoming frame
  4646. @end table
  4647. Default value is @samp{init}.
  4648. @end table
  4649. The expressions accept the following parameters:
  4650. @table @option
  4651. @item n
  4652. frame count of the input frame starting from 0
  4653. @item pos
  4654. byte position of the corresponding packet in the input file, NAN if
  4655. unspecified
  4656. @item r
  4657. frame rate of the input video, NAN if the input frame rate is unknown
  4658. @item t
  4659. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4660. @end table
  4661. @subsection Commands
  4662. The filter supports the following commands:
  4663. @table @option
  4664. @item contrast
  4665. Set the contrast expression.
  4666. @item brightness
  4667. Set the brightness expression.
  4668. @item saturation
  4669. Set the saturation expression.
  4670. @item gamma
  4671. Set the gamma expression.
  4672. @item gamma_r
  4673. Set the gamma_r expression.
  4674. @item gamma_g
  4675. Set gamma_g expression.
  4676. @item gamma_b
  4677. Set gamma_b expression.
  4678. @item gamma_weight
  4679. Set gamma_weight expression.
  4680. The command accepts the same syntax of the corresponding option.
  4681. If the specified expression is not valid, it is kept at its current
  4682. value.
  4683. @end table
  4684. @section erosion
  4685. Apply erosion effect to the video.
  4686. This filter replaces the pixel by the local(3x3) minimum.
  4687. It accepts the following options:
  4688. @table @option
  4689. @item threshold0
  4690. @item threshold1
  4691. @item threshold2
  4692. @item threshold3
  4693. Limit the maximum change for each plane, default is 65535.
  4694. If 0, plane will remain unchanged.
  4695. @item coordinates
  4696. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4697. pixels are used.
  4698. Flags to local 3x3 coordinates maps like this:
  4699. 1 2 3
  4700. 4 5
  4701. 6 7 8
  4702. @end table
  4703. @section extractplanes
  4704. Extract color channel components from input video stream into
  4705. separate grayscale video streams.
  4706. The filter accepts the following option:
  4707. @table @option
  4708. @item planes
  4709. Set plane(s) to extract.
  4710. Available values for planes are:
  4711. @table @samp
  4712. @item y
  4713. @item u
  4714. @item v
  4715. @item a
  4716. @item r
  4717. @item g
  4718. @item b
  4719. @end table
  4720. Choosing planes not available in the input will result in an error.
  4721. That means you cannot select @code{r}, @code{g}, @code{b} planes
  4722. with @code{y}, @code{u}, @code{v} planes at same time.
  4723. @end table
  4724. @subsection Examples
  4725. @itemize
  4726. @item
  4727. Extract luma, u and v color channel component from input video frame
  4728. into 3 grayscale outputs:
  4729. @example
  4730. 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
  4731. @end example
  4732. @end itemize
  4733. @section elbg
  4734. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  4735. For each input image, the filter will compute the optimal mapping from
  4736. the input to the output given the codebook length, that is the number
  4737. of distinct output colors.
  4738. This filter accepts the following options.
  4739. @table @option
  4740. @item codebook_length, l
  4741. Set codebook length. The value must be a positive integer, and
  4742. represents the number of distinct output colors. Default value is 256.
  4743. @item nb_steps, n
  4744. Set the maximum number of iterations to apply for computing the optimal
  4745. mapping. The higher the value the better the result and the higher the
  4746. computation time. Default value is 1.
  4747. @item seed, s
  4748. Set a random seed, must be an integer included between 0 and
  4749. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  4750. will try to use a good random seed on a best effort basis.
  4751. @item pal8
  4752. Set pal8 output pixel format. This option does not work with codebook
  4753. length greater than 256.
  4754. @end table
  4755. @section fade
  4756. Apply a fade-in/out effect to the input video.
  4757. It accepts the following parameters:
  4758. @table @option
  4759. @item type, t
  4760. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  4761. effect.
  4762. Default is @code{in}.
  4763. @item start_frame, s
  4764. Specify the number of the frame to start applying the fade
  4765. effect at. Default is 0.
  4766. @item nb_frames, n
  4767. The number of frames that the fade effect lasts. At the end of the
  4768. fade-in effect, the output video will have the same intensity as the input video.
  4769. At the end of the fade-out transition, the output video will be filled with the
  4770. selected @option{color}.
  4771. Default is 25.
  4772. @item alpha
  4773. If set to 1, fade only alpha channel, if one exists on the input.
  4774. Default value is 0.
  4775. @item start_time, st
  4776. Specify the timestamp (in seconds) of the frame to start to apply the fade
  4777. effect. If both start_frame and start_time are specified, the fade will start at
  4778. whichever comes last. Default is 0.
  4779. @item duration, d
  4780. The number of seconds for which the fade effect has to last. At the end of the
  4781. fade-in effect the output video will have the same intensity as the input video,
  4782. at the end of the fade-out transition the output video will be filled with the
  4783. selected @option{color}.
  4784. If both duration and nb_frames are specified, duration is used. Default is 0
  4785. (nb_frames is used by default).
  4786. @item color, c
  4787. Specify the color of the fade. Default is "black".
  4788. @end table
  4789. @subsection Examples
  4790. @itemize
  4791. @item
  4792. Fade in the first 30 frames of video:
  4793. @example
  4794. fade=in:0:30
  4795. @end example
  4796. The command above is equivalent to:
  4797. @example
  4798. fade=t=in:s=0:n=30
  4799. @end example
  4800. @item
  4801. Fade out the last 45 frames of a 200-frame video:
  4802. @example
  4803. fade=out:155:45
  4804. fade=type=out:start_frame=155:nb_frames=45
  4805. @end example
  4806. @item
  4807. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  4808. @example
  4809. fade=in:0:25, fade=out:975:25
  4810. @end example
  4811. @item
  4812. Make the first 5 frames yellow, then fade in from frame 5-24:
  4813. @example
  4814. fade=in:5:20:color=yellow
  4815. @end example
  4816. @item
  4817. Fade in alpha over first 25 frames of video:
  4818. @example
  4819. fade=in:0:25:alpha=1
  4820. @end example
  4821. @item
  4822. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  4823. @example
  4824. fade=t=in:st=5.5:d=0.5
  4825. @end example
  4826. @end itemize
  4827. @section fftfilt
  4828. Apply arbitrary expressions to samples in frequency domain
  4829. @table @option
  4830. @item dc_Y
  4831. Adjust the dc value (gain) of the luma plane of the image. The filter
  4832. accepts an integer value in range @code{0} to @code{1000}. The default
  4833. value is set to @code{0}.
  4834. @item dc_U
  4835. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  4836. filter accepts an integer value in range @code{0} to @code{1000}. The
  4837. default value is set to @code{0}.
  4838. @item dc_V
  4839. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  4840. filter accepts an integer value in range @code{0} to @code{1000}. The
  4841. default value is set to @code{0}.
  4842. @item weight_Y
  4843. Set the frequency domain weight expression for the luma plane.
  4844. @item weight_U
  4845. Set the frequency domain weight expression for the 1st chroma plane.
  4846. @item weight_V
  4847. Set the frequency domain weight expression for the 2nd chroma plane.
  4848. The filter accepts the following variables:
  4849. @item X
  4850. @item Y
  4851. The coordinates of the current sample.
  4852. @item W
  4853. @item H
  4854. The width and height of the image.
  4855. @end table
  4856. @subsection Examples
  4857. @itemize
  4858. @item
  4859. High-pass:
  4860. @example
  4861. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  4862. @end example
  4863. @item
  4864. Low-pass:
  4865. @example
  4866. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  4867. @end example
  4868. @item
  4869. Sharpen:
  4870. @example
  4871. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  4872. @end example
  4873. @end itemize
  4874. @section field
  4875. Extract a single field from an interlaced image using stride
  4876. arithmetic to avoid wasting CPU time. The output frames are marked as
  4877. non-interlaced.
  4878. The filter accepts the following options:
  4879. @table @option
  4880. @item type
  4881. Specify whether to extract the top (if the value is @code{0} or
  4882. @code{top}) or the bottom field (if the value is @code{1} or
  4883. @code{bottom}).
  4884. @end table
  4885. @section fieldmatch
  4886. Field matching filter for inverse telecine. It is meant to reconstruct the
  4887. progressive frames from a telecined stream. The filter does not drop duplicated
  4888. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  4889. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  4890. The separation of the field matching and the decimation is notably motivated by
  4891. the possibility of inserting a de-interlacing filter fallback between the two.
  4892. If the source has mixed telecined and real interlaced content,
  4893. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  4894. But these remaining combed frames will be marked as interlaced, and thus can be
  4895. de-interlaced by a later filter such as @ref{yadif} before decimation.
  4896. In addition to the various configuration options, @code{fieldmatch} can take an
  4897. optional second stream, activated through the @option{ppsrc} option. If
  4898. enabled, the frames reconstruction will be based on the fields and frames from
  4899. this second stream. This allows the first input to be pre-processed in order to
  4900. help the various algorithms of the filter, while keeping the output lossless
  4901. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  4902. or brightness/contrast adjustments can help.
  4903. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  4904. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  4905. which @code{fieldmatch} is based on. While the semantic and usage are very
  4906. close, some behaviour and options names can differ.
  4907. The @ref{decimate} filter currently only works for constant frame rate input.
  4908. If your input has mixed telecined (30fps) and progressive content with a lower
  4909. framerate like 24fps use the following filterchain to produce the necessary cfr
  4910. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  4911. The filter accepts the following options:
  4912. @table @option
  4913. @item order
  4914. Specify the assumed field order of the input stream. Available values are:
  4915. @table @samp
  4916. @item auto
  4917. Auto detect parity (use FFmpeg's internal parity value).
  4918. @item bff
  4919. Assume bottom field first.
  4920. @item tff
  4921. Assume top field first.
  4922. @end table
  4923. Note that it is sometimes recommended not to trust the parity announced by the
  4924. stream.
  4925. Default value is @var{auto}.
  4926. @item mode
  4927. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  4928. sense that it won't risk creating jerkiness due to duplicate frames when
  4929. possible, but if there are bad edits or blended fields it will end up
  4930. outputting combed frames when a good match might actually exist. On the other
  4931. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  4932. but will almost always find a good frame if there is one. The other values are
  4933. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  4934. jerkiness and creating duplicate frames versus finding good matches in sections
  4935. with bad edits, orphaned fields, blended fields, etc.
  4936. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  4937. Available values are:
  4938. @table @samp
  4939. @item pc
  4940. 2-way matching (p/c)
  4941. @item pc_n
  4942. 2-way matching, and trying 3rd match if still combed (p/c + n)
  4943. @item pc_u
  4944. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  4945. @item pc_n_ub
  4946. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  4947. still combed (p/c + n + u/b)
  4948. @item pcn
  4949. 3-way matching (p/c/n)
  4950. @item pcn_ub
  4951. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  4952. detected as combed (p/c/n + u/b)
  4953. @end table
  4954. The parenthesis at the end indicate the matches that would be used for that
  4955. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  4956. @var{top}).
  4957. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  4958. the slowest.
  4959. Default value is @var{pc_n}.
  4960. @item ppsrc
  4961. Mark the main input stream as a pre-processed input, and enable the secondary
  4962. input stream as the clean source to pick the fields from. See the filter
  4963. introduction for more details. It is similar to the @option{clip2} feature from
  4964. VFM/TFM.
  4965. Default value is @code{0} (disabled).
  4966. @item field
  4967. Set the field to match from. It is recommended to set this to the same value as
  4968. @option{order} unless you experience matching failures with that setting. In
  4969. certain circumstances changing the field that is used to match from can have a
  4970. large impact on matching performance. Available values are:
  4971. @table @samp
  4972. @item auto
  4973. Automatic (same value as @option{order}).
  4974. @item bottom
  4975. Match from the bottom field.
  4976. @item top
  4977. Match from the top field.
  4978. @end table
  4979. Default value is @var{auto}.
  4980. @item mchroma
  4981. Set whether or not chroma is included during the match comparisons. In most
  4982. cases it is recommended to leave this enabled. You should set this to @code{0}
  4983. only if your clip has bad chroma problems such as heavy rainbowing or other
  4984. artifacts. Setting this to @code{0} could also be used to speed things up at
  4985. the cost of some accuracy.
  4986. Default value is @code{1}.
  4987. @item y0
  4988. @item y1
  4989. These define an exclusion band which excludes the lines between @option{y0} and
  4990. @option{y1} from being included in the field matching decision. An exclusion
  4991. band can be used to ignore subtitles, a logo, or other things that may
  4992. interfere with the matching. @option{y0} sets the starting scan line and
  4993. @option{y1} sets the ending line; all lines in between @option{y0} and
  4994. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  4995. @option{y0} and @option{y1} to the same value will disable the feature.
  4996. @option{y0} and @option{y1} defaults to @code{0}.
  4997. @item scthresh
  4998. Set the scene change detection threshold as a percentage of maximum change on
  4999. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5000. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5001. @option{scthresh} is @code{[0.0, 100.0]}.
  5002. Default value is @code{12.0}.
  5003. @item combmatch
  5004. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5005. account the combed scores of matches when deciding what match to use as the
  5006. final match. Available values are:
  5007. @table @samp
  5008. @item none
  5009. No final matching based on combed scores.
  5010. @item sc
  5011. Combed scores are only used when a scene change is detected.
  5012. @item full
  5013. Use combed scores all the time.
  5014. @end table
  5015. Default is @var{sc}.
  5016. @item combdbg
  5017. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5018. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5019. Available values are:
  5020. @table @samp
  5021. @item none
  5022. No forced calculation.
  5023. @item pcn
  5024. Force p/c/n calculations.
  5025. @item pcnub
  5026. Force p/c/n/u/b calculations.
  5027. @end table
  5028. Default value is @var{none}.
  5029. @item cthresh
  5030. This is the area combing threshold used for combed frame detection. This
  5031. essentially controls how "strong" or "visible" combing must be to be detected.
  5032. Larger values mean combing must be more visible and smaller values mean combing
  5033. can be less visible or strong and still be detected. Valid settings are from
  5034. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5035. be detected as combed). This is basically a pixel difference value. A good
  5036. range is @code{[8, 12]}.
  5037. Default value is @code{9}.
  5038. @item chroma
  5039. Sets whether or not chroma is considered in the combed frame decision. Only
  5040. disable this if your source has chroma problems (rainbowing, etc.) that are
  5041. causing problems for the combed frame detection with chroma enabled. Actually,
  5042. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5043. where there is chroma only combing in the source.
  5044. Default value is @code{0}.
  5045. @item blockx
  5046. @item blocky
  5047. Respectively set the x-axis and y-axis size of the window used during combed
  5048. frame detection. This has to do with the size of the area in which
  5049. @option{combpel} pixels are required to be detected as combed for a frame to be
  5050. declared combed. See the @option{combpel} parameter description for more info.
  5051. Possible values are any number that is a power of 2 starting at 4 and going up
  5052. to 512.
  5053. Default value is @code{16}.
  5054. @item combpel
  5055. The number of combed pixels inside any of the @option{blocky} by
  5056. @option{blockx} size blocks on the frame for the frame to be detected as
  5057. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5058. setting controls "how much" combing there must be in any localized area (a
  5059. window defined by the @option{blockx} and @option{blocky} settings) on the
  5060. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5061. which point no frames will ever be detected as combed). This setting is known
  5062. as @option{MI} in TFM/VFM vocabulary.
  5063. Default value is @code{80}.
  5064. @end table
  5065. @anchor{p/c/n/u/b meaning}
  5066. @subsection p/c/n/u/b meaning
  5067. @subsubsection p/c/n
  5068. We assume the following telecined stream:
  5069. @example
  5070. Top fields: 1 2 2 3 4
  5071. Bottom fields: 1 2 3 4 4
  5072. @end example
  5073. The numbers correspond to the progressive frame the fields relate to. Here, the
  5074. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5075. When @code{fieldmatch} is configured to run a matching from bottom
  5076. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5077. @example
  5078. Input stream:
  5079. T 1 2 2 3 4
  5080. B 1 2 3 4 4 <-- matching reference
  5081. Matches: c c n n c
  5082. Output stream:
  5083. T 1 2 3 4 4
  5084. B 1 2 3 4 4
  5085. @end example
  5086. As a result of the field matching, we can see that some frames get duplicated.
  5087. To perform a complete inverse telecine, you need to rely on a decimation filter
  5088. after this operation. See for instance the @ref{decimate} filter.
  5089. The same operation now matching from top fields (@option{field}=@var{top})
  5090. looks like this:
  5091. @example
  5092. Input stream:
  5093. T 1 2 2 3 4 <-- matching reference
  5094. B 1 2 3 4 4
  5095. Matches: c c p p c
  5096. Output stream:
  5097. T 1 2 2 3 4
  5098. B 1 2 2 3 4
  5099. @end example
  5100. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5101. basically, they refer to the frame and field of the opposite parity:
  5102. @itemize
  5103. @item @var{p} matches the field of the opposite parity in the previous frame
  5104. @item @var{c} matches the field of the opposite parity in the current frame
  5105. @item @var{n} matches the field of the opposite parity in the next frame
  5106. @end itemize
  5107. @subsubsection u/b
  5108. The @var{u} and @var{b} matching are a bit special in the sense that they match
  5109. from the opposite parity flag. In the following examples, we assume that we are
  5110. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  5111. 'x' is placed above and below each matched fields.
  5112. With bottom matching (@option{field}=@var{bottom}):
  5113. @example
  5114. Match: c p n b u
  5115. x x x x x
  5116. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5117. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5118. x x x x x
  5119. Output frames:
  5120. 2 1 2 2 2
  5121. 2 2 2 1 3
  5122. @end example
  5123. With top matching (@option{field}=@var{top}):
  5124. @example
  5125. Match: c p n b u
  5126. x x x x x
  5127. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5128. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5129. x x x x x
  5130. Output frames:
  5131. 2 2 2 1 2
  5132. 2 1 3 2 2
  5133. @end example
  5134. @subsection Examples
  5135. Simple IVTC of a top field first telecined stream:
  5136. @example
  5137. fieldmatch=order=tff:combmatch=none, decimate
  5138. @end example
  5139. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  5140. @example
  5141. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  5142. @end example
  5143. @section fieldorder
  5144. Transform the field order of the input video.
  5145. It accepts the following parameters:
  5146. @table @option
  5147. @item order
  5148. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  5149. for bottom field first.
  5150. @end table
  5151. The default value is @samp{tff}.
  5152. The transformation is done by shifting the picture content up or down
  5153. by one line, and filling the remaining line with appropriate picture content.
  5154. This method is consistent with most broadcast field order converters.
  5155. If the input video is not flagged as being interlaced, or it is already
  5156. flagged as being of the required output field order, then this filter does
  5157. not alter the incoming video.
  5158. It is very useful when converting to or from PAL DV material,
  5159. which is bottom field first.
  5160. For example:
  5161. @example
  5162. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  5163. @end example
  5164. @section fifo, afifo
  5165. Buffer input images and send them when they are requested.
  5166. It is mainly useful when auto-inserted by the libavfilter
  5167. framework.
  5168. It does not take parameters.
  5169. @section find_rect
  5170. Find a rectangular object
  5171. It accepts the following options:
  5172. @table @option
  5173. @item object
  5174. Filepath of the object image, needs to be in gray8.
  5175. @item threshold
  5176. Detection threshold, default is 0.5.
  5177. @item mipmaps
  5178. Number of mipmaps, default is 3.
  5179. @item xmin, ymin, xmax, ymax
  5180. Specifies the rectangle in which to search.
  5181. @end table
  5182. @subsection Examples
  5183. @itemize
  5184. @item
  5185. Generate a representative palette of a given video using @command{ffmpeg}:
  5186. @example
  5187. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5188. @end example
  5189. @end itemize
  5190. @section cover_rect
  5191. Cover a rectangular object
  5192. It accepts the following options:
  5193. @table @option
  5194. @item cover
  5195. Filepath of the optional cover image, needs to be in yuv420.
  5196. @item mode
  5197. Set covering mode.
  5198. It accepts the following values:
  5199. @table @samp
  5200. @item cover
  5201. cover it by the supplied image
  5202. @item blur
  5203. cover it by interpolating the surrounding pixels
  5204. @end table
  5205. Default value is @var{blur}.
  5206. @end table
  5207. @subsection Examples
  5208. @itemize
  5209. @item
  5210. Generate a representative palette of a given video using @command{ffmpeg}:
  5211. @example
  5212. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5213. @end example
  5214. @end itemize
  5215. @anchor{format}
  5216. @section format
  5217. Convert the input video to one of the specified pixel formats.
  5218. Libavfilter will try to pick one that is suitable as input to
  5219. the next filter.
  5220. It accepts the following parameters:
  5221. @table @option
  5222. @item pix_fmts
  5223. A '|'-separated list of pixel format names, such as
  5224. "pix_fmts=yuv420p|monow|rgb24".
  5225. @end table
  5226. @subsection Examples
  5227. @itemize
  5228. @item
  5229. Convert the input video to the @var{yuv420p} format
  5230. @example
  5231. format=pix_fmts=yuv420p
  5232. @end example
  5233. Convert the input video to any of the formats in the list
  5234. @example
  5235. format=pix_fmts=yuv420p|yuv444p|yuv410p
  5236. @end example
  5237. @end itemize
  5238. @anchor{fps}
  5239. @section fps
  5240. Convert the video to specified constant frame rate by duplicating or dropping
  5241. frames as necessary.
  5242. It accepts the following parameters:
  5243. @table @option
  5244. @item fps
  5245. The desired output frame rate. The default is @code{25}.
  5246. @item round
  5247. Rounding method.
  5248. Possible values are:
  5249. @table @option
  5250. @item zero
  5251. zero round towards 0
  5252. @item inf
  5253. round away from 0
  5254. @item down
  5255. round towards -infinity
  5256. @item up
  5257. round towards +infinity
  5258. @item near
  5259. round to nearest
  5260. @end table
  5261. The default is @code{near}.
  5262. @item start_time
  5263. Assume the first PTS should be the given value, in seconds. This allows for
  5264. padding/trimming at the start of stream. By default, no assumption is made
  5265. about the first frame's expected PTS, so no padding or trimming is done.
  5266. For example, this could be set to 0 to pad the beginning with duplicates of
  5267. the first frame if a video stream starts after the audio stream or to trim any
  5268. frames with a negative PTS.
  5269. @end table
  5270. Alternatively, the options can be specified as a flat string:
  5271. @var{fps}[:@var{round}].
  5272. See also the @ref{setpts} filter.
  5273. @subsection Examples
  5274. @itemize
  5275. @item
  5276. A typical usage in order to set the fps to 25:
  5277. @example
  5278. fps=fps=25
  5279. @end example
  5280. @item
  5281. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  5282. @example
  5283. fps=fps=film:round=near
  5284. @end example
  5285. @end itemize
  5286. @section framepack
  5287. Pack two different video streams into a stereoscopic video, setting proper
  5288. metadata on supported codecs. The two views should have the same size and
  5289. framerate and processing will stop when the shorter video ends. Please note
  5290. that you may conveniently adjust view properties with the @ref{scale} and
  5291. @ref{fps} filters.
  5292. It accepts the following parameters:
  5293. @table @option
  5294. @item format
  5295. The desired packing format. Supported values are:
  5296. @table @option
  5297. @item sbs
  5298. The views are next to each other (default).
  5299. @item tab
  5300. The views are on top of each other.
  5301. @item lines
  5302. The views are packed by line.
  5303. @item columns
  5304. The views are packed by column.
  5305. @item frameseq
  5306. The views are temporally interleaved.
  5307. @end table
  5308. @end table
  5309. Some examples:
  5310. @example
  5311. # Convert left and right views into a frame-sequential video
  5312. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  5313. # Convert views into a side-by-side video with the same output resolution as the input
  5314. 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
  5315. @end example
  5316. @section framerate
  5317. Change the frame rate by interpolating new video output frames from the source
  5318. frames.
  5319. This filter is not designed to function correctly with interlaced media. If
  5320. you wish to change the frame rate of interlaced media then you are required
  5321. to deinterlace before this filter and re-interlace after this filter.
  5322. A description of the accepted options follows.
  5323. @table @option
  5324. @item fps
  5325. Specify the output frames per second. This option can also be specified
  5326. as a value alone. The default is @code{50}.
  5327. @item interp_start
  5328. Specify the start of a range where the output frame will be created as a
  5329. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5330. the default is @code{15}.
  5331. @item interp_end
  5332. Specify the end of a range where the output frame will be created as a
  5333. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5334. the default is @code{240}.
  5335. @item scene
  5336. Specify the level at which a scene change is detected as a value between
  5337. 0 and 100 to indicate a new scene; a low value reflects a low
  5338. probability for the current frame to introduce a new scene, while a higher
  5339. value means the current frame is more likely to be one.
  5340. The default is @code{7}.
  5341. @item flags
  5342. Specify flags influencing the filter process.
  5343. Available value for @var{flags} is:
  5344. @table @option
  5345. @item scene_change_detect, scd
  5346. Enable scene change detection using the value of the option @var{scene}.
  5347. This flag is enabled by default.
  5348. @end table
  5349. @end table
  5350. @section framestep
  5351. Select one frame every N-th frame.
  5352. This filter accepts the following option:
  5353. @table @option
  5354. @item step
  5355. Select frame after every @code{step} frames.
  5356. Allowed values are positive integers higher than 0. Default value is @code{1}.
  5357. @end table
  5358. @anchor{frei0r}
  5359. @section frei0r
  5360. Apply a frei0r effect to the input video.
  5361. To enable the compilation of this filter, you need to install the frei0r
  5362. header and configure FFmpeg with @code{--enable-frei0r}.
  5363. It accepts the following parameters:
  5364. @table @option
  5365. @item filter_name
  5366. The name of the frei0r effect to load. If the environment variable
  5367. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  5368. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  5369. Otherwise, the standard frei0r paths are searched, in this order:
  5370. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  5371. @file{/usr/lib/frei0r-1/}.
  5372. @item filter_params
  5373. A '|'-separated list of parameters to pass to the frei0r effect.
  5374. @end table
  5375. A frei0r effect parameter can be a boolean (its value is either
  5376. "y" or "n"), a double, a color (specified as
  5377. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  5378. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  5379. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  5380. @var{X} and @var{Y} are floating point numbers) and/or a string.
  5381. The number and types of parameters depend on the loaded effect. If an
  5382. effect parameter is not specified, the default value is set.
  5383. @subsection Examples
  5384. @itemize
  5385. @item
  5386. Apply the distort0r effect, setting the first two double parameters:
  5387. @example
  5388. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  5389. @end example
  5390. @item
  5391. Apply the colordistance effect, taking a color as the first parameter:
  5392. @example
  5393. frei0r=colordistance:0.2/0.3/0.4
  5394. frei0r=colordistance:violet
  5395. frei0r=colordistance:0x112233
  5396. @end example
  5397. @item
  5398. Apply the perspective effect, specifying the top left and top right image
  5399. positions:
  5400. @example
  5401. frei0r=perspective:0.2/0.2|0.8/0.2
  5402. @end example
  5403. @end itemize
  5404. For more information, see
  5405. @url{http://frei0r.dyne.org}
  5406. @section fspp
  5407. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  5408. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  5409. processing filter, one of them is performed once per block, not per pixel.
  5410. This allows for much higher speed.
  5411. The filter accepts the following options:
  5412. @table @option
  5413. @item quality
  5414. Set quality. This option defines the number of levels for averaging. It accepts
  5415. an integer in the range 4-5. Default value is @code{4}.
  5416. @item qp
  5417. Force a constant quantization parameter. It accepts an integer in range 0-63.
  5418. If not set, the filter will use the QP from the video stream (if available).
  5419. @item strength
  5420. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  5421. more details but also more artifacts, while higher values make the image smoother
  5422. but also blurrier. Default value is @code{0} − PSNR optimal.
  5423. @item use_bframe_qp
  5424. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5425. option may cause flicker since the B-Frames have often larger QP. Default is
  5426. @code{0} (not enabled).
  5427. @end table
  5428. @section geq
  5429. The filter accepts the following options:
  5430. @table @option
  5431. @item lum_expr, lum
  5432. Set the luminance expression.
  5433. @item cb_expr, cb
  5434. Set the chrominance blue expression.
  5435. @item cr_expr, cr
  5436. Set the chrominance red expression.
  5437. @item alpha_expr, a
  5438. Set the alpha expression.
  5439. @item red_expr, r
  5440. Set the red expression.
  5441. @item green_expr, g
  5442. Set the green expression.
  5443. @item blue_expr, b
  5444. Set the blue expression.
  5445. @end table
  5446. The colorspace is selected according to the specified options. If one
  5447. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  5448. options is specified, the filter will automatically select a YCbCr
  5449. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  5450. @option{blue_expr} options is specified, it will select an RGB
  5451. colorspace.
  5452. If one of the chrominance expression is not defined, it falls back on the other
  5453. one. If no alpha expression is specified it will evaluate to opaque value.
  5454. If none of chrominance expressions are specified, they will evaluate
  5455. to the luminance expression.
  5456. The expressions can use the following variables and functions:
  5457. @table @option
  5458. @item N
  5459. The sequential number of the filtered frame, starting from @code{0}.
  5460. @item X
  5461. @item Y
  5462. The coordinates of the current sample.
  5463. @item W
  5464. @item H
  5465. The width and height of the image.
  5466. @item SW
  5467. @item SH
  5468. Width and height scale depending on the currently filtered plane. It is the
  5469. ratio between the corresponding luma plane number of pixels and the current
  5470. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  5471. @code{0.5,0.5} for chroma planes.
  5472. @item T
  5473. Time of the current frame, expressed in seconds.
  5474. @item p(x, y)
  5475. Return the value of the pixel at location (@var{x},@var{y}) of the current
  5476. plane.
  5477. @item lum(x, y)
  5478. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  5479. plane.
  5480. @item cb(x, y)
  5481. Return the value of the pixel at location (@var{x},@var{y}) of the
  5482. blue-difference chroma plane. Return 0 if there is no such plane.
  5483. @item cr(x, y)
  5484. Return the value of the pixel at location (@var{x},@var{y}) of the
  5485. red-difference chroma plane. Return 0 if there is no such plane.
  5486. @item r(x, y)
  5487. @item g(x, y)
  5488. @item b(x, y)
  5489. Return the value of the pixel at location (@var{x},@var{y}) of the
  5490. red/green/blue component. Return 0 if there is no such component.
  5491. @item alpha(x, y)
  5492. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  5493. plane. Return 0 if there is no such plane.
  5494. @end table
  5495. For functions, if @var{x} and @var{y} are outside the area, the value will be
  5496. automatically clipped to the closer edge.
  5497. @subsection Examples
  5498. @itemize
  5499. @item
  5500. Flip the image horizontally:
  5501. @example
  5502. geq=p(W-X\,Y)
  5503. @end example
  5504. @item
  5505. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  5506. wavelength of 100 pixels:
  5507. @example
  5508. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  5509. @end example
  5510. @item
  5511. Generate a fancy enigmatic moving light:
  5512. @example
  5513. 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
  5514. @end example
  5515. @item
  5516. Generate a quick emboss effect:
  5517. @example
  5518. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  5519. @end example
  5520. @item
  5521. Modify RGB components depending on pixel position:
  5522. @example
  5523. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  5524. @end example
  5525. @item
  5526. Create a radial gradient that is the same size as the input (also see
  5527. the @ref{vignette} filter):
  5528. @example
  5529. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  5530. @end example
  5531. @item
  5532. Create a linear gradient to use as a mask for another filter, then
  5533. compose with @ref{overlay}. In this example the video will gradually
  5534. become more blurry from the top to the bottom of the y-axis as defined
  5535. by the linear gradient:
  5536. @example
  5537. ffmpeg -i input.mp4 -filter_complex "geq=lum=255*(Y/H),format=gray[grad];[0:v]boxblur=4[blur];[blur][grad]alphamerge[alpha];[0:v][alpha]overlay" output.mp4
  5538. @end example
  5539. @end itemize
  5540. @section gradfun
  5541. Fix the banding artifacts that are sometimes introduced into nearly flat
  5542. regions by truncation to 8bit color depth.
  5543. Interpolate the gradients that should go where the bands are, and
  5544. dither them.
  5545. It is designed for playback only. Do not use it prior to
  5546. lossy compression, because compression tends to lose the dither and
  5547. bring back the bands.
  5548. It accepts the following parameters:
  5549. @table @option
  5550. @item strength
  5551. The maximum amount by which the filter will change any one pixel. This is also
  5552. the threshold for detecting nearly flat regions. Acceptable values range from
  5553. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  5554. valid range.
  5555. @item radius
  5556. The neighborhood to fit the gradient to. A larger radius makes for smoother
  5557. gradients, but also prevents the filter from modifying the pixels near detailed
  5558. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  5559. values will be clipped to the valid range.
  5560. @end table
  5561. Alternatively, the options can be specified as a flat string:
  5562. @var{strength}[:@var{radius}]
  5563. @subsection Examples
  5564. @itemize
  5565. @item
  5566. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  5567. @example
  5568. gradfun=3.5:8
  5569. @end example
  5570. @item
  5571. Specify radius, omitting the strength (which will fall-back to the default
  5572. value):
  5573. @example
  5574. gradfun=radius=8
  5575. @end example
  5576. @end itemize
  5577. @anchor{haldclut}
  5578. @section haldclut
  5579. Apply a Hald CLUT to a video stream.
  5580. First input is the video stream to process, and second one is the Hald CLUT.
  5581. The Hald CLUT input can be a simple picture or a complete video stream.
  5582. The filter accepts the following options:
  5583. @table @option
  5584. @item shortest
  5585. Force termination when the shortest input terminates. Default is @code{0}.
  5586. @item repeatlast
  5587. Continue applying the last CLUT after the end of the stream. A value of
  5588. @code{0} disable the filter after the last frame of the CLUT is reached.
  5589. Default is @code{1}.
  5590. @end table
  5591. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  5592. filters share the same internals).
  5593. More information about the Hald CLUT can be found on Eskil Steenberg's website
  5594. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  5595. @subsection Workflow examples
  5596. @subsubsection Hald CLUT video stream
  5597. Generate an identity Hald CLUT stream altered with various effects:
  5598. @example
  5599. 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
  5600. @end example
  5601. Note: make sure you use a lossless codec.
  5602. Then use it with @code{haldclut} to apply it on some random stream:
  5603. @example
  5604. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  5605. @end example
  5606. The Hald CLUT will be applied to the 10 first seconds (duration of
  5607. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  5608. to the remaining frames of the @code{mandelbrot} stream.
  5609. @subsubsection Hald CLUT with preview
  5610. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  5611. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  5612. biggest possible square starting at the top left of the picture. The remaining
  5613. padding pixels (bottom or right) will be ignored. This area can be used to add
  5614. a preview of the Hald CLUT.
  5615. Typically, the following generated Hald CLUT will be supported by the
  5616. @code{haldclut} filter:
  5617. @example
  5618. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  5619. pad=iw+320 [padded_clut];
  5620. smptebars=s=320x256, split [a][b];
  5621. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  5622. [main][b] overlay=W-320" -frames:v 1 clut.png
  5623. @end example
  5624. It contains the original and a preview of the effect of the CLUT: SMPTE color
  5625. bars are displayed on the right-top, and below the same color bars processed by
  5626. the color changes.
  5627. Then, the effect of this Hald CLUT can be visualized with:
  5628. @example
  5629. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  5630. @end example
  5631. @section hflip
  5632. Flip the input video horizontally.
  5633. For example, to horizontally flip the input video with @command{ffmpeg}:
  5634. @example
  5635. ffmpeg -i in.avi -vf "hflip" out.avi
  5636. @end example
  5637. @section histeq
  5638. This filter applies a global color histogram equalization on a
  5639. per-frame basis.
  5640. It can be used to correct video that has a compressed range of pixel
  5641. intensities. The filter redistributes the pixel intensities to
  5642. equalize their distribution across the intensity range. It may be
  5643. viewed as an "automatically adjusting contrast filter". This filter is
  5644. useful only for correcting degraded or poorly captured source
  5645. video.
  5646. The filter accepts the following options:
  5647. @table @option
  5648. @item strength
  5649. Determine the amount of equalization to be applied. As the strength
  5650. is reduced, the distribution of pixel intensities more-and-more
  5651. approaches that of the input frame. The value must be a float number
  5652. in the range [0,1] and defaults to 0.200.
  5653. @item intensity
  5654. Set the maximum intensity that can generated and scale the output
  5655. values appropriately. The strength should be set as desired and then
  5656. the intensity can be limited if needed to avoid washing-out. The value
  5657. must be a float number in the range [0,1] and defaults to 0.210.
  5658. @item antibanding
  5659. Set the antibanding level. If enabled the filter will randomly vary
  5660. the luminance of output pixels by a small amount to avoid banding of
  5661. the histogram. Possible values are @code{none}, @code{weak} or
  5662. @code{strong}. It defaults to @code{none}.
  5663. @end table
  5664. @section histogram
  5665. Compute and draw a color distribution histogram for the input video.
  5666. The computed histogram is a representation of the color component
  5667. distribution in an image.
  5668. Standard histogram displays the color components distribution in an image.
  5669. Displays color graph for each color component. Shows distribution of
  5670. the Y, U, V, A or R, G, B components, depending on input format, in the
  5671. current frame. Below each graph a color component scale meter is shown.
  5672. The filter accepts the following options:
  5673. @table @option
  5674. @item level_height
  5675. Set height of level. Default value is @code{200}.
  5676. Allowed range is [50, 2048].
  5677. @item scale_height
  5678. Set height of color scale. Default value is @code{12}.
  5679. Allowed range is [0, 40].
  5680. @item display_mode
  5681. Set display mode.
  5682. It accepts the following values:
  5683. @table @samp
  5684. @item parade
  5685. Per color component graphs are placed below each other.
  5686. @item overlay
  5687. Presents information identical to that in the @code{parade}, except
  5688. that the graphs representing color components are superimposed directly
  5689. over one another.
  5690. @end table
  5691. Default is @code{parade}.
  5692. @item levels_mode
  5693. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  5694. Default is @code{linear}.
  5695. @item components
  5696. Set what color components to display.
  5697. Default is @code{7}.
  5698. @end table
  5699. @subsection Examples
  5700. @itemize
  5701. @item
  5702. Calculate and draw histogram:
  5703. @example
  5704. ffplay -i input -vf histogram
  5705. @end example
  5706. @end itemize
  5707. @anchor{hqdn3d}
  5708. @section hqdn3d
  5709. This is a high precision/quality 3d denoise filter. It aims to reduce
  5710. image noise, producing smooth images and making still images really
  5711. still. It should enhance compressibility.
  5712. It accepts the following optional parameters:
  5713. @table @option
  5714. @item luma_spatial
  5715. A non-negative floating point number which specifies spatial luma strength.
  5716. It defaults to 4.0.
  5717. @item chroma_spatial
  5718. A non-negative floating point number which specifies spatial chroma strength.
  5719. It defaults to 3.0*@var{luma_spatial}/4.0.
  5720. @item luma_tmp
  5721. A floating point number which specifies luma temporal strength. It defaults to
  5722. 6.0*@var{luma_spatial}/4.0.
  5723. @item chroma_tmp
  5724. A floating point number which specifies chroma temporal strength. It defaults to
  5725. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  5726. @end table
  5727. @section hqx
  5728. Apply a high-quality magnification filter designed for pixel art. This filter
  5729. was originally created by Maxim Stepin.
  5730. It accepts the following option:
  5731. @table @option
  5732. @item n
  5733. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  5734. @code{hq3x} and @code{4} for @code{hq4x}.
  5735. Default is @code{3}.
  5736. @end table
  5737. @section hstack
  5738. Stack input videos horizontally.
  5739. All streams must be of same pixel format and of same height.
  5740. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  5741. to create same output.
  5742. The filter accept the following option:
  5743. @table @option
  5744. @item inputs
  5745. Set number of input streams. Default is 2.
  5746. @item shortest
  5747. If set to 1, force the output to terminate when the shortest input
  5748. terminates. Default value is 0.
  5749. @end table
  5750. @section hue
  5751. Modify the hue and/or the saturation of the input.
  5752. It accepts the following parameters:
  5753. @table @option
  5754. @item h
  5755. Specify the hue angle as a number of degrees. It accepts an expression,
  5756. and defaults to "0".
  5757. @item s
  5758. Specify the saturation in the [-10,10] range. It accepts an expression and
  5759. defaults to "1".
  5760. @item H
  5761. Specify the hue angle as a number of radians. It accepts an
  5762. expression, and defaults to "0".
  5763. @item b
  5764. Specify the brightness in the [-10,10] range. It accepts an expression and
  5765. defaults to "0".
  5766. @end table
  5767. @option{h} and @option{H} are mutually exclusive, and can't be
  5768. specified at the same time.
  5769. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  5770. expressions containing the following constants:
  5771. @table @option
  5772. @item n
  5773. frame count of the input frame starting from 0
  5774. @item pts
  5775. presentation timestamp of the input frame expressed in time base units
  5776. @item r
  5777. frame rate of the input video, NAN if the input frame rate is unknown
  5778. @item t
  5779. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5780. @item tb
  5781. time base of the input video
  5782. @end table
  5783. @subsection Examples
  5784. @itemize
  5785. @item
  5786. Set the hue to 90 degrees and the saturation to 1.0:
  5787. @example
  5788. hue=h=90:s=1
  5789. @end example
  5790. @item
  5791. Same command but expressing the hue in radians:
  5792. @example
  5793. hue=H=PI/2:s=1
  5794. @end example
  5795. @item
  5796. Rotate hue and make the saturation swing between 0
  5797. and 2 over a period of 1 second:
  5798. @example
  5799. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  5800. @end example
  5801. @item
  5802. Apply a 3 seconds saturation fade-in effect starting at 0:
  5803. @example
  5804. hue="s=min(t/3\,1)"
  5805. @end example
  5806. The general fade-in expression can be written as:
  5807. @example
  5808. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  5809. @end example
  5810. @item
  5811. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  5812. @example
  5813. hue="s=max(0\, min(1\, (8-t)/3))"
  5814. @end example
  5815. The general fade-out expression can be written as:
  5816. @example
  5817. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  5818. @end example
  5819. @end itemize
  5820. @subsection Commands
  5821. This filter supports the following commands:
  5822. @table @option
  5823. @item b
  5824. @item s
  5825. @item h
  5826. @item H
  5827. Modify the hue and/or the saturation and/or brightness of the input video.
  5828. The command accepts the same syntax of the corresponding option.
  5829. If the specified expression is not valid, it is kept at its current
  5830. value.
  5831. @end table
  5832. @section idet
  5833. Detect video interlacing type.
  5834. This filter tries to detect if the input frames as interlaced, progressive,
  5835. top or bottom field first. It will also try and detect fields that are
  5836. repeated between adjacent frames (a sign of telecine).
  5837. Single frame detection considers only immediately adjacent frames when classifying each frame.
  5838. Multiple frame detection incorporates the classification history of previous frames.
  5839. The filter will log these metadata values:
  5840. @table @option
  5841. @item single.current_frame
  5842. Detected type of current frame using single-frame detection. One of:
  5843. ``tff'' (top field first), ``bff'' (bottom field first),
  5844. ``progressive'', or ``undetermined''
  5845. @item single.tff
  5846. Cumulative number of frames detected as top field first using single-frame detection.
  5847. @item multiple.tff
  5848. Cumulative number of frames detected as top field first using multiple-frame detection.
  5849. @item single.bff
  5850. Cumulative number of frames detected as bottom field first using single-frame detection.
  5851. @item multiple.current_frame
  5852. Detected type of current frame using multiple-frame detection. One of:
  5853. ``tff'' (top field first), ``bff'' (bottom field first),
  5854. ``progressive'', or ``undetermined''
  5855. @item multiple.bff
  5856. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  5857. @item single.progressive
  5858. Cumulative number of frames detected as progressive using single-frame detection.
  5859. @item multiple.progressive
  5860. Cumulative number of frames detected as progressive using multiple-frame detection.
  5861. @item single.undetermined
  5862. Cumulative number of frames that could not be classified using single-frame detection.
  5863. @item multiple.undetermined
  5864. Cumulative number of frames that could not be classified using multiple-frame detection.
  5865. @item repeated.current_frame
  5866. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  5867. @item repeated.neither
  5868. Cumulative number of frames with no repeated field.
  5869. @item repeated.top
  5870. Cumulative number of frames with the top field repeated from the previous frame's top field.
  5871. @item repeated.bottom
  5872. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  5873. @end table
  5874. The filter accepts the following options:
  5875. @table @option
  5876. @item intl_thres
  5877. Set interlacing threshold.
  5878. @item prog_thres
  5879. Set progressive threshold.
  5880. @item repeat_thres
  5881. Threshold for repeated field detection.
  5882. @item half_life
  5883. Number of frames after which a given frame's contribution to the
  5884. statistics is halved (i.e., it contributes only 0.5 to it's
  5885. classification). The default of 0 means that all frames seen are given
  5886. full weight of 1.0 forever.
  5887. @item analyze_interlaced_flag
  5888. When this is not 0 then idet will use the specified number of frames to determine
  5889. if the interlaced flag is accurate, it will not count undetermined frames.
  5890. If the flag is found to be accurate it will be used without any further
  5891. computations, if it is found to be inaccurate it will be cleared without any
  5892. further computations. This allows inserting the idet filter as a low computational
  5893. method to clean up the interlaced flag
  5894. @end table
  5895. @section il
  5896. Deinterleave or interleave fields.
  5897. This filter allows one to process interlaced images fields without
  5898. deinterlacing them. Deinterleaving splits the input frame into 2
  5899. fields (so called half pictures). Odd lines are moved to the top
  5900. half of the output image, even lines to the bottom half.
  5901. You can process (filter) them independently and then re-interleave them.
  5902. The filter accepts the following options:
  5903. @table @option
  5904. @item luma_mode, l
  5905. @item chroma_mode, c
  5906. @item alpha_mode, a
  5907. Available values for @var{luma_mode}, @var{chroma_mode} and
  5908. @var{alpha_mode} are:
  5909. @table @samp
  5910. @item none
  5911. Do nothing.
  5912. @item deinterleave, d
  5913. Deinterleave fields, placing one above the other.
  5914. @item interleave, i
  5915. Interleave fields. Reverse the effect of deinterleaving.
  5916. @end table
  5917. Default value is @code{none}.
  5918. @item luma_swap, ls
  5919. @item chroma_swap, cs
  5920. @item alpha_swap, as
  5921. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  5922. @end table
  5923. @section inflate
  5924. Apply inflate effect to the video.
  5925. This filter replaces the pixel by the local(3x3) average by taking into account
  5926. only values higher than the pixel.
  5927. It accepts the following options:
  5928. @table @option
  5929. @item threshold0
  5930. @item threshold1
  5931. @item threshold2
  5932. @item threshold3
  5933. Limit the maximum change for each plane, default is 65535.
  5934. If 0, plane will remain unchanged.
  5935. @end table
  5936. @section interlace
  5937. Simple interlacing filter from progressive contents. This interleaves upper (or
  5938. lower) lines from odd frames with lower (or upper) lines from even frames,
  5939. halving the frame rate and preserving image height.
  5940. @example
  5941. Original Original New Frame
  5942. Frame 'j' Frame 'j+1' (tff)
  5943. ========== =========== ==================
  5944. Line 0 --------------------> Frame 'j' Line 0
  5945. Line 1 Line 1 ----> Frame 'j+1' Line 1
  5946. Line 2 ---------------------> Frame 'j' Line 2
  5947. Line 3 Line 3 ----> Frame 'j+1' Line 3
  5948. ... ... ...
  5949. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  5950. @end example
  5951. It accepts the following optional parameters:
  5952. @table @option
  5953. @item scan
  5954. This determines whether the interlaced frame is taken from the even
  5955. (tff - default) or odd (bff) lines of the progressive frame.
  5956. @item lowpass
  5957. Enable (default) or disable the vertical lowpass filter to avoid twitter
  5958. interlacing and reduce moire patterns.
  5959. @end table
  5960. @section kerndeint
  5961. Deinterlace input video by applying Donald Graft's adaptive kernel
  5962. deinterling. Work on interlaced parts of a video to produce
  5963. progressive frames.
  5964. The description of the accepted parameters follows.
  5965. @table @option
  5966. @item thresh
  5967. Set the threshold which affects the filter's tolerance when
  5968. determining if a pixel line must be processed. It must be an integer
  5969. in the range [0,255] and defaults to 10. A value of 0 will result in
  5970. applying the process on every pixels.
  5971. @item map
  5972. Paint pixels exceeding the threshold value to white if set to 1.
  5973. Default is 0.
  5974. @item order
  5975. Set the fields order. Swap fields if set to 1, leave fields alone if
  5976. 0. Default is 0.
  5977. @item sharp
  5978. Enable additional sharpening if set to 1. Default is 0.
  5979. @item twoway
  5980. Enable twoway sharpening if set to 1. Default is 0.
  5981. @end table
  5982. @subsection Examples
  5983. @itemize
  5984. @item
  5985. Apply default values:
  5986. @example
  5987. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  5988. @end example
  5989. @item
  5990. Enable additional sharpening:
  5991. @example
  5992. kerndeint=sharp=1
  5993. @end example
  5994. @item
  5995. Paint processed pixels in white:
  5996. @example
  5997. kerndeint=map=1
  5998. @end example
  5999. @end itemize
  6000. @section lenscorrection
  6001. Correct radial lens distortion
  6002. This filter can be used to correct for radial distortion as can result from the use
  6003. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6004. one can use tools available for example as part of opencv or simply trial-and-error.
  6005. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6006. and extract the k1 and k2 coefficients from the resulting matrix.
  6007. Note that effectively the same filter is available in the open-source tools Krita and
  6008. Digikam from the KDE project.
  6009. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6010. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6011. brightness distribution, so you may want to use both filters together in certain
  6012. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6013. be applied before or after lens correction.
  6014. @subsection Options
  6015. The filter accepts the following options:
  6016. @table @option
  6017. @item cx
  6018. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6019. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6020. width.
  6021. @item cy
  6022. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6023. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6024. height.
  6025. @item k1
  6026. Coefficient of the quadratic correction term. 0.5 means no correction.
  6027. @item k2
  6028. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6029. @end table
  6030. The formula that generates the correction is:
  6031. @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)
  6032. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6033. distances from the focal point in the source and target images, respectively.
  6034. @anchor{lut3d}
  6035. @section lut3d
  6036. Apply a 3D LUT to an input video.
  6037. The filter accepts the following options:
  6038. @table @option
  6039. @item file
  6040. Set the 3D LUT file name.
  6041. Currently supported formats:
  6042. @table @samp
  6043. @item 3dl
  6044. AfterEffects
  6045. @item cube
  6046. Iridas
  6047. @item dat
  6048. DaVinci
  6049. @item m3d
  6050. Pandora
  6051. @end table
  6052. @item interp
  6053. Select interpolation mode.
  6054. Available values are:
  6055. @table @samp
  6056. @item nearest
  6057. Use values from the nearest defined point.
  6058. @item trilinear
  6059. Interpolate values using the 8 points defining a cube.
  6060. @item tetrahedral
  6061. Interpolate values using a tetrahedron.
  6062. @end table
  6063. @end table
  6064. @section lut, lutrgb, lutyuv
  6065. Compute a look-up table for binding each pixel component input value
  6066. to an output value, and apply it to the input video.
  6067. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6068. to an RGB input video.
  6069. These filters accept the following parameters:
  6070. @table @option
  6071. @item c0
  6072. set first pixel component expression
  6073. @item c1
  6074. set second pixel component expression
  6075. @item c2
  6076. set third pixel component expression
  6077. @item c3
  6078. set fourth pixel component expression, corresponds to the alpha component
  6079. @item r
  6080. set red component expression
  6081. @item g
  6082. set green component expression
  6083. @item b
  6084. set blue component expression
  6085. @item a
  6086. alpha component expression
  6087. @item y
  6088. set Y/luminance component expression
  6089. @item u
  6090. set U/Cb component expression
  6091. @item v
  6092. set V/Cr component expression
  6093. @end table
  6094. Each of them specifies the expression to use for computing the lookup table for
  6095. the corresponding pixel component values.
  6096. The exact component associated to each of the @var{c*} options depends on the
  6097. format in input.
  6098. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  6099. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  6100. The expressions can contain the following constants and functions:
  6101. @table @option
  6102. @item w
  6103. @item h
  6104. The input width and height.
  6105. @item val
  6106. The input value for the pixel component.
  6107. @item clipval
  6108. The input value, clipped to the @var{minval}-@var{maxval} range.
  6109. @item maxval
  6110. The maximum value for the pixel component.
  6111. @item minval
  6112. The minimum value for the pixel component.
  6113. @item negval
  6114. The negated value for the pixel component value, clipped to the
  6115. @var{minval}-@var{maxval} range; it corresponds to the expression
  6116. "maxval-clipval+minval".
  6117. @item clip(val)
  6118. The computed value in @var{val}, clipped to the
  6119. @var{minval}-@var{maxval} range.
  6120. @item gammaval(gamma)
  6121. The computed gamma correction value of the pixel component value,
  6122. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  6123. expression
  6124. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  6125. @end table
  6126. All expressions default to "val".
  6127. @subsection Examples
  6128. @itemize
  6129. @item
  6130. Negate input video:
  6131. @example
  6132. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  6133. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  6134. @end example
  6135. The above is the same as:
  6136. @example
  6137. lutrgb="r=negval:g=negval:b=negval"
  6138. lutyuv="y=negval:u=negval:v=negval"
  6139. @end example
  6140. @item
  6141. Negate luminance:
  6142. @example
  6143. lutyuv=y=negval
  6144. @end example
  6145. @item
  6146. Remove chroma components, turning the video into a graytone image:
  6147. @example
  6148. lutyuv="u=128:v=128"
  6149. @end example
  6150. @item
  6151. Apply a luma burning effect:
  6152. @example
  6153. lutyuv="y=2*val"
  6154. @end example
  6155. @item
  6156. Remove green and blue components:
  6157. @example
  6158. lutrgb="g=0:b=0"
  6159. @end example
  6160. @item
  6161. Set a constant alpha channel value on input:
  6162. @example
  6163. format=rgba,lutrgb=a="maxval-minval/2"
  6164. @end example
  6165. @item
  6166. Correct luminance gamma by a factor of 0.5:
  6167. @example
  6168. lutyuv=y=gammaval(0.5)
  6169. @end example
  6170. @item
  6171. Discard least significant bits of luma:
  6172. @example
  6173. lutyuv=y='bitand(val, 128+64+32)'
  6174. @end example
  6175. @end itemize
  6176. @section maskedmerge
  6177. Merge the first input stream with the second input stream using per pixel
  6178. weights in the third input stream.
  6179. A value of 0 in the third stream pixel component means that pixel component
  6180. from first stream is returned unchanged, while maximum value (eg. 255 for
  6181. 8-bit videos) means that pixel component from second stream is returned
  6182. unchanged. Intermediate values define the amount of merging between both
  6183. input stream's pixel components.
  6184. This filter accepts the following options:
  6185. @table @option
  6186. @item planes
  6187. Set which planes will be processed as bitmap, unprocessed planes will be
  6188. copied from first stream.
  6189. By default value 0xf, all planes will be processed.
  6190. @end table
  6191. @section mcdeint
  6192. Apply motion-compensation deinterlacing.
  6193. It needs one field per frame as input and must thus be used together
  6194. with yadif=1/3 or equivalent.
  6195. This filter accepts the following options:
  6196. @table @option
  6197. @item mode
  6198. Set the deinterlacing mode.
  6199. It accepts one of the following values:
  6200. @table @samp
  6201. @item fast
  6202. @item medium
  6203. @item slow
  6204. use iterative motion estimation
  6205. @item extra_slow
  6206. like @samp{slow}, but use multiple reference frames.
  6207. @end table
  6208. Default value is @samp{fast}.
  6209. @item parity
  6210. Set the picture field parity assumed for the input video. It must be
  6211. one of the following values:
  6212. @table @samp
  6213. @item 0, tff
  6214. assume top field first
  6215. @item 1, bff
  6216. assume bottom field first
  6217. @end table
  6218. Default value is @samp{bff}.
  6219. @item qp
  6220. Set per-block quantization parameter (QP) used by the internal
  6221. encoder.
  6222. Higher values should result in a smoother motion vector field but less
  6223. optimal individual vectors. Default value is 1.
  6224. @end table
  6225. @section mergeplanes
  6226. Merge color channel components from several video streams.
  6227. The filter accepts up to 4 input streams, and merge selected input
  6228. planes to the output video.
  6229. This filter accepts the following options:
  6230. @table @option
  6231. @item mapping
  6232. Set input to output plane mapping. Default is @code{0}.
  6233. The mappings is specified as a bitmap. It should be specified as a
  6234. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  6235. mapping for the first plane of the output stream. 'A' sets the number of
  6236. the input stream to use (from 0 to 3), and 'a' the plane number of the
  6237. corresponding input to use (from 0 to 3). The rest of the mappings is
  6238. similar, 'Bb' describes the mapping for the output stream second
  6239. plane, 'Cc' describes the mapping for the output stream third plane and
  6240. 'Dd' describes the mapping for the output stream fourth plane.
  6241. @item format
  6242. Set output pixel format. Default is @code{yuva444p}.
  6243. @end table
  6244. @subsection Examples
  6245. @itemize
  6246. @item
  6247. Merge three gray video streams of same width and height into single video stream:
  6248. @example
  6249. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  6250. @end example
  6251. @item
  6252. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  6253. @example
  6254. [a0][a1]mergeplanes=0x00010210:yuva444p
  6255. @end example
  6256. @item
  6257. Swap Y and A plane in yuva444p stream:
  6258. @example
  6259. format=yuva444p,mergeplanes=0x03010200:yuva444p
  6260. @end example
  6261. @item
  6262. Swap U and V plane in yuv420p stream:
  6263. @example
  6264. format=yuv420p,mergeplanes=0x000201:yuv420p
  6265. @end example
  6266. @item
  6267. Cast a rgb24 clip to yuv444p:
  6268. @example
  6269. format=rgb24,mergeplanes=0x000102:yuv444p
  6270. @end example
  6271. @end itemize
  6272. @section mpdecimate
  6273. Drop frames that do not differ greatly from the previous frame in
  6274. order to reduce frame rate.
  6275. The main use of this filter is for very-low-bitrate encoding
  6276. (e.g. streaming over dialup modem), but it could in theory be used for
  6277. fixing movies that were inverse-telecined incorrectly.
  6278. A description of the accepted options follows.
  6279. @table @option
  6280. @item max
  6281. Set the maximum number of consecutive frames which can be dropped (if
  6282. positive), or the minimum interval between dropped frames (if
  6283. negative). If the value is 0, the frame is dropped unregarding the
  6284. number of previous sequentially dropped frames.
  6285. Default value is 0.
  6286. @item hi
  6287. @item lo
  6288. @item frac
  6289. Set the dropping threshold values.
  6290. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  6291. represent actual pixel value differences, so a threshold of 64
  6292. corresponds to 1 unit of difference for each pixel, or the same spread
  6293. out differently over the block.
  6294. A frame is a candidate for dropping if no 8x8 blocks differ by more
  6295. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  6296. meaning the whole image) differ by more than a threshold of @option{lo}.
  6297. Default value for @option{hi} is 64*12, default value for @option{lo} is
  6298. 64*5, and default value for @option{frac} is 0.33.
  6299. @end table
  6300. @section negate
  6301. Negate input video.
  6302. It accepts an integer in input; if non-zero it negates the
  6303. alpha component (if available). The default value in input is 0.
  6304. @section noformat
  6305. Force libavfilter not to use any of the specified pixel formats for the
  6306. input to the next filter.
  6307. It accepts the following parameters:
  6308. @table @option
  6309. @item pix_fmts
  6310. A '|'-separated list of pixel format names, such as
  6311. apix_fmts=yuv420p|monow|rgb24".
  6312. @end table
  6313. @subsection Examples
  6314. @itemize
  6315. @item
  6316. Force libavfilter to use a format different from @var{yuv420p} for the
  6317. input to the vflip filter:
  6318. @example
  6319. noformat=pix_fmts=yuv420p,vflip
  6320. @end example
  6321. @item
  6322. Convert the input video to any of the formats not contained in the list:
  6323. @example
  6324. noformat=yuv420p|yuv444p|yuv410p
  6325. @end example
  6326. @end itemize
  6327. @section noise
  6328. Add noise on video input frame.
  6329. The filter accepts the following options:
  6330. @table @option
  6331. @item all_seed
  6332. @item c0_seed
  6333. @item c1_seed
  6334. @item c2_seed
  6335. @item c3_seed
  6336. Set noise seed for specific pixel component or all pixel components in case
  6337. of @var{all_seed}. Default value is @code{123457}.
  6338. @item all_strength, alls
  6339. @item c0_strength, c0s
  6340. @item c1_strength, c1s
  6341. @item c2_strength, c2s
  6342. @item c3_strength, c3s
  6343. Set noise strength for specific pixel component or all pixel components in case
  6344. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  6345. @item all_flags, allf
  6346. @item c0_flags, c0f
  6347. @item c1_flags, c1f
  6348. @item c2_flags, c2f
  6349. @item c3_flags, c3f
  6350. Set pixel component flags or set flags for all components if @var{all_flags}.
  6351. Available values for component flags are:
  6352. @table @samp
  6353. @item a
  6354. averaged temporal noise (smoother)
  6355. @item p
  6356. mix random noise with a (semi)regular pattern
  6357. @item t
  6358. temporal noise (noise pattern changes between frames)
  6359. @item u
  6360. uniform noise (gaussian otherwise)
  6361. @end table
  6362. @end table
  6363. @subsection Examples
  6364. Add temporal and uniform noise to input video:
  6365. @example
  6366. noise=alls=20:allf=t+u
  6367. @end example
  6368. @section null
  6369. Pass the video source unchanged to the output.
  6370. @section ocr
  6371. Optical Character Recognition
  6372. This filter uses Tesseract for optical character recognition.
  6373. It accepts the following options:
  6374. @table @option
  6375. @item datapath
  6376. Set datapath to tesseract data. Default is to use whatever was
  6377. set at installation.
  6378. @item language
  6379. Set language, default is "eng".
  6380. @item whitelist
  6381. Set character whitelist.
  6382. @item blacklist
  6383. Set character blacklist.
  6384. @end table
  6385. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  6386. @section ocv
  6387. Apply a video transform using libopencv.
  6388. To enable this filter, install the libopencv library and headers and
  6389. configure FFmpeg with @code{--enable-libopencv}.
  6390. It accepts the following parameters:
  6391. @table @option
  6392. @item filter_name
  6393. The name of the libopencv filter to apply.
  6394. @item filter_params
  6395. The parameters to pass to the libopencv filter. If not specified, the default
  6396. values are assumed.
  6397. @end table
  6398. Refer to the official libopencv documentation for more precise
  6399. information:
  6400. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  6401. Several libopencv filters are supported; see the following subsections.
  6402. @anchor{dilate}
  6403. @subsection dilate
  6404. Dilate an image by using a specific structuring element.
  6405. It corresponds to the libopencv function @code{cvDilate}.
  6406. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  6407. @var{struct_el} represents a structuring element, and has the syntax:
  6408. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  6409. @var{cols} and @var{rows} represent the number of columns and rows of
  6410. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  6411. point, and @var{shape} the shape for the structuring element. @var{shape}
  6412. must be "rect", "cross", "ellipse", or "custom".
  6413. If the value for @var{shape} is "custom", it must be followed by a
  6414. string of the form "=@var{filename}". The file with name
  6415. @var{filename} is assumed to represent a binary image, with each
  6416. printable character corresponding to a bright pixel. When a custom
  6417. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  6418. or columns and rows of the read file are assumed instead.
  6419. The default value for @var{struct_el} is "3x3+0x0/rect".
  6420. @var{nb_iterations} specifies the number of times the transform is
  6421. applied to the image, and defaults to 1.
  6422. Some examples:
  6423. @example
  6424. # Use the default values
  6425. ocv=dilate
  6426. # Dilate using a structuring element with a 5x5 cross, iterating two times
  6427. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  6428. # Read the shape from the file diamond.shape, iterating two times.
  6429. # The file diamond.shape may contain a pattern of characters like this
  6430. # *
  6431. # ***
  6432. # *****
  6433. # ***
  6434. # *
  6435. # The specified columns and rows are ignored
  6436. # but the anchor point coordinates are not
  6437. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  6438. @end example
  6439. @subsection erode
  6440. Erode an image by using a specific structuring element.
  6441. It corresponds to the libopencv function @code{cvErode}.
  6442. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  6443. with the same syntax and semantics as the @ref{dilate} filter.
  6444. @subsection smooth
  6445. Smooth the input video.
  6446. The filter takes the following parameters:
  6447. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  6448. @var{type} is the type of smooth filter to apply, and must be one of
  6449. the following values: "blur", "blur_no_scale", "median", "gaussian",
  6450. or "bilateral". The default value is "gaussian".
  6451. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  6452. depend on the smooth type. @var{param1} and
  6453. @var{param2} accept integer positive values or 0. @var{param3} and
  6454. @var{param4} accept floating point values.
  6455. The default value for @var{param1} is 3. The default value for the
  6456. other parameters is 0.
  6457. These parameters correspond to the parameters assigned to the
  6458. libopencv function @code{cvSmooth}.
  6459. @anchor{overlay}
  6460. @section overlay
  6461. Overlay one video on top of another.
  6462. It takes two inputs and has one output. The first input is the "main"
  6463. video on which the second input is overlaid.
  6464. It accepts the following parameters:
  6465. A description of the accepted options follows.
  6466. @table @option
  6467. @item x
  6468. @item y
  6469. Set the expression for the x and y coordinates of the overlaid video
  6470. on the main video. Default value is "0" for both expressions. In case
  6471. the expression is invalid, it is set to a huge value (meaning that the
  6472. overlay will not be displayed within the output visible area).
  6473. @item eof_action
  6474. The action to take when EOF is encountered on the secondary input; it accepts
  6475. one of the following values:
  6476. @table @option
  6477. @item repeat
  6478. Repeat the last frame (the default).
  6479. @item endall
  6480. End both streams.
  6481. @item pass
  6482. Pass the main input through.
  6483. @end table
  6484. @item eval
  6485. Set when the expressions for @option{x}, and @option{y} are evaluated.
  6486. It accepts the following values:
  6487. @table @samp
  6488. @item init
  6489. only evaluate expressions once during the filter initialization or
  6490. when a command is processed
  6491. @item frame
  6492. evaluate expressions for each incoming frame
  6493. @end table
  6494. Default value is @samp{frame}.
  6495. @item shortest
  6496. If set to 1, force the output to terminate when the shortest input
  6497. terminates. Default value is 0.
  6498. @item format
  6499. Set the format for the output video.
  6500. It accepts the following values:
  6501. @table @samp
  6502. @item yuv420
  6503. force YUV420 output
  6504. @item yuv422
  6505. force YUV422 output
  6506. @item yuv444
  6507. force YUV444 output
  6508. @item rgb
  6509. force RGB output
  6510. @end table
  6511. Default value is @samp{yuv420}.
  6512. @item rgb @emph{(deprecated)}
  6513. If set to 1, force the filter to accept inputs in the RGB
  6514. color space. Default value is 0. This option is deprecated, use
  6515. @option{format} instead.
  6516. @item repeatlast
  6517. If set to 1, force the filter to draw the last overlay frame over the
  6518. main input until the end of the stream. A value of 0 disables this
  6519. behavior. Default value is 1.
  6520. @end table
  6521. The @option{x}, and @option{y} expressions can contain the following
  6522. parameters.
  6523. @table @option
  6524. @item main_w, W
  6525. @item main_h, H
  6526. The main input width and height.
  6527. @item overlay_w, w
  6528. @item overlay_h, h
  6529. The overlay input width and height.
  6530. @item x
  6531. @item y
  6532. The computed values for @var{x} and @var{y}. They are evaluated for
  6533. each new frame.
  6534. @item hsub
  6535. @item vsub
  6536. horizontal and vertical chroma subsample values of the output
  6537. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  6538. @var{vsub} is 1.
  6539. @item n
  6540. the number of input frame, starting from 0
  6541. @item pos
  6542. the position in the file of the input frame, NAN if unknown
  6543. @item t
  6544. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  6545. @end table
  6546. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  6547. when evaluation is done @emph{per frame}, and will evaluate to NAN
  6548. when @option{eval} is set to @samp{init}.
  6549. Be aware that frames are taken from each input video in timestamp
  6550. order, hence, if their initial timestamps differ, it is a good idea
  6551. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  6552. have them begin in the same zero timestamp, as the example for
  6553. the @var{movie} filter does.
  6554. You can chain together more overlays but you should test the
  6555. efficiency of such approach.
  6556. @subsection Commands
  6557. This filter supports the following commands:
  6558. @table @option
  6559. @item x
  6560. @item y
  6561. Modify the x and y of the overlay input.
  6562. The command accepts the same syntax of the corresponding option.
  6563. If the specified expression is not valid, it is kept at its current
  6564. value.
  6565. @end table
  6566. @subsection Examples
  6567. @itemize
  6568. @item
  6569. Draw the overlay at 10 pixels from the bottom right corner of the main
  6570. video:
  6571. @example
  6572. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  6573. @end example
  6574. Using named options the example above becomes:
  6575. @example
  6576. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  6577. @end example
  6578. @item
  6579. Insert a transparent PNG logo in the bottom left corner of the input,
  6580. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  6581. @example
  6582. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  6583. @end example
  6584. @item
  6585. Insert 2 different transparent PNG logos (second logo on bottom
  6586. right corner) using the @command{ffmpeg} tool:
  6587. @example
  6588. 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
  6589. @end example
  6590. @item
  6591. Add a transparent color layer on top of the main video; @code{WxH}
  6592. must specify the size of the main input to the overlay filter:
  6593. @example
  6594. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  6595. @end example
  6596. @item
  6597. Play an original video and a filtered version (here with the deshake
  6598. filter) side by side using the @command{ffplay} tool:
  6599. @example
  6600. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  6601. @end example
  6602. The above command is the same as:
  6603. @example
  6604. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  6605. @end example
  6606. @item
  6607. Make a sliding overlay appearing from the left to the right top part of the
  6608. screen starting since time 2:
  6609. @example
  6610. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  6611. @end example
  6612. @item
  6613. Compose output by putting two input videos side to side:
  6614. @example
  6615. ffmpeg -i left.avi -i right.avi -filter_complex "
  6616. nullsrc=size=200x100 [background];
  6617. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  6618. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  6619. [background][left] overlay=shortest=1 [background+left];
  6620. [background+left][right] overlay=shortest=1:x=100 [left+right]
  6621. "
  6622. @end example
  6623. @item
  6624. Mask 10-20 seconds of a video by applying the delogo filter to a section
  6625. @example
  6626. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  6627. -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]'
  6628. masked.avi
  6629. @end example
  6630. @item
  6631. Chain several overlays in cascade:
  6632. @example
  6633. nullsrc=s=200x200 [bg];
  6634. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  6635. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  6636. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  6637. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  6638. [in3] null, [mid2] overlay=100:100 [out0]
  6639. @end example
  6640. @end itemize
  6641. @section owdenoise
  6642. Apply Overcomplete Wavelet denoiser.
  6643. The filter accepts the following options:
  6644. @table @option
  6645. @item depth
  6646. Set depth.
  6647. Larger depth values will denoise lower frequency components more, but
  6648. slow down filtering.
  6649. Must be an int in the range 8-16, default is @code{8}.
  6650. @item luma_strength, ls
  6651. Set luma strength.
  6652. Must be a double value in the range 0-1000, default is @code{1.0}.
  6653. @item chroma_strength, cs
  6654. Set chroma strength.
  6655. Must be a double value in the range 0-1000, default is @code{1.0}.
  6656. @end table
  6657. @anchor{pad}
  6658. @section pad
  6659. Add paddings to the input image, and place the original input at the
  6660. provided @var{x}, @var{y} coordinates.
  6661. It accepts the following parameters:
  6662. @table @option
  6663. @item width, w
  6664. @item height, h
  6665. Specify an expression for the size of the output image with the
  6666. paddings added. If the value for @var{width} or @var{height} is 0, the
  6667. corresponding input size is used for the output.
  6668. The @var{width} expression can reference the value set by the
  6669. @var{height} expression, and vice versa.
  6670. The default value of @var{width} and @var{height} is 0.
  6671. @item x
  6672. @item y
  6673. Specify the offsets to place the input image at within the padded area,
  6674. with respect to the top/left border of the output image.
  6675. The @var{x} expression can reference the value set by the @var{y}
  6676. expression, and vice versa.
  6677. The default value of @var{x} and @var{y} is 0.
  6678. @item color
  6679. Specify the color of the padded area. For the syntax of this option,
  6680. check the "Color" section in the ffmpeg-utils manual.
  6681. The default value of @var{color} is "black".
  6682. @end table
  6683. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  6684. options are expressions containing the following constants:
  6685. @table @option
  6686. @item in_w
  6687. @item in_h
  6688. The input video width and height.
  6689. @item iw
  6690. @item ih
  6691. These are the same as @var{in_w} and @var{in_h}.
  6692. @item out_w
  6693. @item out_h
  6694. The output width and height (the size of the padded area), as
  6695. specified by the @var{width} and @var{height} expressions.
  6696. @item ow
  6697. @item oh
  6698. These are the same as @var{out_w} and @var{out_h}.
  6699. @item x
  6700. @item y
  6701. The x and y offsets as specified by the @var{x} and @var{y}
  6702. expressions, or NAN if not yet specified.
  6703. @item a
  6704. same as @var{iw} / @var{ih}
  6705. @item sar
  6706. input sample aspect ratio
  6707. @item dar
  6708. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6709. @item hsub
  6710. @item vsub
  6711. The horizontal and vertical chroma subsample values. For example for the
  6712. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6713. @end table
  6714. @subsection Examples
  6715. @itemize
  6716. @item
  6717. Add paddings with the color "violet" to the input video. The output video
  6718. size is 640x480, and the top-left corner of the input video is placed at
  6719. column 0, row 40
  6720. @example
  6721. pad=640:480:0:40:violet
  6722. @end example
  6723. The example above is equivalent to the following command:
  6724. @example
  6725. pad=width=640:height=480:x=0:y=40:color=violet
  6726. @end example
  6727. @item
  6728. Pad the input to get an output with dimensions increased by 3/2,
  6729. and put the input video at the center of the padded area:
  6730. @example
  6731. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  6732. @end example
  6733. @item
  6734. Pad the input to get a squared output with size equal to the maximum
  6735. value between the input width and height, and put the input video at
  6736. the center of the padded area:
  6737. @example
  6738. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  6739. @end example
  6740. @item
  6741. Pad the input to get a final w/h ratio of 16:9:
  6742. @example
  6743. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  6744. @end example
  6745. @item
  6746. In case of anamorphic video, in order to set the output display aspect
  6747. correctly, it is necessary to use @var{sar} in the expression,
  6748. according to the relation:
  6749. @example
  6750. (ih * X / ih) * sar = output_dar
  6751. X = output_dar / sar
  6752. @end example
  6753. Thus the previous example needs to be modified to:
  6754. @example
  6755. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  6756. @end example
  6757. @item
  6758. Double the output size and put the input video in the bottom-right
  6759. corner of the output padded area:
  6760. @example
  6761. pad="2*iw:2*ih:ow-iw:oh-ih"
  6762. @end example
  6763. @end itemize
  6764. @anchor{palettegen}
  6765. @section palettegen
  6766. Generate one palette for a whole video stream.
  6767. It accepts the following options:
  6768. @table @option
  6769. @item max_colors
  6770. Set the maximum number of colors to quantize in the palette.
  6771. Note: the palette will still contain 256 colors; the unused palette entries
  6772. will be black.
  6773. @item reserve_transparent
  6774. Create a palette of 255 colors maximum and reserve the last one for
  6775. transparency. Reserving the transparency color is useful for GIF optimization.
  6776. If not set, the maximum of colors in the palette will be 256. You probably want
  6777. to disable this option for a standalone image.
  6778. Set by default.
  6779. @item stats_mode
  6780. Set statistics mode.
  6781. It accepts the following values:
  6782. @table @samp
  6783. @item full
  6784. Compute full frame histograms.
  6785. @item diff
  6786. Compute histograms only for the part that differs from previous frame. This
  6787. might be relevant to give more importance to the moving part of your input if
  6788. the background is static.
  6789. @end table
  6790. Default value is @var{full}.
  6791. @end table
  6792. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  6793. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  6794. color quantization of the palette. This information is also visible at
  6795. @var{info} logging level.
  6796. @subsection Examples
  6797. @itemize
  6798. @item
  6799. Generate a representative palette of a given video using @command{ffmpeg}:
  6800. @example
  6801. ffmpeg -i input.mkv -vf palettegen palette.png
  6802. @end example
  6803. @end itemize
  6804. @section paletteuse
  6805. Use a palette to downsample an input video stream.
  6806. The filter takes two inputs: one video stream and a palette. The palette must
  6807. be a 256 pixels image.
  6808. It accepts the following options:
  6809. @table @option
  6810. @item dither
  6811. Select dithering mode. Available algorithms are:
  6812. @table @samp
  6813. @item bayer
  6814. Ordered 8x8 bayer dithering (deterministic)
  6815. @item heckbert
  6816. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  6817. Note: this dithering is sometimes considered "wrong" and is included as a
  6818. reference.
  6819. @item floyd_steinberg
  6820. Floyd and Steingberg dithering (error diffusion)
  6821. @item sierra2
  6822. Frankie Sierra dithering v2 (error diffusion)
  6823. @item sierra2_4a
  6824. Frankie Sierra dithering v2 "Lite" (error diffusion)
  6825. @end table
  6826. Default is @var{sierra2_4a}.
  6827. @item bayer_scale
  6828. When @var{bayer} dithering is selected, this option defines the scale of the
  6829. pattern (how much the crosshatch pattern is visible). A low value means more
  6830. visible pattern for less banding, and higher value means less visible pattern
  6831. at the cost of more banding.
  6832. The option must be an integer value in the range [0,5]. Default is @var{2}.
  6833. @item diff_mode
  6834. If set, define the zone to process
  6835. @table @samp
  6836. @item rectangle
  6837. Only the changing rectangle will be reprocessed. This is similar to GIF
  6838. cropping/offsetting compression mechanism. This option can be useful for speed
  6839. if only a part of the image is changing, and has use cases such as limiting the
  6840. scope of the error diffusal @option{dither} to the rectangle that bounds the
  6841. moving scene (it leads to more deterministic output if the scene doesn't change
  6842. much, and as a result less moving noise and better GIF compression).
  6843. @end table
  6844. Default is @var{none}.
  6845. @end table
  6846. @subsection Examples
  6847. @itemize
  6848. @item
  6849. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  6850. using @command{ffmpeg}:
  6851. @example
  6852. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  6853. @end example
  6854. @end itemize
  6855. @section perspective
  6856. Correct perspective of video not recorded perpendicular to the screen.
  6857. A description of the accepted parameters follows.
  6858. @table @option
  6859. @item x0
  6860. @item y0
  6861. @item x1
  6862. @item y1
  6863. @item x2
  6864. @item y2
  6865. @item x3
  6866. @item y3
  6867. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  6868. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  6869. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  6870. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  6871. then the corners of the source will be sent to the specified coordinates.
  6872. The expressions can use the following variables:
  6873. @table @option
  6874. @item W
  6875. @item H
  6876. the width and height of video frame.
  6877. @end table
  6878. @item interpolation
  6879. Set interpolation for perspective correction.
  6880. It accepts the following values:
  6881. @table @samp
  6882. @item linear
  6883. @item cubic
  6884. @end table
  6885. Default value is @samp{linear}.
  6886. @item sense
  6887. Set interpretation of coordinate options.
  6888. It accepts the following values:
  6889. @table @samp
  6890. @item 0, source
  6891. Send point in the source specified by the given coordinates to
  6892. the corners of the destination.
  6893. @item 1, destination
  6894. Send the corners of the source to the point in the destination specified
  6895. by the given coordinates.
  6896. Default value is @samp{source}.
  6897. @end table
  6898. @end table
  6899. @section phase
  6900. Delay interlaced video by one field time so that the field order changes.
  6901. The intended use is to fix PAL movies that have been captured with the
  6902. opposite field order to the film-to-video transfer.
  6903. A description of the accepted parameters follows.
  6904. @table @option
  6905. @item mode
  6906. Set phase mode.
  6907. It accepts the following values:
  6908. @table @samp
  6909. @item t
  6910. Capture field order top-first, transfer bottom-first.
  6911. Filter will delay the bottom field.
  6912. @item b
  6913. Capture field order bottom-first, transfer top-first.
  6914. Filter will delay the top field.
  6915. @item p
  6916. Capture and transfer with the same field order. This mode only exists
  6917. for the documentation of the other options to refer to, but if you
  6918. actually select it, the filter will faithfully do nothing.
  6919. @item a
  6920. Capture field order determined automatically by field flags, transfer
  6921. opposite.
  6922. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  6923. basis using field flags. If no field information is available,
  6924. then this works just like @samp{u}.
  6925. @item u
  6926. Capture unknown or varying, transfer opposite.
  6927. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  6928. analyzing the images and selecting the alternative that produces best
  6929. match between the fields.
  6930. @item T
  6931. Capture top-first, transfer unknown or varying.
  6932. Filter selects among @samp{t} and @samp{p} using image analysis.
  6933. @item B
  6934. Capture bottom-first, transfer unknown or varying.
  6935. Filter selects among @samp{b} and @samp{p} using image analysis.
  6936. @item A
  6937. Capture determined by field flags, transfer unknown or varying.
  6938. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  6939. image analysis. If no field information is available, then this works just
  6940. like @samp{U}. This is the default mode.
  6941. @item U
  6942. Both capture and transfer unknown or varying.
  6943. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  6944. @end table
  6945. @end table
  6946. @section pixdesctest
  6947. Pixel format descriptor test filter, mainly useful for internal
  6948. testing. The output video should be equal to the input video.
  6949. For example:
  6950. @example
  6951. format=monow, pixdesctest
  6952. @end example
  6953. can be used to test the monowhite pixel format descriptor definition.
  6954. @section pp
  6955. Enable the specified chain of postprocessing subfilters using libpostproc. This
  6956. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  6957. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  6958. Each subfilter and some options have a short and a long name that can be used
  6959. interchangeably, i.e. dr/dering are the same.
  6960. The filters accept the following options:
  6961. @table @option
  6962. @item subfilters
  6963. Set postprocessing subfilters string.
  6964. @end table
  6965. All subfilters share common options to determine their scope:
  6966. @table @option
  6967. @item a/autoq
  6968. Honor the quality commands for this subfilter.
  6969. @item c/chrom
  6970. Do chrominance filtering, too (default).
  6971. @item y/nochrom
  6972. Do luminance filtering only (no chrominance).
  6973. @item n/noluma
  6974. Do chrominance filtering only (no luminance).
  6975. @end table
  6976. These options can be appended after the subfilter name, separated by a '|'.
  6977. Available subfilters are:
  6978. @table @option
  6979. @item hb/hdeblock[|difference[|flatness]]
  6980. Horizontal deblocking filter
  6981. @table @option
  6982. @item difference
  6983. Difference factor where higher values mean more deblocking (default: @code{32}).
  6984. @item flatness
  6985. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6986. @end table
  6987. @item vb/vdeblock[|difference[|flatness]]
  6988. Vertical deblocking filter
  6989. @table @option
  6990. @item difference
  6991. Difference factor where higher values mean more deblocking (default: @code{32}).
  6992. @item flatness
  6993. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6994. @end table
  6995. @item ha/hadeblock[|difference[|flatness]]
  6996. Accurate horizontal deblocking filter
  6997. @table @option
  6998. @item difference
  6999. Difference factor where higher values mean more deblocking (default: @code{32}).
  7000. @item flatness
  7001. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7002. @end table
  7003. @item va/vadeblock[|difference[|flatness]]
  7004. Accurate vertical deblocking filter
  7005. @table @option
  7006. @item difference
  7007. Difference factor where higher values mean more deblocking (default: @code{32}).
  7008. @item flatness
  7009. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7010. @end table
  7011. @end table
  7012. The horizontal and vertical deblocking filters share the difference and
  7013. flatness values so you cannot set different horizontal and vertical
  7014. thresholds.
  7015. @table @option
  7016. @item h1/x1hdeblock
  7017. Experimental horizontal deblocking filter
  7018. @item v1/x1vdeblock
  7019. Experimental vertical deblocking filter
  7020. @item dr/dering
  7021. Deringing filter
  7022. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  7023. @table @option
  7024. @item threshold1
  7025. larger -> stronger filtering
  7026. @item threshold2
  7027. larger -> stronger filtering
  7028. @item threshold3
  7029. larger -> stronger filtering
  7030. @end table
  7031. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  7032. @table @option
  7033. @item f/fullyrange
  7034. Stretch luminance to @code{0-255}.
  7035. @end table
  7036. @item lb/linblenddeint
  7037. Linear blend deinterlacing filter that deinterlaces the given block by
  7038. filtering all lines with a @code{(1 2 1)} filter.
  7039. @item li/linipoldeint
  7040. Linear interpolating deinterlacing filter that deinterlaces the given block by
  7041. linearly interpolating every second line.
  7042. @item ci/cubicipoldeint
  7043. Cubic interpolating deinterlacing filter deinterlaces the given block by
  7044. cubically interpolating every second line.
  7045. @item md/mediandeint
  7046. Median deinterlacing filter that deinterlaces the given block by applying a
  7047. median filter to every second line.
  7048. @item fd/ffmpegdeint
  7049. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  7050. second line with a @code{(-1 4 2 4 -1)} filter.
  7051. @item l5/lowpass5
  7052. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  7053. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  7054. @item fq/forceQuant[|quantizer]
  7055. Overrides the quantizer table from the input with the constant quantizer you
  7056. specify.
  7057. @table @option
  7058. @item quantizer
  7059. Quantizer to use
  7060. @end table
  7061. @item de/default
  7062. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  7063. @item fa/fast
  7064. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  7065. @item ac
  7066. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  7067. @end table
  7068. @subsection Examples
  7069. @itemize
  7070. @item
  7071. Apply horizontal and vertical deblocking, deringing and automatic
  7072. brightness/contrast:
  7073. @example
  7074. pp=hb/vb/dr/al
  7075. @end example
  7076. @item
  7077. Apply default filters without brightness/contrast correction:
  7078. @example
  7079. pp=de/-al
  7080. @end example
  7081. @item
  7082. Apply default filters and temporal denoiser:
  7083. @example
  7084. pp=default/tmpnoise|1|2|3
  7085. @end example
  7086. @item
  7087. Apply deblocking on luminance only, and switch vertical deblocking on or off
  7088. automatically depending on available CPU time:
  7089. @example
  7090. pp=hb|y/vb|a
  7091. @end example
  7092. @end itemize
  7093. @section pp7
  7094. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  7095. similar to spp = 6 with 7 point DCT, where only the center sample is
  7096. used after IDCT.
  7097. The filter accepts the following options:
  7098. @table @option
  7099. @item qp
  7100. Force a constant quantization parameter. It accepts an integer in range
  7101. 0 to 63. If not set, the filter will use the QP from the video stream
  7102. (if available).
  7103. @item mode
  7104. Set thresholding mode. Available modes are:
  7105. @table @samp
  7106. @item hard
  7107. Set hard thresholding.
  7108. @item soft
  7109. Set soft thresholding (better de-ringing effect, but likely blurrier).
  7110. @item medium
  7111. Set medium thresholding (good results, default).
  7112. @end table
  7113. @end table
  7114. @section psnr
  7115. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  7116. Ratio) between two input videos.
  7117. This filter takes in input two input videos, the first input is
  7118. considered the "main" source and is passed unchanged to the
  7119. output. The second input is used as a "reference" video for computing
  7120. the PSNR.
  7121. Both video inputs must have the same resolution and pixel format for
  7122. this filter to work correctly. Also it assumes that both inputs
  7123. have the same number of frames, which are compared one by one.
  7124. The obtained average PSNR is printed through the logging system.
  7125. The filter stores the accumulated MSE (mean squared error) of each
  7126. frame, and at the end of the processing it is averaged across all frames
  7127. equally, and the following formula is applied to obtain the PSNR:
  7128. @example
  7129. PSNR = 10*log10(MAX^2/MSE)
  7130. @end example
  7131. Where MAX is the average of the maximum values of each component of the
  7132. image.
  7133. The description of the accepted parameters follows.
  7134. @table @option
  7135. @item stats_file, f
  7136. If specified the filter will use the named file to save the PSNR of
  7137. each individual frame. When filename equals "-" the data is sent to
  7138. standard output.
  7139. @end table
  7140. The file printed if @var{stats_file} is selected, contains a sequence of
  7141. key/value pairs of the form @var{key}:@var{value} for each compared
  7142. couple of frames.
  7143. A description of each shown parameter follows:
  7144. @table @option
  7145. @item n
  7146. sequential number of the input frame, starting from 1
  7147. @item mse_avg
  7148. Mean Square Error pixel-by-pixel average difference of the compared
  7149. frames, averaged over all the image components.
  7150. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  7151. Mean Square Error pixel-by-pixel average difference of the compared
  7152. frames for the component specified by the suffix.
  7153. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  7154. Peak Signal to Noise ratio of the compared frames for the component
  7155. specified by the suffix.
  7156. @end table
  7157. For example:
  7158. @example
  7159. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7160. [main][ref] psnr="stats_file=stats.log" [out]
  7161. @end example
  7162. On this example the input file being processed is compared with the
  7163. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  7164. is stored in @file{stats.log}.
  7165. @anchor{pullup}
  7166. @section pullup
  7167. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  7168. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  7169. content.
  7170. The pullup filter is designed to take advantage of future context in making
  7171. its decisions. This filter is stateless in the sense that it does not lock
  7172. onto a pattern to follow, but it instead looks forward to the following
  7173. fields in order to identify matches and rebuild progressive frames.
  7174. To produce content with an even framerate, insert the fps filter after
  7175. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  7176. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  7177. The filter accepts the following options:
  7178. @table @option
  7179. @item jl
  7180. @item jr
  7181. @item jt
  7182. @item jb
  7183. These options set the amount of "junk" to ignore at the left, right, top, and
  7184. bottom of the image, respectively. Left and right are in units of 8 pixels,
  7185. while top and bottom are in units of 2 lines.
  7186. The default is 8 pixels on each side.
  7187. @item sb
  7188. Set the strict breaks. Setting this option to 1 will reduce the chances of
  7189. filter generating an occasional mismatched frame, but it may also cause an
  7190. excessive number of frames to be dropped during high motion sequences.
  7191. Conversely, setting it to -1 will make filter match fields more easily.
  7192. This may help processing of video where there is slight blurring between
  7193. the fields, but may also cause there to be interlaced frames in the output.
  7194. Default value is @code{0}.
  7195. @item mp
  7196. Set the metric plane to use. It accepts the following values:
  7197. @table @samp
  7198. @item l
  7199. Use luma plane.
  7200. @item u
  7201. Use chroma blue plane.
  7202. @item v
  7203. Use chroma red plane.
  7204. @end table
  7205. This option may be set to use chroma plane instead of the default luma plane
  7206. for doing filter's computations. This may improve accuracy on very clean
  7207. source material, but more likely will decrease accuracy, especially if there
  7208. is chroma noise (rainbow effect) or any grayscale video.
  7209. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  7210. load and make pullup usable in realtime on slow machines.
  7211. @end table
  7212. For best results (without duplicated frames in the output file) it is
  7213. necessary to change the output frame rate. For example, to inverse
  7214. telecine NTSC input:
  7215. @example
  7216. ffmpeg -i input -vf pullup -r 24000/1001 ...
  7217. @end example
  7218. @section qp
  7219. Change video quantization parameters (QP).
  7220. The filter accepts the following option:
  7221. @table @option
  7222. @item qp
  7223. Set expression for quantization parameter.
  7224. @end table
  7225. The expression is evaluated through the eval API and can contain, among others,
  7226. the following constants:
  7227. @table @var
  7228. @item known
  7229. 1 if index is not 129, 0 otherwise.
  7230. @item qp
  7231. Sequentional index starting from -129 to 128.
  7232. @end table
  7233. @subsection Examples
  7234. @itemize
  7235. @item
  7236. Some equation like:
  7237. @example
  7238. qp=2+2*sin(PI*qp)
  7239. @end example
  7240. @end itemize
  7241. @section random
  7242. Flush video frames from internal cache of frames into a random order.
  7243. No frame is discarded.
  7244. Inspired by @ref{frei0r} nervous filter.
  7245. @table @option
  7246. @item frames
  7247. Set size in number of frames of internal cache, in range from @code{2} to
  7248. @code{512}. Default is @code{30}.
  7249. @item seed
  7250. Set seed for random number generator, must be an integer included between
  7251. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  7252. less than @code{0}, the filter will try to use a good random seed on a
  7253. best effort basis.
  7254. @end table
  7255. @section removegrain
  7256. The removegrain filter is a spatial denoiser for progressive video.
  7257. @table @option
  7258. @item m0
  7259. Set mode for the first plane.
  7260. @item m1
  7261. Set mode for the second plane.
  7262. @item m2
  7263. Set mode for the third plane.
  7264. @item m3
  7265. Set mode for the fourth plane.
  7266. @end table
  7267. Range of mode is from 0 to 24. Description of each mode follows:
  7268. @table @var
  7269. @item 0
  7270. Leave input plane unchanged. Default.
  7271. @item 1
  7272. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  7273. @item 2
  7274. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  7275. @item 3
  7276. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  7277. @item 4
  7278. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  7279. This is equivalent to a median filter.
  7280. @item 5
  7281. Line-sensitive clipping giving the minimal change.
  7282. @item 6
  7283. Line-sensitive clipping, intermediate.
  7284. @item 7
  7285. Line-sensitive clipping, intermediate.
  7286. @item 8
  7287. Line-sensitive clipping, intermediate.
  7288. @item 9
  7289. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  7290. @item 10
  7291. Replaces the target pixel with the closest neighbour.
  7292. @item 11
  7293. [1 2 1] horizontal and vertical kernel blur.
  7294. @item 12
  7295. Same as mode 11.
  7296. @item 13
  7297. Bob mode, interpolates top field from the line where the neighbours
  7298. pixels are the closest.
  7299. @item 14
  7300. Bob mode, interpolates bottom field from the line where the neighbours
  7301. pixels are the closest.
  7302. @item 15
  7303. Bob mode, interpolates top field. Same as 13 but with a more complicated
  7304. interpolation formula.
  7305. @item 16
  7306. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  7307. interpolation formula.
  7308. @item 17
  7309. Clips the pixel with the minimum and maximum of respectively the maximum and
  7310. minimum of each pair of opposite neighbour pixels.
  7311. @item 18
  7312. Line-sensitive clipping using opposite neighbours whose greatest distance from
  7313. the current pixel is minimal.
  7314. @item 19
  7315. Replaces the pixel with the average of its 8 neighbours.
  7316. @item 20
  7317. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  7318. @item 21
  7319. Clips pixels using the averages of opposite neighbour.
  7320. @item 22
  7321. Same as mode 21 but simpler and faster.
  7322. @item 23
  7323. Small edge and halo removal, but reputed useless.
  7324. @item 24
  7325. Similar as 23.
  7326. @end table
  7327. @section removelogo
  7328. Suppress a TV station logo, using an image file to determine which
  7329. pixels comprise the logo. It works by filling in the pixels that
  7330. comprise the logo with neighboring pixels.
  7331. The filter accepts the following options:
  7332. @table @option
  7333. @item filename, f
  7334. Set the filter bitmap file, which can be any image format supported by
  7335. libavformat. The width and height of the image file must match those of the
  7336. video stream being processed.
  7337. @end table
  7338. Pixels in the provided bitmap image with a value of zero are not
  7339. considered part of the logo, non-zero pixels are considered part of
  7340. the logo. If you use white (255) for the logo and black (0) for the
  7341. rest, you will be safe. For making the filter bitmap, it is
  7342. recommended to take a screen capture of a black frame with the logo
  7343. visible, and then using a threshold filter followed by the erode
  7344. filter once or twice.
  7345. If needed, little splotches can be fixed manually. Remember that if
  7346. logo pixels are not covered, the filter quality will be much
  7347. reduced. Marking too many pixels as part of the logo does not hurt as
  7348. much, but it will increase the amount of blurring needed to cover over
  7349. the image and will destroy more information than necessary, and extra
  7350. pixels will slow things down on a large logo.
  7351. @section repeatfields
  7352. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  7353. fields based on its value.
  7354. @section reverse, areverse
  7355. Reverse a clip.
  7356. Warning: This filter requires memory to buffer the entire clip, so trimming
  7357. is suggested.
  7358. @subsection Examples
  7359. @itemize
  7360. @item
  7361. Take the first 5 seconds of a clip, and reverse it.
  7362. @example
  7363. trim=end=5,reverse
  7364. @end example
  7365. @end itemize
  7366. @section rotate
  7367. Rotate video by an arbitrary angle expressed in radians.
  7368. The filter accepts the following options:
  7369. A description of the optional parameters follows.
  7370. @table @option
  7371. @item angle, a
  7372. Set an expression for the angle by which to rotate the input video
  7373. clockwise, expressed as a number of radians. A negative value will
  7374. result in a counter-clockwise rotation. By default it is set to "0".
  7375. This expression is evaluated for each frame.
  7376. @item out_w, ow
  7377. Set the output width expression, default value is "iw".
  7378. This expression is evaluated just once during configuration.
  7379. @item out_h, oh
  7380. Set the output height expression, default value is "ih".
  7381. This expression is evaluated just once during configuration.
  7382. @item bilinear
  7383. Enable bilinear interpolation if set to 1, a value of 0 disables
  7384. it. Default value is 1.
  7385. @item fillcolor, c
  7386. Set the color used to fill the output area not covered by the rotated
  7387. image. For the general syntax of this option, check the "Color" section in the
  7388. ffmpeg-utils manual. If the special value "none" is selected then no
  7389. background is printed (useful for example if the background is never shown).
  7390. Default value is "black".
  7391. @end table
  7392. The expressions for the angle and the output size can contain the
  7393. following constants and functions:
  7394. @table @option
  7395. @item n
  7396. sequential number of the input frame, starting from 0. It is always NAN
  7397. before the first frame is filtered.
  7398. @item t
  7399. time in seconds of the input frame, it is set to 0 when the filter is
  7400. configured. It is always NAN before the first frame is filtered.
  7401. @item hsub
  7402. @item vsub
  7403. horizontal and vertical chroma subsample values. For example for the
  7404. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7405. @item in_w, iw
  7406. @item in_h, ih
  7407. the input video width and height
  7408. @item out_w, ow
  7409. @item out_h, oh
  7410. the output width and height, that is the size of the padded area as
  7411. specified by the @var{width} and @var{height} expressions
  7412. @item rotw(a)
  7413. @item roth(a)
  7414. the minimal width/height required for completely containing the input
  7415. video rotated by @var{a} radians.
  7416. These are only available when computing the @option{out_w} and
  7417. @option{out_h} expressions.
  7418. @end table
  7419. @subsection Examples
  7420. @itemize
  7421. @item
  7422. Rotate the input by PI/6 radians clockwise:
  7423. @example
  7424. rotate=PI/6
  7425. @end example
  7426. @item
  7427. Rotate the input by PI/6 radians counter-clockwise:
  7428. @example
  7429. rotate=-PI/6
  7430. @end example
  7431. @item
  7432. Rotate the input by 45 degrees clockwise:
  7433. @example
  7434. rotate=45*PI/180
  7435. @end example
  7436. @item
  7437. Apply a constant rotation with period T, starting from an angle of PI/3:
  7438. @example
  7439. rotate=PI/3+2*PI*t/T
  7440. @end example
  7441. @item
  7442. Make the input video rotation oscillating with a period of T
  7443. seconds and an amplitude of A radians:
  7444. @example
  7445. rotate=A*sin(2*PI/T*t)
  7446. @end example
  7447. @item
  7448. Rotate the video, output size is chosen so that the whole rotating
  7449. input video is always completely contained in the output:
  7450. @example
  7451. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  7452. @end example
  7453. @item
  7454. Rotate the video, reduce the output size so that no background is ever
  7455. shown:
  7456. @example
  7457. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  7458. @end example
  7459. @end itemize
  7460. @subsection Commands
  7461. The filter supports the following commands:
  7462. @table @option
  7463. @item a, angle
  7464. Set the angle expression.
  7465. The command accepts the same syntax of the corresponding option.
  7466. If the specified expression is not valid, it is kept at its current
  7467. value.
  7468. @end table
  7469. @section sab
  7470. Apply Shape Adaptive Blur.
  7471. The filter accepts the following options:
  7472. @table @option
  7473. @item luma_radius, lr
  7474. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  7475. value is 1.0. A greater value will result in a more blurred image, and
  7476. in slower processing.
  7477. @item luma_pre_filter_radius, lpfr
  7478. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  7479. value is 1.0.
  7480. @item luma_strength, ls
  7481. Set luma maximum difference between pixels to still be considered, must
  7482. be a value in the 0.1-100.0 range, default value is 1.0.
  7483. @item chroma_radius, cr
  7484. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  7485. greater value will result in a more blurred image, and in slower
  7486. processing.
  7487. @item chroma_pre_filter_radius, cpfr
  7488. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  7489. @item chroma_strength, cs
  7490. Set chroma maximum difference between pixels to still be considered,
  7491. must be a value in the 0.1-100.0 range.
  7492. @end table
  7493. Each chroma option value, if not explicitly specified, is set to the
  7494. corresponding luma option value.
  7495. @anchor{scale}
  7496. @section scale
  7497. Scale (resize) the input video, using the libswscale library.
  7498. The scale filter forces the output display aspect ratio to be the same
  7499. of the input, by changing the output sample aspect ratio.
  7500. If the input image format is different from the format requested by
  7501. the next filter, the scale filter will convert the input to the
  7502. requested format.
  7503. @subsection Options
  7504. The filter accepts the following options, or any of the options
  7505. supported by the libswscale scaler.
  7506. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  7507. the complete list of scaler options.
  7508. @table @option
  7509. @item width, w
  7510. @item height, h
  7511. Set the output video dimension expression. Default value is the input
  7512. dimension.
  7513. If the value is 0, the input width is used for the output.
  7514. If one of the values is -1, the scale filter will use a value that
  7515. maintains the aspect ratio of the input image, calculated from the
  7516. other specified dimension. If both of them are -1, the input size is
  7517. used
  7518. If one of the values is -n with n > 1, the scale filter will also use a value
  7519. that maintains the aspect ratio of the input image, calculated from the other
  7520. specified dimension. After that it will, however, make sure that the calculated
  7521. dimension is divisible by n and adjust the value if necessary.
  7522. See below for the list of accepted constants for use in the dimension
  7523. expression.
  7524. @item interl
  7525. Set the interlacing mode. It accepts the following values:
  7526. @table @samp
  7527. @item 1
  7528. Force interlaced aware scaling.
  7529. @item 0
  7530. Do not apply interlaced scaling.
  7531. @item -1
  7532. Select interlaced aware scaling depending on whether the source frames
  7533. are flagged as interlaced or not.
  7534. @end table
  7535. Default value is @samp{0}.
  7536. @item flags
  7537. Set libswscale scaling flags. See
  7538. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  7539. complete list of values. If not explicitly specified the filter applies
  7540. the default flags.
  7541. @item size, s
  7542. Set the video size. For the syntax of this option, check the
  7543. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7544. @item in_color_matrix
  7545. @item out_color_matrix
  7546. Set in/output YCbCr color space type.
  7547. This allows the autodetected value to be overridden as well as allows forcing
  7548. a specific value used for the output and encoder.
  7549. If not specified, the color space type depends on the pixel format.
  7550. Possible values:
  7551. @table @samp
  7552. @item auto
  7553. Choose automatically.
  7554. @item bt709
  7555. Format conforming to International Telecommunication Union (ITU)
  7556. Recommendation BT.709.
  7557. @item fcc
  7558. Set color space conforming to the United States Federal Communications
  7559. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  7560. @item bt601
  7561. Set color space conforming to:
  7562. @itemize
  7563. @item
  7564. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  7565. @item
  7566. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  7567. @item
  7568. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  7569. @end itemize
  7570. @item smpte240m
  7571. Set color space conforming to SMPTE ST 240:1999.
  7572. @end table
  7573. @item in_range
  7574. @item out_range
  7575. Set in/output YCbCr sample range.
  7576. This allows the autodetected value to be overridden as well as allows forcing
  7577. a specific value used for the output and encoder. If not specified, the
  7578. range depends on the pixel format. Possible values:
  7579. @table @samp
  7580. @item auto
  7581. Choose automatically.
  7582. @item jpeg/full/pc
  7583. Set full range (0-255 in case of 8-bit luma).
  7584. @item mpeg/tv
  7585. Set "MPEG" range (16-235 in case of 8-bit luma).
  7586. @end table
  7587. @item force_original_aspect_ratio
  7588. Enable decreasing or increasing output video width or height if necessary to
  7589. keep the original aspect ratio. Possible values:
  7590. @table @samp
  7591. @item disable
  7592. Scale the video as specified and disable this feature.
  7593. @item decrease
  7594. The output video dimensions will automatically be decreased if needed.
  7595. @item increase
  7596. The output video dimensions will automatically be increased if needed.
  7597. @end table
  7598. One useful instance of this option is that when you know a specific device's
  7599. maximum allowed resolution, you can use this to limit the output video to
  7600. that, while retaining the aspect ratio. For example, device A allows
  7601. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  7602. decrease) and specifying 1280x720 to the command line makes the output
  7603. 1280x533.
  7604. Please note that this is a different thing than specifying -1 for @option{w}
  7605. or @option{h}, you still need to specify the output resolution for this option
  7606. to work.
  7607. @end table
  7608. The values of the @option{w} and @option{h} options are expressions
  7609. containing the following constants:
  7610. @table @var
  7611. @item in_w
  7612. @item in_h
  7613. The input width and height
  7614. @item iw
  7615. @item ih
  7616. These are the same as @var{in_w} and @var{in_h}.
  7617. @item out_w
  7618. @item out_h
  7619. The output (scaled) width and height
  7620. @item ow
  7621. @item oh
  7622. These are the same as @var{out_w} and @var{out_h}
  7623. @item a
  7624. The same as @var{iw} / @var{ih}
  7625. @item sar
  7626. input sample aspect ratio
  7627. @item dar
  7628. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  7629. @item hsub
  7630. @item vsub
  7631. horizontal and vertical input chroma subsample values. For example for the
  7632. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7633. @item ohsub
  7634. @item ovsub
  7635. horizontal and vertical output chroma subsample values. For example for the
  7636. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7637. @end table
  7638. @subsection Examples
  7639. @itemize
  7640. @item
  7641. Scale the input video to a size of 200x100
  7642. @example
  7643. scale=w=200:h=100
  7644. @end example
  7645. This is equivalent to:
  7646. @example
  7647. scale=200:100
  7648. @end example
  7649. or:
  7650. @example
  7651. scale=200x100
  7652. @end example
  7653. @item
  7654. Specify a size abbreviation for the output size:
  7655. @example
  7656. scale=qcif
  7657. @end example
  7658. which can also be written as:
  7659. @example
  7660. scale=size=qcif
  7661. @end example
  7662. @item
  7663. Scale the input to 2x:
  7664. @example
  7665. scale=w=2*iw:h=2*ih
  7666. @end example
  7667. @item
  7668. The above is the same as:
  7669. @example
  7670. scale=2*in_w:2*in_h
  7671. @end example
  7672. @item
  7673. Scale the input to 2x with forced interlaced scaling:
  7674. @example
  7675. scale=2*iw:2*ih:interl=1
  7676. @end example
  7677. @item
  7678. Scale the input to half size:
  7679. @example
  7680. scale=w=iw/2:h=ih/2
  7681. @end example
  7682. @item
  7683. Increase the width, and set the height to the same size:
  7684. @example
  7685. scale=3/2*iw:ow
  7686. @end example
  7687. @item
  7688. Seek Greek harmony:
  7689. @example
  7690. scale=iw:1/PHI*iw
  7691. scale=ih*PHI:ih
  7692. @end example
  7693. @item
  7694. Increase the height, and set the width to 3/2 of the height:
  7695. @example
  7696. scale=w=3/2*oh:h=3/5*ih
  7697. @end example
  7698. @item
  7699. Increase the size, making the size a multiple of the chroma
  7700. subsample values:
  7701. @example
  7702. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  7703. @end example
  7704. @item
  7705. Increase the width to a maximum of 500 pixels,
  7706. keeping the same aspect ratio as the input:
  7707. @example
  7708. scale=w='min(500\, iw*3/2):h=-1'
  7709. @end example
  7710. @end itemize
  7711. @subsection Commands
  7712. This filter supports the following commands:
  7713. @table @option
  7714. @item width, w
  7715. @item height, h
  7716. Set the output video dimension expression.
  7717. The command accepts the same syntax of the corresponding option.
  7718. If the specified expression is not valid, it is kept at its current
  7719. value.
  7720. @end table
  7721. @section scale2ref
  7722. Scale (resize) the input video, based on a reference video.
  7723. See the scale filter for available options, scale2ref supports the same but
  7724. uses the reference video instead of the main input as basis.
  7725. @subsection Examples
  7726. @itemize
  7727. @item
  7728. Scale a subtitle stream to match the main video in size before overlaying
  7729. @example
  7730. 'scale2ref[b][a];[a][b]overlay'
  7731. @end example
  7732. @end itemize
  7733. @section separatefields
  7734. The @code{separatefields} takes a frame-based video input and splits
  7735. each frame into its components fields, producing a new half height clip
  7736. with twice the frame rate and twice the frame count.
  7737. This filter use field-dominance information in frame to decide which
  7738. of each pair of fields to place first in the output.
  7739. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  7740. @section setdar, setsar
  7741. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  7742. output video.
  7743. This is done by changing the specified Sample (aka Pixel) Aspect
  7744. Ratio, according to the following equation:
  7745. @example
  7746. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  7747. @end example
  7748. Keep in mind that the @code{setdar} filter does not modify the pixel
  7749. dimensions of the video frame. Also, the display aspect ratio set by
  7750. this filter may be changed by later filters in the filterchain,
  7751. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  7752. applied.
  7753. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  7754. the filter output video.
  7755. Note that as a consequence of the application of this filter, the
  7756. output display aspect ratio will change according to the equation
  7757. above.
  7758. Keep in mind that the sample aspect ratio set by the @code{setsar}
  7759. filter may be changed by later filters in the filterchain, e.g. if
  7760. another "setsar" or a "setdar" filter is applied.
  7761. It accepts the following parameters:
  7762. @table @option
  7763. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  7764. Set the aspect ratio used by the filter.
  7765. The parameter can be a floating point number string, an expression, or
  7766. a string of the form @var{num}:@var{den}, where @var{num} and
  7767. @var{den} are the numerator and denominator of the aspect ratio. If
  7768. the parameter is not specified, it is assumed the value "0".
  7769. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  7770. should be escaped.
  7771. @item max
  7772. Set the maximum integer value to use for expressing numerator and
  7773. denominator when reducing the expressed aspect ratio to a rational.
  7774. Default value is @code{100}.
  7775. @end table
  7776. The parameter @var{sar} is an expression containing
  7777. the following constants:
  7778. @table @option
  7779. @item E, PI, PHI
  7780. These are approximated values for the mathematical constants e
  7781. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  7782. @item w, h
  7783. The input width and height.
  7784. @item a
  7785. These are the same as @var{w} / @var{h}.
  7786. @item sar
  7787. The input sample aspect ratio.
  7788. @item dar
  7789. The input display aspect ratio. It is the same as
  7790. (@var{w} / @var{h}) * @var{sar}.
  7791. @item hsub, vsub
  7792. Horizontal and vertical chroma subsample values. For example, for the
  7793. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7794. @end table
  7795. @subsection Examples
  7796. @itemize
  7797. @item
  7798. To change the display aspect ratio to 16:9, specify one of the following:
  7799. @example
  7800. setdar=dar=1.77777
  7801. setdar=dar=16/9
  7802. setdar=dar=1.77777
  7803. @end example
  7804. @item
  7805. To change the sample aspect ratio to 10:11, specify:
  7806. @example
  7807. setsar=sar=10/11
  7808. @end example
  7809. @item
  7810. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  7811. 1000 in the aspect ratio reduction, use the command:
  7812. @example
  7813. setdar=ratio=16/9:max=1000
  7814. @end example
  7815. @end itemize
  7816. @anchor{setfield}
  7817. @section setfield
  7818. Force field for the output video frame.
  7819. The @code{setfield} filter marks the interlace type field for the
  7820. output frames. It does not change the input frame, but only sets the
  7821. corresponding property, which affects how the frame is treated by
  7822. following filters (e.g. @code{fieldorder} or @code{yadif}).
  7823. The filter accepts the following options:
  7824. @table @option
  7825. @item mode
  7826. Available values are:
  7827. @table @samp
  7828. @item auto
  7829. Keep the same field property.
  7830. @item bff
  7831. Mark the frame as bottom-field-first.
  7832. @item tff
  7833. Mark the frame as top-field-first.
  7834. @item prog
  7835. Mark the frame as progressive.
  7836. @end table
  7837. @end table
  7838. @section showinfo
  7839. Show a line containing various information for each input video frame.
  7840. The input video is not modified.
  7841. The shown line contains a sequence of key/value pairs of the form
  7842. @var{key}:@var{value}.
  7843. The following values are shown in the output:
  7844. @table @option
  7845. @item n
  7846. The (sequential) number of the input frame, starting from 0.
  7847. @item pts
  7848. The Presentation TimeStamp of the input frame, expressed as a number of
  7849. time base units. The time base unit depends on the filter input pad.
  7850. @item pts_time
  7851. The Presentation TimeStamp of the input frame, expressed as a number of
  7852. seconds.
  7853. @item pos
  7854. The position of the frame in the input stream, or -1 if this information is
  7855. unavailable and/or meaningless (for example in case of synthetic video).
  7856. @item fmt
  7857. The pixel format name.
  7858. @item sar
  7859. The sample aspect ratio of the input frame, expressed in the form
  7860. @var{num}/@var{den}.
  7861. @item s
  7862. The size of the input frame. For the syntax of this option, check the
  7863. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7864. @item i
  7865. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  7866. for bottom field first).
  7867. @item iskey
  7868. This is 1 if the frame is a key frame, 0 otherwise.
  7869. @item type
  7870. The picture type of the input frame ("I" for an I-frame, "P" for a
  7871. P-frame, "B" for a B-frame, or "?" for an unknown type).
  7872. Also refer to the documentation of the @code{AVPictureType} enum and of
  7873. the @code{av_get_picture_type_char} function defined in
  7874. @file{libavutil/avutil.h}.
  7875. @item checksum
  7876. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  7877. @item plane_checksum
  7878. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  7879. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  7880. @end table
  7881. @section showpalette
  7882. Displays the 256 colors palette of each frame. This filter is only relevant for
  7883. @var{pal8} pixel format frames.
  7884. It accepts the following option:
  7885. @table @option
  7886. @item s
  7887. Set the size of the box used to represent one palette color entry. Default is
  7888. @code{30} (for a @code{30x30} pixel box).
  7889. @end table
  7890. @section shuffleframes
  7891. Reorder and/or duplicate video frames.
  7892. It accepts the following parameters:
  7893. @table @option
  7894. @item mapping
  7895. Set the destination indexes of input frames.
  7896. This is space or '|' separated list of indexes that maps input frames to output
  7897. frames. Number of indexes also sets maximal value that each index may have.
  7898. @end table
  7899. The first frame has the index 0. The default is to keep the input unchanged.
  7900. Swap second and third frame of every three frames of the input:
  7901. @example
  7902. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  7903. @end example
  7904. @section shuffleplanes
  7905. Reorder and/or duplicate video planes.
  7906. It accepts the following parameters:
  7907. @table @option
  7908. @item map0
  7909. The index of the input plane to be used as the first output plane.
  7910. @item map1
  7911. The index of the input plane to be used as the second output plane.
  7912. @item map2
  7913. The index of the input plane to be used as the third output plane.
  7914. @item map3
  7915. The index of the input plane to be used as the fourth output plane.
  7916. @end table
  7917. The first plane has the index 0. The default is to keep the input unchanged.
  7918. Swap the second and third planes of the input:
  7919. @example
  7920. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  7921. @end example
  7922. @anchor{signalstats}
  7923. @section signalstats
  7924. Evaluate various visual metrics that assist in determining issues associated
  7925. with the digitization of analog video media.
  7926. By default the filter will log these metadata values:
  7927. @table @option
  7928. @item YMIN
  7929. Display the minimal Y value contained within the input frame. Expressed in
  7930. range of [0-255].
  7931. @item YLOW
  7932. Display the Y value at the 10% percentile within the input frame. Expressed in
  7933. range of [0-255].
  7934. @item YAVG
  7935. Display the average Y value within the input frame. Expressed in range of
  7936. [0-255].
  7937. @item YHIGH
  7938. Display the Y value at the 90% percentile within the input frame. Expressed in
  7939. range of [0-255].
  7940. @item YMAX
  7941. Display the maximum Y value contained within the input frame. Expressed in
  7942. range of [0-255].
  7943. @item UMIN
  7944. Display the minimal U value contained within the input frame. Expressed in
  7945. range of [0-255].
  7946. @item ULOW
  7947. Display the U value at the 10% percentile within the input frame. Expressed in
  7948. range of [0-255].
  7949. @item UAVG
  7950. Display the average U value within the input frame. Expressed in range of
  7951. [0-255].
  7952. @item UHIGH
  7953. Display the U value at the 90% percentile within the input frame. Expressed in
  7954. range of [0-255].
  7955. @item UMAX
  7956. Display the maximum U value contained within the input frame. Expressed in
  7957. range of [0-255].
  7958. @item VMIN
  7959. Display the minimal V value contained within the input frame. Expressed in
  7960. range of [0-255].
  7961. @item VLOW
  7962. Display the V value at the 10% percentile within the input frame. Expressed in
  7963. range of [0-255].
  7964. @item VAVG
  7965. Display the average V value within the input frame. Expressed in range of
  7966. [0-255].
  7967. @item VHIGH
  7968. Display the V value at the 90% percentile within the input frame. Expressed in
  7969. range of [0-255].
  7970. @item VMAX
  7971. Display the maximum V value contained within the input frame. Expressed in
  7972. range of [0-255].
  7973. @item SATMIN
  7974. Display the minimal saturation value contained within the input frame.
  7975. Expressed in range of [0-~181.02].
  7976. @item SATLOW
  7977. Display the saturation value at the 10% percentile within the input frame.
  7978. Expressed in range of [0-~181.02].
  7979. @item SATAVG
  7980. Display the average saturation value within the input frame. Expressed in range
  7981. of [0-~181.02].
  7982. @item SATHIGH
  7983. Display the saturation value at the 90% percentile within the input frame.
  7984. Expressed in range of [0-~181.02].
  7985. @item SATMAX
  7986. Display the maximum saturation value contained within the input frame.
  7987. Expressed in range of [0-~181.02].
  7988. @item HUEMED
  7989. Display the median value for hue within the input frame. Expressed in range of
  7990. [0-360].
  7991. @item HUEAVG
  7992. Display the average value for hue within the input frame. Expressed in range of
  7993. [0-360].
  7994. @item YDIF
  7995. Display the average of sample value difference between all values of the Y
  7996. plane in the current frame and corresponding values of the previous input frame.
  7997. Expressed in range of [0-255].
  7998. @item UDIF
  7999. Display the average of sample value difference between all values of the U
  8000. plane in the current frame and corresponding values of the previous input frame.
  8001. Expressed in range of [0-255].
  8002. @item VDIF
  8003. Display the average of sample value difference between all values of the V
  8004. plane in the current frame and corresponding values of the previous input frame.
  8005. Expressed in range of [0-255].
  8006. @end table
  8007. The filter accepts the following options:
  8008. @table @option
  8009. @item stat
  8010. @item out
  8011. @option{stat} specify an additional form of image analysis.
  8012. @option{out} output video with the specified type of pixel highlighted.
  8013. Both options accept the following values:
  8014. @table @samp
  8015. @item tout
  8016. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  8017. unlike the neighboring pixels of the same field. Examples of temporal outliers
  8018. include the results of video dropouts, head clogs, or tape tracking issues.
  8019. @item vrep
  8020. Identify @var{vertical line repetition}. Vertical line repetition includes
  8021. similar rows of pixels within a frame. In born-digital video vertical line
  8022. repetition is common, but this pattern is uncommon in video digitized from an
  8023. analog source. When it occurs in video that results from the digitization of an
  8024. analog source it can indicate concealment from a dropout compensator.
  8025. @item brng
  8026. Identify pixels that fall outside of legal broadcast range.
  8027. @end table
  8028. @item color, c
  8029. Set the highlight color for the @option{out} option. The default color is
  8030. yellow.
  8031. @end table
  8032. @subsection Examples
  8033. @itemize
  8034. @item
  8035. Output data of various video metrics:
  8036. @example
  8037. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  8038. @end example
  8039. @item
  8040. Output specific data about the minimum and maximum values of the Y plane per frame:
  8041. @example
  8042. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  8043. @end example
  8044. @item
  8045. Playback video while highlighting pixels that are outside of broadcast range in red.
  8046. @example
  8047. ffplay example.mov -vf signalstats="out=brng:color=red"
  8048. @end example
  8049. @item
  8050. Playback video with signalstats metadata drawn over the frame.
  8051. @example
  8052. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  8053. @end example
  8054. The contents of signalstat_drawtext.txt used in the command are:
  8055. @example
  8056. time %@{pts:hms@}
  8057. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  8058. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  8059. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  8060. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  8061. @end example
  8062. @end itemize
  8063. @anchor{smartblur}
  8064. @section smartblur
  8065. Blur the input video without impacting the outlines.
  8066. It accepts the following options:
  8067. @table @option
  8068. @item luma_radius, lr
  8069. Set the luma radius. The option value must be a float number in
  8070. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8071. used to blur the image (slower if larger). Default value is 1.0.
  8072. @item luma_strength, ls
  8073. Set the luma strength. The option value must be a float number
  8074. in the range [-1.0,1.0] that configures the blurring. A value included
  8075. in [0.0,1.0] will blur the image whereas a value included in
  8076. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8077. @item luma_threshold, lt
  8078. Set the luma threshold used as a coefficient to determine
  8079. whether a pixel should be blurred or not. The option value must be an
  8080. integer in the range [-30,30]. A value of 0 will filter all the image,
  8081. a value included in [0,30] will filter flat areas and a value included
  8082. in [-30,0] will filter edges. Default value is 0.
  8083. @item chroma_radius, cr
  8084. Set the chroma radius. The option value must be a float number in
  8085. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8086. used to blur the image (slower if larger). Default value is 1.0.
  8087. @item chroma_strength, cs
  8088. Set the chroma strength. The option value must be a float number
  8089. in the range [-1.0,1.0] that configures the blurring. A value included
  8090. in [0.0,1.0] will blur the image whereas a value included in
  8091. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8092. @item chroma_threshold, ct
  8093. Set the chroma threshold used as a coefficient to determine
  8094. whether a pixel should be blurred or not. The option value must be an
  8095. integer in the range [-30,30]. A value of 0 will filter all the image,
  8096. a value included in [0,30] will filter flat areas and a value included
  8097. in [-30,0] will filter edges. Default value is 0.
  8098. @end table
  8099. If a chroma option is not explicitly set, the corresponding luma value
  8100. is set.
  8101. @section ssim
  8102. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  8103. This filter takes in input two input videos, the first input is
  8104. considered the "main" source and is passed unchanged to the
  8105. output. The second input is used as a "reference" video for computing
  8106. the SSIM.
  8107. Both video inputs must have the same resolution and pixel format for
  8108. this filter to work correctly. Also it assumes that both inputs
  8109. have the same number of frames, which are compared one by one.
  8110. The filter stores the calculated SSIM of each frame.
  8111. The description of the accepted parameters follows.
  8112. @table @option
  8113. @item stats_file, f
  8114. If specified the filter will use the named file to save the SSIM of
  8115. each individual frame. When filename equals "-" the data is sent to
  8116. standard output.
  8117. @end table
  8118. The file printed if @var{stats_file} is selected, contains a sequence of
  8119. key/value pairs of the form @var{key}:@var{value} for each compared
  8120. couple of frames.
  8121. A description of each shown parameter follows:
  8122. @table @option
  8123. @item n
  8124. sequential number of the input frame, starting from 1
  8125. @item Y, U, V, R, G, B
  8126. SSIM of the compared frames for the component specified by the suffix.
  8127. @item All
  8128. SSIM of the compared frames for the whole frame.
  8129. @item dB
  8130. Same as above but in dB representation.
  8131. @end table
  8132. For example:
  8133. @example
  8134. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8135. [main][ref] ssim="stats_file=stats.log" [out]
  8136. @end example
  8137. On this example the input file being processed is compared with the
  8138. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  8139. is stored in @file{stats.log}.
  8140. Another example with both psnr and ssim at same time:
  8141. @example
  8142. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  8143. @end example
  8144. @section stereo3d
  8145. Convert between different stereoscopic image formats.
  8146. The filters accept the following options:
  8147. @table @option
  8148. @item in
  8149. Set stereoscopic image format of input.
  8150. Available values for input image formats are:
  8151. @table @samp
  8152. @item sbsl
  8153. side by side parallel (left eye left, right eye right)
  8154. @item sbsr
  8155. side by side crosseye (right eye left, left eye right)
  8156. @item sbs2l
  8157. side by side parallel with half width resolution
  8158. (left eye left, right eye right)
  8159. @item sbs2r
  8160. side by side crosseye with half width resolution
  8161. (right eye left, left eye right)
  8162. @item abl
  8163. above-below (left eye above, right eye below)
  8164. @item abr
  8165. above-below (right eye above, left eye below)
  8166. @item ab2l
  8167. above-below with half height resolution
  8168. (left eye above, right eye below)
  8169. @item ab2r
  8170. above-below with half height resolution
  8171. (right eye above, left eye below)
  8172. @item al
  8173. alternating frames (left eye first, right eye second)
  8174. @item ar
  8175. alternating frames (right eye first, left eye second)
  8176. @item irl
  8177. interleaved rows (left eye has top row, right eye starts on next row)
  8178. @item irr
  8179. interleaved rows (right eye has top row, left eye starts on next row)
  8180. Default value is @samp{sbsl}.
  8181. @end table
  8182. @item out
  8183. Set stereoscopic image format of output.
  8184. Available values for output image formats are all the input formats as well as:
  8185. @table @samp
  8186. @item arbg
  8187. anaglyph red/blue gray
  8188. (red filter on left eye, blue filter on right eye)
  8189. @item argg
  8190. anaglyph red/green gray
  8191. (red filter on left eye, green filter on right eye)
  8192. @item arcg
  8193. anaglyph red/cyan gray
  8194. (red filter on left eye, cyan filter on right eye)
  8195. @item arch
  8196. anaglyph red/cyan half colored
  8197. (red filter on left eye, cyan filter on right eye)
  8198. @item arcc
  8199. anaglyph red/cyan color
  8200. (red filter on left eye, cyan filter on right eye)
  8201. @item arcd
  8202. anaglyph red/cyan color optimized with the least squares projection of dubois
  8203. (red filter on left eye, cyan filter on right eye)
  8204. @item agmg
  8205. anaglyph green/magenta gray
  8206. (green filter on left eye, magenta filter on right eye)
  8207. @item agmh
  8208. anaglyph green/magenta half colored
  8209. (green filter on left eye, magenta filter on right eye)
  8210. @item agmc
  8211. anaglyph green/magenta colored
  8212. (green filter on left eye, magenta filter on right eye)
  8213. @item agmd
  8214. anaglyph green/magenta color optimized with the least squares projection of dubois
  8215. (green filter on left eye, magenta filter on right eye)
  8216. @item aybg
  8217. anaglyph yellow/blue gray
  8218. (yellow filter on left eye, blue filter on right eye)
  8219. @item aybh
  8220. anaglyph yellow/blue half colored
  8221. (yellow filter on left eye, blue filter on right eye)
  8222. @item aybc
  8223. anaglyph yellow/blue colored
  8224. (yellow filter on left eye, blue filter on right eye)
  8225. @item aybd
  8226. anaglyph yellow/blue color optimized with the least squares projection of dubois
  8227. (yellow filter on left eye, blue filter on right eye)
  8228. @item ml
  8229. mono output (left eye only)
  8230. @item mr
  8231. mono output (right eye only)
  8232. @item chl
  8233. checkerboard, left eye first
  8234. @item chr
  8235. checkerboard, right eye first
  8236. @item icl
  8237. interleaved columns, left eye first
  8238. @item icr
  8239. interleaved columns, right eye first
  8240. @end table
  8241. Default value is @samp{arcd}.
  8242. @end table
  8243. @subsection Examples
  8244. @itemize
  8245. @item
  8246. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  8247. @example
  8248. stereo3d=sbsl:aybd
  8249. @end example
  8250. @item
  8251. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  8252. @example
  8253. stereo3d=abl:sbsr
  8254. @end example
  8255. @end itemize
  8256. @anchor{spp}
  8257. @section spp
  8258. Apply a simple postprocessing filter that compresses and decompresses the image
  8259. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  8260. and average the results.
  8261. The filter accepts the following options:
  8262. @table @option
  8263. @item quality
  8264. Set quality. This option defines the number of levels for averaging. It accepts
  8265. an integer in the range 0-6. If set to @code{0}, the filter will have no
  8266. effect. A value of @code{6} means the higher quality. For each increment of
  8267. that value the speed drops by a factor of approximately 2. Default value is
  8268. @code{3}.
  8269. @item qp
  8270. Force a constant quantization parameter. If not set, the filter will use the QP
  8271. from the video stream (if available).
  8272. @item mode
  8273. Set thresholding mode. Available modes are:
  8274. @table @samp
  8275. @item hard
  8276. Set hard thresholding (default).
  8277. @item soft
  8278. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8279. @end table
  8280. @item use_bframe_qp
  8281. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8282. option may cause flicker since the B-Frames have often larger QP. Default is
  8283. @code{0} (not enabled).
  8284. @end table
  8285. @anchor{subtitles}
  8286. @section subtitles
  8287. Draw subtitles on top of input video using the libass library.
  8288. To enable compilation of this filter you need to configure FFmpeg with
  8289. @code{--enable-libass}. This filter also requires a build with libavcodec and
  8290. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  8291. Alpha) subtitles format.
  8292. The filter accepts the following options:
  8293. @table @option
  8294. @item filename, f
  8295. Set the filename of the subtitle file to read. It must be specified.
  8296. @item original_size
  8297. Specify the size of the original video, the video for which the ASS file
  8298. was composed. For the syntax of this option, check the
  8299. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8300. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  8301. correctly scale the fonts if the aspect ratio has been changed.
  8302. @item fontsdir
  8303. Set a directory path containing fonts that can be used by the filter.
  8304. These fonts will be used in addition to whatever the font provider uses.
  8305. @item charenc
  8306. Set subtitles input character encoding. @code{subtitles} filter only. Only
  8307. useful if not UTF-8.
  8308. @item stream_index, si
  8309. Set subtitles stream index. @code{subtitles} filter only.
  8310. @item force_style
  8311. Override default style or script info parameters of the subtitles. It accepts a
  8312. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  8313. @end table
  8314. If the first key is not specified, it is assumed that the first value
  8315. specifies the @option{filename}.
  8316. For example, to render the file @file{sub.srt} on top of the input
  8317. video, use the command:
  8318. @example
  8319. subtitles=sub.srt
  8320. @end example
  8321. which is equivalent to:
  8322. @example
  8323. subtitles=filename=sub.srt
  8324. @end example
  8325. To render the default subtitles stream from file @file{video.mkv}, use:
  8326. @example
  8327. subtitles=video.mkv
  8328. @end example
  8329. To render the second subtitles stream from that file, use:
  8330. @example
  8331. subtitles=video.mkv:si=1
  8332. @end example
  8333. To make the subtitles stream from @file{sub.srt} appear in transparent green
  8334. @code{DejaVu Serif}, use:
  8335. @example
  8336. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  8337. @end example
  8338. @section super2xsai
  8339. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  8340. Interpolate) pixel art scaling algorithm.
  8341. Useful for enlarging pixel art images without reducing sharpness.
  8342. @section swapuv
  8343. Swap U & V plane.
  8344. @section telecine
  8345. Apply telecine process to the video.
  8346. This filter accepts the following options:
  8347. @table @option
  8348. @item first_field
  8349. @table @samp
  8350. @item top, t
  8351. top field first
  8352. @item bottom, b
  8353. bottom field first
  8354. The default value is @code{top}.
  8355. @end table
  8356. @item pattern
  8357. A string of numbers representing the pulldown pattern you wish to apply.
  8358. The default value is @code{23}.
  8359. @end table
  8360. @example
  8361. Some typical patterns:
  8362. NTSC output (30i):
  8363. 27.5p: 32222
  8364. 24p: 23 (classic)
  8365. 24p: 2332 (preferred)
  8366. 20p: 33
  8367. 18p: 334
  8368. 16p: 3444
  8369. PAL output (25i):
  8370. 27.5p: 12222
  8371. 24p: 222222222223 ("Euro pulldown")
  8372. 16.67p: 33
  8373. 16p: 33333334
  8374. @end example
  8375. @section thumbnail
  8376. Select the most representative frame in a given sequence of consecutive frames.
  8377. The filter accepts the following options:
  8378. @table @option
  8379. @item n
  8380. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  8381. will pick one of them, and then handle the next batch of @var{n} frames until
  8382. the end. Default is @code{100}.
  8383. @end table
  8384. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  8385. value will result in a higher memory usage, so a high value is not recommended.
  8386. @subsection Examples
  8387. @itemize
  8388. @item
  8389. Extract one picture each 50 frames:
  8390. @example
  8391. thumbnail=50
  8392. @end example
  8393. @item
  8394. Complete example of a thumbnail creation with @command{ffmpeg}:
  8395. @example
  8396. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  8397. @end example
  8398. @end itemize
  8399. @section tile
  8400. Tile several successive frames together.
  8401. The filter accepts the following options:
  8402. @table @option
  8403. @item layout
  8404. Set the grid size (i.e. the number of lines and columns). For the syntax of
  8405. this option, check the
  8406. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8407. @item nb_frames
  8408. Set the maximum number of frames to render in the given area. It must be less
  8409. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  8410. the area will be used.
  8411. @item margin
  8412. Set the outer border margin in pixels.
  8413. @item padding
  8414. Set the inner border thickness (i.e. the number of pixels between frames). For
  8415. more advanced padding options (such as having different values for the edges),
  8416. refer to the pad video filter.
  8417. @item color
  8418. Specify the color of the unused area. For the syntax of this option, check the
  8419. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  8420. is "black".
  8421. @end table
  8422. @subsection Examples
  8423. @itemize
  8424. @item
  8425. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  8426. @example
  8427. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  8428. @end example
  8429. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  8430. duplicating each output frame to accommodate the originally detected frame
  8431. rate.
  8432. @item
  8433. Display @code{5} pictures in an area of @code{3x2} frames,
  8434. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  8435. mixed flat and named options:
  8436. @example
  8437. tile=3x2:nb_frames=5:padding=7:margin=2
  8438. @end example
  8439. @end itemize
  8440. @section tinterlace
  8441. Perform various types of temporal field interlacing.
  8442. Frames are counted starting from 1, so the first input frame is
  8443. considered odd.
  8444. The filter accepts the following options:
  8445. @table @option
  8446. @item mode
  8447. Specify the mode of the interlacing. This option can also be specified
  8448. as a value alone. See below for a list of values for this option.
  8449. Available values are:
  8450. @table @samp
  8451. @item merge, 0
  8452. Move odd frames into the upper field, even into the lower field,
  8453. generating a double height frame at half frame rate.
  8454. @example
  8455. ------> time
  8456. Input:
  8457. Frame 1 Frame 2 Frame 3 Frame 4
  8458. 11111 22222 33333 44444
  8459. 11111 22222 33333 44444
  8460. 11111 22222 33333 44444
  8461. 11111 22222 33333 44444
  8462. Output:
  8463. 11111 33333
  8464. 22222 44444
  8465. 11111 33333
  8466. 22222 44444
  8467. 11111 33333
  8468. 22222 44444
  8469. 11111 33333
  8470. 22222 44444
  8471. @end example
  8472. @item drop_odd, 1
  8473. Only output even frames, odd frames are dropped, generating a frame with
  8474. unchanged height at half frame rate.
  8475. @example
  8476. ------> time
  8477. Input:
  8478. Frame 1 Frame 2 Frame 3 Frame 4
  8479. 11111 22222 33333 44444
  8480. 11111 22222 33333 44444
  8481. 11111 22222 33333 44444
  8482. 11111 22222 33333 44444
  8483. Output:
  8484. 22222 44444
  8485. 22222 44444
  8486. 22222 44444
  8487. 22222 44444
  8488. @end example
  8489. @item drop_even, 2
  8490. Only output odd frames, even frames are dropped, generating a frame with
  8491. unchanged height at half frame rate.
  8492. @example
  8493. ------> time
  8494. Input:
  8495. Frame 1 Frame 2 Frame 3 Frame 4
  8496. 11111 22222 33333 44444
  8497. 11111 22222 33333 44444
  8498. 11111 22222 33333 44444
  8499. 11111 22222 33333 44444
  8500. Output:
  8501. 11111 33333
  8502. 11111 33333
  8503. 11111 33333
  8504. 11111 33333
  8505. @end example
  8506. @item pad, 3
  8507. Expand each frame to full height, but pad alternate lines with black,
  8508. generating a frame with double height at the same input frame rate.
  8509. @example
  8510. ------> time
  8511. Input:
  8512. Frame 1 Frame 2 Frame 3 Frame 4
  8513. 11111 22222 33333 44444
  8514. 11111 22222 33333 44444
  8515. 11111 22222 33333 44444
  8516. 11111 22222 33333 44444
  8517. Output:
  8518. 11111 ..... 33333 .....
  8519. ..... 22222 ..... 44444
  8520. 11111 ..... 33333 .....
  8521. ..... 22222 ..... 44444
  8522. 11111 ..... 33333 .....
  8523. ..... 22222 ..... 44444
  8524. 11111 ..... 33333 .....
  8525. ..... 22222 ..... 44444
  8526. @end example
  8527. @item interleave_top, 4
  8528. Interleave the upper field from odd frames with the lower field from
  8529. even frames, generating a frame with unchanged height at half frame rate.
  8530. @example
  8531. ------> time
  8532. Input:
  8533. Frame 1 Frame 2 Frame 3 Frame 4
  8534. 11111<- 22222 33333<- 44444
  8535. 11111 22222<- 33333 44444<-
  8536. 11111<- 22222 33333<- 44444
  8537. 11111 22222<- 33333 44444<-
  8538. Output:
  8539. 11111 33333
  8540. 22222 44444
  8541. 11111 33333
  8542. 22222 44444
  8543. @end example
  8544. @item interleave_bottom, 5
  8545. Interleave the lower field from odd frames with the upper field from
  8546. even frames, generating a frame with unchanged height at half frame rate.
  8547. @example
  8548. ------> time
  8549. Input:
  8550. Frame 1 Frame 2 Frame 3 Frame 4
  8551. 11111 22222<- 33333 44444<-
  8552. 11111<- 22222 33333<- 44444
  8553. 11111 22222<- 33333 44444<-
  8554. 11111<- 22222 33333<- 44444
  8555. Output:
  8556. 22222 44444
  8557. 11111 33333
  8558. 22222 44444
  8559. 11111 33333
  8560. @end example
  8561. @item interlacex2, 6
  8562. Double frame rate with unchanged height. Frames are inserted each
  8563. containing the second temporal field from the previous input frame and
  8564. the first temporal field from the next input frame. This mode relies on
  8565. the top_field_first flag. Useful for interlaced video displays with no
  8566. field synchronisation.
  8567. @example
  8568. ------> time
  8569. Input:
  8570. Frame 1 Frame 2 Frame 3 Frame 4
  8571. 11111 22222 33333 44444
  8572. 11111 22222 33333 44444
  8573. 11111 22222 33333 44444
  8574. 11111 22222 33333 44444
  8575. Output:
  8576. 11111 22222 22222 33333 33333 44444 44444
  8577. 11111 11111 22222 22222 33333 33333 44444
  8578. 11111 22222 22222 33333 33333 44444 44444
  8579. 11111 11111 22222 22222 33333 33333 44444
  8580. @end example
  8581. @item mergex2, 7
  8582. Move odd frames into the upper field, even into the lower field,
  8583. generating a double height frame at same frame rate.
  8584. @example
  8585. ------> time
  8586. Input:
  8587. Frame 1 Frame 2 Frame 3 Frame 4
  8588. 11111 22222 33333 44444
  8589. 11111 22222 33333 44444
  8590. 11111 22222 33333 44444
  8591. 11111 22222 33333 44444
  8592. Output:
  8593. 11111 33333 33333 55555
  8594. 22222 22222 44444 44444
  8595. 11111 33333 33333 55555
  8596. 22222 22222 44444 44444
  8597. 11111 33333 33333 55555
  8598. 22222 22222 44444 44444
  8599. 11111 33333 33333 55555
  8600. 22222 22222 44444 44444
  8601. @end example
  8602. @end table
  8603. Numeric values are deprecated but are accepted for backward
  8604. compatibility reasons.
  8605. Default mode is @code{merge}.
  8606. @item flags
  8607. Specify flags influencing the filter process.
  8608. Available value for @var{flags} is:
  8609. @table @option
  8610. @item low_pass_filter, vlfp
  8611. Enable vertical low-pass filtering in the filter.
  8612. Vertical low-pass filtering is required when creating an interlaced
  8613. destination from a progressive source which contains high-frequency
  8614. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  8615. patterning.
  8616. Vertical low-pass filtering can only be enabled for @option{mode}
  8617. @var{interleave_top} and @var{interleave_bottom}.
  8618. @end table
  8619. @end table
  8620. @section transpose
  8621. Transpose rows with columns in the input video and optionally flip it.
  8622. It accepts the following parameters:
  8623. @table @option
  8624. @item dir
  8625. Specify the transposition direction.
  8626. Can assume the following values:
  8627. @table @samp
  8628. @item 0, 4, cclock_flip
  8629. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  8630. @example
  8631. L.R L.l
  8632. . . -> . .
  8633. l.r R.r
  8634. @end example
  8635. @item 1, 5, clock
  8636. Rotate by 90 degrees clockwise, that is:
  8637. @example
  8638. L.R l.L
  8639. . . -> . .
  8640. l.r r.R
  8641. @end example
  8642. @item 2, 6, cclock
  8643. Rotate by 90 degrees counterclockwise, that is:
  8644. @example
  8645. L.R R.r
  8646. . . -> . .
  8647. l.r L.l
  8648. @end example
  8649. @item 3, 7, clock_flip
  8650. Rotate by 90 degrees clockwise and vertically flip, that is:
  8651. @example
  8652. L.R r.R
  8653. . . -> . .
  8654. l.r l.L
  8655. @end example
  8656. @end table
  8657. For values between 4-7, the transposition is only done if the input
  8658. video geometry is portrait and not landscape. These values are
  8659. deprecated, the @code{passthrough} option should be used instead.
  8660. Numerical values are deprecated, and should be dropped in favor of
  8661. symbolic constants.
  8662. @item passthrough
  8663. Do not apply the transposition if the input geometry matches the one
  8664. specified by the specified value. It accepts the following values:
  8665. @table @samp
  8666. @item none
  8667. Always apply transposition.
  8668. @item portrait
  8669. Preserve portrait geometry (when @var{height} >= @var{width}).
  8670. @item landscape
  8671. Preserve landscape geometry (when @var{width} >= @var{height}).
  8672. @end table
  8673. Default value is @code{none}.
  8674. @end table
  8675. For example to rotate by 90 degrees clockwise and preserve portrait
  8676. layout:
  8677. @example
  8678. transpose=dir=1:passthrough=portrait
  8679. @end example
  8680. The command above can also be specified as:
  8681. @example
  8682. transpose=1:portrait
  8683. @end example
  8684. @section trim
  8685. Trim the input so that the output contains one continuous subpart of the input.
  8686. It accepts the following parameters:
  8687. @table @option
  8688. @item start
  8689. Specify the time of the start of the kept section, i.e. the frame with the
  8690. timestamp @var{start} will be the first frame in the output.
  8691. @item end
  8692. Specify the time of the first frame that will be dropped, i.e. the frame
  8693. immediately preceding the one with the timestamp @var{end} will be the last
  8694. frame in the output.
  8695. @item start_pts
  8696. This is the same as @var{start}, except this option sets the start timestamp
  8697. in timebase units instead of seconds.
  8698. @item end_pts
  8699. This is the same as @var{end}, except this option sets the end timestamp
  8700. in timebase units instead of seconds.
  8701. @item duration
  8702. The maximum duration of the output in seconds.
  8703. @item start_frame
  8704. The number of the first frame that should be passed to the output.
  8705. @item end_frame
  8706. The number of the first frame that should be dropped.
  8707. @end table
  8708. @option{start}, @option{end}, and @option{duration} are expressed as time
  8709. duration specifications; see
  8710. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  8711. for the accepted syntax.
  8712. Note that the first two sets of the start/end options and the @option{duration}
  8713. option look at the frame timestamp, while the _frame variants simply count the
  8714. frames that pass through the filter. Also note that this filter does not modify
  8715. the timestamps. If you wish for the output timestamps to start at zero, insert a
  8716. setpts filter after the trim filter.
  8717. If multiple start or end options are set, this filter tries to be greedy and
  8718. keep all the frames that match at least one of the specified constraints. To keep
  8719. only the part that matches all the constraints at once, chain multiple trim
  8720. filters.
  8721. The defaults are such that all the input is kept. So it is possible to set e.g.
  8722. just the end values to keep everything before the specified time.
  8723. Examples:
  8724. @itemize
  8725. @item
  8726. Drop everything except the second minute of input:
  8727. @example
  8728. ffmpeg -i INPUT -vf trim=60:120
  8729. @end example
  8730. @item
  8731. Keep only the first second:
  8732. @example
  8733. ffmpeg -i INPUT -vf trim=duration=1
  8734. @end example
  8735. @end itemize
  8736. @anchor{unsharp}
  8737. @section unsharp
  8738. Sharpen or blur the input video.
  8739. It accepts the following parameters:
  8740. @table @option
  8741. @item luma_msize_x, lx
  8742. Set the luma matrix horizontal size. It must be an odd integer between
  8743. 3 and 63. The default value is 5.
  8744. @item luma_msize_y, ly
  8745. Set the luma matrix vertical size. It must be an odd integer between 3
  8746. and 63. The default value is 5.
  8747. @item luma_amount, la
  8748. Set the luma effect strength. It must be a floating point number, reasonable
  8749. values lay between -1.5 and 1.5.
  8750. Negative values will blur the input video, while positive values will
  8751. sharpen it, a value of zero will disable the effect.
  8752. Default value is 1.0.
  8753. @item chroma_msize_x, cx
  8754. Set the chroma matrix horizontal size. It must be an odd integer
  8755. between 3 and 63. The default value is 5.
  8756. @item chroma_msize_y, cy
  8757. Set the chroma matrix vertical size. It must be an odd integer
  8758. between 3 and 63. The default value is 5.
  8759. @item chroma_amount, ca
  8760. Set the chroma effect strength. It must be a floating point number, reasonable
  8761. values lay between -1.5 and 1.5.
  8762. Negative values will blur the input video, while positive values will
  8763. sharpen it, a value of zero will disable the effect.
  8764. Default value is 0.0.
  8765. @item opencl
  8766. If set to 1, specify using OpenCL capabilities, only available if
  8767. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  8768. @end table
  8769. All parameters are optional and default to the equivalent of the
  8770. string '5:5:1.0:5:5:0.0'.
  8771. @subsection Examples
  8772. @itemize
  8773. @item
  8774. Apply strong luma sharpen effect:
  8775. @example
  8776. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  8777. @end example
  8778. @item
  8779. Apply a strong blur of both luma and chroma parameters:
  8780. @example
  8781. unsharp=7:7:-2:7:7:-2
  8782. @end example
  8783. @end itemize
  8784. @section uspp
  8785. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  8786. the image at several (or - in the case of @option{quality} level @code{8} - all)
  8787. shifts and average the results.
  8788. The way this differs from the behavior of spp is that uspp actually encodes &
  8789. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  8790. DCT similar to MJPEG.
  8791. The filter accepts the following options:
  8792. @table @option
  8793. @item quality
  8794. Set quality. This option defines the number of levels for averaging. It accepts
  8795. an integer in the range 0-8. If set to @code{0}, the filter will have no
  8796. effect. A value of @code{8} means the higher quality. For each increment of
  8797. that value the speed drops by a factor of approximately 2. Default value is
  8798. @code{3}.
  8799. @item qp
  8800. Force a constant quantization parameter. If not set, the filter will use the QP
  8801. from the video stream (if available).
  8802. @end table
  8803. @section vectorscope
  8804. Display 2 color component values in the two dimensional graph (which is called
  8805. a vectorscope).
  8806. This filter accepts the following options:
  8807. @table @option
  8808. @item mode, m
  8809. Set vectorscope mode.
  8810. It accepts the following values:
  8811. @table @samp
  8812. @item gray
  8813. Gray values are displayed on graph, higher brightness means more pixels have
  8814. same component color value on location in graph. This is the default mode.
  8815. @item color
  8816. Gray values are displayed on graph. Surrounding pixels values which are not
  8817. present in video frame are drawn in gradient of 2 color components which are
  8818. set by option @code{x} and @code{y}.
  8819. @item color2
  8820. Actual color components values present in video frame are displayed on graph.
  8821. @item color3
  8822. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  8823. on graph increases value of another color component, which is luminance by
  8824. default values of @code{x} and @code{y}.
  8825. @item color4
  8826. Actual colors present in video frame are displayed on graph. If two different
  8827. colors map to same position on graph then color with higher value of component
  8828. not present in graph is picked.
  8829. @end table
  8830. @item x
  8831. Set which color component will be represented on X-axis. Default is @code{1}.
  8832. @item y
  8833. Set which color component will be represented on Y-axis. Default is @code{2}.
  8834. @item intensity, i
  8835. Set intensity, used by modes: gray, color and color3 for increasing brightness
  8836. of color component which represents frequency of (X, Y) location in graph.
  8837. @item envelope, e
  8838. @table @samp
  8839. @item none
  8840. No envelope, this is default.
  8841. @item instant
  8842. Instant envelope, even darkest single pixel will be clearly highlighted.
  8843. @item peak
  8844. Hold maximum and minimum values presented in graph over time. This way you
  8845. can still spot out of range values without constantly looking at vectorscope.
  8846. @item peak+instant
  8847. Peak and instant envelope combined together.
  8848. @end table
  8849. @end table
  8850. @anchor{vidstabdetect}
  8851. @section vidstabdetect
  8852. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  8853. @ref{vidstabtransform} for pass 2.
  8854. This filter generates a file with relative translation and rotation
  8855. transform information about subsequent frames, which is then used by
  8856. the @ref{vidstabtransform} filter.
  8857. To enable compilation of this filter you need to configure FFmpeg with
  8858. @code{--enable-libvidstab}.
  8859. This filter accepts the following options:
  8860. @table @option
  8861. @item result
  8862. Set the path to the file used to write the transforms information.
  8863. Default value is @file{transforms.trf}.
  8864. @item shakiness
  8865. Set how shaky the video is and how quick the camera is. It accepts an
  8866. integer in the range 1-10, a value of 1 means little shakiness, a
  8867. value of 10 means strong shakiness. Default value is 5.
  8868. @item accuracy
  8869. Set the accuracy of the detection process. It must be a value in the
  8870. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  8871. accuracy. Default value is 15.
  8872. @item stepsize
  8873. Set stepsize of the search process. The region around minimum is
  8874. scanned with 1 pixel resolution. Default value is 6.
  8875. @item mincontrast
  8876. Set minimum contrast. Below this value a local measurement field is
  8877. discarded. Must be a floating point value in the range 0-1. Default
  8878. value is 0.3.
  8879. @item tripod
  8880. Set reference frame number for tripod mode.
  8881. If enabled, the motion of the frames is compared to a reference frame
  8882. in the filtered stream, identified by the specified number. The idea
  8883. is to compensate all movements in a more-or-less static scene and keep
  8884. the camera view absolutely still.
  8885. If set to 0, it is disabled. The frames are counted starting from 1.
  8886. @item show
  8887. Show fields and transforms in the resulting frames. It accepts an
  8888. integer in the range 0-2. Default value is 0, which disables any
  8889. visualization.
  8890. @end table
  8891. @subsection Examples
  8892. @itemize
  8893. @item
  8894. Use default values:
  8895. @example
  8896. vidstabdetect
  8897. @end example
  8898. @item
  8899. Analyze strongly shaky movie and put the results in file
  8900. @file{mytransforms.trf}:
  8901. @example
  8902. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  8903. @end example
  8904. @item
  8905. Visualize the result of internal transformations in the resulting
  8906. video:
  8907. @example
  8908. vidstabdetect=show=1
  8909. @end example
  8910. @item
  8911. Analyze a video with medium shakiness using @command{ffmpeg}:
  8912. @example
  8913. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  8914. @end example
  8915. @end itemize
  8916. @anchor{vidstabtransform}
  8917. @section vidstabtransform
  8918. Video stabilization/deshaking: pass 2 of 2,
  8919. see @ref{vidstabdetect} for pass 1.
  8920. Read a file with transform information for each frame and
  8921. apply/compensate them. Together with the @ref{vidstabdetect}
  8922. filter this can be used to deshake videos. See also
  8923. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  8924. the @ref{unsharp} filter, see below.
  8925. To enable compilation of this filter you need to configure FFmpeg with
  8926. @code{--enable-libvidstab}.
  8927. @subsection Options
  8928. @table @option
  8929. @item input
  8930. Set path to the file used to read the transforms. Default value is
  8931. @file{transforms.trf}.
  8932. @item smoothing
  8933. Set the number of frames (value*2 + 1) used for lowpass filtering the
  8934. camera movements. Default value is 10.
  8935. For example a number of 10 means that 21 frames are used (10 in the
  8936. past and 10 in the future) to smoothen the motion in the video. A
  8937. larger value leads to a smoother video, but limits the acceleration of
  8938. the camera (pan/tilt movements). 0 is a special case where a static
  8939. camera is simulated.
  8940. @item optalgo
  8941. Set the camera path optimization algorithm.
  8942. Accepted values are:
  8943. @table @samp
  8944. @item gauss
  8945. gaussian kernel low-pass filter on camera motion (default)
  8946. @item avg
  8947. averaging on transformations
  8948. @end table
  8949. @item maxshift
  8950. Set maximal number of pixels to translate frames. Default value is -1,
  8951. meaning no limit.
  8952. @item maxangle
  8953. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  8954. value is -1, meaning no limit.
  8955. @item crop
  8956. Specify how to deal with borders that may be visible due to movement
  8957. compensation.
  8958. Available values are:
  8959. @table @samp
  8960. @item keep
  8961. keep image information from previous frame (default)
  8962. @item black
  8963. fill the border black
  8964. @end table
  8965. @item invert
  8966. Invert transforms if set to 1. Default value is 0.
  8967. @item relative
  8968. Consider transforms as relative to previous frame if set to 1,
  8969. absolute if set to 0. Default value is 0.
  8970. @item zoom
  8971. Set percentage to zoom. A positive value will result in a zoom-in
  8972. effect, a negative value in a zoom-out effect. Default value is 0 (no
  8973. zoom).
  8974. @item optzoom
  8975. Set optimal zooming to avoid borders.
  8976. Accepted values are:
  8977. @table @samp
  8978. @item 0
  8979. disabled
  8980. @item 1
  8981. optimal static zoom value is determined (only very strong movements
  8982. will lead to visible borders) (default)
  8983. @item 2
  8984. optimal adaptive zoom value is determined (no borders will be
  8985. visible), see @option{zoomspeed}
  8986. @end table
  8987. Note that the value given at zoom is added to the one calculated here.
  8988. @item zoomspeed
  8989. Set percent to zoom maximally each frame (enabled when
  8990. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  8991. 0.25.
  8992. @item interpol
  8993. Specify type of interpolation.
  8994. Available values are:
  8995. @table @samp
  8996. @item no
  8997. no interpolation
  8998. @item linear
  8999. linear only horizontal
  9000. @item bilinear
  9001. linear in both directions (default)
  9002. @item bicubic
  9003. cubic in both directions (slow)
  9004. @end table
  9005. @item tripod
  9006. Enable virtual tripod mode if set to 1, which is equivalent to
  9007. @code{relative=0:smoothing=0}. Default value is 0.
  9008. Use also @code{tripod} option of @ref{vidstabdetect}.
  9009. @item debug
  9010. Increase log verbosity if set to 1. Also the detected global motions
  9011. are written to the temporary file @file{global_motions.trf}. Default
  9012. value is 0.
  9013. @end table
  9014. @subsection Examples
  9015. @itemize
  9016. @item
  9017. Use @command{ffmpeg} for a typical stabilization with default values:
  9018. @example
  9019. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  9020. @end example
  9021. Note the use of the @ref{unsharp} filter which is always recommended.
  9022. @item
  9023. Zoom in a bit more and load transform data from a given file:
  9024. @example
  9025. vidstabtransform=zoom=5:input="mytransforms.trf"
  9026. @end example
  9027. @item
  9028. Smoothen the video even more:
  9029. @example
  9030. vidstabtransform=smoothing=30
  9031. @end example
  9032. @end itemize
  9033. @section vflip
  9034. Flip the input video vertically.
  9035. For example, to vertically flip a video with @command{ffmpeg}:
  9036. @example
  9037. ffmpeg -i in.avi -vf "vflip" out.avi
  9038. @end example
  9039. @anchor{vignette}
  9040. @section vignette
  9041. Make or reverse a natural vignetting effect.
  9042. The filter accepts the following options:
  9043. @table @option
  9044. @item angle, a
  9045. Set lens angle expression as a number of radians.
  9046. The value is clipped in the @code{[0,PI/2]} range.
  9047. Default value: @code{"PI/5"}
  9048. @item x0
  9049. @item y0
  9050. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  9051. by default.
  9052. @item mode
  9053. Set forward/backward mode.
  9054. Available modes are:
  9055. @table @samp
  9056. @item forward
  9057. The larger the distance from the central point, the darker the image becomes.
  9058. @item backward
  9059. The larger the distance from the central point, the brighter the image becomes.
  9060. This can be used to reverse a vignette effect, though there is no automatic
  9061. detection to extract the lens @option{angle} and other settings (yet). It can
  9062. also be used to create a burning effect.
  9063. @end table
  9064. Default value is @samp{forward}.
  9065. @item eval
  9066. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  9067. It accepts the following values:
  9068. @table @samp
  9069. @item init
  9070. Evaluate expressions only once during the filter initialization.
  9071. @item frame
  9072. Evaluate expressions for each incoming frame. This is way slower than the
  9073. @samp{init} mode since it requires all the scalers to be re-computed, but it
  9074. allows advanced dynamic expressions.
  9075. @end table
  9076. Default value is @samp{init}.
  9077. @item dither
  9078. Set dithering to reduce the circular banding effects. Default is @code{1}
  9079. (enabled).
  9080. @item aspect
  9081. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  9082. Setting this value to the SAR of the input will make a rectangular vignetting
  9083. following the dimensions of the video.
  9084. Default is @code{1/1}.
  9085. @end table
  9086. @subsection Expressions
  9087. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  9088. following parameters.
  9089. @table @option
  9090. @item w
  9091. @item h
  9092. input width and height
  9093. @item n
  9094. the number of input frame, starting from 0
  9095. @item pts
  9096. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  9097. @var{TB} units, NAN if undefined
  9098. @item r
  9099. frame rate of the input video, NAN if the input frame rate is unknown
  9100. @item t
  9101. the PTS (Presentation TimeStamp) of the filtered video frame,
  9102. expressed in seconds, NAN if undefined
  9103. @item tb
  9104. time base of the input video
  9105. @end table
  9106. @subsection Examples
  9107. @itemize
  9108. @item
  9109. Apply simple strong vignetting effect:
  9110. @example
  9111. vignette=PI/4
  9112. @end example
  9113. @item
  9114. Make a flickering vignetting:
  9115. @example
  9116. vignette='PI/4+random(1)*PI/50':eval=frame
  9117. @end example
  9118. @end itemize
  9119. @section vstack
  9120. Stack input videos vertically.
  9121. All streams must be of same pixel format and of same width.
  9122. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9123. to create same output.
  9124. The filter accept the following option:
  9125. @table @option
  9126. @item inputs
  9127. Set number of input streams. Default is 2.
  9128. @item shortest
  9129. If set to 1, force the output to terminate when the shortest input
  9130. terminates. Default value is 0.
  9131. @end table
  9132. @section w3fdif
  9133. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  9134. Deinterlacing Filter").
  9135. Based on the process described by Martin Weston for BBC R&D, and
  9136. implemented based on the de-interlace algorithm written by Jim
  9137. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  9138. uses filter coefficients calculated by BBC R&D.
  9139. There are two sets of filter coefficients, so called "simple":
  9140. and "complex". Which set of filter coefficients is used can
  9141. be set by passing an optional parameter:
  9142. @table @option
  9143. @item filter
  9144. Set the interlacing filter coefficients. Accepts one of the following values:
  9145. @table @samp
  9146. @item simple
  9147. Simple filter coefficient set.
  9148. @item complex
  9149. More-complex filter coefficient set.
  9150. @end table
  9151. Default value is @samp{complex}.
  9152. @item deint
  9153. Specify which frames to deinterlace. Accept one of the following values:
  9154. @table @samp
  9155. @item all
  9156. Deinterlace all frames,
  9157. @item interlaced
  9158. Only deinterlace frames marked as interlaced.
  9159. @end table
  9160. Default value is @samp{all}.
  9161. @end table
  9162. @section waveform
  9163. Video waveform monitor.
  9164. The waveform monitor plots color component intensity. By default luminance
  9165. only. Each column of the waveform corresponds to a column of pixels in the
  9166. source video.
  9167. It accepts the following options:
  9168. @table @option
  9169. @item mode, m
  9170. Can be either @code{row}, or @code{column}. Default is @code{column}.
  9171. In row mode, the graph on the left side represents color component value 0 and
  9172. the right side represents value = 255. In column mode, the top side represents
  9173. color component value = 0 and bottom side represents value = 255.
  9174. @item intensity, i
  9175. Set intensity. Smaller values are useful to find out how many values of the same
  9176. luminance are distributed across input rows/columns.
  9177. Default value is @code{0.04}. Allowed range is [0, 1].
  9178. @item mirror, r
  9179. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  9180. In mirrored mode, higher values will be represented on the left
  9181. side for @code{row} mode and at the top for @code{column} mode. Default is
  9182. @code{1} (mirrored).
  9183. @item display, d
  9184. Set display mode.
  9185. It accepts the following values:
  9186. @table @samp
  9187. @item overlay
  9188. Presents information identical to that in the @code{parade}, except
  9189. that the graphs representing color components are superimposed directly
  9190. over one another.
  9191. This display mode makes it easier to spot relative differences or similarities
  9192. in overlapping areas of the color components that are supposed to be identical,
  9193. such as neutral whites, grays, or blacks.
  9194. @item parade
  9195. Display separate graph for the color components side by side in
  9196. @code{row} mode or one below the other in @code{column} mode.
  9197. Using this display mode makes it easy to spot color casts in the highlights
  9198. and shadows of an image, by comparing the contours of the top and the bottom
  9199. graphs of each waveform. Since whites, grays, and blacks are characterized
  9200. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  9201. should display three waveforms of roughly equal width/height. If not, the
  9202. correction is easy to perform by making level adjustments the three waveforms.
  9203. @end table
  9204. Default is @code{parade}.
  9205. @item components, c
  9206. Set which color components to display. Default is 1, which means only luminance
  9207. or red color component if input is in RGB colorspace. If is set for example to
  9208. 7 it will display all 3 (if) available color components.
  9209. @item envelope, e
  9210. @table @samp
  9211. @item none
  9212. No envelope, this is default.
  9213. @item instant
  9214. Instant envelope, minimum and maximum values presented in graph will be easily
  9215. visible even with small @code{step} value.
  9216. @item peak
  9217. Hold minimum and maximum values presented in graph across time. This way you
  9218. can still spot out of range values without constantly looking at waveforms.
  9219. @item peak+instant
  9220. Peak and instant envelope combined together.
  9221. @end table
  9222. @item filter, f
  9223. @table @samp
  9224. @item lowpass
  9225. No filtering, this is default.
  9226. @item flat
  9227. Luma and chroma combined together.
  9228. @item aflat
  9229. Similar as above, but shows difference between blue and red chroma.
  9230. @item chroma
  9231. Displays only chroma.
  9232. @item achroma
  9233. Similar as above, but shows difference between blue and red chroma.
  9234. @item color
  9235. Displays actual color value on waveform.
  9236. @end table
  9237. @end table
  9238. @section xbr
  9239. Apply the xBR high-quality magnification filter which is designed for pixel
  9240. art. It follows a set of edge-detection rules, see
  9241. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  9242. It accepts the following option:
  9243. @table @option
  9244. @item n
  9245. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  9246. @code{3xBR} and @code{4} for @code{4xBR}.
  9247. Default is @code{3}.
  9248. @end table
  9249. @anchor{yadif}
  9250. @section yadif
  9251. Deinterlace the input video ("yadif" means "yet another deinterlacing
  9252. filter").
  9253. It accepts the following parameters:
  9254. @table @option
  9255. @item mode
  9256. The interlacing mode to adopt. It accepts one of the following values:
  9257. @table @option
  9258. @item 0, send_frame
  9259. Output one frame for each frame.
  9260. @item 1, send_field
  9261. Output one frame for each field.
  9262. @item 2, send_frame_nospatial
  9263. Like @code{send_frame}, but it skips the spatial interlacing check.
  9264. @item 3, send_field_nospatial
  9265. Like @code{send_field}, but it skips the spatial interlacing check.
  9266. @end table
  9267. The default value is @code{send_frame}.
  9268. @item parity
  9269. The picture field parity assumed for the input interlaced video. It accepts one
  9270. of the following values:
  9271. @table @option
  9272. @item 0, tff
  9273. Assume the top field is first.
  9274. @item 1, bff
  9275. Assume the bottom field is first.
  9276. @item -1, auto
  9277. Enable automatic detection of field parity.
  9278. @end table
  9279. The default value is @code{auto}.
  9280. If the interlacing is unknown or the decoder does not export this information,
  9281. top field first will be assumed.
  9282. @item deint
  9283. Specify which frames to deinterlace. Accept one of the following
  9284. values:
  9285. @table @option
  9286. @item 0, all
  9287. Deinterlace all frames.
  9288. @item 1, interlaced
  9289. Only deinterlace frames marked as interlaced.
  9290. @end table
  9291. The default value is @code{all}.
  9292. @end table
  9293. @section zoompan
  9294. Apply Zoom & Pan effect.
  9295. This filter accepts the following options:
  9296. @table @option
  9297. @item zoom, z
  9298. Set the zoom expression. Default is 1.
  9299. @item x
  9300. @item y
  9301. Set the x and y expression. Default is 0.
  9302. @item d
  9303. Set the duration expression in number of frames.
  9304. This sets for how many number of frames effect will last for
  9305. single input image.
  9306. @item s
  9307. Set the output image size, default is 'hd720'.
  9308. @end table
  9309. Each expression can contain the following constants:
  9310. @table @option
  9311. @item in_w, iw
  9312. Input width.
  9313. @item in_h, ih
  9314. Input height.
  9315. @item out_w, ow
  9316. Output width.
  9317. @item out_h, oh
  9318. Output height.
  9319. @item in
  9320. Input frame count.
  9321. @item on
  9322. Output frame count.
  9323. @item x
  9324. @item y
  9325. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  9326. for current input frame.
  9327. @item px
  9328. @item py
  9329. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  9330. not yet such frame (first input frame).
  9331. @item zoom
  9332. Last calculated zoom from 'z' expression for current input frame.
  9333. @item pzoom
  9334. Last calculated zoom of last output frame of previous input frame.
  9335. @item duration
  9336. Number of output frames for current input frame. Calculated from 'd' expression
  9337. for each input frame.
  9338. @item pduration
  9339. number of output frames created for previous input frame
  9340. @item a
  9341. Rational number: input width / input height
  9342. @item sar
  9343. sample aspect ratio
  9344. @item dar
  9345. display aspect ratio
  9346. @end table
  9347. @subsection Examples
  9348. @itemize
  9349. @item
  9350. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  9351. @example
  9352. 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
  9353. @end example
  9354. @item
  9355. Zoom-in up to 1.5 and pan always at center of picture:
  9356. @example
  9357. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  9358. @end example
  9359. @end itemize
  9360. @section zscale
  9361. Scale (resize) the input video, using the z.lib library:
  9362. https://github.com/sekrit-twc/zimg.
  9363. The zscale filter forces the output display aspect ratio to be the same
  9364. as the input, by changing the output sample aspect ratio.
  9365. If the input image format is different from the format requested by
  9366. the next filter, the zscale filter will convert the input to the
  9367. requested format.
  9368. @subsection Options
  9369. The filter accepts the following options.
  9370. @table @option
  9371. @item width, w
  9372. @item height, h
  9373. Set the output video dimension expression. Default value is the input
  9374. dimension.
  9375. If the @var{width} or @var{w} is 0, the input width is used for the output.
  9376. If the @var{height} or @var{h} is 0, the input height is used for the output.
  9377. If one of the values is -1, the zscale filter will use a value that
  9378. maintains the aspect ratio of the input image, calculated from the
  9379. other specified dimension. If both of them are -1, the input size is
  9380. used
  9381. If one of the values is -n with n > 1, the zscale filter will also use a value
  9382. that maintains the aspect ratio of the input image, calculated from the other
  9383. specified dimension. After that it will, however, make sure that the calculated
  9384. dimension is divisible by n and adjust the value if necessary.
  9385. See below for the list of accepted constants for use in the dimension
  9386. expression.
  9387. @item size, s
  9388. Set the video size. For the syntax of this option, check the
  9389. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9390. @item dither, d
  9391. Set the dither type.
  9392. Possible values are:
  9393. @table @var
  9394. @item none
  9395. @item ordered
  9396. @item random
  9397. @item error_diffusion
  9398. @end table
  9399. Default is none.
  9400. @item filter, f
  9401. Set the resize filter type.
  9402. Possible values are:
  9403. @table @var
  9404. @item point
  9405. @item bilinear
  9406. @item bicubic
  9407. @item spline16
  9408. @item spline36
  9409. @item lanczos
  9410. @end table
  9411. Default is bilinear.
  9412. @item range, r
  9413. Set the color range.
  9414. Possible values are:
  9415. @table @var
  9416. @item input
  9417. @item limited
  9418. @item full
  9419. @end table
  9420. Default is same as input.
  9421. @item primaries, p
  9422. Set the color primaries.
  9423. Possible values are:
  9424. @table @var
  9425. @item input
  9426. @item 709
  9427. @item unspecified
  9428. @item 170m
  9429. @item 240m
  9430. @item 2020
  9431. @end table
  9432. Default is same as input.
  9433. @item transfer, t
  9434. Set the transfer characteristics.
  9435. Possible values are:
  9436. @table @var
  9437. @item input
  9438. @item 709
  9439. @item unspecified
  9440. @item 601
  9441. @item linear
  9442. @item 2020_10
  9443. @item 2020_12
  9444. @end table
  9445. Default is same as input.
  9446. @item matrix, m
  9447. Set the colorspace matrix.
  9448. Possible value are:
  9449. @table @var
  9450. @item input
  9451. @item 709
  9452. @item unspecified
  9453. @item 470bg
  9454. @item 170m
  9455. @item 2020_ncl
  9456. @item 2020_cl
  9457. @end table
  9458. Default is same as input.
  9459. @end table
  9460. The values of the @option{w} and @option{h} options are expressions
  9461. containing the following constants:
  9462. @table @var
  9463. @item in_w
  9464. @item in_h
  9465. The input width and height
  9466. @item iw
  9467. @item ih
  9468. These are the same as @var{in_w} and @var{in_h}.
  9469. @item out_w
  9470. @item out_h
  9471. The output (scaled) width and height
  9472. @item ow
  9473. @item oh
  9474. These are the same as @var{out_w} and @var{out_h}
  9475. @item a
  9476. The same as @var{iw} / @var{ih}
  9477. @item sar
  9478. input sample aspect ratio
  9479. @item dar
  9480. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9481. @item hsub
  9482. @item vsub
  9483. horizontal and vertical input chroma subsample values. For example for the
  9484. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9485. @item ohsub
  9486. @item ovsub
  9487. horizontal and vertical output chroma subsample values. For example for the
  9488. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9489. @end table
  9490. @table @option
  9491. @end table
  9492. @c man end VIDEO FILTERS
  9493. @chapter Video Sources
  9494. @c man begin VIDEO SOURCES
  9495. Below is a description of the currently available video sources.
  9496. @section buffer
  9497. Buffer video frames, and make them available to the filter chain.
  9498. This source is mainly intended for a programmatic use, in particular
  9499. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  9500. It accepts the following parameters:
  9501. @table @option
  9502. @item video_size
  9503. Specify the size (width and height) of the buffered video frames. For the
  9504. syntax of this option, check the
  9505. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9506. @item width
  9507. The input video width.
  9508. @item height
  9509. The input video height.
  9510. @item pix_fmt
  9511. A string representing the pixel format of the buffered video frames.
  9512. It may be a number corresponding to a pixel format, or a pixel format
  9513. name.
  9514. @item time_base
  9515. Specify the timebase assumed by the timestamps of the buffered frames.
  9516. @item frame_rate
  9517. Specify the frame rate expected for the video stream.
  9518. @item pixel_aspect, sar
  9519. The sample (pixel) aspect ratio of the input video.
  9520. @item sws_param
  9521. Specify the optional parameters to be used for the scale filter which
  9522. is automatically inserted when an input change is detected in the
  9523. input size or format.
  9524. @end table
  9525. For example:
  9526. @example
  9527. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  9528. @end example
  9529. will instruct the source to accept video frames with size 320x240 and
  9530. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  9531. square pixels (1:1 sample aspect ratio).
  9532. Since the pixel format with name "yuv410p" corresponds to the number 6
  9533. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  9534. this example corresponds to:
  9535. @example
  9536. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  9537. @end example
  9538. Alternatively, the options can be specified as a flat string, but this
  9539. syntax is deprecated:
  9540. @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}]
  9541. @section cellauto
  9542. Create a pattern generated by an elementary cellular automaton.
  9543. The initial state of the cellular automaton can be defined through the
  9544. @option{filename}, and @option{pattern} options. If such options are
  9545. not specified an initial state is created randomly.
  9546. At each new frame a new row in the video is filled with the result of
  9547. the cellular automaton next generation. The behavior when the whole
  9548. frame is filled is defined by the @option{scroll} option.
  9549. This source accepts the following options:
  9550. @table @option
  9551. @item filename, f
  9552. Read the initial cellular automaton state, i.e. the starting row, from
  9553. the specified file.
  9554. In the file, each non-whitespace character is considered an alive
  9555. cell, a newline will terminate the row, and further characters in the
  9556. file will be ignored.
  9557. @item pattern, p
  9558. Read the initial cellular automaton state, i.e. the starting row, from
  9559. the specified string.
  9560. Each non-whitespace character in the string is considered an alive
  9561. cell, a newline will terminate the row, and further characters in the
  9562. string will be ignored.
  9563. @item rate, r
  9564. Set the video rate, that is the number of frames generated per second.
  9565. Default is 25.
  9566. @item random_fill_ratio, ratio
  9567. Set the random fill ratio for the initial cellular automaton row. It
  9568. is a floating point number value ranging from 0 to 1, defaults to
  9569. 1/PHI.
  9570. This option is ignored when a file or a pattern is specified.
  9571. @item random_seed, seed
  9572. Set the seed for filling randomly the initial row, must be an integer
  9573. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9574. set to -1, the filter will try to use a good random seed on a best
  9575. effort basis.
  9576. @item rule
  9577. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  9578. Default value is 110.
  9579. @item size, s
  9580. Set the size of the output video. For the syntax of this option, check the
  9581. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9582. If @option{filename} or @option{pattern} is specified, the size is set
  9583. by default to the width of the specified initial state row, and the
  9584. height is set to @var{width} * PHI.
  9585. If @option{size} is set, it must contain the width of the specified
  9586. pattern string, and the specified pattern will be centered in the
  9587. larger row.
  9588. If a filename or a pattern string is not specified, the size value
  9589. defaults to "320x518" (used for a randomly generated initial state).
  9590. @item scroll
  9591. If set to 1, scroll the output upward when all the rows in the output
  9592. have been already filled. If set to 0, the new generated row will be
  9593. written over the top row just after the bottom row is filled.
  9594. Defaults to 1.
  9595. @item start_full, full
  9596. If set to 1, completely fill the output with generated rows before
  9597. outputting the first frame.
  9598. This is the default behavior, for disabling set the value to 0.
  9599. @item stitch
  9600. If set to 1, stitch the left and right row edges together.
  9601. This is the default behavior, for disabling set the value to 0.
  9602. @end table
  9603. @subsection Examples
  9604. @itemize
  9605. @item
  9606. Read the initial state from @file{pattern}, and specify an output of
  9607. size 200x400.
  9608. @example
  9609. cellauto=f=pattern:s=200x400
  9610. @end example
  9611. @item
  9612. Generate a random initial row with a width of 200 cells, with a fill
  9613. ratio of 2/3:
  9614. @example
  9615. cellauto=ratio=2/3:s=200x200
  9616. @end example
  9617. @item
  9618. Create a pattern generated by rule 18 starting by a single alive cell
  9619. centered on an initial row with width 100:
  9620. @example
  9621. cellauto=p=@@:s=100x400:full=0:rule=18
  9622. @end example
  9623. @item
  9624. Specify a more elaborated initial pattern:
  9625. @example
  9626. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  9627. @end example
  9628. @end itemize
  9629. @section mandelbrot
  9630. Generate a Mandelbrot set fractal, and progressively zoom towards the
  9631. point specified with @var{start_x} and @var{start_y}.
  9632. This source accepts the following options:
  9633. @table @option
  9634. @item end_pts
  9635. Set the terminal pts value. Default value is 400.
  9636. @item end_scale
  9637. Set the terminal scale value.
  9638. Must be a floating point value. Default value is 0.3.
  9639. @item inner
  9640. Set the inner coloring mode, that is the algorithm used to draw the
  9641. Mandelbrot fractal internal region.
  9642. It shall assume one of the following values:
  9643. @table @option
  9644. @item black
  9645. Set black mode.
  9646. @item convergence
  9647. Show time until convergence.
  9648. @item mincol
  9649. Set color based on point closest to the origin of the iterations.
  9650. @item period
  9651. Set period mode.
  9652. @end table
  9653. Default value is @var{mincol}.
  9654. @item bailout
  9655. Set the bailout value. Default value is 10.0.
  9656. @item maxiter
  9657. Set the maximum of iterations performed by the rendering
  9658. algorithm. Default value is 7189.
  9659. @item outer
  9660. Set outer coloring mode.
  9661. It shall assume one of following values:
  9662. @table @option
  9663. @item iteration_count
  9664. Set iteration cound mode.
  9665. @item normalized_iteration_count
  9666. set normalized iteration count mode.
  9667. @end table
  9668. Default value is @var{normalized_iteration_count}.
  9669. @item rate, r
  9670. Set frame rate, expressed as number of frames per second. Default
  9671. value is "25".
  9672. @item size, s
  9673. Set frame size. For the syntax of this option, check the "Video
  9674. size" section in the ffmpeg-utils manual. Default value is "640x480".
  9675. @item start_scale
  9676. Set the initial scale value. Default value is 3.0.
  9677. @item start_x
  9678. Set the initial x position. Must be a floating point value between
  9679. -100 and 100. Default value is -0.743643887037158704752191506114774.
  9680. @item start_y
  9681. Set the initial y position. Must be a floating point value between
  9682. -100 and 100. Default value is -0.131825904205311970493132056385139.
  9683. @end table
  9684. @section mptestsrc
  9685. Generate various test patterns, as generated by the MPlayer test filter.
  9686. The size of the generated video is fixed, and is 256x256.
  9687. This source is useful in particular for testing encoding features.
  9688. This source accepts the following options:
  9689. @table @option
  9690. @item rate, r
  9691. Specify the frame rate of the sourced video, as the number of frames
  9692. generated per second. It has to be a string in the format
  9693. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9694. number or a valid video frame rate abbreviation. The default value is
  9695. "25".
  9696. @item duration, d
  9697. Set the duration of the sourced video. See
  9698. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9699. for the accepted syntax.
  9700. If not specified, or the expressed duration is negative, the video is
  9701. supposed to be generated forever.
  9702. @item test, t
  9703. Set the number or the name of the test to perform. Supported tests are:
  9704. @table @option
  9705. @item dc_luma
  9706. @item dc_chroma
  9707. @item freq_luma
  9708. @item freq_chroma
  9709. @item amp_luma
  9710. @item amp_chroma
  9711. @item cbp
  9712. @item mv
  9713. @item ring1
  9714. @item ring2
  9715. @item all
  9716. @end table
  9717. Default value is "all", which will cycle through the list of all tests.
  9718. @end table
  9719. Some examples:
  9720. @example
  9721. mptestsrc=t=dc_luma
  9722. @end example
  9723. will generate a "dc_luma" test pattern.
  9724. @section frei0r_src
  9725. Provide a frei0r source.
  9726. To enable compilation of this filter you need to install the frei0r
  9727. header and configure FFmpeg with @code{--enable-frei0r}.
  9728. This source accepts the following parameters:
  9729. @table @option
  9730. @item size
  9731. The size of the video to generate. For the syntax of this option, check the
  9732. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9733. @item framerate
  9734. The framerate of the generated video. It may be a string of the form
  9735. @var{num}/@var{den} or a frame rate abbreviation.
  9736. @item filter_name
  9737. The name to the frei0r source to load. For more information regarding frei0r and
  9738. how to set the parameters, read the @ref{frei0r} section in the video filters
  9739. documentation.
  9740. @item filter_params
  9741. A '|'-separated list of parameters to pass to the frei0r source.
  9742. @end table
  9743. For example, to generate a frei0r partik0l source with size 200x200
  9744. and frame rate 10 which is overlaid on the overlay filter main input:
  9745. @example
  9746. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  9747. @end example
  9748. @section life
  9749. Generate a life pattern.
  9750. This source is based on a generalization of John Conway's life game.
  9751. The sourced input represents a life grid, each pixel represents a cell
  9752. which can be in one of two possible states, alive or dead. Every cell
  9753. interacts with its eight neighbours, which are the cells that are
  9754. horizontally, vertically, or diagonally adjacent.
  9755. At each interaction the grid evolves according to the adopted rule,
  9756. which specifies the number of neighbor alive cells which will make a
  9757. cell stay alive or born. The @option{rule} option allows one to specify
  9758. the rule to adopt.
  9759. This source accepts the following options:
  9760. @table @option
  9761. @item filename, f
  9762. Set the file from which to read the initial grid state. In the file,
  9763. each non-whitespace character is considered an alive cell, and newline
  9764. is used to delimit the end of each row.
  9765. If this option is not specified, the initial grid is generated
  9766. randomly.
  9767. @item rate, r
  9768. Set the video rate, that is the number of frames generated per second.
  9769. Default is 25.
  9770. @item random_fill_ratio, ratio
  9771. Set the random fill ratio for the initial random grid. It is a
  9772. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  9773. It is ignored when a file is specified.
  9774. @item random_seed, seed
  9775. Set the seed for filling the initial random grid, must be an integer
  9776. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9777. set to -1, the filter will try to use a good random seed on a best
  9778. effort basis.
  9779. @item rule
  9780. Set the life rule.
  9781. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  9782. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  9783. @var{NS} specifies the number of alive neighbor cells which make a
  9784. live cell stay alive, and @var{NB} the number of alive neighbor cells
  9785. which make a dead cell to become alive (i.e. to "born").
  9786. "s" and "b" can be used in place of "S" and "B", respectively.
  9787. Alternatively a rule can be specified by an 18-bits integer. The 9
  9788. high order bits are used to encode the next cell state if it is alive
  9789. for each number of neighbor alive cells, the low order bits specify
  9790. the rule for "borning" new cells. Higher order bits encode for an
  9791. higher number of neighbor cells.
  9792. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  9793. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  9794. Default value is "S23/B3", which is the original Conway's game of life
  9795. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  9796. cells, and will born a new cell if there are three alive cells around
  9797. a dead cell.
  9798. @item size, s
  9799. Set the size of the output video. For the syntax of this option, check the
  9800. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9801. If @option{filename} is specified, the size is set by default to the
  9802. same size of the input file. If @option{size} is set, it must contain
  9803. the size specified in the input file, and the initial grid defined in
  9804. that file is centered in the larger resulting area.
  9805. If a filename is not specified, the size value defaults to "320x240"
  9806. (used for a randomly generated initial grid).
  9807. @item stitch
  9808. If set to 1, stitch the left and right grid edges together, and the
  9809. top and bottom edges also. Defaults to 1.
  9810. @item mold
  9811. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  9812. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  9813. value from 0 to 255.
  9814. @item life_color
  9815. Set the color of living (or new born) cells.
  9816. @item death_color
  9817. Set the color of dead cells. If @option{mold} is set, this is the first color
  9818. used to represent a dead cell.
  9819. @item mold_color
  9820. Set mold color, for definitely dead and moldy cells.
  9821. For the syntax of these 3 color options, check the "Color" section in the
  9822. ffmpeg-utils manual.
  9823. @end table
  9824. @subsection Examples
  9825. @itemize
  9826. @item
  9827. Read a grid from @file{pattern}, and center it on a grid of size
  9828. 300x300 pixels:
  9829. @example
  9830. life=f=pattern:s=300x300
  9831. @end example
  9832. @item
  9833. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  9834. @example
  9835. life=ratio=2/3:s=200x200
  9836. @end example
  9837. @item
  9838. Specify a custom rule for evolving a randomly generated grid:
  9839. @example
  9840. life=rule=S14/B34
  9841. @end example
  9842. @item
  9843. Full example with slow death effect (mold) using @command{ffplay}:
  9844. @example
  9845. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  9846. @end example
  9847. @end itemize
  9848. @anchor{allrgb}
  9849. @anchor{allyuv}
  9850. @anchor{color}
  9851. @anchor{haldclutsrc}
  9852. @anchor{nullsrc}
  9853. @anchor{rgbtestsrc}
  9854. @anchor{smptebars}
  9855. @anchor{smptehdbars}
  9856. @anchor{testsrc}
  9857. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  9858. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  9859. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  9860. The @code{color} source provides an uniformly colored input.
  9861. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  9862. @ref{haldclut} filter.
  9863. The @code{nullsrc} source returns unprocessed video frames. It is
  9864. mainly useful to be employed in analysis / debugging tools, or as the
  9865. source for filters which ignore the input data.
  9866. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  9867. detecting RGB vs BGR issues. You should see a red, green and blue
  9868. stripe from top to bottom.
  9869. The @code{smptebars} source generates a color bars pattern, based on
  9870. the SMPTE Engineering Guideline EG 1-1990.
  9871. The @code{smptehdbars} source generates a color bars pattern, based on
  9872. the SMPTE RP 219-2002.
  9873. The @code{testsrc} source generates a test video pattern, showing a
  9874. color pattern, a scrolling gradient and a timestamp. This is mainly
  9875. intended for testing purposes.
  9876. The sources accept the following parameters:
  9877. @table @option
  9878. @item color, c
  9879. Specify the color of the source, only available in the @code{color}
  9880. source. For the syntax of this option, check the "Color" section in the
  9881. ffmpeg-utils manual.
  9882. @item level
  9883. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  9884. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  9885. pixels to be used as identity matrix for 3D lookup tables. Each component is
  9886. coded on a @code{1/(N*N)} scale.
  9887. @item size, s
  9888. Specify the size of the sourced video. For the syntax of this option, check the
  9889. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9890. The default value is @code{320x240}.
  9891. This option is not available with the @code{haldclutsrc} filter.
  9892. @item rate, r
  9893. Specify the frame rate of the sourced video, as the number of frames
  9894. generated per second. It has to be a string in the format
  9895. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9896. number or a valid video frame rate abbreviation. The default value is
  9897. "25".
  9898. @item sar
  9899. Set the sample aspect ratio of the sourced video.
  9900. @item duration, d
  9901. Set the duration of the sourced video. See
  9902. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9903. for the accepted syntax.
  9904. If not specified, or the expressed duration is negative, the video is
  9905. supposed to be generated forever.
  9906. @item decimals, n
  9907. Set the number of decimals to show in the timestamp, only available in the
  9908. @code{testsrc} source.
  9909. The displayed timestamp value will correspond to the original
  9910. timestamp value multiplied by the power of 10 of the specified
  9911. value. Default value is 0.
  9912. @end table
  9913. For example the following:
  9914. @example
  9915. testsrc=duration=5.3:size=qcif:rate=10
  9916. @end example
  9917. will generate a video with a duration of 5.3 seconds, with size
  9918. 176x144 and a frame rate of 10 frames per second.
  9919. The following graph description will generate a red source
  9920. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  9921. frames per second.
  9922. @example
  9923. color=c=red@@0.2:s=qcif:r=10
  9924. @end example
  9925. If the input content is to be ignored, @code{nullsrc} can be used. The
  9926. following command generates noise in the luminance plane by employing
  9927. the @code{geq} filter:
  9928. @example
  9929. nullsrc=s=256x256, geq=random(1)*255:128:128
  9930. @end example
  9931. @subsection Commands
  9932. The @code{color} source supports the following commands:
  9933. @table @option
  9934. @item c, color
  9935. Set the color of the created image. Accepts the same syntax of the
  9936. corresponding @option{color} option.
  9937. @end table
  9938. @c man end VIDEO SOURCES
  9939. @chapter Video Sinks
  9940. @c man begin VIDEO SINKS
  9941. Below is a description of the currently available video sinks.
  9942. @section buffersink
  9943. Buffer video frames, and make them available to the end of the filter
  9944. graph.
  9945. This sink is mainly intended for programmatic use, in particular
  9946. through the interface defined in @file{libavfilter/buffersink.h}
  9947. or the options system.
  9948. It accepts a pointer to an AVBufferSinkContext structure, which
  9949. defines the incoming buffers' formats, to be passed as the opaque
  9950. parameter to @code{avfilter_init_filter} for initialization.
  9951. @section nullsink
  9952. Null video sink: do absolutely nothing with the input video. It is
  9953. mainly useful as a template and for use in analysis / debugging
  9954. tools.
  9955. @c man end VIDEO SINKS
  9956. @chapter Multimedia Filters
  9957. @c man begin MULTIMEDIA FILTERS
  9958. Below is a description of the currently available multimedia filters.
  9959. @section aphasemeter
  9960. Convert input audio to a video output, displaying the audio phase.
  9961. The filter accepts the following options:
  9962. @table @option
  9963. @item rate, r
  9964. Set the output frame rate. Default value is @code{25}.
  9965. @item size, s
  9966. Set the video size for the output. For the syntax of this option, check the
  9967. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9968. Default value is @code{800x400}.
  9969. @item rc
  9970. @item gc
  9971. @item bc
  9972. Specify the red, green, blue contrast. Default values are @code{2},
  9973. @code{7} and @code{1}.
  9974. Allowed range is @code{[0, 255]}.
  9975. @item mpc
  9976. Set color which will be used for drawing median phase. If color is
  9977. @code{none} which is default, no median phase value will be drawn.
  9978. @end table
  9979. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  9980. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  9981. The @code{-1} means left and right channels are completely out of phase and
  9982. @code{1} means channels are in phase.
  9983. @section avectorscope
  9984. Convert input audio to a video output, representing the audio vector
  9985. scope.
  9986. The filter is used to measure the difference between channels of stereo
  9987. audio stream. A monoaural signal, consisting of identical left and right
  9988. signal, results in straight vertical line. Any stereo separation is visible
  9989. as a deviation from this line, creating a Lissajous figure.
  9990. If the straight (or deviation from it) but horizontal line appears this
  9991. indicates that the left and right channels are out of phase.
  9992. The filter accepts the following options:
  9993. @table @option
  9994. @item mode, m
  9995. Set the vectorscope mode.
  9996. Available values are:
  9997. @table @samp
  9998. @item lissajous
  9999. Lissajous rotated by 45 degrees.
  10000. @item lissajous_xy
  10001. Same as above but not rotated.
  10002. @item polar
  10003. Shape resembling half of circle.
  10004. @end table
  10005. Default value is @samp{lissajous}.
  10006. @item size, s
  10007. Set the video size for the output. For the syntax of this option, check the
  10008. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10009. Default value is @code{400x400}.
  10010. @item rate, r
  10011. Set the output frame rate. Default value is @code{25}.
  10012. @item rc
  10013. @item gc
  10014. @item bc
  10015. @item ac
  10016. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  10017. @code{160}, @code{80} and @code{255}.
  10018. Allowed range is @code{[0, 255]}.
  10019. @item rf
  10020. @item gf
  10021. @item bf
  10022. @item af
  10023. Specify the red, green, blue and alpha fade. Default values are @code{15},
  10024. @code{10}, @code{5} and @code{5}.
  10025. Allowed range is @code{[0, 255]}.
  10026. @item zoom
  10027. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  10028. @end table
  10029. @subsection Examples
  10030. @itemize
  10031. @item
  10032. Complete example using @command{ffplay}:
  10033. @example
  10034. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  10035. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  10036. @end example
  10037. @end itemize
  10038. @section concat
  10039. Concatenate audio and video streams, joining them together one after the
  10040. other.
  10041. The filter works on segments of synchronized video and audio streams. All
  10042. segments must have the same number of streams of each type, and that will
  10043. also be the number of streams at output.
  10044. The filter accepts the following options:
  10045. @table @option
  10046. @item n
  10047. Set the number of segments. Default is 2.
  10048. @item v
  10049. Set the number of output video streams, that is also the number of video
  10050. streams in each segment. Default is 1.
  10051. @item a
  10052. Set the number of output audio streams, that is also the number of audio
  10053. streams in each segment. Default is 0.
  10054. @item unsafe
  10055. Activate unsafe mode: do not fail if segments have a different format.
  10056. @end table
  10057. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  10058. @var{a} audio outputs.
  10059. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  10060. segment, in the same order as the outputs, then the inputs for the second
  10061. segment, etc.
  10062. Related streams do not always have exactly the same duration, for various
  10063. reasons including codec frame size or sloppy authoring. For that reason,
  10064. related synchronized streams (e.g. a video and its audio track) should be
  10065. concatenated at once. The concat filter will use the duration of the longest
  10066. stream in each segment (except the last one), and if necessary pad shorter
  10067. audio streams with silence.
  10068. For this filter to work correctly, all segments must start at timestamp 0.
  10069. All corresponding streams must have the same parameters in all segments; the
  10070. filtering system will automatically select a common pixel format for video
  10071. streams, and a common sample format, sample rate and channel layout for
  10072. audio streams, but other settings, such as resolution, must be converted
  10073. explicitly by the user.
  10074. Different frame rates are acceptable but will result in variable frame rate
  10075. at output; be sure to configure the output file to handle it.
  10076. @subsection Examples
  10077. @itemize
  10078. @item
  10079. Concatenate an opening, an episode and an ending, all in bilingual version
  10080. (video in stream 0, audio in streams 1 and 2):
  10081. @example
  10082. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  10083. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  10084. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  10085. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  10086. @end example
  10087. @item
  10088. Concatenate two parts, handling audio and video separately, using the
  10089. (a)movie sources, and adjusting the resolution:
  10090. @example
  10091. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  10092. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  10093. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  10094. @end example
  10095. Note that a desync will happen at the stitch if the audio and video streams
  10096. do not have exactly the same duration in the first file.
  10097. @end itemize
  10098. @anchor{ebur128}
  10099. @section ebur128
  10100. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  10101. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  10102. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  10103. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  10104. The filter also has a video output (see the @var{video} option) with a real
  10105. time graph to observe the loudness evolution. The graphic contains the logged
  10106. message mentioned above, so it is not printed anymore when this option is set,
  10107. unless the verbose logging is set. The main graphing area contains the
  10108. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  10109. the momentary loudness (400 milliseconds).
  10110. More information about the Loudness Recommendation EBU R128 on
  10111. @url{http://tech.ebu.ch/loudness}.
  10112. The filter accepts the following options:
  10113. @table @option
  10114. @item video
  10115. Activate the video output. The audio stream is passed unchanged whether this
  10116. option is set or no. The video stream will be the first output stream if
  10117. activated. Default is @code{0}.
  10118. @item size
  10119. Set the video size. This option is for video only. For the syntax of this
  10120. option, check the
  10121. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10122. Default and minimum resolution is @code{640x480}.
  10123. @item meter
  10124. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  10125. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  10126. other integer value between this range is allowed.
  10127. @item metadata
  10128. Set metadata injection. If set to @code{1}, the audio input will be segmented
  10129. into 100ms output frames, each of them containing various loudness information
  10130. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  10131. Default is @code{0}.
  10132. @item framelog
  10133. Force the frame logging level.
  10134. Available values are:
  10135. @table @samp
  10136. @item info
  10137. information logging level
  10138. @item verbose
  10139. verbose logging level
  10140. @end table
  10141. By default, the logging level is set to @var{info}. If the @option{video} or
  10142. the @option{metadata} options are set, it switches to @var{verbose}.
  10143. @item peak
  10144. Set peak mode(s).
  10145. Available modes can be cumulated (the option is a @code{flag} type). Possible
  10146. values are:
  10147. @table @samp
  10148. @item none
  10149. Disable any peak mode (default).
  10150. @item sample
  10151. Enable sample-peak mode.
  10152. Simple peak mode looking for the higher sample value. It logs a message
  10153. for sample-peak (identified by @code{SPK}).
  10154. @item true
  10155. Enable true-peak mode.
  10156. If enabled, the peak lookup is done on an over-sampled version of the input
  10157. stream for better peak accuracy. It logs a message for true-peak.
  10158. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  10159. This mode requires a build with @code{libswresample}.
  10160. @end table
  10161. @item dualmono
  10162. Treat mono input files as "dual mono". If a mono file is intended for playback
  10163. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  10164. If set to @code{true}, this option will compensate for this effect.
  10165. Multi-channel input files are not affected by this option.
  10166. @item panlaw
  10167. Set a specific pan law to be used for the measurement of dual mono files.
  10168. This parameter is optional, and has a default value of -3.01dB.
  10169. @end table
  10170. @subsection Examples
  10171. @itemize
  10172. @item
  10173. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  10174. @example
  10175. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  10176. @end example
  10177. @item
  10178. Run an analysis with @command{ffmpeg}:
  10179. @example
  10180. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  10181. @end example
  10182. @end itemize
  10183. @section interleave, ainterleave
  10184. Temporally interleave frames from several inputs.
  10185. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  10186. These filters read frames from several inputs and send the oldest
  10187. queued frame to the output.
  10188. Input streams must have a well defined, monotonically increasing frame
  10189. timestamp values.
  10190. In order to submit one frame to output, these filters need to enqueue
  10191. at least one frame for each input, so they cannot work in case one
  10192. input is not yet terminated and will not receive incoming frames.
  10193. For example consider the case when one input is a @code{select} filter
  10194. which always drop input frames. The @code{interleave} filter will keep
  10195. reading from that input, but it will never be able to send new frames
  10196. to output until the input will send an end-of-stream signal.
  10197. Also, depending on inputs synchronization, the filters will drop
  10198. frames in case one input receives more frames than the other ones, and
  10199. the queue is already filled.
  10200. These filters accept the following options:
  10201. @table @option
  10202. @item nb_inputs, n
  10203. Set the number of different inputs, it is 2 by default.
  10204. @end table
  10205. @subsection Examples
  10206. @itemize
  10207. @item
  10208. Interleave frames belonging to different streams using @command{ffmpeg}:
  10209. @example
  10210. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  10211. @end example
  10212. @item
  10213. Add flickering blur effect:
  10214. @example
  10215. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  10216. @end example
  10217. @end itemize
  10218. @section perms, aperms
  10219. Set read/write permissions for the output frames.
  10220. These filters are mainly aimed at developers to test direct path in the
  10221. following filter in the filtergraph.
  10222. The filters accept the following options:
  10223. @table @option
  10224. @item mode
  10225. Select the permissions mode.
  10226. It accepts the following values:
  10227. @table @samp
  10228. @item none
  10229. Do nothing. This is the default.
  10230. @item ro
  10231. Set all the output frames read-only.
  10232. @item rw
  10233. Set all the output frames directly writable.
  10234. @item toggle
  10235. Make the frame read-only if writable, and writable if read-only.
  10236. @item random
  10237. Set each output frame read-only or writable randomly.
  10238. @end table
  10239. @item seed
  10240. Set the seed for the @var{random} mode, must be an integer included between
  10241. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10242. @code{-1}, the filter will try to use a good random seed on a best effort
  10243. basis.
  10244. @end table
  10245. Note: in case of auto-inserted filter between the permission filter and the
  10246. following one, the permission might not be received as expected in that
  10247. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  10248. perms/aperms filter can avoid this problem.
  10249. @section realtime, arealtime
  10250. Slow down filtering to match real time approximatively.
  10251. These filters will pause the filtering for a variable amount of time to
  10252. match the output rate with the input timestamps.
  10253. They are similar to the @option{re} option to @code{ffmpeg}.
  10254. They accept the following options:
  10255. @table @option
  10256. @item limit
  10257. Time limit for the pauses. Any pause longer than that will be considered
  10258. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  10259. @end table
  10260. @section select, aselect
  10261. Select frames to pass in output.
  10262. This filter accepts the following options:
  10263. @table @option
  10264. @item expr, e
  10265. Set expression, which is evaluated for each input frame.
  10266. If the expression is evaluated to zero, the frame is discarded.
  10267. If the evaluation result is negative or NaN, the frame is sent to the
  10268. first output; otherwise it is sent to the output with index
  10269. @code{ceil(val)-1}, assuming that the input index starts from 0.
  10270. For example a value of @code{1.2} corresponds to the output with index
  10271. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  10272. @item outputs, n
  10273. Set the number of outputs. The output to which to send the selected
  10274. frame is based on the result of the evaluation. Default value is 1.
  10275. @end table
  10276. The expression can contain the following constants:
  10277. @table @option
  10278. @item n
  10279. The (sequential) number of the filtered frame, starting from 0.
  10280. @item selected_n
  10281. The (sequential) number of the selected frame, starting from 0.
  10282. @item prev_selected_n
  10283. The sequential number of the last selected frame. It's NAN if undefined.
  10284. @item TB
  10285. The timebase of the input timestamps.
  10286. @item pts
  10287. The PTS (Presentation TimeStamp) of the filtered video frame,
  10288. expressed in @var{TB} units. It's NAN if undefined.
  10289. @item t
  10290. The PTS of the filtered video frame,
  10291. expressed in seconds. It's NAN if undefined.
  10292. @item prev_pts
  10293. The PTS of the previously filtered video frame. It's NAN if undefined.
  10294. @item prev_selected_pts
  10295. The PTS of the last previously filtered video frame. It's NAN if undefined.
  10296. @item prev_selected_t
  10297. The PTS of the last previously selected video frame. It's NAN if undefined.
  10298. @item start_pts
  10299. The PTS of the first video frame in the video. It's NAN if undefined.
  10300. @item start_t
  10301. The time of the first video frame in the video. It's NAN if undefined.
  10302. @item pict_type @emph{(video only)}
  10303. The type of the filtered frame. It can assume one of the following
  10304. values:
  10305. @table @option
  10306. @item I
  10307. @item P
  10308. @item B
  10309. @item S
  10310. @item SI
  10311. @item SP
  10312. @item BI
  10313. @end table
  10314. @item interlace_type @emph{(video only)}
  10315. The frame interlace type. It can assume one of the following values:
  10316. @table @option
  10317. @item PROGRESSIVE
  10318. The frame is progressive (not interlaced).
  10319. @item TOPFIRST
  10320. The frame is top-field-first.
  10321. @item BOTTOMFIRST
  10322. The frame is bottom-field-first.
  10323. @end table
  10324. @item consumed_sample_n @emph{(audio only)}
  10325. the number of selected samples before the current frame
  10326. @item samples_n @emph{(audio only)}
  10327. the number of samples in the current frame
  10328. @item sample_rate @emph{(audio only)}
  10329. the input sample rate
  10330. @item key
  10331. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  10332. @item pos
  10333. the position in the file of the filtered frame, -1 if the information
  10334. is not available (e.g. for synthetic video)
  10335. @item scene @emph{(video only)}
  10336. value between 0 and 1 to indicate a new scene; a low value reflects a low
  10337. probability for the current frame to introduce a new scene, while a higher
  10338. value means the current frame is more likely to be one (see the example below)
  10339. @item concatdec_select
  10340. The concat demuxer can select only part of a concat input file by setting an
  10341. inpoint and an outpoint, but the output packets may not be entirely contained
  10342. in the selected interval. By using this variable, it is possible to skip frames
  10343. generated by the concat demuxer which are not exactly contained in the selected
  10344. interval.
  10345. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  10346. and the @var{lavf.concat.duration} packet metadata values which are also
  10347. present in the decoded frames.
  10348. The @var{concatdec_select} variable is -1 if the frame pts is at least
  10349. start_time and either the duration metadata is missing or the frame pts is less
  10350. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  10351. missing.
  10352. That basically means that an input frame is selected if its pts is within the
  10353. interval set by the concat demuxer.
  10354. @end table
  10355. The default value of the select expression is "1".
  10356. @subsection Examples
  10357. @itemize
  10358. @item
  10359. Select all frames in input:
  10360. @example
  10361. select
  10362. @end example
  10363. The example above is the same as:
  10364. @example
  10365. select=1
  10366. @end example
  10367. @item
  10368. Skip all frames:
  10369. @example
  10370. select=0
  10371. @end example
  10372. @item
  10373. Select only I-frames:
  10374. @example
  10375. select='eq(pict_type\,I)'
  10376. @end example
  10377. @item
  10378. Select one frame every 100:
  10379. @example
  10380. select='not(mod(n\,100))'
  10381. @end example
  10382. @item
  10383. Select only frames contained in the 10-20 time interval:
  10384. @example
  10385. select=between(t\,10\,20)
  10386. @end example
  10387. @item
  10388. Select only I frames contained in the 10-20 time interval:
  10389. @example
  10390. select=between(t\,10\,20)*eq(pict_type\,I)
  10391. @end example
  10392. @item
  10393. Select frames with a minimum distance of 10 seconds:
  10394. @example
  10395. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  10396. @end example
  10397. @item
  10398. Use aselect to select only audio frames with samples number > 100:
  10399. @example
  10400. aselect='gt(samples_n\,100)'
  10401. @end example
  10402. @item
  10403. Create a mosaic of the first scenes:
  10404. @example
  10405. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  10406. @end example
  10407. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  10408. choice.
  10409. @item
  10410. Send even and odd frames to separate outputs, and compose them:
  10411. @example
  10412. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  10413. @end example
  10414. @item
  10415. Select useful frames from an ffconcat file which is using inpoints and
  10416. outpoints but where the source files are not intra frame only.
  10417. @example
  10418. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  10419. @end example
  10420. @end itemize
  10421. @section selectivecolor
  10422. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10423. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10424. by the "purity" of the color (that is, how saturated it already is).
  10425. This filter is similar to the Adobe Photoshop Selective Color tool.
  10426. The filter accepts the following options:
  10427. @table @option
  10428. @item correction_method
  10429. Select color correction method.
  10430. Available values are:
  10431. @table @samp
  10432. @item absolute
  10433. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10434. component value).
  10435. @item relative
  10436. Specified adjustments are relative to the original component value.
  10437. @end table
  10438. Default is @code{absolute}.
  10439. @item reds
  10440. Adjustments for red pixels (pixels where the red component is the maximum)
  10441. @item yellows
  10442. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10443. @item greens
  10444. Adjustments for green pixels (pixels where the green component is the maximum)
  10445. @item cyans
  10446. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10447. @item blues
  10448. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10449. @item magentas
  10450. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10451. @item whites
  10452. Adjustments for white pixels (pixels where all components are greater than 128)
  10453. @item neutrals
  10454. Adjustments for all pixels except pure black and pure white
  10455. @item blacks
  10456. Adjustments for black pixels (pixels where all components are lesser than 128)
  10457. @item psfile
  10458. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10459. @end table
  10460. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10461. 4 space separated floating point adjustment values in the [-1,1] range,
  10462. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10463. pixels of its range.
  10464. @subsection Examples
  10465. @itemize
  10466. @item
  10467. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10468. increase magenta by 27% in blue areas:
  10469. @example
  10470. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10471. @end example
  10472. @item
  10473. Use a Photoshop selective color preset:
  10474. @example
  10475. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10476. @end example
  10477. @end itemize
  10478. @section sendcmd, asendcmd
  10479. Send commands to filters in the filtergraph.
  10480. These filters read commands to be sent to other filters in the
  10481. filtergraph.
  10482. @code{sendcmd} must be inserted between two video filters,
  10483. @code{asendcmd} must be inserted between two audio filters, but apart
  10484. from that they act the same way.
  10485. The specification of commands can be provided in the filter arguments
  10486. with the @var{commands} option, or in a file specified by the
  10487. @var{filename} option.
  10488. These filters accept the following options:
  10489. @table @option
  10490. @item commands, c
  10491. Set the commands to be read and sent to the other filters.
  10492. @item filename, f
  10493. Set the filename of the commands to be read and sent to the other
  10494. filters.
  10495. @end table
  10496. @subsection Commands syntax
  10497. A commands description consists of a sequence of interval
  10498. specifications, comprising a list of commands to be executed when a
  10499. particular event related to that interval occurs. The occurring event
  10500. is typically the current frame time entering or leaving a given time
  10501. interval.
  10502. An interval is specified by the following syntax:
  10503. @example
  10504. @var{START}[-@var{END}] @var{COMMANDS};
  10505. @end example
  10506. The time interval is specified by the @var{START} and @var{END} times.
  10507. @var{END} is optional and defaults to the maximum time.
  10508. The current frame time is considered within the specified interval if
  10509. it is included in the interval [@var{START}, @var{END}), that is when
  10510. the time is greater or equal to @var{START} and is lesser than
  10511. @var{END}.
  10512. @var{COMMANDS} consists of a sequence of one or more command
  10513. specifications, separated by ",", relating to that interval. The
  10514. syntax of a command specification is given by:
  10515. @example
  10516. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  10517. @end example
  10518. @var{FLAGS} is optional and specifies the type of events relating to
  10519. the time interval which enable sending the specified command, and must
  10520. be a non-null sequence of identifier flags separated by "+" or "|" and
  10521. enclosed between "[" and "]".
  10522. The following flags are recognized:
  10523. @table @option
  10524. @item enter
  10525. The command is sent when the current frame timestamp enters the
  10526. specified interval. In other words, the command is sent when the
  10527. previous frame timestamp was not in the given interval, and the
  10528. current is.
  10529. @item leave
  10530. The command is sent when the current frame timestamp leaves the
  10531. specified interval. In other words, the command is sent when the
  10532. previous frame timestamp was in the given interval, and the
  10533. current is not.
  10534. @end table
  10535. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  10536. assumed.
  10537. @var{TARGET} specifies the target of the command, usually the name of
  10538. the filter class or a specific filter instance name.
  10539. @var{COMMAND} specifies the name of the command for the target filter.
  10540. @var{ARG} is optional and specifies the optional list of argument for
  10541. the given @var{COMMAND}.
  10542. Between one interval specification and another, whitespaces, or
  10543. sequences of characters starting with @code{#} until the end of line,
  10544. are ignored and can be used to annotate comments.
  10545. A simplified BNF description of the commands specification syntax
  10546. follows:
  10547. @example
  10548. @var{COMMAND_FLAG} ::= "enter" | "leave"
  10549. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  10550. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  10551. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  10552. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  10553. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  10554. @end example
  10555. @subsection Examples
  10556. @itemize
  10557. @item
  10558. Specify audio tempo change at second 4:
  10559. @example
  10560. asendcmd=c='4.0 atempo tempo 1.5',atempo
  10561. @end example
  10562. @item
  10563. Specify a list of drawtext and hue commands in a file.
  10564. @example
  10565. # show text in the interval 5-10
  10566. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  10567. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  10568. # desaturate the image in the interval 15-20
  10569. 15.0-20.0 [enter] hue s 0,
  10570. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  10571. [leave] hue s 1,
  10572. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  10573. # apply an exponential saturation fade-out effect, starting from time 25
  10574. 25 [enter] hue s exp(25-t)
  10575. @end example
  10576. A filtergraph allowing to read and process the above command list
  10577. stored in a file @file{test.cmd}, can be specified with:
  10578. @example
  10579. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  10580. @end example
  10581. @end itemize
  10582. @anchor{setpts}
  10583. @section setpts, asetpts
  10584. Change the PTS (presentation timestamp) of the input frames.
  10585. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  10586. This filter accepts the following options:
  10587. @table @option
  10588. @item expr
  10589. The expression which is evaluated for each frame to construct its timestamp.
  10590. @end table
  10591. The expression is evaluated through the eval API and can contain the following
  10592. constants:
  10593. @table @option
  10594. @item FRAME_RATE
  10595. frame rate, only defined for constant frame-rate video
  10596. @item PTS
  10597. The presentation timestamp in input
  10598. @item N
  10599. The count of the input frame for video or the number of consumed samples,
  10600. not including the current frame for audio, starting from 0.
  10601. @item NB_CONSUMED_SAMPLES
  10602. The number of consumed samples, not including the current frame (only
  10603. audio)
  10604. @item NB_SAMPLES, S
  10605. The number of samples in the current frame (only audio)
  10606. @item SAMPLE_RATE, SR
  10607. The audio sample rate.
  10608. @item STARTPTS
  10609. The PTS of the first frame.
  10610. @item STARTT
  10611. the time in seconds of the first frame
  10612. @item INTERLACED
  10613. State whether the current frame is interlaced.
  10614. @item T
  10615. the time in seconds of the current frame
  10616. @item POS
  10617. original position in the file of the frame, or undefined if undefined
  10618. for the current frame
  10619. @item PREV_INPTS
  10620. The previous input PTS.
  10621. @item PREV_INT
  10622. previous input time in seconds
  10623. @item PREV_OUTPTS
  10624. The previous output PTS.
  10625. @item PREV_OUTT
  10626. previous output time in seconds
  10627. @item RTCTIME
  10628. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  10629. instead.
  10630. @item RTCSTART
  10631. The wallclock (RTC) time at the start of the movie in microseconds.
  10632. @item TB
  10633. The timebase of the input timestamps.
  10634. @end table
  10635. @subsection Examples
  10636. @itemize
  10637. @item
  10638. Start counting PTS from zero
  10639. @example
  10640. setpts=PTS-STARTPTS
  10641. @end example
  10642. @item
  10643. Apply fast motion effect:
  10644. @example
  10645. setpts=0.5*PTS
  10646. @end example
  10647. @item
  10648. Apply slow motion effect:
  10649. @example
  10650. setpts=2.0*PTS
  10651. @end example
  10652. @item
  10653. Set fixed rate of 25 frames per second:
  10654. @example
  10655. setpts=N/(25*TB)
  10656. @end example
  10657. @item
  10658. Set fixed rate 25 fps with some jitter:
  10659. @example
  10660. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  10661. @end example
  10662. @item
  10663. Apply an offset of 10 seconds to the input PTS:
  10664. @example
  10665. setpts=PTS+10/TB
  10666. @end example
  10667. @item
  10668. Generate timestamps from a "live source" and rebase onto the current timebase:
  10669. @example
  10670. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  10671. @end example
  10672. @item
  10673. Generate timestamps by counting samples:
  10674. @example
  10675. asetpts=N/SR/TB
  10676. @end example
  10677. @end itemize
  10678. @section settb, asettb
  10679. Set the timebase to use for the output frames timestamps.
  10680. It is mainly useful for testing timebase configuration.
  10681. It accepts the following parameters:
  10682. @table @option
  10683. @item expr, tb
  10684. The expression which is evaluated into the output timebase.
  10685. @end table
  10686. The value for @option{tb} is an arithmetic expression representing a
  10687. rational. The expression can contain the constants "AVTB" (the default
  10688. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  10689. audio only). Default value is "intb".
  10690. @subsection Examples
  10691. @itemize
  10692. @item
  10693. Set the timebase to 1/25:
  10694. @example
  10695. settb=expr=1/25
  10696. @end example
  10697. @item
  10698. Set the timebase to 1/10:
  10699. @example
  10700. settb=expr=0.1
  10701. @end example
  10702. @item
  10703. Set the timebase to 1001/1000:
  10704. @example
  10705. settb=1+0.001
  10706. @end example
  10707. @item
  10708. Set the timebase to 2*intb:
  10709. @example
  10710. settb=2*intb
  10711. @end example
  10712. @item
  10713. Set the default timebase value:
  10714. @example
  10715. settb=AVTB
  10716. @end example
  10717. @end itemize
  10718. @section showcqt
  10719. Convert input audio to a video output representing frequency spectrum
  10720. logarithmically using Brown-Puckette constant Q transform algorithm with
  10721. direct frequency domain coefficient calculation (but the transform itself
  10722. is not really constant Q, instead the Q factor is actually variable/clamped),
  10723. with musical tone scale, from E0 to D#10.
  10724. The filter accepts the following options:
  10725. @table @option
  10726. @item size, s
  10727. Specify the video size for the output. It must be even. For the syntax of this option,
  10728. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10729. Default value is @code{1920x1080}.
  10730. @item fps, rate, r
  10731. Set the output frame rate. Default value is @code{25}.
  10732. @item bar_h
  10733. Set the bargraph height. It must be even. Default value is @code{-1} which
  10734. computes the bargraph height automatically.
  10735. @item axis_h
  10736. Set the axis height. It must be even. Default value is @code{-1} which computes
  10737. the axis height automatically.
  10738. @item sono_h
  10739. Set the sonogram height. It must be even. Default value is @code{-1} which
  10740. computes the sonogram height automatically.
  10741. @item fullhd
  10742. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  10743. instead. Default value is @code{1}.
  10744. @item sono_v, volume
  10745. Specify the sonogram volume expression. It can contain variables:
  10746. @table @option
  10747. @item bar_v
  10748. the @var{bar_v} evaluated expression
  10749. @item frequency, freq, f
  10750. the frequency where it is evaluated
  10751. @item timeclamp, tc
  10752. the value of @var{timeclamp} option
  10753. @end table
  10754. and functions:
  10755. @table @option
  10756. @item a_weighting(f)
  10757. A-weighting of equal loudness
  10758. @item b_weighting(f)
  10759. B-weighting of equal loudness
  10760. @item c_weighting(f)
  10761. C-weighting of equal loudness.
  10762. @end table
  10763. Default value is @code{16}.
  10764. @item bar_v, volume2
  10765. Specify the bargraph volume expression. It can contain variables:
  10766. @table @option
  10767. @item sono_v
  10768. the @var{sono_v} evaluated expression
  10769. @item frequency, freq, f
  10770. the frequency where it is evaluated
  10771. @item timeclamp, tc
  10772. the value of @var{timeclamp} option
  10773. @end table
  10774. and functions:
  10775. @table @option
  10776. @item a_weighting(f)
  10777. A-weighting of equal loudness
  10778. @item b_weighting(f)
  10779. B-weighting of equal loudness
  10780. @item c_weighting(f)
  10781. C-weighting of equal loudness.
  10782. @end table
  10783. Default value is @code{sono_v}.
  10784. @item sono_g, gamma
  10785. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  10786. higher gamma makes the spectrum having more range. Default value is @code{3}.
  10787. Acceptable range is @code{[1, 7]}.
  10788. @item bar_g, gamma2
  10789. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  10790. @code{[1, 7]}.
  10791. @item timeclamp, tc
  10792. Specify the transform timeclamp. At low frequency, there is trade-off between
  10793. accuracy in time domain and frequency domain. If timeclamp is lower,
  10794. event in time domain is represented more accurately (such as fast bass drum),
  10795. otherwise event in frequency domain is represented more accurately
  10796. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  10797. @item basefreq
  10798. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  10799. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  10800. @item endfreq
  10801. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  10802. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  10803. @item coeffclamp
  10804. This option is deprecated and ignored.
  10805. @item tlength
  10806. Specify the transform length in time domain. Use this option to control accuracy
  10807. trade-off between time domain and frequency domain at every frequency sample.
  10808. It can contain variables:
  10809. @table @option
  10810. @item frequency, freq, f
  10811. the frequency where it is evaluated
  10812. @item timeclamp, tc
  10813. the value of @var{timeclamp} option.
  10814. @end table
  10815. Default value is @code{384*tc/(384+tc*f)}.
  10816. @item count
  10817. Specify the transform count for every video frame. Default value is @code{6}.
  10818. Acceptable range is @code{[1, 30]}.
  10819. @item fcount
  10820. Specify the transform count for every single pixel. Default value is @code{0},
  10821. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  10822. @item fontfile
  10823. Specify font file for use with freetype to draw the axis. If not specified,
  10824. use embedded font. Note that drawing with font file or embedded font is not
  10825. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  10826. option instead.
  10827. @item fontcolor
  10828. Specify font color expression. This is arithmetic expression that should return
  10829. integer value 0xRRGGBB. It can contain variables:
  10830. @table @option
  10831. @item frequency, freq, f
  10832. the frequency where it is evaluated
  10833. @item timeclamp, tc
  10834. the value of @var{timeclamp} option
  10835. @end table
  10836. and functions:
  10837. @table @option
  10838. @item midi(f)
  10839. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  10840. @item r(x), g(x), b(x)
  10841. red, green, and blue value of intensity x.
  10842. @end table
  10843. Default value is @code{st(0, (midi(f)-59.5)/12);
  10844. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  10845. r(1-ld(1)) + b(ld(1))}.
  10846. @item axisfile
  10847. Specify image file to draw the axis. This option override @var{fontfile} and
  10848. @var{fontcolor} option.
  10849. @item axis, text
  10850. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  10851. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  10852. Default value is @code{1}.
  10853. @end table
  10854. @subsection Examples
  10855. @itemize
  10856. @item
  10857. Playing audio while showing the spectrum:
  10858. @example
  10859. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  10860. @end example
  10861. @item
  10862. Same as above, but with frame rate 30 fps:
  10863. @example
  10864. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  10865. @end example
  10866. @item
  10867. Playing at 1280x720:
  10868. @example
  10869. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  10870. @end example
  10871. @item
  10872. Disable sonogram display:
  10873. @example
  10874. sono_h=0
  10875. @end example
  10876. @item
  10877. A1 and its harmonics: A1, A2, (near)E3, A3:
  10878. @example
  10879. 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),
  10880. asplit[a][out1]; [a] showcqt [out0]'
  10881. @end example
  10882. @item
  10883. Same as above, but with more accuracy in frequency domain:
  10884. @example
  10885. 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),
  10886. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  10887. @end example
  10888. @item
  10889. Custom volume:
  10890. @example
  10891. bar_v=10:sono_v=bar_v*a_weighting(f)
  10892. @end example
  10893. @item
  10894. Custom gamma, now spectrum is linear to the amplitude.
  10895. @example
  10896. bar_g=2:sono_g=2
  10897. @end example
  10898. @item
  10899. Custom tlength equation:
  10900. @example
  10901. 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)))'
  10902. @end example
  10903. @item
  10904. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  10905. @example
  10906. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  10907. @end example
  10908. @item
  10909. Custom frequency range with custom axis using image file:
  10910. @example
  10911. axisfile=myaxis.png:basefreq=40:endfreq=10000
  10912. @end example
  10913. @end itemize
  10914. @section showfreqs
  10915. Convert input audio to video output representing the audio power spectrum.
  10916. Audio amplitude is on Y-axis while frequency is on X-axis.
  10917. The filter accepts the following options:
  10918. @table @option
  10919. @item size, s
  10920. Specify size of video. For the syntax of this option, check the
  10921. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10922. Default is @code{1024x512}.
  10923. @item mode
  10924. Set display mode.
  10925. This set how each frequency bin will be represented.
  10926. It accepts the following values:
  10927. @table @samp
  10928. @item line
  10929. @item bar
  10930. @item dot
  10931. @end table
  10932. Default is @code{bar}.
  10933. @item ascale
  10934. Set amplitude scale.
  10935. It accepts the following values:
  10936. @table @samp
  10937. @item lin
  10938. Linear scale.
  10939. @item sqrt
  10940. Square root scale.
  10941. @item cbrt
  10942. Cubic root scale.
  10943. @item log
  10944. Logarithmic scale.
  10945. @end table
  10946. Default is @code{log}.
  10947. @item fscale
  10948. Set frequency scale.
  10949. It accepts the following values:
  10950. @table @samp
  10951. @item lin
  10952. Linear scale.
  10953. @item log
  10954. Logarithmic scale.
  10955. @item rlog
  10956. Reverse logarithmic scale.
  10957. @end table
  10958. Default is @code{lin}.
  10959. @item win_size
  10960. Set window size.
  10961. It accepts the following values:
  10962. @table @samp
  10963. @item w16
  10964. @item w32
  10965. @item w64
  10966. @item w128
  10967. @item w256
  10968. @item w512
  10969. @item w1024
  10970. @item w2048
  10971. @item w4096
  10972. @item w8192
  10973. @item w16384
  10974. @item w32768
  10975. @item w65536
  10976. @end table
  10977. Default is @code{w2048}
  10978. @item win_func
  10979. Set windowing function.
  10980. It accepts the following values:
  10981. @table @samp
  10982. @item rect
  10983. @item bartlett
  10984. @item hanning
  10985. @item hamming
  10986. @item blackman
  10987. @item welch
  10988. @item flattop
  10989. @item bharris
  10990. @item bnuttall
  10991. @item bhann
  10992. @item sine
  10993. @item nuttall
  10994. @item lanczos
  10995. @item gauss
  10996. @end table
  10997. Default is @code{hanning}.
  10998. @item overlap
  10999. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  11000. which means optimal overlap for selected window function will be picked.
  11001. @item averaging
  11002. Set time averaging. Setting this to 0 will display current maximal peaks.
  11003. Default is @code{1}, which means time averaging is disabled.
  11004. @item colors
  11005. Specify list of colors separated by space or by '|' which will be used to
  11006. draw channel frequencies. Unrecognized or missing colors will be replaced
  11007. by white color.
  11008. @end table
  11009. @section showspectrum
  11010. Convert input audio to a video output, representing the audio frequency
  11011. spectrum.
  11012. The filter accepts the following options:
  11013. @table @option
  11014. @item size, s
  11015. Specify the video size for the output. For the syntax of this option, check the
  11016. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11017. Default value is @code{640x512}.
  11018. @item slide
  11019. Specify how the spectrum should slide along the window.
  11020. It accepts the following values:
  11021. @table @samp
  11022. @item replace
  11023. the samples start again on the left when they reach the right
  11024. @item scroll
  11025. the samples scroll from right to left
  11026. @item fullframe
  11027. frames are only produced when the samples reach the right
  11028. @end table
  11029. Default value is @code{replace}.
  11030. @item mode
  11031. Specify display mode.
  11032. It accepts the following values:
  11033. @table @samp
  11034. @item combined
  11035. all channels are displayed in the same row
  11036. @item separate
  11037. all channels are displayed in separate rows
  11038. @end table
  11039. Default value is @samp{combined}.
  11040. @item color
  11041. Specify display color mode.
  11042. It accepts the following values:
  11043. @table @samp
  11044. @item channel
  11045. each channel is displayed in a separate color
  11046. @item intensity
  11047. each channel is is displayed using the same color scheme
  11048. @end table
  11049. Default value is @samp{channel}.
  11050. @item scale
  11051. Specify scale used for calculating intensity color values.
  11052. It accepts the following values:
  11053. @table @samp
  11054. @item lin
  11055. linear
  11056. @item sqrt
  11057. square root, default
  11058. @item cbrt
  11059. cubic root
  11060. @item log
  11061. logarithmic
  11062. @end table
  11063. Default value is @samp{sqrt}.
  11064. @item saturation
  11065. Set saturation modifier for displayed colors. Negative values provide
  11066. alternative color scheme. @code{0} is no saturation at all.
  11067. Saturation must be in [-10.0, 10.0] range.
  11068. Default value is @code{1}.
  11069. @item win_func
  11070. Set window function.
  11071. It accepts the following values:
  11072. @table @samp
  11073. @item none
  11074. No samples pre-processing (do not expect this to be faster)
  11075. @item hann
  11076. Hann window
  11077. @item hamming
  11078. Hamming window
  11079. @item blackman
  11080. Blackman window
  11081. @end table
  11082. Default value is @code{hann}.
  11083. @end table
  11084. The usage is very similar to the showwaves filter; see the examples in that
  11085. section.
  11086. @subsection Examples
  11087. @itemize
  11088. @item
  11089. Large window with logarithmic color scaling:
  11090. @example
  11091. showspectrum=s=1280x480:scale=log
  11092. @end example
  11093. @item
  11094. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  11095. @example
  11096. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11097. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  11098. @end example
  11099. @end itemize
  11100. @section showvolume
  11101. Convert input audio volume to a video output.
  11102. The filter accepts the following options:
  11103. @table @option
  11104. @item rate, r
  11105. Set video rate.
  11106. @item b
  11107. Set border width, allowed range is [0, 5]. Default is 1.
  11108. @item w
  11109. Set channel width, allowed range is [80, 1080]. Default is 400.
  11110. @item h
  11111. Set channel height, allowed range is [1, 100]. Default is 20.
  11112. @item f
  11113. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  11114. @item c
  11115. Set volume color expression.
  11116. The expression can use the following variables:
  11117. @table @option
  11118. @item VOLUME
  11119. Current max volume of channel in dB.
  11120. @item CHANNEL
  11121. Current channel number, starting from 0.
  11122. @end table
  11123. @item t
  11124. If set, displays channel names. Default is enabled.
  11125. @item v
  11126. If set, displays volume values. Default is enabled.
  11127. @end table
  11128. @section showwaves
  11129. Convert input audio to a video output, representing the samples waves.
  11130. The filter accepts the following options:
  11131. @table @option
  11132. @item size, s
  11133. Specify the video size for the output. For the syntax of this option, check the
  11134. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11135. Default value is @code{600x240}.
  11136. @item mode
  11137. Set display mode.
  11138. Available values are:
  11139. @table @samp
  11140. @item point
  11141. Draw a point for each sample.
  11142. @item line
  11143. Draw a vertical line for each sample.
  11144. @item p2p
  11145. Draw a point for each sample and a line between them.
  11146. @item cline
  11147. Draw a centered vertical line for each sample.
  11148. @end table
  11149. Default value is @code{point}.
  11150. @item n
  11151. Set the number of samples which are printed on the same column. A
  11152. larger value will decrease the frame rate. Must be a positive
  11153. integer. This option can be set only if the value for @var{rate}
  11154. is not explicitly specified.
  11155. @item rate, r
  11156. Set the (approximate) output frame rate. This is done by setting the
  11157. option @var{n}. Default value is "25".
  11158. @item split_channels
  11159. Set if channels should be drawn separately or overlap. Default value is 0.
  11160. @end table
  11161. @subsection Examples
  11162. @itemize
  11163. @item
  11164. Output the input file audio and the corresponding video representation
  11165. at the same time:
  11166. @example
  11167. amovie=a.mp3,asplit[out0],showwaves[out1]
  11168. @end example
  11169. @item
  11170. Create a synthetic signal and show it with showwaves, forcing a
  11171. frame rate of 30 frames per second:
  11172. @example
  11173. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  11174. @end example
  11175. @end itemize
  11176. @section showwavespic
  11177. Convert input audio to a single video frame, representing the samples waves.
  11178. The filter accepts the following options:
  11179. @table @option
  11180. @item size, s
  11181. Specify the video size for the output. For the syntax of this option, check the
  11182. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11183. Default value is @code{600x240}.
  11184. @item split_channels
  11185. Set if channels should be drawn separately or overlap. Default value is 0.
  11186. @end table
  11187. @subsection Examples
  11188. @itemize
  11189. @item
  11190. Extract a channel split representation of the wave form of a whole audio track
  11191. in a 1024x800 picture using @command{ffmpeg}:
  11192. @example
  11193. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  11194. @end example
  11195. @end itemize
  11196. @section split, asplit
  11197. Split input into several identical outputs.
  11198. @code{asplit} works with audio input, @code{split} with video.
  11199. The filter accepts a single parameter which specifies the number of outputs. If
  11200. unspecified, it defaults to 2.
  11201. @subsection Examples
  11202. @itemize
  11203. @item
  11204. Create two separate outputs from the same input:
  11205. @example
  11206. [in] split [out0][out1]
  11207. @end example
  11208. @item
  11209. To create 3 or more outputs, you need to specify the number of
  11210. outputs, like in:
  11211. @example
  11212. [in] asplit=3 [out0][out1][out2]
  11213. @end example
  11214. @item
  11215. Create two separate outputs from the same input, one cropped and
  11216. one padded:
  11217. @example
  11218. [in] split [splitout1][splitout2];
  11219. [splitout1] crop=100:100:0:0 [cropout];
  11220. [splitout2] pad=200:200:100:100 [padout];
  11221. @end example
  11222. @item
  11223. Create 5 copies of the input audio with @command{ffmpeg}:
  11224. @example
  11225. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  11226. @end example
  11227. @end itemize
  11228. @section zmq, azmq
  11229. Receive commands sent through a libzmq client, and forward them to
  11230. filters in the filtergraph.
  11231. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  11232. must be inserted between two video filters, @code{azmq} between two
  11233. audio filters.
  11234. To enable these filters you need to install the libzmq library and
  11235. headers and configure FFmpeg with @code{--enable-libzmq}.
  11236. For more information about libzmq see:
  11237. @url{http://www.zeromq.org/}
  11238. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  11239. receives messages sent through a network interface defined by the
  11240. @option{bind_address} option.
  11241. The received message must be in the form:
  11242. @example
  11243. @var{TARGET} @var{COMMAND} [@var{ARG}]
  11244. @end example
  11245. @var{TARGET} specifies the target of the command, usually the name of
  11246. the filter class or a specific filter instance name.
  11247. @var{COMMAND} specifies the name of the command for the target filter.
  11248. @var{ARG} is optional and specifies the optional argument list for the
  11249. given @var{COMMAND}.
  11250. Upon reception, the message is processed and the corresponding command
  11251. is injected into the filtergraph. Depending on the result, the filter
  11252. will send a reply to the client, adopting the format:
  11253. @example
  11254. @var{ERROR_CODE} @var{ERROR_REASON}
  11255. @var{MESSAGE}
  11256. @end example
  11257. @var{MESSAGE} is optional.
  11258. @subsection Examples
  11259. Look at @file{tools/zmqsend} for an example of a zmq client which can
  11260. be used to send commands processed by these filters.
  11261. Consider the following filtergraph generated by @command{ffplay}
  11262. @example
  11263. ffplay -dumpgraph 1 -f lavfi "
  11264. color=s=100x100:c=red [l];
  11265. color=s=100x100:c=blue [r];
  11266. nullsrc=s=200x100, zmq [bg];
  11267. [bg][l] overlay [bg+l];
  11268. [bg+l][r] overlay=x=100 "
  11269. @end example
  11270. To change the color of the left side of the video, the following
  11271. command can be used:
  11272. @example
  11273. echo Parsed_color_0 c yellow | tools/zmqsend
  11274. @end example
  11275. To change the right side:
  11276. @example
  11277. echo Parsed_color_1 c pink | tools/zmqsend
  11278. @end example
  11279. @c man end MULTIMEDIA FILTERS
  11280. @chapter Multimedia Sources
  11281. @c man begin MULTIMEDIA SOURCES
  11282. Below is a description of the currently available multimedia sources.
  11283. @section amovie
  11284. This is the same as @ref{movie} source, except it selects an audio
  11285. stream by default.
  11286. @anchor{movie}
  11287. @section movie
  11288. Read audio and/or video stream(s) from a movie container.
  11289. It accepts the following parameters:
  11290. @table @option
  11291. @item filename
  11292. The name of the resource to read (not necessarily a file; it can also be a
  11293. device or a stream accessed through some protocol).
  11294. @item format_name, f
  11295. Specifies the format assumed for the movie to read, and can be either
  11296. the name of a container or an input device. If not specified, the
  11297. format is guessed from @var{movie_name} or by probing.
  11298. @item seek_point, sp
  11299. Specifies the seek point in seconds. The frames will be output
  11300. starting from this seek point. The parameter is evaluated with
  11301. @code{av_strtod}, so the numerical value may be suffixed by an IS
  11302. postfix. The default value is "0".
  11303. @item streams, s
  11304. Specifies the streams to read. Several streams can be specified,
  11305. separated by "+". The source will then have as many outputs, in the
  11306. same order. The syntax is explained in the ``Stream specifiers''
  11307. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  11308. respectively the default (best suited) video and audio stream. Default
  11309. is "dv", or "da" if the filter is called as "amovie".
  11310. @item stream_index, si
  11311. Specifies the index of the video stream to read. If the value is -1,
  11312. the most suitable video stream will be automatically selected. The default
  11313. value is "-1". Deprecated. If the filter is called "amovie", it will select
  11314. audio instead of video.
  11315. @item loop
  11316. Specifies how many times to read the stream in sequence.
  11317. If the value is less than 1, the stream will be read again and again.
  11318. Default value is "1".
  11319. Note that when the movie is looped the source timestamps are not
  11320. changed, so it will generate non monotonically increasing timestamps.
  11321. @end table
  11322. It allows overlaying a second video on top of the main input of
  11323. a filtergraph, as shown in this graph:
  11324. @example
  11325. input -----------> deltapts0 --> overlay --> output
  11326. ^
  11327. |
  11328. movie --> scale--> deltapts1 -------+
  11329. @end example
  11330. @subsection Examples
  11331. @itemize
  11332. @item
  11333. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  11334. on top of the input labelled "in":
  11335. @example
  11336. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11337. [in] setpts=PTS-STARTPTS [main];
  11338. [main][over] overlay=16:16 [out]
  11339. @end example
  11340. @item
  11341. Read from a video4linux2 device, and overlay it on top of the input
  11342. labelled "in":
  11343. @example
  11344. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11345. [in] setpts=PTS-STARTPTS [main];
  11346. [main][over] overlay=16:16 [out]
  11347. @end example
  11348. @item
  11349. Read the first video stream and the audio stream with id 0x81 from
  11350. dvd.vob; the video is connected to the pad named "video" and the audio is
  11351. connected to the pad named "audio":
  11352. @example
  11353. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  11354. @end example
  11355. @end itemize
  11356. @c man end MULTIMEDIA SOURCES