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.

15030 lines
410KB

  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 anequalizer
  779. High-order parametric multiband equalizer for each channel.
  780. It accepts the following parameters:
  781. @table @option
  782. @item params
  783. This option string is in format:
  784. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  785. Each equalizer band is separated by '|'.
  786. @table @option
  787. @item chn
  788. Set channel number to which equalization will be applied.
  789. If input doesn't have that channel the entry is ignored.
  790. @item cf
  791. Set central frequency for band.
  792. If input doesn't have that frequency the entry is ignored.
  793. @item w
  794. Set band width in hertz.
  795. @item g
  796. Set band gain in dB.
  797. @item f
  798. Set filter type for band, optional, can be:
  799. @table @samp
  800. @item 0
  801. Butterworth, this is default.
  802. @item 1
  803. Chebyshev type 1.
  804. @item 2
  805. Chebyshev type 2.
  806. @end table
  807. @end table
  808. @item curves
  809. With this option activated frequency response of anequalizer is displayed
  810. in video stream.
  811. @item size
  812. Set video stream size. Only useful if curves option is activated.
  813. @item mgain
  814. Set max gain that will be displayed. Only useful if curves option is activated.
  815. Setting this to reasonable value allows to display gain which is derived from
  816. neighbour bands which are too close to each other and thus produce higher gain
  817. when both are activated.
  818. @item fscale
  819. Set frequency scale used to draw frequency response in video output.
  820. Can be linear or logarithmic. Default is logarithmic.
  821. @item colors
  822. Set color for each channel curve which is going to be displayed in video stream.
  823. This is list of color names separated by space or by '|'.
  824. Unrecognised or missing colors will be replaced by white color.
  825. @end table
  826. @subsection Examples
  827. @itemize
  828. @item
  829. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  830. for first 2 channels using Chebyshev type 1 filter:
  831. @example
  832. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  833. @end example
  834. @end itemize
  835. @subsection Commands
  836. This filter supports the following commands:
  837. @table @option
  838. @item change
  839. Alter existing filter parameters.
  840. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  841. @var{fN} is existing filter number, starting from 0, if no such filter is available
  842. error is returned.
  843. @var{freq} set new frequency parameter.
  844. @var{width} set new width parameter in herz.
  845. @var{gain} set new gain parameter in dB.
  846. Full filter invocation with asendcmd may look like this:
  847. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  848. @end table
  849. @section anull
  850. Pass the audio source unchanged to the output.
  851. @section apad
  852. Pad the end of an audio stream with silence.
  853. This can be used together with @command{ffmpeg} @option{-shortest} to
  854. extend audio streams to the same length as the video stream.
  855. A description of the accepted options follows.
  856. @table @option
  857. @item packet_size
  858. Set silence packet size. Default value is 4096.
  859. @item pad_len
  860. Set the number of samples of silence to add to the end. After the
  861. value is reached, the stream is terminated. This option is mutually
  862. exclusive with @option{whole_len}.
  863. @item whole_len
  864. Set the minimum total number of samples in the output audio stream. If
  865. the value is longer than the input audio length, silence is added to
  866. the end, until the value is reached. This option is mutually exclusive
  867. with @option{pad_len}.
  868. @end table
  869. If neither the @option{pad_len} nor the @option{whole_len} option is
  870. set, the filter will add silence to the end of the input stream
  871. indefinitely.
  872. @subsection Examples
  873. @itemize
  874. @item
  875. Add 1024 samples of silence to the end of the input:
  876. @example
  877. apad=pad_len=1024
  878. @end example
  879. @item
  880. Make sure the audio output will contain at least 10000 samples, pad
  881. the input with silence if required:
  882. @example
  883. apad=whole_len=10000
  884. @end example
  885. @item
  886. Use @command{ffmpeg} to pad the audio input with silence, so that the
  887. video stream will always result the shortest and will be converted
  888. until the end in the output file when using the @option{shortest}
  889. option:
  890. @example
  891. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  892. @end example
  893. @end itemize
  894. @section aphaser
  895. Add a phasing effect to the input audio.
  896. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  897. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  898. A description of the accepted parameters follows.
  899. @table @option
  900. @item in_gain
  901. Set input gain. Default is 0.4.
  902. @item out_gain
  903. Set output gain. Default is 0.74
  904. @item delay
  905. Set delay in milliseconds. Default is 3.0.
  906. @item decay
  907. Set decay. Default is 0.4.
  908. @item speed
  909. Set modulation speed in Hz. Default is 0.5.
  910. @item type
  911. Set modulation type. Default is triangular.
  912. It accepts the following values:
  913. @table @samp
  914. @item triangular, t
  915. @item sinusoidal, s
  916. @end table
  917. @end table
  918. @section apulsator
  919. Audio pulsator is something between an autopanner and a tremolo.
  920. But it can produce funny stereo effects as well. Pulsator changes the volume
  921. of the left and right channel based on a LFO (low frequency oscillator) with
  922. different waveforms and shifted phases.
  923. This filter have the ability to define an offset between left and right
  924. channel. An offset of 0 means that both LFO shapes match each other.
  925. The left and right channel are altered equally - a conventional tremolo.
  926. An offset of 50% means that the shape of the right channel is exactly shifted
  927. in phase (or moved backwards about half of the frequency) - pulsator acts as
  928. an autopanner. At 1 both curves match again. Every setting in between moves the
  929. phase shift gapless between all stages and produces some "bypassing" sounds with
  930. sine and triangle waveforms. The more you set the offset near 1 (starting from
  931. the 0.5) the faster the signal passes from the left to the right speaker.
  932. The filter accepts the following options:
  933. @table @option
  934. @item level_in
  935. Set input gain. By default it is 1. Range is [0.015625 - 64].
  936. @item level_out
  937. Set output gain. By default it is 1. Range is [0.015625 - 64].
  938. @item mode
  939. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  940. sawup or sawdown. Default is sine.
  941. @item amount
  942. Set modulation. Define how much of original signal is affected by the LFO.
  943. @item offset_l
  944. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  945. @item offset_r
  946. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  947. @item width
  948. Set pulse width. Default is 1. Allowed range is [0 - 2].
  949. @item timing
  950. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  951. @item bpm
  952. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  953. is set to bpm.
  954. @item ms
  955. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  956. is set to ms.
  957. @item hz
  958. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  959. if timing is set to hz.
  960. @end table
  961. @anchor{aresample}
  962. @section aresample
  963. Resample the input audio to the specified parameters, using the
  964. libswresample library. If none are specified then the filter will
  965. automatically convert between its input and output.
  966. This filter is also able to stretch/squeeze the audio data to make it match
  967. the timestamps or to inject silence / cut out audio to make it match the
  968. timestamps, do a combination of both or do neither.
  969. The filter accepts the syntax
  970. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  971. expresses a sample rate and @var{resampler_options} is a list of
  972. @var{key}=@var{value} pairs, separated by ":". See the
  973. ffmpeg-resampler manual for the complete list of supported options.
  974. @subsection Examples
  975. @itemize
  976. @item
  977. Resample the input audio to 44100Hz:
  978. @example
  979. aresample=44100
  980. @end example
  981. @item
  982. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  983. samples per second compensation:
  984. @example
  985. aresample=async=1000
  986. @end example
  987. @end itemize
  988. @section asetnsamples
  989. Set the number of samples per each output audio frame.
  990. The last output packet may contain a different number of samples, as
  991. the filter will flush all the remaining samples when the input audio
  992. signal its end.
  993. The filter accepts the following options:
  994. @table @option
  995. @item nb_out_samples, n
  996. Set the number of frames per each output audio frame. The number is
  997. intended as the number of samples @emph{per each channel}.
  998. Default value is 1024.
  999. @item pad, p
  1000. If set to 1, the filter will pad the last audio frame with zeroes, so
  1001. that the last frame will contain the same number of samples as the
  1002. previous ones. Default value is 1.
  1003. @end table
  1004. For example, to set the number of per-frame samples to 1234 and
  1005. disable padding for the last frame, use:
  1006. @example
  1007. asetnsamples=n=1234:p=0
  1008. @end example
  1009. @section asetrate
  1010. Set the sample rate without altering the PCM data.
  1011. This will result in a change of speed and pitch.
  1012. The filter accepts the following options:
  1013. @table @option
  1014. @item sample_rate, r
  1015. Set the output sample rate. Default is 44100 Hz.
  1016. @end table
  1017. @section ashowinfo
  1018. Show a line containing various information for each input audio frame.
  1019. The input audio is not modified.
  1020. The shown line contains a sequence of key/value pairs of the form
  1021. @var{key}:@var{value}.
  1022. The following values are shown in the output:
  1023. @table @option
  1024. @item n
  1025. The (sequential) number of the input frame, starting from 0.
  1026. @item pts
  1027. The presentation timestamp of the input frame, in time base units; the time base
  1028. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1029. @item pts_time
  1030. The presentation timestamp of the input frame in seconds.
  1031. @item pos
  1032. position of the frame in the input stream, -1 if this information in
  1033. unavailable and/or meaningless (for example in case of synthetic audio)
  1034. @item fmt
  1035. The sample format.
  1036. @item chlayout
  1037. The channel layout.
  1038. @item rate
  1039. The sample rate for the audio frame.
  1040. @item nb_samples
  1041. The number of samples (per channel) in the frame.
  1042. @item checksum
  1043. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1044. audio, the data is treated as if all the planes were concatenated.
  1045. @item plane_checksums
  1046. A list of Adler-32 checksums for each data plane.
  1047. @end table
  1048. @anchor{astats}
  1049. @section astats
  1050. Display time domain statistical information about the audio channels.
  1051. Statistics are calculated and displayed for each audio channel and,
  1052. where applicable, an overall figure is also given.
  1053. It accepts the following option:
  1054. @table @option
  1055. @item length
  1056. Short window length in seconds, used for peak and trough RMS measurement.
  1057. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1058. @item metadata
  1059. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1060. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1061. disabled.
  1062. Available keys for each channel are:
  1063. DC_offset
  1064. Min_level
  1065. Max_level
  1066. Min_difference
  1067. Max_difference
  1068. Mean_difference
  1069. Peak_level
  1070. RMS_peak
  1071. RMS_trough
  1072. Crest_factor
  1073. Flat_factor
  1074. Peak_count
  1075. Bit_depth
  1076. and for Overall:
  1077. DC_offset
  1078. Min_level
  1079. Max_level
  1080. Min_difference
  1081. Max_difference
  1082. Mean_difference
  1083. Peak_level
  1084. RMS_level
  1085. RMS_peak
  1086. RMS_trough
  1087. Flat_factor
  1088. Peak_count
  1089. Bit_depth
  1090. Number_of_samples
  1091. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1092. this @code{lavfi.astats.Overall.Peak_count}.
  1093. For description what each key means read below.
  1094. @item reset
  1095. Set number of frame after which stats are going to be recalculated.
  1096. Default is disabled.
  1097. @end table
  1098. A description of each shown parameter follows:
  1099. @table @option
  1100. @item DC offset
  1101. Mean amplitude displacement from zero.
  1102. @item Min level
  1103. Minimal sample level.
  1104. @item Max level
  1105. Maximal sample level.
  1106. @item Min difference
  1107. Minimal difference between two consecutive samples.
  1108. @item Max difference
  1109. Maximal difference between two consecutive samples.
  1110. @item Mean difference
  1111. Mean difference between two consecutive samples.
  1112. The average of each difference between two consecutive samples.
  1113. @item Peak level dB
  1114. @item RMS level dB
  1115. Standard peak and RMS level measured in dBFS.
  1116. @item RMS peak dB
  1117. @item RMS trough dB
  1118. Peak and trough values for RMS level measured over a short window.
  1119. @item Crest factor
  1120. Standard ratio of peak to RMS level (note: not in dB).
  1121. @item Flat factor
  1122. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1123. (i.e. either @var{Min level} or @var{Max level}).
  1124. @item Peak count
  1125. Number of occasions (not the number of samples) that the signal attained either
  1126. @var{Min level} or @var{Max level}.
  1127. @item Bit depth
  1128. Overall bit depth of audio. Number of bits used for each sample.
  1129. @end table
  1130. @section asyncts
  1131. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1132. dropping samples/adding silence when needed.
  1133. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1134. It accepts the following parameters:
  1135. @table @option
  1136. @item compensate
  1137. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1138. by default. When disabled, time gaps are covered with silence.
  1139. @item min_delta
  1140. The minimum difference between timestamps and audio data (in seconds) to trigger
  1141. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1142. sync with this filter, try setting this parameter to 0.
  1143. @item max_comp
  1144. The maximum compensation in samples per second. Only relevant with compensate=1.
  1145. The default value is 500.
  1146. @item first_pts
  1147. Assume that the first PTS should be this value. The time base is 1 / sample
  1148. rate. This allows for padding/trimming at the start of the stream. By default,
  1149. no assumption is made about the first frame's expected PTS, so no padding or
  1150. trimming is done. For example, this could be set to 0 to pad the beginning with
  1151. silence if an audio stream starts after the video stream or to trim any samples
  1152. with a negative PTS due to encoder delay.
  1153. @end table
  1154. @section atempo
  1155. Adjust audio tempo.
  1156. The filter accepts exactly one parameter, the audio tempo. If not
  1157. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1158. be in the [0.5, 2.0] range.
  1159. @subsection Examples
  1160. @itemize
  1161. @item
  1162. Slow down audio to 80% tempo:
  1163. @example
  1164. atempo=0.8
  1165. @end example
  1166. @item
  1167. To speed up audio to 125% tempo:
  1168. @example
  1169. atempo=1.25
  1170. @end example
  1171. @end itemize
  1172. @section atrim
  1173. Trim the input so that the output contains one continuous subpart of the input.
  1174. It accepts the following parameters:
  1175. @table @option
  1176. @item start
  1177. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1178. sample with the timestamp @var{start} will be the first sample in the output.
  1179. @item end
  1180. Specify time of the first audio sample that will be dropped, i.e. the
  1181. audio sample immediately preceding the one with the timestamp @var{end} will be
  1182. the last sample in the output.
  1183. @item start_pts
  1184. Same as @var{start}, except this option sets the start timestamp in samples
  1185. instead of seconds.
  1186. @item end_pts
  1187. Same as @var{end}, except this option sets the end timestamp in samples instead
  1188. of seconds.
  1189. @item duration
  1190. The maximum duration of the output in seconds.
  1191. @item start_sample
  1192. The number of the first sample that should be output.
  1193. @item end_sample
  1194. The number of the first sample that should be dropped.
  1195. @end table
  1196. @option{start}, @option{end}, and @option{duration} are expressed as time
  1197. duration specifications; see
  1198. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1199. Note that the first two sets of the start/end options and the @option{duration}
  1200. option look at the frame timestamp, while the _sample options simply count the
  1201. samples that pass through the filter. So start/end_pts and start/end_sample will
  1202. give different results when the timestamps are wrong, inexact or do not start at
  1203. zero. Also note that this filter does not modify the timestamps. If you wish
  1204. to have the output timestamps start at zero, insert the asetpts filter after the
  1205. atrim filter.
  1206. If multiple start or end options are set, this filter tries to be greedy and
  1207. keep all samples that match at least one of the specified constraints. To keep
  1208. only the part that matches all the constraints at once, chain multiple atrim
  1209. filters.
  1210. The defaults are such that all the input is kept. So it is possible to set e.g.
  1211. just the end values to keep everything before the specified time.
  1212. Examples:
  1213. @itemize
  1214. @item
  1215. Drop everything except the second minute of input:
  1216. @example
  1217. ffmpeg -i INPUT -af atrim=60:120
  1218. @end example
  1219. @item
  1220. Keep only the first 1000 samples:
  1221. @example
  1222. ffmpeg -i INPUT -af atrim=end_sample=1000
  1223. @end example
  1224. @end itemize
  1225. @section bandpass
  1226. Apply a two-pole Butterworth band-pass filter with central
  1227. frequency @var{frequency}, and (3dB-point) band-width width.
  1228. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1229. instead of the default: constant 0dB peak gain.
  1230. The filter roll off at 6dB per octave (20dB per decade).
  1231. The filter accepts the following options:
  1232. @table @option
  1233. @item frequency, f
  1234. Set the filter's central frequency. Default is @code{3000}.
  1235. @item csg
  1236. Constant skirt gain if set to 1. Defaults to 0.
  1237. @item width_type
  1238. Set method to specify band-width of filter.
  1239. @table @option
  1240. @item h
  1241. Hz
  1242. @item q
  1243. Q-Factor
  1244. @item o
  1245. octave
  1246. @item s
  1247. slope
  1248. @end table
  1249. @item width, w
  1250. Specify the band-width of a filter in width_type units.
  1251. @end table
  1252. @section bandreject
  1253. Apply a two-pole Butterworth band-reject filter with central
  1254. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1255. The filter roll off at 6dB per octave (20dB per decade).
  1256. The filter accepts the following options:
  1257. @table @option
  1258. @item frequency, f
  1259. Set the filter's central frequency. Default is @code{3000}.
  1260. @item width_type
  1261. Set method to specify band-width of filter.
  1262. @table @option
  1263. @item h
  1264. Hz
  1265. @item q
  1266. Q-Factor
  1267. @item o
  1268. octave
  1269. @item s
  1270. slope
  1271. @end table
  1272. @item width, w
  1273. Specify the band-width of a filter in width_type units.
  1274. @end table
  1275. @section bass
  1276. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1277. shelving filter with a response similar to that of a standard
  1278. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1279. The filter accepts the following options:
  1280. @table @option
  1281. @item gain, g
  1282. Give the gain at 0 Hz. Its useful range is about -20
  1283. (for a large cut) to +20 (for a large boost).
  1284. Beware of clipping when using a positive gain.
  1285. @item frequency, f
  1286. Set the filter's central frequency and so can be used
  1287. to extend or reduce the frequency range to be boosted or cut.
  1288. The default value is @code{100} Hz.
  1289. @item width_type
  1290. Set method to specify band-width of filter.
  1291. @table @option
  1292. @item h
  1293. Hz
  1294. @item q
  1295. Q-Factor
  1296. @item o
  1297. octave
  1298. @item s
  1299. slope
  1300. @end table
  1301. @item width, w
  1302. Determine how steep is the filter's shelf transition.
  1303. @end table
  1304. @section biquad
  1305. Apply a biquad IIR filter with the given coefficients.
  1306. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1307. are the numerator and denominator coefficients respectively.
  1308. @section bs2b
  1309. Bauer stereo to binaural transformation, which improves headphone listening of
  1310. stereo audio records.
  1311. It accepts the following parameters:
  1312. @table @option
  1313. @item profile
  1314. Pre-defined crossfeed level.
  1315. @table @option
  1316. @item default
  1317. Default level (fcut=700, feed=50).
  1318. @item cmoy
  1319. Chu Moy circuit (fcut=700, feed=60).
  1320. @item jmeier
  1321. Jan Meier circuit (fcut=650, feed=95).
  1322. @end table
  1323. @item fcut
  1324. Cut frequency (in Hz).
  1325. @item feed
  1326. Feed level (in Hz).
  1327. @end table
  1328. @section channelmap
  1329. Remap input channels to new locations.
  1330. It accepts the following parameters:
  1331. @table @option
  1332. @item channel_layout
  1333. The channel layout of the output stream.
  1334. @item map
  1335. Map channels from input to output. The argument is a '|'-separated list of
  1336. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1337. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1338. channel (e.g. FL for front left) or its index in the input channel layout.
  1339. @var{out_channel} is the name of the output channel or its index in the output
  1340. channel layout. If @var{out_channel} is not given then it is implicitly an
  1341. index, starting with zero and increasing by one for each mapping.
  1342. @end table
  1343. If no mapping is present, the filter will implicitly map input channels to
  1344. output channels, preserving indices.
  1345. For example, assuming a 5.1+downmix input MOV file,
  1346. @example
  1347. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1348. @end example
  1349. will create an output WAV file tagged as stereo from the downmix channels of
  1350. the input.
  1351. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1352. @example
  1353. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1354. @end example
  1355. @section channelsplit
  1356. Split each channel from an input audio stream into a separate output stream.
  1357. It accepts the following parameters:
  1358. @table @option
  1359. @item channel_layout
  1360. The channel layout of the input stream. The default is "stereo".
  1361. @end table
  1362. For example, assuming a stereo input MP3 file,
  1363. @example
  1364. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1365. @end example
  1366. will create an output Matroska file with two audio streams, one containing only
  1367. the left channel and the other the right channel.
  1368. Split a 5.1 WAV file into per-channel files:
  1369. @example
  1370. ffmpeg -i in.wav -filter_complex
  1371. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1372. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1373. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1374. side_right.wav
  1375. @end example
  1376. @section chorus
  1377. Add a chorus effect to the audio.
  1378. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1379. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1380. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1381. The modulation depth defines the range the modulated delay is played before or after
  1382. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1383. sound tuned around the original one, like in a chorus where some vocals are slightly
  1384. off key.
  1385. It accepts the following parameters:
  1386. @table @option
  1387. @item in_gain
  1388. Set input gain. Default is 0.4.
  1389. @item out_gain
  1390. Set output gain. Default is 0.4.
  1391. @item delays
  1392. Set delays. A typical delay is around 40ms to 60ms.
  1393. @item decays
  1394. Set decays.
  1395. @item speeds
  1396. Set speeds.
  1397. @item depths
  1398. Set depths.
  1399. @end table
  1400. @subsection Examples
  1401. @itemize
  1402. @item
  1403. A single delay:
  1404. @example
  1405. chorus=0.7:0.9:55:0.4:0.25:2
  1406. @end example
  1407. @item
  1408. Two delays:
  1409. @example
  1410. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1411. @end example
  1412. @item
  1413. Fuller sounding chorus with three delays:
  1414. @example
  1415. 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
  1416. @end example
  1417. @end itemize
  1418. @section compand
  1419. Compress or expand the audio's dynamic range.
  1420. It accepts the following parameters:
  1421. @table @option
  1422. @item attacks
  1423. @item decays
  1424. A list of times in seconds for each channel over which the instantaneous level
  1425. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1426. increase of volume and @var{decays} refers to decrease of volume. For most
  1427. situations, the attack time (response to the audio getting louder) should be
  1428. shorter than the decay time, because the human ear is more sensitive to sudden
  1429. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1430. a typical value for decay is 0.8 seconds.
  1431. If specified number of attacks & decays is lower than number of channels, the last
  1432. set attack/decay will be used for all remaining channels.
  1433. @item points
  1434. A list of points for the transfer function, specified in dB relative to the
  1435. maximum possible signal amplitude. Each key points list must be defined using
  1436. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1437. @code{x0/y0 x1/y1 x2/y2 ....}
  1438. The input values must be in strictly increasing order but the transfer function
  1439. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1440. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1441. function are @code{-70/-70|-60/-20}.
  1442. @item soft-knee
  1443. Set the curve radius in dB for all joints. It defaults to 0.01.
  1444. @item gain
  1445. Set the additional gain in dB to be applied at all points on the transfer
  1446. function. This allows for easy adjustment of the overall gain.
  1447. It defaults to 0.
  1448. @item volume
  1449. Set an initial volume, in dB, to be assumed for each channel when filtering
  1450. starts. This permits the user to supply a nominal level initially, so that, for
  1451. example, a very large gain is not applied to initial signal levels before the
  1452. companding has begun to operate. A typical value for audio which is initially
  1453. quiet is -90 dB. It defaults to 0.
  1454. @item delay
  1455. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1456. delayed before being fed to the volume adjuster. Specifying a delay
  1457. approximately equal to the attack/decay times allows the filter to effectively
  1458. operate in predictive rather than reactive mode. It defaults to 0.
  1459. @end table
  1460. @subsection Examples
  1461. @itemize
  1462. @item
  1463. Make music with both quiet and loud passages suitable for listening to in a
  1464. noisy environment:
  1465. @example
  1466. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1467. @end example
  1468. Another example for audio with whisper and explosion parts:
  1469. @example
  1470. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1471. @end example
  1472. @item
  1473. A noise gate for when the noise is at a lower level than the signal:
  1474. @example
  1475. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1476. @end example
  1477. @item
  1478. Here is another noise gate, this time for when the noise is at a higher level
  1479. than the signal (making it, in some ways, similar to squelch):
  1480. @example
  1481. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1482. @end example
  1483. @item
  1484. 2:1 compression starting at -6dB:
  1485. @example
  1486. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1487. @end example
  1488. @item
  1489. 2:1 compression starting at -9dB:
  1490. @example
  1491. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1492. @end example
  1493. @item
  1494. 2:1 compression starting at -12dB:
  1495. @example
  1496. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1497. @end example
  1498. @item
  1499. 2:1 compression starting at -18dB:
  1500. @example
  1501. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1502. @end example
  1503. @item
  1504. 3:1 compression starting at -15dB:
  1505. @example
  1506. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1507. @end example
  1508. @item
  1509. Compressor/Gate:
  1510. @example
  1511. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1512. @end example
  1513. @item
  1514. Expander:
  1515. @example
  1516. 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
  1517. @end example
  1518. @item
  1519. Hard limiter at -6dB:
  1520. @example
  1521. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1522. @end example
  1523. @item
  1524. Hard limiter at -12dB:
  1525. @example
  1526. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1527. @end example
  1528. @item
  1529. Hard noise gate at -35 dB:
  1530. @example
  1531. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1532. @end example
  1533. @item
  1534. Soft limiter:
  1535. @example
  1536. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1537. @end example
  1538. @end itemize
  1539. @section compensationdelay
  1540. Compensation Delay Line is a metric based delay to compensate differing
  1541. positions of microphones or speakers.
  1542. For example, you have recorded guitar with two microphones placed in
  1543. different location. Because the front of sound wave has fixed speed in
  1544. normal conditions, the phasing of microphones can vary and depends on
  1545. their location and interposition. The best sound mix can be achieved when
  1546. these microphones are in phase (synchronized). Note that distance of
  1547. ~30 cm between microphones makes one microphone to capture signal in
  1548. antiphase to another microphone. That makes the final mix sounding moody.
  1549. This filter helps to solve phasing problems by adding different delays
  1550. to each microphone track and make them synchronized.
  1551. The best result can be reached when you take one track as base and
  1552. synchronize other tracks one by one with it.
  1553. Remember that synchronization/delay tolerance depends on sample rate, too.
  1554. Higher sample rates will give more tolerance.
  1555. It accepts the following parameters:
  1556. @table @option
  1557. @item mm
  1558. Set millimeters distance. This is compensation distance for fine tuning.
  1559. Default is 0.
  1560. @item cm
  1561. Set cm distance. This is compensation distance for tightening distance setup.
  1562. Default is 0.
  1563. @item m
  1564. Set meters distance. This is compensation distance for hard distance setup.
  1565. Default is 0.
  1566. @item dry
  1567. Set dry amount. Amount of unprocessed (dry) signal.
  1568. Default is 0.
  1569. @item wet
  1570. Set wet amount. Amount of processed (wet) signal.
  1571. Default is 1.
  1572. @item temp
  1573. Set temperature degree in Celsius. This is the temperature of the environment.
  1574. Default is 20.
  1575. @end table
  1576. @section dcshift
  1577. Apply a DC shift to the audio.
  1578. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1579. in the recording chain) from the audio. The effect of a DC offset is reduced
  1580. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1581. a signal has a DC offset.
  1582. @table @option
  1583. @item shift
  1584. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1585. the audio.
  1586. @item limitergain
  1587. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1588. used to prevent clipping.
  1589. @end table
  1590. @section dynaudnorm
  1591. Dynamic Audio Normalizer.
  1592. This filter applies a certain amount of gain to the input audio in order
  1593. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1594. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1595. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1596. This allows for applying extra gain to the "quiet" sections of the audio
  1597. while avoiding distortions or clipping the "loud" sections. In other words:
  1598. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1599. sections, in the sense that the volume of each section is brought to the
  1600. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1601. this goal *without* applying "dynamic range compressing". It will retain 100%
  1602. of the dynamic range *within* each section of the audio file.
  1603. @table @option
  1604. @item f
  1605. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1606. Default is 500 milliseconds.
  1607. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1608. referred to as frames. This is required, because a peak magnitude has no
  1609. meaning for just a single sample value. Instead, we need to determine the
  1610. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1611. normalizer would simply use the peak magnitude of the complete file, the
  1612. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1613. frame. The length of a frame is specified in milliseconds. By default, the
  1614. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1615. been found to give good results with most files.
  1616. Note that the exact frame length, in number of samples, will be determined
  1617. automatically, based on the sampling rate of the individual input audio file.
  1618. @item g
  1619. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1620. number. Default is 31.
  1621. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1622. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1623. is specified in frames, centered around the current frame. For the sake of
  1624. simplicity, this must be an odd number. Consequently, the default value of 31
  1625. takes into account the current frame, as well as the 15 preceding frames and
  1626. the 15 subsequent frames. Using a larger window results in a stronger
  1627. smoothing effect and thus in less gain variation, i.e. slower gain
  1628. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1629. effect and thus in more gain variation, i.e. faster gain adaptation.
  1630. In other words, the more you increase this value, the more the Dynamic Audio
  1631. Normalizer will behave like a "traditional" normalization filter. On the
  1632. contrary, the more you decrease this value, the more the Dynamic Audio
  1633. Normalizer will behave like a dynamic range compressor.
  1634. @item p
  1635. Set the target peak value. This specifies the highest permissible magnitude
  1636. level for the normalized audio input. This filter will try to approach the
  1637. target peak magnitude as closely as possible, but at the same time it also
  1638. makes sure that the normalized signal will never exceed the peak magnitude.
  1639. A frame's maximum local gain factor is imposed directly by the target peak
  1640. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1641. It is not recommended to go above this value.
  1642. @item m
  1643. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1644. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1645. factor for each input frame, i.e. the maximum gain factor that does not
  1646. result in clipping or distortion. The maximum gain factor is determined by
  1647. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1648. additionally bounds the frame's maximum gain factor by a predetermined
  1649. (global) maximum gain factor. This is done in order to avoid excessive gain
  1650. factors in "silent" or almost silent frames. By default, the maximum gain
  1651. factor is 10.0, For most inputs the default value should be sufficient and
  1652. it usually is not recommended to increase this value. Though, for input
  1653. with an extremely low overall volume level, it may be necessary to allow even
  1654. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1655. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1656. Instead, a "sigmoid" threshold function will be applied. This way, the
  1657. gain factors will smoothly approach the threshold value, but never exceed that
  1658. value.
  1659. @item r
  1660. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1661. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1662. This means that the maximum local gain factor for each frame is defined
  1663. (only) by the frame's highest magnitude sample. This way, the samples can
  1664. be amplified as much as possible without exceeding the maximum signal
  1665. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1666. Normalizer can also take into account the frame's root mean square,
  1667. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1668. determine the power of a time-varying signal. It is therefore considered
  1669. that the RMS is a better approximation of the "perceived loudness" than
  1670. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1671. frames to a constant RMS value, a uniform "perceived loudness" can be
  1672. established. If a target RMS value has been specified, a frame's local gain
  1673. factor is defined as the factor that would result in exactly that RMS value.
  1674. Note, however, that the maximum local gain factor is still restricted by the
  1675. frame's highest magnitude sample, in order to prevent clipping.
  1676. @item n
  1677. Enable channels coupling. By default is enabled.
  1678. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1679. amount. This means the same gain factor will be applied to all channels, i.e.
  1680. the maximum possible gain factor is determined by the "loudest" channel.
  1681. However, in some recordings, it may happen that the volume of the different
  1682. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1683. In this case, this option can be used to disable the channel coupling. This way,
  1684. the gain factor will be determined independently for each channel, depending
  1685. only on the individual channel's highest magnitude sample. This allows for
  1686. harmonizing the volume of the different channels.
  1687. @item c
  1688. Enable DC bias correction. By default is disabled.
  1689. An audio signal (in the time domain) is a sequence of sample values.
  1690. In the Dynamic Audio Normalizer these sample values are represented in the
  1691. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1692. audio signal, or "waveform", should be centered around the zero point.
  1693. That means if we calculate the mean value of all samples in a file, or in a
  1694. single frame, then the result should be 0.0 or at least very close to that
  1695. value. If, however, there is a significant deviation of the mean value from
  1696. 0.0, in either positive or negative direction, this is referred to as a
  1697. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1698. Audio Normalizer provides optional DC bias correction.
  1699. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1700. the mean value, or "DC correction" offset, of each input frame and subtract
  1701. that value from all of the frame's sample values which ensures those samples
  1702. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1703. boundaries, the DC correction offset values will be interpolated smoothly
  1704. between neighbouring frames.
  1705. @item b
  1706. Enable alternative boundary mode. By default is disabled.
  1707. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1708. around each frame. This includes the preceding frames as well as the
  1709. subsequent frames. However, for the "boundary" frames, located at the very
  1710. beginning and at the very end of the audio file, not all neighbouring
  1711. frames are available. In particular, for the first few frames in the audio
  1712. file, the preceding frames are not known. And, similarly, for the last few
  1713. frames in the audio file, the subsequent frames are not known. Thus, the
  1714. question arises which gain factors should be assumed for the missing frames
  1715. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1716. to deal with this situation. The default boundary mode assumes a gain factor
  1717. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1718. "fade out" at the beginning and at the end of the input, respectively.
  1719. @item s
  1720. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1721. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1722. compression. This means that signal peaks will not be pruned and thus the
  1723. full dynamic range will be retained within each local neighbourhood. However,
  1724. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1725. normalization algorithm with a more "traditional" compression.
  1726. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1727. (thresholding) function. If (and only if) the compression feature is enabled,
  1728. all input frames will be processed by a soft knee thresholding function prior
  1729. to the actual normalization process. Put simply, the thresholding function is
  1730. going to prune all samples whose magnitude exceeds a certain threshold value.
  1731. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1732. value. Instead, the threshold value will be adjusted for each individual
  1733. frame.
  1734. In general, smaller parameters result in stronger compression, and vice versa.
  1735. Values below 3.0 are not recommended, because audible distortion may appear.
  1736. @end table
  1737. @section earwax
  1738. Make audio easier to listen to on headphones.
  1739. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1740. so that when listened to on headphones the stereo image is moved from
  1741. inside your head (standard for headphones) to outside and in front of
  1742. the listener (standard for speakers).
  1743. Ported from SoX.
  1744. @section equalizer
  1745. Apply a two-pole peaking equalisation (EQ) filter. With this
  1746. filter, the signal-level at and around a selected frequency can
  1747. be increased or decreased, whilst (unlike bandpass and bandreject
  1748. filters) that at all other frequencies is unchanged.
  1749. In order to produce complex equalisation curves, this filter can
  1750. be given several times, each with a different central frequency.
  1751. The filter accepts the following options:
  1752. @table @option
  1753. @item frequency, f
  1754. Set the filter's central frequency in Hz.
  1755. @item width_type
  1756. Set method to specify band-width of filter.
  1757. @table @option
  1758. @item h
  1759. Hz
  1760. @item q
  1761. Q-Factor
  1762. @item o
  1763. octave
  1764. @item s
  1765. slope
  1766. @end table
  1767. @item width, w
  1768. Specify the band-width of a filter in width_type units.
  1769. @item gain, g
  1770. Set the required gain or attenuation in dB.
  1771. Beware of clipping when using a positive gain.
  1772. @end table
  1773. @subsection Examples
  1774. @itemize
  1775. @item
  1776. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1777. @example
  1778. equalizer=f=1000:width_type=h:width=200:g=-10
  1779. @end example
  1780. @item
  1781. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1782. @example
  1783. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1784. @end example
  1785. @end itemize
  1786. @section extrastereo
  1787. Linearly increases the difference between left and right channels which
  1788. adds some sort of "live" effect to playback.
  1789. The filter accepts the following option:
  1790. @table @option
  1791. @item m
  1792. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1793. (average of both channels), with 1.0 sound will be unchanged, with
  1794. -1.0 left and right channels will be swapped.
  1795. @item c
  1796. Enable clipping. By default is enabled.
  1797. @end table
  1798. @section flanger
  1799. Apply a flanging effect to the audio.
  1800. The filter accepts the following options:
  1801. @table @option
  1802. @item delay
  1803. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1804. @item depth
  1805. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1806. @item regen
  1807. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1808. Default value is 0.
  1809. @item width
  1810. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1811. Default value is 71.
  1812. @item speed
  1813. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1814. @item shape
  1815. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1816. Default value is @var{sinusoidal}.
  1817. @item phase
  1818. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1819. Default value is 25.
  1820. @item interp
  1821. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1822. Default is @var{linear}.
  1823. @end table
  1824. @section highpass
  1825. Apply a high-pass filter with 3dB point frequency.
  1826. The filter can be either single-pole, or double-pole (the default).
  1827. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1828. The filter accepts the following options:
  1829. @table @option
  1830. @item frequency, f
  1831. Set frequency in Hz. Default is 3000.
  1832. @item poles, p
  1833. Set number of poles. Default is 2.
  1834. @item width_type
  1835. Set method to specify band-width of filter.
  1836. @table @option
  1837. @item h
  1838. Hz
  1839. @item q
  1840. Q-Factor
  1841. @item o
  1842. octave
  1843. @item s
  1844. slope
  1845. @end table
  1846. @item width, w
  1847. Specify the band-width of a filter in width_type units.
  1848. Applies only to double-pole filter.
  1849. The default is 0.707q and gives a Butterworth response.
  1850. @end table
  1851. @section join
  1852. Join multiple input streams into one multi-channel stream.
  1853. It accepts the following parameters:
  1854. @table @option
  1855. @item inputs
  1856. The number of input streams. It defaults to 2.
  1857. @item channel_layout
  1858. The desired output channel layout. It defaults to stereo.
  1859. @item map
  1860. Map channels from inputs to output. The argument is a '|'-separated list of
  1861. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  1862. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  1863. can be either the name of the input channel (e.g. FL for front left) or its
  1864. index in the specified input stream. @var{out_channel} is the name of the output
  1865. channel.
  1866. @end table
  1867. The filter will attempt to guess the mappings when they are not specified
  1868. explicitly. It does so by first trying to find an unused matching input channel
  1869. and if that fails it picks the first unused input channel.
  1870. Join 3 inputs (with properly set channel layouts):
  1871. @example
  1872. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1873. @end example
  1874. Build a 5.1 output from 6 single-channel streams:
  1875. @example
  1876. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1877. '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'
  1878. out
  1879. @end example
  1880. @section ladspa
  1881. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  1882. To enable compilation of this filter you need to configure FFmpeg with
  1883. @code{--enable-ladspa}.
  1884. @table @option
  1885. @item file, f
  1886. Specifies the name of LADSPA plugin library to load. If the environment
  1887. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  1888. each one of the directories specified by the colon separated list in
  1889. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  1890. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  1891. @file{/usr/lib/ladspa/}.
  1892. @item plugin, p
  1893. Specifies the plugin within the library. Some libraries contain only
  1894. one plugin, but others contain many of them. If this is not set filter
  1895. will list all available plugins within the specified library.
  1896. @item controls, c
  1897. Set the '|' separated list of controls which are zero or more floating point
  1898. values that determine the behavior of the loaded plugin (for example delay,
  1899. threshold or gain).
  1900. Controls need to be defined using the following syntax:
  1901. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  1902. @var{valuei} is the value set on the @var{i}-th control.
  1903. Alternatively they can be also defined using the following syntax:
  1904. @var{value0}|@var{value1}|@var{value2}|..., where
  1905. @var{valuei} is the value set on the @var{i}-th control.
  1906. If @option{controls} is set to @code{help}, all available controls and
  1907. their valid ranges are printed.
  1908. @item sample_rate, s
  1909. Specify the sample rate, default to 44100. Only used if plugin have
  1910. zero inputs.
  1911. @item nb_samples, n
  1912. Set the number of samples per channel per each output frame, default
  1913. is 1024. Only used if plugin have zero inputs.
  1914. @item duration, d
  1915. Set the minimum duration of the sourced audio. See
  1916. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1917. for the accepted syntax.
  1918. Note that the resulting duration may be greater than the specified duration,
  1919. as the generated audio is always cut at the end of a complete frame.
  1920. If not specified, or the expressed duration is negative, the audio is
  1921. supposed to be generated forever.
  1922. Only used if plugin have zero inputs.
  1923. @end table
  1924. @subsection Examples
  1925. @itemize
  1926. @item
  1927. List all available plugins within amp (LADSPA example plugin) library:
  1928. @example
  1929. ladspa=file=amp
  1930. @end example
  1931. @item
  1932. List all available controls and their valid ranges for @code{vcf_notch}
  1933. plugin from @code{VCF} library:
  1934. @example
  1935. ladspa=f=vcf:p=vcf_notch:c=help
  1936. @end example
  1937. @item
  1938. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  1939. plugin library:
  1940. @example
  1941. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  1942. @end example
  1943. @item
  1944. Add reverberation to the audio using TAP-plugins
  1945. (Tom's Audio Processing plugins):
  1946. @example
  1947. ladspa=file=tap_reverb:tap_reverb
  1948. @end example
  1949. @item
  1950. Generate white noise, with 0.2 amplitude:
  1951. @example
  1952. ladspa=file=cmt:noise_source_white:c=c0=.2
  1953. @end example
  1954. @item
  1955. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  1956. @code{C* Audio Plugin Suite} (CAPS) library:
  1957. @example
  1958. ladspa=file=caps:Click:c=c1=20'
  1959. @end example
  1960. @item
  1961. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  1962. @example
  1963. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  1964. @end example
  1965. @item
  1966. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  1967. @code{SWH Plugins} collection:
  1968. @example
  1969. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  1970. @end example
  1971. @item
  1972. Attenuate low frequencies using Multiband EQ from Steve Harris
  1973. @code{SWH Plugins} collection:
  1974. @example
  1975. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  1976. @end example
  1977. @end itemize
  1978. @subsection Commands
  1979. This filter supports the following commands:
  1980. @table @option
  1981. @item cN
  1982. Modify the @var{N}-th control value.
  1983. If the specified value is not valid, it is ignored and prior one is kept.
  1984. @end table
  1985. @section lowpass
  1986. Apply a low-pass filter with 3dB point frequency.
  1987. The filter can be either single-pole or double-pole (the default).
  1988. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1989. The filter accepts the following options:
  1990. @table @option
  1991. @item frequency, f
  1992. Set frequency in Hz. Default is 500.
  1993. @item poles, p
  1994. Set number of poles. Default is 2.
  1995. @item width_type
  1996. Set method to specify band-width of filter.
  1997. @table @option
  1998. @item h
  1999. Hz
  2000. @item q
  2001. Q-Factor
  2002. @item o
  2003. octave
  2004. @item s
  2005. slope
  2006. @end table
  2007. @item width, w
  2008. Specify the band-width of a filter in width_type units.
  2009. Applies only to double-pole filter.
  2010. The default is 0.707q and gives a Butterworth response.
  2011. @end table
  2012. @anchor{pan}
  2013. @section pan
  2014. Mix channels with specific gain levels. The filter accepts the output
  2015. channel layout followed by a set of channels definitions.
  2016. This filter is also designed to efficiently remap the channels of an audio
  2017. stream.
  2018. The filter accepts parameters of the form:
  2019. "@var{l}|@var{outdef}|@var{outdef}|..."
  2020. @table @option
  2021. @item l
  2022. output channel layout or number of channels
  2023. @item outdef
  2024. output channel specification, of the form:
  2025. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2026. @item out_name
  2027. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2028. number (c0, c1, etc.)
  2029. @item gain
  2030. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2031. @item in_name
  2032. input channel to use, see out_name for details; it is not possible to mix
  2033. named and numbered input channels
  2034. @end table
  2035. If the `=' in a channel specification is replaced by `<', then the gains for
  2036. that specification will be renormalized so that the total is 1, thus
  2037. avoiding clipping noise.
  2038. @subsection Mixing examples
  2039. For example, if you want to down-mix from stereo to mono, but with a bigger
  2040. factor for the left channel:
  2041. @example
  2042. pan=1c|c0=0.9*c0+0.1*c1
  2043. @end example
  2044. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2045. 7-channels surround:
  2046. @example
  2047. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2048. @end example
  2049. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2050. that should be preferred (see "-ac" option) unless you have very specific
  2051. needs.
  2052. @subsection Remapping examples
  2053. The channel remapping will be effective if, and only if:
  2054. @itemize
  2055. @item gain coefficients are zeroes or ones,
  2056. @item only one input per channel output,
  2057. @end itemize
  2058. If all these conditions are satisfied, the filter will notify the user ("Pure
  2059. channel mapping detected"), and use an optimized and lossless method to do the
  2060. remapping.
  2061. For example, if you have a 5.1 source and want a stereo audio stream by
  2062. dropping the extra channels:
  2063. @example
  2064. pan="stereo| c0=FL | c1=FR"
  2065. @end example
  2066. Given the same source, you can also switch front left and front right channels
  2067. and keep the input channel layout:
  2068. @example
  2069. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2070. @end example
  2071. If the input is a stereo audio stream, you can mute the front left channel (and
  2072. still keep the stereo channel layout) with:
  2073. @example
  2074. pan="stereo|c1=c1"
  2075. @end example
  2076. Still with a stereo audio stream input, you can copy the right channel in both
  2077. front left and right:
  2078. @example
  2079. pan="stereo| c0=FR | c1=FR"
  2080. @end example
  2081. @section replaygain
  2082. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2083. outputs it unchanged.
  2084. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2085. @section resample
  2086. Convert the audio sample format, sample rate and channel layout. It is
  2087. not meant to be used directly.
  2088. @section rubberband
  2089. Apply time-stretching and pitch-shifting with librubberband.
  2090. The filter accepts the following options:
  2091. @table @option
  2092. @item tempo
  2093. Set tempo scale factor.
  2094. @item pitch
  2095. Set pitch scale factor.
  2096. @item transients
  2097. Set transients detector.
  2098. Possible values are:
  2099. @table @var
  2100. @item crisp
  2101. @item mixed
  2102. @item smooth
  2103. @end table
  2104. @item detector
  2105. Set detector.
  2106. Possible values are:
  2107. @table @var
  2108. @item compound
  2109. @item percussive
  2110. @item soft
  2111. @end table
  2112. @item phase
  2113. Set phase.
  2114. Possible values are:
  2115. @table @var
  2116. @item laminar
  2117. @item independent
  2118. @end table
  2119. @item window
  2120. Set processing window size.
  2121. Possible values are:
  2122. @table @var
  2123. @item standard
  2124. @item short
  2125. @item long
  2126. @end table
  2127. @item smoothing
  2128. Set smoothing.
  2129. Possible values are:
  2130. @table @var
  2131. @item off
  2132. @item on
  2133. @end table
  2134. @item formant
  2135. Enable formant preservation when shift pitching.
  2136. Possible values are:
  2137. @table @var
  2138. @item shifted
  2139. @item preserved
  2140. @end table
  2141. @item pitchq
  2142. Set pitch quality.
  2143. Possible values are:
  2144. @table @var
  2145. @item quality
  2146. @item speed
  2147. @item consistency
  2148. @end table
  2149. @item channels
  2150. Set channels.
  2151. Possible values are:
  2152. @table @var
  2153. @item apart
  2154. @item together
  2155. @end table
  2156. @end table
  2157. @section sidechaincompress
  2158. This filter acts like normal compressor but has the ability to compress
  2159. detected signal using second input signal.
  2160. It needs two input streams and returns one output stream.
  2161. First input stream will be processed depending on second stream signal.
  2162. The filtered signal then can be filtered with other filters in later stages of
  2163. processing. See @ref{pan} and @ref{amerge} filter.
  2164. The filter accepts the following options:
  2165. @table @option
  2166. @item level_in
  2167. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2168. @item threshold
  2169. If a signal of second stream raises above this level it will affect the gain
  2170. reduction of first stream.
  2171. By default is 0.125. Range is between 0.00097563 and 1.
  2172. @item ratio
  2173. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2174. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2175. Default is 2. Range is between 1 and 20.
  2176. @item attack
  2177. Amount of milliseconds the signal has to rise above the threshold before gain
  2178. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2179. @item release
  2180. Amount of milliseconds the signal has to fall below the threshold before
  2181. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2182. @item makeup
  2183. Set the amount by how much signal will be amplified after processing.
  2184. Default is 2. Range is from 1 and 64.
  2185. @item knee
  2186. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2187. Default is 2.82843. Range is between 1 and 8.
  2188. @item link
  2189. Choose if the @code{average} level between all channels of side-chain stream
  2190. or the louder(@code{maximum}) channel of side-chain stream affects the
  2191. reduction. Default is @code{average}.
  2192. @item detection
  2193. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2194. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2195. @item level_sc
  2196. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2197. @item mix
  2198. How much to use compressed signal in output. Default is 1.
  2199. Range is between 0 and 1.
  2200. @end table
  2201. @subsection Examples
  2202. @itemize
  2203. @item
  2204. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2205. depending on the signal of 2nd input and later compressed signal to be
  2206. merged with 2nd input:
  2207. @example
  2208. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2209. @end example
  2210. @end itemize
  2211. @section sidechaingate
  2212. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2213. filter the detected signal before sending it to the gain reduction stage.
  2214. Normally a gate uses the full range signal to detect a level above the
  2215. threshold.
  2216. For example: If you cut all lower frequencies from your sidechain signal
  2217. the gate will decrease the volume of your track only if not enough highs
  2218. appear. With this technique you are able to reduce the resonation of a
  2219. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2220. guitar.
  2221. It needs two input streams and returns one output stream.
  2222. First input stream will be processed depending on second stream signal.
  2223. The filter accepts the following options:
  2224. @table @option
  2225. @item level_in
  2226. Set input level before filtering.
  2227. Default is 1. Allowed range is from 0.015625 to 64.
  2228. @item range
  2229. Set the level of gain reduction when the signal is below the threshold.
  2230. Default is 0.06125. Allowed range is from 0 to 1.
  2231. @item threshold
  2232. If a signal rises above this level the gain reduction is released.
  2233. Default is 0.125. Allowed range is from 0 to 1.
  2234. @item ratio
  2235. Set a ratio about which the signal is reduced.
  2236. Default is 2. Allowed range is from 1 to 9000.
  2237. @item attack
  2238. Amount of milliseconds the signal has to rise above the threshold before gain
  2239. reduction stops.
  2240. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2241. @item release
  2242. Amount of milliseconds the signal has to fall below the threshold before the
  2243. reduction is increased again. Default is 250 milliseconds.
  2244. Allowed range is from 0.01 to 9000.
  2245. @item makeup
  2246. Set amount of amplification of signal after processing.
  2247. Default is 1. Allowed range is from 1 to 64.
  2248. @item knee
  2249. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2250. Default is 2.828427125. Allowed range is from 1 to 8.
  2251. @item detection
  2252. Choose if exact signal should be taken for detection or an RMS like one.
  2253. Default is rms. Can be peak or rms.
  2254. @item link
  2255. Choose if the average level between all channels or the louder channel affects
  2256. the reduction.
  2257. Default is average. Can be average or maximum.
  2258. @item level_sc
  2259. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2260. @end table
  2261. @section silencedetect
  2262. Detect silence in an audio stream.
  2263. This filter logs a message when it detects that the input audio volume is less
  2264. or equal to a noise tolerance value for a duration greater or equal to the
  2265. minimum detected noise duration.
  2266. The printed times and duration are expressed in seconds.
  2267. The filter accepts the following options:
  2268. @table @option
  2269. @item duration, d
  2270. Set silence duration until notification (default is 2 seconds).
  2271. @item noise, n
  2272. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2273. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2274. @end table
  2275. @subsection Examples
  2276. @itemize
  2277. @item
  2278. Detect 5 seconds of silence with -50dB noise tolerance:
  2279. @example
  2280. silencedetect=n=-50dB:d=5
  2281. @end example
  2282. @item
  2283. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2284. tolerance in @file{silence.mp3}:
  2285. @example
  2286. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2287. @end example
  2288. @end itemize
  2289. @section silenceremove
  2290. Remove silence from the beginning, middle or end of the audio.
  2291. The filter accepts the following options:
  2292. @table @option
  2293. @item start_periods
  2294. This value is used to indicate if audio should be trimmed at beginning of
  2295. the audio. A value of zero indicates no silence should be trimmed from the
  2296. beginning. When specifying a non-zero value, it trims audio up until it
  2297. finds non-silence. Normally, when trimming silence from beginning of audio
  2298. the @var{start_periods} will be @code{1} but it can be increased to higher
  2299. values to trim all audio up to specific count of non-silence periods.
  2300. Default value is @code{0}.
  2301. @item start_duration
  2302. Specify the amount of time that non-silence must be detected before it stops
  2303. trimming audio. By increasing the duration, bursts of noises can be treated
  2304. as silence and trimmed off. Default value is @code{0}.
  2305. @item start_threshold
  2306. This indicates what sample value should be treated as silence. For digital
  2307. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2308. you may wish to increase the value to account for background noise.
  2309. Can be specified in dB (in case "dB" is appended to the specified value)
  2310. or amplitude ratio. Default value is @code{0}.
  2311. @item stop_periods
  2312. Set the count for trimming silence from the end of audio.
  2313. To remove silence from the middle of a file, specify a @var{stop_periods}
  2314. that is negative. This value is then treated as a positive value and is
  2315. used to indicate the effect should restart processing as specified by
  2316. @var{start_periods}, making it suitable for removing periods of silence
  2317. in the middle of the audio.
  2318. Default value is @code{0}.
  2319. @item stop_duration
  2320. Specify a duration of silence that must exist before audio is not copied any
  2321. more. By specifying a higher duration, silence that is wanted can be left in
  2322. the audio.
  2323. Default value is @code{0}.
  2324. @item stop_threshold
  2325. This is the same as @option{start_threshold} but for trimming silence from
  2326. the end of audio.
  2327. Can be specified in dB (in case "dB" is appended to the specified value)
  2328. or amplitude ratio. Default value is @code{0}.
  2329. @item leave_silence
  2330. This indicate that @var{stop_duration} length of audio should be left intact
  2331. at the beginning of each period of silence.
  2332. For example, if you want to remove long pauses between words but do not want
  2333. to remove the pauses completely. Default value is @code{0}.
  2334. @item detection
  2335. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2336. and works better with digital silence which is exactly 0.
  2337. Default value is @code{rms}.
  2338. @item window
  2339. Set ratio used to calculate size of window for detecting silence.
  2340. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2341. @end table
  2342. @subsection Examples
  2343. @itemize
  2344. @item
  2345. The following example shows how this filter can be used to start a recording
  2346. that does not contain the delay at the start which usually occurs between
  2347. pressing the record button and the start of the performance:
  2348. @example
  2349. silenceremove=1:5:0.02
  2350. @end example
  2351. @item
  2352. Trim all silence encountered from begining to end where there is more than 1
  2353. second of silence in audio:
  2354. @example
  2355. silenceremove=0:0:0:-1:1:-90dB
  2356. @end example
  2357. @end itemize
  2358. @section sofalizer
  2359. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2360. loudspeakers around the user for binaural listening via headphones (audio
  2361. formats up to 9 channels supported).
  2362. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2363. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2364. Austrian Academy of Sciences.
  2365. To enable compilation of this filter you need to configure FFmpeg with
  2366. @code{--enable-netcdf}.
  2367. The filter accepts the following options:
  2368. @table @option
  2369. @item sofa
  2370. Set the SOFA file used for rendering.
  2371. @item gain
  2372. Set gain applied to audio. Value is in dB. Default is 0.
  2373. @item rotation
  2374. Set rotation of virtual loudspeakers in deg. Default is 0.
  2375. @item elevation
  2376. Set elevation of virtual speakers in deg. Default is 0.
  2377. @item radius
  2378. Set distance in meters between loudspeakers and the listener with near-field
  2379. HRTFs. Default is 1.
  2380. @item type
  2381. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2382. processing audio in time domain which is slow but gives high quality output.
  2383. @var{freq} is processing audio in frequency domain which is fast but gives
  2384. mediocre output. Default is @var{freq}.
  2385. @end table
  2386. @section stereotools
  2387. This filter has some handy utilities to manage stereo signals, for converting
  2388. M/S stereo recordings to L/R signal while having control over the parameters
  2389. or spreading the stereo image of master track.
  2390. The filter accepts the following options:
  2391. @table @option
  2392. @item level_in
  2393. Set input level before filtering for both channels. Defaults is 1.
  2394. Allowed range is from 0.015625 to 64.
  2395. @item level_out
  2396. Set output level after filtering for both channels. Defaults is 1.
  2397. Allowed range is from 0.015625 to 64.
  2398. @item balance_in
  2399. Set input balance between both channels. Default is 0.
  2400. Allowed range is from -1 to 1.
  2401. @item balance_out
  2402. Set output balance between both channels. Default is 0.
  2403. Allowed range is from -1 to 1.
  2404. @item softclip
  2405. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2406. clipping. Disabled by default.
  2407. @item mutel
  2408. Mute the left channel. Disabled by default.
  2409. @item muter
  2410. Mute the right channel. Disabled by default.
  2411. @item phasel
  2412. Change the phase of the left channel. Disabled by default.
  2413. @item phaser
  2414. Change the phase of the right channel. Disabled by default.
  2415. @item mode
  2416. Set stereo mode. Available values are:
  2417. @table @samp
  2418. @item lr>lr
  2419. Left/Right to Left/Right, this is default.
  2420. @item lr>ms
  2421. Left/Right to Mid/Side.
  2422. @item ms>lr
  2423. Mid/Side to Left/Right.
  2424. @item lr>ll
  2425. Left/Right to Left/Left.
  2426. @item lr>rr
  2427. Left/Right to Right/Right.
  2428. @item lr>l+r
  2429. Left/Right to Left + Right.
  2430. @item lr>rl
  2431. Left/Right to Right/Left.
  2432. @end table
  2433. @item slev
  2434. Set level of side signal. Default is 1.
  2435. Allowed range is from 0.015625 to 64.
  2436. @item sbal
  2437. Set balance of side signal. Default is 0.
  2438. Allowed range is from -1 to 1.
  2439. @item mlev
  2440. Set level of the middle signal. Default is 1.
  2441. Allowed range is from 0.015625 to 64.
  2442. @item mpan
  2443. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2444. @item base
  2445. Set stereo base between mono and inversed channels. Default is 0.
  2446. Allowed range is from -1 to 1.
  2447. @item delay
  2448. Set delay in milliseconds how much to delay left from right channel and
  2449. vice versa. Default is 0. Allowed range is from -20 to 20.
  2450. @item sclevel
  2451. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2452. @item phase
  2453. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2454. @end table
  2455. @section stereowiden
  2456. This filter enhance the stereo effect by suppressing signal common to both
  2457. channels and by delaying the signal of left into right and vice versa,
  2458. thereby widening the stereo effect.
  2459. The filter accepts the following options:
  2460. @table @option
  2461. @item delay
  2462. Time in milliseconds of the delay of left signal into right and vice versa.
  2463. Default is 20 milliseconds.
  2464. @item feedback
  2465. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2466. effect of left signal in right output and vice versa which gives widening
  2467. effect. Default is 0.3.
  2468. @item crossfeed
  2469. Cross feed of left into right with inverted phase. This helps in suppressing
  2470. the mono. If the value is 1 it will cancel all the signal common to both
  2471. channels. Default is 0.3.
  2472. @item drymix
  2473. Set level of input signal of original channel. Default is 0.8.
  2474. @end table
  2475. @section treble
  2476. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2477. shelving filter with a response similar to that of a standard
  2478. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2479. The filter accepts the following options:
  2480. @table @option
  2481. @item gain, g
  2482. Give the gain at whichever is the lower of ~22 kHz and the
  2483. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2484. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2485. @item frequency, f
  2486. Set the filter's central frequency and so can be used
  2487. to extend or reduce the frequency range to be boosted or cut.
  2488. The default value is @code{3000} Hz.
  2489. @item width_type
  2490. Set method to specify band-width of filter.
  2491. @table @option
  2492. @item h
  2493. Hz
  2494. @item q
  2495. Q-Factor
  2496. @item o
  2497. octave
  2498. @item s
  2499. slope
  2500. @end table
  2501. @item width, w
  2502. Determine how steep is the filter's shelf transition.
  2503. @end table
  2504. @section tremolo
  2505. Sinusoidal amplitude modulation.
  2506. The filter accepts the following options:
  2507. @table @option
  2508. @item f
  2509. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2510. (20 Hz or lower) will result in a tremolo effect.
  2511. This filter may also be used as a ring modulator by specifying
  2512. a modulation frequency higher than 20 Hz.
  2513. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2514. @item d
  2515. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2516. Default value is 0.5.
  2517. @end table
  2518. @section vibrato
  2519. Sinusoidal phase modulation.
  2520. The filter accepts the following options:
  2521. @table @option
  2522. @item f
  2523. Modulation frequency in Hertz.
  2524. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2525. @item d
  2526. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2527. Default value is 0.5.
  2528. @end table
  2529. @section volume
  2530. Adjust the input audio volume.
  2531. It accepts the following parameters:
  2532. @table @option
  2533. @item volume
  2534. Set audio volume expression.
  2535. Output values are clipped to the maximum value.
  2536. The output audio volume is given by the relation:
  2537. @example
  2538. @var{output_volume} = @var{volume} * @var{input_volume}
  2539. @end example
  2540. The default value for @var{volume} is "1.0".
  2541. @item precision
  2542. This parameter represents the mathematical precision.
  2543. It determines which input sample formats will be allowed, which affects the
  2544. precision of the volume scaling.
  2545. @table @option
  2546. @item fixed
  2547. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2548. @item float
  2549. 32-bit floating-point; this limits input sample format to FLT. (default)
  2550. @item double
  2551. 64-bit floating-point; this limits input sample format to DBL.
  2552. @end table
  2553. @item replaygain
  2554. Choose the behaviour on encountering ReplayGain side data in input frames.
  2555. @table @option
  2556. @item drop
  2557. Remove ReplayGain side data, ignoring its contents (the default).
  2558. @item ignore
  2559. Ignore ReplayGain side data, but leave it in the frame.
  2560. @item track
  2561. Prefer the track gain, if present.
  2562. @item album
  2563. Prefer the album gain, if present.
  2564. @end table
  2565. @item replaygain_preamp
  2566. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2567. Default value for @var{replaygain_preamp} is 0.0.
  2568. @item eval
  2569. Set when the volume expression is evaluated.
  2570. It accepts the following values:
  2571. @table @samp
  2572. @item once
  2573. only evaluate expression once during the filter initialization, or
  2574. when the @samp{volume} command is sent
  2575. @item frame
  2576. evaluate expression for each incoming frame
  2577. @end table
  2578. Default value is @samp{once}.
  2579. @end table
  2580. The volume expression can contain the following parameters.
  2581. @table @option
  2582. @item n
  2583. frame number (starting at zero)
  2584. @item nb_channels
  2585. number of channels
  2586. @item nb_consumed_samples
  2587. number of samples consumed by the filter
  2588. @item nb_samples
  2589. number of samples in the current frame
  2590. @item pos
  2591. original frame position in the file
  2592. @item pts
  2593. frame PTS
  2594. @item sample_rate
  2595. sample rate
  2596. @item startpts
  2597. PTS at start of stream
  2598. @item startt
  2599. time at start of stream
  2600. @item t
  2601. frame time
  2602. @item tb
  2603. timestamp timebase
  2604. @item volume
  2605. last set volume value
  2606. @end table
  2607. Note that when @option{eval} is set to @samp{once} only the
  2608. @var{sample_rate} and @var{tb} variables are available, all other
  2609. variables will evaluate to NAN.
  2610. @subsection Commands
  2611. This filter supports the following commands:
  2612. @table @option
  2613. @item volume
  2614. Modify the volume expression.
  2615. The command accepts the same syntax of the corresponding option.
  2616. If the specified expression is not valid, it is kept at its current
  2617. value.
  2618. @item replaygain_noclip
  2619. Prevent clipping by limiting the gain applied.
  2620. Default value for @var{replaygain_noclip} is 1.
  2621. @end table
  2622. @subsection Examples
  2623. @itemize
  2624. @item
  2625. Halve the input audio volume:
  2626. @example
  2627. volume=volume=0.5
  2628. volume=volume=1/2
  2629. volume=volume=-6.0206dB
  2630. @end example
  2631. In all the above example the named key for @option{volume} can be
  2632. omitted, for example like in:
  2633. @example
  2634. volume=0.5
  2635. @end example
  2636. @item
  2637. Increase input audio power by 6 decibels using fixed-point precision:
  2638. @example
  2639. volume=volume=6dB:precision=fixed
  2640. @end example
  2641. @item
  2642. Fade volume after time 10 with an annihilation period of 5 seconds:
  2643. @example
  2644. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2645. @end example
  2646. @end itemize
  2647. @section volumedetect
  2648. Detect the volume of the input video.
  2649. The filter has no parameters. The input is not modified. Statistics about
  2650. the volume will be printed in the log when the input stream end is reached.
  2651. In particular it will show the mean volume (root mean square), maximum
  2652. volume (on a per-sample basis), and the beginning of a histogram of the
  2653. registered volume values (from the maximum value to a cumulated 1/1000 of
  2654. the samples).
  2655. All volumes are in decibels relative to the maximum PCM value.
  2656. @subsection Examples
  2657. Here is an excerpt of the output:
  2658. @example
  2659. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2660. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2661. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2662. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2663. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2664. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2665. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2666. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2667. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2668. @end example
  2669. It means that:
  2670. @itemize
  2671. @item
  2672. The mean square energy is approximately -27 dB, or 10^-2.7.
  2673. @item
  2674. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2675. @item
  2676. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2677. @end itemize
  2678. In other words, raising the volume by +4 dB does not cause any clipping,
  2679. raising it by +5 dB causes clipping for 6 samples, etc.
  2680. @c man end AUDIO FILTERS
  2681. @chapter Audio Sources
  2682. @c man begin AUDIO SOURCES
  2683. Below is a description of the currently available audio sources.
  2684. @section abuffer
  2685. Buffer audio frames, and make them available to the filter chain.
  2686. This source is mainly intended for a programmatic use, in particular
  2687. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2688. It accepts the following parameters:
  2689. @table @option
  2690. @item time_base
  2691. The timebase which will be used for timestamps of submitted frames. It must be
  2692. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2693. @item sample_rate
  2694. The sample rate of the incoming audio buffers.
  2695. @item sample_fmt
  2696. The sample format of the incoming audio buffers.
  2697. Either a sample format name or its corresponding integer representation from
  2698. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2699. @item channel_layout
  2700. The channel layout of the incoming audio buffers.
  2701. Either a channel layout name from channel_layout_map in
  2702. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2703. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2704. @item channels
  2705. The number of channels of the incoming audio buffers.
  2706. If both @var{channels} and @var{channel_layout} are specified, then they
  2707. must be consistent.
  2708. @end table
  2709. @subsection Examples
  2710. @example
  2711. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2712. @end example
  2713. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2714. Since the sample format with name "s16p" corresponds to the number
  2715. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2716. equivalent to:
  2717. @example
  2718. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2719. @end example
  2720. @section aevalsrc
  2721. Generate an audio signal specified by an expression.
  2722. This source accepts in input one or more expressions (one for each
  2723. channel), which are evaluated and used to generate a corresponding
  2724. audio signal.
  2725. This source accepts the following options:
  2726. @table @option
  2727. @item exprs
  2728. Set the '|'-separated expressions list for each separate channel. In case the
  2729. @option{channel_layout} option is not specified, the selected channel layout
  2730. depends on the number of provided expressions. Otherwise the last
  2731. specified expression is applied to the remaining output channels.
  2732. @item channel_layout, c
  2733. Set the channel layout. The number of channels in the specified layout
  2734. must be equal to the number of specified expressions.
  2735. @item duration, d
  2736. Set the minimum duration of the sourced audio. See
  2737. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2738. for the accepted syntax.
  2739. Note that the resulting duration may be greater than the specified
  2740. duration, as the generated audio is always cut at the end of a
  2741. complete frame.
  2742. If not specified, or the expressed duration is negative, the audio is
  2743. supposed to be generated forever.
  2744. @item nb_samples, n
  2745. Set the number of samples per channel per each output frame,
  2746. default to 1024.
  2747. @item sample_rate, s
  2748. Specify the sample rate, default to 44100.
  2749. @end table
  2750. Each expression in @var{exprs} can contain the following constants:
  2751. @table @option
  2752. @item n
  2753. number of the evaluated sample, starting from 0
  2754. @item t
  2755. time of the evaluated sample expressed in seconds, starting from 0
  2756. @item s
  2757. sample rate
  2758. @end table
  2759. @subsection Examples
  2760. @itemize
  2761. @item
  2762. Generate silence:
  2763. @example
  2764. aevalsrc=0
  2765. @end example
  2766. @item
  2767. Generate a sin signal with frequency of 440 Hz, set sample rate to
  2768. 8000 Hz:
  2769. @example
  2770. aevalsrc="sin(440*2*PI*t):s=8000"
  2771. @end example
  2772. @item
  2773. Generate a two channels signal, specify the channel layout (Front
  2774. Center + Back Center) explicitly:
  2775. @example
  2776. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  2777. @end example
  2778. @item
  2779. Generate white noise:
  2780. @example
  2781. aevalsrc="-2+random(0)"
  2782. @end example
  2783. @item
  2784. Generate an amplitude modulated signal:
  2785. @example
  2786. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  2787. @end example
  2788. @item
  2789. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  2790. @example
  2791. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  2792. @end example
  2793. @end itemize
  2794. @section anullsrc
  2795. The null audio source, return unprocessed audio frames. It is mainly useful
  2796. as a template and to be employed in analysis / debugging tools, or as
  2797. the source for filters which ignore the input data (for example the sox
  2798. synth filter).
  2799. This source accepts the following options:
  2800. @table @option
  2801. @item channel_layout, cl
  2802. Specifies the channel layout, and can be either an integer or a string
  2803. representing a channel layout. The default value of @var{channel_layout}
  2804. is "stereo".
  2805. Check the channel_layout_map definition in
  2806. @file{libavutil/channel_layout.c} for the mapping between strings and
  2807. channel layout values.
  2808. @item sample_rate, r
  2809. Specifies the sample rate, and defaults to 44100.
  2810. @item nb_samples, n
  2811. Set the number of samples per requested frames.
  2812. @end table
  2813. @subsection Examples
  2814. @itemize
  2815. @item
  2816. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  2817. @example
  2818. anullsrc=r=48000:cl=4
  2819. @end example
  2820. @item
  2821. Do the same operation with a more obvious syntax:
  2822. @example
  2823. anullsrc=r=48000:cl=mono
  2824. @end example
  2825. @end itemize
  2826. All the parameters need to be explicitly defined.
  2827. @section flite
  2828. Synthesize a voice utterance using the libflite library.
  2829. To enable compilation of this filter you need to configure FFmpeg with
  2830. @code{--enable-libflite}.
  2831. Note that the flite library is not thread-safe.
  2832. The filter accepts the following options:
  2833. @table @option
  2834. @item list_voices
  2835. If set to 1, list the names of the available voices and exit
  2836. immediately. Default value is 0.
  2837. @item nb_samples, n
  2838. Set the maximum number of samples per frame. Default value is 512.
  2839. @item textfile
  2840. Set the filename containing the text to speak.
  2841. @item text
  2842. Set the text to speak.
  2843. @item voice, v
  2844. Set the voice to use for the speech synthesis. Default value is
  2845. @code{kal}. See also the @var{list_voices} option.
  2846. @end table
  2847. @subsection Examples
  2848. @itemize
  2849. @item
  2850. Read from file @file{speech.txt}, and synthesize the text using the
  2851. standard flite voice:
  2852. @example
  2853. flite=textfile=speech.txt
  2854. @end example
  2855. @item
  2856. Read the specified text selecting the @code{slt} voice:
  2857. @example
  2858. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2859. @end example
  2860. @item
  2861. Input text to ffmpeg:
  2862. @example
  2863. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2864. @end example
  2865. @item
  2866. Make @file{ffplay} speak the specified text, using @code{flite} and
  2867. the @code{lavfi} device:
  2868. @example
  2869. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  2870. @end example
  2871. @end itemize
  2872. For more information about libflite, check:
  2873. @url{http://www.speech.cs.cmu.edu/flite/}
  2874. @section anoisesrc
  2875. Generate a noise audio signal.
  2876. The filter accepts the following options:
  2877. @table @option
  2878. @item sample_rate, r
  2879. Specify the sample rate. Default value is 48000 Hz.
  2880. @item amplitude, a
  2881. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  2882. is 1.0.
  2883. @item duration, d
  2884. Specify the duration of the generated audio stream. Not specifying this option
  2885. results in noise with an infinite length.
  2886. @item color, colour, c
  2887. Specify the color of noise. Available noise colors are white, pink, and brown.
  2888. Default color is white.
  2889. @item seed, s
  2890. Specify a value used to seed the PRNG.
  2891. @item nb_samples, n
  2892. Set the number of samples per each output frame, default is 1024.
  2893. @end table
  2894. @subsection Examples
  2895. @itemize
  2896. @item
  2897. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  2898. @example
  2899. anoisesrc=d=60:c=pink:r=44100:a=0.5
  2900. @end example
  2901. @end itemize
  2902. @section sine
  2903. Generate an audio signal made of a sine wave with amplitude 1/8.
  2904. The audio signal is bit-exact.
  2905. The filter accepts the following options:
  2906. @table @option
  2907. @item frequency, f
  2908. Set the carrier frequency. Default is 440 Hz.
  2909. @item beep_factor, b
  2910. Enable a periodic beep every second with frequency @var{beep_factor} times
  2911. the carrier frequency. Default is 0, meaning the beep is disabled.
  2912. @item sample_rate, r
  2913. Specify the sample rate, default is 44100.
  2914. @item duration, d
  2915. Specify the duration of the generated audio stream.
  2916. @item samples_per_frame
  2917. Set the number of samples per output frame.
  2918. The expression can contain the following constants:
  2919. @table @option
  2920. @item n
  2921. The (sequential) number of the output audio frame, starting from 0.
  2922. @item pts
  2923. The PTS (Presentation TimeStamp) of the output audio frame,
  2924. expressed in @var{TB} units.
  2925. @item t
  2926. The PTS of the output audio frame, expressed in seconds.
  2927. @item TB
  2928. The timebase of the output audio frames.
  2929. @end table
  2930. Default is @code{1024}.
  2931. @end table
  2932. @subsection Examples
  2933. @itemize
  2934. @item
  2935. Generate a simple 440 Hz sine wave:
  2936. @example
  2937. sine
  2938. @end example
  2939. @item
  2940. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  2941. @example
  2942. sine=220:4:d=5
  2943. sine=f=220:b=4:d=5
  2944. sine=frequency=220:beep_factor=4:duration=5
  2945. @end example
  2946. @item
  2947. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  2948. pattern:
  2949. @example
  2950. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  2951. @end example
  2952. @end itemize
  2953. @c man end AUDIO SOURCES
  2954. @chapter Audio Sinks
  2955. @c man begin AUDIO SINKS
  2956. Below is a description of the currently available audio sinks.
  2957. @section abuffersink
  2958. Buffer audio frames, and make them available to the end of filter chain.
  2959. This sink is mainly intended for programmatic use, in particular
  2960. through the interface defined in @file{libavfilter/buffersink.h}
  2961. or the options system.
  2962. It accepts a pointer to an AVABufferSinkContext structure, which
  2963. defines the incoming buffers' formats, to be passed as the opaque
  2964. parameter to @code{avfilter_init_filter} for initialization.
  2965. @section anullsink
  2966. Null audio sink; do absolutely nothing with the input audio. It is
  2967. mainly useful as a template and for use in analysis / debugging
  2968. tools.
  2969. @c man end AUDIO SINKS
  2970. @chapter Video Filters
  2971. @c man begin VIDEO FILTERS
  2972. When you configure your FFmpeg build, you can disable any of the
  2973. existing filters using @code{--disable-filters}.
  2974. The configure output will show the video filters included in your
  2975. build.
  2976. Below is a description of the currently available video filters.
  2977. @section alphaextract
  2978. Extract the alpha component from the input as a grayscale video. This
  2979. is especially useful with the @var{alphamerge} filter.
  2980. @section alphamerge
  2981. Add or replace the alpha component of the primary input with the
  2982. grayscale value of a second input. This is intended for use with
  2983. @var{alphaextract} to allow the transmission or storage of frame
  2984. sequences that have alpha in a format that doesn't support an alpha
  2985. channel.
  2986. For example, to reconstruct full frames from a normal YUV-encoded video
  2987. and a separate video created with @var{alphaextract}, you might use:
  2988. @example
  2989. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  2990. @end example
  2991. Since this filter is designed for reconstruction, it operates on frame
  2992. sequences without considering timestamps, and terminates when either
  2993. input reaches end of stream. This will cause problems if your encoding
  2994. pipeline drops frames. If you're trying to apply an image as an
  2995. overlay to a video stream, consider the @var{overlay} filter instead.
  2996. @section ass
  2997. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  2998. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  2999. Substation Alpha) subtitles files.
  3000. This filter accepts the following option in addition to the common options from
  3001. the @ref{subtitles} filter:
  3002. @table @option
  3003. @item shaping
  3004. Set the shaping engine
  3005. Available values are:
  3006. @table @samp
  3007. @item auto
  3008. The default libass shaping engine, which is the best available.
  3009. @item simple
  3010. Fast, font-agnostic shaper that can do only substitutions
  3011. @item complex
  3012. Slower shaper using OpenType for substitutions and positioning
  3013. @end table
  3014. The default is @code{auto}.
  3015. @end table
  3016. @section atadenoise
  3017. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3018. The filter accepts the following options:
  3019. @table @option
  3020. @item 0a
  3021. Set threshold A for 1st plane. Default is 0.02.
  3022. Valid range is 0 to 0.3.
  3023. @item 0b
  3024. Set threshold B for 1st plane. Default is 0.04.
  3025. Valid range is 0 to 5.
  3026. @item 1a
  3027. Set threshold A for 2nd plane. Default is 0.02.
  3028. Valid range is 0 to 0.3.
  3029. @item 1b
  3030. Set threshold B for 2nd plane. Default is 0.04.
  3031. Valid range is 0 to 5.
  3032. @item 2a
  3033. Set threshold A for 3rd plane. Default is 0.02.
  3034. Valid range is 0 to 0.3.
  3035. @item 2b
  3036. Set threshold B for 3rd plane. Default is 0.04.
  3037. Valid range is 0 to 5.
  3038. Threshold A is designed to react on abrupt changes in the input signal and
  3039. threshold B is designed to react on continuous changes in the input signal.
  3040. @item s
  3041. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3042. number in range [5, 129].
  3043. @end table
  3044. @section bbox
  3045. Compute the bounding box for the non-black pixels in the input frame
  3046. luminance plane.
  3047. This filter computes the bounding box containing all the pixels with a
  3048. luminance value greater than the minimum allowed value.
  3049. The parameters describing the bounding box are printed on the filter
  3050. log.
  3051. The filter accepts the following option:
  3052. @table @option
  3053. @item min_val
  3054. Set the minimal luminance value. Default is @code{16}.
  3055. @end table
  3056. @section blackdetect
  3057. Detect video intervals that are (almost) completely black. Can be
  3058. useful to detect chapter transitions, commercials, or invalid
  3059. recordings. Output lines contains the time for the start, end and
  3060. duration of the detected black interval expressed in seconds.
  3061. In order to display the output lines, you need to set the loglevel at
  3062. least to the AV_LOG_INFO value.
  3063. The filter accepts the following options:
  3064. @table @option
  3065. @item black_min_duration, d
  3066. Set the minimum detected black duration expressed in seconds. It must
  3067. be a non-negative floating point number.
  3068. Default value is 2.0.
  3069. @item picture_black_ratio_th, pic_th
  3070. Set the threshold for considering a picture "black".
  3071. Express the minimum value for the ratio:
  3072. @example
  3073. @var{nb_black_pixels} / @var{nb_pixels}
  3074. @end example
  3075. for which a picture is considered black.
  3076. Default value is 0.98.
  3077. @item pixel_black_th, pix_th
  3078. Set the threshold for considering a pixel "black".
  3079. The threshold expresses the maximum pixel luminance value for which a
  3080. pixel is considered "black". The provided value is scaled according to
  3081. the following equation:
  3082. @example
  3083. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3084. @end example
  3085. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3086. the input video format, the range is [0-255] for YUV full-range
  3087. formats and [16-235] for YUV non full-range formats.
  3088. Default value is 0.10.
  3089. @end table
  3090. The following example sets the maximum pixel threshold to the minimum
  3091. value, and detects only black intervals of 2 or more seconds:
  3092. @example
  3093. blackdetect=d=2:pix_th=0.00
  3094. @end example
  3095. @section blackframe
  3096. Detect frames that are (almost) completely black. Can be useful to
  3097. detect chapter transitions or commercials. Output lines consist of
  3098. the frame number of the detected frame, the percentage of blackness,
  3099. the position in the file if known or -1 and the timestamp in seconds.
  3100. In order to display the output lines, you need to set the loglevel at
  3101. least to the AV_LOG_INFO value.
  3102. It accepts the following parameters:
  3103. @table @option
  3104. @item amount
  3105. The percentage of the pixels that have to be below the threshold; it defaults to
  3106. @code{98}.
  3107. @item threshold, thresh
  3108. The threshold below which a pixel value is considered black; it defaults to
  3109. @code{32}.
  3110. @end table
  3111. @section blend, tblend
  3112. Blend two video frames into each other.
  3113. The @code{blend} filter takes two input streams and outputs one
  3114. stream, the first input is the "top" layer and second input is
  3115. "bottom" layer. Output terminates when shortest input terminates.
  3116. The @code{tblend} (time blend) filter takes two consecutive frames
  3117. from one single stream, and outputs the result obtained by blending
  3118. the new frame on top of the old frame.
  3119. A description of the accepted options follows.
  3120. @table @option
  3121. @item c0_mode
  3122. @item c1_mode
  3123. @item c2_mode
  3124. @item c3_mode
  3125. @item all_mode
  3126. Set blend mode for specific pixel component or all pixel components in case
  3127. of @var{all_mode}. Default value is @code{normal}.
  3128. Available values for component modes are:
  3129. @table @samp
  3130. @item addition
  3131. @item addition128
  3132. @item and
  3133. @item average
  3134. @item burn
  3135. @item darken
  3136. @item difference
  3137. @item difference128
  3138. @item divide
  3139. @item dodge
  3140. @item exclusion
  3141. @item glow
  3142. @item hardlight
  3143. @item hardmix
  3144. @item lighten
  3145. @item linearlight
  3146. @item multiply
  3147. @item negation
  3148. @item normal
  3149. @item or
  3150. @item overlay
  3151. @item phoenix
  3152. @item pinlight
  3153. @item reflect
  3154. @item screen
  3155. @item softlight
  3156. @item subtract
  3157. @item vividlight
  3158. @item xor
  3159. @end table
  3160. @item c0_opacity
  3161. @item c1_opacity
  3162. @item c2_opacity
  3163. @item c3_opacity
  3164. @item all_opacity
  3165. Set blend opacity for specific pixel component or all pixel components in case
  3166. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3167. @item c0_expr
  3168. @item c1_expr
  3169. @item c2_expr
  3170. @item c3_expr
  3171. @item all_expr
  3172. Set blend expression for specific pixel component or all pixel components in case
  3173. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3174. The expressions can use the following variables:
  3175. @table @option
  3176. @item N
  3177. The sequential number of the filtered frame, starting from @code{0}.
  3178. @item X
  3179. @item Y
  3180. the coordinates of the current sample
  3181. @item W
  3182. @item H
  3183. the width and height of currently filtered plane
  3184. @item SW
  3185. @item SH
  3186. Width and height scale depending on the currently filtered plane. It is the
  3187. ratio between the corresponding luma plane number of pixels and the current
  3188. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3189. @code{0.5,0.5} for chroma planes.
  3190. @item T
  3191. Time of the current frame, expressed in seconds.
  3192. @item TOP, A
  3193. Value of pixel component at current location for first video frame (top layer).
  3194. @item BOTTOM, B
  3195. Value of pixel component at current location for second video frame (bottom layer).
  3196. @end table
  3197. @item shortest
  3198. Force termination when the shortest input terminates. Default is
  3199. @code{0}. This option is only defined for the @code{blend} filter.
  3200. @item repeatlast
  3201. Continue applying the last bottom frame after the end of the stream. A value of
  3202. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3203. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3204. @end table
  3205. @subsection Examples
  3206. @itemize
  3207. @item
  3208. Apply transition from bottom layer to top layer in first 10 seconds:
  3209. @example
  3210. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3211. @end example
  3212. @item
  3213. Apply 1x1 checkerboard effect:
  3214. @example
  3215. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3216. @end example
  3217. @item
  3218. Apply uncover left effect:
  3219. @example
  3220. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3221. @end example
  3222. @item
  3223. Apply uncover down effect:
  3224. @example
  3225. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3226. @end example
  3227. @item
  3228. Apply uncover up-left effect:
  3229. @example
  3230. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3231. @end example
  3232. @item
  3233. Display differences between the current and the previous frame:
  3234. @example
  3235. tblend=all_mode=difference128
  3236. @end example
  3237. @end itemize
  3238. @section boxblur
  3239. Apply a boxblur algorithm to the input video.
  3240. It accepts the following parameters:
  3241. @table @option
  3242. @item luma_radius, lr
  3243. @item luma_power, lp
  3244. @item chroma_radius, cr
  3245. @item chroma_power, cp
  3246. @item alpha_radius, ar
  3247. @item alpha_power, ap
  3248. @end table
  3249. A description of the accepted options follows.
  3250. @table @option
  3251. @item luma_radius, lr
  3252. @item chroma_radius, cr
  3253. @item alpha_radius, ar
  3254. Set an expression for the box radius in pixels used for blurring the
  3255. corresponding input plane.
  3256. The radius value must be a non-negative number, and must not be
  3257. greater than the value of the expression @code{min(w,h)/2} for the
  3258. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3259. planes.
  3260. Default value for @option{luma_radius} is "2". If not specified,
  3261. @option{chroma_radius} and @option{alpha_radius} default to the
  3262. corresponding value set for @option{luma_radius}.
  3263. The expressions can contain the following constants:
  3264. @table @option
  3265. @item w
  3266. @item h
  3267. The input width and height in pixels.
  3268. @item cw
  3269. @item ch
  3270. The input chroma image width and height in pixels.
  3271. @item hsub
  3272. @item vsub
  3273. The horizontal and vertical chroma subsample values. For example, for the
  3274. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3275. @end table
  3276. @item luma_power, lp
  3277. @item chroma_power, cp
  3278. @item alpha_power, ap
  3279. Specify how many times the boxblur filter is applied to the
  3280. corresponding plane.
  3281. Default value for @option{luma_power} is 2. If not specified,
  3282. @option{chroma_power} and @option{alpha_power} default to the
  3283. corresponding value set for @option{luma_power}.
  3284. A value of 0 will disable the effect.
  3285. @end table
  3286. @subsection Examples
  3287. @itemize
  3288. @item
  3289. Apply a boxblur filter with the luma, chroma, and alpha radii
  3290. set to 2:
  3291. @example
  3292. boxblur=luma_radius=2:luma_power=1
  3293. boxblur=2:1
  3294. @end example
  3295. @item
  3296. Set the luma radius to 2, and alpha and chroma radius to 0:
  3297. @example
  3298. boxblur=2:1:cr=0:ar=0
  3299. @end example
  3300. @item
  3301. Set the luma and chroma radii to a fraction of the video dimension:
  3302. @example
  3303. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3304. @end example
  3305. @end itemize
  3306. @section chromakey
  3307. YUV colorspace color/chroma keying.
  3308. The filter accepts the following options:
  3309. @table @option
  3310. @item color
  3311. The color which will be replaced with transparency.
  3312. @item similarity
  3313. Similarity percentage with the key color.
  3314. 0.01 matches only the exact key color, while 1.0 matches everything.
  3315. @item blend
  3316. Blend percentage.
  3317. 0.0 makes pixels either fully transparent, or not transparent at all.
  3318. Higher values result in semi-transparent pixels, with a higher transparency
  3319. the more similar the pixels color is to the key color.
  3320. @item yuv
  3321. Signals that the color passed is already in YUV instead of RGB.
  3322. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3323. This can be used to pass exact YUV values as hexadecimal numbers.
  3324. @end table
  3325. @subsection Examples
  3326. @itemize
  3327. @item
  3328. Make every green pixel in the input image transparent:
  3329. @example
  3330. ffmpeg -i input.png -vf chromakey=green out.png
  3331. @end example
  3332. @item
  3333. Overlay a greenscreen-video on top of a static black background.
  3334. @example
  3335. 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
  3336. @end example
  3337. @end itemize
  3338. @section codecview
  3339. Visualize information exported by some codecs.
  3340. Some codecs can export information through frames using side-data or other
  3341. means. For example, some MPEG based codecs export motion vectors through the
  3342. @var{export_mvs} flag in the codec @option{flags2} option.
  3343. The filter accepts the following option:
  3344. @table @option
  3345. @item mv
  3346. Set motion vectors to visualize.
  3347. Available flags for @var{mv} are:
  3348. @table @samp
  3349. @item pf
  3350. forward predicted MVs of P-frames
  3351. @item bf
  3352. forward predicted MVs of B-frames
  3353. @item bb
  3354. backward predicted MVs of B-frames
  3355. @end table
  3356. @item qp
  3357. Display quantization parameters using the chroma planes
  3358. @end table
  3359. @subsection Examples
  3360. @itemize
  3361. @item
  3362. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  3363. @example
  3364. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  3365. @end example
  3366. @end itemize
  3367. @section colorbalance
  3368. Modify intensity of primary colors (red, green and blue) of input frames.
  3369. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3370. regions for the red-cyan, green-magenta or blue-yellow balance.
  3371. A positive adjustment value shifts the balance towards the primary color, a negative
  3372. value towards the complementary color.
  3373. The filter accepts the following options:
  3374. @table @option
  3375. @item rs
  3376. @item gs
  3377. @item bs
  3378. Adjust red, green and blue shadows (darkest pixels).
  3379. @item rm
  3380. @item gm
  3381. @item bm
  3382. Adjust red, green and blue midtones (medium pixels).
  3383. @item rh
  3384. @item gh
  3385. @item bh
  3386. Adjust red, green and blue highlights (brightest pixels).
  3387. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3388. @end table
  3389. @subsection Examples
  3390. @itemize
  3391. @item
  3392. Add red color cast to shadows:
  3393. @example
  3394. colorbalance=rs=.3
  3395. @end example
  3396. @end itemize
  3397. @section colorkey
  3398. RGB colorspace color keying.
  3399. The filter accepts the following options:
  3400. @table @option
  3401. @item color
  3402. The color which will be replaced with transparency.
  3403. @item similarity
  3404. Similarity percentage with the key color.
  3405. 0.01 matches only the exact key color, while 1.0 matches everything.
  3406. @item blend
  3407. Blend percentage.
  3408. 0.0 makes pixels either fully transparent, or not transparent at all.
  3409. Higher values result in semi-transparent pixels, with a higher transparency
  3410. the more similar the pixels color is to the key color.
  3411. @end table
  3412. @subsection Examples
  3413. @itemize
  3414. @item
  3415. Make every green pixel in the input image transparent:
  3416. @example
  3417. ffmpeg -i input.png -vf colorkey=green out.png
  3418. @end example
  3419. @item
  3420. Overlay a greenscreen-video on top of a static background image.
  3421. @example
  3422. 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
  3423. @end example
  3424. @end itemize
  3425. @section colorlevels
  3426. Adjust video input frames using levels.
  3427. The filter accepts the following options:
  3428. @table @option
  3429. @item rimin
  3430. @item gimin
  3431. @item bimin
  3432. @item aimin
  3433. Adjust red, green, blue and alpha input black point.
  3434. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3435. @item rimax
  3436. @item gimax
  3437. @item bimax
  3438. @item aimax
  3439. Adjust red, green, blue and alpha input white point.
  3440. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3441. Input levels are used to lighten highlights (bright tones), darken shadows
  3442. (dark tones), change the balance of bright and dark tones.
  3443. @item romin
  3444. @item gomin
  3445. @item bomin
  3446. @item aomin
  3447. Adjust red, green, blue and alpha output black point.
  3448. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3449. @item romax
  3450. @item gomax
  3451. @item bomax
  3452. @item aomax
  3453. Adjust red, green, blue and alpha output white point.
  3454. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3455. Output levels allows manual selection of a constrained output level range.
  3456. @end table
  3457. @subsection Examples
  3458. @itemize
  3459. @item
  3460. Make video output darker:
  3461. @example
  3462. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3463. @end example
  3464. @item
  3465. Increase contrast:
  3466. @example
  3467. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3468. @end example
  3469. @item
  3470. Make video output lighter:
  3471. @example
  3472. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3473. @end example
  3474. @item
  3475. Increase brightness:
  3476. @example
  3477. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3478. @end example
  3479. @end itemize
  3480. @section colorchannelmixer
  3481. Adjust video input frames by re-mixing color channels.
  3482. This filter modifies a color channel by adding the values associated to
  3483. the other channels of the same pixels. For example if the value to
  3484. modify is red, the output value will be:
  3485. @example
  3486. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3487. @end example
  3488. The filter accepts the following options:
  3489. @table @option
  3490. @item rr
  3491. @item rg
  3492. @item rb
  3493. @item ra
  3494. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3495. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3496. @item gr
  3497. @item gg
  3498. @item gb
  3499. @item ga
  3500. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3501. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3502. @item br
  3503. @item bg
  3504. @item bb
  3505. @item ba
  3506. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3507. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3508. @item ar
  3509. @item ag
  3510. @item ab
  3511. @item aa
  3512. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3513. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3514. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3515. @end table
  3516. @subsection Examples
  3517. @itemize
  3518. @item
  3519. Convert source to grayscale:
  3520. @example
  3521. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3522. @end example
  3523. @item
  3524. Simulate sepia tones:
  3525. @example
  3526. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3527. @end example
  3528. @end itemize
  3529. @section colormatrix
  3530. Convert color matrix.
  3531. The filter accepts the following options:
  3532. @table @option
  3533. @item src
  3534. @item dst
  3535. Specify the source and destination color matrix. Both values must be
  3536. specified.
  3537. The accepted values are:
  3538. @table @samp
  3539. @item bt709
  3540. BT.709
  3541. @item bt601
  3542. BT.601
  3543. @item smpte240m
  3544. SMPTE-240M
  3545. @item fcc
  3546. FCC
  3547. @end table
  3548. @end table
  3549. For example to convert from BT.601 to SMPTE-240M, use the command:
  3550. @example
  3551. colormatrix=bt601:smpte240m
  3552. @end example
  3553. @section copy
  3554. Copy the input source unchanged to the output. This is mainly useful for
  3555. testing purposes.
  3556. @section crop
  3557. Crop the input video to given dimensions.
  3558. It accepts the following parameters:
  3559. @table @option
  3560. @item w, out_w
  3561. The width of the output video. It defaults to @code{iw}.
  3562. This expression is evaluated only once during the filter
  3563. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  3564. @item h, out_h
  3565. The height of the output video. It defaults to @code{ih}.
  3566. This expression is evaluated only once during the filter
  3567. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  3568. @item x
  3569. The horizontal position, in the input video, of the left edge of the output
  3570. video. It defaults to @code{(in_w-out_w)/2}.
  3571. This expression is evaluated per-frame.
  3572. @item y
  3573. The vertical position, in the input video, of the top edge of the output video.
  3574. It defaults to @code{(in_h-out_h)/2}.
  3575. This expression is evaluated per-frame.
  3576. @item keep_aspect
  3577. If set to 1 will force the output display aspect ratio
  3578. to be the same of the input, by changing the output sample aspect
  3579. ratio. It defaults to 0.
  3580. @end table
  3581. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  3582. expressions containing the following constants:
  3583. @table @option
  3584. @item x
  3585. @item y
  3586. The computed values for @var{x} and @var{y}. They are evaluated for
  3587. each new frame.
  3588. @item in_w
  3589. @item in_h
  3590. The input width and height.
  3591. @item iw
  3592. @item ih
  3593. These are the same as @var{in_w} and @var{in_h}.
  3594. @item out_w
  3595. @item out_h
  3596. The output (cropped) width and height.
  3597. @item ow
  3598. @item oh
  3599. These are the same as @var{out_w} and @var{out_h}.
  3600. @item a
  3601. same as @var{iw} / @var{ih}
  3602. @item sar
  3603. input sample aspect ratio
  3604. @item dar
  3605. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  3606. @item hsub
  3607. @item vsub
  3608. horizontal and vertical chroma subsample values. For example for the
  3609. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3610. @item n
  3611. The number of the input frame, starting from 0.
  3612. @item pos
  3613. the position in the file of the input frame, NAN if unknown
  3614. @item t
  3615. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  3616. @end table
  3617. The expression for @var{out_w} may depend on the value of @var{out_h},
  3618. and the expression for @var{out_h} may depend on @var{out_w}, but they
  3619. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  3620. evaluated after @var{out_w} and @var{out_h}.
  3621. The @var{x} and @var{y} parameters specify the expressions for the
  3622. position of the top-left corner of the output (non-cropped) area. They
  3623. are evaluated for each frame. If the evaluated value is not valid, it
  3624. is approximated to the nearest valid value.
  3625. The expression for @var{x} may depend on @var{y}, and the expression
  3626. for @var{y} may depend on @var{x}.
  3627. @subsection Examples
  3628. @itemize
  3629. @item
  3630. Crop area with size 100x100 at position (12,34).
  3631. @example
  3632. crop=100:100:12:34
  3633. @end example
  3634. Using named options, the example above becomes:
  3635. @example
  3636. crop=w=100:h=100:x=12:y=34
  3637. @end example
  3638. @item
  3639. Crop the central input area with size 100x100:
  3640. @example
  3641. crop=100:100
  3642. @end example
  3643. @item
  3644. Crop the central input area with size 2/3 of the input video:
  3645. @example
  3646. crop=2/3*in_w:2/3*in_h
  3647. @end example
  3648. @item
  3649. Crop the input video central square:
  3650. @example
  3651. crop=out_w=in_h
  3652. crop=in_h
  3653. @end example
  3654. @item
  3655. Delimit the rectangle with the top-left corner placed at position
  3656. 100:100 and the right-bottom corner corresponding to the right-bottom
  3657. corner of the input image.
  3658. @example
  3659. crop=in_w-100:in_h-100:100:100
  3660. @end example
  3661. @item
  3662. Crop 10 pixels from the left and right borders, and 20 pixels from
  3663. the top and bottom borders
  3664. @example
  3665. crop=in_w-2*10:in_h-2*20
  3666. @end example
  3667. @item
  3668. Keep only the bottom right quarter of the input image:
  3669. @example
  3670. crop=in_w/2:in_h/2:in_w/2:in_h/2
  3671. @end example
  3672. @item
  3673. Crop height for getting Greek harmony:
  3674. @example
  3675. crop=in_w:1/PHI*in_w
  3676. @end example
  3677. @item
  3678. Apply trembling effect:
  3679. @example
  3680. 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)
  3681. @end example
  3682. @item
  3683. Apply erratic camera effect depending on timestamp:
  3684. @example
  3685. 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)"
  3686. @end example
  3687. @item
  3688. Set x depending on the value of y:
  3689. @example
  3690. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  3691. @end example
  3692. @end itemize
  3693. @subsection Commands
  3694. This filter supports the following commands:
  3695. @table @option
  3696. @item w, out_w
  3697. @item h, out_h
  3698. @item x
  3699. @item y
  3700. Set width/height of the output video and the horizontal/vertical position
  3701. in the input video.
  3702. The command accepts the same syntax of the corresponding option.
  3703. If the specified expression is not valid, it is kept at its current
  3704. value.
  3705. @end table
  3706. @section cropdetect
  3707. Auto-detect the crop size.
  3708. It calculates the necessary cropping parameters and prints the
  3709. recommended parameters via the logging system. The detected dimensions
  3710. correspond to the non-black area of the input video.
  3711. It accepts the following parameters:
  3712. @table @option
  3713. @item limit
  3714. Set higher black value threshold, which can be optionally specified
  3715. from nothing (0) to everything (255 for 8bit based formats). An intensity
  3716. value greater to the set value is considered non-black. It defaults to 24.
  3717. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  3718. on the bitdepth of the pixel format.
  3719. @item round
  3720. The value which the width/height should be divisible by. It defaults to
  3721. 16. The offset is automatically adjusted to center the video. Use 2 to
  3722. get only even dimensions (needed for 4:2:2 video). 16 is best when
  3723. encoding to most video codecs.
  3724. @item reset_count, reset
  3725. Set the counter that determines after how many frames cropdetect will
  3726. reset the previously detected largest video area and start over to
  3727. detect the current optimal crop area. Default value is 0.
  3728. This can be useful when channel logos distort the video area. 0
  3729. indicates 'never reset', and returns the largest area encountered during
  3730. playback.
  3731. @end table
  3732. @anchor{curves}
  3733. @section curves
  3734. Apply color adjustments using curves.
  3735. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  3736. component (red, green and blue) has its values defined by @var{N} key points
  3737. tied from each other using a smooth curve. The x-axis represents the pixel
  3738. values from the input frame, and the y-axis the new pixel values to be set for
  3739. the output frame.
  3740. By default, a component curve is defined by the two points @var{(0;0)} and
  3741. @var{(1;1)}. This creates a straight line where each original pixel value is
  3742. "adjusted" to its own value, which means no change to the image.
  3743. The filter allows you to redefine these two points and add some more. A new
  3744. curve (using a natural cubic spline interpolation) will be define to pass
  3745. smoothly through all these new coordinates. The new defined points needs to be
  3746. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  3747. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  3748. the vector spaces, the values will be clipped accordingly.
  3749. If there is no key point defined in @code{x=0}, the filter will automatically
  3750. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  3751. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  3752. The filter accepts the following options:
  3753. @table @option
  3754. @item preset
  3755. Select one of the available color presets. This option can be used in addition
  3756. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  3757. options takes priority on the preset values.
  3758. Available presets are:
  3759. @table @samp
  3760. @item none
  3761. @item color_negative
  3762. @item cross_process
  3763. @item darker
  3764. @item increase_contrast
  3765. @item lighter
  3766. @item linear_contrast
  3767. @item medium_contrast
  3768. @item negative
  3769. @item strong_contrast
  3770. @item vintage
  3771. @end table
  3772. Default is @code{none}.
  3773. @item master, m
  3774. Set the master key points. These points will define a second pass mapping. It
  3775. is sometimes called a "luminance" or "value" mapping. It can be used with
  3776. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  3777. post-processing LUT.
  3778. @item red, r
  3779. Set the key points for the red component.
  3780. @item green, g
  3781. Set the key points for the green component.
  3782. @item blue, b
  3783. Set the key points for the blue component.
  3784. @item all
  3785. Set the key points for all components (not including master).
  3786. Can be used in addition to the other key points component
  3787. options. In this case, the unset component(s) will fallback on this
  3788. @option{all} setting.
  3789. @item psfile
  3790. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  3791. @end table
  3792. To avoid some filtergraph syntax conflicts, each key points list need to be
  3793. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  3794. @subsection Examples
  3795. @itemize
  3796. @item
  3797. Increase slightly the middle level of blue:
  3798. @example
  3799. curves=blue='0.5/0.58'
  3800. @end example
  3801. @item
  3802. Vintage effect:
  3803. @example
  3804. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  3805. @end example
  3806. Here we obtain the following coordinates for each components:
  3807. @table @var
  3808. @item red
  3809. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  3810. @item green
  3811. @code{(0;0) (0.50;0.48) (1;1)}
  3812. @item blue
  3813. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  3814. @end table
  3815. @item
  3816. The previous example can also be achieved with the associated built-in preset:
  3817. @example
  3818. curves=preset=vintage
  3819. @end example
  3820. @item
  3821. Or simply:
  3822. @example
  3823. curves=vintage
  3824. @end example
  3825. @item
  3826. Use a Photoshop preset and redefine the points of the green component:
  3827. @example
  3828. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  3829. @end example
  3830. @end itemize
  3831. @section dctdnoiz
  3832. Denoise frames using 2D DCT (frequency domain filtering).
  3833. This filter is not designed for real time.
  3834. The filter accepts the following options:
  3835. @table @option
  3836. @item sigma, s
  3837. Set the noise sigma constant.
  3838. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  3839. coefficient (absolute value) below this threshold with be dropped.
  3840. If you need a more advanced filtering, see @option{expr}.
  3841. Default is @code{0}.
  3842. @item overlap
  3843. Set number overlapping pixels for each block. Since the filter can be slow, you
  3844. may want to reduce this value, at the cost of a less effective filter and the
  3845. risk of various artefacts.
  3846. If the overlapping value doesn't permit processing the whole input width or
  3847. height, a warning will be displayed and according borders won't be denoised.
  3848. Default value is @var{blocksize}-1, which is the best possible setting.
  3849. @item expr, e
  3850. Set the coefficient factor expression.
  3851. For each coefficient of a DCT block, this expression will be evaluated as a
  3852. multiplier value for the coefficient.
  3853. If this is option is set, the @option{sigma} option will be ignored.
  3854. The absolute value of the coefficient can be accessed through the @var{c}
  3855. variable.
  3856. @item n
  3857. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  3858. @var{blocksize}, which is the width and height of the processed blocks.
  3859. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  3860. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  3861. on the speed processing. Also, a larger block size does not necessarily means a
  3862. better de-noising.
  3863. @end table
  3864. @subsection Examples
  3865. Apply a denoise with a @option{sigma} of @code{4.5}:
  3866. @example
  3867. dctdnoiz=4.5
  3868. @end example
  3869. The same operation can be achieved using the expression system:
  3870. @example
  3871. dctdnoiz=e='gte(c, 4.5*3)'
  3872. @end example
  3873. Violent denoise using a block size of @code{16x16}:
  3874. @example
  3875. dctdnoiz=15:n=4
  3876. @end example
  3877. @section deband
  3878. Remove banding artifacts from input video.
  3879. It works by replacing banded pixels with average value of referenced pixels.
  3880. The filter accepts the following options:
  3881. @table @option
  3882. @item 1thr
  3883. @item 2thr
  3884. @item 3thr
  3885. @item 4thr
  3886. Set banding detection threshold for each plane. Default is 0.02.
  3887. Valid range is 0.00003 to 0.5.
  3888. If difference between current pixel and reference pixel is less than threshold,
  3889. it will be considered as banded.
  3890. @item range, r
  3891. Banding detection range in pixels. Default is 16. If positive, random number
  3892. in range 0 to set value will be used. If negative, exact absolute value
  3893. will be used.
  3894. The range defines square of four pixels around current pixel.
  3895. @item direction, d
  3896. Set direction in radians from which four pixel will be compared. If positive,
  3897. random direction from 0 to set direction will be picked. If negative, exact of
  3898. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  3899. will pick only pixels on same row and -PI/2 will pick only pixels on same
  3900. column.
  3901. @item blur
  3902. If enabled, current pixel is compared with average value of all four
  3903. surrounding pixels. The default is enabled. If disabled current pixel is
  3904. compared with all four surrounding pixels. The pixel is considered banded
  3905. if only all four differences with surrounding pixels are less than threshold.
  3906. @end table
  3907. @anchor{decimate}
  3908. @section decimate
  3909. Drop duplicated frames at regular intervals.
  3910. The filter accepts the following options:
  3911. @table @option
  3912. @item cycle
  3913. Set the number of frames from which one will be dropped. Setting this to
  3914. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  3915. Default is @code{5}.
  3916. @item dupthresh
  3917. Set the threshold for duplicate detection. If the difference metric for a frame
  3918. is less than or equal to this value, then it is declared as duplicate. Default
  3919. is @code{1.1}
  3920. @item scthresh
  3921. Set scene change threshold. Default is @code{15}.
  3922. @item blockx
  3923. @item blocky
  3924. Set the size of the x and y-axis blocks used during metric calculations.
  3925. Larger blocks give better noise suppression, but also give worse detection of
  3926. small movements. Must be a power of two. Default is @code{32}.
  3927. @item ppsrc
  3928. Mark main input as a pre-processed input and activate clean source input
  3929. stream. This allows the input to be pre-processed with various filters to help
  3930. the metrics calculation while keeping the frame selection lossless. When set to
  3931. @code{1}, the first stream is for the pre-processed input, and the second
  3932. stream is the clean source from where the kept frames are chosen. Default is
  3933. @code{0}.
  3934. @item chroma
  3935. Set whether or not chroma is considered in the metric calculations. Default is
  3936. @code{1}.
  3937. @end table
  3938. @section deflate
  3939. Apply deflate effect to the video.
  3940. This filter replaces the pixel by the local(3x3) average by taking into account
  3941. only values lower than the pixel.
  3942. It accepts the following options:
  3943. @table @option
  3944. @item threshold0
  3945. @item threshold1
  3946. @item threshold2
  3947. @item threshold3
  3948. Limit the maximum change for each plane, default is 65535.
  3949. If 0, plane will remain unchanged.
  3950. @end table
  3951. @section dejudder
  3952. Remove judder produced by partially interlaced telecined content.
  3953. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  3954. source was partially telecined content then the output of @code{pullup,dejudder}
  3955. will have a variable frame rate. May change the recorded frame rate of the
  3956. container. Aside from that change, this filter will not affect constant frame
  3957. rate video.
  3958. The option available in this filter is:
  3959. @table @option
  3960. @item cycle
  3961. Specify the length of the window over which the judder repeats.
  3962. Accepts any integer greater than 1. Useful values are:
  3963. @table @samp
  3964. @item 4
  3965. If the original was telecined from 24 to 30 fps (Film to NTSC).
  3966. @item 5
  3967. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  3968. @item 20
  3969. If a mixture of the two.
  3970. @end table
  3971. The default is @samp{4}.
  3972. @end table
  3973. @section delogo
  3974. Suppress a TV station logo by a simple interpolation of the surrounding
  3975. pixels. Just set a rectangle covering the logo and watch it disappear
  3976. (and sometimes something even uglier appear - your mileage may vary).
  3977. It accepts the following parameters:
  3978. @table @option
  3979. @item x
  3980. @item y
  3981. Specify the top left corner coordinates of the logo. They must be
  3982. specified.
  3983. @item w
  3984. @item h
  3985. Specify the width and height of the logo to clear. They must be
  3986. specified.
  3987. @item band, t
  3988. Specify the thickness of the fuzzy edge of the rectangle (added to
  3989. @var{w} and @var{h}). The default value is 1. This option is
  3990. deprecated, setting higher values should no longer be necessary and
  3991. is not recommended.
  3992. @item show
  3993. When set to 1, a green rectangle is drawn on the screen to simplify
  3994. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  3995. The default value is 0.
  3996. The rectangle is drawn on the outermost pixels which will be (partly)
  3997. replaced with interpolated values. The values of the next pixels
  3998. immediately outside this rectangle in each direction will be used to
  3999. compute the interpolated pixel values inside the rectangle.
  4000. @end table
  4001. @subsection Examples
  4002. @itemize
  4003. @item
  4004. Set a rectangle covering the area with top left corner coordinates 0,0
  4005. and size 100x77, and a band of size 10:
  4006. @example
  4007. delogo=x=0:y=0:w=100:h=77:band=10
  4008. @end example
  4009. @end itemize
  4010. @section deshake
  4011. Attempt to fix small changes in horizontal and/or vertical shift. This
  4012. filter helps remove camera shake from hand-holding a camera, bumping a
  4013. tripod, moving on a vehicle, etc.
  4014. The filter accepts the following options:
  4015. @table @option
  4016. @item x
  4017. @item y
  4018. @item w
  4019. @item h
  4020. Specify a rectangular area where to limit the search for motion
  4021. vectors.
  4022. If desired the search for motion vectors can be limited to a
  4023. rectangular area of the frame defined by its top left corner, width
  4024. and height. These parameters have the same meaning as the drawbox
  4025. filter which can be used to visualise the position of the bounding
  4026. box.
  4027. This is useful when simultaneous movement of subjects within the frame
  4028. might be confused for camera motion by the motion vector search.
  4029. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4030. then the full frame is used. This allows later options to be set
  4031. without specifying the bounding box for the motion vector search.
  4032. Default - search the whole frame.
  4033. @item rx
  4034. @item ry
  4035. Specify the maximum extent of movement in x and y directions in the
  4036. range 0-64 pixels. Default 16.
  4037. @item edge
  4038. Specify how to generate pixels to fill blanks at the edge of the
  4039. frame. Available values are:
  4040. @table @samp
  4041. @item blank, 0
  4042. Fill zeroes at blank locations
  4043. @item original, 1
  4044. Original image at blank locations
  4045. @item clamp, 2
  4046. Extruded edge value at blank locations
  4047. @item mirror, 3
  4048. Mirrored edge at blank locations
  4049. @end table
  4050. Default value is @samp{mirror}.
  4051. @item blocksize
  4052. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4053. default 8.
  4054. @item contrast
  4055. Specify the contrast threshold for blocks. Only blocks with more than
  4056. the specified contrast (difference between darkest and lightest
  4057. pixels) will be considered. Range 1-255, default 125.
  4058. @item search
  4059. Specify the search strategy. Available values are:
  4060. @table @samp
  4061. @item exhaustive, 0
  4062. Set exhaustive search
  4063. @item less, 1
  4064. Set less exhaustive search.
  4065. @end table
  4066. Default value is @samp{exhaustive}.
  4067. @item filename
  4068. If set then a detailed log of the motion search is written to the
  4069. specified file.
  4070. @item opencl
  4071. If set to 1, specify using OpenCL capabilities, only available if
  4072. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4073. @end table
  4074. @section detelecine
  4075. Apply an exact inverse of the telecine operation. It requires a predefined
  4076. pattern specified using the pattern option which must be the same as that passed
  4077. to the telecine filter.
  4078. This filter accepts the following options:
  4079. @table @option
  4080. @item first_field
  4081. @table @samp
  4082. @item top, t
  4083. top field first
  4084. @item bottom, b
  4085. bottom field first
  4086. The default value is @code{top}.
  4087. @end table
  4088. @item pattern
  4089. A string of numbers representing the pulldown pattern you wish to apply.
  4090. The default value is @code{23}.
  4091. @item start_frame
  4092. A number representing position of the first frame with respect to the telecine
  4093. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4094. @end table
  4095. @section dilation
  4096. Apply dilation effect to the video.
  4097. This filter replaces the pixel by the local(3x3) maximum.
  4098. It accepts the following options:
  4099. @table @option
  4100. @item threshold0
  4101. @item threshold1
  4102. @item threshold2
  4103. @item threshold3
  4104. Limit the maximum change for each plane, default is 65535.
  4105. If 0, plane will remain unchanged.
  4106. @item coordinates
  4107. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4108. pixels are used.
  4109. Flags to local 3x3 coordinates maps like this:
  4110. 1 2 3
  4111. 4 5
  4112. 6 7 8
  4113. @end table
  4114. @section displace
  4115. Displace pixels as indicated by second and third input stream.
  4116. It takes three input streams and outputs one stream, the first input is the
  4117. source, and second and third input are displacement maps.
  4118. The second input specifies how much to displace pixels along the
  4119. x-axis, while the third input specifies how much to displace pixels
  4120. along the y-axis.
  4121. If one of displacement map streams terminates, last frame from that
  4122. displacement map will be used.
  4123. Note that once generated, displacements maps can be reused over and over again.
  4124. A description of the accepted options follows.
  4125. @table @option
  4126. @item edge
  4127. Set displace behavior for pixels that are out of range.
  4128. Available values are:
  4129. @table @samp
  4130. @item blank
  4131. Missing pixels are replaced by black pixels.
  4132. @item smear
  4133. Adjacent pixels will spread out to replace missing pixels.
  4134. @item wrap
  4135. Out of range pixels are wrapped so they point to pixels of other side.
  4136. @end table
  4137. Default is @samp{smear}.
  4138. @end table
  4139. @subsection Examples
  4140. @itemize
  4141. @item
  4142. Add ripple effect to rgb input of video size hd720:
  4143. @example
  4144. 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
  4145. @end example
  4146. @item
  4147. Add wave effect to rgb input of video size hd720:
  4148. @example
  4149. 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
  4150. @end example
  4151. @end itemize
  4152. @section drawbox
  4153. Draw a colored box on the input image.
  4154. It accepts the following parameters:
  4155. @table @option
  4156. @item x
  4157. @item y
  4158. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4159. @item width, w
  4160. @item height, h
  4161. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4162. the input width and height. It defaults to 0.
  4163. @item color, c
  4164. Specify the color of the box to write. For the general syntax of this option,
  4165. check the "Color" section in the ffmpeg-utils manual. If the special
  4166. value @code{invert} is used, the box edge color is the same as the
  4167. video with inverted luma.
  4168. @item thickness, t
  4169. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4170. See below for the list of accepted constants.
  4171. @end table
  4172. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4173. following constants:
  4174. @table @option
  4175. @item dar
  4176. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4177. @item hsub
  4178. @item vsub
  4179. horizontal and vertical chroma subsample values. For example for the
  4180. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4181. @item in_h, ih
  4182. @item in_w, iw
  4183. The input width and height.
  4184. @item sar
  4185. The input sample aspect ratio.
  4186. @item x
  4187. @item y
  4188. The x and y offset coordinates where the box is drawn.
  4189. @item w
  4190. @item h
  4191. The width and height of the drawn box.
  4192. @item t
  4193. The thickness of the drawn box.
  4194. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4195. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4196. @end table
  4197. @subsection Examples
  4198. @itemize
  4199. @item
  4200. Draw a black box around the edge of the input image:
  4201. @example
  4202. drawbox
  4203. @end example
  4204. @item
  4205. Draw a box with color red and an opacity of 50%:
  4206. @example
  4207. drawbox=10:20:200:60:red@@0.5
  4208. @end example
  4209. The previous example can be specified as:
  4210. @example
  4211. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  4212. @end example
  4213. @item
  4214. Fill the box with pink color:
  4215. @example
  4216. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  4217. @end example
  4218. @item
  4219. Draw a 2-pixel red 2.40:1 mask:
  4220. @example
  4221. 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
  4222. @end example
  4223. @end itemize
  4224. @section drawgraph, adrawgraph
  4225. Draw a graph using input video or audio metadata.
  4226. It accepts the following parameters:
  4227. @table @option
  4228. @item m1
  4229. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  4230. @item fg1
  4231. Set 1st foreground color expression.
  4232. @item m2
  4233. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  4234. @item fg2
  4235. Set 2nd foreground color expression.
  4236. @item m3
  4237. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  4238. @item fg3
  4239. Set 3rd foreground color expression.
  4240. @item m4
  4241. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  4242. @item fg4
  4243. Set 4th foreground color expression.
  4244. @item min
  4245. Set minimal value of metadata value.
  4246. @item max
  4247. Set maximal value of metadata value.
  4248. @item bg
  4249. Set graph background color. Default is white.
  4250. @item mode
  4251. Set graph mode.
  4252. Available values for mode is:
  4253. @table @samp
  4254. @item bar
  4255. @item dot
  4256. @item line
  4257. @end table
  4258. Default is @code{line}.
  4259. @item slide
  4260. Set slide mode.
  4261. Available values for slide is:
  4262. @table @samp
  4263. @item frame
  4264. Draw new frame when right border is reached.
  4265. @item replace
  4266. Replace old columns with new ones.
  4267. @item scroll
  4268. Scroll from right to left.
  4269. @item rscroll
  4270. Scroll from left to right.
  4271. @end table
  4272. Default is @code{frame}.
  4273. @item size
  4274. Set size of graph video. For the syntax of this option, check the
  4275. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  4276. The default value is @code{900x256}.
  4277. The foreground color expressions can use the following variables:
  4278. @table @option
  4279. @item MIN
  4280. Minimal value of metadata value.
  4281. @item MAX
  4282. Maximal value of metadata value.
  4283. @item VAL
  4284. Current metadata key value.
  4285. @end table
  4286. The color is defined as 0xAABBGGRR.
  4287. @end table
  4288. Example using metadata from @ref{signalstats} filter:
  4289. @example
  4290. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  4291. @end example
  4292. Example using metadata from @ref{ebur128} filter:
  4293. @example
  4294. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  4295. @end example
  4296. @section drawgrid
  4297. Draw a grid on the input image.
  4298. It accepts the following parameters:
  4299. @table @option
  4300. @item x
  4301. @item y
  4302. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  4303. @item width, w
  4304. @item height, h
  4305. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  4306. input width and height, respectively, minus @code{thickness}, so image gets
  4307. framed. Default to 0.
  4308. @item color, c
  4309. Specify the color of the grid. For the general syntax of this option,
  4310. check the "Color" section in the ffmpeg-utils manual. If the special
  4311. value @code{invert} is used, the grid color is the same as the
  4312. video with inverted luma.
  4313. @item thickness, t
  4314. The expression which sets the thickness of the grid line. Default value is @code{1}.
  4315. See below for the list of accepted constants.
  4316. @end table
  4317. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4318. following constants:
  4319. @table @option
  4320. @item dar
  4321. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4322. @item hsub
  4323. @item vsub
  4324. horizontal and vertical chroma subsample values. For example for the
  4325. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4326. @item in_h, ih
  4327. @item in_w, iw
  4328. The input grid cell width and height.
  4329. @item sar
  4330. The input sample aspect ratio.
  4331. @item x
  4332. @item y
  4333. The x and y coordinates of some point of grid intersection (meant to configure offset).
  4334. @item w
  4335. @item h
  4336. The width and height of the drawn cell.
  4337. @item t
  4338. The thickness of the drawn cell.
  4339. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4340. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4341. @end table
  4342. @subsection Examples
  4343. @itemize
  4344. @item
  4345. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  4346. @example
  4347. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  4348. @end example
  4349. @item
  4350. Draw a white 3x3 grid with an opacity of 50%:
  4351. @example
  4352. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  4353. @end example
  4354. @end itemize
  4355. @anchor{drawtext}
  4356. @section drawtext
  4357. Draw a text string or text from a specified file on top of a video, using the
  4358. libfreetype library.
  4359. To enable compilation of this filter, you need to configure FFmpeg with
  4360. @code{--enable-libfreetype}.
  4361. To enable default font fallback and the @var{font} option you need to
  4362. configure FFmpeg with @code{--enable-libfontconfig}.
  4363. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  4364. @code{--enable-libfribidi}.
  4365. @subsection Syntax
  4366. It accepts the following parameters:
  4367. @table @option
  4368. @item box
  4369. Used to draw a box around text using the background color.
  4370. The value must be either 1 (enable) or 0 (disable).
  4371. The default value of @var{box} is 0.
  4372. @item boxborderw
  4373. Set the width of the border to be drawn around the box using @var{boxcolor}.
  4374. The default value of @var{boxborderw} is 0.
  4375. @item boxcolor
  4376. The color to be used for drawing box around text. For the syntax of this
  4377. option, check the "Color" section in the ffmpeg-utils manual.
  4378. The default value of @var{boxcolor} is "white".
  4379. @item borderw
  4380. Set the width of the border to be drawn around the text using @var{bordercolor}.
  4381. The default value of @var{borderw} is 0.
  4382. @item bordercolor
  4383. Set the color to be used for drawing border around text. For the syntax of this
  4384. option, check the "Color" section in the ffmpeg-utils manual.
  4385. The default value of @var{bordercolor} is "black".
  4386. @item expansion
  4387. Select how the @var{text} is expanded. Can be either @code{none},
  4388. @code{strftime} (deprecated) or
  4389. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  4390. below for details.
  4391. @item fix_bounds
  4392. If true, check and fix text coords to avoid clipping.
  4393. @item fontcolor
  4394. The color to be used for drawing fonts. For the syntax of this option, check
  4395. the "Color" section in the ffmpeg-utils manual.
  4396. The default value of @var{fontcolor} is "black".
  4397. @item fontcolor_expr
  4398. String which is expanded the same way as @var{text} to obtain dynamic
  4399. @var{fontcolor} value. By default this option has empty value and is not
  4400. processed. When this option is set, it overrides @var{fontcolor} option.
  4401. @item font
  4402. The font family to be used for drawing text. By default Sans.
  4403. @item fontfile
  4404. The font file to be used for drawing text. The path must be included.
  4405. This parameter is mandatory if the fontconfig support is disabled.
  4406. @item draw
  4407. This option does not exist, please see the timeline system
  4408. @item alpha
  4409. Draw the text applying alpha blending. The value can
  4410. be either a number between 0.0 and 1.0
  4411. The expression accepts the same variables @var{x, y} do.
  4412. The default value is 1.
  4413. Please see fontcolor_expr
  4414. @item fontsize
  4415. The font size to be used for drawing text.
  4416. The default value of @var{fontsize} is 16.
  4417. @item text_shaping
  4418. If set to 1, attempt to shape the text (for example, reverse the order of
  4419. right-to-left text and join Arabic characters) before drawing it.
  4420. Otherwise, just draw the text exactly as given.
  4421. By default 1 (if supported).
  4422. @item ft_load_flags
  4423. The flags to be used for loading the fonts.
  4424. The flags map the corresponding flags supported by libfreetype, and are
  4425. a combination of the following values:
  4426. @table @var
  4427. @item default
  4428. @item no_scale
  4429. @item no_hinting
  4430. @item render
  4431. @item no_bitmap
  4432. @item vertical_layout
  4433. @item force_autohint
  4434. @item crop_bitmap
  4435. @item pedantic
  4436. @item ignore_global_advance_width
  4437. @item no_recurse
  4438. @item ignore_transform
  4439. @item monochrome
  4440. @item linear_design
  4441. @item no_autohint
  4442. @end table
  4443. Default value is "default".
  4444. For more information consult the documentation for the FT_LOAD_*
  4445. libfreetype flags.
  4446. @item shadowcolor
  4447. The color to be used for drawing a shadow behind the drawn text. For the
  4448. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  4449. The default value of @var{shadowcolor} is "black".
  4450. @item shadowx
  4451. @item shadowy
  4452. The x and y offsets for the text shadow position with respect to the
  4453. position of the text. They can be either positive or negative
  4454. values. The default value for both is "0".
  4455. @item start_number
  4456. The starting frame number for the n/frame_num variable. The default value
  4457. is "0".
  4458. @item tabsize
  4459. The size in number of spaces to use for rendering the tab.
  4460. Default value is 4.
  4461. @item timecode
  4462. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  4463. format. It can be used with or without text parameter. @var{timecode_rate}
  4464. option must be specified.
  4465. @item timecode_rate, rate, r
  4466. Set the timecode frame rate (timecode only).
  4467. @item text
  4468. The text string to be drawn. The text must be a sequence of UTF-8
  4469. encoded characters.
  4470. This parameter is mandatory if no file is specified with the parameter
  4471. @var{textfile}.
  4472. @item textfile
  4473. A text file containing text to be drawn. The text must be a sequence
  4474. of UTF-8 encoded characters.
  4475. This parameter is mandatory if no text string is specified with the
  4476. parameter @var{text}.
  4477. If both @var{text} and @var{textfile} are specified, an error is thrown.
  4478. @item reload
  4479. If set to 1, the @var{textfile} will be reloaded before each frame.
  4480. Be sure to update it atomically, or it may be read partially, or even fail.
  4481. @item x
  4482. @item y
  4483. The expressions which specify the offsets where text will be drawn
  4484. within the video frame. They are relative to the top/left border of the
  4485. output image.
  4486. The default value of @var{x} and @var{y} is "0".
  4487. See below for the list of accepted constants and functions.
  4488. @end table
  4489. The parameters for @var{x} and @var{y} are expressions containing the
  4490. following constants and functions:
  4491. @table @option
  4492. @item dar
  4493. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  4494. @item hsub
  4495. @item vsub
  4496. horizontal and vertical chroma subsample values. For example for the
  4497. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4498. @item line_h, lh
  4499. the height of each text line
  4500. @item main_h, h, H
  4501. the input height
  4502. @item main_w, w, W
  4503. the input width
  4504. @item max_glyph_a, ascent
  4505. the maximum distance from the baseline to the highest/upper grid
  4506. coordinate used to place a glyph outline point, for all the rendered
  4507. glyphs.
  4508. It is a positive value, due to the grid's orientation with the Y axis
  4509. upwards.
  4510. @item max_glyph_d, descent
  4511. the maximum distance from the baseline to the lowest grid coordinate
  4512. used to place a glyph outline point, for all the rendered glyphs.
  4513. This is a negative value, due to the grid's orientation, with the Y axis
  4514. upwards.
  4515. @item max_glyph_h
  4516. maximum glyph height, that is the maximum height for all the glyphs
  4517. contained in the rendered text, it is equivalent to @var{ascent} -
  4518. @var{descent}.
  4519. @item max_glyph_w
  4520. maximum glyph width, that is the maximum width for all the glyphs
  4521. contained in the rendered text
  4522. @item n
  4523. the number of input frame, starting from 0
  4524. @item rand(min, max)
  4525. return a random number included between @var{min} and @var{max}
  4526. @item sar
  4527. The input sample aspect ratio.
  4528. @item t
  4529. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4530. @item text_h, th
  4531. the height of the rendered text
  4532. @item text_w, tw
  4533. the width of the rendered text
  4534. @item x
  4535. @item y
  4536. the x and y offset coordinates where the text is drawn.
  4537. These parameters allow the @var{x} and @var{y} expressions to refer
  4538. each other, so you can for example specify @code{y=x/dar}.
  4539. @end table
  4540. @anchor{drawtext_expansion}
  4541. @subsection Text expansion
  4542. If @option{expansion} is set to @code{strftime},
  4543. the filter recognizes strftime() sequences in the provided text and
  4544. expands them accordingly. Check the documentation of strftime(). This
  4545. feature is deprecated.
  4546. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  4547. If @option{expansion} is set to @code{normal} (which is the default),
  4548. the following expansion mechanism is used.
  4549. The backslash character @samp{\}, followed by any character, always expands to
  4550. the second character.
  4551. Sequence of the form @code{%@{...@}} are expanded. The text between the
  4552. braces is a function name, possibly followed by arguments separated by ':'.
  4553. If the arguments contain special characters or delimiters (':' or '@}'),
  4554. they should be escaped.
  4555. Note that they probably must also be escaped as the value for the
  4556. @option{text} option in the filter argument string and as the filter
  4557. argument in the filtergraph description, and possibly also for the shell,
  4558. that makes up to four levels of escaping; using a text file avoids these
  4559. problems.
  4560. The following functions are available:
  4561. @table @command
  4562. @item expr, e
  4563. The expression evaluation result.
  4564. It must take one argument specifying the expression to be evaluated,
  4565. which accepts the same constants and functions as the @var{x} and
  4566. @var{y} values. Note that not all constants should be used, for
  4567. example the text size is not known when evaluating the expression, so
  4568. the constants @var{text_w} and @var{text_h} will have an undefined
  4569. value.
  4570. @item expr_int_format, eif
  4571. Evaluate the expression's value and output as formatted integer.
  4572. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  4573. The second argument specifies the output format. Allowed values are @samp{x},
  4574. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  4575. @code{printf} function.
  4576. The third parameter is optional and sets the number of positions taken by the output.
  4577. It can be used to add padding with zeros from the left.
  4578. @item gmtime
  4579. The time at which the filter is running, expressed in UTC.
  4580. It can accept an argument: a strftime() format string.
  4581. @item localtime
  4582. The time at which the filter is running, expressed in the local time zone.
  4583. It can accept an argument: a strftime() format string.
  4584. @item metadata
  4585. Frame metadata. It must take one argument specifying metadata key.
  4586. @item n, frame_num
  4587. The frame number, starting from 0.
  4588. @item pict_type
  4589. A 1 character description of the current picture type.
  4590. @item pts
  4591. The timestamp of the current frame.
  4592. It can take up to three arguments.
  4593. The first argument is the format of the timestamp; it defaults to @code{flt}
  4594. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  4595. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  4596. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  4597. @code{localtime} stands for the timestamp of the frame formatted as
  4598. local time zone time.
  4599. The second argument is an offset added to the timestamp.
  4600. If the format is set to @code{localtime} or @code{gmtime},
  4601. a third argument may be supplied: a strftime() format string.
  4602. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  4603. @end table
  4604. @subsection Examples
  4605. @itemize
  4606. @item
  4607. Draw "Test Text" with font FreeSerif, using the default values for the
  4608. optional parameters.
  4609. @example
  4610. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  4611. @end example
  4612. @item
  4613. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  4614. and y=50 (counting from the top-left corner of the screen), text is
  4615. yellow with a red box around it. Both the text and the box have an
  4616. opacity of 20%.
  4617. @example
  4618. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  4619. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  4620. @end example
  4621. Note that the double quotes are not necessary if spaces are not used
  4622. within the parameter list.
  4623. @item
  4624. Show the text at the center of the video frame:
  4625. @example
  4626. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  4627. @end example
  4628. @item
  4629. Show a text line sliding from right to left in the last row of the video
  4630. frame. The file @file{LONG_LINE} is assumed to contain a single line
  4631. with no newlines.
  4632. @example
  4633. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  4634. @end example
  4635. @item
  4636. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  4637. @example
  4638. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  4639. @end example
  4640. @item
  4641. Draw a single green letter "g", at the center of the input video.
  4642. The glyph baseline is placed at half screen height.
  4643. @example
  4644. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  4645. @end example
  4646. @item
  4647. Show text for 1 second every 3 seconds:
  4648. @example
  4649. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  4650. @end example
  4651. @item
  4652. Use fontconfig to set the font. Note that the colons need to be escaped.
  4653. @example
  4654. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  4655. @end example
  4656. @item
  4657. Print the date of a real-time encoding (see strftime(3)):
  4658. @example
  4659. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  4660. @end example
  4661. @item
  4662. Show text fading in and out (appearing/disappearing):
  4663. @example
  4664. #!/bin/sh
  4665. DS=1.0 # display start
  4666. DE=10.0 # display end
  4667. FID=1.5 # fade in duration
  4668. FOD=5 # fade out duration
  4669. 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 @}"
  4670. @end example
  4671. @end itemize
  4672. For more information about libfreetype, check:
  4673. @url{http://www.freetype.org/}.
  4674. For more information about fontconfig, check:
  4675. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  4676. For more information about libfribidi, check:
  4677. @url{http://fribidi.org/}.
  4678. @section edgedetect
  4679. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  4680. The filter accepts the following options:
  4681. @table @option
  4682. @item low
  4683. @item high
  4684. Set low and high threshold values used by the Canny thresholding
  4685. algorithm.
  4686. The high threshold selects the "strong" edge pixels, which are then
  4687. connected through 8-connectivity with the "weak" edge pixels selected
  4688. by the low threshold.
  4689. @var{low} and @var{high} threshold values must be chosen in the range
  4690. [0,1], and @var{low} should be lesser or equal to @var{high}.
  4691. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  4692. is @code{50/255}.
  4693. @item mode
  4694. Define the drawing mode.
  4695. @table @samp
  4696. @item wires
  4697. Draw white/gray wires on black background.
  4698. @item colormix
  4699. Mix the colors to create a paint/cartoon effect.
  4700. @end table
  4701. Default value is @var{wires}.
  4702. @end table
  4703. @subsection Examples
  4704. @itemize
  4705. @item
  4706. Standard edge detection with custom values for the hysteresis thresholding:
  4707. @example
  4708. edgedetect=low=0.1:high=0.4
  4709. @end example
  4710. @item
  4711. Painting effect without thresholding:
  4712. @example
  4713. edgedetect=mode=colormix:high=0
  4714. @end example
  4715. @end itemize
  4716. @section eq
  4717. Set brightness, contrast, saturation and approximate gamma adjustment.
  4718. The filter accepts the following options:
  4719. @table @option
  4720. @item contrast
  4721. Set the contrast expression. The value must be a float value in range
  4722. @code{-2.0} to @code{2.0}. The default value is "1".
  4723. @item brightness
  4724. Set the brightness expression. The value must be a float value in
  4725. range @code{-1.0} to @code{1.0}. The default value is "0".
  4726. @item saturation
  4727. Set the saturation expression. The value must be a float in
  4728. range @code{0.0} to @code{3.0}. The default value is "1".
  4729. @item gamma
  4730. Set the gamma expression. The value must be a float in range
  4731. @code{0.1} to @code{10.0}. The default value is "1".
  4732. @item gamma_r
  4733. Set the gamma expression for red. The value must be a float in
  4734. range @code{0.1} to @code{10.0}. The default value is "1".
  4735. @item gamma_g
  4736. Set the gamma expression for green. The value must be a float in range
  4737. @code{0.1} to @code{10.0}. The default value is "1".
  4738. @item gamma_b
  4739. Set the gamma expression for blue. The value must be a float in range
  4740. @code{0.1} to @code{10.0}. The default value is "1".
  4741. @item gamma_weight
  4742. Set the gamma weight expression. It can be used to reduce the effect
  4743. of a high gamma value on bright image areas, e.g. keep them from
  4744. getting overamplified and just plain white. The value must be a float
  4745. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  4746. gamma correction all the way down while @code{1.0} leaves it at its
  4747. full strength. Default is "1".
  4748. @item eval
  4749. Set when the expressions for brightness, contrast, saturation and
  4750. gamma expressions are evaluated.
  4751. It accepts the following values:
  4752. @table @samp
  4753. @item init
  4754. only evaluate expressions once during the filter initialization or
  4755. when a command is processed
  4756. @item frame
  4757. evaluate expressions for each incoming frame
  4758. @end table
  4759. Default value is @samp{init}.
  4760. @end table
  4761. The expressions accept the following parameters:
  4762. @table @option
  4763. @item n
  4764. frame count of the input frame starting from 0
  4765. @item pos
  4766. byte position of the corresponding packet in the input file, NAN if
  4767. unspecified
  4768. @item r
  4769. frame rate of the input video, NAN if the input frame rate is unknown
  4770. @item t
  4771. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4772. @end table
  4773. @subsection Commands
  4774. The filter supports the following commands:
  4775. @table @option
  4776. @item contrast
  4777. Set the contrast expression.
  4778. @item brightness
  4779. Set the brightness expression.
  4780. @item saturation
  4781. Set the saturation expression.
  4782. @item gamma
  4783. Set the gamma expression.
  4784. @item gamma_r
  4785. Set the gamma_r expression.
  4786. @item gamma_g
  4787. Set gamma_g expression.
  4788. @item gamma_b
  4789. Set gamma_b expression.
  4790. @item gamma_weight
  4791. Set gamma_weight expression.
  4792. The command accepts the same syntax of the corresponding option.
  4793. If the specified expression is not valid, it is kept at its current
  4794. value.
  4795. @end table
  4796. @section erosion
  4797. Apply erosion effect to the video.
  4798. This filter replaces the pixel by the local(3x3) minimum.
  4799. It accepts the following options:
  4800. @table @option
  4801. @item threshold0
  4802. @item threshold1
  4803. @item threshold2
  4804. @item threshold3
  4805. Limit the maximum change for each plane, default is 65535.
  4806. If 0, plane will remain unchanged.
  4807. @item coordinates
  4808. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4809. pixels are used.
  4810. Flags to local 3x3 coordinates maps like this:
  4811. 1 2 3
  4812. 4 5
  4813. 6 7 8
  4814. @end table
  4815. @section extractplanes
  4816. Extract color channel components from input video stream into
  4817. separate grayscale video streams.
  4818. The filter accepts the following option:
  4819. @table @option
  4820. @item planes
  4821. Set plane(s) to extract.
  4822. Available values for planes are:
  4823. @table @samp
  4824. @item y
  4825. @item u
  4826. @item v
  4827. @item a
  4828. @item r
  4829. @item g
  4830. @item b
  4831. @end table
  4832. Choosing planes not available in the input will result in an error.
  4833. That means you cannot select @code{r}, @code{g}, @code{b} planes
  4834. with @code{y}, @code{u}, @code{v} planes at same time.
  4835. @end table
  4836. @subsection Examples
  4837. @itemize
  4838. @item
  4839. Extract luma, u and v color channel component from input video frame
  4840. into 3 grayscale outputs:
  4841. @example
  4842. 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
  4843. @end example
  4844. @end itemize
  4845. @section elbg
  4846. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  4847. For each input image, the filter will compute the optimal mapping from
  4848. the input to the output given the codebook length, that is the number
  4849. of distinct output colors.
  4850. This filter accepts the following options.
  4851. @table @option
  4852. @item codebook_length, l
  4853. Set codebook length. The value must be a positive integer, and
  4854. represents the number of distinct output colors. Default value is 256.
  4855. @item nb_steps, n
  4856. Set the maximum number of iterations to apply for computing the optimal
  4857. mapping. The higher the value the better the result and the higher the
  4858. computation time. Default value is 1.
  4859. @item seed, s
  4860. Set a random seed, must be an integer included between 0 and
  4861. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  4862. will try to use a good random seed on a best effort basis.
  4863. @item pal8
  4864. Set pal8 output pixel format. This option does not work with codebook
  4865. length greater than 256.
  4866. @end table
  4867. @section fade
  4868. Apply a fade-in/out effect to the input video.
  4869. It accepts the following parameters:
  4870. @table @option
  4871. @item type, t
  4872. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  4873. effect.
  4874. Default is @code{in}.
  4875. @item start_frame, s
  4876. Specify the number of the frame to start applying the fade
  4877. effect at. Default is 0.
  4878. @item nb_frames, n
  4879. The number of frames that the fade effect lasts. At the end of the
  4880. fade-in effect, the output video will have the same intensity as the input video.
  4881. At the end of the fade-out transition, the output video will be filled with the
  4882. selected @option{color}.
  4883. Default is 25.
  4884. @item alpha
  4885. If set to 1, fade only alpha channel, if one exists on the input.
  4886. Default value is 0.
  4887. @item start_time, st
  4888. Specify the timestamp (in seconds) of the frame to start to apply the fade
  4889. effect. If both start_frame and start_time are specified, the fade will start at
  4890. whichever comes last. Default is 0.
  4891. @item duration, d
  4892. The number of seconds for which the fade effect has to last. At the end of the
  4893. fade-in effect the output video will have the same intensity as the input video,
  4894. at the end of the fade-out transition the output video will be filled with the
  4895. selected @option{color}.
  4896. If both duration and nb_frames are specified, duration is used. Default is 0
  4897. (nb_frames is used by default).
  4898. @item color, c
  4899. Specify the color of the fade. Default is "black".
  4900. @end table
  4901. @subsection Examples
  4902. @itemize
  4903. @item
  4904. Fade in the first 30 frames of video:
  4905. @example
  4906. fade=in:0:30
  4907. @end example
  4908. The command above is equivalent to:
  4909. @example
  4910. fade=t=in:s=0:n=30
  4911. @end example
  4912. @item
  4913. Fade out the last 45 frames of a 200-frame video:
  4914. @example
  4915. fade=out:155:45
  4916. fade=type=out:start_frame=155:nb_frames=45
  4917. @end example
  4918. @item
  4919. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  4920. @example
  4921. fade=in:0:25, fade=out:975:25
  4922. @end example
  4923. @item
  4924. Make the first 5 frames yellow, then fade in from frame 5-24:
  4925. @example
  4926. fade=in:5:20:color=yellow
  4927. @end example
  4928. @item
  4929. Fade in alpha over first 25 frames of video:
  4930. @example
  4931. fade=in:0:25:alpha=1
  4932. @end example
  4933. @item
  4934. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  4935. @example
  4936. fade=t=in:st=5.5:d=0.5
  4937. @end example
  4938. @end itemize
  4939. @section fftfilt
  4940. Apply arbitrary expressions to samples in frequency domain
  4941. @table @option
  4942. @item dc_Y
  4943. Adjust the dc value (gain) of the luma plane of the image. The filter
  4944. accepts an integer value in range @code{0} to @code{1000}. The default
  4945. value is set to @code{0}.
  4946. @item dc_U
  4947. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  4948. filter accepts an integer value in range @code{0} to @code{1000}. The
  4949. default value is set to @code{0}.
  4950. @item dc_V
  4951. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  4952. filter accepts an integer value in range @code{0} to @code{1000}. The
  4953. default value is set to @code{0}.
  4954. @item weight_Y
  4955. Set the frequency domain weight expression for the luma plane.
  4956. @item weight_U
  4957. Set the frequency domain weight expression for the 1st chroma plane.
  4958. @item weight_V
  4959. Set the frequency domain weight expression for the 2nd chroma plane.
  4960. The filter accepts the following variables:
  4961. @item X
  4962. @item Y
  4963. The coordinates of the current sample.
  4964. @item W
  4965. @item H
  4966. The width and height of the image.
  4967. @end table
  4968. @subsection Examples
  4969. @itemize
  4970. @item
  4971. High-pass:
  4972. @example
  4973. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  4974. @end example
  4975. @item
  4976. Low-pass:
  4977. @example
  4978. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  4979. @end example
  4980. @item
  4981. Sharpen:
  4982. @example
  4983. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  4984. @end example
  4985. @end itemize
  4986. @section field
  4987. Extract a single field from an interlaced image using stride
  4988. arithmetic to avoid wasting CPU time. The output frames are marked as
  4989. non-interlaced.
  4990. The filter accepts the following options:
  4991. @table @option
  4992. @item type
  4993. Specify whether to extract the top (if the value is @code{0} or
  4994. @code{top}) or the bottom field (if the value is @code{1} or
  4995. @code{bottom}).
  4996. @end table
  4997. @section fieldmatch
  4998. Field matching filter for inverse telecine. It is meant to reconstruct the
  4999. progressive frames from a telecined stream. The filter does not drop duplicated
  5000. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5001. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5002. The separation of the field matching and the decimation is notably motivated by
  5003. the possibility of inserting a de-interlacing filter fallback between the two.
  5004. If the source has mixed telecined and real interlaced content,
  5005. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5006. But these remaining combed frames will be marked as interlaced, and thus can be
  5007. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5008. In addition to the various configuration options, @code{fieldmatch} can take an
  5009. optional second stream, activated through the @option{ppsrc} option. If
  5010. enabled, the frames reconstruction will be based on the fields and frames from
  5011. this second stream. This allows the first input to be pre-processed in order to
  5012. help the various algorithms of the filter, while keeping the output lossless
  5013. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5014. or brightness/contrast adjustments can help.
  5015. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5016. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5017. which @code{fieldmatch} is based on. While the semantic and usage are very
  5018. close, some behaviour and options names can differ.
  5019. The @ref{decimate} filter currently only works for constant frame rate input.
  5020. If your input has mixed telecined (30fps) and progressive content with a lower
  5021. framerate like 24fps use the following filterchain to produce the necessary cfr
  5022. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5023. The filter accepts the following options:
  5024. @table @option
  5025. @item order
  5026. Specify the assumed field order of the input stream. Available values are:
  5027. @table @samp
  5028. @item auto
  5029. Auto detect parity (use FFmpeg's internal parity value).
  5030. @item bff
  5031. Assume bottom field first.
  5032. @item tff
  5033. Assume top field first.
  5034. @end table
  5035. Note that it is sometimes recommended not to trust the parity announced by the
  5036. stream.
  5037. Default value is @var{auto}.
  5038. @item mode
  5039. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5040. sense that it won't risk creating jerkiness due to duplicate frames when
  5041. possible, but if there are bad edits or blended fields it will end up
  5042. outputting combed frames when a good match might actually exist. On the other
  5043. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5044. but will almost always find a good frame if there is one. The other values are
  5045. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5046. jerkiness and creating duplicate frames versus finding good matches in sections
  5047. with bad edits, orphaned fields, blended fields, etc.
  5048. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5049. Available values are:
  5050. @table @samp
  5051. @item pc
  5052. 2-way matching (p/c)
  5053. @item pc_n
  5054. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5055. @item pc_u
  5056. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5057. @item pc_n_ub
  5058. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5059. still combed (p/c + n + u/b)
  5060. @item pcn
  5061. 3-way matching (p/c/n)
  5062. @item pcn_ub
  5063. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5064. detected as combed (p/c/n + u/b)
  5065. @end table
  5066. The parenthesis at the end indicate the matches that would be used for that
  5067. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5068. @var{top}).
  5069. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5070. the slowest.
  5071. Default value is @var{pc_n}.
  5072. @item ppsrc
  5073. Mark the main input stream as a pre-processed input, and enable the secondary
  5074. input stream as the clean source to pick the fields from. See the filter
  5075. introduction for more details. It is similar to the @option{clip2} feature from
  5076. VFM/TFM.
  5077. Default value is @code{0} (disabled).
  5078. @item field
  5079. Set the field to match from. It is recommended to set this to the same value as
  5080. @option{order} unless you experience matching failures with that setting. In
  5081. certain circumstances changing the field that is used to match from can have a
  5082. large impact on matching performance. Available values are:
  5083. @table @samp
  5084. @item auto
  5085. Automatic (same value as @option{order}).
  5086. @item bottom
  5087. Match from the bottom field.
  5088. @item top
  5089. Match from the top field.
  5090. @end table
  5091. Default value is @var{auto}.
  5092. @item mchroma
  5093. Set whether or not chroma is included during the match comparisons. In most
  5094. cases it is recommended to leave this enabled. You should set this to @code{0}
  5095. only if your clip has bad chroma problems such as heavy rainbowing or other
  5096. artifacts. Setting this to @code{0} could also be used to speed things up at
  5097. the cost of some accuracy.
  5098. Default value is @code{1}.
  5099. @item y0
  5100. @item y1
  5101. These define an exclusion band which excludes the lines between @option{y0} and
  5102. @option{y1} from being included in the field matching decision. An exclusion
  5103. band can be used to ignore subtitles, a logo, or other things that may
  5104. interfere with the matching. @option{y0} sets the starting scan line and
  5105. @option{y1} sets the ending line; all lines in between @option{y0} and
  5106. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5107. @option{y0} and @option{y1} to the same value will disable the feature.
  5108. @option{y0} and @option{y1} defaults to @code{0}.
  5109. @item scthresh
  5110. Set the scene change detection threshold as a percentage of maximum change on
  5111. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5112. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5113. @option{scthresh} is @code{[0.0, 100.0]}.
  5114. Default value is @code{12.0}.
  5115. @item combmatch
  5116. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5117. account the combed scores of matches when deciding what match to use as the
  5118. final match. Available values are:
  5119. @table @samp
  5120. @item none
  5121. No final matching based on combed scores.
  5122. @item sc
  5123. Combed scores are only used when a scene change is detected.
  5124. @item full
  5125. Use combed scores all the time.
  5126. @end table
  5127. Default is @var{sc}.
  5128. @item combdbg
  5129. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5130. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5131. Available values are:
  5132. @table @samp
  5133. @item none
  5134. No forced calculation.
  5135. @item pcn
  5136. Force p/c/n calculations.
  5137. @item pcnub
  5138. Force p/c/n/u/b calculations.
  5139. @end table
  5140. Default value is @var{none}.
  5141. @item cthresh
  5142. This is the area combing threshold used for combed frame detection. This
  5143. essentially controls how "strong" or "visible" combing must be to be detected.
  5144. Larger values mean combing must be more visible and smaller values mean combing
  5145. can be less visible or strong and still be detected. Valid settings are from
  5146. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5147. be detected as combed). This is basically a pixel difference value. A good
  5148. range is @code{[8, 12]}.
  5149. Default value is @code{9}.
  5150. @item chroma
  5151. Sets whether or not chroma is considered in the combed frame decision. Only
  5152. disable this if your source has chroma problems (rainbowing, etc.) that are
  5153. causing problems for the combed frame detection with chroma enabled. Actually,
  5154. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5155. where there is chroma only combing in the source.
  5156. Default value is @code{0}.
  5157. @item blockx
  5158. @item blocky
  5159. Respectively set the x-axis and y-axis size of the window used during combed
  5160. frame detection. This has to do with the size of the area in which
  5161. @option{combpel} pixels are required to be detected as combed for a frame to be
  5162. declared combed. See the @option{combpel} parameter description for more info.
  5163. Possible values are any number that is a power of 2 starting at 4 and going up
  5164. to 512.
  5165. Default value is @code{16}.
  5166. @item combpel
  5167. The number of combed pixels inside any of the @option{blocky} by
  5168. @option{blockx} size blocks on the frame for the frame to be detected as
  5169. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5170. setting controls "how much" combing there must be in any localized area (a
  5171. window defined by the @option{blockx} and @option{blocky} settings) on the
  5172. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5173. which point no frames will ever be detected as combed). This setting is known
  5174. as @option{MI} in TFM/VFM vocabulary.
  5175. Default value is @code{80}.
  5176. @end table
  5177. @anchor{p/c/n/u/b meaning}
  5178. @subsection p/c/n/u/b meaning
  5179. @subsubsection p/c/n
  5180. We assume the following telecined stream:
  5181. @example
  5182. Top fields: 1 2 2 3 4
  5183. Bottom fields: 1 2 3 4 4
  5184. @end example
  5185. The numbers correspond to the progressive frame the fields relate to. Here, the
  5186. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5187. When @code{fieldmatch} is configured to run a matching from bottom
  5188. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5189. @example
  5190. Input stream:
  5191. T 1 2 2 3 4
  5192. B 1 2 3 4 4 <-- matching reference
  5193. Matches: c c n n c
  5194. Output stream:
  5195. T 1 2 3 4 4
  5196. B 1 2 3 4 4
  5197. @end example
  5198. As a result of the field matching, we can see that some frames get duplicated.
  5199. To perform a complete inverse telecine, you need to rely on a decimation filter
  5200. after this operation. See for instance the @ref{decimate} filter.
  5201. The same operation now matching from top fields (@option{field}=@var{top})
  5202. looks like this:
  5203. @example
  5204. Input stream:
  5205. T 1 2 2 3 4 <-- matching reference
  5206. B 1 2 3 4 4
  5207. Matches: c c p p c
  5208. Output stream:
  5209. T 1 2 2 3 4
  5210. B 1 2 2 3 4
  5211. @end example
  5212. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5213. basically, they refer to the frame and field of the opposite parity:
  5214. @itemize
  5215. @item @var{p} matches the field of the opposite parity in the previous frame
  5216. @item @var{c} matches the field of the opposite parity in the current frame
  5217. @item @var{n} matches the field of the opposite parity in the next frame
  5218. @end itemize
  5219. @subsubsection u/b
  5220. The @var{u} and @var{b} matching are a bit special in the sense that they match
  5221. from the opposite parity flag. In the following examples, we assume that we are
  5222. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  5223. 'x' is placed above and below each matched fields.
  5224. With bottom matching (@option{field}=@var{bottom}):
  5225. @example
  5226. Match: c p n b u
  5227. x x x x x
  5228. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5229. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5230. x x x x x
  5231. Output frames:
  5232. 2 1 2 2 2
  5233. 2 2 2 1 3
  5234. @end example
  5235. With top matching (@option{field}=@var{top}):
  5236. @example
  5237. Match: c p n b u
  5238. x x x x x
  5239. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5240. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5241. x x x x x
  5242. Output frames:
  5243. 2 2 2 1 2
  5244. 2 1 3 2 2
  5245. @end example
  5246. @subsection Examples
  5247. Simple IVTC of a top field first telecined stream:
  5248. @example
  5249. fieldmatch=order=tff:combmatch=none, decimate
  5250. @end example
  5251. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  5252. @example
  5253. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  5254. @end example
  5255. @section fieldorder
  5256. Transform the field order of the input video.
  5257. It accepts the following parameters:
  5258. @table @option
  5259. @item order
  5260. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  5261. for bottom field first.
  5262. @end table
  5263. The default value is @samp{tff}.
  5264. The transformation is done by shifting the picture content up or down
  5265. by one line, and filling the remaining line with appropriate picture content.
  5266. This method is consistent with most broadcast field order converters.
  5267. If the input video is not flagged as being interlaced, or it is already
  5268. flagged as being of the required output field order, then this filter does
  5269. not alter the incoming video.
  5270. It is very useful when converting to or from PAL DV material,
  5271. which is bottom field first.
  5272. For example:
  5273. @example
  5274. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  5275. @end example
  5276. @section fifo, afifo
  5277. Buffer input images and send them when they are requested.
  5278. It is mainly useful when auto-inserted by the libavfilter
  5279. framework.
  5280. It does not take parameters.
  5281. @section find_rect
  5282. Find a rectangular object
  5283. It accepts the following options:
  5284. @table @option
  5285. @item object
  5286. Filepath of the object image, needs to be in gray8.
  5287. @item threshold
  5288. Detection threshold, default is 0.5.
  5289. @item mipmaps
  5290. Number of mipmaps, default is 3.
  5291. @item xmin, ymin, xmax, ymax
  5292. Specifies the rectangle in which to search.
  5293. @end table
  5294. @subsection Examples
  5295. @itemize
  5296. @item
  5297. Generate a representative palette of a given video using @command{ffmpeg}:
  5298. @example
  5299. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5300. @end example
  5301. @end itemize
  5302. @section cover_rect
  5303. Cover a rectangular object
  5304. It accepts the following options:
  5305. @table @option
  5306. @item cover
  5307. Filepath of the optional cover image, needs to be in yuv420.
  5308. @item mode
  5309. Set covering mode.
  5310. It accepts the following values:
  5311. @table @samp
  5312. @item cover
  5313. cover it by the supplied image
  5314. @item blur
  5315. cover it by interpolating the surrounding pixels
  5316. @end table
  5317. Default value is @var{blur}.
  5318. @end table
  5319. @subsection Examples
  5320. @itemize
  5321. @item
  5322. Generate a representative palette of a given video using @command{ffmpeg}:
  5323. @example
  5324. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5325. @end example
  5326. @end itemize
  5327. @anchor{format}
  5328. @section format
  5329. Convert the input video to one of the specified pixel formats.
  5330. Libavfilter will try to pick one that is suitable as input to
  5331. the next filter.
  5332. It accepts the following parameters:
  5333. @table @option
  5334. @item pix_fmts
  5335. A '|'-separated list of pixel format names, such as
  5336. "pix_fmts=yuv420p|monow|rgb24".
  5337. @end table
  5338. @subsection Examples
  5339. @itemize
  5340. @item
  5341. Convert the input video to the @var{yuv420p} format
  5342. @example
  5343. format=pix_fmts=yuv420p
  5344. @end example
  5345. Convert the input video to any of the formats in the list
  5346. @example
  5347. format=pix_fmts=yuv420p|yuv444p|yuv410p
  5348. @end example
  5349. @end itemize
  5350. @anchor{fps}
  5351. @section fps
  5352. Convert the video to specified constant frame rate by duplicating or dropping
  5353. frames as necessary.
  5354. It accepts the following parameters:
  5355. @table @option
  5356. @item fps
  5357. The desired output frame rate. The default is @code{25}.
  5358. @item round
  5359. Rounding method.
  5360. Possible values are:
  5361. @table @option
  5362. @item zero
  5363. zero round towards 0
  5364. @item inf
  5365. round away from 0
  5366. @item down
  5367. round towards -infinity
  5368. @item up
  5369. round towards +infinity
  5370. @item near
  5371. round to nearest
  5372. @end table
  5373. The default is @code{near}.
  5374. @item start_time
  5375. Assume the first PTS should be the given value, in seconds. This allows for
  5376. padding/trimming at the start of stream. By default, no assumption is made
  5377. about the first frame's expected PTS, so no padding or trimming is done.
  5378. For example, this could be set to 0 to pad the beginning with duplicates of
  5379. the first frame if a video stream starts after the audio stream or to trim any
  5380. frames with a negative PTS.
  5381. @end table
  5382. Alternatively, the options can be specified as a flat string:
  5383. @var{fps}[:@var{round}].
  5384. See also the @ref{setpts} filter.
  5385. @subsection Examples
  5386. @itemize
  5387. @item
  5388. A typical usage in order to set the fps to 25:
  5389. @example
  5390. fps=fps=25
  5391. @end example
  5392. @item
  5393. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  5394. @example
  5395. fps=fps=film:round=near
  5396. @end example
  5397. @end itemize
  5398. @section framepack
  5399. Pack two different video streams into a stereoscopic video, setting proper
  5400. metadata on supported codecs. The two views should have the same size and
  5401. framerate and processing will stop when the shorter video ends. Please note
  5402. that you may conveniently adjust view properties with the @ref{scale} and
  5403. @ref{fps} filters.
  5404. It accepts the following parameters:
  5405. @table @option
  5406. @item format
  5407. The desired packing format. Supported values are:
  5408. @table @option
  5409. @item sbs
  5410. The views are next to each other (default).
  5411. @item tab
  5412. The views are on top of each other.
  5413. @item lines
  5414. The views are packed by line.
  5415. @item columns
  5416. The views are packed by column.
  5417. @item frameseq
  5418. The views are temporally interleaved.
  5419. @end table
  5420. @end table
  5421. Some examples:
  5422. @example
  5423. # Convert left and right views into a frame-sequential video
  5424. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  5425. # Convert views into a side-by-side video with the same output resolution as the input
  5426. 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
  5427. @end example
  5428. @section framerate
  5429. Change the frame rate by interpolating new video output frames from the source
  5430. frames.
  5431. This filter is not designed to function correctly with interlaced media. If
  5432. you wish to change the frame rate of interlaced media then you are required
  5433. to deinterlace before this filter and re-interlace after this filter.
  5434. A description of the accepted options follows.
  5435. @table @option
  5436. @item fps
  5437. Specify the output frames per second. This option can also be specified
  5438. as a value alone. The default is @code{50}.
  5439. @item interp_start
  5440. Specify the start of a range where the output frame will be created as a
  5441. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5442. the default is @code{15}.
  5443. @item interp_end
  5444. Specify the end of a range where the output frame will be created as a
  5445. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5446. the default is @code{240}.
  5447. @item scene
  5448. Specify the level at which a scene change is detected as a value between
  5449. 0 and 100 to indicate a new scene; a low value reflects a low
  5450. probability for the current frame to introduce a new scene, while a higher
  5451. value means the current frame is more likely to be one.
  5452. The default is @code{7}.
  5453. @item flags
  5454. Specify flags influencing the filter process.
  5455. Available value for @var{flags} is:
  5456. @table @option
  5457. @item scene_change_detect, scd
  5458. Enable scene change detection using the value of the option @var{scene}.
  5459. This flag is enabled by default.
  5460. @end table
  5461. @end table
  5462. @section framestep
  5463. Select one frame every N-th frame.
  5464. This filter accepts the following option:
  5465. @table @option
  5466. @item step
  5467. Select frame after every @code{step} frames.
  5468. Allowed values are positive integers higher than 0. Default value is @code{1}.
  5469. @end table
  5470. @anchor{frei0r}
  5471. @section frei0r
  5472. Apply a frei0r effect to the input video.
  5473. To enable the compilation of this filter, you need to install the frei0r
  5474. header and configure FFmpeg with @code{--enable-frei0r}.
  5475. It accepts the following parameters:
  5476. @table @option
  5477. @item filter_name
  5478. The name of the frei0r effect to load. If the environment variable
  5479. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  5480. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  5481. Otherwise, the standard frei0r paths are searched, in this order:
  5482. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  5483. @file{/usr/lib/frei0r-1/}.
  5484. @item filter_params
  5485. A '|'-separated list of parameters to pass to the frei0r effect.
  5486. @end table
  5487. A frei0r effect parameter can be a boolean (its value is either
  5488. "y" or "n"), a double, a color (specified as
  5489. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  5490. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  5491. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  5492. @var{X} and @var{Y} are floating point numbers) and/or a string.
  5493. The number and types of parameters depend on the loaded effect. If an
  5494. effect parameter is not specified, the default value is set.
  5495. @subsection Examples
  5496. @itemize
  5497. @item
  5498. Apply the distort0r effect, setting the first two double parameters:
  5499. @example
  5500. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  5501. @end example
  5502. @item
  5503. Apply the colordistance effect, taking a color as the first parameter:
  5504. @example
  5505. frei0r=colordistance:0.2/0.3/0.4
  5506. frei0r=colordistance:violet
  5507. frei0r=colordistance:0x112233
  5508. @end example
  5509. @item
  5510. Apply the perspective effect, specifying the top left and top right image
  5511. positions:
  5512. @example
  5513. frei0r=perspective:0.2/0.2|0.8/0.2
  5514. @end example
  5515. @end itemize
  5516. For more information, see
  5517. @url{http://frei0r.dyne.org}
  5518. @section fspp
  5519. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  5520. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  5521. processing filter, one of them is performed once per block, not per pixel.
  5522. This allows for much higher speed.
  5523. The filter accepts the following options:
  5524. @table @option
  5525. @item quality
  5526. Set quality. This option defines the number of levels for averaging. It accepts
  5527. an integer in the range 4-5. Default value is @code{4}.
  5528. @item qp
  5529. Force a constant quantization parameter. It accepts an integer in range 0-63.
  5530. If not set, the filter will use the QP from the video stream (if available).
  5531. @item strength
  5532. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  5533. more details but also more artifacts, while higher values make the image smoother
  5534. but also blurrier. Default value is @code{0} − PSNR optimal.
  5535. @item use_bframe_qp
  5536. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5537. option may cause flicker since the B-Frames have often larger QP. Default is
  5538. @code{0} (not enabled).
  5539. @end table
  5540. @section geq
  5541. The filter accepts the following options:
  5542. @table @option
  5543. @item lum_expr, lum
  5544. Set the luminance expression.
  5545. @item cb_expr, cb
  5546. Set the chrominance blue expression.
  5547. @item cr_expr, cr
  5548. Set the chrominance red expression.
  5549. @item alpha_expr, a
  5550. Set the alpha expression.
  5551. @item red_expr, r
  5552. Set the red expression.
  5553. @item green_expr, g
  5554. Set the green expression.
  5555. @item blue_expr, b
  5556. Set the blue expression.
  5557. @end table
  5558. The colorspace is selected according to the specified options. If one
  5559. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  5560. options is specified, the filter will automatically select a YCbCr
  5561. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  5562. @option{blue_expr} options is specified, it will select an RGB
  5563. colorspace.
  5564. If one of the chrominance expression is not defined, it falls back on the other
  5565. one. If no alpha expression is specified it will evaluate to opaque value.
  5566. If none of chrominance expressions are specified, they will evaluate
  5567. to the luminance expression.
  5568. The expressions can use the following variables and functions:
  5569. @table @option
  5570. @item N
  5571. The sequential number of the filtered frame, starting from @code{0}.
  5572. @item X
  5573. @item Y
  5574. The coordinates of the current sample.
  5575. @item W
  5576. @item H
  5577. The width and height of the image.
  5578. @item SW
  5579. @item SH
  5580. Width and height scale depending on the currently filtered plane. It is the
  5581. ratio between the corresponding luma plane number of pixels and the current
  5582. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  5583. @code{0.5,0.5} for chroma planes.
  5584. @item T
  5585. Time of the current frame, expressed in seconds.
  5586. @item p(x, y)
  5587. Return the value of the pixel at location (@var{x},@var{y}) of the current
  5588. plane.
  5589. @item lum(x, y)
  5590. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  5591. plane.
  5592. @item cb(x, y)
  5593. Return the value of the pixel at location (@var{x},@var{y}) of the
  5594. blue-difference chroma plane. Return 0 if there is no such plane.
  5595. @item cr(x, y)
  5596. Return the value of the pixel at location (@var{x},@var{y}) of the
  5597. red-difference chroma plane. Return 0 if there is no such plane.
  5598. @item r(x, y)
  5599. @item g(x, y)
  5600. @item b(x, y)
  5601. Return the value of the pixel at location (@var{x},@var{y}) of the
  5602. red/green/blue component. Return 0 if there is no such component.
  5603. @item alpha(x, y)
  5604. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  5605. plane. Return 0 if there is no such plane.
  5606. @end table
  5607. For functions, if @var{x} and @var{y} are outside the area, the value will be
  5608. automatically clipped to the closer edge.
  5609. @subsection Examples
  5610. @itemize
  5611. @item
  5612. Flip the image horizontally:
  5613. @example
  5614. geq=p(W-X\,Y)
  5615. @end example
  5616. @item
  5617. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  5618. wavelength of 100 pixels:
  5619. @example
  5620. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  5621. @end example
  5622. @item
  5623. Generate a fancy enigmatic moving light:
  5624. @example
  5625. 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
  5626. @end example
  5627. @item
  5628. Generate a quick emboss effect:
  5629. @example
  5630. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  5631. @end example
  5632. @item
  5633. Modify RGB components depending on pixel position:
  5634. @example
  5635. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  5636. @end example
  5637. @item
  5638. Create a radial gradient that is the same size as the input (also see
  5639. the @ref{vignette} filter):
  5640. @example
  5641. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  5642. @end example
  5643. @item
  5644. Create a linear gradient to use as a mask for another filter, then
  5645. compose with @ref{overlay}. In this example the video will gradually
  5646. become more blurry from the top to the bottom of the y-axis as defined
  5647. by the linear gradient:
  5648. @example
  5649. 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
  5650. @end example
  5651. @end itemize
  5652. @section gradfun
  5653. Fix the banding artifacts that are sometimes introduced into nearly flat
  5654. regions by truncation to 8bit color depth.
  5655. Interpolate the gradients that should go where the bands are, and
  5656. dither them.
  5657. It is designed for playback only. Do not use it prior to
  5658. lossy compression, because compression tends to lose the dither and
  5659. bring back the bands.
  5660. It accepts the following parameters:
  5661. @table @option
  5662. @item strength
  5663. The maximum amount by which the filter will change any one pixel. This is also
  5664. the threshold for detecting nearly flat regions. Acceptable values range from
  5665. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  5666. valid range.
  5667. @item radius
  5668. The neighborhood to fit the gradient to. A larger radius makes for smoother
  5669. gradients, but also prevents the filter from modifying the pixels near detailed
  5670. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  5671. values will be clipped to the valid range.
  5672. @end table
  5673. Alternatively, the options can be specified as a flat string:
  5674. @var{strength}[:@var{radius}]
  5675. @subsection Examples
  5676. @itemize
  5677. @item
  5678. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  5679. @example
  5680. gradfun=3.5:8
  5681. @end example
  5682. @item
  5683. Specify radius, omitting the strength (which will fall-back to the default
  5684. value):
  5685. @example
  5686. gradfun=radius=8
  5687. @end example
  5688. @end itemize
  5689. @anchor{haldclut}
  5690. @section haldclut
  5691. Apply a Hald CLUT to a video stream.
  5692. First input is the video stream to process, and second one is the Hald CLUT.
  5693. The Hald CLUT input can be a simple picture or a complete video stream.
  5694. The filter accepts the following options:
  5695. @table @option
  5696. @item shortest
  5697. Force termination when the shortest input terminates. Default is @code{0}.
  5698. @item repeatlast
  5699. Continue applying the last CLUT after the end of the stream. A value of
  5700. @code{0} disable the filter after the last frame of the CLUT is reached.
  5701. Default is @code{1}.
  5702. @end table
  5703. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  5704. filters share the same internals).
  5705. More information about the Hald CLUT can be found on Eskil Steenberg's website
  5706. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  5707. @subsection Workflow examples
  5708. @subsubsection Hald CLUT video stream
  5709. Generate an identity Hald CLUT stream altered with various effects:
  5710. @example
  5711. 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
  5712. @end example
  5713. Note: make sure you use a lossless codec.
  5714. Then use it with @code{haldclut} to apply it on some random stream:
  5715. @example
  5716. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  5717. @end example
  5718. The Hald CLUT will be applied to the 10 first seconds (duration of
  5719. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  5720. to the remaining frames of the @code{mandelbrot} stream.
  5721. @subsubsection Hald CLUT with preview
  5722. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  5723. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  5724. biggest possible square starting at the top left of the picture. The remaining
  5725. padding pixels (bottom or right) will be ignored. This area can be used to add
  5726. a preview of the Hald CLUT.
  5727. Typically, the following generated Hald CLUT will be supported by the
  5728. @code{haldclut} filter:
  5729. @example
  5730. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  5731. pad=iw+320 [padded_clut];
  5732. smptebars=s=320x256, split [a][b];
  5733. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  5734. [main][b] overlay=W-320" -frames:v 1 clut.png
  5735. @end example
  5736. It contains the original and a preview of the effect of the CLUT: SMPTE color
  5737. bars are displayed on the right-top, and below the same color bars processed by
  5738. the color changes.
  5739. Then, the effect of this Hald CLUT can be visualized with:
  5740. @example
  5741. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  5742. @end example
  5743. @section hflip
  5744. Flip the input video horizontally.
  5745. For example, to horizontally flip the input video with @command{ffmpeg}:
  5746. @example
  5747. ffmpeg -i in.avi -vf "hflip" out.avi
  5748. @end example
  5749. @section histeq
  5750. This filter applies a global color histogram equalization on a
  5751. per-frame basis.
  5752. It can be used to correct video that has a compressed range of pixel
  5753. intensities. The filter redistributes the pixel intensities to
  5754. equalize their distribution across the intensity range. It may be
  5755. viewed as an "automatically adjusting contrast filter". This filter is
  5756. useful only for correcting degraded or poorly captured source
  5757. video.
  5758. The filter accepts the following options:
  5759. @table @option
  5760. @item strength
  5761. Determine the amount of equalization to be applied. As the strength
  5762. is reduced, the distribution of pixel intensities more-and-more
  5763. approaches that of the input frame. The value must be a float number
  5764. in the range [0,1] and defaults to 0.200.
  5765. @item intensity
  5766. Set the maximum intensity that can generated and scale the output
  5767. values appropriately. The strength should be set as desired and then
  5768. the intensity can be limited if needed to avoid washing-out. The value
  5769. must be a float number in the range [0,1] and defaults to 0.210.
  5770. @item antibanding
  5771. Set the antibanding level. If enabled the filter will randomly vary
  5772. the luminance of output pixels by a small amount to avoid banding of
  5773. the histogram. Possible values are @code{none}, @code{weak} or
  5774. @code{strong}. It defaults to @code{none}.
  5775. @end table
  5776. @section histogram
  5777. Compute and draw a color distribution histogram for the input video.
  5778. The computed histogram is a representation of the color component
  5779. distribution in an image.
  5780. Standard histogram displays the color components distribution in an image.
  5781. Displays color graph for each color component. Shows distribution of
  5782. the Y, U, V, A or R, G, B components, depending on input format, in the
  5783. current frame. Below each graph a color component scale meter is shown.
  5784. The filter accepts the following options:
  5785. @table @option
  5786. @item level_height
  5787. Set height of level. Default value is @code{200}.
  5788. Allowed range is [50, 2048].
  5789. @item scale_height
  5790. Set height of color scale. Default value is @code{12}.
  5791. Allowed range is [0, 40].
  5792. @item display_mode
  5793. Set display mode.
  5794. It accepts the following values:
  5795. @table @samp
  5796. @item parade
  5797. Per color component graphs are placed below each other.
  5798. @item overlay
  5799. Presents information identical to that in the @code{parade}, except
  5800. that the graphs representing color components are superimposed directly
  5801. over one another.
  5802. @end table
  5803. Default is @code{parade}.
  5804. @item levels_mode
  5805. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  5806. Default is @code{linear}.
  5807. @item components
  5808. Set what color components to display.
  5809. Default is @code{7}.
  5810. @end table
  5811. @subsection Examples
  5812. @itemize
  5813. @item
  5814. Calculate and draw histogram:
  5815. @example
  5816. ffplay -i input -vf histogram
  5817. @end example
  5818. @end itemize
  5819. @anchor{hqdn3d}
  5820. @section hqdn3d
  5821. This is a high precision/quality 3d denoise filter. It aims to reduce
  5822. image noise, producing smooth images and making still images really
  5823. still. It should enhance compressibility.
  5824. It accepts the following optional parameters:
  5825. @table @option
  5826. @item luma_spatial
  5827. A non-negative floating point number which specifies spatial luma strength.
  5828. It defaults to 4.0.
  5829. @item chroma_spatial
  5830. A non-negative floating point number which specifies spatial chroma strength.
  5831. It defaults to 3.0*@var{luma_spatial}/4.0.
  5832. @item luma_tmp
  5833. A floating point number which specifies luma temporal strength. It defaults to
  5834. 6.0*@var{luma_spatial}/4.0.
  5835. @item chroma_tmp
  5836. A floating point number which specifies chroma temporal strength. It defaults to
  5837. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  5838. @end table
  5839. @section hqx
  5840. Apply a high-quality magnification filter designed for pixel art. This filter
  5841. was originally created by Maxim Stepin.
  5842. It accepts the following option:
  5843. @table @option
  5844. @item n
  5845. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  5846. @code{hq3x} and @code{4} for @code{hq4x}.
  5847. Default is @code{3}.
  5848. @end table
  5849. @section hstack
  5850. Stack input videos horizontally.
  5851. All streams must be of same pixel format and of same height.
  5852. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  5853. to create same output.
  5854. The filter accept the following option:
  5855. @table @option
  5856. @item inputs
  5857. Set number of input streams. Default is 2.
  5858. @item shortest
  5859. If set to 1, force the output to terminate when the shortest input
  5860. terminates. Default value is 0.
  5861. @end table
  5862. @section hue
  5863. Modify the hue and/or the saturation of the input.
  5864. It accepts the following parameters:
  5865. @table @option
  5866. @item h
  5867. Specify the hue angle as a number of degrees. It accepts an expression,
  5868. and defaults to "0".
  5869. @item s
  5870. Specify the saturation in the [-10,10] range. It accepts an expression and
  5871. defaults to "1".
  5872. @item H
  5873. Specify the hue angle as a number of radians. It accepts an
  5874. expression, and defaults to "0".
  5875. @item b
  5876. Specify the brightness in the [-10,10] range. It accepts an expression and
  5877. defaults to "0".
  5878. @end table
  5879. @option{h} and @option{H} are mutually exclusive, and can't be
  5880. specified at the same time.
  5881. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  5882. expressions containing the following constants:
  5883. @table @option
  5884. @item n
  5885. frame count of the input frame starting from 0
  5886. @item pts
  5887. presentation timestamp of the input frame expressed in time base units
  5888. @item r
  5889. frame rate of the input video, NAN if the input frame rate is unknown
  5890. @item t
  5891. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5892. @item tb
  5893. time base of the input video
  5894. @end table
  5895. @subsection Examples
  5896. @itemize
  5897. @item
  5898. Set the hue to 90 degrees and the saturation to 1.0:
  5899. @example
  5900. hue=h=90:s=1
  5901. @end example
  5902. @item
  5903. Same command but expressing the hue in radians:
  5904. @example
  5905. hue=H=PI/2:s=1
  5906. @end example
  5907. @item
  5908. Rotate hue and make the saturation swing between 0
  5909. and 2 over a period of 1 second:
  5910. @example
  5911. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  5912. @end example
  5913. @item
  5914. Apply a 3 seconds saturation fade-in effect starting at 0:
  5915. @example
  5916. hue="s=min(t/3\,1)"
  5917. @end example
  5918. The general fade-in expression can be written as:
  5919. @example
  5920. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  5921. @end example
  5922. @item
  5923. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  5924. @example
  5925. hue="s=max(0\, min(1\, (8-t)/3))"
  5926. @end example
  5927. The general fade-out expression can be written as:
  5928. @example
  5929. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  5930. @end example
  5931. @end itemize
  5932. @subsection Commands
  5933. This filter supports the following commands:
  5934. @table @option
  5935. @item b
  5936. @item s
  5937. @item h
  5938. @item H
  5939. Modify the hue and/or the saturation and/or brightness of the input video.
  5940. The command accepts the same syntax of the corresponding option.
  5941. If the specified expression is not valid, it is kept at its current
  5942. value.
  5943. @end table
  5944. @section idet
  5945. Detect video interlacing type.
  5946. This filter tries to detect if the input frames as interlaced, progressive,
  5947. top or bottom field first. It will also try and detect fields that are
  5948. repeated between adjacent frames (a sign of telecine).
  5949. Single frame detection considers only immediately adjacent frames when classifying each frame.
  5950. Multiple frame detection incorporates the classification history of previous frames.
  5951. The filter will log these metadata values:
  5952. @table @option
  5953. @item single.current_frame
  5954. Detected type of current frame using single-frame detection. One of:
  5955. ``tff'' (top field first), ``bff'' (bottom field first),
  5956. ``progressive'', or ``undetermined''
  5957. @item single.tff
  5958. Cumulative number of frames detected as top field first using single-frame detection.
  5959. @item multiple.tff
  5960. Cumulative number of frames detected as top field first using multiple-frame detection.
  5961. @item single.bff
  5962. Cumulative number of frames detected as bottom field first using single-frame detection.
  5963. @item multiple.current_frame
  5964. Detected type of current frame using multiple-frame detection. One of:
  5965. ``tff'' (top field first), ``bff'' (bottom field first),
  5966. ``progressive'', or ``undetermined''
  5967. @item multiple.bff
  5968. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  5969. @item single.progressive
  5970. Cumulative number of frames detected as progressive using single-frame detection.
  5971. @item multiple.progressive
  5972. Cumulative number of frames detected as progressive using multiple-frame detection.
  5973. @item single.undetermined
  5974. Cumulative number of frames that could not be classified using single-frame detection.
  5975. @item multiple.undetermined
  5976. Cumulative number of frames that could not be classified using multiple-frame detection.
  5977. @item repeated.current_frame
  5978. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  5979. @item repeated.neither
  5980. Cumulative number of frames with no repeated field.
  5981. @item repeated.top
  5982. Cumulative number of frames with the top field repeated from the previous frame's top field.
  5983. @item repeated.bottom
  5984. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  5985. @end table
  5986. The filter accepts the following options:
  5987. @table @option
  5988. @item intl_thres
  5989. Set interlacing threshold.
  5990. @item prog_thres
  5991. Set progressive threshold.
  5992. @item repeat_thres
  5993. Threshold for repeated field detection.
  5994. @item half_life
  5995. Number of frames after which a given frame's contribution to the
  5996. statistics is halved (i.e., it contributes only 0.5 to it's
  5997. classification). The default of 0 means that all frames seen are given
  5998. full weight of 1.0 forever.
  5999. @item analyze_interlaced_flag
  6000. When this is not 0 then idet will use the specified number of frames to determine
  6001. if the interlaced flag is accurate, it will not count undetermined frames.
  6002. If the flag is found to be accurate it will be used without any further
  6003. computations, if it is found to be inaccurate it will be cleared without any
  6004. further computations. This allows inserting the idet filter as a low computational
  6005. method to clean up the interlaced flag
  6006. @end table
  6007. @section il
  6008. Deinterleave or interleave fields.
  6009. This filter allows one to process interlaced images fields without
  6010. deinterlacing them. Deinterleaving splits the input frame into 2
  6011. fields (so called half pictures). Odd lines are moved to the top
  6012. half of the output image, even lines to the bottom half.
  6013. You can process (filter) them independently and then re-interleave them.
  6014. The filter accepts the following options:
  6015. @table @option
  6016. @item luma_mode, l
  6017. @item chroma_mode, c
  6018. @item alpha_mode, a
  6019. Available values for @var{luma_mode}, @var{chroma_mode} and
  6020. @var{alpha_mode} are:
  6021. @table @samp
  6022. @item none
  6023. Do nothing.
  6024. @item deinterleave, d
  6025. Deinterleave fields, placing one above the other.
  6026. @item interleave, i
  6027. Interleave fields. Reverse the effect of deinterleaving.
  6028. @end table
  6029. Default value is @code{none}.
  6030. @item luma_swap, ls
  6031. @item chroma_swap, cs
  6032. @item alpha_swap, as
  6033. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6034. @end table
  6035. @section inflate
  6036. Apply inflate effect to the video.
  6037. This filter replaces the pixel by the local(3x3) average by taking into account
  6038. only values higher than the pixel.
  6039. It accepts the following options:
  6040. @table @option
  6041. @item threshold0
  6042. @item threshold1
  6043. @item threshold2
  6044. @item threshold3
  6045. Limit the maximum change for each plane, default is 65535.
  6046. If 0, plane will remain unchanged.
  6047. @end table
  6048. @section interlace
  6049. Simple interlacing filter from progressive contents. This interleaves upper (or
  6050. lower) lines from odd frames with lower (or upper) lines from even frames,
  6051. halving the frame rate and preserving image height.
  6052. @example
  6053. Original Original New Frame
  6054. Frame 'j' Frame 'j+1' (tff)
  6055. ========== =========== ==================
  6056. Line 0 --------------------> Frame 'j' Line 0
  6057. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6058. Line 2 ---------------------> Frame 'j' Line 2
  6059. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6060. ... ... ...
  6061. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6062. @end example
  6063. It accepts the following optional parameters:
  6064. @table @option
  6065. @item scan
  6066. This determines whether the interlaced frame is taken from the even
  6067. (tff - default) or odd (bff) lines of the progressive frame.
  6068. @item lowpass
  6069. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6070. interlacing and reduce moire patterns.
  6071. @end table
  6072. @section kerndeint
  6073. Deinterlace input video by applying Donald Graft's adaptive kernel
  6074. deinterling. Work on interlaced parts of a video to produce
  6075. progressive frames.
  6076. The description of the accepted parameters follows.
  6077. @table @option
  6078. @item thresh
  6079. Set the threshold which affects the filter's tolerance when
  6080. determining if a pixel line must be processed. It must be an integer
  6081. in the range [0,255] and defaults to 10. A value of 0 will result in
  6082. applying the process on every pixels.
  6083. @item map
  6084. Paint pixels exceeding the threshold value to white if set to 1.
  6085. Default is 0.
  6086. @item order
  6087. Set the fields order. Swap fields if set to 1, leave fields alone if
  6088. 0. Default is 0.
  6089. @item sharp
  6090. Enable additional sharpening if set to 1. Default is 0.
  6091. @item twoway
  6092. Enable twoway sharpening if set to 1. Default is 0.
  6093. @end table
  6094. @subsection Examples
  6095. @itemize
  6096. @item
  6097. Apply default values:
  6098. @example
  6099. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6100. @end example
  6101. @item
  6102. Enable additional sharpening:
  6103. @example
  6104. kerndeint=sharp=1
  6105. @end example
  6106. @item
  6107. Paint processed pixels in white:
  6108. @example
  6109. kerndeint=map=1
  6110. @end example
  6111. @end itemize
  6112. @section lenscorrection
  6113. Correct radial lens distortion
  6114. This filter can be used to correct for radial distortion as can result from the use
  6115. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6116. one can use tools available for example as part of opencv or simply trial-and-error.
  6117. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6118. and extract the k1 and k2 coefficients from the resulting matrix.
  6119. Note that effectively the same filter is available in the open-source tools Krita and
  6120. Digikam from the KDE project.
  6121. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6122. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6123. brightness distribution, so you may want to use both filters together in certain
  6124. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6125. be applied before or after lens correction.
  6126. @subsection Options
  6127. The filter accepts the following options:
  6128. @table @option
  6129. @item cx
  6130. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6131. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6132. width.
  6133. @item cy
  6134. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6135. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6136. height.
  6137. @item k1
  6138. Coefficient of the quadratic correction term. 0.5 means no correction.
  6139. @item k2
  6140. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6141. @end table
  6142. The formula that generates the correction is:
  6143. @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)
  6144. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6145. distances from the focal point in the source and target images, respectively.
  6146. @anchor{lut3d}
  6147. @section lut3d
  6148. Apply a 3D LUT to an input video.
  6149. The filter accepts the following options:
  6150. @table @option
  6151. @item file
  6152. Set the 3D LUT file name.
  6153. Currently supported formats:
  6154. @table @samp
  6155. @item 3dl
  6156. AfterEffects
  6157. @item cube
  6158. Iridas
  6159. @item dat
  6160. DaVinci
  6161. @item m3d
  6162. Pandora
  6163. @end table
  6164. @item interp
  6165. Select interpolation mode.
  6166. Available values are:
  6167. @table @samp
  6168. @item nearest
  6169. Use values from the nearest defined point.
  6170. @item trilinear
  6171. Interpolate values using the 8 points defining a cube.
  6172. @item tetrahedral
  6173. Interpolate values using a tetrahedron.
  6174. @end table
  6175. @end table
  6176. @section lut, lutrgb, lutyuv
  6177. Compute a look-up table for binding each pixel component input value
  6178. to an output value, and apply it to the input video.
  6179. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6180. to an RGB input video.
  6181. These filters accept the following parameters:
  6182. @table @option
  6183. @item c0
  6184. set first pixel component expression
  6185. @item c1
  6186. set second pixel component expression
  6187. @item c2
  6188. set third pixel component expression
  6189. @item c3
  6190. set fourth pixel component expression, corresponds to the alpha component
  6191. @item r
  6192. set red component expression
  6193. @item g
  6194. set green component expression
  6195. @item b
  6196. set blue component expression
  6197. @item a
  6198. alpha component expression
  6199. @item y
  6200. set Y/luminance component expression
  6201. @item u
  6202. set U/Cb component expression
  6203. @item v
  6204. set V/Cr component expression
  6205. @end table
  6206. Each of them specifies the expression to use for computing the lookup table for
  6207. the corresponding pixel component values.
  6208. The exact component associated to each of the @var{c*} options depends on the
  6209. format in input.
  6210. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  6211. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  6212. The expressions can contain the following constants and functions:
  6213. @table @option
  6214. @item w
  6215. @item h
  6216. The input width and height.
  6217. @item val
  6218. The input value for the pixel component.
  6219. @item clipval
  6220. The input value, clipped to the @var{minval}-@var{maxval} range.
  6221. @item maxval
  6222. The maximum value for the pixel component.
  6223. @item minval
  6224. The minimum value for the pixel component.
  6225. @item negval
  6226. The negated value for the pixel component value, clipped to the
  6227. @var{minval}-@var{maxval} range; it corresponds to the expression
  6228. "maxval-clipval+minval".
  6229. @item clip(val)
  6230. The computed value in @var{val}, clipped to the
  6231. @var{minval}-@var{maxval} range.
  6232. @item gammaval(gamma)
  6233. The computed gamma correction value of the pixel component value,
  6234. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  6235. expression
  6236. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  6237. @end table
  6238. All expressions default to "val".
  6239. @subsection Examples
  6240. @itemize
  6241. @item
  6242. Negate input video:
  6243. @example
  6244. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  6245. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  6246. @end example
  6247. The above is the same as:
  6248. @example
  6249. lutrgb="r=negval:g=negval:b=negval"
  6250. lutyuv="y=negval:u=negval:v=negval"
  6251. @end example
  6252. @item
  6253. Negate luminance:
  6254. @example
  6255. lutyuv=y=negval
  6256. @end example
  6257. @item
  6258. Remove chroma components, turning the video into a graytone image:
  6259. @example
  6260. lutyuv="u=128:v=128"
  6261. @end example
  6262. @item
  6263. Apply a luma burning effect:
  6264. @example
  6265. lutyuv="y=2*val"
  6266. @end example
  6267. @item
  6268. Remove green and blue components:
  6269. @example
  6270. lutrgb="g=0:b=0"
  6271. @end example
  6272. @item
  6273. Set a constant alpha channel value on input:
  6274. @example
  6275. format=rgba,lutrgb=a="maxval-minval/2"
  6276. @end example
  6277. @item
  6278. Correct luminance gamma by a factor of 0.5:
  6279. @example
  6280. lutyuv=y=gammaval(0.5)
  6281. @end example
  6282. @item
  6283. Discard least significant bits of luma:
  6284. @example
  6285. lutyuv=y='bitand(val, 128+64+32)'
  6286. @end example
  6287. @end itemize
  6288. @section maskedmerge
  6289. Merge the first input stream with the second input stream using per pixel
  6290. weights in the third input stream.
  6291. A value of 0 in the third stream pixel component means that pixel component
  6292. from first stream is returned unchanged, while maximum value (eg. 255 for
  6293. 8-bit videos) means that pixel component from second stream is returned
  6294. unchanged. Intermediate values define the amount of merging between both
  6295. input stream's pixel components.
  6296. This filter accepts the following options:
  6297. @table @option
  6298. @item planes
  6299. Set which planes will be processed as bitmap, unprocessed planes will be
  6300. copied from first stream.
  6301. By default value 0xf, all planes will be processed.
  6302. @end table
  6303. @section mcdeint
  6304. Apply motion-compensation deinterlacing.
  6305. It needs one field per frame as input and must thus be used together
  6306. with yadif=1/3 or equivalent.
  6307. This filter accepts the following options:
  6308. @table @option
  6309. @item mode
  6310. Set the deinterlacing mode.
  6311. It accepts one of the following values:
  6312. @table @samp
  6313. @item fast
  6314. @item medium
  6315. @item slow
  6316. use iterative motion estimation
  6317. @item extra_slow
  6318. like @samp{slow}, but use multiple reference frames.
  6319. @end table
  6320. Default value is @samp{fast}.
  6321. @item parity
  6322. Set the picture field parity assumed for the input video. It must be
  6323. one of the following values:
  6324. @table @samp
  6325. @item 0, tff
  6326. assume top field first
  6327. @item 1, bff
  6328. assume bottom field first
  6329. @end table
  6330. Default value is @samp{bff}.
  6331. @item qp
  6332. Set per-block quantization parameter (QP) used by the internal
  6333. encoder.
  6334. Higher values should result in a smoother motion vector field but less
  6335. optimal individual vectors. Default value is 1.
  6336. @end table
  6337. @section mergeplanes
  6338. Merge color channel components from several video streams.
  6339. The filter accepts up to 4 input streams, and merge selected input
  6340. planes to the output video.
  6341. This filter accepts the following options:
  6342. @table @option
  6343. @item mapping
  6344. Set input to output plane mapping. Default is @code{0}.
  6345. The mappings is specified as a bitmap. It should be specified as a
  6346. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  6347. mapping for the first plane of the output stream. 'A' sets the number of
  6348. the input stream to use (from 0 to 3), and 'a' the plane number of the
  6349. corresponding input to use (from 0 to 3). The rest of the mappings is
  6350. similar, 'Bb' describes the mapping for the output stream second
  6351. plane, 'Cc' describes the mapping for the output stream third plane and
  6352. 'Dd' describes the mapping for the output stream fourth plane.
  6353. @item format
  6354. Set output pixel format. Default is @code{yuva444p}.
  6355. @end table
  6356. @subsection Examples
  6357. @itemize
  6358. @item
  6359. Merge three gray video streams of same width and height into single video stream:
  6360. @example
  6361. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  6362. @end example
  6363. @item
  6364. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  6365. @example
  6366. [a0][a1]mergeplanes=0x00010210:yuva444p
  6367. @end example
  6368. @item
  6369. Swap Y and A plane in yuva444p stream:
  6370. @example
  6371. format=yuva444p,mergeplanes=0x03010200:yuva444p
  6372. @end example
  6373. @item
  6374. Swap U and V plane in yuv420p stream:
  6375. @example
  6376. format=yuv420p,mergeplanes=0x000201:yuv420p
  6377. @end example
  6378. @item
  6379. Cast a rgb24 clip to yuv444p:
  6380. @example
  6381. format=rgb24,mergeplanes=0x000102:yuv444p
  6382. @end example
  6383. @end itemize
  6384. @section mpdecimate
  6385. Drop frames that do not differ greatly from the previous frame in
  6386. order to reduce frame rate.
  6387. The main use of this filter is for very-low-bitrate encoding
  6388. (e.g. streaming over dialup modem), but it could in theory be used for
  6389. fixing movies that were inverse-telecined incorrectly.
  6390. A description of the accepted options follows.
  6391. @table @option
  6392. @item max
  6393. Set the maximum number of consecutive frames which can be dropped (if
  6394. positive), or the minimum interval between dropped frames (if
  6395. negative). If the value is 0, the frame is dropped unregarding the
  6396. number of previous sequentially dropped frames.
  6397. Default value is 0.
  6398. @item hi
  6399. @item lo
  6400. @item frac
  6401. Set the dropping threshold values.
  6402. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  6403. represent actual pixel value differences, so a threshold of 64
  6404. corresponds to 1 unit of difference for each pixel, or the same spread
  6405. out differently over the block.
  6406. A frame is a candidate for dropping if no 8x8 blocks differ by more
  6407. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  6408. meaning the whole image) differ by more than a threshold of @option{lo}.
  6409. Default value for @option{hi} is 64*12, default value for @option{lo} is
  6410. 64*5, and default value for @option{frac} is 0.33.
  6411. @end table
  6412. @section negate
  6413. Negate input video.
  6414. It accepts an integer in input; if non-zero it negates the
  6415. alpha component (if available). The default value in input is 0.
  6416. @section noformat
  6417. Force libavfilter not to use any of the specified pixel formats for the
  6418. input to the next filter.
  6419. It accepts the following parameters:
  6420. @table @option
  6421. @item pix_fmts
  6422. A '|'-separated list of pixel format names, such as
  6423. apix_fmts=yuv420p|monow|rgb24".
  6424. @end table
  6425. @subsection Examples
  6426. @itemize
  6427. @item
  6428. Force libavfilter to use a format different from @var{yuv420p} for the
  6429. input to the vflip filter:
  6430. @example
  6431. noformat=pix_fmts=yuv420p,vflip
  6432. @end example
  6433. @item
  6434. Convert the input video to any of the formats not contained in the list:
  6435. @example
  6436. noformat=yuv420p|yuv444p|yuv410p
  6437. @end example
  6438. @end itemize
  6439. @section noise
  6440. Add noise on video input frame.
  6441. The filter accepts the following options:
  6442. @table @option
  6443. @item all_seed
  6444. @item c0_seed
  6445. @item c1_seed
  6446. @item c2_seed
  6447. @item c3_seed
  6448. Set noise seed for specific pixel component or all pixel components in case
  6449. of @var{all_seed}. Default value is @code{123457}.
  6450. @item all_strength, alls
  6451. @item c0_strength, c0s
  6452. @item c1_strength, c1s
  6453. @item c2_strength, c2s
  6454. @item c3_strength, c3s
  6455. Set noise strength for specific pixel component or all pixel components in case
  6456. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  6457. @item all_flags, allf
  6458. @item c0_flags, c0f
  6459. @item c1_flags, c1f
  6460. @item c2_flags, c2f
  6461. @item c3_flags, c3f
  6462. Set pixel component flags or set flags for all components if @var{all_flags}.
  6463. Available values for component flags are:
  6464. @table @samp
  6465. @item a
  6466. averaged temporal noise (smoother)
  6467. @item p
  6468. mix random noise with a (semi)regular pattern
  6469. @item t
  6470. temporal noise (noise pattern changes between frames)
  6471. @item u
  6472. uniform noise (gaussian otherwise)
  6473. @end table
  6474. @end table
  6475. @subsection Examples
  6476. Add temporal and uniform noise to input video:
  6477. @example
  6478. noise=alls=20:allf=t+u
  6479. @end example
  6480. @section null
  6481. Pass the video source unchanged to the output.
  6482. @section ocr
  6483. Optical Character Recognition
  6484. This filter uses Tesseract for optical character recognition.
  6485. It accepts the following options:
  6486. @table @option
  6487. @item datapath
  6488. Set datapath to tesseract data. Default is to use whatever was
  6489. set at installation.
  6490. @item language
  6491. Set language, default is "eng".
  6492. @item whitelist
  6493. Set character whitelist.
  6494. @item blacklist
  6495. Set character blacklist.
  6496. @end table
  6497. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  6498. @section ocv
  6499. Apply a video transform using libopencv.
  6500. To enable this filter, install the libopencv library and headers and
  6501. configure FFmpeg with @code{--enable-libopencv}.
  6502. It accepts the following parameters:
  6503. @table @option
  6504. @item filter_name
  6505. The name of the libopencv filter to apply.
  6506. @item filter_params
  6507. The parameters to pass to the libopencv filter. If not specified, the default
  6508. values are assumed.
  6509. @end table
  6510. Refer to the official libopencv documentation for more precise
  6511. information:
  6512. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  6513. Several libopencv filters are supported; see the following subsections.
  6514. @anchor{dilate}
  6515. @subsection dilate
  6516. Dilate an image by using a specific structuring element.
  6517. It corresponds to the libopencv function @code{cvDilate}.
  6518. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  6519. @var{struct_el} represents a structuring element, and has the syntax:
  6520. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  6521. @var{cols} and @var{rows} represent the number of columns and rows of
  6522. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  6523. point, and @var{shape} the shape for the structuring element. @var{shape}
  6524. must be "rect", "cross", "ellipse", or "custom".
  6525. If the value for @var{shape} is "custom", it must be followed by a
  6526. string of the form "=@var{filename}". The file with name
  6527. @var{filename} is assumed to represent a binary image, with each
  6528. printable character corresponding to a bright pixel. When a custom
  6529. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  6530. or columns and rows of the read file are assumed instead.
  6531. The default value for @var{struct_el} is "3x3+0x0/rect".
  6532. @var{nb_iterations} specifies the number of times the transform is
  6533. applied to the image, and defaults to 1.
  6534. Some examples:
  6535. @example
  6536. # Use the default values
  6537. ocv=dilate
  6538. # Dilate using a structuring element with a 5x5 cross, iterating two times
  6539. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  6540. # Read the shape from the file diamond.shape, iterating two times.
  6541. # The file diamond.shape may contain a pattern of characters like this
  6542. # *
  6543. # ***
  6544. # *****
  6545. # ***
  6546. # *
  6547. # The specified columns and rows are ignored
  6548. # but the anchor point coordinates are not
  6549. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  6550. @end example
  6551. @subsection erode
  6552. Erode an image by using a specific structuring element.
  6553. It corresponds to the libopencv function @code{cvErode}.
  6554. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  6555. with the same syntax and semantics as the @ref{dilate} filter.
  6556. @subsection smooth
  6557. Smooth the input video.
  6558. The filter takes the following parameters:
  6559. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  6560. @var{type} is the type of smooth filter to apply, and must be one of
  6561. the following values: "blur", "blur_no_scale", "median", "gaussian",
  6562. or "bilateral". The default value is "gaussian".
  6563. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  6564. depend on the smooth type. @var{param1} and
  6565. @var{param2} accept integer positive values or 0. @var{param3} and
  6566. @var{param4} accept floating point values.
  6567. The default value for @var{param1} is 3. The default value for the
  6568. other parameters is 0.
  6569. These parameters correspond to the parameters assigned to the
  6570. libopencv function @code{cvSmooth}.
  6571. @anchor{overlay}
  6572. @section overlay
  6573. Overlay one video on top of another.
  6574. It takes two inputs and has one output. The first input is the "main"
  6575. video on which the second input is overlaid.
  6576. It accepts the following parameters:
  6577. A description of the accepted options follows.
  6578. @table @option
  6579. @item x
  6580. @item y
  6581. Set the expression for the x and y coordinates of the overlaid video
  6582. on the main video. Default value is "0" for both expressions. In case
  6583. the expression is invalid, it is set to a huge value (meaning that the
  6584. overlay will not be displayed within the output visible area).
  6585. @item eof_action
  6586. The action to take when EOF is encountered on the secondary input; it accepts
  6587. one of the following values:
  6588. @table @option
  6589. @item repeat
  6590. Repeat the last frame (the default).
  6591. @item endall
  6592. End both streams.
  6593. @item pass
  6594. Pass the main input through.
  6595. @end table
  6596. @item eval
  6597. Set when the expressions for @option{x}, and @option{y} are evaluated.
  6598. It accepts the following values:
  6599. @table @samp
  6600. @item init
  6601. only evaluate expressions once during the filter initialization or
  6602. when a command is processed
  6603. @item frame
  6604. evaluate expressions for each incoming frame
  6605. @end table
  6606. Default value is @samp{frame}.
  6607. @item shortest
  6608. If set to 1, force the output to terminate when the shortest input
  6609. terminates. Default value is 0.
  6610. @item format
  6611. Set the format for the output video.
  6612. It accepts the following values:
  6613. @table @samp
  6614. @item yuv420
  6615. force YUV420 output
  6616. @item yuv422
  6617. force YUV422 output
  6618. @item yuv444
  6619. force YUV444 output
  6620. @item rgb
  6621. force RGB output
  6622. @end table
  6623. Default value is @samp{yuv420}.
  6624. @item rgb @emph{(deprecated)}
  6625. If set to 1, force the filter to accept inputs in the RGB
  6626. color space. Default value is 0. This option is deprecated, use
  6627. @option{format} instead.
  6628. @item repeatlast
  6629. If set to 1, force the filter to draw the last overlay frame over the
  6630. main input until the end of the stream. A value of 0 disables this
  6631. behavior. Default value is 1.
  6632. @end table
  6633. The @option{x}, and @option{y} expressions can contain the following
  6634. parameters.
  6635. @table @option
  6636. @item main_w, W
  6637. @item main_h, H
  6638. The main input width and height.
  6639. @item overlay_w, w
  6640. @item overlay_h, h
  6641. The overlay input width and height.
  6642. @item x
  6643. @item y
  6644. The computed values for @var{x} and @var{y}. They are evaluated for
  6645. each new frame.
  6646. @item hsub
  6647. @item vsub
  6648. horizontal and vertical chroma subsample values of the output
  6649. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  6650. @var{vsub} is 1.
  6651. @item n
  6652. the number of input frame, starting from 0
  6653. @item pos
  6654. the position in the file of the input frame, NAN if unknown
  6655. @item t
  6656. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  6657. @end table
  6658. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  6659. when evaluation is done @emph{per frame}, and will evaluate to NAN
  6660. when @option{eval} is set to @samp{init}.
  6661. Be aware that frames are taken from each input video in timestamp
  6662. order, hence, if their initial timestamps differ, it is a good idea
  6663. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  6664. have them begin in the same zero timestamp, as the example for
  6665. the @var{movie} filter does.
  6666. You can chain together more overlays but you should test the
  6667. efficiency of such approach.
  6668. @subsection Commands
  6669. This filter supports the following commands:
  6670. @table @option
  6671. @item x
  6672. @item y
  6673. Modify the x and y of the overlay input.
  6674. The command accepts the same syntax of the corresponding option.
  6675. If the specified expression is not valid, it is kept at its current
  6676. value.
  6677. @end table
  6678. @subsection Examples
  6679. @itemize
  6680. @item
  6681. Draw the overlay at 10 pixels from the bottom right corner of the main
  6682. video:
  6683. @example
  6684. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  6685. @end example
  6686. Using named options the example above becomes:
  6687. @example
  6688. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  6689. @end example
  6690. @item
  6691. Insert a transparent PNG logo in the bottom left corner of the input,
  6692. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  6693. @example
  6694. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  6695. @end example
  6696. @item
  6697. Insert 2 different transparent PNG logos (second logo on bottom
  6698. right corner) using the @command{ffmpeg} tool:
  6699. @example
  6700. 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
  6701. @end example
  6702. @item
  6703. Add a transparent color layer on top of the main video; @code{WxH}
  6704. must specify the size of the main input to the overlay filter:
  6705. @example
  6706. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  6707. @end example
  6708. @item
  6709. Play an original video and a filtered version (here with the deshake
  6710. filter) side by side using the @command{ffplay} tool:
  6711. @example
  6712. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  6713. @end example
  6714. The above command is the same as:
  6715. @example
  6716. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  6717. @end example
  6718. @item
  6719. Make a sliding overlay appearing from the left to the right top part of the
  6720. screen starting since time 2:
  6721. @example
  6722. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  6723. @end example
  6724. @item
  6725. Compose output by putting two input videos side to side:
  6726. @example
  6727. ffmpeg -i left.avi -i right.avi -filter_complex "
  6728. nullsrc=size=200x100 [background];
  6729. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  6730. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  6731. [background][left] overlay=shortest=1 [background+left];
  6732. [background+left][right] overlay=shortest=1:x=100 [left+right]
  6733. "
  6734. @end example
  6735. @item
  6736. Mask 10-20 seconds of a video by applying the delogo filter to a section
  6737. @example
  6738. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  6739. -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]'
  6740. masked.avi
  6741. @end example
  6742. @item
  6743. Chain several overlays in cascade:
  6744. @example
  6745. nullsrc=s=200x200 [bg];
  6746. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  6747. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  6748. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  6749. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  6750. [in3] null, [mid2] overlay=100:100 [out0]
  6751. @end example
  6752. @end itemize
  6753. @section owdenoise
  6754. Apply Overcomplete Wavelet denoiser.
  6755. The filter accepts the following options:
  6756. @table @option
  6757. @item depth
  6758. Set depth.
  6759. Larger depth values will denoise lower frequency components more, but
  6760. slow down filtering.
  6761. Must be an int in the range 8-16, default is @code{8}.
  6762. @item luma_strength, ls
  6763. Set luma strength.
  6764. Must be a double value in the range 0-1000, default is @code{1.0}.
  6765. @item chroma_strength, cs
  6766. Set chroma strength.
  6767. Must be a double value in the range 0-1000, default is @code{1.0}.
  6768. @end table
  6769. @anchor{pad}
  6770. @section pad
  6771. Add paddings to the input image, and place the original input at the
  6772. provided @var{x}, @var{y} coordinates.
  6773. It accepts the following parameters:
  6774. @table @option
  6775. @item width, w
  6776. @item height, h
  6777. Specify an expression for the size of the output image with the
  6778. paddings added. If the value for @var{width} or @var{height} is 0, the
  6779. corresponding input size is used for the output.
  6780. The @var{width} expression can reference the value set by the
  6781. @var{height} expression, and vice versa.
  6782. The default value of @var{width} and @var{height} is 0.
  6783. @item x
  6784. @item y
  6785. Specify the offsets to place the input image at within the padded area,
  6786. with respect to the top/left border of the output image.
  6787. The @var{x} expression can reference the value set by the @var{y}
  6788. expression, and vice versa.
  6789. The default value of @var{x} and @var{y} is 0.
  6790. @item color
  6791. Specify the color of the padded area. For the syntax of this option,
  6792. check the "Color" section in the ffmpeg-utils manual.
  6793. The default value of @var{color} is "black".
  6794. @end table
  6795. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  6796. options are expressions containing the following constants:
  6797. @table @option
  6798. @item in_w
  6799. @item in_h
  6800. The input video width and height.
  6801. @item iw
  6802. @item ih
  6803. These are the same as @var{in_w} and @var{in_h}.
  6804. @item out_w
  6805. @item out_h
  6806. The output width and height (the size of the padded area), as
  6807. specified by the @var{width} and @var{height} expressions.
  6808. @item ow
  6809. @item oh
  6810. These are the same as @var{out_w} and @var{out_h}.
  6811. @item x
  6812. @item y
  6813. The x and y offsets as specified by the @var{x} and @var{y}
  6814. expressions, or NAN if not yet specified.
  6815. @item a
  6816. same as @var{iw} / @var{ih}
  6817. @item sar
  6818. input sample aspect ratio
  6819. @item dar
  6820. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6821. @item hsub
  6822. @item vsub
  6823. The horizontal and vertical chroma subsample values. For example for the
  6824. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6825. @end table
  6826. @subsection Examples
  6827. @itemize
  6828. @item
  6829. Add paddings with the color "violet" to the input video. The output video
  6830. size is 640x480, and the top-left corner of the input video is placed at
  6831. column 0, row 40
  6832. @example
  6833. pad=640:480:0:40:violet
  6834. @end example
  6835. The example above is equivalent to the following command:
  6836. @example
  6837. pad=width=640:height=480:x=0:y=40:color=violet
  6838. @end example
  6839. @item
  6840. Pad the input to get an output with dimensions increased by 3/2,
  6841. and put the input video at the center of the padded area:
  6842. @example
  6843. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  6844. @end example
  6845. @item
  6846. Pad the input to get a squared output with size equal to the maximum
  6847. value between the input width and height, and put the input video at
  6848. the center of the padded area:
  6849. @example
  6850. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  6851. @end example
  6852. @item
  6853. Pad the input to get a final w/h ratio of 16:9:
  6854. @example
  6855. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  6856. @end example
  6857. @item
  6858. In case of anamorphic video, in order to set the output display aspect
  6859. correctly, it is necessary to use @var{sar} in the expression,
  6860. according to the relation:
  6861. @example
  6862. (ih * X / ih) * sar = output_dar
  6863. X = output_dar / sar
  6864. @end example
  6865. Thus the previous example needs to be modified to:
  6866. @example
  6867. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  6868. @end example
  6869. @item
  6870. Double the output size and put the input video in the bottom-right
  6871. corner of the output padded area:
  6872. @example
  6873. pad="2*iw:2*ih:ow-iw:oh-ih"
  6874. @end example
  6875. @end itemize
  6876. @anchor{palettegen}
  6877. @section palettegen
  6878. Generate one palette for a whole video stream.
  6879. It accepts the following options:
  6880. @table @option
  6881. @item max_colors
  6882. Set the maximum number of colors to quantize in the palette.
  6883. Note: the palette will still contain 256 colors; the unused palette entries
  6884. will be black.
  6885. @item reserve_transparent
  6886. Create a palette of 255 colors maximum and reserve the last one for
  6887. transparency. Reserving the transparency color is useful for GIF optimization.
  6888. If not set, the maximum of colors in the palette will be 256. You probably want
  6889. to disable this option for a standalone image.
  6890. Set by default.
  6891. @item stats_mode
  6892. Set statistics mode.
  6893. It accepts the following values:
  6894. @table @samp
  6895. @item full
  6896. Compute full frame histograms.
  6897. @item diff
  6898. Compute histograms only for the part that differs from previous frame. This
  6899. might be relevant to give more importance to the moving part of your input if
  6900. the background is static.
  6901. @end table
  6902. Default value is @var{full}.
  6903. @end table
  6904. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  6905. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  6906. color quantization of the palette. This information is also visible at
  6907. @var{info} logging level.
  6908. @subsection Examples
  6909. @itemize
  6910. @item
  6911. Generate a representative palette of a given video using @command{ffmpeg}:
  6912. @example
  6913. ffmpeg -i input.mkv -vf palettegen palette.png
  6914. @end example
  6915. @end itemize
  6916. @section paletteuse
  6917. Use a palette to downsample an input video stream.
  6918. The filter takes two inputs: one video stream and a palette. The palette must
  6919. be a 256 pixels image.
  6920. It accepts the following options:
  6921. @table @option
  6922. @item dither
  6923. Select dithering mode. Available algorithms are:
  6924. @table @samp
  6925. @item bayer
  6926. Ordered 8x8 bayer dithering (deterministic)
  6927. @item heckbert
  6928. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  6929. Note: this dithering is sometimes considered "wrong" and is included as a
  6930. reference.
  6931. @item floyd_steinberg
  6932. Floyd and Steingberg dithering (error diffusion)
  6933. @item sierra2
  6934. Frankie Sierra dithering v2 (error diffusion)
  6935. @item sierra2_4a
  6936. Frankie Sierra dithering v2 "Lite" (error diffusion)
  6937. @end table
  6938. Default is @var{sierra2_4a}.
  6939. @item bayer_scale
  6940. When @var{bayer} dithering is selected, this option defines the scale of the
  6941. pattern (how much the crosshatch pattern is visible). A low value means more
  6942. visible pattern for less banding, and higher value means less visible pattern
  6943. at the cost of more banding.
  6944. The option must be an integer value in the range [0,5]. Default is @var{2}.
  6945. @item diff_mode
  6946. If set, define the zone to process
  6947. @table @samp
  6948. @item rectangle
  6949. Only the changing rectangle will be reprocessed. This is similar to GIF
  6950. cropping/offsetting compression mechanism. This option can be useful for speed
  6951. if only a part of the image is changing, and has use cases such as limiting the
  6952. scope of the error diffusal @option{dither} to the rectangle that bounds the
  6953. moving scene (it leads to more deterministic output if the scene doesn't change
  6954. much, and as a result less moving noise and better GIF compression).
  6955. @end table
  6956. Default is @var{none}.
  6957. @end table
  6958. @subsection Examples
  6959. @itemize
  6960. @item
  6961. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  6962. using @command{ffmpeg}:
  6963. @example
  6964. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  6965. @end example
  6966. @end itemize
  6967. @section perspective
  6968. Correct perspective of video not recorded perpendicular to the screen.
  6969. A description of the accepted parameters follows.
  6970. @table @option
  6971. @item x0
  6972. @item y0
  6973. @item x1
  6974. @item y1
  6975. @item x2
  6976. @item y2
  6977. @item x3
  6978. @item y3
  6979. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  6980. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  6981. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  6982. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  6983. then the corners of the source will be sent to the specified coordinates.
  6984. The expressions can use the following variables:
  6985. @table @option
  6986. @item W
  6987. @item H
  6988. the width and height of video frame.
  6989. @end table
  6990. @item interpolation
  6991. Set interpolation for perspective correction.
  6992. It accepts the following values:
  6993. @table @samp
  6994. @item linear
  6995. @item cubic
  6996. @end table
  6997. Default value is @samp{linear}.
  6998. @item sense
  6999. Set interpretation of coordinate options.
  7000. It accepts the following values:
  7001. @table @samp
  7002. @item 0, source
  7003. Send point in the source specified by the given coordinates to
  7004. the corners of the destination.
  7005. @item 1, destination
  7006. Send the corners of the source to the point in the destination specified
  7007. by the given coordinates.
  7008. Default value is @samp{source}.
  7009. @end table
  7010. @end table
  7011. @section phase
  7012. Delay interlaced video by one field time so that the field order changes.
  7013. The intended use is to fix PAL movies that have been captured with the
  7014. opposite field order to the film-to-video transfer.
  7015. A description of the accepted parameters follows.
  7016. @table @option
  7017. @item mode
  7018. Set phase mode.
  7019. It accepts the following values:
  7020. @table @samp
  7021. @item t
  7022. Capture field order top-first, transfer bottom-first.
  7023. Filter will delay the bottom field.
  7024. @item b
  7025. Capture field order bottom-first, transfer top-first.
  7026. Filter will delay the top field.
  7027. @item p
  7028. Capture and transfer with the same field order. This mode only exists
  7029. for the documentation of the other options to refer to, but if you
  7030. actually select it, the filter will faithfully do nothing.
  7031. @item a
  7032. Capture field order determined automatically by field flags, transfer
  7033. opposite.
  7034. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  7035. basis using field flags. If no field information is available,
  7036. then this works just like @samp{u}.
  7037. @item u
  7038. Capture unknown or varying, transfer opposite.
  7039. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  7040. analyzing the images and selecting the alternative that produces best
  7041. match between the fields.
  7042. @item T
  7043. Capture top-first, transfer unknown or varying.
  7044. Filter selects among @samp{t} and @samp{p} using image analysis.
  7045. @item B
  7046. Capture bottom-first, transfer unknown or varying.
  7047. Filter selects among @samp{b} and @samp{p} using image analysis.
  7048. @item A
  7049. Capture determined by field flags, transfer unknown or varying.
  7050. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  7051. image analysis. If no field information is available, then this works just
  7052. like @samp{U}. This is the default mode.
  7053. @item U
  7054. Both capture and transfer unknown or varying.
  7055. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  7056. @end table
  7057. @end table
  7058. @section pixdesctest
  7059. Pixel format descriptor test filter, mainly useful for internal
  7060. testing. The output video should be equal to the input video.
  7061. For example:
  7062. @example
  7063. format=monow, pixdesctest
  7064. @end example
  7065. can be used to test the monowhite pixel format descriptor definition.
  7066. @section pp
  7067. Enable the specified chain of postprocessing subfilters using libpostproc. This
  7068. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  7069. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  7070. Each subfilter and some options have a short and a long name that can be used
  7071. interchangeably, i.e. dr/dering are the same.
  7072. The filters accept the following options:
  7073. @table @option
  7074. @item subfilters
  7075. Set postprocessing subfilters string.
  7076. @end table
  7077. All subfilters share common options to determine their scope:
  7078. @table @option
  7079. @item a/autoq
  7080. Honor the quality commands for this subfilter.
  7081. @item c/chrom
  7082. Do chrominance filtering, too (default).
  7083. @item y/nochrom
  7084. Do luminance filtering only (no chrominance).
  7085. @item n/noluma
  7086. Do chrominance filtering only (no luminance).
  7087. @end table
  7088. These options can be appended after the subfilter name, separated by a '|'.
  7089. Available subfilters are:
  7090. @table @option
  7091. @item hb/hdeblock[|difference[|flatness]]
  7092. Horizontal deblocking filter
  7093. @table @option
  7094. @item difference
  7095. Difference factor where higher values mean more deblocking (default: @code{32}).
  7096. @item flatness
  7097. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7098. @end table
  7099. @item vb/vdeblock[|difference[|flatness]]
  7100. Vertical deblocking filter
  7101. @table @option
  7102. @item difference
  7103. Difference factor where higher values mean more deblocking (default: @code{32}).
  7104. @item flatness
  7105. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7106. @end table
  7107. @item ha/hadeblock[|difference[|flatness]]
  7108. Accurate horizontal deblocking filter
  7109. @table @option
  7110. @item difference
  7111. Difference factor where higher values mean more deblocking (default: @code{32}).
  7112. @item flatness
  7113. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7114. @end table
  7115. @item va/vadeblock[|difference[|flatness]]
  7116. Accurate vertical deblocking filter
  7117. @table @option
  7118. @item difference
  7119. Difference factor where higher values mean more deblocking (default: @code{32}).
  7120. @item flatness
  7121. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7122. @end table
  7123. @end table
  7124. The horizontal and vertical deblocking filters share the difference and
  7125. flatness values so you cannot set different horizontal and vertical
  7126. thresholds.
  7127. @table @option
  7128. @item h1/x1hdeblock
  7129. Experimental horizontal deblocking filter
  7130. @item v1/x1vdeblock
  7131. Experimental vertical deblocking filter
  7132. @item dr/dering
  7133. Deringing filter
  7134. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  7135. @table @option
  7136. @item threshold1
  7137. larger -> stronger filtering
  7138. @item threshold2
  7139. larger -> stronger filtering
  7140. @item threshold3
  7141. larger -> stronger filtering
  7142. @end table
  7143. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  7144. @table @option
  7145. @item f/fullyrange
  7146. Stretch luminance to @code{0-255}.
  7147. @end table
  7148. @item lb/linblenddeint
  7149. Linear blend deinterlacing filter that deinterlaces the given block by
  7150. filtering all lines with a @code{(1 2 1)} filter.
  7151. @item li/linipoldeint
  7152. Linear interpolating deinterlacing filter that deinterlaces the given block by
  7153. linearly interpolating every second line.
  7154. @item ci/cubicipoldeint
  7155. Cubic interpolating deinterlacing filter deinterlaces the given block by
  7156. cubically interpolating every second line.
  7157. @item md/mediandeint
  7158. Median deinterlacing filter that deinterlaces the given block by applying a
  7159. median filter to every second line.
  7160. @item fd/ffmpegdeint
  7161. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  7162. second line with a @code{(-1 4 2 4 -1)} filter.
  7163. @item l5/lowpass5
  7164. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  7165. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  7166. @item fq/forceQuant[|quantizer]
  7167. Overrides the quantizer table from the input with the constant quantizer you
  7168. specify.
  7169. @table @option
  7170. @item quantizer
  7171. Quantizer to use
  7172. @end table
  7173. @item de/default
  7174. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  7175. @item fa/fast
  7176. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  7177. @item ac
  7178. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  7179. @end table
  7180. @subsection Examples
  7181. @itemize
  7182. @item
  7183. Apply horizontal and vertical deblocking, deringing and automatic
  7184. brightness/contrast:
  7185. @example
  7186. pp=hb/vb/dr/al
  7187. @end example
  7188. @item
  7189. Apply default filters without brightness/contrast correction:
  7190. @example
  7191. pp=de/-al
  7192. @end example
  7193. @item
  7194. Apply default filters and temporal denoiser:
  7195. @example
  7196. pp=default/tmpnoise|1|2|3
  7197. @end example
  7198. @item
  7199. Apply deblocking on luminance only, and switch vertical deblocking on or off
  7200. automatically depending on available CPU time:
  7201. @example
  7202. pp=hb|y/vb|a
  7203. @end example
  7204. @end itemize
  7205. @section pp7
  7206. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  7207. similar to spp = 6 with 7 point DCT, where only the center sample is
  7208. used after IDCT.
  7209. The filter accepts the following options:
  7210. @table @option
  7211. @item qp
  7212. Force a constant quantization parameter. It accepts an integer in range
  7213. 0 to 63. If not set, the filter will use the QP from the video stream
  7214. (if available).
  7215. @item mode
  7216. Set thresholding mode. Available modes are:
  7217. @table @samp
  7218. @item hard
  7219. Set hard thresholding.
  7220. @item soft
  7221. Set soft thresholding (better de-ringing effect, but likely blurrier).
  7222. @item medium
  7223. Set medium thresholding (good results, default).
  7224. @end table
  7225. @end table
  7226. @section psnr
  7227. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  7228. Ratio) between two input videos.
  7229. This filter takes in input two input videos, the first input is
  7230. considered the "main" source and is passed unchanged to the
  7231. output. The second input is used as a "reference" video for computing
  7232. the PSNR.
  7233. Both video inputs must have the same resolution and pixel format for
  7234. this filter to work correctly. Also it assumes that both inputs
  7235. have the same number of frames, which are compared one by one.
  7236. The obtained average PSNR is printed through the logging system.
  7237. The filter stores the accumulated MSE (mean squared error) of each
  7238. frame, and at the end of the processing it is averaged across all frames
  7239. equally, and the following formula is applied to obtain the PSNR:
  7240. @example
  7241. PSNR = 10*log10(MAX^2/MSE)
  7242. @end example
  7243. Where MAX is the average of the maximum values of each component of the
  7244. image.
  7245. The description of the accepted parameters follows.
  7246. @table @option
  7247. @item stats_file, f
  7248. If specified the filter will use the named file to save the PSNR of
  7249. each individual frame. When filename equals "-" the data is sent to
  7250. standard output.
  7251. @end table
  7252. The file printed if @var{stats_file} is selected, contains a sequence of
  7253. key/value pairs of the form @var{key}:@var{value} for each compared
  7254. couple of frames.
  7255. A description of each shown parameter follows:
  7256. @table @option
  7257. @item n
  7258. sequential number of the input frame, starting from 1
  7259. @item mse_avg
  7260. Mean Square Error pixel-by-pixel average difference of the compared
  7261. frames, averaged over all the image components.
  7262. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  7263. Mean Square Error pixel-by-pixel average difference of the compared
  7264. frames for the component specified by the suffix.
  7265. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  7266. Peak Signal to Noise ratio of the compared frames for the component
  7267. specified by the suffix.
  7268. @end table
  7269. For example:
  7270. @example
  7271. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7272. [main][ref] psnr="stats_file=stats.log" [out]
  7273. @end example
  7274. On this example the input file being processed is compared with the
  7275. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  7276. is stored in @file{stats.log}.
  7277. @anchor{pullup}
  7278. @section pullup
  7279. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  7280. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  7281. content.
  7282. The pullup filter is designed to take advantage of future context in making
  7283. its decisions. This filter is stateless in the sense that it does not lock
  7284. onto a pattern to follow, but it instead looks forward to the following
  7285. fields in order to identify matches and rebuild progressive frames.
  7286. To produce content with an even framerate, insert the fps filter after
  7287. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  7288. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  7289. The filter accepts the following options:
  7290. @table @option
  7291. @item jl
  7292. @item jr
  7293. @item jt
  7294. @item jb
  7295. These options set the amount of "junk" to ignore at the left, right, top, and
  7296. bottom of the image, respectively. Left and right are in units of 8 pixels,
  7297. while top and bottom are in units of 2 lines.
  7298. The default is 8 pixels on each side.
  7299. @item sb
  7300. Set the strict breaks. Setting this option to 1 will reduce the chances of
  7301. filter generating an occasional mismatched frame, but it may also cause an
  7302. excessive number of frames to be dropped during high motion sequences.
  7303. Conversely, setting it to -1 will make filter match fields more easily.
  7304. This may help processing of video where there is slight blurring between
  7305. the fields, but may also cause there to be interlaced frames in the output.
  7306. Default value is @code{0}.
  7307. @item mp
  7308. Set the metric plane to use. It accepts the following values:
  7309. @table @samp
  7310. @item l
  7311. Use luma plane.
  7312. @item u
  7313. Use chroma blue plane.
  7314. @item v
  7315. Use chroma red plane.
  7316. @end table
  7317. This option may be set to use chroma plane instead of the default luma plane
  7318. for doing filter's computations. This may improve accuracy on very clean
  7319. source material, but more likely will decrease accuracy, especially if there
  7320. is chroma noise (rainbow effect) or any grayscale video.
  7321. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  7322. load and make pullup usable in realtime on slow machines.
  7323. @end table
  7324. For best results (without duplicated frames in the output file) it is
  7325. necessary to change the output frame rate. For example, to inverse
  7326. telecine NTSC input:
  7327. @example
  7328. ffmpeg -i input -vf pullup -r 24000/1001 ...
  7329. @end example
  7330. @section qp
  7331. Change video quantization parameters (QP).
  7332. The filter accepts the following option:
  7333. @table @option
  7334. @item qp
  7335. Set expression for quantization parameter.
  7336. @end table
  7337. The expression is evaluated through the eval API and can contain, among others,
  7338. the following constants:
  7339. @table @var
  7340. @item known
  7341. 1 if index is not 129, 0 otherwise.
  7342. @item qp
  7343. Sequentional index starting from -129 to 128.
  7344. @end table
  7345. @subsection Examples
  7346. @itemize
  7347. @item
  7348. Some equation like:
  7349. @example
  7350. qp=2+2*sin(PI*qp)
  7351. @end example
  7352. @end itemize
  7353. @section random
  7354. Flush video frames from internal cache of frames into a random order.
  7355. No frame is discarded.
  7356. Inspired by @ref{frei0r} nervous filter.
  7357. @table @option
  7358. @item frames
  7359. Set size in number of frames of internal cache, in range from @code{2} to
  7360. @code{512}. Default is @code{30}.
  7361. @item seed
  7362. Set seed for random number generator, must be an integer included between
  7363. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  7364. less than @code{0}, the filter will try to use a good random seed on a
  7365. best effort basis.
  7366. @end table
  7367. @section removegrain
  7368. The removegrain filter is a spatial denoiser for progressive video.
  7369. @table @option
  7370. @item m0
  7371. Set mode for the first plane.
  7372. @item m1
  7373. Set mode for the second plane.
  7374. @item m2
  7375. Set mode for the third plane.
  7376. @item m3
  7377. Set mode for the fourth plane.
  7378. @end table
  7379. Range of mode is from 0 to 24. Description of each mode follows:
  7380. @table @var
  7381. @item 0
  7382. Leave input plane unchanged. Default.
  7383. @item 1
  7384. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  7385. @item 2
  7386. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  7387. @item 3
  7388. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  7389. @item 4
  7390. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  7391. This is equivalent to a median filter.
  7392. @item 5
  7393. Line-sensitive clipping giving the minimal change.
  7394. @item 6
  7395. Line-sensitive clipping, intermediate.
  7396. @item 7
  7397. Line-sensitive clipping, intermediate.
  7398. @item 8
  7399. Line-sensitive clipping, intermediate.
  7400. @item 9
  7401. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  7402. @item 10
  7403. Replaces the target pixel with the closest neighbour.
  7404. @item 11
  7405. [1 2 1] horizontal and vertical kernel blur.
  7406. @item 12
  7407. Same as mode 11.
  7408. @item 13
  7409. Bob mode, interpolates top field from the line where the neighbours
  7410. pixels are the closest.
  7411. @item 14
  7412. Bob mode, interpolates bottom field from the line where the neighbours
  7413. pixels are the closest.
  7414. @item 15
  7415. Bob mode, interpolates top field. Same as 13 but with a more complicated
  7416. interpolation formula.
  7417. @item 16
  7418. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  7419. interpolation formula.
  7420. @item 17
  7421. Clips the pixel with the minimum and maximum of respectively the maximum and
  7422. minimum of each pair of opposite neighbour pixels.
  7423. @item 18
  7424. Line-sensitive clipping using opposite neighbours whose greatest distance from
  7425. the current pixel is minimal.
  7426. @item 19
  7427. Replaces the pixel with the average of its 8 neighbours.
  7428. @item 20
  7429. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  7430. @item 21
  7431. Clips pixels using the averages of opposite neighbour.
  7432. @item 22
  7433. Same as mode 21 but simpler and faster.
  7434. @item 23
  7435. Small edge and halo removal, but reputed useless.
  7436. @item 24
  7437. Similar as 23.
  7438. @end table
  7439. @section removelogo
  7440. Suppress a TV station logo, using an image file to determine which
  7441. pixels comprise the logo. It works by filling in the pixels that
  7442. comprise the logo with neighboring pixels.
  7443. The filter accepts the following options:
  7444. @table @option
  7445. @item filename, f
  7446. Set the filter bitmap file, which can be any image format supported by
  7447. libavformat. The width and height of the image file must match those of the
  7448. video stream being processed.
  7449. @end table
  7450. Pixels in the provided bitmap image with a value of zero are not
  7451. considered part of the logo, non-zero pixels are considered part of
  7452. the logo. If you use white (255) for the logo and black (0) for the
  7453. rest, you will be safe. For making the filter bitmap, it is
  7454. recommended to take a screen capture of a black frame with the logo
  7455. visible, and then using a threshold filter followed by the erode
  7456. filter once or twice.
  7457. If needed, little splotches can be fixed manually. Remember that if
  7458. logo pixels are not covered, the filter quality will be much
  7459. reduced. Marking too many pixels as part of the logo does not hurt as
  7460. much, but it will increase the amount of blurring needed to cover over
  7461. the image and will destroy more information than necessary, and extra
  7462. pixels will slow things down on a large logo.
  7463. @section repeatfields
  7464. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  7465. fields based on its value.
  7466. @section reverse, areverse
  7467. Reverse a clip.
  7468. Warning: This filter requires memory to buffer the entire clip, so trimming
  7469. is suggested.
  7470. @subsection Examples
  7471. @itemize
  7472. @item
  7473. Take the first 5 seconds of a clip, and reverse it.
  7474. @example
  7475. trim=end=5,reverse
  7476. @end example
  7477. @end itemize
  7478. @section rotate
  7479. Rotate video by an arbitrary angle expressed in radians.
  7480. The filter accepts the following options:
  7481. A description of the optional parameters follows.
  7482. @table @option
  7483. @item angle, a
  7484. Set an expression for the angle by which to rotate the input video
  7485. clockwise, expressed as a number of radians. A negative value will
  7486. result in a counter-clockwise rotation. By default it is set to "0".
  7487. This expression is evaluated for each frame.
  7488. @item out_w, ow
  7489. Set the output width expression, default value is "iw".
  7490. This expression is evaluated just once during configuration.
  7491. @item out_h, oh
  7492. Set the output height expression, default value is "ih".
  7493. This expression is evaluated just once during configuration.
  7494. @item bilinear
  7495. Enable bilinear interpolation if set to 1, a value of 0 disables
  7496. it. Default value is 1.
  7497. @item fillcolor, c
  7498. Set the color used to fill the output area not covered by the rotated
  7499. image. For the general syntax of this option, check the "Color" section in the
  7500. ffmpeg-utils manual. If the special value "none" is selected then no
  7501. background is printed (useful for example if the background is never shown).
  7502. Default value is "black".
  7503. @end table
  7504. The expressions for the angle and the output size can contain the
  7505. following constants and functions:
  7506. @table @option
  7507. @item n
  7508. sequential number of the input frame, starting from 0. It is always NAN
  7509. before the first frame is filtered.
  7510. @item t
  7511. time in seconds of the input frame, it is set to 0 when the filter is
  7512. configured. It is always NAN before the first frame is filtered.
  7513. @item hsub
  7514. @item vsub
  7515. horizontal and vertical chroma subsample values. For example for the
  7516. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7517. @item in_w, iw
  7518. @item in_h, ih
  7519. the input video width and height
  7520. @item out_w, ow
  7521. @item out_h, oh
  7522. the output width and height, that is the size of the padded area as
  7523. specified by the @var{width} and @var{height} expressions
  7524. @item rotw(a)
  7525. @item roth(a)
  7526. the minimal width/height required for completely containing the input
  7527. video rotated by @var{a} radians.
  7528. These are only available when computing the @option{out_w} and
  7529. @option{out_h} expressions.
  7530. @end table
  7531. @subsection Examples
  7532. @itemize
  7533. @item
  7534. Rotate the input by PI/6 radians clockwise:
  7535. @example
  7536. rotate=PI/6
  7537. @end example
  7538. @item
  7539. Rotate the input by PI/6 radians counter-clockwise:
  7540. @example
  7541. rotate=-PI/6
  7542. @end example
  7543. @item
  7544. Rotate the input by 45 degrees clockwise:
  7545. @example
  7546. rotate=45*PI/180
  7547. @end example
  7548. @item
  7549. Apply a constant rotation with period T, starting from an angle of PI/3:
  7550. @example
  7551. rotate=PI/3+2*PI*t/T
  7552. @end example
  7553. @item
  7554. Make the input video rotation oscillating with a period of T
  7555. seconds and an amplitude of A radians:
  7556. @example
  7557. rotate=A*sin(2*PI/T*t)
  7558. @end example
  7559. @item
  7560. Rotate the video, output size is chosen so that the whole rotating
  7561. input video is always completely contained in the output:
  7562. @example
  7563. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  7564. @end example
  7565. @item
  7566. Rotate the video, reduce the output size so that no background is ever
  7567. shown:
  7568. @example
  7569. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  7570. @end example
  7571. @end itemize
  7572. @subsection Commands
  7573. The filter supports the following commands:
  7574. @table @option
  7575. @item a, angle
  7576. Set the angle expression.
  7577. The command accepts the same syntax of the corresponding option.
  7578. If the specified expression is not valid, it is kept at its current
  7579. value.
  7580. @end table
  7581. @section sab
  7582. Apply Shape Adaptive Blur.
  7583. The filter accepts the following options:
  7584. @table @option
  7585. @item luma_radius, lr
  7586. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  7587. value is 1.0. A greater value will result in a more blurred image, and
  7588. in slower processing.
  7589. @item luma_pre_filter_radius, lpfr
  7590. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  7591. value is 1.0.
  7592. @item luma_strength, ls
  7593. Set luma maximum difference between pixels to still be considered, must
  7594. be a value in the 0.1-100.0 range, default value is 1.0.
  7595. @item chroma_radius, cr
  7596. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  7597. greater value will result in a more blurred image, and in slower
  7598. processing.
  7599. @item chroma_pre_filter_radius, cpfr
  7600. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  7601. @item chroma_strength, cs
  7602. Set chroma maximum difference between pixels to still be considered,
  7603. must be a value in the 0.1-100.0 range.
  7604. @end table
  7605. Each chroma option value, if not explicitly specified, is set to the
  7606. corresponding luma option value.
  7607. @anchor{scale}
  7608. @section scale
  7609. Scale (resize) the input video, using the libswscale library.
  7610. The scale filter forces the output display aspect ratio to be the same
  7611. of the input, by changing the output sample aspect ratio.
  7612. If the input image format is different from the format requested by
  7613. the next filter, the scale filter will convert the input to the
  7614. requested format.
  7615. @subsection Options
  7616. The filter accepts the following options, or any of the options
  7617. supported by the libswscale scaler.
  7618. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  7619. the complete list of scaler options.
  7620. @table @option
  7621. @item width, w
  7622. @item height, h
  7623. Set the output video dimension expression. Default value is the input
  7624. dimension.
  7625. If the value is 0, the input width is used for the output.
  7626. If one of the values is -1, the scale filter will use a value that
  7627. maintains the aspect ratio of the input image, calculated from the
  7628. other specified dimension. If both of them are -1, the input size is
  7629. used
  7630. If one of the values is -n with n > 1, the scale filter will also use a value
  7631. that maintains the aspect ratio of the input image, calculated from the other
  7632. specified dimension. After that it will, however, make sure that the calculated
  7633. dimension is divisible by n and adjust the value if necessary.
  7634. See below for the list of accepted constants for use in the dimension
  7635. expression.
  7636. @item interl
  7637. Set the interlacing mode. It accepts the following values:
  7638. @table @samp
  7639. @item 1
  7640. Force interlaced aware scaling.
  7641. @item 0
  7642. Do not apply interlaced scaling.
  7643. @item -1
  7644. Select interlaced aware scaling depending on whether the source frames
  7645. are flagged as interlaced or not.
  7646. @end table
  7647. Default value is @samp{0}.
  7648. @item flags
  7649. Set libswscale scaling flags. See
  7650. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  7651. complete list of values. If not explicitly specified the filter applies
  7652. the default flags.
  7653. @item size, s
  7654. Set the video size. For the syntax of this option, check the
  7655. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7656. @item in_color_matrix
  7657. @item out_color_matrix
  7658. Set in/output YCbCr color space type.
  7659. This allows the autodetected value to be overridden as well as allows forcing
  7660. a specific value used for the output and encoder.
  7661. If not specified, the color space type depends on the pixel format.
  7662. Possible values:
  7663. @table @samp
  7664. @item auto
  7665. Choose automatically.
  7666. @item bt709
  7667. Format conforming to International Telecommunication Union (ITU)
  7668. Recommendation BT.709.
  7669. @item fcc
  7670. Set color space conforming to the United States Federal Communications
  7671. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  7672. @item bt601
  7673. Set color space conforming to:
  7674. @itemize
  7675. @item
  7676. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  7677. @item
  7678. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  7679. @item
  7680. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  7681. @end itemize
  7682. @item smpte240m
  7683. Set color space conforming to SMPTE ST 240:1999.
  7684. @end table
  7685. @item in_range
  7686. @item out_range
  7687. Set in/output YCbCr sample range.
  7688. This allows the autodetected value to be overridden as well as allows forcing
  7689. a specific value used for the output and encoder. If not specified, the
  7690. range depends on the pixel format. Possible values:
  7691. @table @samp
  7692. @item auto
  7693. Choose automatically.
  7694. @item jpeg/full/pc
  7695. Set full range (0-255 in case of 8-bit luma).
  7696. @item mpeg/tv
  7697. Set "MPEG" range (16-235 in case of 8-bit luma).
  7698. @end table
  7699. @item force_original_aspect_ratio
  7700. Enable decreasing or increasing output video width or height if necessary to
  7701. keep the original aspect ratio. Possible values:
  7702. @table @samp
  7703. @item disable
  7704. Scale the video as specified and disable this feature.
  7705. @item decrease
  7706. The output video dimensions will automatically be decreased if needed.
  7707. @item increase
  7708. The output video dimensions will automatically be increased if needed.
  7709. @end table
  7710. One useful instance of this option is that when you know a specific device's
  7711. maximum allowed resolution, you can use this to limit the output video to
  7712. that, while retaining the aspect ratio. For example, device A allows
  7713. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  7714. decrease) and specifying 1280x720 to the command line makes the output
  7715. 1280x533.
  7716. Please note that this is a different thing than specifying -1 for @option{w}
  7717. or @option{h}, you still need to specify the output resolution for this option
  7718. to work.
  7719. @end table
  7720. The values of the @option{w} and @option{h} options are expressions
  7721. containing the following constants:
  7722. @table @var
  7723. @item in_w
  7724. @item in_h
  7725. The input width and height
  7726. @item iw
  7727. @item ih
  7728. These are the same as @var{in_w} and @var{in_h}.
  7729. @item out_w
  7730. @item out_h
  7731. The output (scaled) width and height
  7732. @item ow
  7733. @item oh
  7734. These are the same as @var{out_w} and @var{out_h}
  7735. @item a
  7736. The same as @var{iw} / @var{ih}
  7737. @item sar
  7738. input sample aspect ratio
  7739. @item dar
  7740. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  7741. @item hsub
  7742. @item vsub
  7743. horizontal and vertical input chroma subsample values. For example for the
  7744. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7745. @item ohsub
  7746. @item ovsub
  7747. horizontal and vertical output chroma subsample values. For example for the
  7748. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7749. @end table
  7750. @subsection Examples
  7751. @itemize
  7752. @item
  7753. Scale the input video to a size of 200x100
  7754. @example
  7755. scale=w=200:h=100
  7756. @end example
  7757. This is equivalent to:
  7758. @example
  7759. scale=200:100
  7760. @end example
  7761. or:
  7762. @example
  7763. scale=200x100
  7764. @end example
  7765. @item
  7766. Specify a size abbreviation for the output size:
  7767. @example
  7768. scale=qcif
  7769. @end example
  7770. which can also be written as:
  7771. @example
  7772. scale=size=qcif
  7773. @end example
  7774. @item
  7775. Scale the input to 2x:
  7776. @example
  7777. scale=w=2*iw:h=2*ih
  7778. @end example
  7779. @item
  7780. The above is the same as:
  7781. @example
  7782. scale=2*in_w:2*in_h
  7783. @end example
  7784. @item
  7785. Scale the input to 2x with forced interlaced scaling:
  7786. @example
  7787. scale=2*iw:2*ih:interl=1
  7788. @end example
  7789. @item
  7790. Scale the input to half size:
  7791. @example
  7792. scale=w=iw/2:h=ih/2
  7793. @end example
  7794. @item
  7795. Increase the width, and set the height to the same size:
  7796. @example
  7797. scale=3/2*iw:ow
  7798. @end example
  7799. @item
  7800. Seek Greek harmony:
  7801. @example
  7802. scale=iw:1/PHI*iw
  7803. scale=ih*PHI:ih
  7804. @end example
  7805. @item
  7806. Increase the height, and set the width to 3/2 of the height:
  7807. @example
  7808. scale=w=3/2*oh:h=3/5*ih
  7809. @end example
  7810. @item
  7811. Increase the size, making the size a multiple of the chroma
  7812. subsample values:
  7813. @example
  7814. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  7815. @end example
  7816. @item
  7817. Increase the width to a maximum of 500 pixels,
  7818. keeping the same aspect ratio as the input:
  7819. @example
  7820. scale=w='min(500\, iw*3/2):h=-1'
  7821. @end example
  7822. @end itemize
  7823. @subsection Commands
  7824. This filter supports the following commands:
  7825. @table @option
  7826. @item width, w
  7827. @item height, h
  7828. Set the output video dimension expression.
  7829. The command accepts the same syntax of the corresponding option.
  7830. If the specified expression is not valid, it is kept at its current
  7831. value.
  7832. @end table
  7833. @section scale2ref
  7834. Scale (resize) the input video, based on a reference video.
  7835. See the scale filter for available options, scale2ref supports the same but
  7836. uses the reference video instead of the main input as basis.
  7837. @subsection Examples
  7838. @itemize
  7839. @item
  7840. Scale a subtitle stream to match the main video in size before overlaying
  7841. @example
  7842. 'scale2ref[b][a];[a][b]overlay'
  7843. @end example
  7844. @end itemize
  7845. @section selectivecolor
  7846. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  7847. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  7848. by the "purity" of the color (that is, how saturated it already is).
  7849. This filter is similar to the Adobe Photoshop Selective Color tool.
  7850. The filter accepts the following options:
  7851. @table @option
  7852. @item correction_method
  7853. Select color correction method.
  7854. Available values are:
  7855. @table @samp
  7856. @item absolute
  7857. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  7858. component value).
  7859. @item relative
  7860. Specified adjustments are relative to the original component value.
  7861. @end table
  7862. Default is @code{absolute}.
  7863. @item reds
  7864. Adjustments for red pixels (pixels where the red component is the maximum)
  7865. @item yellows
  7866. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  7867. @item greens
  7868. Adjustments for green pixels (pixels where the green component is the maximum)
  7869. @item cyans
  7870. Adjustments for cyan pixels (pixels where the red component is the minimum)
  7871. @item blues
  7872. Adjustments for blue pixels (pixels where the blue component is the maximum)
  7873. @item magentas
  7874. Adjustments for magenta pixels (pixels where the green component is the minimum)
  7875. @item whites
  7876. Adjustments for white pixels (pixels where all components are greater than 128)
  7877. @item neutrals
  7878. Adjustments for all pixels except pure black and pure white
  7879. @item blacks
  7880. Adjustments for black pixels (pixels where all components are lesser than 128)
  7881. @item psfile
  7882. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  7883. @end table
  7884. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  7885. 4 space separated floating point adjustment values in the [-1,1] range,
  7886. respectively to adjust the amount of cyan, magenta, yellow and black for the
  7887. pixels of its range.
  7888. @subsection Examples
  7889. @itemize
  7890. @item
  7891. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  7892. increase magenta by 27% in blue areas:
  7893. @example
  7894. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  7895. @end example
  7896. @item
  7897. Use a Photoshop selective color preset:
  7898. @example
  7899. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  7900. @end example
  7901. @end itemize
  7902. @section separatefields
  7903. The @code{separatefields} takes a frame-based video input and splits
  7904. each frame into its components fields, producing a new half height clip
  7905. with twice the frame rate and twice the frame count.
  7906. This filter use field-dominance information in frame to decide which
  7907. of each pair of fields to place first in the output.
  7908. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  7909. @section setdar, setsar
  7910. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  7911. output video.
  7912. This is done by changing the specified Sample (aka Pixel) Aspect
  7913. Ratio, according to the following equation:
  7914. @example
  7915. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  7916. @end example
  7917. Keep in mind that the @code{setdar} filter does not modify the pixel
  7918. dimensions of the video frame. Also, the display aspect ratio set by
  7919. this filter may be changed by later filters in the filterchain,
  7920. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  7921. applied.
  7922. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  7923. the filter output video.
  7924. Note that as a consequence of the application of this filter, the
  7925. output display aspect ratio will change according to the equation
  7926. above.
  7927. Keep in mind that the sample aspect ratio set by the @code{setsar}
  7928. filter may be changed by later filters in the filterchain, e.g. if
  7929. another "setsar" or a "setdar" filter is applied.
  7930. It accepts the following parameters:
  7931. @table @option
  7932. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  7933. Set the aspect ratio used by the filter.
  7934. The parameter can be a floating point number string, an expression, or
  7935. a string of the form @var{num}:@var{den}, where @var{num} and
  7936. @var{den} are the numerator and denominator of the aspect ratio. If
  7937. the parameter is not specified, it is assumed the value "0".
  7938. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  7939. should be escaped.
  7940. @item max
  7941. Set the maximum integer value to use for expressing numerator and
  7942. denominator when reducing the expressed aspect ratio to a rational.
  7943. Default value is @code{100}.
  7944. @end table
  7945. The parameter @var{sar} is an expression containing
  7946. the following constants:
  7947. @table @option
  7948. @item E, PI, PHI
  7949. These are approximated values for the mathematical constants e
  7950. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  7951. @item w, h
  7952. The input width and height.
  7953. @item a
  7954. These are the same as @var{w} / @var{h}.
  7955. @item sar
  7956. The input sample aspect ratio.
  7957. @item dar
  7958. The input display aspect ratio. It is the same as
  7959. (@var{w} / @var{h}) * @var{sar}.
  7960. @item hsub, vsub
  7961. Horizontal and vertical chroma subsample values. For example, for the
  7962. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7963. @end table
  7964. @subsection Examples
  7965. @itemize
  7966. @item
  7967. To change the display aspect ratio to 16:9, specify one of the following:
  7968. @example
  7969. setdar=dar=1.77777
  7970. setdar=dar=16/9
  7971. setdar=dar=1.77777
  7972. @end example
  7973. @item
  7974. To change the sample aspect ratio to 10:11, specify:
  7975. @example
  7976. setsar=sar=10/11
  7977. @end example
  7978. @item
  7979. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  7980. 1000 in the aspect ratio reduction, use the command:
  7981. @example
  7982. setdar=ratio=16/9:max=1000
  7983. @end example
  7984. @end itemize
  7985. @anchor{setfield}
  7986. @section setfield
  7987. Force field for the output video frame.
  7988. The @code{setfield} filter marks the interlace type field for the
  7989. output frames. It does not change the input frame, but only sets the
  7990. corresponding property, which affects how the frame is treated by
  7991. following filters (e.g. @code{fieldorder} or @code{yadif}).
  7992. The filter accepts the following options:
  7993. @table @option
  7994. @item mode
  7995. Available values are:
  7996. @table @samp
  7997. @item auto
  7998. Keep the same field property.
  7999. @item bff
  8000. Mark the frame as bottom-field-first.
  8001. @item tff
  8002. Mark the frame as top-field-first.
  8003. @item prog
  8004. Mark the frame as progressive.
  8005. @end table
  8006. @end table
  8007. @section showinfo
  8008. Show a line containing various information for each input video frame.
  8009. The input video is not modified.
  8010. The shown line contains a sequence of key/value pairs of the form
  8011. @var{key}:@var{value}.
  8012. The following values are shown in the output:
  8013. @table @option
  8014. @item n
  8015. The (sequential) number of the input frame, starting from 0.
  8016. @item pts
  8017. The Presentation TimeStamp of the input frame, expressed as a number of
  8018. time base units. The time base unit depends on the filter input pad.
  8019. @item pts_time
  8020. The Presentation TimeStamp of the input frame, expressed as a number of
  8021. seconds.
  8022. @item pos
  8023. The position of the frame in the input stream, or -1 if this information is
  8024. unavailable and/or meaningless (for example in case of synthetic video).
  8025. @item fmt
  8026. The pixel format name.
  8027. @item sar
  8028. The sample aspect ratio of the input frame, expressed in the form
  8029. @var{num}/@var{den}.
  8030. @item s
  8031. The size of the input frame. For the syntax of this option, check the
  8032. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8033. @item i
  8034. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  8035. for bottom field first).
  8036. @item iskey
  8037. This is 1 if the frame is a key frame, 0 otherwise.
  8038. @item type
  8039. The picture type of the input frame ("I" for an I-frame, "P" for a
  8040. P-frame, "B" for a B-frame, or "?" for an unknown type).
  8041. Also refer to the documentation of the @code{AVPictureType} enum and of
  8042. the @code{av_get_picture_type_char} function defined in
  8043. @file{libavutil/avutil.h}.
  8044. @item checksum
  8045. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  8046. @item plane_checksum
  8047. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  8048. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  8049. @end table
  8050. @section showpalette
  8051. Displays the 256 colors palette of each frame. This filter is only relevant for
  8052. @var{pal8} pixel format frames.
  8053. It accepts the following option:
  8054. @table @option
  8055. @item s
  8056. Set the size of the box used to represent one palette color entry. Default is
  8057. @code{30} (for a @code{30x30} pixel box).
  8058. @end table
  8059. @section shuffleframes
  8060. Reorder and/or duplicate video frames.
  8061. It accepts the following parameters:
  8062. @table @option
  8063. @item mapping
  8064. Set the destination indexes of input frames.
  8065. This is space or '|' separated list of indexes that maps input frames to output
  8066. frames. Number of indexes also sets maximal value that each index may have.
  8067. @end table
  8068. The first frame has the index 0. The default is to keep the input unchanged.
  8069. Swap second and third frame of every three frames of the input:
  8070. @example
  8071. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  8072. @end example
  8073. @section shuffleplanes
  8074. Reorder and/or duplicate video planes.
  8075. It accepts the following parameters:
  8076. @table @option
  8077. @item map0
  8078. The index of the input plane to be used as the first output plane.
  8079. @item map1
  8080. The index of the input plane to be used as the second output plane.
  8081. @item map2
  8082. The index of the input plane to be used as the third output plane.
  8083. @item map3
  8084. The index of the input plane to be used as the fourth output plane.
  8085. @end table
  8086. The first plane has the index 0. The default is to keep the input unchanged.
  8087. Swap the second and third planes of the input:
  8088. @example
  8089. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  8090. @end example
  8091. @anchor{signalstats}
  8092. @section signalstats
  8093. Evaluate various visual metrics that assist in determining issues associated
  8094. with the digitization of analog video media.
  8095. By default the filter will log these metadata values:
  8096. @table @option
  8097. @item YMIN
  8098. Display the minimal Y value contained within the input frame. Expressed in
  8099. range of [0-255].
  8100. @item YLOW
  8101. Display the Y value at the 10% percentile within the input frame. Expressed in
  8102. range of [0-255].
  8103. @item YAVG
  8104. Display the average Y value within the input frame. Expressed in range of
  8105. [0-255].
  8106. @item YHIGH
  8107. Display the Y value at the 90% percentile within the input frame. Expressed in
  8108. range of [0-255].
  8109. @item YMAX
  8110. Display the maximum Y value contained within the input frame. Expressed in
  8111. range of [0-255].
  8112. @item UMIN
  8113. Display the minimal U value contained within the input frame. Expressed in
  8114. range of [0-255].
  8115. @item ULOW
  8116. Display the U value at the 10% percentile within the input frame. Expressed in
  8117. range of [0-255].
  8118. @item UAVG
  8119. Display the average U value within the input frame. Expressed in range of
  8120. [0-255].
  8121. @item UHIGH
  8122. Display the U value at the 90% percentile within the input frame. Expressed in
  8123. range of [0-255].
  8124. @item UMAX
  8125. Display the maximum U value contained within the input frame. Expressed in
  8126. range of [0-255].
  8127. @item VMIN
  8128. Display the minimal V value contained within the input frame. Expressed in
  8129. range of [0-255].
  8130. @item VLOW
  8131. Display the V value at the 10% percentile within the input frame. Expressed in
  8132. range of [0-255].
  8133. @item VAVG
  8134. Display the average V value within the input frame. Expressed in range of
  8135. [0-255].
  8136. @item VHIGH
  8137. Display the V value at the 90% percentile within the input frame. Expressed in
  8138. range of [0-255].
  8139. @item VMAX
  8140. Display the maximum V value contained within the input frame. Expressed in
  8141. range of [0-255].
  8142. @item SATMIN
  8143. Display the minimal saturation value contained within the input frame.
  8144. Expressed in range of [0-~181.02].
  8145. @item SATLOW
  8146. Display the saturation value at the 10% percentile within the input frame.
  8147. Expressed in range of [0-~181.02].
  8148. @item SATAVG
  8149. Display the average saturation value within the input frame. Expressed in range
  8150. of [0-~181.02].
  8151. @item SATHIGH
  8152. Display the saturation value at the 90% percentile within the input frame.
  8153. Expressed in range of [0-~181.02].
  8154. @item SATMAX
  8155. Display the maximum saturation value contained within the input frame.
  8156. Expressed in range of [0-~181.02].
  8157. @item HUEMED
  8158. Display the median value for hue within the input frame. Expressed in range of
  8159. [0-360].
  8160. @item HUEAVG
  8161. Display the average value for hue within the input frame. Expressed in range of
  8162. [0-360].
  8163. @item YDIF
  8164. Display the average of sample value difference between all values of the Y
  8165. plane in the current frame and corresponding values of the previous input frame.
  8166. Expressed in range of [0-255].
  8167. @item UDIF
  8168. Display the average of sample value difference between all values of the U
  8169. plane in the current frame and corresponding values of the previous input frame.
  8170. Expressed in range of [0-255].
  8171. @item VDIF
  8172. Display the average of sample value difference between all values of the V
  8173. plane in the current frame and corresponding values of the previous input frame.
  8174. Expressed in range of [0-255].
  8175. @end table
  8176. The filter accepts the following options:
  8177. @table @option
  8178. @item stat
  8179. @item out
  8180. @option{stat} specify an additional form of image analysis.
  8181. @option{out} output video with the specified type of pixel highlighted.
  8182. Both options accept the following values:
  8183. @table @samp
  8184. @item tout
  8185. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  8186. unlike the neighboring pixels of the same field. Examples of temporal outliers
  8187. include the results of video dropouts, head clogs, or tape tracking issues.
  8188. @item vrep
  8189. Identify @var{vertical line repetition}. Vertical line repetition includes
  8190. similar rows of pixels within a frame. In born-digital video vertical line
  8191. repetition is common, but this pattern is uncommon in video digitized from an
  8192. analog source. When it occurs in video that results from the digitization of an
  8193. analog source it can indicate concealment from a dropout compensator.
  8194. @item brng
  8195. Identify pixels that fall outside of legal broadcast range.
  8196. @end table
  8197. @item color, c
  8198. Set the highlight color for the @option{out} option. The default color is
  8199. yellow.
  8200. @end table
  8201. @subsection Examples
  8202. @itemize
  8203. @item
  8204. Output data of various video metrics:
  8205. @example
  8206. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  8207. @end example
  8208. @item
  8209. Output specific data about the minimum and maximum values of the Y plane per frame:
  8210. @example
  8211. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  8212. @end example
  8213. @item
  8214. Playback video while highlighting pixels that are outside of broadcast range in red.
  8215. @example
  8216. ffplay example.mov -vf signalstats="out=brng:color=red"
  8217. @end example
  8218. @item
  8219. Playback video with signalstats metadata drawn over the frame.
  8220. @example
  8221. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  8222. @end example
  8223. The contents of signalstat_drawtext.txt used in the command are:
  8224. @example
  8225. time %@{pts:hms@}
  8226. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  8227. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  8228. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  8229. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  8230. @end example
  8231. @end itemize
  8232. @anchor{smartblur}
  8233. @section smartblur
  8234. Blur the input video without impacting the outlines.
  8235. It accepts the following options:
  8236. @table @option
  8237. @item luma_radius, lr
  8238. Set the luma radius. The option value must be a float number in
  8239. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8240. used to blur the image (slower if larger). Default value is 1.0.
  8241. @item luma_strength, ls
  8242. Set the luma strength. The option value must be a float number
  8243. in the range [-1.0,1.0] that configures the blurring. A value included
  8244. in [0.0,1.0] will blur the image whereas a value included in
  8245. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8246. @item luma_threshold, lt
  8247. Set the luma threshold used as a coefficient to determine
  8248. whether a pixel should be blurred or not. The option value must be an
  8249. integer in the range [-30,30]. A value of 0 will filter all the image,
  8250. a value included in [0,30] will filter flat areas and a value included
  8251. in [-30,0] will filter edges. Default value is 0.
  8252. @item chroma_radius, cr
  8253. Set the chroma radius. The option value must be a float number in
  8254. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8255. used to blur the image (slower if larger). Default value is 1.0.
  8256. @item chroma_strength, cs
  8257. Set the chroma strength. The option value must be a float number
  8258. in the range [-1.0,1.0] that configures the blurring. A value included
  8259. in [0.0,1.0] will blur the image whereas a value included in
  8260. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8261. @item chroma_threshold, ct
  8262. Set the chroma threshold used as a coefficient to determine
  8263. whether a pixel should be blurred or not. The option value must be an
  8264. integer in the range [-30,30]. A value of 0 will filter all the image,
  8265. a value included in [0,30] will filter flat areas and a value included
  8266. in [-30,0] will filter edges. Default value is 0.
  8267. @end table
  8268. If a chroma option is not explicitly set, the corresponding luma value
  8269. is set.
  8270. @section ssim
  8271. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  8272. This filter takes in input two input videos, the first input is
  8273. considered the "main" source and is passed unchanged to the
  8274. output. The second input is used as a "reference" video for computing
  8275. the SSIM.
  8276. Both video inputs must have the same resolution and pixel format for
  8277. this filter to work correctly. Also it assumes that both inputs
  8278. have the same number of frames, which are compared one by one.
  8279. The filter stores the calculated SSIM of each frame.
  8280. The description of the accepted parameters follows.
  8281. @table @option
  8282. @item stats_file, f
  8283. If specified the filter will use the named file to save the SSIM of
  8284. each individual frame. When filename equals "-" the data is sent to
  8285. standard output.
  8286. @end table
  8287. The file printed if @var{stats_file} is selected, contains a sequence of
  8288. key/value pairs of the form @var{key}:@var{value} for each compared
  8289. couple of frames.
  8290. A description of each shown parameter follows:
  8291. @table @option
  8292. @item n
  8293. sequential number of the input frame, starting from 1
  8294. @item Y, U, V, R, G, B
  8295. SSIM of the compared frames for the component specified by the suffix.
  8296. @item All
  8297. SSIM of the compared frames for the whole frame.
  8298. @item dB
  8299. Same as above but in dB representation.
  8300. @end table
  8301. For example:
  8302. @example
  8303. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8304. [main][ref] ssim="stats_file=stats.log" [out]
  8305. @end example
  8306. On this example the input file being processed is compared with the
  8307. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  8308. is stored in @file{stats.log}.
  8309. Another example with both psnr and ssim at same time:
  8310. @example
  8311. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  8312. @end example
  8313. @section stereo3d
  8314. Convert between different stereoscopic image formats.
  8315. The filters accept the following options:
  8316. @table @option
  8317. @item in
  8318. Set stereoscopic image format of input.
  8319. Available values for input image formats are:
  8320. @table @samp
  8321. @item sbsl
  8322. side by side parallel (left eye left, right eye right)
  8323. @item sbsr
  8324. side by side crosseye (right eye left, left eye right)
  8325. @item sbs2l
  8326. side by side parallel with half width resolution
  8327. (left eye left, right eye right)
  8328. @item sbs2r
  8329. side by side crosseye with half width resolution
  8330. (right eye left, left eye right)
  8331. @item abl
  8332. above-below (left eye above, right eye below)
  8333. @item abr
  8334. above-below (right eye above, left eye below)
  8335. @item ab2l
  8336. above-below with half height resolution
  8337. (left eye above, right eye below)
  8338. @item ab2r
  8339. above-below with half height resolution
  8340. (right eye above, left eye below)
  8341. @item al
  8342. alternating frames (left eye first, right eye second)
  8343. @item ar
  8344. alternating frames (right eye first, left eye second)
  8345. @item irl
  8346. interleaved rows (left eye has top row, right eye starts on next row)
  8347. @item irr
  8348. interleaved rows (right eye has top row, left eye starts on next row)
  8349. @item icl
  8350. interleaved columns, left eye first
  8351. @item icr
  8352. interleaved columns, right eye first
  8353. Default value is @samp{sbsl}.
  8354. @end table
  8355. @item out
  8356. Set stereoscopic image format of output.
  8357. @table @samp
  8358. @item sbsl
  8359. side by side parallel (left eye left, right eye right)
  8360. @item sbsr
  8361. side by side crosseye (right eye left, left eye right)
  8362. @item sbs2l
  8363. side by side parallel with half width resolution
  8364. (left eye left, right eye right)
  8365. @item sbs2r
  8366. side by side crosseye with half width resolution
  8367. (right eye left, left eye right)
  8368. @item abl
  8369. above-below (left eye above, right eye below)
  8370. @item abr
  8371. above-below (right eye above, left eye below)
  8372. @item ab2l
  8373. above-below with half height resolution
  8374. (left eye above, right eye below)
  8375. @item ab2r
  8376. above-below with half height resolution
  8377. (right eye above, left eye below)
  8378. @item al
  8379. alternating frames (left eye first, right eye second)
  8380. @item ar
  8381. alternating frames (right eye first, left eye second)
  8382. @item irl
  8383. interleaved rows (left eye has top row, right eye starts on next row)
  8384. @item irr
  8385. interleaved rows (right eye has top row, left eye starts on next row)
  8386. @item arbg
  8387. anaglyph red/blue gray
  8388. (red filter on left eye, blue filter on right eye)
  8389. @item argg
  8390. anaglyph red/green gray
  8391. (red filter on left eye, green filter on right eye)
  8392. @item arcg
  8393. anaglyph red/cyan gray
  8394. (red filter on left eye, cyan filter on right eye)
  8395. @item arch
  8396. anaglyph red/cyan half colored
  8397. (red filter on left eye, cyan filter on right eye)
  8398. @item arcc
  8399. anaglyph red/cyan color
  8400. (red filter on left eye, cyan filter on right eye)
  8401. @item arcd
  8402. anaglyph red/cyan color optimized with the least squares projection of dubois
  8403. (red filter on left eye, cyan filter on right eye)
  8404. @item agmg
  8405. anaglyph green/magenta gray
  8406. (green filter on left eye, magenta filter on right eye)
  8407. @item agmh
  8408. anaglyph green/magenta half colored
  8409. (green filter on left eye, magenta filter on right eye)
  8410. @item agmc
  8411. anaglyph green/magenta colored
  8412. (green filter on left eye, magenta filter on right eye)
  8413. @item agmd
  8414. anaglyph green/magenta color optimized with the least squares projection of dubois
  8415. (green filter on left eye, magenta filter on right eye)
  8416. @item aybg
  8417. anaglyph yellow/blue gray
  8418. (yellow filter on left eye, blue filter on right eye)
  8419. @item aybh
  8420. anaglyph yellow/blue half colored
  8421. (yellow filter on left eye, blue filter on right eye)
  8422. @item aybc
  8423. anaglyph yellow/blue colored
  8424. (yellow filter on left eye, blue filter on right eye)
  8425. @item aybd
  8426. anaglyph yellow/blue color optimized with the least squares projection of dubois
  8427. (yellow filter on left eye, blue filter on right eye)
  8428. @item ml
  8429. mono output (left eye only)
  8430. @item mr
  8431. mono output (right eye only)
  8432. @item chl
  8433. checkerboard, left eye first
  8434. @item chr
  8435. checkerboard, right eye first
  8436. @item icl
  8437. interleaved columns, left eye first
  8438. @item icr
  8439. interleaved columns, right eye first
  8440. @end table
  8441. Default value is @samp{arcd}.
  8442. @end table
  8443. @subsection Examples
  8444. @itemize
  8445. @item
  8446. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  8447. @example
  8448. stereo3d=sbsl:aybd
  8449. @end example
  8450. @item
  8451. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  8452. @example
  8453. stereo3d=abl:sbsr
  8454. @end example
  8455. @end itemize
  8456. @anchor{spp}
  8457. @section spp
  8458. Apply a simple postprocessing filter that compresses and decompresses the image
  8459. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  8460. and average the results.
  8461. The filter accepts the following options:
  8462. @table @option
  8463. @item quality
  8464. Set quality. This option defines the number of levels for averaging. It accepts
  8465. an integer in the range 0-6. If set to @code{0}, the filter will have no
  8466. effect. A value of @code{6} means the higher quality. For each increment of
  8467. that value the speed drops by a factor of approximately 2. Default value is
  8468. @code{3}.
  8469. @item qp
  8470. Force a constant quantization parameter. If not set, the filter will use the QP
  8471. from the video stream (if available).
  8472. @item mode
  8473. Set thresholding mode. Available modes are:
  8474. @table @samp
  8475. @item hard
  8476. Set hard thresholding (default).
  8477. @item soft
  8478. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8479. @end table
  8480. @item use_bframe_qp
  8481. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8482. option may cause flicker since the B-Frames have often larger QP. Default is
  8483. @code{0} (not enabled).
  8484. @end table
  8485. @anchor{subtitles}
  8486. @section subtitles
  8487. Draw subtitles on top of input video using the libass library.
  8488. To enable compilation of this filter you need to configure FFmpeg with
  8489. @code{--enable-libass}. This filter also requires a build with libavcodec and
  8490. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  8491. Alpha) subtitles format.
  8492. The filter accepts the following options:
  8493. @table @option
  8494. @item filename, f
  8495. Set the filename of the subtitle file to read. It must be specified.
  8496. @item original_size
  8497. Specify the size of the original video, the video for which the ASS file
  8498. was composed. For the syntax of this option, check the
  8499. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8500. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  8501. correctly scale the fonts if the aspect ratio has been changed.
  8502. @item fontsdir
  8503. Set a directory path containing fonts that can be used by the filter.
  8504. These fonts will be used in addition to whatever the font provider uses.
  8505. @item charenc
  8506. Set subtitles input character encoding. @code{subtitles} filter only. Only
  8507. useful if not UTF-8.
  8508. @item stream_index, si
  8509. Set subtitles stream index. @code{subtitles} filter only.
  8510. @item force_style
  8511. Override default style or script info parameters of the subtitles. It accepts a
  8512. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  8513. @end table
  8514. If the first key is not specified, it is assumed that the first value
  8515. specifies the @option{filename}.
  8516. For example, to render the file @file{sub.srt} on top of the input
  8517. video, use the command:
  8518. @example
  8519. subtitles=sub.srt
  8520. @end example
  8521. which is equivalent to:
  8522. @example
  8523. subtitles=filename=sub.srt
  8524. @end example
  8525. To render the default subtitles stream from file @file{video.mkv}, use:
  8526. @example
  8527. subtitles=video.mkv
  8528. @end example
  8529. To render the second subtitles stream from that file, use:
  8530. @example
  8531. subtitles=video.mkv:si=1
  8532. @end example
  8533. To make the subtitles stream from @file{sub.srt} appear in transparent green
  8534. @code{DejaVu Serif}, use:
  8535. @example
  8536. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  8537. @end example
  8538. @section super2xsai
  8539. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  8540. Interpolate) pixel art scaling algorithm.
  8541. Useful for enlarging pixel art images without reducing sharpness.
  8542. @section swapuv
  8543. Swap U & V plane.
  8544. @section telecine
  8545. Apply telecine process to the video.
  8546. This filter accepts the following options:
  8547. @table @option
  8548. @item first_field
  8549. @table @samp
  8550. @item top, t
  8551. top field first
  8552. @item bottom, b
  8553. bottom field first
  8554. The default value is @code{top}.
  8555. @end table
  8556. @item pattern
  8557. A string of numbers representing the pulldown pattern you wish to apply.
  8558. The default value is @code{23}.
  8559. @end table
  8560. @example
  8561. Some typical patterns:
  8562. NTSC output (30i):
  8563. 27.5p: 32222
  8564. 24p: 23 (classic)
  8565. 24p: 2332 (preferred)
  8566. 20p: 33
  8567. 18p: 334
  8568. 16p: 3444
  8569. PAL output (25i):
  8570. 27.5p: 12222
  8571. 24p: 222222222223 ("Euro pulldown")
  8572. 16.67p: 33
  8573. 16p: 33333334
  8574. @end example
  8575. @section thumbnail
  8576. Select the most representative frame in a given sequence of consecutive frames.
  8577. The filter accepts the following options:
  8578. @table @option
  8579. @item n
  8580. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  8581. will pick one of them, and then handle the next batch of @var{n} frames until
  8582. the end. Default is @code{100}.
  8583. @end table
  8584. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  8585. value will result in a higher memory usage, so a high value is not recommended.
  8586. @subsection Examples
  8587. @itemize
  8588. @item
  8589. Extract one picture each 50 frames:
  8590. @example
  8591. thumbnail=50
  8592. @end example
  8593. @item
  8594. Complete example of a thumbnail creation with @command{ffmpeg}:
  8595. @example
  8596. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  8597. @end example
  8598. @end itemize
  8599. @section tile
  8600. Tile several successive frames together.
  8601. The filter accepts the following options:
  8602. @table @option
  8603. @item layout
  8604. Set the grid size (i.e. the number of lines and columns). For the syntax of
  8605. this option, check the
  8606. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8607. @item nb_frames
  8608. Set the maximum number of frames to render in the given area. It must be less
  8609. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  8610. the area will be used.
  8611. @item margin
  8612. Set the outer border margin in pixels.
  8613. @item padding
  8614. Set the inner border thickness (i.e. the number of pixels between frames). For
  8615. more advanced padding options (such as having different values for the edges),
  8616. refer to the pad video filter.
  8617. @item color
  8618. Specify the color of the unused area. For the syntax of this option, check the
  8619. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  8620. is "black".
  8621. @end table
  8622. @subsection Examples
  8623. @itemize
  8624. @item
  8625. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  8626. @example
  8627. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  8628. @end example
  8629. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  8630. duplicating each output frame to accommodate the originally detected frame
  8631. rate.
  8632. @item
  8633. Display @code{5} pictures in an area of @code{3x2} frames,
  8634. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  8635. mixed flat and named options:
  8636. @example
  8637. tile=3x2:nb_frames=5:padding=7:margin=2
  8638. @end example
  8639. @end itemize
  8640. @section tinterlace
  8641. Perform various types of temporal field interlacing.
  8642. Frames are counted starting from 1, so the first input frame is
  8643. considered odd.
  8644. The filter accepts the following options:
  8645. @table @option
  8646. @item mode
  8647. Specify the mode of the interlacing. This option can also be specified
  8648. as a value alone. See below for a list of values for this option.
  8649. Available values are:
  8650. @table @samp
  8651. @item merge, 0
  8652. Move odd frames into the upper field, even into the lower field,
  8653. generating a double height frame at half frame rate.
  8654. @example
  8655. ------> time
  8656. Input:
  8657. Frame 1 Frame 2 Frame 3 Frame 4
  8658. 11111 22222 33333 44444
  8659. 11111 22222 33333 44444
  8660. 11111 22222 33333 44444
  8661. 11111 22222 33333 44444
  8662. Output:
  8663. 11111 33333
  8664. 22222 44444
  8665. 11111 33333
  8666. 22222 44444
  8667. 11111 33333
  8668. 22222 44444
  8669. 11111 33333
  8670. 22222 44444
  8671. @end example
  8672. @item drop_odd, 1
  8673. Only output even frames, odd frames are dropped, generating a frame with
  8674. unchanged height at half frame rate.
  8675. @example
  8676. ------> time
  8677. Input:
  8678. Frame 1 Frame 2 Frame 3 Frame 4
  8679. 11111 22222 33333 44444
  8680. 11111 22222 33333 44444
  8681. 11111 22222 33333 44444
  8682. 11111 22222 33333 44444
  8683. Output:
  8684. 22222 44444
  8685. 22222 44444
  8686. 22222 44444
  8687. 22222 44444
  8688. @end example
  8689. @item drop_even, 2
  8690. Only output odd frames, even frames are dropped, generating a frame with
  8691. unchanged height at half frame rate.
  8692. @example
  8693. ------> time
  8694. Input:
  8695. Frame 1 Frame 2 Frame 3 Frame 4
  8696. 11111 22222 33333 44444
  8697. 11111 22222 33333 44444
  8698. 11111 22222 33333 44444
  8699. 11111 22222 33333 44444
  8700. Output:
  8701. 11111 33333
  8702. 11111 33333
  8703. 11111 33333
  8704. 11111 33333
  8705. @end example
  8706. @item pad, 3
  8707. Expand each frame to full height, but pad alternate lines with black,
  8708. generating a frame with double height at the same input frame rate.
  8709. @example
  8710. ------> time
  8711. Input:
  8712. Frame 1 Frame 2 Frame 3 Frame 4
  8713. 11111 22222 33333 44444
  8714. 11111 22222 33333 44444
  8715. 11111 22222 33333 44444
  8716. 11111 22222 33333 44444
  8717. Output:
  8718. 11111 ..... 33333 .....
  8719. ..... 22222 ..... 44444
  8720. 11111 ..... 33333 .....
  8721. ..... 22222 ..... 44444
  8722. 11111 ..... 33333 .....
  8723. ..... 22222 ..... 44444
  8724. 11111 ..... 33333 .....
  8725. ..... 22222 ..... 44444
  8726. @end example
  8727. @item interleave_top, 4
  8728. Interleave the upper field from odd frames with the lower field from
  8729. even frames, generating a frame with unchanged height at half frame rate.
  8730. @example
  8731. ------> time
  8732. Input:
  8733. Frame 1 Frame 2 Frame 3 Frame 4
  8734. 11111<- 22222 33333<- 44444
  8735. 11111 22222<- 33333 44444<-
  8736. 11111<- 22222 33333<- 44444
  8737. 11111 22222<- 33333 44444<-
  8738. Output:
  8739. 11111 33333
  8740. 22222 44444
  8741. 11111 33333
  8742. 22222 44444
  8743. @end example
  8744. @item interleave_bottom, 5
  8745. Interleave the lower field from odd frames with the upper field from
  8746. even frames, generating a frame with unchanged height at half frame rate.
  8747. @example
  8748. ------> time
  8749. Input:
  8750. Frame 1 Frame 2 Frame 3 Frame 4
  8751. 11111 22222<- 33333 44444<-
  8752. 11111<- 22222 33333<- 44444
  8753. 11111 22222<- 33333 44444<-
  8754. 11111<- 22222 33333<- 44444
  8755. Output:
  8756. 22222 44444
  8757. 11111 33333
  8758. 22222 44444
  8759. 11111 33333
  8760. @end example
  8761. @item interlacex2, 6
  8762. Double frame rate with unchanged height. Frames are inserted each
  8763. containing the second temporal field from the previous input frame and
  8764. the first temporal field from the next input frame. This mode relies on
  8765. the top_field_first flag. Useful for interlaced video displays with no
  8766. field synchronisation.
  8767. @example
  8768. ------> time
  8769. Input:
  8770. Frame 1 Frame 2 Frame 3 Frame 4
  8771. 11111 22222 33333 44444
  8772. 11111 22222 33333 44444
  8773. 11111 22222 33333 44444
  8774. 11111 22222 33333 44444
  8775. Output:
  8776. 11111 22222 22222 33333 33333 44444 44444
  8777. 11111 11111 22222 22222 33333 33333 44444
  8778. 11111 22222 22222 33333 33333 44444 44444
  8779. 11111 11111 22222 22222 33333 33333 44444
  8780. @end example
  8781. @item mergex2, 7
  8782. Move odd frames into the upper field, even into the lower field,
  8783. generating a double height frame at same frame rate.
  8784. @example
  8785. ------> time
  8786. Input:
  8787. Frame 1 Frame 2 Frame 3 Frame 4
  8788. 11111 22222 33333 44444
  8789. 11111 22222 33333 44444
  8790. 11111 22222 33333 44444
  8791. 11111 22222 33333 44444
  8792. Output:
  8793. 11111 33333 33333 55555
  8794. 22222 22222 44444 44444
  8795. 11111 33333 33333 55555
  8796. 22222 22222 44444 44444
  8797. 11111 33333 33333 55555
  8798. 22222 22222 44444 44444
  8799. 11111 33333 33333 55555
  8800. 22222 22222 44444 44444
  8801. @end example
  8802. @end table
  8803. Numeric values are deprecated but are accepted for backward
  8804. compatibility reasons.
  8805. Default mode is @code{merge}.
  8806. @item flags
  8807. Specify flags influencing the filter process.
  8808. Available value for @var{flags} is:
  8809. @table @option
  8810. @item low_pass_filter, vlfp
  8811. Enable vertical low-pass filtering in the filter.
  8812. Vertical low-pass filtering is required when creating an interlaced
  8813. destination from a progressive source which contains high-frequency
  8814. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  8815. patterning.
  8816. Vertical low-pass filtering can only be enabled for @option{mode}
  8817. @var{interleave_top} and @var{interleave_bottom}.
  8818. @end table
  8819. @end table
  8820. @section transpose
  8821. Transpose rows with columns in the input video and optionally flip it.
  8822. It accepts the following parameters:
  8823. @table @option
  8824. @item dir
  8825. Specify the transposition direction.
  8826. Can assume the following values:
  8827. @table @samp
  8828. @item 0, 4, cclock_flip
  8829. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  8830. @example
  8831. L.R L.l
  8832. . . -> . .
  8833. l.r R.r
  8834. @end example
  8835. @item 1, 5, clock
  8836. Rotate by 90 degrees clockwise, that is:
  8837. @example
  8838. L.R l.L
  8839. . . -> . .
  8840. l.r r.R
  8841. @end example
  8842. @item 2, 6, cclock
  8843. Rotate by 90 degrees counterclockwise, that is:
  8844. @example
  8845. L.R R.r
  8846. . . -> . .
  8847. l.r L.l
  8848. @end example
  8849. @item 3, 7, clock_flip
  8850. Rotate by 90 degrees clockwise and vertically flip, that is:
  8851. @example
  8852. L.R r.R
  8853. . . -> . .
  8854. l.r l.L
  8855. @end example
  8856. @end table
  8857. For values between 4-7, the transposition is only done if the input
  8858. video geometry is portrait and not landscape. These values are
  8859. deprecated, the @code{passthrough} option should be used instead.
  8860. Numerical values are deprecated, and should be dropped in favor of
  8861. symbolic constants.
  8862. @item passthrough
  8863. Do not apply the transposition if the input geometry matches the one
  8864. specified by the specified value. It accepts the following values:
  8865. @table @samp
  8866. @item none
  8867. Always apply transposition.
  8868. @item portrait
  8869. Preserve portrait geometry (when @var{height} >= @var{width}).
  8870. @item landscape
  8871. Preserve landscape geometry (when @var{width} >= @var{height}).
  8872. @end table
  8873. Default value is @code{none}.
  8874. @end table
  8875. For example to rotate by 90 degrees clockwise and preserve portrait
  8876. layout:
  8877. @example
  8878. transpose=dir=1:passthrough=portrait
  8879. @end example
  8880. The command above can also be specified as:
  8881. @example
  8882. transpose=1:portrait
  8883. @end example
  8884. @section trim
  8885. Trim the input so that the output contains one continuous subpart of the input.
  8886. It accepts the following parameters:
  8887. @table @option
  8888. @item start
  8889. Specify the time of the start of the kept section, i.e. the frame with the
  8890. timestamp @var{start} will be the first frame in the output.
  8891. @item end
  8892. Specify the time of the first frame that will be dropped, i.e. the frame
  8893. immediately preceding the one with the timestamp @var{end} will be the last
  8894. frame in the output.
  8895. @item start_pts
  8896. This is the same as @var{start}, except this option sets the start timestamp
  8897. in timebase units instead of seconds.
  8898. @item end_pts
  8899. This is the same as @var{end}, except this option sets the end timestamp
  8900. in timebase units instead of seconds.
  8901. @item duration
  8902. The maximum duration of the output in seconds.
  8903. @item start_frame
  8904. The number of the first frame that should be passed to the output.
  8905. @item end_frame
  8906. The number of the first frame that should be dropped.
  8907. @end table
  8908. @option{start}, @option{end}, and @option{duration} are expressed as time
  8909. duration specifications; see
  8910. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  8911. for the accepted syntax.
  8912. Note that the first two sets of the start/end options and the @option{duration}
  8913. option look at the frame timestamp, while the _frame variants simply count the
  8914. frames that pass through the filter. Also note that this filter does not modify
  8915. the timestamps. If you wish for the output timestamps to start at zero, insert a
  8916. setpts filter after the trim filter.
  8917. If multiple start or end options are set, this filter tries to be greedy and
  8918. keep all the frames that match at least one of the specified constraints. To keep
  8919. only the part that matches all the constraints at once, chain multiple trim
  8920. filters.
  8921. The defaults are such that all the input is kept. So it is possible to set e.g.
  8922. just the end values to keep everything before the specified time.
  8923. Examples:
  8924. @itemize
  8925. @item
  8926. Drop everything except the second minute of input:
  8927. @example
  8928. ffmpeg -i INPUT -vf trim=60:120
  8929. @end example
  8930. @item
  8931. Keep only the first second:
  8932. @example
  8933. ffmpeg -i INPUT -vf trim=duration=1
  8934. @end example
  8935. @end itemize
  8936. @anchor{unsharp}
  8937. @section unsharp
  8938. Sharpen or blur the input video.
  8939. It accepts the following parameters:
  8940. @table @option
  8941. @item luma_msize_x, lx
  8942. Set the luma matrix horizontal size. It must be an odd integer between
  8943. 3 and 63. The default value is 5.
  8944. @item luma_msize_y, ly
  8945. Set the luma matrix vertical size. It must be an odd integer between 3
  8946. and 63. The default value is 5.
  8947. @item luma_amount, la
  8948. Set the luma effect strength. It must be a floating point number, reasonable
  8949. values lay between -1.5 and 1.5.
  8950. Negative values will blur the input video, while positive values will
  8951. sharpen it, a value of zero will disable the effect.
  8952. Default value is 1.0.
  8953. @item chroma_msize_x, cx
  8954. Set the chroma matrix horizontal size. It must be an odd integer
  8955. between 3 and 63. The default value is 5.
  8956. @item chroma_msize_y, cy
  8957. Set the chroma matrix vertical size. It must be an odd integer
  8958. between 3 and 63. The default value is 5.
  8959. @item chroma_amount, ca
  8960. Set the chroma effect strength. It must be a floating point number, reasonable
  8961. values lay between -1.5 and 1.5.
  8962. Negative values will blur the input video, while positive values will
  8963. sharpen it, a value of zero will disable the effect.
  8964. Default value is 0.0.
  8965. @item opencl
  8966. If set to 1, specify using OpenCL capabilities, only available if
  8967. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  8968. @end table
  8969. All parameters are optional and default to the equivalent of the
  8970. string '5:5:1.0:5:5:0.0'.
  8971. @subsection Examples
  8972. @itemize
  8973. @item
  8974. Apply strong luma sharpen effect:
  8975. @example
  8976. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  8977. @end example
  8978. @item
  8979. Apply a strong blur of both luma and chroma parameters:
  8980. @example
  8981. unsharp=7:7:-2:7:7:-2
  8982. @end example
  8983. @end itemize
  8984. @section uspp
  8985. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  8986. the image at several (or - in the case of @option{quality} level @code{8} - all)
  8987. shifts and average the results.
  8988. The way this differs from the behavior of spp is that uspp actually encodes &
  8989. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  8990. DCT similar to MJPEG.
  8991. The filter accepts the following options:
  8992. @table @option
  8993. @item quality
  8994. Set quality. This option defines the number of levels for averaging. It accepts
  8995. an integer in the range 0-8. If set to @code{0}, the filter will have no
  8996. effect. A value of @code{8} means the higher quality. For each increment of
  8997. that value the speed drops by a factor of approximately 2. Default value is
  8998. @code{3}.
  8999. @item qp
  9000. Force a constant quantization parameter. If not set, the filter will use the QP
  9001. from the video stream (if available).
  9002. @end table
  9003. @section vectorscope
  9004. Display 2 color component values in the two dimensional graph (which is called
  9005. a vectorscope).
  9006. This filter accepts the following options:
  9007. @table @option
  9008. @item mode, m
  9009. Set vectorscope mode.
  9010. It accepts the following values:
  9011. @table @samp
  9012. @item gray
  9013. Gray values are displayed on graph, higher brightness means more pixels have
  9014. same component color value on location in graph. This is the default mode.
  9015. @item color
  9016. Gray values are displayed on graph. Surrounding pixels values which are not
  9017. present in video frame are drawn in gradient of 2 color components which are
  9018. set by option @code{x} and @code{y}.
  9019. @item color2
  9020. Actual color components values present in video frame are displayed on graph.
  9021. @item color3
  9022. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  9023. on graph increases value of another color component, which is luminance by
  9024. default values of @code{x} and @code{y}.
  9025. @item color4
  9026. Actual colors present in video frame are displayed on graph. If two different
  9027. colors map to same position on graph then color with higher value of component
  9028. not present in graph is picked.
  9029. @end table
  9030. @item x
  9031. Set which color component will be represented on X-axis. Default is @code{1}.
  9032. @item y
  9033. Set which color component will be represented on Y-axis. Default is @code{2}.
  9034. @item intensity, i
  9035. Set intensity, used by modes: gray, color and color3 for increasing brightness
  9036. of color component which represents frequency of (X, Y) location in graph.
  9037. @item envelope, e
  9038. @table @samp
  9039. @item none
  9040. No envelope, this is default.
  9041. @item instant
  9042. Instant envelope, even darkest single pixel will be clearly highlighted.
  9043. @item peak
  9044. Hold maximum and minimum values presented in graph over time. This way you
  9045. can still spot out of range values without constantly looking at vectorscope.
  9046. @item peak+instant
  9047. Peak and instant envelope combined together.
  9048. @end table
  9049. @end table
  9050. @anchor{vidstabdetect}
  9051. @section vidstabdetect
  9052. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  9053. @ref{vidstabtransform} for pass 2.
  9054. This filter generates a file with relative translation and rotation
  9055. transform information about subsequent frames, which is then used by
  9056. the @ref{vidstabtransform} filter.
  9057. To enable compilation of this filter you need to configure FFmpeg with
  9058. @code{--enable-libvidstab}.
  9059. This filter accepts the following options:
  9060. @table @option
  9061. @item result
  9062. Set the path to the file used to write the transforms information.
  9063. Default value is @file{transforms.trf}.
  9064. @item shakiness
  9065. Set how shaky the video is and how quick the camera is. It accepts an
  9066. integer in the range 1-10, a value of 1 means little shakiness, a
  9067. value of 10 means strong shakiness. Default value is 5.
  9068. @item accuracy
  9069. Set the accuracy of the detection process. It must be a value in the
  9070. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  9071. accuracy. Default value is 15.
  9072. @item stepsize
  9073. Set stepsize of the search process. The region around minimum is
  9074. scanned with 1 pixel resolution. Default value is 6.
  9075. @item mincontrast
  9076. Set minimum contrast. Below this value a local measurement field is
  9077. discarded. Must be a floating point value in the range 0-1. Default
  9078. value is 0.3.
  9079. @item tripod
  9080. Set reference frame number for tripod mode.
  9081. If enabled, the motion of the frames is compared to a reference frame
  9082. in the filtered stream, identified by the specified number. The idea
  9083. is to compensate all movements in a more-or-less static scene and keep
  9084. the camera view absolutely still.
  9085. If set to 0, it is disabled. The frames are counted starting from 1.
  9086. @item show
  9087. Show fields and transforms in the resulting frames. It accepts an
  9088. integer in the range 0-2. Default value is 0, which disables any
  9089. visualization.
  9090. @end table
  9091. @subsection Examples
  9092. @itemize
  9093. @item
  9094. Use default values:
  9095. @example
  9096. vidstabdetect
  9097. @end example
  9098. @item
  9099. Analyze strongly shaky movie and put the results in file
  9100. @file{mytransforms.trf}:
  9101. @example
  9102. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  9103. @end example
  9104. @item
  9105. Visualize the result of internal transformations in the resulting
  9106. video:
  9107. @example
  9108. vidstabdetect=show=1
  9109. @end example
  9110. @item
  9111. Analyze a video with medium shakiness using @command{ffmpeg}:
  9112. @example
  9113. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  9114. @end example
  9115. @end itemize
  9116. @anchor{vidstabtransform}
  9117. @section vidstabtransform
  9118. Video stabilization/deshaking: pass 2 of 2,
  9119. see @ref{vidstabdetect} for pass 1.
  9120. Read a file with transform information for each frame and
  9121. apply/compensate them. Together with the @ref{vidstabdetect}
  9122. filter this can be used to deshake videos. See also
  9123. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  9124. the @ref{unsharp} filter, see below.
  9125. To enable compilation of this filter you need to configure FFmpeg with
  9126. @code{--enable-libvidstab}.
  9127. @subsection Options
  9128. @table @option
  9129. @item input
  9130. Set path to the file used to read the transforms. Default value is
  9131. @file{transforms.trf}.
  9132. @item smoothing
  9133. Set the number of frames (value*2 + 1) used for lowpass filtering the
  9134. camera movements. Default value is 10.
  9135. For example a number of 10 means that 21 frames are used (10 in the
  9136. past and 10 in the future) to smoothen the motion in the video. A
  9137. larger value leads to a smoother video, but limits the acceleration of
  9138. the camera (pan/tilt movements). 0 is a special case where a static
  9139. camera is simulated.
  9140. @item optalgo
  9141. Set the camera path optimization algorithm.
  9142. Accepted values are:
  9143. @table @samp
  9144. @item gauss
  9145. gaussian kernel low-pass filter on camera motion (default)
  9146. @item avg
  9147. averaging on transformations
  9148. @end table
  9149. @item maxshift
  9150. Set maximal number of pixels to translate frames. Default value is -1,
  9151. meaning no limit.
  9152. @item maxangle
  9153. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  9154. value is -1, meaning no limit.
  9155. @item crop
  9156. Specify how to deal with borders that may be visible due to movement
  9157. compensation.
  9158. Available values are:
  9159. @table @samp
  9160. @item keep
  9161. keep image information from previous frame (default)
  9162. @item black
  9163. fill the border black
  9164. @end table
  9165. @item invert
  9166. Invert transforms if set to 1. Default value is 0.
  9167. @item relative
  9168. Consider transforms as relative to previous frame if set to 1,
  9169. absolute if set to 0. Default value is 0.
  9170. @item zoom
  9171. Set percentage to zoom. A positive value will result in a zoom-in
  9172. effect, a negative value in a zoom-out effect. Default value is 0 (no
  9173. zoom).
  9174. @item optzoom
  9175. Set optimal zooming to avoid borders.
  9176. Accepted values are:
  9177. @table @samp
  9178. @item 0
  9179. disabled
  9180. @item 1
  9181. optimal static zoom value is determined (only very strong movements
  9182. will lead to visible borders) (default)
  9183. @item 2
  9184. optimal adaptive zoom value is determined (no borders will be
  9185. visible), see @option{zoomspeed}
  9186. @end table
  9187. Note that the value given at zoom is added to the one calculated here.
  9188. @item zoomspeed
  9189. Set percent to zoom maximally each frame (enabled when
  9190. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  9191. 0.25.
  9192. @item interpol
  9193. Specify type of interpolation.
  9194. Available values are:
  9195. @table @samp
  9196. @item no
  9197. no interpolation
  9198. @item linear
  9199. linear only horizontal
  9200. @item bilinear
  9201. linear in both directions (default)
  9202. @item bicubic
  9203. cubic in both directions (slow)
  9204. @end table
  9205. @item tripod
  9206. Enable virtual tripod mode if set to 1, which is equivalent to
  9207. @code{relative=0:smoothing=0}. Default value is 0.
  9208. Use also @code{tripod} option of @ref{vidstabdetect}.
  9209. @item debug
  9210. Increase log verbosity if set to 1. Also the detected global motions
  9211. are written to the temporary file @file{global_motions.trf}. Default
  9212. value is 0.
  9213. @end table
  9214. @subsection Examples
  9215. @itemize
  9216. @item
  9217. Use @command{ffmpeg} for a typical stabilization with default values:
  9218. @example
  9219. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  9220. @end example
  9221. Note the use of the @ref{unsharp} filter which is always recommended.
  9222. @item
  9223. Zoom in a bit more and load transform data from a given file:
  9224. @example
  9225. vidstabtransform=zoom=5:input="mytransforms.trf"
  9226. @end example
  9227. @item
  9228. Smoothen the video even more:
  9229. @example
  9230. vidstabtransform=smoothing=30
  9231. @end example
  9232. @end itemize
  9233. @section vflip
  9234. Flip the input video vertically.
  9235. For example, to vertically flip a video with @command{ffmpeg}:
  9236. @example
  9237. ffmpeg -i in.avi -vf "vflip" out.avi
  9238. @end example
  9239. @anchor{vignette}
  9240. @section vignette
  9241. Make or reverse a natural vignetting effect.
  9242. The filter accepts the following options:
  9243. @table @option
  9244. @item angle, a
  9245. Set lens angle expression as a number of radians.
  9246. The value is clipped in the @code{[0,PI/2]} range.
  9247. Default value: @code{"PI/5"}
  9248. @item x0
  9249. @item y0
  9250. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  9251. by default.
  9252. @item mode
  9253. Set forward/backward mode.
  9254. Available modes are:
  9255. @table @samp
  9256. @item forward
  9257. The larger the distance from the central point, the darker the image becomes.
  9258. @item backward
  9259. The larger the distance from the central point, the brighter the image becomes.
  9260. This can be used to reverse a vignette effect, though there is no automatic
  9261. detection to extract the lens @option{angle} and other settings (yet). It can
  9262. also be used to create a burning effect.
  9263. @end table
  9264. Default value is @samp{forward}.
  9265. @item eval
  9266. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  9267. It accepts the following values:
  9268. @table @samp
  9269. @item init
  9270. Evaluate expressions only once during the filter initialization.
  9271. @item frame
  9272. Evaluate expressions for each incoming frame. This is way slower than the
  9273. @samp{init} mode since it requires all the scalers to be re-computed, but it
  9274. allows advanced dynamic expressions.
  9275. @end table
  9276. Default value is @samp{init}.
  9277. @item dither
  9278. Set dithering to reduce the circular banding effects. Default is @code{1}
  9279. (enabled).
  9280. @item aspect
  9281. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  9282. Setting this value to the SAR of the input will make a rectangular vignetting
  9283. following the dimensions of the video.
  9284. Default is @code{1/1}.
  9285. @end table
  9286. @subsection Expressions
  9287. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  9288. following parameters.
  9289. @table @option
  9290. @item w
  9291. @item h
  9292. input width and height
  9293. @item n
  9294. the number of input frame, starting from 0
  9295. @item pts
  9296. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  9297. @var{TB} units, NAN if undefined
  9298. @item r
  9299. frame rate of the input video, NAN if the input frame rate is unknown
  9300. @item t
  9301. the PTS (Presentation TimeStamp) of the filtered video frame,
  9302. expressed in seconds, NAN if undefined
  9303. @item tb
  9304. time base of the input video
  9305. @end table
  9306. @subsection Examples
  9307. @itemize
  9308. @item
  9309. Apply simple strong vignetting effect:
  9310. @example
  9311. vignette=PI/4
  9312. @end example
  9313. @item
  9314. Make a flickering vignetting:
  9315. @example
  9316. vignette='PI/4+random(1)*PI/50':eval=frame
  9317. @end example
  9318. @end itemize
  9319. @section vstack
  9320. Stack input videos vertically.
  9321. All streams must be of same pixel format and of same width.
  9322. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9323. to create same output.
  9324. The filter accept the following option:
  9325. @table @option
  9326. @item inputs
  9327. Set number of input streams. Default is 2.
  9328. @item shortest
  9329. If set to 1, force the output to terminate when the shortest input
  9330. terminates. Default value is 0.
  9331. @end table
  9332. @section w3fdif
  9333. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  9334. Deinterlacing Filter").
  9335. Based on the process described by Martin Weston for BBC R&D, and
  9336. implemented based on the de-interlace algorithm written by Jim
  9337. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  9338. uses filter coefficients calculated by BBC R&D.
  9339. There are two sets of filter coefficients, so called "simple":
  9340. and "complex". Which set of filter coefficients is used can
  9341. be set by passing an optional parameter:
  9342. @table @option
  9343. @item filter
  9344. Set the interlacing filter coefficients. Accepts one of the following values:
  9345. @table @samp
  9346. @item simple
  9347. Simple filter coefficient set.
  9348. @item complex
  9349. More-complex filter coefficient set.
  9350. @end table
  9351. Default value is @samp{complex}.
  9352. @item deint
  9353. Specify which frames to deinterlace. Accept one of the following values:
  9354. @table @samp
  9355. @item all
  9356. Deinterlace all frames,
  9357. @item interlaced
  9358. Only deinterlace frames marked as interlaced.
  9359. @end table
  9360. Default value is @samp{all}.
  9361. @end table
  9362. @section waveform
  9363. Video waveform monitor.
  9364. The waveform monitor plots color component intensity. By default luminance
  9365. only. Each column of the waveform corresponds to a column of pixels in the
  9366. source video.
  9367. It accepts the following options:
  9368. @table @option
  9369. @item mode, m
  9370. Can be either @code{row}, or @code{column}. Default is @code{column}.
  9371. In row mode, the graph on the left side represents color component value 0 and
  9372. the right side represents value = 255. In column mode, the top side represents
  9373. color component value = 0 and bottom side represents value = 255.
  9374. @item intensity, i
  9375. Set intensity. Smaller values are useful to find out how many values of the same
  9376. luminance are distributed across input rows/columns.
  9377. Default value is @code{0.04}. Allowed range is [0, 1].
  9378. @item mirror, r
  9379. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  9380. In mirrored mode, higher values will be represented on the left
  9381. side for @code{row} mode and at the top for @code{column} mode. Default is
  9382. @code{1} (mirrored).
  9383. @item display, d
  9384. Set display mode.
  9385. It accepts the following values:
  9386. @table @samp
  9387. @item overlay
  9388. Presents information identical to that in the @code{parade}, except
  9389. that the graphs representing color components are superimposed directly
  9390. over one another.
  9391. This display mode makes it easier to spot relative differences or similarities
  9392. in overlapping areas of the color components that are supposed to be identical,
  9393. such as neutral whites, grays, or blacks.
  9394. @item parade
  9395. Display separate graph for the color components side by side in
  9396. @code{row} mode or one below the other in @code{column} mode.
  9397. Using this display mode makes it easy to spot color casts in the highlights
  9398. and shadows of an image, by comparing the contours of the top and the bottom
  9399. graphs of each waveform. Since whites, grays, and blacks are characterized
  9400. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  9401. should display three waveforms of roughly equal width/height. If not, the
  9402. correction is easy to perform by making level adjustments the three waveforms.
  9403. @end table
  9404. Default is @code{parade}.
  9405. @item components, c
  9406. Set which color components to display. Default is 1, which means only luminance
  9407. or red color component if input is in RGB colorspace. If is set for example to
  9408. 7 it will display all 3 (if) available color components.
  9409. @item envelope, e
  9410. @table @samp
  9411. @item none
  9412. No envelope, this is default.
  9413. @item instant
  9414. Instant envelope, minimum and maximum values presented in graph will be easily
  9415. visible even with small @code{step} value.
  9416. @item peak
  9417. Hold minimum and maximum values presented in graph across time. This way you
  9418. can still spot out of range values without constantly looking at waveforms.
  9419. @item peak+instant
  9420. Peak and instant envelope combined together.
  9421. @end table
  9422. @item filter, f
  9423. @table @samp
  9424. @item lowpass
  9425. No filtering, this is default.
  9426. @item flat
  9427. Luma and chroma combined together.
  9428. @item aflat
  9429. Similar as above, but shows difference between blue and red chroma.
  9430. @item chroma
  9431. Displays only chroma.
  9432. @item achroma
  9433. Similar as above, but shows difference between blue and red chroma.
  9434. @item color
  9435. Displays actual color value on waveform.
  9436. @end table
  9437. @end table
  9438. @section xbr
  9439. Apply the xBR high-quality magnification filter which is designed for pixel
  9440. art. It follows a set of edge-detection rules, see
  9441. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  9442. It accepts the following option:
  9443. @table @option
  9444. @item n
  9445. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  9446. @code{3xBR} and @code{4} for @code{4xBR}.
  9447. Default is @code{3}.
  9448. @end table
  9449. @anchor{yadif}
  9450. @section yadif
  9451. Deinterlace the input video ("yadif" means "yet another deinterlacing
  9452. filter").
  9453. It accepts the following parameters:
  9454. @table @option
  9455. @item mode
  9456. The interlacing mode to adopt. It accepts one of the following values:
  9457. @table @option
  9458. @item 0, send_frame
  9459. Output one frame for each frame.
  9460. @item 1, send_field
  9461. Output one frame for each field.
  9462. @item 2, send_frame_nospatial
  9463. Like @code{send_frame}, but it skips the spatial interlacing check.
  9464. @item 3, send_field_nospatial
  9465. Like @code{send_field}, but it skips the spatial interlacing check.
  9466. @end table
  9467. The default value is @code{send_frame}.
  9468. @item parity
  9469. The picture field parity assumed for the input interlaced video. It accepts one
  9470. of the following values:
  9471. @table @option
  9472. @item 0, tff
  9473. Assume the top field is first.
  9474. @item 1, bff
  9475. Assume the bottom field is first.
  9476. @item -1, auto
  9477. Enable automatic detection of field parity.
  9478. @end table
  9479. The default value is @code{auto}.
  9480. If the interlacing is unknown or the decoder does not export this information,
  9481. top field first will be assumed.
  9482. @item deint
  9483. Specify which frames to deinterlace. Accept one of the following
  9484. values:
  9485. @table @option
  9486. @item 0, all
  9487. Deinterlace all frames.
  9488. @item 1, interlaced
  9489. Only deinterlace frames marked as interlaced.
  9490. @end table
  9491. The default value is @code{all}.
  9492. @end table
  9493. @section zoompan
  9494. Apply Zoom & Pan effect.
  9495. This filter accepts the following options:
  9496. @table @option
  9497. @item zoom, z
  9498. Set the zoom expression. Default is 1.
  9499. @item x
  9500. @item y
  9501. Set the x and y expression. Default is 0.
  9502. @item d
  9503. Set the duration expression in number of frames.
  9504. This sets for how many number of frames effect will last for
  9505. single input image.
  9506. @item s
  9507. Set the output image size, default is 'hd720'.
  9508. @end table
  9509. Each expression can contain the following constants:
  9510. @table @option
  9511. @item in_w, iw
  9512. Input width.
  9513. @item in_h, ih
  9514. Input height.
  9515. @item out_w, ow
  9516. Output width.
  9517. @item out_h, oh
  9518. Output height.
  9519. @item in
  9520. Input frame count.
  9521. @item on
  9522. Output frame count.
  9523. @item x
  9524. @item y
  9525. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  9526. for current input frame.
  9527. @item px
  9528. @item py
  9529. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  9530. not yet such frame (first input frame).
  9531. @item zoom
  9532. Last calculated zoom from 'z' expression for current input frame.
  9533. @item pzoom
  9534. Last calculated zoom of last output frame of previous input frame.
  9535. @item duration
  9536. Number of output frames for current input frame. Calculated from 'd' expression
  9537. for each input frame.
  9538. @item pduration
  9539. number of output frames created for previous input frame
  9540. @item a
  9541. Rational number: input width / input height
  9542. @item sar
  9543. sample aspect ratio
  9544. @item dar
  9545. display aspect ratio
  9546. @end table
  9547. @subsection Examples
  9548. @itemize
  9549. @item
  9550. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  9551. @example
  9552. 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
  9553. @end example
  9554. @item
  9555. Zoom-in up to 1.5 and pan always at center of picture:
  9556. @example
  9557. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  9558. @end example
  9559. @end itemize
  9560. @section zscale
  9561. Scale (resize) the input video, using the z.lib library:
  9562. https://github.com/sekrit-twc/zimg.
  9563. The zscale filter forces the output display aspect ratio to be the same
  9564. as the input, by changing the output sample aspect ratio.
  9565. If the input image format is different from the format requested by
  9566. the next filter, the zscale filter will convert the input to the
  9567. requested format.
  9568. @subsection Options
  9569. The filter accepts the following options.
  9570. @table @option
  9571. @item width, w
  9572. @item height, h
  9573. Set the output video dimension expression. Default value is the input
  9574. dimension.
  9575. If the @var{width} or @var{w} is 0, the input width is used for the output.
  9576. If the @var{height} or @var{h} is 0, the input height is used for the output.
  9577. If one of the values is -1, the zscale filter will use a value that
  9578. maintains the aspect ratio of the input image, calculated from the
  9579. other specified dimension. If both of them are -1, the input size is
  9580. used
  9581. If one of the values is -n with n > 1, the zscale filter will also use a value
  9582. that maintains the aspect ratio of the input image, calculated from the other
  9583. specified dimension. After that it will, however, make sure that the calculated
  9584. dimension is divisible by n and adjust the value if necessary.
  9585. See below for the list of accepted constants for use in the dimension
  9586. expression.
  9587. @item size, s
  9588. Set the video size. For the syntax of this option, check the
  9589. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9590. @item dither, d
  9591. Set the dither type.
  9592. Possible values are:
  9593. @table @var
  9594. @item none
  9595. @item ordered
  9596. @item random
  9597. @item error_diffusion
  9598. @end table
  9599. Default is none.
  9600. @item filter, f
  9601. Set the resize filter type.
  9602. Possible values are:
  9603. @table @var
  9604. @item point
  9605. @item bilinear
  9606. @item bicubic
  9607. @item spline16
  9608. @item spline36
  9609. @item lanczos
  9610. @end table
  9611. Default is bilinear.
  9612. @item range, r
  9613. Set the color range.
  9614. Possible values are:
  9615. @table @var
  9616. @item input
  9617. @item limited
  9618. @item full
  9619. @end table
  9620. Default is same as input.
  9621. @item primaries, p
  9622. Set the color primaries.
  9623. Possible values are:
  9624. @table @var
  9625. @item input
  9626. @item 709
  9627. @item unspecified
  9628. @item 170m
  9629. @item 240m
  9630. @item 2020
  9631. @end table
  9632. Default is same as input.
  9633. @item transfer, t
  9634. Set the transfer characteristics.
  9635. Possible values are:
  9636. @table @var
  9637. @item input
  9638. @item 709
  9639. @item unspecified
  9640. @item 601
  9641. @item linear
  9642. @item 2020_10
  9643. @item 2020_12
  9644. @end table
  9645. Default is same as input.
  9646. @item matrix, m
  9647. Set the colorspace matrix.
  9648. Possible value are:
  9649. @table @var
  9650. @item input
  9651. @item 709
  9652. @item unspecified
  9653. @item 470bg
  9654. @item 170m
  9655. @item 2020_ncl
  9656. @item 2020_cl
  9657. @end table
  9658. Default is same as input.
  9659. @end table
  9660. The values of the @option{w} and @option{h} options are expressions
  9661. containing the following constants:
  9662. @table @var
  9663. @item in_w
  9664. @item in_h
  9665. The input width and height
  9666. @item iw
  9667. @item ih
  9668. These are the same as @var{in_w} and @var{in_h}.
  9669. @item out_w
  9670. @item out_h
  9671. The output (scaled) width and height
  9672. @item ow
  9673. @item oh
  9674. These are the same as @var{out_w} and @var{out_h}
  9675. @item a
  9676. The same as @var{iw} / @var{ih}
  9677. @item sar
  9678. input sample aspect ratio
  9679. @item dar
  9680. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9681. @item hsub
  9682. @item vsub
  9683. horizontal and vertical input chroma subsample values. For example for the
  9684. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9685. @item ohsub
  9686. @item ovsub
  9687. horizontal and vertical output chroma subsample values. For example for the
  9688. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9689. @end table
  9690. @table @option
  9691. @end table
  9692. @c man end VIDEO FILTERS
  9693. @chapter Video Sources
  9694. @c man begin VIDEO SOURCES
  9695. Below is a description of the currently available video sources.
  9696. @section buffer
  9697. Buffer video frames, and make them available to the filter chain.
  9698. This source is mainly intended for a programmatic use, in particular
  9699. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  9700. It accepts the following parameters:
  9701. @table @option
  9702. @item video_size
  9703. Specify the size (width and height) of the buffered video frames. For the
  9704. syntax of this option, check the
  9705. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9706. @item width
  9707. The input video width.
  9708. @item height
  9709. The input video height.
  9710. @item pix_fmt
  9711. A string representing the pixel format of the buffered video frames.
  9712. It may be a number corresponding to a pixel format, or a pixel format
  9713. name.
  9714. @item time_base
  9715. Specify the timebase assumed by the timestamps of the buffered frames.
  9716. @item frame_rate
  9717. Specify the frame rate expected for the video stream.
  9718. @item pixel_aspect, sar
  9719. The sample (pixel) aspect ratio of the input video.
  9720. @item sws_param
  9721. Specify the optional parameters to be used for the scale filter which
  9722. is automatically inserted when an input change is detected in the
  9723. input size or format.
  9724. @end table
  9725. For example:
  9726. @example
  9727. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  9728. @end example
  9729. will instruct the source to accept video frames with size 320x240 and
  9730. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  9731. square pixels (1:1 sample aspect ratio).
  9732. Since the pixel format with name "yuv410p" corresponds to the number 6
  9733. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  9734. this example corresponds to:
  9735. @example
  9736. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  9737. @end example
  9738. Alternatively, the options can be specified as a flat string, but this
  9739. syntax is deprecated:
  9740. @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}]
  9741. @section cellauto
  9742. Create a pattern generated by an elementary cellular automaton.
  9743. The initial state of the cellular automaton can be defined through the
  9744. @option{filename}, and @option{pattern} options. If such options are
  9745. not specified an initial state is created randomly.
  9746. At each new frame a new row in the video is filled with the result of
  9747. the cellular automaton next generation. The behavior when the whole
  9748. frame is filled is defined by the @option{scroll} option.
  9749. This source accepts the following options:
  9750. @table @option
  9751. @item filename, f
  9752. Read the initial cellular automaton state, i.e. the starting row, from
  9753. the specified file.
  9754. In the file, each non-whitespace character is considered an alive
  9755. cell, a newline will terminate the row, and further characters in the
  9756. file will be ignored.
  9757. @item pattern, p
  9758. Read the initial cellular automaton state, i.e. the starting row, from
  9759. the specified string.
  9760. Each non-whitespace character in the string is considered an alive
  9761. cell, a newline will terminate the row, and further characters in the
  9762. string will be ignored.
  9763. @item rate, r
  9764. Set the video rate, that is the number of frames generated per second.
  9765. Default is 25.
  9766. @item random_fill_ratio, ratio
  9767. Set the random fill ratio for the initial cellular automaton row. It
  9768. is a floating point number value ranging from 0 to 1, defaults to
  9769. 1/PHI.
  9770. This option is ignored when a file or a pattern is specified.
  9771. @item random_seed, seed
  9772. Set the seed for filling randomly the initial row, must be an integer
  9773. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9774. set to -1, the filter will try to use a good random seed on a best
  9775. effort basis.
  9776. @item rule
  9777. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  9778. Default value is 110.
  9779. @item size, s
  9780. Set the size of the output video. For the syntax of this option, check the
  9781. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9782. If @option{filename} or @option{pattern} is specified, the size is set
  9783. by default to the width of the specified initial state row, and the
  9784. height is set to @var{width} * PHI.
  9785. If @option{size} is set, it must contain the width of the specified
  9786. pattern string, and the specified pattern will be centered in the
  9787. larger row.
  9788. If a filename or a pattern string is not specified, the size value
  9789. defaults to "320x518" (used for a randomly generated initial state).
  9790. @item scroll
  9791. If set to 1, scroll the output upward when all the rows in the output
  9792. have been already filled. If set to 0, the new generated row will be
  9793. written over the top row just after the bottom row is filled.
  9794. Defaults to 1.
  9795. @item start_full, full
  9796. If set to 1, completely fill the output with generated rows before
  9797. outputting the first frame.
  9798. This is the default behavior, for disabling set the value to 0.
  9799. @item stitch
  9800. If set to 1, stitch the left and right row edges together.
  9801. This is the default behavior, for disabling set the value to 0.
  9802. @end table
  9803. @subsection Examples
  9804. @itemize
  9805. @item
  9806. Read the initial state from @file{pattern}, and specify an output of
  9807. size 200x400.
  9808. @example
  9809. cellauto=f=pattern:s=200x400
  9810. @end example
  9811. @item
  9812. Generate a random initial row with a width of 200 cells, with a fill
  9813. ratio of 2/3:
  9814. @example
  9815. cellauto=ratio=2/3:s=200x200
  9816. @end example
  9817. @item
  9818. Create a pattern generated by rule 18 starting by a single alive cell
  9819. centered on an initial row with width 100:
  9820. @example
  9821. cellauto=p=@@:s=100x400:full=0:rule=18
  9822. @end example
  9823. @item
  9824. Specify a more elaborated initial pattern:
  9825. @example
  9826. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  9827. @end example
  9828. @end itemize
  9829. @section mandelbrot
  9830. Generate a Mandelbrot set fractal, and progressively zoom towards the
  9831. point specified with @var{start_x} and @var{start_y}.
  9832. This source accepts the following options:
  9833. @table @option
  9834. @item end_pts
  9835. Set the terminal pts value. Default value is 400.
  9836. @item end_scale
  9837. Set the terminal scale value.
  9838. Must be a floating point value. Default value is 0.3.
  9839. @item inner
  9840. Set the inner coloring mode, that is the algorithm used to draw the
  9841. Mandelbrot fractal internal region.
  9842. It shall assume one of the following values:
  9843. @table @option
  9844. @item black
  9845. Set black mode.
  9846. @item convergence
  9847. Show time until convergence.
  9848. @item mincol
  9849. Set color based on point closest to the origin of the iterations.
  9850. @item period
  9851. Set period mode.
  9852. @end table
  9853. Default value is @var{mincol}.
  9854. @item bailout
  9855. Set the bailout value. Default value is 10.0.
  9856. @item maxiter
  9857. Set the maximum of iterations performed by the rendering
  9858. algorithm. Default value is 7189.
  9859. @item outer
  9860. Set outer coloring mode.
  9861. It shall assume one of following values:
  9862. @table @option
  9863. @item iteration_count
  9864. Set iteration cound mode.
  9865. @item normalized_iteration_count
  9866. set normalized iteration count mode.
  9867. @end table
  9868. Default value is @var{normalized_iteration_count}.
  9869. @item rate, r
  9870. Set frame rate, expressed as number of frames per second. Default
  9871. value is "25".
  9872. @item size, s
  9873. Set frame size. For the syntax of this option, check the "Video
  9874. size" section in the ffmpeg-utils manual. Default value is "640x480".
  9875. @item start_scale
  9876. Set the initial scale value. Default value is 3.0.
  9877. @item start_x
  9878. Set the initial x position. Must be a floating point value between
  9879. -100 and 100. Default value is -0.743643887037158704752191506114774.
  9880. @item start_y
  9881. Set the initial y position. Must be a floating point value between
  9882. -100 and 100. Default value is -0.131825904205311970493132056385139.
  9883. @end table
  9884. @section mptestsrc
  9885. Generate various test patterns, as generated by the MPlayer test filter.
  9886. The size of the generated video is fixed, and is 256x256.
  9887. This source is useful in particular for testing encoding features.
  9888. This source accepts the following options:
  9889. @table @option
  9890. @item rate, r
  9891. Specify the frame rate of the sourced video, as the number of frames
  9892. generated per second. It has to be a string in the format
  9893. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9894. number or a valid video frame rate abbreviation. The default value is
  9895. "25".
  9896. @item duration, d
  9897. Set the duration of the sourced video. See
  9898. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9899. for the accepted syntax.
  9900. If not specified, or the expressed duration is negative, the video is
  9901. supposed to be generated forever.
  9902. @item test, t
  9903. Set the number or the name of the test to perform. Supported tests are:
  9904. @table @option
  9905. @item dc_luma
  9906. @item dc_chroma
  9907. @item freq_luma
  9908. @item freq_chroma
  9909. @item amp_luma
  9910. @item amp_chroma
  9911. @item cbp
  9912. @item mv
  9913. @item ring1
  9914. @item ring2
  9915. @item all
  9916. @end table
  9917. Default value is "all", which will cycle through the list of all tests.
  9918. @end table
  9919. Some examples:
  9920. @example
  9921. mptestsrc=t=dc_luma
  9922. @end example
  9923. will generate a "dc_luma" test pattern.
  9924. @section frei0r_src
  9925. Provide a frei0r source.
  9926. To enable compilation of this filter you need to install the frei0r
  9927. header and configure FFmpeg with @code{--enable-frei0r}.
  9928. This source accepts the following parameters:
  9929. @table @option
  9930. @item size
  9931. The size of the video to generate. For the syntax of this option, check the
  9932. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9933. @item framerate
  9934. The framerate of the generated video. It may be a string of the form
  9935. @var{num}/@var{den} or a frame rate abbreviation.
  9936. @item filter_name
  9937. The name to the frei0r source to load. For more information regarding frei0r and
  9938. how to set the parameters, read the @ref{frei0r} section in the video filters
  9939. documentation.
  9940. @item filter_params
  9941. A '|'-separated list of parameters to pass to the frei0r source.
  9942. @end table
  9943. For example, to generate a frei0r partik0l source with size 200x200
  9944. and frame rate 10 which is overlaid on the overlay filter main input:
  9945. @example
  9946. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  9947. @end example
  9948. @section life
  9949. Generate a life pattern.
  9950. This source is based on a generalization of John Conway's life game.
  9951. The sourced input represents a life grid, each pixel represents a cell
  9952. which can be in one of two possible states, alive or dead. Every cell
  9953. interacts with its eight neighbours, which are the cells that are
  9954. horizontally, vertically, or diagonally adjacent.
  9955. At each interaction the grid evolves according to the adopted rule,
  9956. which specifies the number of neighbor alive cells which will make a
  9957. cell stay alive or born. The @option{rule} option allows one to specify
  9958. the rule to adopt.
  9959. This source accepts the following options:
  9960. @table @option
  9961. @item filename, f
  9962. Set the file from which to read the initial grid state. In the file,
  9963. each non-whitespace character is considered an alive cell, and newline
  9964. is used to delimit the end of each row.
  9965. If this option is not specified, the initial grid is generated
  9966. randomly.
  9967. @item rate, r
  9968. Set the video rate, that is the number of frames generated per second.
  9969. Default is 25.
  9970. @item random_fill_ratio, ratio
  9971. Set the random fill ratio for the initial random grid. It is a
  9972. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  9973. It is ignored when a file is specified.
  9974. @item random_seed, seed
  9975. Set the seed for filling the initial random grid, must be an integer
  9976. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9977. set to -1, the filter will try to use a good random seed on a best
  9978. effort basis.
  9979. @item rule
  9980. Set the life rule.
  9981. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  9982. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  9983. @var{NS} specifies the number of alive neighbor cells which make a
  9984. live cell stay alive, and @var{NB} the number of alive neighbor cells
  9985. which make a dead cell to become alive (i.e. to "born").
  9986. "s" and "b" can be used in place of "S" and "B", respectively.
  9987. Alternatively a rule can be specified by an 18-bits integer. The 9
  9988. high order bits are used to encode the next cell state if it is alive
  9989. for each number of neighbor alive cells, the low order bits specify
  9990. the rule for "borning" new cells. Higher order bits encode for an
  9991. higher number of neighbor cells.
  9992. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  9993. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  9994. Default value is "S23/B3", which is the original Conway's game of life
  9995. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  9996. cells, and will born a new cell if there are three alive cells around
  9997. a dead cell.
  9998. @item size, s
  9999. Set the size of the output video. For the syntax of this option, check the
  10000. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10001. If @option{filename} is specified, the size is set by default to the
  10002. same size of the input file. If @option{size} is set, it must contain
  10003. the size specified in the input file, and the initial grid defined in
  10004. that file is centered in the larger resulting area.
  10005. If a filename is not specified, the size value defaults to "320x240"
  10006. (used for a randomly generated initial grid).
  10007. @item stitch
  10008. If set to 1, stitch the left and right grid edges together, and the
  10009. top and bottom edges also. Defaults to 1.
  10010. @item mold
  10011. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  10012. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  10013. value from 0 to 255.
  10014. @item life_color
  10015. Set the color of living (or new born) cells.
  10016. @item death_color
  10017. Set the color of dead cells. If @option{mold} is set, this is the first color
  10018. used to represent a dead cell.
  10019. @item mold_color
  10020. Set mold color, for definitely dead and moldy cells.
  10021. For the syntax of these 3 color options, check the "Color" section in the
  10022. ffmpeg-utils manual.
  10023. @end table
  10024. @subsection Examples
  10025. @itemize
  10026. @item
  10027. Read a grid from @file{pattern}, and center it on a grid of size
  10028. 300x300 pixels:
  10029. @example
  10030. life=f=pattern:s=300x300
  10031. @end example
  10032. @item
  10033. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  10034. @example
  10035. life=ratio=2/3:s=200x200
  10036. @end example
  10037. @item
  10038. Specify a custom rule for evolving a randomly generated grid:
  10039. @example
  10040. life=rule=S14/B34
  10041. @end example
  10042. @item
  10043. Full example with slow death effect (mold) using @command{ffplay}:
  10044. @example
  10045. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  10046. @end example
  10047. @end itemize
  10048. @anchor{allrgb}
  10049. @anchor{allyuv}
  10050. @anchor{color}
  10051. @anchor{haldclutsrc}
  10052. @anchor{nullsrc}
  10053. @anchor{rgbtestsrc}
  10054. @anchor{smptebars}
  10055. @anchor{smptehdbars}
  10056. @anchor{testsrc}
  10057. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  10058. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  10059. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  10060. The @code{color} source provides an uniformly colored input.
  10061. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  10062. @ref{haldclut} filter.
  10063. The @code{nullsrc} source returns unprocessed video frames. It is
  10064. mainly useful to be employed in analysis / debugging tools, or as the
  10065. source for filters which ignore the input data.
  10066. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  10067. detecting RGB vs BGR issues. You should see a red, green and blue
  10068. stripe from top to bottom.
  10069. The @code{smptebars} source generates a color bars pattern, based on
  10070. the SMPTE Engineering Guideline EG 1-1990.
  10071. The @code{smptehdbars} source generates a color bars pattern, based on
  10072. the SMPTE RP 219-2002.
  10073. The @code{testsrc} source generates a test video pattern, showing a
  10074. color pattern, a scrolling gradient and a timestamp. This is mainly
  10075. intended for testing purposes.
  10076. The sources accept the following parameters:
  10077. @table @option
  10078. @item color, c
  10079. Specify the color of the source, only available in the @code{color}
  10080. source. For the syntax of this option, check the "Color" section in the
  10081. ffmpeg-utils manual.
  10082. @item level
  10083. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  10084. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  10085. pixels to be used as identity matrix for 3D lookup tables. Each component is
  10086. coded on a @code{1/(N*N)} scale.
  10087. @item size, s
  10088. Specify the size of the sourced video. For the syntax of this option, check the
  10089. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10090. The default value is @code{320x240}.
  10091. This option is not available with the @code{haldclutsrc} filter.
  10092. @item rate, r
  10093. Specify the frame rate of the sourced video, as the number of frames
  10094. generated per second. It has to be a string in the format
  10095. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  10096. number or a valid video frame rate abbreviation. The default value is
  10097. "25".
  10098. @item sar
  10099. Set the sample aspect ratio of the sourced video.
  10100. @item duration, d
  10101. Set the duration of the sourced video. See
  10102. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10103. for the accepted syntax.
  10104. If not specified, or the expressed duration is negative, the video is
  10105. supposed to be generated forever.
  10106. @item decimals, n
  10107. Set the number of decimals to show in the timestamp, only available in the
  10108. @code{testsrc} source.
  10109. The displayed timestamp value will correspond to the original
  10110. timestamp value multiplied by the power of 10 of the specified
  10111. value. Default value is 0.
  10112. @end table
  10113. For example the following:
  10114. @example
  10115. testsrc=duration=5.3:size=qcif:rate=10
  10116. @end example
  10117. will generate a video with a duration of 5.3 seconds, with size
  10118. 176x144 and a frame rate of 10 frames per second.
  10119. The following graph description will generate a red source
  10120. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  10121. frames per second.
  10122. @example
  10123. color=c=red@@0.2:s=qcif:r=10
  10124. @end example
  10125. If the input content is to be ignored, @code{nullsrc} can be used. The
  10126. following command generates noise in the luminance plane by employing
  10127. the @code{geq} filter:
  10128. @example
  10129. nullsrc=s=256x256, geq=random(1)*255:128:128
  10130. @end example
  10131. @subsection Commands
  10132. The @code{color} source supports the following commands:
  10133. @table @option
  10134. @item c, color
  10135. Set the color of the created image. Accepts the same syntax of the
  10136. corresponding @option{color} option.
  10137. @end table
  10138. @c man end VIDEO SOURCES
  10139. @chapter Video Sinks
  10140. @c man begin VIDEO SINKS
  10141. Below is a description of the currently available video sinks.
  10142. @section buffersink
  10143. Buffer video frames, and make them available to the end of the filter
  10144. graph.
  10145. This sink is mainly intended for programmatic use, in particular
  10146. through the interface defined in @file{libavfilter/buffersink.h}
  10147. or the options system.
  10148. It accepts a pointer to an AVBufferSinkContext structure, which
  10149. defines the incoming buffers' formats, to be passed as the opaque
  10150. parameter to @code{avfilter_init_filter} for initialization.
  10151. @section nullsink
  10152. Null video sink: do absolutely nothing with the input video. It is
  10153. mainly useful as a template and for use in analysis / debugging
  10154. tools.
  10155. @c man end VIDEO SINKS
  10156. @chapter Multimedia Filters
  10157. @c man begin MULTIMEDIA FILTERS
  10158. Below is a description of the currently available multimedia filters.
  10159. @section aphasemeter
  10160. Convert input audio to a video output, displaying the audio phase.
  10161. The filter accepts the following options:
  10162. @table @option
  10163. @item rate, r
  10164. Set the output frame rate. Default value is @code{25}.
  10165. @item size, s
  10166. Set the video size for the output. For the syntax of this option, check the
  10167. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10168. Default value is @code{800x400}.
  10169. @item rc
  10170. @item gc
  10171. @item bc
  10172. Specify the red, green, blue contrast. Default values are @code{2},
  10173. @code{7} and @code{1}.
  10174. Allowed range is @code{[0, 255]}.
  10175. @item mpc
  10176. Set color which will be used for drawing median phase. If color is
  10177. @code{none} which is default, no median phase value will be drawn.
  10178. @end table
  10179. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  10180. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  10181. The @code{-1} means left and right channels are completely out of phase and
  10182. @code{1} means channels are in phase.
  10183. @section avectorscope
  10184. Convert input audio to a video output, representing the audio vector
  10185. scope.
  10186. The filter is used to measure the difference between channels of stereo
  10187. audio stream. A monoaural signal, consisting of identical left and right
  10188. signal, results in straight vertical line. Any stereo separation is visible
  10189. as a deviation from this line, creating a Lissajous figure.
  10190. If the straight (or deviation from it) but horizontal line appears this
  10191. indicates that the left and right channels are out of phase.
  10192. The filter accepts the following options:
  10193. @table @option
  10194. @item mode, m
  10195. Set the vectorscope mode.
  10196. Available values are:
  10197. @table @samp
  10198. @item lissajous
  10199. Lissajous rotated by 45 degrees.
  10200. @item lissajous_xy
  10201. Same as above but not rotated.
  10202. @item polar
  10203. Shape resembling half of circle.
  10204. @end table
  10205. Default value is @samp{lissajous}.
  10206. @item size, s
  10207. Set the video size for the output. For the syntax of this option, check the
  10208. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10209. Default value is @code{400x400}.
  10210. @item rate, r
  10211. Set the output frame rate. Default value is @code{25}.
  10212. @item rc
  10213. @item gc
  10214. @item bc
  10215. @item ac
  10216. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  10217. @code{160}, @code{80} and @code{255}.
  10218. Allowed range is @code{[0, 255]}.
  10219. @item rf
  10220. @item gf
  10221. @item bf
  10222. @item af
  10223. Specify the red, green, blue and alpha fade. Default values are @code{15},
  10224. @code{10}, @code{5} and @code{5}.
  10225. Allowed range is @code{[0, 255]}.
  10226. @item zoom
  10227. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  10228. @end table
  10229. @subsection Examples
  10230. @itemize
  10231. @item
  10232. Complete example using @command{ffplay}:
  10233. @example
  10234. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  10235. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  10236. @end example
  10237. @end itemize
  10238. @section concat
  10239. Concatenate audio and video streams, joining them together one after the
  10240. other.
  10241. The filter works on segments of synchronized video and audio streams. All
  10242. segments must have the same number of streams of each type, and that will
  10243. also be the number of streams at output.
  10244. The filter accepts the following options:
  10245. @table @option
  10246. @item n
  10247. Set the number of segments. Default is 2.
  10248. @item v
  10249. Set the number of output video streams, that is also the number of video
  10250. streams in each segment. Default is 1.
  10251. @item a
  10252. Set the number of output audio streams, that is also the number of audio
  10253. streams in each segment. Default is 0.
  10254. @item unsafe
  10255. Activate unsafe mode: do not fail if segments have a different format.
  10256. @end table
  10257. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  10258. @var{a} audio outputs.
  10259. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  10260. segment, in the same order as the outputs, then the inputs for the second
  10261. segment, etc.
  10262. Related streams do not always have exactly the same duration, for various
  10263. reasons including codec frame size or sloppy authoring. For that reason,
  10264. related synchronized streams (e.g. a video and its audio track) should be
  10265. concatenated at once. The concat filter will use the duration of the longest
  10266. stream in each segment (except the last one), and if necessary pad shorter
  10267. audio streams with silence.
  10268. For this filter to work correctly, all segments must start at timestamp 0.
  10269. All corresponding streams must have the same parameters in all segments; the
  10270. filtering system will automatically select a common pixel format for video
  10271. streams, and a common sample format, sample rate and channel layout for
  10272. audio streams, but other settings, such as resolution, must be converted
  10273. explicitly by the user.
  10274. Different frame rates are acceptable but will result in variable frame rate
  10275. at output; be sure to configure the output file to handle it.
  10276. @subsection Examples
  10277. @itemize
  10278. @item
  10279. Concatenate an opening, an episode and an ending, all in bilingual version
  10280. (video in stream 0, audio in streams 1 and 2):
  10281. @example
  10282. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  10283. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  10284. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  10285. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  10286. @end example
  10287. @item
  10288. Concatenate two parts, handling audio and video separately, using the
  10289. (a)movie sources, and adjusting the resolution:
  10290. @example
  10291. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  10292. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  10293. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  10294. @end example
  10295. Note that a desync will happen at the stitch if the audio and video streams
  10296. do not have exactly the same duration in the first file.
  10297. @end itemize
  10298. @anchor{ebur128}
  10299. @section ebur128
  10300. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  10301. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  10302. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  10303. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  10304. The filter also has a video output (see the @var{video} option) with a real
  10305. time graph to observe the loudness evolution. The graphic contains the logged
  10306. message mentioned above, so it is not printed anymore when this option is set,
  10307. unless the verbose logging is set. The main graphing area contains the
  10308. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  10309. the momentary loudness (400 milliseconds).
  10310. More information about the Loudness Recommendation EBU R128 on
  10311. @url{http://tech.ebu.ch/loudness}.
  10312. The filter accepts the following options:
  10313. @table @option
  10314. @item video
  10315. Activate the video output. The audio stream is passed unchanged whether this
  10316. option is set or no. The video stream will be the first output stream if
  10317. activated. Default is @code{0}.
  10318. @item size
  10319. Set the video size. This option is for video only. For the syntax of this
  10320. option, check the
  10321. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10322. Default and minimum resolution is @code{640x480}.
  10323. @item meter
  10324. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  10325. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  10326. other integer value between this range is allowed.
  10327. @item metadata
  10328. Set metadata injection. If set to @code{1}, the audio input will be segmented
  10329. into 100ms output frames, each of them containing various loudness information
  10330. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  10331. Default is @code{0}.
  10332. @item framelog
  10333. Force the frame logging level.
  10334. Available values are:
  10335. @table @samp
  10336. @item info
  10337. information logging level
  10338. @item verbose
  10339. verbose logging level
  10340. @end table
  10341. By default, the logging level is set to @var{info}. If the @option{video} or
  10342. the @option{metadata} options are set, it switches to @var{verbose}.
  10343. @item peak
  10344. Set peak mode(s).
  10345. Available modes can be cumulated (the option is a @code{flag} type). Possible
  10346. values are:
  10347. @table @samp
  10348. @item none
  10349. Disable any peak mode (default).
  10350. @item sample
  10351. Enable sample-peak mode.
  10352. Simple peak mode looking for the higher sample value. It logs a message
  10353. for sample-peak (identified by @code{SPK}).
  10354. @item true
  10355. Enable true-peak mode.
  10356. If enabled, the peak lookup is done on an over-sampled version of the input
  10357. stream for better peak accuracy. It logs a message for true-peak.
  10358. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  10359. This mode requires a build with @code{libswresample}.
  10360. @end table
  10361. @item dualmono
  10362. Treat mono input files as "dual mono". If a mono file is intended for playback
  10363. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  10364. If set to @code{true}, this option will compensate for this effect.
  10365. Multi-channel input files are not affected by this option.
  10366. @item panlaw
  10367. Set a specific pan law to be used for the measurement of dual mono files.
  10368. This parameter is optional, and has a default value of -3.01dB.
  10369. @end table
  10370. @subsection Examples
  10371. @itemize
  10372. @item
  10373. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  10374. @example
  10375. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  10376. @end example
  10377. @item
  10378. Run an analysis with @command{ffmpeg}:
  10379. @example
  10380. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  10381. @end example
  10382. @end itemize
  10383. @section interleave, ainterleave
  10384. Temporally interleave frames from several inputs.
  10385. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  10386. These filters read frames from several inputs and send the oldest
  10387. queued frame to the output.
  10388. Input streams must have a well defined, monotonically increasing frame
  10389. timestamp values.
  10390. In order to submit one frame to output, these filters need to enqueue
  10391. at least one frame for each input, so they cannot work in case one
  10392. input is not yet terminated and will not receive incoming frames.
  10393. For example consider the case when one input is a @code{select} filter
  10394. which always drop input frames. The @code{interleave} filter will keep
  10395. reading from that input, but it will never be able to send new frames
  10396. to output until the input will send an end-of-stream signal.
  10397. Also, depending on inputs synchronization, the filters will drop
  10398. frames in case one input receives more frames than the other ones, and
  10399. the queue is already filled.
  10400. These filters accept the following options:
  10401. @table @option
  10402. @item nb_inputs, n
  10403. Set the number of different inputs, it is 2 by default.
  10404. @end table
  10405. @subsection Examples
  10406. @itemize
  10407. @item
  10408. Interleave frames belonging to different streams using @command{ffmpeg}:
  10409. @example
  10410. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  10411. @end example
  10412. @item
  10413. Add flickering blur effect:
  10414. @example
  10415. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  10416. @end example
  10417. @end itemize
  10418. @section perms, aperms
  10419. Set read/write permissions for the output frames.
  10420. These filters are mainly aimed at developers to test direct path in the
  10421. following filter in the filtergraph.
  10422. The filters accept the following options:
  10423. @table @option
  10424. @item mode
  10425. Select the permissions mode.
  10426. It accepts the following values:
  10427. @table @samp
  10428. @item none
  10429. Do nothing. This is the default.
  10430. @item ro
  10431. Set all the output frames read-only.
  10432. @item rw
  10433. Set all the output frames directly writable.
  10434. @item toggle
  10435. Make the frame read-only if writable, and writable if read-only.
  10436. @item random
  10437. Set each output frame read-only or writable randomly.
  10438. @end table
  10439. @item seed
  10440. Set the seed for the @var{random} mode, must be an integer included between
  10441. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10442. @code{-1}, the filter will try to use a good random seed on a best effort
  10443. basis.
  10444. @end table
  10445. Note: in case of auto-inserted filter between the permission filter and the
  10446. following one, the permission might not be received as expected in that
  10447. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  10448. perms/aperms filter can avoid this problem.
  10449. @section realtime, arealtime
  10450. Slow down filtering to match real time approximatively.
  10451. These filters will pause the filtering for a variable amount of time to
  10452. match the output rate with the input timestamps.
  10453. They are similar to the @option{re} option to @code{ffmpeg}.
  10454. They accept the following options:
  10455. @table @option
  10456. @item limit
  10457. Time limit for the pauses. Any pause longer than that will be considered
  10458. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  10459. @end table
  10460. @section select, aselect
  10461. Select frames to pass in output.
  10462. This filter accepts the following options:
  10463. @table @option
  10464. @item expr, e
  10465. Set expression, which is evaluated for each input frame.
  10466. If the expression is evaluated to zero, the frame is discarded.
  10467. If the evaluation result is negative or NaN, the frame is sent to the
  10468. first output; otherwise it is sent to the output with index
  10469. @code{ceil(val)-1}, assuming that the input index starts from 0.
  10470. For example a value of @code{1.2} corresponds to the output with index
  10471. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  10472. @item outputs, n
  10473. Set the number of outputs. The output to which to send the selected
  10474. frame is based on the result of the evaluation. Default value is 1.
  10475. @end table
  10476. The expression can contain the following constants:
  10477. @table @option
  10478. @item n
  10479. The (sequential) number of the filtered frame, starting from 0.
  10480. @item selected_n
  10481. The (sequential) number of the selected frame, starting from 0.
  10482. @item prev_selected_n
  10483. The sequential number of the last selected frame. It's NAN if undefined.
  10484. @item TB
  10485. The timebase of the input timestamps.
  10486. @item pts
  10487. The PTS (Presentation TimeStamp) of the filtered video frame,
  10488. expressed in @var{TB} units. It's NAN if undefined.
  10489. @item t
  10490. The PTS of the filtered video frame,
  10491. expressed in seconds. It's NAN if undefined.
  10492. @item prev_pts
  10493. The PTS of the previously filtered video frame. It's NAN if undefined.
  10494. @item prev_selected_pts
  10495. The PTS of the last previously filtered video frame. It's NAN if undefined.
  10496. @item prev_selected_t
  10497. The PTS of the last previously selected video frame. It's NAN if undefined.
  10498. @item start_pts
  10499. The PTS of the first video frame in the video. It's NAN if undefined.
  10500. @item start_t
  10501. The time of the first video frame in the video. It's NAN if undefined.
  10502. @item pict_type @emph{(video only)}
  10503. The type of the filtered frame. It can assume one of the following
  10504. values:
  10505. @table @option
  10506. @item I
  10507. @item P
  10508. @item B
  10509. @item S
  10510. @item SI
  10511. @item SP
  10512. @item BI
  10513. @end table
  10514. @item interlace_type @emph{(video only)}
  10515. The frame interlace type. It can assume one of the following values:
  10516. @table @option
  10517. @item PROGRESSIVE
  10518. The frame is progressive (not interlaced).
  10519. @item TOPFIRST
  10520. The frame is top-field-first.
  10521. @item BOTTOMFIRST
  10522. The frame is bottom-field-first.
  10523. @end table
  10524. @item consumed_sample_n @emph{(audio only)}
  10525. the number of selected samples before the current frame
  10526. @item samples_n @emph{(audio only)}
  10527. the number of samples in the current frame
  10528. @item sample_rate @emph{(audio only)}
  10529. the input sample rate
  10530. @item key
  10531. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  10532. @item pos
  10533. the position in the file of the filtered frame, -1 if the information
  10534. is not available (e.g. for synthetic video)
  10535. @item scene @emph{(video only)}
  10536. value between 0 and 1 to indicate a new scene; a low value reflects a low
  10537. probability for the current frame to introduce a new scene, while a higher
  10538. value means the current frame is more likely to be one (see the example below)
  10539. @item concatdec_select
  10540. The concat demuxer can select only part of a concat input file by setting an
  10541. inpoint and an outpoint, but the output packets may not be entirely contained
  10542. in the selected interval. By using this variable, it is possible to skip frames
  10543. generated by the concat demuxer which are not exactly contained in the selected
  10544. interval.
  10545. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  10546. and the @var{lavf.concat.duration} packet metadata values which are also
  10547. present in the decoded frames.
  10548. The @var{concatdec_select} variable is -1 if the frame pts is at least
  10549. start_time and either the duration metadata is missing or the frame pts is less
  10550. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  10551. missing.
  10552. That basically means that an input frame is selected if its pts is within the
  10553. interval set by the concat demuxer.
  10554. @end table
  10555. The default value of the select expression is "1".
  10556. @subsection Examples
  10557. @itemize
  10558. @item
  10559. Select all frames in input:
  10560. @example
  10561. select
  10562. @end example
  10563. The example above is the same as:
  10564. @example
  10565. select=1
  10566. @end example
  10567. @item
  10568. Skip all frames:
  10569. @example
  10570. select=0
  10571. @end example
  10572. @item
  10573. Select only I-frames:
  10574. @example
  10575. select='eq(pict_type\,I)'
  10576. @end example
  10577. @item
  10578. Select one frame every 100:
  10579. @example
  10580. select='not(mod(n\,100))'
  10581. @end example
  10582. @item
  10583. Select only frames contained in the 10-20 time interval:
  10584. @example
  10585. select=between(t\,10\,20)
  10586. @end example
  10587. @item
  10588. Select only I frames contained in the 10-20 time interval:
  10589. @example
  10590. select=between(t\,10\,20)*eq(pict_type\,I)
  10591. @end example
  10592. @item
  10593. Select frames with a minimum distance of 10 seconds:
  10594. @example
  10595. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  10596. @end example
  10597. @item
  10598. Use aselect to select only audio frames with samples number > 100:
  10599. @example
  10600. aselect='gt(samples_n\,100)'
  10601. @end example
  10602. @item
  10603. Create a mosaic of the first scenes:
  10604. @example
  10605. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  10606. @end example
  10607. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  10608. choice.
  10609. @item
  10610. Send even and odd frames to separate outputs, and compose them:
  10611. @example
  10612. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  10613. @end example
  10614. @item
  10615. Select useful frames from an ffconcat file which is using inpoints and
  10616. outpoints but where the source files are not intra frame only.
  10617. @example
  10618. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  10619. @end example
  10620. @end itemize
  10621. @section sendcmd, asendcmd
  10622. Send commands to filters in the filtergraph.
  10623. These filters read commands to be sent to other filters in the
  10624. filtergraph.
  10625. @code{sendcmd} must be inserted between two video filters,
  10626. @code{asendcmd} must be inserted between two audio filters, but apart
  10627. from that they act the same way.
  10628. The specification of commands can be provided in the filter arguments
  10629. with the @var{commands} option, or in a file specified by the
  10630. @var{filename} option.
  10631. These filters accept the following options:
  10632. @table @option
  10633. @item commands, c
  10634. Set the commands to be read and sent to the other filters.
  10635. @item filename, f
  10636. Set the filename of the commands to be read and sent to the other
  10637. filters.
  10638. @end table
  10639. @subsection Commands syntax
  10640. A commands description consists of a sequence of interval
  10641. specifications, comprising a list of commands to be executed when a
  10642. particular event related to that interval occurs. The occurring event
  10643. is typically the current frame time entering or leaving a given time
  10644. interval.
  10645. An interval is specified by the following syntax:
  10646. @example
  10647. @var{START}[-@var{END}] @var{COMMANDS};
  10648. @end example
  10649. The time interval is specified by the @var{START} and @var{END} times.
  10650. @var{END} is optional and defaults to the maximum time.
  10651. The current frame time is considered within the specified interval if
  10652. it is included in the interval [@var{START}, @var{END}), that is when
  10653. the time is greater or equal to @var{START} and is lesser than
  10654. @var{END}.
  10655. @var{COMMANDS} consists of a sequence of one or more command
  10656. specifications, separated by ",", relating to that interval. The
  10657. syntax of a command specification is given by:
  10658. @example
  10659. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  10660. @end example
  10661. @var{FLAGS} is optional and specifies the type of events relating to
  10662. the time interval which enable sending the specified command, and must
  10663. be a non-null sequence of identifier flags separated by "+" or "|" and
  10664. enclosed between "[" and "]".
  10665. The following flags are recognized:
  10666. @table @option
  10667. @item enter
  10668. The command is sent when the current frame timestamp enters the
  10669. specified interval. In other words, the command is sent when the
  10670. previous frame timestamp was not in the given interval, and the
  10671. current is.
  10672. @item leave
  10673. The command is sent when the current frame timestamp leaves the
  10674. specified interval. In other words, the command is sent when the
  10675. previous frame timestamp was in the given interval, and the
  10676. current is not.
  10677. @end table
  10678. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  10679. assumed.
  10680. @var{TARGET} specifies the target of the command, usually the name of
  10681. the filter class or a specific filter instance name.
  10682. @var{COMMAND} specifies the name of the command for the target filter.
  10683. @var{ARG} is optional and specifies the optional list of argument for
  10684. the given @var{COMMAND}.
  10685. Between one interval specification and another, whitespaces, or
  10686. sequences of characters starting with @code{#} until the end of line,
  10687. are ignored and can be used to annotate comments.
  10688. A simplified BNF description of the commands specification syntax
  10689. follows:
  10690. @example
  10691. @var{COMMAND_FLAG} ::= "enter" | "leave"
  10692. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  10693. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  10694. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  10695. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  10696. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  10697. @end example
  10698. @subsection Examples
  10699. @itemize
  10700. @item
  10701. Specify audio tempo change at second 4:
  10702. @example
  10703. asendcmd=c='4.0 atempo tempo 1.5',atempo
  10704. @end example
  10705. @item
  10706. Specify a list of drawtext and hue commands in a file.
  10707. @example
  10708. # show text in the interval 5-10
  10709. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  10710. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  10711. # desaturate the image in the interval 15-20
  10712. 15.0-20.0 [enter] hue s 0,
  10713. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  10714. [leave] hue s 1,
  10715. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  10716. # apply an exponential saturation fade-out effect, starting from time 25
  10717. 25 [enter] hue s exp(25-t)
  10718. @end example
  10719. A filtergraph allowing to read and process the above command list
  10720. stored in a file @file{test.cmd}, can be specified with:
  10721. @example
  10722. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  10723. @end example
  10724. @end itemize
  10725. @anchor{setpts}
  10726. @section setpts, asetpts
  10727. Change the PTS (presentation timestamp) of the input frames.
  10728. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  10729. This filter accepts the following options:
  10730. @table @option
  10731. @item expr
  10732. The expression which is evaluated for each frame to construct its timestamp.
  10733. @end table
  10734. The expression is evaluated through the eval API and can contain the following
  10735. constants:
  10736. @table @option
  10737. @item FRAME_RATE
  10738. frame rate, only defined for constant frame-rate video
  10739. @item PTS
  10740. The presentation timestamp in input
  10741. @item N
  10742. The count of the input frame for video or the number of consumed samples,
  10743. not including the current frame for audio, starting from 0.
  10744. @item NB_CONSUMED_SAMPLES
  10745. The number of consumed samples, not including the current frame (only
  10746. audio)
  10747. @item NB_SAMPLES, S
  10748. The number of samples in the current frame (only audio)
  10749. @item SAMPLE_RATE, SR
  10750. The audio sample rate.
  10751. @item STARTPTS
  10752. The PTS of the first frame.
  10753. @item STARTT
  10754. the time in seconds of the first frame
  10755. @item INTERLACED
  10756. State whether the current frame is interlaced.
  10757. @item T
  10758. the time in seconds of the current frame
  10759. @item POS
  10760. original position in the file of the frame, or undefined if undefined
  10761. for the current frame
  10762. @item PREV_INPTS
  10763. The previous input PTS.
  10764. @item PREV_INT
  10765. previous input time in seconds
  10766. @item PREV_OUTPTS
  10767. The previous output PTS.
  10768. @item PREV_OUTT
  10769. previous output time in seconds
  10770. @item RTCTIME
  10771. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  10772. instead.
  10773. @item RTCSTART
  10774. The wallclock (RTC) time at the start of the movie in microseconds.
  10775. @item TB
  10776. The timebase of the input timestamps.
  10777. @end table
  10778. @subsection Examples
  10779. @itemize
  10780. @item
  10781. Start counting PTS from zero
  10782. @example
  10783. setpts=PTS-STARTPTS
  10784. @end example
  10785. @item
  10786. Apply fast motion effect:
  10787. @example
  10788. setpts=0.5*PTS
  10789. @end example
  10790. @item
  10791. Apply slow motion effect:
  10792. @example
  10793. setpts=2.0*PTS
  10794. @end example
  10795. @item
  10796. Set fixed rate of 25 frames per second:
  10797. @example
  10798. setpts=N/(25*TB)
  10799. @end example
  10800. @item
  10801. Set fixed rate 25 fps with some jitter:
  10802. @example
  10803. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  10804. @end example
  10805. @item
  10806. Apply an offset of 10 seconds to the input PTS:
  10807. @example
  10808. setpts=PTS+10/TB
  10809. @end example
  10810. @item
  10811. Generate timestamps from a "live source" and rebase onto the current timebase:
  10812. @example
  10813. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  10814. @end example
  10815. @item
  10816. Generate timestamps by counting samples:
  10817. @example
  10818. asetpts=N/SR/TB
  10819. @end example
  10820. @end itemize
  10821. @section settb, asettb
  10822. Set the timebase to use for the output frames timestamps.
  10823. It is mainly useful for testing timebase configuration.
  10824. It accepts the following parameters:
  10825. @table @option
  10826. @item expr, tb
  10827. The expression which is evaluated into the output timebase.
  10828. @end table
  10829. The value for @option{tb} is an arithmetic expression representing a
  10830. rational. The expression can contain the constants "AVTB" (the default
  10831. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  10832. audio only). Default value is "intb".
  10833. @subsection Examples
  10834. @itemize
  10835. @item
  10836. Set the timebase to 1/25:
  10837. @example
  10838. settb=expr=1/25
  10839. @end example
  10840. @item
  10841. Set the timebase to 1/10:
  10842. @example
  10843. settb=expr=0.1
  10844. @end example
  10845. @item
  10846. Set the timebase to 1001/1000:
  10847. @example
  10848. settb=1+0.001
  10849. @end example
  10850. @item
  10851. Set the timebase to 2*intb:
  10852. @example
  10853. settb=2*intb
  10854. @end example
  10855. @item
  10856. Set the default timebase value:
  10857. @example
  10858. settb=AVTB
  10859. @end example
  10860. @end itemize
  10861. @section showcqt
  10862. Convert input audio to a video output representing frequency spectrum
  10863. logarithmically using Brown-Puckette constant Q transform algorithm with
  10864. direct frequency domain coefficient calculation (but the transform itself
  10865. is not really constant Q, instead the Q factor is actually variable/clamped),
  10866. with musical tone scale, from E0 to D#10.
  10867. The filter accepts the following options:
  10868. @table @option
  10869. @item size, s
  10870. Specify the video size for the output. It must be even. For the syntax of this option,
  10871. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10872. Default value is @code{1920x1080}.
  10873. @item fps, rate, r
  10874. Set the output frame rate. Default value is @code{25}.
  10875. @item bar_h
  10876. Set the bargraph height. It must be even. Default value is @code{-1} which
  10877. computes the bargraph height automatically.
  10878. @item axis_h
  10879. Set the axis height. It must be even. Default value is @code{-1} which computes
  10880. the axis height automatically.
  10881. @item sono_h
  10882. Set the sonogram height. It must be even. Default value is @code{-1} which
  10883. computes the sonogram height automatically.
  10884. @item fullhd
  10885. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  10886. instead. Default value is @code{1}.
  10887. @item sono_v, volume
  10888. Specify the sonogram volume expression. It can contain variables:
  10889. @table @option
  10890. @item bar_v
  10891. the @var{bar_v} evaluated expression
  10892. @item frequency, freq, f
  10893. the frequency where it is evaluated
  10894. @item timeclamp, tc
  10895. the value of @var{timeclamp} option
  10896. @end table
  10897. and functions:
  10898. @table @option
  10899. @item a_weighting(f)
  10900. A-weighting of equal loudness
  10901. @item b_weighting(f)
  10902. B-weighting of equal loudness
  10903. @item c_weighting(f)
  10904. C-weighting of equal loudness.
  10905. @end table
  10906. Default value is @code{16}.
  10907. @item bar_v, volume2
  10908. Specify the bargraph volume expression. It can contain variables:
  10909. @table @option
  10910. @item sono_v
  10911. the @var{sono_v} evaluated expression
  10912. @item frequency, freq, f
  10913. the frequency where it is evaluated
  10914. @item timeclamp, tc
  10915. the value of @var{timeclamp} option
  10916. @end table
  10917. and functions:
  10918. @table @option
  10919. @item a_weighting(f)
  10920. A-weighting of equal loudness
  10921. @item b_weighting(f)
  10922. B-weighting of equal loudness
  10923. @item c_weighting(f)
  10924. C-weighting of equal loudness.
  10925. @end table
  10926. Default value is @code{sono_v}.
  10927. @item sono_g, gamma
  10928. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  10929. higher gamma makes the spectrum having more range. Default value is @code{3}.
  10930. Acceptable range is @code{[1, 7]}.
  10931. @item bar_g, gamma2
  10932. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  10933. @code{[1, 7]}.
  10934. @item timeclamp, tc
  10935. Specify the transform timeclamp. At low frequency, there is trade-off between
  10936. accuracy in time domain and frequency domain. If timeclamp is lower,
  10937. event in time domain is represented more accurately (such as fast bass drum),
  10938. otherwise event in frequency domain is represented more accurately
  10939. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  10940. @item basefreq
  10941. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  10942. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  10943. @item endfreq
  10944. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  10945. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  10946. @item coeffclamp
  10947. This option is deprecated and ignored.
  10948. @item tlength
  10949. Specify the transform length in time domain. Use this option to control accuracy
  10950. trade-off between time domain and frequency domain at every frequency sample.
  10951. It can contain variables:
  10952. @table @option
  10953. @item frequency, freq, f
  10954. the frequency where it is evaluated
  10955. @item timeclamp, tc
  10956. the value of @var{timeclamp} option.
  10957. @end table
  10958. Default value is @code{384*tc/(384+tc*f)}.
  10959. @item count
  10960. Specify the transform count for every video frame. Default value is @code{6}.
  10961. Acceptable range is @code{[1, 30]}.
  10962. @item fcount
  10963. Specify the transform count for every single pixel. Default value is @code{0},
  10964. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  10965. @item fontfile
  10966. Specify font file for use with freetype to draw the axis. If not specified,
  10967. use embedded font. Note that drawing with font file or embedded font is not
  10968. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  10969. option instead.
  10970. @item fontcolor
  10971. Specify font color expression. This is arithmetic expression that should return
  10972. integer value 0xRRGGBB. It can contain variables:
  10973. @table @option
  10974. @item frequency, freq, f
  10975. the frequency where it is evaluated
  10976. @item timeclamp, tc
  10977. the value of @var{timeclamp} option
  10978. @end table
  10979. and functions:
  10980. @table @option
  10981. @item midi(f)
  10982. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  10983. @item r(x), g(x), b(x)
  10984. red, green, and blue value of intensity x.
  10985. @end table
  10986. Default value is @code{st(0, (midi(f)-59.5)/12);
  10987. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  10988. r(1-ld(1)) + b(ld(1))}.
  10989. @item axisfile
  10990. Specify image file to draw the axis. This option override @var{fontfile} and
  10991. @var{fontcolor} option.
  10992. @item axis, text
  10993. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  10994. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  10995. Default value is @code{1}.
  10996. @end table
  10997. @subsection Examples
  10998. @itemize
  10999. @item
  11000. Playing audio while showing the spectrum:
  11001. @example
  11002. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  11003. @end example
  11004. @item
  11005. Same as above, but with frame rate 30 fps:
  11006. @example
  11007. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  11008. @end example
  11009. @item
  11010. Playing at 1280x720:
  11011. @example
  11012. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  11013. @end example
  11014. @item
  11015. Disable sonogram display:
  11016. @example
  11017. sono_h=0
  11018. @end example
  11019. @item
  11020. A1 and its harmonics: A1, A2, (near)E3, A3:
  11021. @example
  11022. 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),
  11023. asplit[a][out1]; [a] showcqt [out0]'
  11024. @end example
  11025. @item
  11026. Same as above, but with more accuracy in frequency domain:
  11027. @example
  11028. 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),
  11029. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  11030. @end example
  11031. @item
  11032. Custom volume:
  11033. @example
  11034. bar_v=10:sono_v=bar_v*a_weighting(f)
  11035. @end example
  11036. @item
  11037. Custom gamma, now spectrum is linear to the amplitude.
  11038. @example
  11039. bar_g=2:sono_g=2
  11040. @end example
  11041. @item
  11042. Custom tlength equation:
  11043. @example
  11044. 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)))'
  11045. @end example
  11046. @item
  11047. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  11048. @example
  11049. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  11050. @end example
  11051. @item
  11052. Custom frequency range with custom axis using image file:
  11053. @example
  11054. axisfile=myaxis.png:basefreq=40:endfreq=10000
  11055. @end example
  11056. @end itemize
  11057. @section showfreqs
  11058. Convert input audio to video output representing the audio power spectrum.
  11059. Audio amplitude is on Y-axis while frequency is on X-axis.
  11060. The filter accepts the following options:
  11061. @table @option
  11062. @item size, s
  11063. Specify size of video. For the syntax of this option, check the
  11064. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11065. Default is @code{1024x512}.
  11066. @item mode
  11067. Set display mode.
  11068. This set how each frequency bin will be represented.
  11069. It accepts the following values:
  11070. @table @samp
  11071. @item line
  11072. @item bar
  11073. @item dot
  11074. @end table
  11075. Default is @code{bar}.
  11076. @item ascale
  11077. Set amplitude scale.
  11078. It accepts the following values:
  11079. @table @samp
  11080. @item lin
  11081. Linear scale.
  11082. @item sqrt
  11083. Square root scale.
  11084. @item cbrt
  11085. Cubic root scale.
  11086. @item log
  11087. Logarithmic scale.
  11088. @end table
  11089. Default is @code{log}.
  11090. @item fscale
  11091. Set frequency scale.
  11092. It accepts the following values:
  11093. @table @samp
  11094. @item lin
  11095. Linear scale.
  11096. @item log
  11097. Logarithmic scale.
  11098. @item rlog
  11099. Reverse logarithmic scale.
  11100. @end table
  11101. Default is @code{lin}.
  11102. @item win_size
  11103. Set window size.
  11104. It accepts the following values:
  11105. @table @samp
  11106. @item w16
  11107. @item w32
  11108. @item w64
  11109. @item w128
  11110. @item w256
  11111. @item w512
  11112. @item w1024
  11113. @item w2048
  11114. @item w4096
  11115. @item w8192
  11116. @item w16384
  11117. @item w32768
  11118. @item w65536
  11119. @end table
  11120. Default is @code{w2048}
  11121. @item win_func
  11122. Set windowing function.
  11123. It accepts the following values:
  11124. @table @samp
  11125. @item rect
  11126. @item bartlett
  11127. @item hanning
  11128. @item hamming
  11129. @item blackman
  11130. @item welch
  11131. @item flattop
  11132. @item bharris
  11133. @item bnuttall
  11134. @item bhann
  11135. @item sine
  11136. @item nuttall
  11137. @item lanczos
  11138. @item gauss
  11139. @end table
  11140. Default is @code{hanning}.
  11141. @item overlap
  11142. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  11143. which means optimal overlap for selected window function will be picked.
  11144. @item averaging
  11145. Set time averaging. Setting this to 0 will display current maximal peaks.
  11146. Default is @code{1}, which means time averaging is disabled.
  11147. @item colors
  11148. Specify list of colors separated by space or by '|' which will be used to
  11149. draw channel frequencies. Unrecognized or missing colors will be replaced
  11150. by white color.
  11151. @item cmode
  11152. Set channel display mode.
  11153. It accepts the following values:
  11154. @table @samp
  11155. @item combined
  11156. @item separate
  11157. @end table
  11158. Default is @code{combined}.
  11159. @end table
  11160. @section showspectrum
  11161. Convert input audio to a video output, representing the audio frequency
  11162. spectrum.
  11163. The filter accepts the following options:
  11164. @table @option
  11165. @item size, s
  11166. Specify the video size for the output. For the syntax of this option, check the
  11167. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11168. Default value is @code{640x512}.
  11169. @item slide
  11170. Specify how the spectrum should slide along the window.
  11171. It accepts the following values:
  11172. @table @samp
  11173. @item replace
  11174. the samples start again on the left when they reach the right
  11175. @item scroll
  11176. the samples scroll from right to left
  11177. @item rscroll
  11178. the samples scroll from left to right
  11179. @item fullframe
  11180. frames are only produced when the samples reach the right
  11181. @end table
  11182. Default value is @code{replace}.
  11183. @item mode
  11184. Specify display mode.
  11185. It accepts the following values:
  11186. @table @samp
  11187. @item combined
  11188. all channels are displayed in the same row
  11189. @item separate
  11190. all channels are displayed in separate rows
  11191. @end table
  11192. Default value is @samp{combined}.
  11193. @item color
  11194. Specify display color mode.
  11195. It accepts the following values:
  11196. @table @samp
  11197. @item channel
  11198. each channel is displayed in a separate color
  11199. @item intensity
  11200. each channel is is displayed using the same color scheme
  11201. @end table
  11202. Default value is @samp{channel}.
  11203. @item scale
  11204. Specify scale used for calculating intensity color values.
  11205. It accepts the following values:
  11206. @table @samp
  11207. @item lin
  11208. linear
  11209. @item sqrt
  11210. square root, default
  11211. @item cbrt
  11212. cubic root
  11213. @item log
  11214. logarithmic
  11215. @end table
  11216. Default value is @samp{sqrt}.
  11217. @item saturation
  11218. Set saturation modifier for displayed colors. Negative values provide
  11219. alternative color scheme. @code{0} is no saturation at all.
  11220. Saturation must be in [-10.0, 10.0] range.
  11221. Default value is @code{1}.
  11222. @item win_func
  11223. Set window function.
  11224. It accepts the following values:
  11225. @table @samp
  11226. @item rect
  11227. @item bartlett
  11228. @item hann
  11229. @item hanning
  11230. @item hamming
  11231. @item blackman
  11232. @item welch
  11233. @item flattop
  11234. @item bharris
  11235. @item bnuttall
  11236. @item bhann
  11237. @item sine
  11238. @item nuttall
  11239. @item lanczos
  11240. @item gauss
  11241. @end table
  11242. Default value is @code{hann}.
  11243. @end table
  11244. The usage is very similar to the showwaves filter; see the examples in that
  11245. section.
  11246. @subsection Examples
  11247. @itemize
  11248. @item
  11249. Large window with logarithmic color scaling:
  11250. @example
  11251. showspectrum=s=1280x480:scale=log
  11252. @end example
  11253. @item
  11254. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  11255. @example
  11256. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11257. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  11258. @end example
  11259. @end itemize
  11260. @section showvolume
  11261. Convert input audio volume to a video output.
  11262. The filter accepts the following options:
  11263. @table @option
  11264. @item rate, r
  11265. Set video rate.
  11266. @item b
  11267. Set border width, allowed range is [0, 5]. Default is 1.
  11268. @item w
  11269. Set channel width, allowed range is [80, 1080]. Default is 400.
  11270. @item h
  11271. Set channel height, allowed range is [1, 100]. Default is 20.
  11272. @item f
  11273. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  11274. @item c
  11275. Set volume color expression.
  11276. The expression can use the following variables:
  11277. @table @option
  11278. @item VOLUME
  11279. Current max volume of channel in dB.
  11280. @item CHANNEL
  11281. Current channel number, starting from 0.
  11282. @end table
  11283. @item t
  11284. If set, displays channel names. Default is enabled.
  11285. @item v
  11286. If set, displays volume values. Default is enabled.
  11287. @end table
  11288. @section showwaves
  11289. Convert input audio to a video output, representing the samples waves.
  11290. The filter accepts the following options:
  11291. @table @option
  11292. @item size, s
  11293. Specify the video size for the output. For the syntax of this option, check the
  11294. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11295. Default value is @code{600x240}.
  11296. @item mode
  11297. Set display mode.
  11298. Available values are:
  11299. @table @samp
  11300. @item point
  11301. Draw a point for each sample.
  11302. @item line
  11303. Draw a vertical line for each sample.
  11304. @item p2p
  11305. Draw a point for each sample and a line between them.
  11306. @item cline
  11307. Draw a centered vertical line for each sample.
  11308. @end table
  11309. Default value is @code{point}.
  11310. @item n
  11311. Set the number of samples which are printed on the same column. A
  11312. larger value will decrease the frame rate. Must be a positive
  11313. integer. This option can be set only if the value for @var{rate}
  11314. is not explicitly specified.
  11315. @item rate, r
  11316. Set the (approximate) output frame rate. This is done by setting the
  11317. option @var{n}. Default value is "25".
  11318. @item split_channels
  11319. Set if channels should be drawn separately or overlap. Default value is 0.
  11320. @end table
  11321. @subsection Examples
  11322. @itemize
  11323. @item
  11324. Output the input file audio and the corresponding video representation
  11325. at the same time:
  11326. @example
  11327. amovie=a.mp3,asplit[out0],showwaves[out1]
  11328. @end example
  11329. @item
  11330. Create a synthetic signal and show it with showwaves, forcing a
  11331. frame rate of 30 frames per second:
  11332. @example
  11333. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  11334. @end example
  11335. @end itemize
  11336. @section showwavespic
  11337. Convert input audio to a single video frame, representing the samples waves.
  11338. The filter accepts the following options:
  11339. @table @option
  11340. @item size, s
  11341. Specify the video size for the output. For the syntax of this option, check the
  11342. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11343. Default value is @code{600x240}.
  11344. @item split_channels
  11345. Set if channels should be drawn separately or overlap. Default value is 0.
  11346. @end table
  11347. @subsection Examples
  11348. @itemize
  11349. @item
  11350. Extract a channel split representation of the wave form of a whole audio track
  11351. in a 1024x800 picture using @command{ffmpeg}:
  11352. @example
  11353. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  11354. @end example
  11355. @end itemize
  11356. @section split, asplit
  11357. Split input into several identical outputs.
  11358. @code{asplit} works with audio input, @code{split} with video.
  11359. The filter accepts a single parameter which specifies the number of outputs. If
  11360. unspecified, it defaults to 2.
  11361. @subsection Examples
  11362. @itemize
  11363. @item
  11364. Create two separate outputs from the same input:
  11365. @example
  11366. [in] split [out0][out1]
  11367. @end example
  11368. @item
  11369. To create 3 or more outputs, you need to specify the number of
  11370. outputs, like in:
  11371. @example
  11372. [in] asplit=3 [out0][out1][out2]
  11373. @end example
  11374. @item
  11375. Create two separate outputs from the same input, one cropped and
  11376. one padded:
  11377. @example
  11378. [in] split [splitout1][splitout2];
  11379. [splitout1] crop=100:100:0:0 [cropout];
  11380. [splitout2] pad=200:200:100:100 [padout];
  11381. @end example
  11382. @item
  11383. Create 5 copies of the input audio with @command{ffmpeg}:
  11384. @example
  11385. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  11386. @end example
  11387. @end itemize
  11388. @section zmq, azmq
  11389. Receive commands sent through a libzmq client, and forward them to
  11390. filters in the filtergraph.
  11391. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  11392. must be inserted between two video filters, @code{azmq} between two
  11393. audio filters.
  11394. To enable these filters you need to install the libzmq library and
  11395. headers and configure FFmpeg with @code{--enable-libzmq}.
  11396. For more information about libzmq see:
  11397. @url{http://www.zeromq.org/}
  11398. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  11399. receives messages sent through a network interface defined by the
  11400. @option{bind_address} option.
  11401. The received message must be in the form:
  11402. @example
  11403. @var{TARGET} @var{COMMAND} [@var{ARG}]
  11404. @end example
  11405. @var{TARGET} specifies the target of the command, usually the name of
  11406. the filter class or a specific filter instance name.
  11407. @var{COMMAND} specifies the name of the command for the target filter.
  11408. @var{ARG} is optional and specifies the optional argument list for the
  11409. given @var{COMMAND}.
  11410. Upon reception, the message is processed and the corresponding command
  11411. is injected into the filtergraph. Depending on the result, the filter
  11412. will send a reply to the client, adopting the format:
  11413. @example
  11414. @var{ERROR_CODE} @var{ERROR_REASON}
  11415. @var{MESSAGE}
  11416. @end example
  11417. @var{MESSAGE} is optional.
  11418. @subsection Examples
  11419. Look at @file{tools/zmqsend} for an example of a zmq client which can
  11420. be used to send commands processed by these filters.
  11421. Consider the following filtergraph generated by @command{ffplay}
  11422. @example
  11423. ffplay -dumpgraph 1 -f lavfi "
  11424. color=s=100x100:c=red [l];
  11425. color=s=100x100:c=blue [r];
  11426. nullsrc=s=200x100, zmq [bg];
  11427. [bg][l] overlay [bg+l];
  11428. [bg+l][r] overlay=x=100 "
  11429. @end example
  11430. To change the color of the left side of the video, the following
  11431. command can be used:
  11432. @example
  11433. echo Parsed_color_0 c yellow | tools/zmqsend
  11434. @end example
  11435. To change the right side:
  11436. @example
  11437. echo Parsed_color_1 c pink | tools/zmqsend
  11438. @end example
  11439. @c man end MULTIMEDIA FILTERS
  11440. @chapter Multimedia Sources
  11441. @c man begin MULTIMEDIA SOURCES
  11442. Below is a description of the currently available multimedia sources.
  11443. @section amovie
  11444. This is the same as @ref{movie} source, except it selects an audio
  11445. stream by default.
  11446. @anchor{movie}
  11447. @section movie
  11448. Read audio and/or video stream(s) from a movie container.
  11449. It accepts the following parameters:
  11450. @table @option
  11451. @item filename
  11452. The name of the resource to read (not necessarily a file; it can also be a
  11453. device or a stream accessed through some protocol).
  11454. @item format_name, f
  11455. Specifies the format assumed for the movie to read, and can be either
  11456. the name of a container or an input device. If not specified, the
  11457. format is guessed from @var{movie_name} or by probing.
  11458. @item seek_point, sp
  11459. Specifies the seek point in seconds. The frames will be output
  11460. starting from this seek point. The parameter is evaluated with
  11461. @code{av_strtod}, so the numerical value may be suffixed by an IS
  11462. postfix. The default value is "0".
  11463. @item streams, s
  11464. Specifies the streams to read. Several streams can be specified,
  11465. separated by "+". The source will then have as many outputs, in the
  11466. same order. The syntax is explained in the ``Stream specifiers''
  11467. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  11468. respectively the default (best suited) video and audio stream. Default
  11469. is "dv", or "da" if the filter is called as "amovie".
  11470. @item stream_index, si
  11471. Specifies the index of the video stream to read. If the value is -1,
  11472. the most suitable video stream will be automatically selected. The default
  11473. value is "-1". Deprecated. If the filter is called "amovie", it will select
  11474. audio instead of video.
  11475. @item loop
  11476. Specifies how many times to read the stream in sequence.
  11477. If the value is less than 1, the stream will be read again and again.
  11478. Default value is "1".
  11479. Note that when the movie is looped the source timestamps are not
  11480. changed, so it will generate non monotonically increasing timestamps.
  11481. @end table
  11482. It allows overlaying a second video on top of the main input of
  11483. a filtergraph, as shown in this graph:
  11484. @example
  11485. input -----------> deltapts0 --> overlay --> output
  11486. ^
  11487. |
  11488. movie --> scale--> deltapts1 -------+
  11489. @end example
  11490. @subsection Examples
  11491. @itemize
  11492. @item
  11493. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  11494. on top of the input labelled "in":
  11495. @example
  11496. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11497. [in] setpts=PTS-STARTPTS [main];
  11498. [main][over] overlay=16:16 [out]
  11499. @end example
  11500. @item
  11501. Read from a video4linux2 device, and overlay it on top of the input
  11502. labelled "in":
  11503. @example
  11504. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11505. [in] setpts=PTS-STARTPTS [main];
  11506. [main][over] overlay=16:16 [out]
  11507. @end example
  11508. @item
  11509. Read the first video stream and the audio stream with id 0x81 from
  11510. dvd.vob; the video is connected to the pad named "video" and the audio is
  11511. connected to the pad named "audio":
  11512. @example
  11513. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  11514. @end example
  11515. @end itemize
  11516. @c man end MULTIMEDIA SOURCES