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.

16605 lines
448KB

  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. @section afftfilt
  588. Apply arbitrary expressions to samples in frequency domain.
  589. @table @option
  590. @item real
  591. Set frequency domain real expression for each separate channel separated
  592. by '|'. Default is "1".
  593. If the number of input channels is greater than the number of
  594. expressions, the last specified expression is used for the remaining
  595. output channels.
  596. @item imag
  597. Set frequency domain imaginary expression for each separate channel
  598. separated by '|'. If not set, @var{real} option is used.
  599. Each expression in @var{real} and @var{imag} can contain the following
  600. constants:
  601. @table @option
  602. @item sr
  603. sample rate
  604. @item b
  605. current frequency bin number
  606. @item nb
  607. number of available bins
  608. @item ch
  609. channel number of the current expression
  610. @item chs
  611. number of channels
  612. @item pts
  613. current frame pts
  614. @end table
  615. @item win_size
  616. Set window size.
  617. It accepts the following values:
  618. @table @samp
  619. @item w16
  620. @item w32
  621. @item w64
  622. @item w128
  623. @item w256
  624. @item w512
  625. @item w1024
  626. @item w2048
  627. @item w4096
  628. @item w8192
  629. @item w16384
  630. @item w32768
  631. @item w65536
  632. @end table
  633. Default is @code{w4096}
  634. @item win_func
  635. Set window function. Default is @code{hann}.
  636. @item overlap
  637. Set window overlap. If set to 1, the recommended overlap for selected
  638. window function will be picked. Default is @code{0.75}.
  639. @end table
  640. @subsection Examples
  641. @itemize
  642. @item
  643. Leave almost only low frequencies in audio:
  644. @example
  645. afftfilt="1-clip((b/nb)*b,0,1)"
  646. @end example
  647. @end itemize
  648. @anchor{aformat}
  649. @section aformat
  650. Set output format constraints for the input audio. The framework will
  651. negotiate the most appropriate format to minimize conversions.
  652. It accepts the following parameters:
  653. @table @option
  654. @item sample_fmts
  655. A '|'-separated list of requested sample formats.
  656. @item sample_rates
  657. A '|'-separated list of requested sample rates.
  658. @item channel_layouts
  659. A '|'-separated list of requested channel layouts.
  660. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  661. for the required syntax.
  662. @end table
  663. If a parameter is omitted, all values are allowed.
  664. Force the output to either unsigned 8-bit or signed 16-bit stereo
  665. @example
  666. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  667. @end example
  668. @section agate
  669. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  670. processing reduces disturbing noise between useful signals.
  671. Gating is done by detecting the volume below a chosen level @var{threshold}
  672. and divide it by the factor set with @var{ratio}. The bottom of the noise
  673. floor is set via @var{range}. Because an exact manipulation of the signal
  674. would cause distortion of the waveform the reduction can be levelled over
  675. time. This is done by setting @var{attack} and @var{release}.
  676. @var{attack} determines how long the signal has to fall below the threshold
  677. before any reduction will occur and @var{release} sets the time the signal
  678. has to raise above the threshold to reduce the reduction again.
  679. Shorter signals than the chosen attack time will be left untouched.
  680. @table @option
  681. @item level_in
  682. Set input level before filtering.
  683. Default is 1. Allowed range is from 0.015625 to 64.
  684. @item range
  685. Set the level of gain reduction when the signal is below the threshold.
  686. Default is 0.06125. Allowed range is from 0 to 1.
  687. @item threshold
  688. If a signal rises above this level the gain reduction is released.
  689. Default is 0.125. Allowed range is from 0 to 1.
  690. @item ratio
  691. Set a ratio about which the signal is reduced.
  692. Default is 2. Allowed range is from 1 to 9000.
  693. @item attack
  694. Amount of milliseconds the signal has to rise above the threshold before gain
  695. reduction stops.
  696. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  697. @item release
  698. Amount of milliseconds the signal has to fall below the threshold before the
  699. reduction is increased again. Default is 250 milliseconds.
  700. Allowed range is from 0.01 to 9000.
  701. @item makeup
  702. Set amount of amplification of signal after processing.
  703. Default is 1. Allowed range is from 1 to 64.
  704. @item knee
  705. Curve the sharp knee around the threshold to enter gain reduction more softly.
  706. Default is 2.828427125. Allowed range is from 1 to 8.
  707. @item detection
  708. Choose if exact signal should be taken for detection or an RMS like one.
  709. Default is rms. Can be peak or rms.
  710. @item link
  711. Choose if the average level between all channels or the louder channel affects
  712. the reduction.
  713. Default is average. Can be average or maximum.
  714. @end table
  715. @section alimiter
  716. The limiter prevents input signal from raising over a desired threshold.
  717. This limiter uses lookahead technology to prevent your signal from distorting.
  718. It means that there is a small delay after signal is processed. Keep in mind
  719. that the delay it produces is the attack time you set.
  720. The filter accepts the following options:
  721. @table @option
  722. @item level_in
  723. Set input gain. Default is 1.
  724. @item level_out
  725. Set output gain. Default is 1.
  726. @item limit
  727. Don't let signals above this level pass the limiter. Default is 1.
  728. @item attack
  729. The limiter will reach its attenuation level in this amount of time in
  730. milliseconds. Default is 5 milliseconds.
  731. @item release
  732. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  733. Default is 50 milliseconds.
  734. @item asc
  735. When gain reduction is always needed ASC takes care of releasing to an
  736. average reduction level rather than reaching a reduction of 0 in the release
  737. time.
  738. @item asc_level
  739. Select how much the release time is affected by ASC, 0 means nearly no changes
  740. in release time while 1 produces higher release times.
  741. @item level
  742. Auto level output signal. Default is enabled.
  743. This normalizes audio back to 0dB if enabled.
  744. @end table
  745. Depending on picked setting it is recommended to upsample input 2x or 4x times
  746. with @ref{aresample} before applying this filter.
  747. @section allpass
  748. Apply a two-pole all-pass filter with central frequency (in Hz)
  749. @var{frequency}, and filter-width @var{width}.
  750. An all-pass filter changes the audio's frequency to phase relationship
  751. without changing its frequency to amplitude relationship.
  752. The filter accepts the following options:
  753. @table @option
  754. @item frequency, f
  755. Set frequency in Hz.
  756. @item width_type
  757. Set method to specify band-width of filter.
  758. @table @option
  759. @item h
  760. Hz
  761. @item q
  762. Q-Factor
  763. @item o
  764. octave
  765. @item s
  766. slope
  767. @end table
  768. @item width, w
  769. Specify the band-width of a filter in width_type units.
  770. @end table
  771. @anchor{amerge}
  772. @section amerge
  773. Merge two or more audio streams into a single multi-channel stream.
  774. The filter accepts the following options:
  775. @table @option
  776. @item inputs
  777. Set the number of inputs. Default is 2.
  778. @end table
  779. If the channel layouts of the inputs are disjoint, and therefore compatible,
  780. the channel layout of the output will be set accordingly and the channels
  781. will be reordered as necessary. If the channel layouts of the inputs are not
  782. disjoint, the output will have all the channels of the first input then all
  783. the channels of the second input, in that order, and the channel layout of
  784. the output will be the default value corresponding to the total number of
  785. channels.
  786. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  787. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  788. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  789. first input, b1 is the first channel of the second input).
  790. On the other hand, if both input are in stereo, the output channels will be
  791. in the default order: a1, a2, b1, b2, and the channel layout will be
  792. arbitrarily set to 4.0, which may or may not be the expected value.
  793. All inputs must have the same sample rate, and format.
  794. If inputs do not have the same duration, the output will stop with the
  795. shortest.
  796. @subsection Examples
  797. @itemize
  798. @item
  799. Merge two mono files into a stereo stream:
  800. @example
  801. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  802. @end example
  803. @item
  804. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  805. @example
  806. 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
  807. @end example
  808. @end itemize
  809. @section amix
  810. Mixes multiple audio inputs into a single output.
  811. Note that this filter only supports float samples (the @var{amerge}
  812. and @var{pan} audio filters support many formats). If the @var{amix}
  813. input has integer samples then @ref{aresample} will be automatically
  814. inserted to perform the conversion to float samples.
  815. For example
  816. @example
  817. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  818. @end example
  819. will mix 3 input audio streams to a single output with the same duration as the
  820. first input and a dropout transition time of 3 seconds.
  821. It accepts the following parameters:
  822. @table @option
  823. @item inputs
  824. The number of inputs. If unspecified, it defaults to 2.
  825. @item duration
  826. How to determine the end-of-stream.
  827. @table @option
  828. @item longest
  829. The duration of the longest input. (default)
  830. @item shortest
  831. The duration of the shortest input.
  832. @item first
  833. The duration of the first input.
  834. @end table
  835. @item dropout_transition
  836. The transition time, in seconds, for volume renormalization when an input
  837. stream ends. The default value is 2 seconds.
  838. @end table
  839. @section anequalizer
  840. High-order parametric multiband equalizer for each channel.
  841. It accepts the following parameters:
  842. @table @option
  843. @item params
  844. This option string is in format:
  845. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  846. Each equalizer band is separated by '|'.
  847. @table @option
  848. @item chn
  849. Set channel number to which equalization will be applied.
  850. If input doesn't have that channel the entry is ignored.
  851. @item cf
  852. Set central frequency for band.
  853. If input doesn't have that frequency the entry is ignored.
  854. @item w
  855. Set band width in hertz.
  856. @item g
  857. Set band gain in dB.
  858. @item f
  859. Set filter type for band, optional, can be:
  860. @table @samp
  861. @item 0
  862. Butterworth, this is default.
  863. @item 1
  864. Chebyshev type 1.
  865. @item 2
  866. Chebyshev type 2.
  867. @end table
  868. @end table
  869. @item curves
  870. With this option activated frequency response of anequalizer is displayed
  871. in video stream.
  872. @item size
  873. Set video stream size. Only useful if curves option is activated.
  874. @item mgain
  875. Set max gain that will be displayed. Only useful if curves option is activated.
  876. Setting this to reasonable value allows to display gain which is derived from
  877. neighbour bands which are too close to each other and thus produce higher gain
  878. when both are activated.
  879. @item fscale
  880. Set frequency scale used to draw frequency response in video output.
  881. Can be linear or logarithmic. Default is logarithmic.
  882. @item colors
  883. Set color for each channel curve which is going to be displayed in video stream.
  884. This is list of color names separated by space or by '|'.
  885. Unrecognised or missing colors will be replaced by white color.
  886. @end table
  887. @subsection Examples
  888. @itemize
  889. @item
  890. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  891. for first 2 channels using Chebyshev type 1 filter:
  892. @example
  893. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  894. @end example
  895. @end itemize
  896. @subsection Commands
  897. This filter supports the following commands:
  898. @table @option
  899. @item change
  900. Alter existing filter parameters.
  901. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  902. @var{fN} is existing filter number, starting from 0, if no such filter is available
  903. error is returned.
  904. @var{freq} set new frequency parameter.
  905. @var{width} set new width parameter in herz.
  906. @var{gain} set new gain parameter in dB.
  907. Full filter invocation with asendcmd may look like this:
  908. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  909. @end table
  910. @section anull
  911. Pass the audio source unchanged to the output.
  912. @section apad
  913. Pad the end of an audio stream with silence.
  914. This can be used together with @command{ffmpeg} @option{-shortest} to
  915. extend audio streams to the same length as the video stream.
  916. A description of the accepted options follows.
  917. @table @option
  918. @item packet_size
  919. Set silence packet size. Default value is 4096.
  920. @item pad_len
  921. Set the number of samples of silence to add to the end. After the
  922. value is reached, the stream is terminated. This option is mutually
  923. exclusive with @option{whole_len}.
  924. @item whole_len
  925. Set the minimum total number of samples in the output audio stream. If
  926. the value is longer than the input audio length, silence is added to
  927. the end, until the value is reached. This option is mutually exclusive
  928. with @option{pad_len}.
  929. @end table
  930. If neither the @option{pad_len} nor the @option{whole_len} option is
  931. set, the filter will add silence to the end of the input stream
  932. indefinitely.
  933. @subsection Examples
  934. @itemize
  935. @item
  936. Add 1024 samples of silence to the end of the input:
  937. @example
  938. apad=pad_len=1024
  939. @end example
  940. @item
  941. Make sure the audio output will contain at least 10000 samples, pad
  942. the input with silence if required:
  943. @example
  944. apad=whole_len=10000
  945. @end example
  946. @item
  947. Use @command{ffmpeg} to pad the audio input with silence, so that the
  948. video stream will always result the shortest and will be converted
  949. until the end in the output file when using the @option{shortest}
  950. option:
  951. @example
  952. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  953. @end example
  954. @end itemize
  955. @section aphaser
  956. Add a phasing effect to the input audio.
  957. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  958. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  959. A description of the accepted parameters follows.
  960. @table @option
  961. @item in_gain
  962. Set input gain. Default is 0.4.
  963. @item out_gain
  964. Set output gain. Default is 0.74
  965. @item delay
  966. Set delay in milliseconds. Default is 3.0.
  967. @item decay
  968. Set decay. Default is 0.4.
  969. @item speed
  970. Set modulation speed in Hz. Default is 0.5.
  971. @item type
  972. Set modulation type. Default is triangular.
  973. It accepts the following values:
  974. @table @samp
  975. @item triangular, t
  976. @item sinusoidal, s
  977. @end table
  978. @end table
  979. @section apulsator
  980. Audio pulsator is something between an autopanner and a tremolo.
  981. But it can produce funny stereo effects as well. Pulsator changes the volume
  982. of the left and right channel based on a LFO (low frequency oscillator) with
  983. different waveforms and shifted phases.
  984. This filter have the ability to define an offset between left and right
  985. channel. An offset of 0 means that both LFO shapes match each other.
  986. The left and right channel are altered equally - a conventional tremolo.
  987. An offset of 50% means that the shape of the right channel is exactly shifted
  988. in phase (or moved backwards about half of the frequency) - pulsator acts as
  989. an autopanner. At 1 both curves match again. Every setting in between moves the
  990. phase shift gapless between all stages and produces some "bypassing" sounds with
  991. sine and triangle waveforms. The more you set the offset near 1 (starting from
  992. the 0.5) the faster the signal passes from the left to the right speaker.
  993. The filter accepts the following options:
  994. @table @option
  995. @item level_in
  996. Set input gain. By default it is 1. Range is [0.015625 - 64].
  997. @item level_out
  998. Set output gain. By default it is 1. Range is [0.015625 - 64].
  999. @item mode
  1000. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1001. sawup or sawdown. Default is sine.
  1002. @item amount
  1003. Set modulation. Define how much of original signal is affected by the LFO.
  1004. @item offset_l
  1005. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1006. @item offset_r
  1007. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1008. @item width
  1009. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1010. @item timing
  1011. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1012. @item bpm
  1013. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1014. is set to bpm.
  1015. @item ms
  1016. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1017. is set to ms.
  1018. @item hz
  1019. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1020. if timing is set to hz.
  1021. @end table
  1022. @anchor{aresample}
  1023. @section aresample
  1024. Resample the input audio to the specified parameters, using the
  1025. libswresample library. If none are specified then the filter will
  1026. automatically convert between its input and output.
  1027. This filter is also able to stretch/squeeze the audio data to make it match
  1028. the timestamps or to inject silence / cut out audio to make it match the
  1029. timestamps, do a combination of both or do neither.
  1030. The filter accepts the syntax
  1031. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1032. expresses a sample rate and @var{resampler_options} is a list of
  1033. @var{key}=@var{value} pairs, separated by ":". See the
  1034. ffmpeg-resampler manual for the complete list of supported options.
  1035. @subsection Examples
  1036. @itemize
  1037. @item
  1038. Resample the input audio to 44100Hz:
  1039. @example
  1040. aresample=44100
  1041. @end example
  1042. @item
  1043. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1044. samples per second compensation:
  1045. @example
  1046. aresample=async=1000
  1047. @end example
  1048. @end itemize
  1049. @section asetnsamples
  1050. Set the number of samples per each output audio frame.
  1051. The last output packet may contain a different number of samples, as
  1052. the filter will flush all the remaining samples when the input audio
  1053. signal its end.
  1054. The filter accepts the following options:
  1055. @table @option
  1056. @item nb_out_samples, n
  1057. Set the number of frames per each output audio frame. The number is
  1058. intended as the number of samples @emph{per each channel}.
  1059. Default value is 1024.
  1060. @item pad, p
  1061. If set to 1, the filter will pad the last audio frame with zeroes, so
  1062. that the last frame will contain the same number of samples as the
  1063. previous ones. Default value is 1.
  1064. @end table
  1065. For example, to set the number of per-frame samples to 1234 and
  1066. disable padding for the last frame, use:
  1067. @example
  1068. asetnsamples=n=1234:p=0
  1069. @end example
  1070. @section asetrate
  1071. Set the sample rate without altering the PCM data.
  1072. This will result in a change of speed and pitch.
  1073. The filter accepts the following options:
  1074. @table @option
  1075. @item sample_rate, r
  1076. Set the output sample rate. Default is 44100 Hz.
  1077. @end table
  1078. @section ashowinfo
  1079. Show a line containing various information for each input audio frame.
  1080. The input audio is not modified.
  1081. The shown line contains a sequence of key/value pairs of the form
  1082. @var{key}:@var{value}.
  1083. The following values are shown in the output:
  1084. @table @option
  1085. @item n
  1086. The (sequential) number of the input frame, starting from 0.
  1087. @item pts
  1088. The presentation timestamp of the input frame, in time base units; the time base
  1089. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1090. @item pts_time
  1091. The presentation timestamp of the input frame in seconds.
  1092. @item pos
  1093. position of the frame in the input stream, -1 if this information in
  1094. unavailable and/or meaningless (for example in case of synthetic audio)
  1095. @item fmt
  1096. The sample format.
  1097. @item chlayout
  1098. The channel layout.
  1099. @item rate
  1100. The sample rate for the audio frame.
  1101. @item nb_samples
  1102. The number of samples (per channel) in the frame.
  1103. @item checksum
  1104. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1105. audio, the data is treated as if all the planes were concatenated.
  1106. @item plane_checksums
  1107. A list of Adler-32 checksums for each data plane.
  1108. @end table
  1109. @anchor{astats}
  1110. @section astats
  1111. Display time domain statistical information about the audio channels.
  1112. Statistics are calculated and displayed for each audio channel and,
  1113. where applicable, an overall figure is also given.
  1114. It accepts the following option:
  1115. @table @option
  1116. @item length
  1117. Short window length in seconds, used for peak and trough RMS measurement.
  1118. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1119. @item metadata
  1120. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1121. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1122. disabled.
  1123. Available keys for each channel are:
  1124. DC_offset
  1125. Min_level
  1126. Max_level
  1127. Min_difference
  1128. Max_difference
  1129. Mean_difference
  1130. Peak_level
  1131. RMS_peak
  1132. RMS_trough
  1133. Crest_factor
  1134. Flat_factor
  1135. Peak_count
  1136. Bit_depth
  1137. and for Overall:
  1138. DC_offset
  1139. Min_level
  1140. Max_level
  1141. Min_difference
  1142. Max_difference
  1143. Mean_difference
  1144. Peak_level
  1145. RMS_level
  1146. RMS_peak
  1147. RMS_trough
  1148. Flat_factor
  1149. Peak_count
  1150. Bit_depth
  1151. Number_of_samples
  1152. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1153. this @code{lavfi.astats.Overall.Peak_count}.
  1154. For description what each key means read below.
  1155. @item reset
  1156. Set number of frame after which stats are going to be recalculated.
  1157. Default is disabled.
  1158. @end table
  1159. A description of each shown parameter follows:
  1160. @table @option
  1161. @item DC offset
  1162. Mean amplitude displacement from zero.
  1163. @item Min level
  1164. Minimal sample level.
  1165. @item Max level
  1166. Maximal sample level.
  1167. @item Min difference
  1168. Minimal difference between two consecutive samples.
  1169. @item Max difference
  1170. Maximal difference between two consecutive samples.
  1171. @item Mean difference
  1172. Mean difference between two consecutive samples.
  1173. The average of each difference between two consecutive samples.
  1174. @item Peak level dB
  1175. @item RMS level dB
  1176. Standard peak and RMS level measured in dBFS.
  1177. @item RMS peak dB
  1178. @item RMS trough dB
  1179. Peak and trough values for RMS level measured over a short window.
  1180. @item Crest factor
  1181. Standard ratio of peak to RMS level (note: not in dB).
  1182. @item Flat factor
  1183. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1184. (i.e. either @var{Min level} or @var{Max level}).
  1185. @item Peak count
  1186. Number of occasions (not the number of samples) that the signal attained either
  1187. @var{Min level} or @var{Max level}.
  1188. @item Bit depth
  1189. Overall bit depth of audio. Number of bits used for each sample.
  1190. @end table
  1191. @section asyncts
  1192. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1193. dropping samples/adding silence when needed.
  1194. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1195. It accepts the following parameters:
  1196. @table @option
  1197. @item compensate
  1198. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1199. by default. When disabled, time gaps are covered with silence.
  1200. @item min_delta
  1201. The minimum difference between timestamps and audio data (in seconds) to trigger
  1202. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1203. sync with this filter, try setting this parameter to 0.
  1204. @item max_comp
  1205. The maximum compensation in samples per second. Only relevant with compensate=1.
  1206. The default value is 500.
  1207. @item first_pts
  1208. Assume that the first PTS should be this value. The time base is 1 / sample
  1209. rate. This allows for padding/trimming at the start of the stream. By default,
  1210. no assumption is made about the first frame's expected PTS, so no padding or
  1211. trimming is done. For example, this could be set to 0 to pad the beginning with
  1212. silence if an audio stream starts after the video stream or to trim any samples
  1213. with a negative PTS due to encoder delay.
  1214. @end table
  1215. @section atempo
  1216. Adjust audio tempo.
  1217. The filter accepts exactly one parameter, the audio tempo. If not
  1218. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1219. be in the [0.5, 2.0] range.
  1220. @subsection Examples
  1221. @itemize
  1222. @item
  1223. Slow down audio to 80% tempo:
  1224. @example
  1225. atempo=0.8
  1226. @end example
  1227. @item
  1228. To speed up audio to 125% tempo:
  1229. @example
  1230. atempo=1.25
  1231. @end example
  1232. @end itemize
  1233. @section atrim
  1234. Trim the input so that the output contains one continuous subpart of the input.
  1235. It accepts the following parameters:
  1236. @table @option
  1237. @item start
  1238. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1239. sample with the timestamp @var{start} will be the first sample in the output.
  1240. @item end
  1241. Specify time of the first audio sample that will be dropped, i.e. the
  1242. audio sample immediately preceding the one with the timestamp @var{end} will be
  1243. the last sample in the output.
  1244. @item start_pts
  1245. Same as @var{start}, except this option sets the start timestamp in samples
  1246. instead of seconds.
  1247. @item end_pts
  1248. Same as @var{end}, except this option sets the end timestamp in samples instead
  1249. of seconds.
  1250. @item duration
  1251. The maximum duration of the output in seconds.
  1252. @item start_sample
  1253. The number of the first sample that should be output.
  1254. @item end_sample
  1255. The number of the first sample that should be dropped.
  1256. @end table
  1257. @option{start}, @option{end}, and @option{duration} are expressed as time
  1258. duration specifications; see
  1259. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1260. Note that the first two sets of the start/end options and the @option{duration}
  1261. option look at the frame timestamp, while the _sample options simply count the
  1262. samples that pass through the filter. So start/end_pts and start/end_sample will
  1263. give different results when the timestamps are wrong, inexact or do not start at
  1264. zero. Also note that this filter does not modify the timestamps. If you wish
  1265. to have the output timestamps start at zero, insert the asetpts filter after the
  1266. atrim filter.
  1267. If multiple start or end options are set, this filter tries to be greedy and
  1268. keep all samples that match at least one of the specified constraints. To keep
  1269. only the part that matches all the constraints at once, chain multiple atrim
  1270. filters.
  1271. The defaults are such that all the input is kept. So it is possible to set e.g.
  1272. just the end values to keep everything before the specified time.
  1273. Examples:
  1274. @itemize
  1275. @item
  1276. Drop everything except the second minute of input:
  1277. @example
  1278. ffmpeg -i INPUT -af atrim=60:120
  1279. @end example
  1280. @item
  1281. Keep only the first 1000 samples:
  1282. @example
  1283. ffmpeg -i INPUT -af atrim=end_sample=1000
  1284. @end example
  1285. @end itemize
  1286. @section bandpass
  1287. Apply a two-pole Butterworth band-pass filter with central
  1288. frequency @var{frequency}, and (3dB-point) band-width width.
  1289. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1290. instead of the default: constant 0dB peak gain.
  1291. The filter roll off at 6dB per octave (20dB per decade).
  1292. The filter accepts the following options:
  1293. @table @option
  1294. @item frequency, f
  1295. Set the filter's central frequency. Default is @code{3000}.
  1296. @item csg
  1297. Constant skirt gain if set to 1. Defaults to 0.
  1298. @item width_type
  1299. Set method to specify band-width of filter.
  1300. @table @option
  1301. @item h
  1302. Hz
  1303. @item q
  1304. Q-Factor
  1305. @item o
  1306. octave
  1307. @item s
  1308. slope
  1309. @end table
  1310. @item width, w
  1311. Specify the band-width of a filter in width_type units.
  1312. @end table
  1313. @section bandreject
  1314. Apply a two-pole Butterworth band-reject filter with central
  1315. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1316. The filter roll off at 6dB per octave (20dB per decade).
  1317. The filter accepts the following options:
  1318. @table @option
  1319. @item frequency, f
  1320. Set the filter's central frequency. Default is @code{3000}.
  1321. @item width_type
  1322. Set method to specify band-width of filter.
  1323. @table @option
  1324. @item h
  1325. Hz
  1326. @item q
  1327. Q-Factor
  1328. @item o
  1329. octave
  1330. @item s
  1331. slope
  1332. @end table
  1333. @item width, w
  1334. Specify the band-width of a filter in width_type units.
  1335. @end table
  1336. @section bass
  1337. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1338. shelving filter with a response similar to that of a standard
  1339. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1340. The filter accepts the following options:
  1341. @table @option
  1342. @item gain, g
  1343. Give the gain at 0 Hz. Its useful range is about -20
  1344. (for a large cut) to +20 (for a large boost).
  1345. Beware of clipping when using a positive gain.
  1346. @item frequency, f
  1347. Set the filter's central frequency and so can be used
  1348. to extend or reduce the frequency range to be boosted or cut.
  1349. The default value is @code{100} Hz.
  1350. @item width_type
  1351. Set method to specify band-width of filter.
  1352. @table @option
  1353. @item h
  1354. Hz
  1355. @item q
  1356. Q-Factor
  1357. @item o
  1358. octave
  1359. @item s
  1360. slope
  1361. @end table
  1362. @item width, w
  1363. Determine how steep is the filter's shelf transition.
  1364. @end table
  1365. @section biquad
  1366. Apply a biquad IIR filter with the given coefficients.
  1367. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1368. are the numerator and denominator coefficients respectively.
  1369. @section bs2b
  1370. Bauer stereo to binaural transformation, which improves headphone listening of
  1371. stereo audio records.
  1372. It accepts the following parameters:
  1373. @table @option
  1374. @item profile
  1375. Pre-defined crossfeed level.
  1376. @table @option
  1377. @item default
  1378. Default level (fcut=700, feed=50).
  1379. @item cmoy
  1380. Chu Moy circuit (fcut=700, feed=60).
  1381. @item jmeier
  1382. Jan Meier circuit (fcut=650, feed=95).
  1383. @end table
  1384. @item fcut
  1385. Cut frequency (in Hz).
  1386. @item feed
  1387. Feed level (in Hz).
  1388. @end table
  1389. @section channelmap
  1390. Remap input channels to new locations.
  1391. It accepts the following parameters:
  1392. @table @option
  1393. @item channel_layout
  1394. The channel layout of the output stream.
  1395. @item map
  1396. Map channels from input to output. The argument is a '|'-separated list of
  1397. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1398. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1399. channel (e.g. FL for front left) or its index in the input channel layout.
  1400. @var{out_channel} is the name of the output channel or its index in the output
  1401. channel layout. If @var{out_channel} is not given then it is implicitly an
  1402. index, starting with zero and increasing by one for each mapping.
  1403. @end table
  1404. If no mapping is present, the filter will implicitly map input channels to
  1405. output channels, preserving indices.
  1406. For example, assuming a 5.1+downmix input MOV file,
  1407. @example
  1408. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1409. @end example
  1410. will create an output WAV file tagged as stereo from the downmix channels of
  1411. the input.
  1412. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1413. @example
  1414. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1415. @end example
  1416. @section channelsplit
  1417. Split each channel from an input audio stream into a separate output stream.
  1418. It accepts the following parameters:
  1419. @table @option
  1420. @item channel_layout
  1421. The channel layout of the input stream. The default is "stereo".
  1422. @end table
  1423. For example, assuming a stereo input MP3 file,
  1424. @example
  1425. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1426. @end example
  1427. will create an output Matroska file with two audio streams, one containing only
  1428. the left channel and the other the right channel.
  1429. Split a 5.1 WAV file into per-channel files:
  1430. @example
  1431. ffmpeg -i in.wav -filter_complex
  1432. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1433. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1434. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1435. side_right.wav
  1436. @end example
  1437. @section chorus
  1438. Add a chorus effect to the audio.
  1439. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1440. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1441. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1442. The modulation depth defines the range the modulated delay is played before or after
  1443. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1444. sound tuned around the original one, like in a chorus where some vocals are slightly
  1445. off key.
  1446. It accepts the following parameters:
  1447. @table @option
  1448. @item in_gain
  1449. Set input gain. Default is 0.4.
  1450. @item out_gain
  1451. Set output gain. Default is 0.4.
  1452. @item delays
  1453. Set delays. A typical delay is around 40ms to 60ms.
  1454. @item decays
  1455. Set decays.
  1456. @item speeds
  1457. Set speeds.
  1458. @item depths
  1459. Set depths.
  1460. @end table
  1461. @subsection Examples
  1462. @itemize
  1463. @item
  1464. A single delay:
  1465. @example
  1466. chorus=0.7:0.9:55:0.4:0.25:2
  1467. @end example
  1468. @item
  1469. Two delays:
  1470. @example
  1471. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1472. @end example
  1473. @item
  1474. Fuller sounding chorus with three delays:
  1475. @example
  1476. 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
  1477. @end example
  1478. @end itemize
  1479. @section compand
  1480. Compress or expand the audio's dynamic range.
  1481. It accepts the following parameters:
  1482. @table @option
  1483. @item attacks
  1484. @item decays
  1485. A list of times in seconds for each channel over which the instantaneous level
  1486. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1487. increase of volume and @var{decays} refers to decrease of volume. For most
  1488. situations, the attack time (response to the audio getting louder) should be
  1489. shorter than the decay time, because the human ear is more sensitive to sudden
  1490. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1491. a typical value for decay is 0.8 seconds.
  1492. If specified number of attacks & decays is lower than number of channels, the last
  1493. set attack/decay will be used for all remaining channels.
  1494. @item points
  1495. A list of points for the transfer function, specified in dB relative to the
  1496. maximum possible signal amplitude. Each key points list must be defined using
  1497. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1498. @code{x0/y0 x1/y1 x2/y2 ....}
  1499. The input values must be in strictly increasing order but the transfer function
  1500. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1501. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1502. function are @code{-70/-70|-60/-20}.
  1503. @item soft-knee
  1504. Set the curve radius in dB for all joints. It defaults to 0.01.
  1505. @item gain
  1506. Set the additional gain in dB to be applied at all points on the transfer
  1507. function. This allows for easy adjustment of the overall gain.
  1508. It defaults to 0.
  1509. @item volume
  1510. Set an initial volume, in dB, to be assumed for each channel when filtering
  1511. starts. This permits the user to supply a nominal level initially, so that, for
  1512. example, a very large gain is not applied to initial signal levels before the
  1513. companding has begun to operate. A typical value for audio which is initially
  1514. quiet is -90 dB. It defaults to 0.
  1515. @item delay
  1516. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1517. delayed before being fed to the volume adjuster. Specifying a delay
  1518. approximately equal to the attack/decay times allows the filter to effectively
  1519. operate in predictive rather than reactive mode. It defaults to 0.
  1520. @end table
  1521. @subsection Examples
  1522. @itemize
  1523. @item
  1524. Make music with both quiet and loud passages suitable for listening to in a
  1525. noisy environment:
  1526. @example
  1527. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1528. @end example
  1529. Another example for audio with whisper and explosion parts:
  1530. @example
  1531. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1532. @end example
  1533. @item
  1534. A noise gate for when the noise is at a lower level than the signal:
  1535. @example
  1536. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1537. @end example
  1538. @item
  1539. Here is another noise gate, this time for when the noise is at a higher level
  1540. than the signal (making it, in some ways, similar to squelch):
  1541. @example
  1542. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1543. @end example
  1544. @item
  1545. 2:1 compression starting at -6dB:
  1546. @example
  1547. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1548. @end example
  1549. @item
  1550. 2:1 compression starting at -9dB:
  1551. @example
  1552. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1553. @end example
  1554. @item
  1555. 2:1 compression starting at -12dB:
  1556. @example
  1557. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1558. @end example
  1559. @item
  1560. 2:1 compression starting at -18dB:
  1561. @example
  1562. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1563. @end example
  1564. @item
  1565. 3:1 compression starting at -15dB:
  1566. @example
  1567. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1568. @end example
  1569. @item
  1570. Compressor/Gate:
  1571. @example
  1572. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1573. @end example
  1574. @item
  1575. Expander:
  1576. @example
  1577. 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
  1578. @end example
  1579. @item
  1580. Hard limiter at -6dB:
  1581. @example
  1582. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1583. @end example
  1584. @item
  1585. Hard limiter at -12dB:
  1586. @example
  1587. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1588. @end example
  1589. @item
  1590. Hard noise gate at -35 dB:
  1591. @example
  1592. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1593. @end example
  1594. @item
  1595. Soft limiter:
  1596. @example
  1597. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1598. @end example
  1599. @end itemize
  1600. @section compensationdelay
  1601. Compensation Delay Line is a metric based delay to compensate differing
  1602. positions of microphones or speakers.
  1603. For example, you have recorded guitar with two microphones placed in
  1604. different location. Because the front of sound wave has fixed speed in
  1605. normal conditions, the phasing of microphones can vary and depends on
  1606. their location and interposition. The best sound mix can be achieved when
  1607. these microphones are in phase (synchronized). Note that distance of
  1608. ~30 cm between microphones makes one microphone to capture signal in
  1609. antiphase to another microphone. That makes the final mix sounding moody.
  1610. This filter helps to solve phasing problems by adding different delays
  1611. to each microphone track and make them synchronized.
  1612. The best result can be reached when you take one track as base and
  1613. synchronize other tracks one by one with it.
  1614. Remember that synchronization/delay tolerance depends on sample rate, too.
  1615. Higher sample rates will give more tolerance.
  1616. It accepts the following parameters:
  1617. @table @option
  1618. @item mm
  1619. Set millimeters distance. This is compensation distance for fine tuning.
  1620. Default is 0.
  1621. @item cm
  1622. Set cm distance. This is compensation distance for tightening distance setup.
  1623. Default is 0.
  1624. @item m
  1625. Set meters distance. This is compensation distance for hard distance setup.
  1626. Default is 0.
  1627. @item dry
  1628. Set dry amount. Amount of unprocessed (dry) signal.
  1629. Default is 0.
  1630. @item wet
  1631. Set wet amount. Amount of processed (wet) signal.
  1632. Default is 1.
  1633. @item temp
  1634. Set temperature degree in Celsius. This is the temperature of the environment.
  1635. Default is 20.
  1636. @end table
  1637. @section dcshift
  1638. Apply a DC shift to the audio.
  1639. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1640. in the recording chain) from the audio. The effect of a DC offset is reduced
  1641. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1642. a signal has a DC offset.
  1643. @table @option
  1644. @item shift
  1645. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1646. the audio.
  1647. @item limitergain
  1648. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1649. used to prevent clipping.
  1650. @end table
  1651. @section dynaudnorm
  1652. Dynamic Audio Normalizer.
  1653. This filter applies a certain amount of gain to the input audio in order
  1654. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1655. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1656. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1657. This allows for applying extra gain to the "quiet" sections of the audio
  1658. while avoiding distortions or clipping the "loud" sections. In other words:
  1659. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1660. sections, in the sense that the volume of each section is brought to the
  1661. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1662. this goal *without* applying "dynamic range compressing". It will retain 100%
  1663. of the dynamic range *within* each section of the audio file.
  1664. @table @option
  1665. @item f
  1666. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1667. Default is 500 milliseconds.
  1668. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1669. referred to as frames. This is required, because a peak magnitude has no
  1670. meaning for just a single sample value. Instead, we need to determine the
  1671. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1672. normalizer would simply use the peak magnitude of the complete file, the
  1673. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1674. frame. The length of a frame is specified in milliseconds. By default, the
  1675. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1676. been found to give good results with most files.
  1677. Note that the exact frame length, in number of samples, will be determined
  1678. automatically, based on the sampling rate of the individual input audio file.
  1679. @item g
  1680. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1681. number. Default is 31.
  1682. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1683. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1684. is specified in frames, centered around the current frame. For the sake of
  1685. simplicity, this must be an odd number. Consequently, the default value of 31
  1686. takes into account the current frame, as well as the 15 preceding frames and
  1687. the 15 subsequent frames. Using a larger window results in a stronger
  1688. smoothing effect and thus in less gain variation, i.e. slower gain
  1689. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1690. effect and thus in more gain variation, i.e. faster gain adaptation.
  1691. In other words, the more you increase this value, the more the Dynamic Audio
  1692. Normalizer will behave like a "traditional" normalization filter. On the
  1693. contrary, the more you decrease this value, the more the Dynamic Audio
  1694. Normalizer will behave like a dynamic range compressor.
  1695. @item p
  1696. Set the target peak value. This specifies the highest permissible magnitude
  1697. level for the normalized audio input. This filter will try to approach the
  1698. target peak magnitude as closely as possible, but at the same time it also
  1699. makes sure that the normalized signal will never exceed the peak magnitude.
  1700. A frame's maximum local gain factor is imposed directly by the target peak
  1701. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1702. It is not recommended to go above this value.
  1703. @item m
  1704. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1705. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1706. factor for each input frame, i.e. the maximum gain factor that does not
  1707. result in clipping or distortion. The maximum gain factor is determined by
  1708. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1709. additionally bounds the frame's maximum gain factor by a predetermined
  1710. (global) maximum gain factor. This is done in order to avoid excessive gain
  1711. factors in "silent" or almost silent frames. By default, the maximum gain
  1712. factor is 10.0, For most inputs the default value should be sufficient and
  1713. it usually is not recommended to increase this value. Though, for input
  1714. with an extremely low overall volume level, it may be necessary to allow even
  1715. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1716. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1717. Instead, a "sigmoid" threshold function will be applied. This way, the
  1718. gain factors will smoothly approach the threshold value, but never exceed that
  1719. value.
  1720. @item r
  1721. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1722. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1723. This means that the maximum local gain factor for each frame is defined
  1724. (only) by the frame's highest magnitude sample. This way, the samples can
  1725. be amplified as much as possible without exceeding the maximum signal
  1726. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1727. Normalizer can also take into account the frame's root mean square,
  1728. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1729. determine the power of a time-varying signal. It is therefore considered
  1730. that the RMS is a better approximation of the "perceived loudness" than
  1731. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1732. frames to a constant RMS value, a uniform "perceived loudness" can be
  1733. established. If a target RMS value has been specified, a frame's local gain
  1734. factor is defined as the factor that would result in exactly that RMS value.
  1735. Note, however, that the maximum local gain factor is still restricted by the
  1736. frame's highest magnitude sample, in order to prevent clipping.
  1737. @item n
  1738. Enable channels coupling. By default is enabled.
  1739. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1740. amount. This means the same gain factor will be applied to all channels, i.e.
  1741. the maximum possible gain factor is determined by the "loudest" channel.
  1742. However, in some recordings, it may happen that the volume of the different
  1743. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1744. In this case, this option can be used to disable the channel coupling. This way,
  1745. the gain factor will be determined independently for each channel, depending
  1746. only on the individual channel's highest magnitude sample. This allows for
  1747. harmonizing the volume of the different channels.
  1748. @item c
  1749. Enable DC bias correction. By default is disabled.
  1750. An audio signal (in the time domain) is a sequence of sample values.
  1751. In the Dynamic Audio Normalizer these sample values are represented in the
  1752. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1753. audio signal, or "waveform", should be centered around the zero point.
  1754. That means if we calculate the mean value of all samples in a file, or in a
  1755. single frame, then the result should be 0.0 or at least very close to that
  1756. value. If, however, there is a significant deviation of the mean value from
  1757. 0.0, in either positive or negative direction, this is referred to as a
  1758. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1759. Audio Normalizer provides optional DC bias correction.
  1760. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1761. the mean value, or "DC correction" offset, of each input frame and subtract
  1762. that value from all of the frame's sample values which ensures those samples
  1763. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1764. boundaries, the DC correction offset values will be interpolated smoothly
  1765. between neighbouring frames.
  1766. @item b
  1767. Enable alternative boundary mode. By default is disabled.
  1768. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1769. around each frame. This includes the preceding frames as well as the
  1770. subsequent frames. However, for the "boundary" frames, located at the very
  1771. beginning and at the very end of the audio file, not all neighbouring
  1772. frames are available. In particular, for the first few frames in the audio
  1773. file, the preceding frames are not known. And, similarly, for the last few
  1774. frames in the audio file, the subsequent frames are not known. Thus, the
  1775. question arises which gain factors should be assumed for the missing frames
  1776. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1777. to deal with this situation. The default boundary mode assumes a gain factor
  1778. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1779. "fade out" at the beginning and at the end of the input, respectively.
  1780. @item s
  1781. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1782. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1783. compression. This means that signal peaks will not be pruned and thus the
  1784. full dynamic range will be retained within each local neighbourhood. However,
  1785. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1786. normalization algorithm with a more "traditional" compression.
  1787. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1788. (thresholding) function. If (and only if) the compression feature is enabled,
  1789. all input frames will be processed by a soft knee thresholding function prior
  1790. to the actual normalization process. Put simply, the thresholding function is
  1791. going to prune all samples whose magnitude exceeds a certain threshold value.
  1792. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1793. value. Instead, the threshold value will be adjusted for each individual
  1794. frame.
  1795. In general, smaller parameters result in stronger compression, and vice versa.
  1796. Values below 3.0 are not recommended, because audible distortion may appear.
  1797. @end table
  1798. @section earwax
  1799. Make audio easier to listen to on headphones.
  1800. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1801. so that when listened to on headphones the stereo image is moved from
  1802. inside your head (standard for headphones) to outside and in front of
  1803. the listener (standard for speakers).
  1804. Ported from SoX.
  1805. @section equalizer
  1806. Apply a two-pole peaking equalisation (EQ) filter. With this
  1807. filter, the signal-level at and around a selected frequency can
  1808. be increased or decreased, whilst (unlike bandpass and bandreject
  1809. filters) that at all other frequencies is unchanged.
  1810. In order to produce complex equalisation curves, this filter can
  1811. be given several times, each with a different central frequency.
  1812. The filter accepts the following options:
  1813. @table @option
  1814. @item frequency, f
  1815. Set the filter's central frequency in Hz.
  1816. @item width_type
  1817. Set method to specify band-width of filter.
  1818. @table @option
  1819. @item h
  1820. Hz
  1821. @item q
  1822. Q-Factor
  1823. @item o
  1824. octave
  1825. @item s
  1826. slope
  1827. @end table
  1828. @item width, w
  1829. Specify the band-width of a filter in width_type units.
  1830. @item gain, g
  1831. Set the required gain or attenuation in dB.
  1832. Beware of clipping when using a positive gain.
  1833. @end table
  1834. @subsection Examples
  1835. @itemize
  1836. @item
  1837. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1838. @example
  1839. equalizer=f=1000:width_type=h:width=200:g=-10
  1840. @end example
  1841. @item
  1842. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1843. @example
  1844. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1845. @end example
  1846. @end itemize
  1847. @section extrastereo
  1848. Linearly increases the difference between left and right channels which
  1849. adds some sort of "live" effect to playback.
  1850. The filter accepts the following option:
  1851. @table @option
  1852. @item m
  1853. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1854. (average of both channels), with 1.0 sound will be unchanged, with
  1855. -1.0 left and right channels will be swapped.
  1856. @item c
  1857. Enable clipping. By default is enabled.
  1858. @end table
  1859. @section firequalizer
  1860. Apply FIR Equalization using arbitrary frequency response.
  1861. The filter accepts the following option:
  1862. @table @option
  1863. @item gain
  1864. Set gain curve equation (in dB). The expression can contain variables:
  1865. @table @option
  1866. @item f
  1867. the evaluated frequency
  1868. @item sr
  1869. sample rate
  1870. @item ch
  1871. channel number, set to 0 when multichannels evaluation is disabled
  1872. @item chid
  1873. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1874. multichannels evaluation is disabled
  1875. @item chs
  1876. number of channels
  1877. @item chlayout
  1878. channel_layout, see libavutil/channel_layout.h
  1879. @end table
  1880. and functions:
  1881. @table @option
  1882. @item gain_interpolate(f)
  1883. interpolate gain on frequency f based on gain_entry
  1884. @end table
  1885. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1886. @item gain_entry
  1887. Set gain entry for gain_interpolate function. The expression can
  1888. contain functions:
  1889. @table @option
  1890. @item entry(f, g)
  1891. store gain entry at frequency f with value g
  1892. @end table
  1893. This option is also available as command.
  1894. @item delay
  1895. Set filter delay in seconds. Higher value means more accurate.
  1896. Default is @code{0.01}.
  1897. @item accuracy
  1898. Set filter accuracy in Hz. Lower value means more accurate.
  1899. Default is @code{5}.
  1900. @item wfunc
  1901. Set window function. Acceptable values are:
  1902. @table @option
  1903. @item rectangular
  1904. rectangular window, useful when gain curve is already smooth
  1905. @item hann
  1906. hann window (default)
  1907. @item hamming
  1908. hamming window
  1909. @item blackman
  1910. blackman window
  1911. @item nuttall3
  1912. 3-terms continuous 1st derivative nuttall window
  1913. @item mnuttall3
  1914. minimum 3-terms discontinuous nuttall window
  1915. @item nuttall
  1916. 4-terms continuous 1st derivative nuttall window
  1917. @item bnuttall
  1918. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  1919. @item bharris
  1920. blackman-harris window
  1921. @end table
  1922. @item fixed
  1923. If enabled, use fixed number of audio samples. This improves speed when
  1924. filtering with large delay. Default is disabled.
  1925. @item multi
  1926. Enable multichannels evaluation on gain. Default is disabled.
  1927. @end table
  1928. @subsection Examples
  1929. @itemize
  1930. @item
  1931. lowpass at 1000 Hz:
  1932. @example
  1933. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  1934. @end example
  1935. @item
  1936. lowpass at 1000 Hz with gain_entry:
  1937. @example
  1938. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  1939. @end example
  1940. @item
  1941. custom equalization:
  1942. @example
  1943. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  1944. @end example
  1945. @item
  1946. higher delay:
  1947. @example
  1948. firequalizer=delay=0.1:fixed=on
  1949. @end example
  1950. @item
  1951. lowpass on left channel, highpass on right channel:
  1952. @example
  1953. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  1954. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  1955. @end example
  1956. @end itemize
  1957. @section flanger
  1958. Apply a flanging effect to the audio.
  1959. The filter accepts the following options:
  1960. @table @option
  1961. @item delay
  1962. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1963. @item depth
  1964. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1965. @item regen
  1966. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1967. Default value is 0.
  1968. @item width
  1969. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1970. Default value is 71.
  1971. @item speed
  1972. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1973. @item shape
  1974. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1975. Default value is @var{sinusoidal}.
  1976. @item phase
  1977. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1978. Default value is 25.
  1979. @item interp
  1980. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1981. Default is @var{linear}.
  1982. @end table
  1983. @section highpass
  1984. Apply a high-pass filter with 3dB point frequency.
  1985. The filter can be either single-pole, or double-pole (the default).
  1986. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1987. The filter accepts the following options:
  1988. @table @option
  1989. @item frequency, f
  1990. Set frequency in Hz. Default is 3000.
  1991. @item poles, p
  1992. Set number of poles. Default is 2.
  1993. @item width_type
  1994. Set method to specify band-width of filter.
  1995. @table @option
  1996. @item h
  1997. Hz
  1998. @item q
  1999. Q-Factor
  2000. @item o
  2001. octave
  2002. @item s
  2003. slope
  2004. @end table
  2005. @item width, w
  2006. Specify the band-width of a filter in width_type units.
  2007. Applies only to double-pole filter.
  2008. The default is 0.707q and gives a Butterworth response.
  2009. @end table
  2010. @section join
  2011. Join multiple input streams into one multi-channel stream.
  2012. It accepts the following parameters:
  2013. @table @option
  2014. @item inputs
  2015. The number of input streams. It defaults to 2.
  2016. @item channel_layout
  2017. The desired output channel layout. It defaults to stereo.
  2018. @item map
  2019. Map channels from inputs to output. The argument is a '|'-separated list of
  2020. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2021. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2022. can be either the name of the input channel (e.g. FL for front left) or its
  2023. index in the specified input stream. @var{out_channel} is the name of the output
  2024. channel.
  2025. @end table
  2026. The filter will attempt to guess the mappings when they are not specified
  2027. explicitly. It does so by first trying to find an unused matching input channel
  2028. and if that fails it picks the first unused input channel.
  2029. Join 3 inputs (with properly set channel layouts):
  2030. @example
  2031. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2032. @end example
  2033. Build a 5.1 output from 6 single-channel streams:
  2034. @example
  2035. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2036. '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'
  2037. out
  2038. @end example
  2039. @section ladspa
  2040. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2041. To enable compilation of this filter you need to configure FFmpeg with
  2042. @code{--enable-ladspa}.
  2043. @table @option
  2044. @item file, f
  2045. Specifies the name of LADSPA plugin library to load. If the environment
  2046. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2047. each one of the directories specified by the colon separated list in
  2048. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2049. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2050. @file{/usr/lib/ladspa/}.
  2051. @item plugin, p
  2052. Specifies the plugin within the library. Some libraries contain only
  2053. one plugin, but others contain many of them. If this is not set filter
  2054. will list all available plugins within the specified library.
  2055. @item controls, c
  2056. Set the '|' separated list of controls which are zero or more floating point
  2057. values that determine the behavior of the loaded plugin (for example delay,
  2058. threshold or gain).
  2059. Controls need to be defined using the following syntax:
  2060. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2061. @var{valuei} is the value set on the @var{i}-th control.
  2062. Alternatively they can be also defined using the following syntax:
  2063. @var{value0}|@var{value1}|@var{value2}|..., where
  2064. @var{valuei} is the value set on the @var{i}-th control.
  2065. If @option{controls} is set to @code{help}, all available controls and
  2066. their valid ranges are printed.
  2067. @item sample_rate, s
  2068. Specify the sample rate, default to 44100. Only used if plugin have
  2069. zero inputs.
  2070. @item nb_samples, n
  2071. Set the number of samples per channel per each output frame, default
  2072. is 1024. Only used if plugin have zero inputs.
  2073. @item duration, d
  2074. Set the minimum duration of the sourced audio. See
  2075. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2076. for the accepted syntax.
  2077. Note that the resulting duration may be greater than the specified duration,
  2078. as the generated audio is always cut at the end of a complete frame.
  2079. If not specified, or the expressed duration is negative, the audio is
  2080. supposed to be generated forever.
  2081. Only used if plugin have zero inputs.
  2082. @end table
  2083. @subsection Examples
  2084. @itemize
  2085. @item
  2086. List all available plugins within amp (LADSPA example plugin) library:
  2087. @example
  2088. ladspa=file=amp
  2089. @end example
  2090. @item
  2091. List all available controls and their valid ranges for @code{vcf_notch}
  2092. plugin from @code{VCF} library:
  2093. @example
  2094. ladspa=f=vcf:p=vcf_notch:c=help
  2095. @end example
  2096. @item
  2097. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2098. plugin library:
  2099. @example
  2100. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2101. @end example
  2102. @item
  2103. Add reverberation to the audio using TAP-plugins
  2104. (Tom's Audio Processing plugins):
  2105. @example
  2106. ladspa=file=tap_reverb:tap_reverb
  2107. @end example
  2108. @item
  2109. Generate white noise, with 0.2 amplitude:
  2110. @example
  2111. ladspa=file=cmt:noise_source_white:c=c0=.2
  2112. @end example
  2113. @item
  2114. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2115. @code{C* Audio Plugin Suite} (CAPS) library:
  2116. @example
  2117. ladspa=file=caps:Click:c=c1=20'
  2118. @end example
  2119. @item
  2120. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2121. @example
  2122. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2123. @end example
  2124. @item
  2125. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2126. @code{SWH Plugins} collection:
  2127. @example
  2128. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2129. @end example
  2130. @item
  2131. Attenuate low frequencies using Multiband EQ from Steve Harris
  2132. @code{SWH Plugins} collection:
  2133. @example
  2134. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2135. @end example
  2136. @end itemize
  2137. @subsection Commands
  2138. This filter supports the following commands:
  2139. @table @option
  2140. @item cN
  2141. Modify the @var{N}-th control value.
  2142. If the specified value is not valid, it is ignored and prior one is kept.
  2143. @end table
  2144. @section lowpass
  2145. Apply a low-pass filter with 3dB point frequency.
  2146. The filter can be either single-pole or double-pole (the default).
  2147. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2148. The filter accepts the following options:
  2149. @table @option
  2150. @item frequency, f
  2151. Set frequency in Hz. Default is 500.
  2152. @item poles, p
  2153. Set number of poles. Default is 2.
  2154. @item width_type
  2155. Set method to specify band-width of filter.
  2156. @table @option
  2157. @item h
  2158. Hz
  2159. @item q
  2160. Q-Factor
  2161. @item o
  2162. octave
  2163. @item s
  2164. slope
  2165. @end table
  2166. @item width, w
  2167. Specify the band-width of a filter in width_type units.
  2168. Applies only to double-pole filter.
  2169. The default is 0.707q and gives a Butterworth response.
  2170. @end table
  2171. @anchor{pan}
  2172. @section pan
  2173. Mix channels with specific gain levels. The filter accepts the output
  2174. channel layout followed by a set of channels definitions.
  2175. This filter is also designed to efficiently remap the channels of an audio
  2176. stream.
  2177. The filter accepts parameters of the form:
  2178. "@var{l}|@var{outdef}|@var{outdef}|..."
  2179. @table @option
  2180. @item l
  2181. output channel layout or number of channels
  2182. @item outdef
  2183. output channel specification, of the form:
  2184. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2185. @item out_name
  2186. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2187. number (c0, c1, etc.)
  2188. @item gain
  2189. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2190. @item in_name
  2191. input channel to use, see out_name for details; it is not possible to mix
  2192. named and numbered input channels
  2193. @end table
  2194. If the `=' in a channel specification is replaced by `<', then the gains for
  2195. that specification will be renormalized so that the total is 1, thus
  2196. avoiding clipping noise.
  2197. @subsection Mixing examples
  2198. For example, if you want to down-mix from stereo to mono, but with a bigger
  2199. factor for the left channel:
  2200. @example
  2201. pan=1c|c0=0.9*c0+0.1*c1
  2202. @end example
  2203. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2204. 7-channels surround:
  2205. @example
  2206. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2207. @end example
  2208. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2209. that should be preferred (see "-ac" option) unless you have very specific
  2210. needs.
  2211. @subsection Remapping examples
  2212. The channel remapping will be effective if, and only if:
  2213. @itemize
  2214. @item gain coefficients are zeroes or ones,
  2215. @item only one input per channel output,
  2216. @end itemize
  2217. If all these conditions are satisfied, the filter will notify the user ("Pure
  2218. channel mapping detected"), and use an optimized and lossless method to do the
  2219. remapping.
  2220. For example, if you have a 5.1 source and want a stereo audio stream by
  2221. dropping the extra channels:
  2222. @example
  2223. pan="stereo| c0=FL | c1=FR"
  2224. @end example
  2225. Given the same source, you can also switch front left and front right channels
  2226. and keep the input channel layout:
  2227. @example
  2228. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2229. @end example
  2230. If the input is a stereo audio stream, you can mute the front left channel (and
  2231. still keep the stereo channel layout) with:
  2232. @example
  2233. pan="stereo|c1=c1"
  2234. @end example
  2235. Still with a stereo audio stream input, you can copy the right channel in both
  2236. front left and right:
  2237. @example
  2238. pan="stereo| c0=FR | c1=FR"
  2239. @end example
  2240. @section replaygain
  2241. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2242. outputs it unchanged.
  2243. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2244. @section resample
  2245. Convert the audio sample format, sample rate and channel layout. It is
  2246. not meant to be used directly.
  2247. @section rubberband
  2248. Apply time-stretching and pitch-shifting with librubberband.
  2249. The filter accepts the following options:
  2250. @table @option
  2251. @item tempo
  2252. Set tempo scale factor.
  2253. @item pitch
  2254. Set pitch scale factor.
  2255. @item transients
  2256. Set transients detector.
  2257. Possible values are:
  2258. @table @var
  2259. @item crisp
  2260. @item mixed
  2261. @item smooth
  2262. @end table
  2263. @item detector
  2264. Set detector.
  2265. Possible values are:
  2266. @table @var
  2267. @item compound
  2268. @item percussive
  2269. @item soft
  2270. @end table
  2271. @item phase
  2272. Set phase.
  2273. Possible values are:
  2274. @table @var
  2275. @item laminar
  2276. @item independent
  2277. @end table
  2278. @item window
  2279. Set processing window size.
  2280. Possible values are:
  2281. @table @var
  2282. @item standard
  2283. @item short
  2284. @item long
  2285. @end table
  2286. @item smoothing
  2287. Set smoothing.
  2288. Possible values are:
  2289. @table @var
  2290. @item off
  2291. @item on
  2292. @end table
  2293. @item formant
  2294. Enable formant preservation when shift pitching.
  2295. Possible values are:
  2296. @table @var
  2297. @item shifted
  2298. @item preserved
  2299. @end table
  2300. @item pitchq
  2301. Set pitch quality.
  2302. Possible values are:
  2303. @table @var
  2304. @item quality
  2305. @item speed
  2306. @item consistency
  2307. @end table
  2308. @item channels
  2309. Set channels.
  2310. Possible values are:
  2311. @table @var
  2312. @item apart
  2313. @item together
  2314. @end table
  2315. @end table
  2316. @section sidechaincompress
  2317. This filter acts like normal compressor but has the ability to compress
  2318. detected signal using second input signal.
  2319. It needs two input streams and returns one output stream.
  2320. First input stream will be processed depending on second stream signal.
  2321. The filtered signal then can be filtered with other filters in later stages of
  2322. processing. See @ref{pan} and @ref{amerge} filter.
  2323. The filter accepts the following options:
  2324. @table @option
  2325. @item level_in
  2326. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2327. @item threshold
  2328. If a signal of second stream raises above this level it will affect the gain
  2329. reduction of first stream.
  2330. By default is 0.125. Range is between 0.00097563 and 1.
  2331. @item ratio
  2332. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2333. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2334. Default is 2. Range is between 1 and 20.
  2335. @item attack
  2336. Amount of milliseconds the signal has to rise above the threshold before gain
  2337. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2338. @item release
  2339. Amount of milliseconds the signal has to fall below the threshold before
  2340. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2341. @item makeup
  2342. Set the amount by how much signal will be amplified after processing.
  2343. Default is 2. Range is from 1 and 64.
  2344. @item knee
  2345. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2346. Default is 2.82843. Range is between 1 and 8.
  2347. @item link
  2348. Choose if the @code{average} level between all channels of side-chain stream
  2349. or the louder(@code{maximum}) channel of side-chain stream affects the
  2350. reduction. Default is @code{average}.
  2351. @item detection
  2352. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2353. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2354. @item level_sc
  2355. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2356. @item mix
  2357. How much to use compressed signal in output. Default is 1.
  2358. Range is between 0 and 1.
  2359. @end table
  2360. @subsection Examples
  2361. @itemize
  2362. @item
  2363. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2364. depending on the signal of 2nd input and later compressed signal to be
  2365. merged with 2nd input:
  2366. @example
  2367. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2368. @end example
  2369. @end itemize
  2370. @section sidechaingate
  2371. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2372. filter the detected signal before sending it to the gain reduction stage.
  2373. Normally a gate uses the full range signal to detect a level above the
  2374. threshold.
  2375. For example: If you cut all lower frequencies from your sidechain signal
  2376. the gate will decrease the volume of your track only if not enough highs
  2377. appear. With this technique you are able to reduce the resonation of a
  2378. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2379. guitar.
  2380. It needs two input streams and returns one output stream.
  2381. First input stream will be processed depending on second stream signal.
  2382. The filter accepts the following options:
  2383. @table @option
  2384. @item level_in
  2385. Set input level before filtering.
  2386. Default is 1. Allowed range is from 0.015625 to 64.
  2387. @item range
  2388. Set the level of gain reduction when the signal is below the threshold.
  2389. Default is 0.06125. Allowed range is from 0 to 1.
  2390. @item threshold
  2391. If a signal rises above this level the gain reduction is released.
  2392. Default is 0.125. Allowed range is from 0 to 1.
  2393. @item ratio
  2394. Set a ratio about which the signal is reduced.
  2395. Default is 2. Allowed range is from 1 to 9000.
  2396. @item attack
  2397. Amount of milliseconds the signal has to rise above the threshold before gain
  2398. reduction stops.
  2399. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2400. @item release
  2401. Amount of milliseconds the signal has to fall below the threshold before the
  2402. reduction is increased again. Default is 250 milliseconds.
  2403. Allowed range is from 0.01 to 9000.
  2404. @item makeup
  2405. Set amount of amplification of signal after processing.
  2406. Default is 1. Allowed range is from 1 to 64.
  2407. @item knee
  2408. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2409. Default is 2.828427125. Allowed range is from 1 to 8.
  2410. @item detection
  2411. Choose if exact signal should be taken for detection or an RMS like one.
  2412. Default is rms. Can be peak or rms.
  2413. @item link
  2414. Choose if the average level between all channels or the louder channel affects
  2415. the reduction.
  2416. Default is average. Can be average or maximum.
  2417. @item level_sc
  2418. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2419. @end table
  2420. @section silencedetect
  2421. Detect silence in an audio stream.
  2422. This filter logs a message when it detects that the input audio volume is less
  2423. or equal to a noise tolerance value for a duration greater or equal to the
  2424. minimum detected noise duration.
  2425. The printed times and duration are expressed in seconds.
  2426. The filter accepts the following options:
  2427. @table @option
  2428. @item duration, d
  2429. Set silence duration until notification (default is 2 seconds).
  2430. @item noise, n
  2431. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2432. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2433. @end table
  2434. @subsection Examples
  2435. @itemize
  2436. @item
  2437. Detect 5 seconds of silence with -50dB noise tolerance:
  2438. @example
  2439. silencedetect=n=-50dB:d=5
  2440. @end example
  2441. @item
  2442. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2443. tolerance in @file{silence.mp3}:
  2444. @example
  2445. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2446. @end example
  2447. @end itemize
  2448. @section silenceremove
  2449. Remove silence from the beginning, middle or end of the audio.
  2450. The filter accepts the following options:
  2451. @table @option
  2452. @item start_periods
  2453. This value is used to indicate if audio should be trimmed at beginning of
  2454. the audio. A value of zero indicates no silence should be trimmed from the
  2455. beginning. When specifying a non-zero value, it trims audio up until it
  2456. finds non-silence. Normally, when trimming silence from beginning of audio
  2457. the @var{start_periods} will be @code{1} but it can be increased to higher
  2458. values to trim all audio up to specific count of non-silence periods.
  2459. Default value is @code{0}.
  2460. @item start_duration
  2461. Specify the amount of time that non-silence must be detected before it stops
  2462. trimming audio. By increasing the duration, bursts of noises can be treated
  2463. as silence and trimmed off. Default value is @code{0}.
  2464. @item start_threshold
  2465. This indicates what sample value should be treated as silence. For digital
  2466. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2467. you may wish to increase the value to account for background noise.
  2468. Can be specified in dB (in case "dB" is appended to the specified value)
  2469. or amplitude ratio. Default value is @code{0}.
  2470. @item stop_periods
  2471. Set the count for trimming silence from the end of audio.
  2472. To remove silence from the middle of a file, specify a @var{stop_periods}
  2473. that is negative. This value is then treated as a positive value and is
  2474. used to indicate the effect should restart processing as specified by
  2475. @var{start_periods}, making it suitable for removing periods of silence
  2476. in the middle of the audio.
  2477. Default value is @code{0}.
  2478. @item stop_duration
  2479. Specify a duration of silence that must exist before audio is not copied any
  2480. more. By specifying a higher duration, silence that is wanted can be left in
  2481. the audio.
  2482. Default value is @code{0}.
  2483. @item stop_threshold
  2484. This is the same as @option{start_threshold} but for trimming silence from
  2485. the end of audio.
  2486. Can be specified in dB (in case "dB" is appended to the specified value)
  2487. or amplitude ratio. Default value is @code{0}.
  2488. @item leave_silence
  2489. This indicate that @var{stop_duration} length of audio should be left intact
  2490. at the beginning of each period of silence.
  2491. For example, if you want to remove long pauses between words but do not want
  2492. to remove the pauses completely. Default value is @code{0}.
  2493. @item detection
  2494. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2495. and works better with digital silence which is exactly 0.
  2496. Default value is @code{rms}.
  2497. @item window
  2498. Set ratio used to calculate size of window for detecting silence.
  2499. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2500. @end table
  2501. @subsection Examples
  2502. @itemize
  2503. @item
  2504. The following example shows how this filter can be used to start a recording
  2505. that does not contain the delay at the start which usually occurs between
  2506. pressing the record button and the start of the performance:
  2507. @example
  2508. silenceremove=1:5:0.02
  2509. @end example
  2510. @item
  2511. Trim all silence encountered from begining to end where there is more than 1
  2512. second of silence in audio:
  2513. @example
  2514. silenceremove=0:0:0:-1:1:-90dB
  2515. @end example
  2516. @end itemize
  2517. @section sofalizer
  2518. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2519. loudspeakers around the user for binaural listening via headphones (audio
  2520. formats up to 9 channels supported).
  2521. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2522. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2523. Austrian Academy of Sciences.
  2524. To enable compilation of this filter you need to configure FFmpeg with
  2525. @code{--enable-netcdf}.
  2526. The filter accepts the following options:
  2527. @table @option
  2528. @item sofa
  2529. Set the SOFA file used for rendering.
  2530. @item gain
  2531. Set gain applied to audio. Value is in dB. Default is 0.
  2532. @item rotation
  2533. Set rotation of virtual loudspeakers in deg. Default is 0.
  2534. @item elevation
  2535. Set elevation of virtual speakers in deg. Default is 0.
  2536. @item radius
  2537. Set distance in meters between loudspeakers and the listener with near-field
  2538. HRTFs. Default is 1.
  2539. @item type
  2540. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2541. processing audio in time domain which is slow.
  2542. @var{freq} is processing audio in frequency domain which is fast.
  2543. Default is @var{freq}.
  2544. @item speakers
  2545. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2546. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2547. Each virtual loudspeaker is described with short channel name following with
  2548. azimuth and elevation in degreees.
  2549. Each virtual loudspeaker description is separated by '|'.
  2550. For example to override front left and front right channel positions use:
  2551. 'speakers=FL 45 15|FR 345 15'.
  2552. Descriptions with unrecognised channel names are ignored.
  2553. @end table
  2554. @subsection Examples
  2555. @itemize
  2556. @item
  2557. Using ClubFritz6 sofa file:
  2558. @example
  2559. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2560. @end example
  2561. @item
  2562. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2563. @example
  2564. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2565. @end example
  2566. @item
  2567. Similar as above but with custom speaker positions for front left, front right, rear left and rear right
  2568. and also with custom gain:
  2569. @example
  2570. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|RL 135|RR 225:gain=28"
  2571. @end example
  2572. @end itemize
  2573. @section stereotools
  2574. This filter has some handy utilities to manage stereo signals, for converting
  2575. M/S stereo recordings to L/R signal while having control over the parameters
  2576. or spreading the stereo image of master track.
  2577. The filter accepts the following options:
  2578. @table @option
  2579. @item level_in
  2580. Set input level before filtering for both channels. Defaults is 1.
  2581. Allowed range is from 0.015625 to 64.
  2582. @item level_out
  2583. Set output level after filtering for both channels. Defaults is 1.
  2584. Allowed range is from 0.015625 to 64.
  2585. @item balance_in
  2586. Set input balance between both channels. Default is 0.
  2587. Allowed range is from -1 to 1.
  2588. @item balance_out
  2589. Set output balance between both channels. Default is 0.
  2590. Allowed range is from -1 to 1.
  2591. @item softclip
  2592. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2593. clipping. Disabled by default.
  2594. @item mutel
  2595. Mute the left channel. Disabled by default.
  2596. @item muter
  2597. Mute the right channel. Disabled by default.
  2598. @item phasel
  2599. Change the phase of the left channel. Disabled by default.
  2600. @item phaser
  2601. Change the phase of the right channel. Disabled by default.
  2602. @item mode
  2603. Set stereo mode. Available values are:
  2604. @table @samp
  2605. @item lr>lr
  2606. Left/Right to Left/Right, this is default.
  2607. @item lr>ms
  2608. Left/Right to Mid/Side.
  2609. @item ms>lr
  2610. Mid/Side to Left/Right.
  2611. @item lr>ll
  2612. Left/Right to Left/Left.
  2613. @item lr>rr
  2614. Left/Right to Right/Right.
  2615. @item lr>l+r
  2616. Left/Right to Left + Right.
  2617. @item lr>rl
  2618. Left/Right to Right/Left.
  2619. @end table
  2620. @item slev
  2621. Set level of side signal. Default is 1.
  2622. Allowed range is from 0.015625 to 64.
  2623. @item sbal
  2624. Set balance of side signal. Default is 0.
  2625. Allowed range is from -1 to 1.
  2626. @item mlev
  2627. Set level of the middle signal. Default is 1.
  2628. Allowed range is from 0.015625 to 64.
  2629. @item mpan
  2630. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2631. @item base
  2632. Set stereo base between mono and inversed channels. Default is 0.
  2633. Allowed range is from -1 to 1.
  2634. @item delay
  2635. Set delay in milliseconds how much to delay left from right channel and
  2636. vice versa. Default is 0. Allowed range is from -20 to 20.
  2637. @item sclevel
  2638. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2639. @item phase
  2640. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2641. @end table
  2642. @subsection Examples
  2643. @itemize
  2644. @item
  2645. Apply karaoke like effect:
  2646. @example
  2647. stereotools=mlev=0.015625
  2648. @end example
  2649. @item
  2650. Convert M/S signal to L/R:
  2651. @example
  2652. "stereotools=mode=ms>lr"
  2653. @end example
  2654. @end itemize
  2655. @section stereowiden
  2656. This filter enhance the stereo effect by suppressing signal common to both
  2657. channels and by delaying the signal of left into right and vice versa,
  2658. thereby widening the stereo effect.
  2659. The filter accepts the following options:
  2660. @table @option
  2661. @item delay
  2662. Time in milliseconds of the delay of left signal into right and vice versa.
  2663. Default is 20 milliseconds.
  2664. @item feedback
  2665. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2666. effect of left signal in right output and vice versa which gives widening
  2667. effect. Default is 0.3.
  2668. @item crossfeed
  2669. Cross feed of left into right with inverted phase. This helps in suppressing
  2670. the mono. If the value is 1 it will cancel all the signal common to both
  2671. channels. Default is 0.3.
  2672. @item drymix
  2673. Set level of input signal of original channel. Default is 0.8.
  2674. @end table
  2675. @section treble
  2676. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2677. shelving filter with a response similar to that of a standard
  2678. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2679. The filter accepts the following options:
  2680. @table @option
  2681. @item gain, g
  2682. Give the gain at whichever is the lower of ~22 kHz and the
  2683. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2684. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2685. @item frequency, f
  2686. Set the filter's central frequency and so can be used
  2687. to extend or reduce the frequency range to be boosted or cut.
  2688. The default value is @code{3000} Hz.
  2689. @item width_type
  2690. Set method to specify band-width of filter.
  2691. @table @option
  2692. @item h
  2693. Hz
  2694. @item q
  2695. Q-Factor
  2696. @item o
  2697. octave
  2698. @item s
  2699. slope
  2700. @end table
  2701. @item width, w
  2702. Determine how steep is the filter's shelf transition.
  2703. @end table
  2704. @section tremolo
  2705. Sinusoidal amplitude modulation.
  2706. The filter accepts the following options:
  2707. @table @option
  2708. @item f
  2709. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2710. (20 Hz or lower) will result in a tremolo effect.
  2711. This filter may also be used as a ring modulator by specifying
  2712. a modulation frequency higher than 20 Hz.
  2713. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2714. @item d
  2715. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2716. Default value is 0.5.
  2717. @end table
  2718. @section vibrato
  2719. Sinusoidal phase modulation.
  2720. The filter accepts the following options:
  2721. @table @option
  2722. @item f
  2723. Modulation frequency in Hertz.
  2724. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2725. @item d
  2726. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2727. Default value is 0.5.
  2728. @end table
  2729. @section volume
  2730. Adjust the input audio volume.
  2731. It accepts the following parameters:
  2732. @table @option
  2733. @item volume
  2734. Set audio volume expression.
  2735. Output values are clipped to the maximum value.
  2736. The output audio volume is given by the relation:
  2737. @example
  2738. @var{output_volume} = @var{volume} * @var{input_volume}
  2739. @end example
  2740. The default value for @var{volume} is "1.0".
  2741. @item precision
  2742. This parameter represents the mathematical precision.
  2743. It determines which input sample formats will be allowed, which affects the
  2744. precision of the volume scaling.
  2745. @table @option
  2746. @item fixed
  2747. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2748. @item float
  2749. 32-bit floating-point; this limits input sample format to FLT. (default)
  2750. @item double
  2751. 64-bit floating-point; this limits input sample format to DBL.
  2752. @end table
  2753. @item replaygain
  2754. Choose the behaviour on encountering ReplayGain side data in input frames.
  2755. @table @option
  2756. @item drop
  2757. Remove ReplayGain side data, ignoring its contents (the default).
  2758. @item ignore
  2759. Ignore ReplayGain side data, but leave it in the frame.
  2760. @item track
  2761. Prefer the track gain, if present.
  2762. @item album
  2763. Prefer the album gain, if present.
  2764. @end table
  2765. @item replaygain_preamp
  2766. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2767. Default value for @var{replaygain_preamp} is 0.0.
  2768. @item eval
  2769. Set when the volume expression is evaluated.
  2770. It accepts the following values:
  2771. @table @samp
  2772. @item once
  2773. only evaluate expression once during the filter initialization, or
  2774. when the @samp{volume} command is sent
  2775. @item frame
  2776. evaluate expression for each incoming frame
  2777. @end table
  2778. Default value is @samp{once}.
  2779. @end table
  2780. The volume expression can contain the following parameters.
  2781. @table @option
  2782. @item n
  2783. frame number (starting at zero)
  2784. @item nb_channels
  2785. number of channels
  2786. @item nb_consumed_samples
  2787. number of samples consumed by the filter
  2788. @item nb_samples
  2789. number of samples in the current frame
  2790. @item pos
  2791. original frame position in the file
  2792. @item pts
  2793. frame PTS
  2794. @item sample_rate
  2795. sample rate
  2796. @item startpts
  2797. PTS at start of stream
  2798. @item startt
  2799. time at start of stream
  2800. @item t
  2801. frame time
  2802. @item tb
  2803. timestamp timebase
  2804. @item volume
  2805. last set volume value
  2806. @end table
  2807. Note that when @option{eval} is set to @samp{once} only the
  2808. @var{sample_rate} and @var{tb} variables are available, all other
  2809. variables will evaluate to NAN.
  2810. @subsection Commands
  2811. This filter supports the following commands:
  2812. @table @option
  2813. @item volume
  2814. Modify the volume expression.
  2815. The command accepts the same syntax of the corresponding option.
  2816. If the specified expression is not valid, it is kept at its current
  2817. value.
  2818. @item replaygain_noclip
  2819. Prevent clipping by limiting the gain applied.
  2820. Default value for @var{replaygain_noclip} is 1.
  2821. @end table
  2822. @subsection Examples
  2823. @itemize
  2824. @item
  2825. Halve the input audio volume:
  2826. @example
  2827. volume=volume=0.5
  2828. volume=volume=1/2
  2829. volume=volume=-6.0206dB
  2830. @end example
  2831. In all the above example the named key for @option{volume} can be
  2832. omitted, for example like in:
  2833. @example
  2834. volume=0.5
  2835. @end example
  2836. @item
  2837. Increase input audio power by 6 decibels using fixed-point precision:
  2838. @example
  2839. volume=volume=6dB:precision=fixed
  2840. @end example
  2841. @item
  2842. Fade volume after time 10 with an annihilation period of 5 seconds:
  2843. @example
  2844. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2845. @end example
  2846. @end itemize
  2847. @section volumedetect
  2848. Detect the volume of the input video.
  2849. The filter has no parameters. The input is not modified. Statistics about
  2850. the volume will be printed in the log when the input stream end is reached.
  2851. In particular it will show the mean volume (root mean square), maximum
  2852. volume (on a per-sample basis), and the beginning of a histogram of the
  2853. registered volume values (from the maximum value to a cumulated 1/1000 of
  2854. the samples).
  2855. All volumes are in decibels relative to the maximum PCM value.
  2856. @subsection Examples
  2857. Here is an excerpt of the output:
  2858. @example
  2859. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2860. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2861. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2862. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2863. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2864. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2865. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2866. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2867. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2868. @end example
  2869. It means that:
  2870. @itemize
  2871. @item
  2872. The mean square energy is approximately -27 dB, or 10^-2.7.
  2873. @item
  2874. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2875. @item
  2876. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2877. @end itemize
  2878. In other words, raising the volume by +4 dB does not cause any clipping,
  2879. raising it by +5 dB causes clipping for 6 samples, etc.
  2880. @c man end AUDIO FILTERS
  2881. @chapter Audio Sources
  2882. @c man begin AUDIO SOURCES
  2883. Below is a description of the currently available audio sources.
  2884. @section abuffer
  2885. Buffer audio frames, and make them available to the filter chain.
  2886. This source is mainly intended for a programmatic use, in particular
  2887. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2888. It accepts the following parameters:
  2889. @table @option
  2890. @item time_base
  2891. The timebase which will be used for timestamps of submitted frames. It must be
  2892. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2893. @item sample_rate
  2894. The sample rate of the incoming audio buffers.
  2895. @item sample_fmt
  2896. The sample format of the incoming audio buffers.
  2897. Either a sample format name or its corresponding integer representation from
  2898. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2899. @item channel_layout
  2900. The channel layout of the incoming audio buffers.
  2901. Either a channel layout name from channel_layout_map in
  2902. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2903. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2904. @item channels
  2905. The number of channels of the incoming audio buffers.
  2906. If both @var{channels} and @var{channel_layout} are specified, then they
  2907. must be consistent.
  2908. @end table
  2909. @subsection Examples
  2910. @example
  2911. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2912. @end example
  2913. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2914. Since the sample format with name "s16p" corresponds to the number
  2915. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2916. equivalent to:
  2917. @example
  2918. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2919. @end example
  2920. @section aevalsrc
  2921. Generate an audio signal specified by an expression.
  2922. This source accepts in input one or more expressions (one for each
  2923. channel), which are evaluated and used to generate a corresponding
  2924. audio signal.
  2925. This source accepts the following options:
  2926. @table @option
  2927. @item exprs
  2928. Set the '|'-separated expressions list for each separate channel. In case the
  2929. @option{channel_layout} option is not specified, the selected channel layout
  2930. depends on the number of provided expressions. Otherwise the last
  2931. specified expression is applied to the remaining output channels.
  2932. @item channel_layout, c
  2933. Set the channel layout. The number of channels in the specified layout
  2934. must be equal to the number of specified expressions.
  2935. @item duration, d
  2936. Set the minimum duration of the sourced audio. See
  2937. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2938. for the accepted syntax.
  2939. Note that the resulting duration may be greater than the specified
  2940. duration, as the generated audio is always cut at the end of a
  2941. complete frame.
  2942. If not specified, or the expressed duration is negative, the audio is
  2943. supposed to be generated forever.
  2944. @item nb_samples, n
  2945. Set the number of samples per channel per each output frame,
  2946. default to 1024.
  2947. @item sample_rate, s
  2948. Specify the sample rate, default to 44100.
  2949. @end table
  2950. Each expression in @var{exprs} can contain the following constants:
  2951. @table @option
  2952. @item n
  2953. number of the evaluated sample, starting from 0
  2954. @item t
  2955. time of the evaluated sample expressed in seconds, starting from 0
  2956. @item s
  2957. sample rate
  2958. @end table
  2959. @subsection Examples
  2960. @itemize
  2961. @item
  2962. Generate silence:
  2963. @example
  2964. aevalsrc=0
  2965. @end example
  2966. @item
  2967. Generate a sin signal with frequency of 440 Hz, set sample rate to
  2968. 8000 Hz:
  2969. @example
  2970. aevalsrc="sin(440*2*PI*t):s=8000"
  2971. @end example
  2972. @item
  2973. Generate a two channels signal, specify the channel layout (Front
  2974. Center + Back Center) explicitly:
  2975. @example
  2976. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  2977. @end example
  2978. @item
  2979. Generate white noise:
  2980. @example
  2981. aevalsrc="-2+random(0)"
  2982. @end example
  2983. @item
  2984. Generate an amplitude modulated signal:
  2985. @example
  2986. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  2987. @end example
  2988. @item
  2989. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  2990. @example
  2991. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  2992. @end example
  2993. @end itemize
  2994. @section anullsrc
  2995. The null audio source, return unprocessed audio frames. It is mainly useful
  2996. as a template and to be employed in analysis / debugging tools, or as
  2997. the source for filters which ignore the input data (for example the sox
  2998. synth filter).
  2999. This source accepts the following options:
  3000. @table @option
  3001. @item channel_layout, cl
  3002. Specifies the channel layout, and can be either an integer or a string
  3003. representing a channel layout. The default value of @var{channel_layout}
  3004. is "stereo".
  3005. Check the channel_layout_map definition in
  3006. @file{libavutil/channel_layout.c} for the mapping between strings and
  3007. channel layout values.
  3008. @item sample_rate, r
  3009. Specifies the sample rate, and defaults to 44100.
  3010. @item nb_samples, n
  3011. Set the number of samples per requested frames.
  3012. @end table
  3013. @subsection Examples
  3014. @itemize
  3015. @item
  3016. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3017. @example
  3018. anullsrc=r=48000:cl=4
  3019. @end example
  3020. @item
  3021. Do the same operation with a more obvious syntax:
  3022. @example
  3023. anullsrc=r=48000:cl=mono
  3024. @end example
  3025. @end itemize
  3026. All the parameters need to be explicitly defined.
  3027. @section flite
  3028. Synthesize a voice utterance using the libflite library.
  3029. To enable compilation of this filter you need to configure FFmpeg with
  3030. @code{--enable-libflite}.
  3031. Note that the flite library is not thread-safe.
  3032. The filter accepts the following options:
  3033. @table @option
  3034. @item list_voices
  3035. If set to 1, list the names of the available voices and exit
  3036. immediately. Default value is 0.
  3037. @item nb_samples, n
  3038. Set the maximum number of samples per frame. Default value is 512.
  3039. @item textfile
  3040. Set the filename containing the text to speak.
  3041. @item text
  3042. Set the text to speak.
  3043. @item voice, v
  3044. Set the voice to use for the speech synthesis. Default value is
  3045. @code{kal}. See also the @var{list_voices} option.
  3046. @end table
  3047. @subsection Examples
  3048. @itemize
  3049. @item
  3050. Read from file @file{speech.txt}, and synthesize the text using the
  3051. standard flite voice:
  3052. @example
  3053. flite=textfile=speech.txt
  3054. @end example
  3055. @item
  3056. Read the specified text selecting the @code{slt} voice:
  3057. @example
  3058. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3059. @end example
  3060. @item
  3061. Input text to ffmpeg:
  3062. @example
  3063. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3064. @end example
  3065. @item
  3066. Make @file{ffplay} speak the specified text, using @code{flite} and
  3067. the @code{lavfi} device:
  3068. @example
  3069. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3070. @end example
  3071. @end itemize
  3072. For more information about libflite, check:
  3073. @url{http://www.speech.cs.cmu.edu/flite/}
  3074. @section anoisesrc
  3075. Generate a noise audio signal.
  3076. The filter accepts the following options:
  3077. @table @option
  3078. @item sample_rate, r
  3079. Specify the sample rate. Default value is 48000 Hz.
  3080. @item amplitude, a
  3081. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3082. is 1.0.
  3083. @item duration, d
  3084. Specify the duration of the generated audio stream. Not specifying this option
  3085. results in noise with an infinite length.
  3086. @item color, colour, c
  3087. Specify the color of noise. Available noise colors are white, pink, and brown.
  3088. Default color is white.
  3089. @item seed, s
  3090. Specify a value used to seed the PRNG.
  3091. @item nb_samples, n
  3092. Set the number of samples per each output frame, default is 1024.
  3093. @end table
  3094. @subsection Examples
  3095. @itemize
  3096. @item
  3097. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3098. @example
  3099. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3100. @end example
  3101. @end itemize
  3102. @section sine
  3103. Generate an audio signal made of a sine wave with amplitude 1/8.
  3104. The audio signal is bit-exact.
  3105. The filter accepts the following options:
  3106. @table @option
  3107. @item frequency, f
  3108. Set the carrier frequency. Default is 440 Hz.
  3109. @item beep_factor, b
  3110. Enable a periodic beep every second with frequency @var{beep_factor} times
  3111. the carrier frequency. Default is 0, meaning the beep is disabled.
  3112. @item sample_rate, r
  3113. Specify the sample rate, default is 44100.
  3114. @item duration, d
  3115. Specify the duration of the generated audio stream.
  3116. @item samples_per_frame
  3117. Set the number of samples per output frame.
  3118. The expression can contain the following constants:
  3119. @table @option
  3120. @item n
  3121. The (sequential) number of the output audio frame, starting from 0.
  3122. @item pts
  3123. The PTS (Presentation TimeStamp) of the output audio frame,
  3124. expressed in @var{TB} units.
  3125. @item t
  3126. The PTS of the output audio frame, expressed in seconds.
  3127. @item TB
  3128. The timebase of the output audio frames.
  3129. @end table
  3130. Default is @code{1024}.
  3131. @end table
  3132. @subsection Examples
  3133. @itemize
  3134. @item
  3135. Generate a simple 440 Hz sine wave:
  3136. @example
  3137. sine
  3138. @end example
  3139. @item
  3140. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3141. @example
  3142. sine=220:4:d=5
  3143. sine=f=220:b=4:d=5
  3144. sine=frequency=220:beep_factor=4:duration=5
  3145. @end example
  3146. @item
  3147. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3148. pattern:
  3149. @example
  3150. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3151. @end example
  3152. @end itemize
  3153. @c man end AUDIO SOURCES
  3154. @chapter Audio Sinks
  3155. @c man begin AUDIO SINKS
  3156. Below is a description of the currently available audio sinks.
  3157. @section abuffersink
  3158. Buffer audio frames, and make them available to the end of filter chain.
  3159. This sink is mainly intended for programmatic use, in particular
  3160. through the interface defined in @file{libavfilter/buffersink.h}
  3161. or the options system.
  3162. It accepts a pointer to an AVABufferSinkContext structure, which
  3163. defines the incoming buffers' formats, to be passed as the opaque
  3164. parameter to @code{avfilter_init_filter} for initialization.
  3165. @section anullsink
  3166. Null audio sink; do absolutely nothing with the input audio. It is
  3167. mainly useful as a template and for use in analysis / debugging
  3168. tools.
  3169. @c man end AUDIO SINKS
  3170. @chapter Video Filters
  3171. @c man begin VIDEO FILTERS
  3172. When you configure your FFmpeg build, you can disable any of the
  3173. existing filters using @code{--disable-filters}.
  3174. The configure output will show the video filters included in your
  3175. build.
  3176. Below is a description of the currently available video filters.
  3177. @section alphaextract
  3178. Extract the alpha component from the input as a grayscale video. This
  3179. is especially useful with the @var{alphamerge} filter.
  3180. @section alphamerge
  3181. Add or replace the alpha component of the primary input with the
  3182. grayscale value of a second input. This is intended for use with
  3183. @var{alphaextract} to allow the transmission or storage of frame
  3184. sequences that have alpha in a format that doesn't support an alpha
  3185. channel.
  3186. For example, to reconstruct full frames from a normal YUV-encoded video
  3187. and a separate video created with @var{alphaextract}, you might use:
  3188. @example
  3189. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3190. @end example
  3191. Since this filter is designed for reconstruction, it operates on frame
  3192. sequences without considering timestamps, and terminates when either
  3193. input reaches end of stream. This will cause problems if your encoding
  3194. pipeline drops frames. If you're trying to apply an image as an
  3195. overlay to a video stream, consider the @var{overlay} filter instead.
  3196. @section ass
  3197. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3198. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3199. Substation Alpha) subtitles files.
  3200. This filter accepts the following option in addition to the common options from
  3201. the @ref{subtitles} filter:
  3202. @table @option
  3203. @item shaping
  3204. Set the shaping engine
  3205. Available values are:
  3206. @table @samp
  3207. @item auto
  3208. The default libass shaping engine, which is the best available.
  3209. @item simple
  3210. Fast, font-agnostic shaper that can do only substitutions
  3211. @item complex
  3212. Slower shaper using OpenType for substitutions and positioning
  3213. @end table
  3214. The default is @code{auto}.
  3215. @end table
  3216. @section atadenoise
  3217. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3218. The filter accepts the following options:
  3219. @table @option
  3220. @item 0a
  3221. Set threshold A for 1st plane. Default is 0.02.
  3222. Valid range is 0 to 0.3.
  3223. @item 0b
  3224. Set threshold B for 1st plane. Default is 0.04.
  3225. Valid range is 0 to 5.
  3226. @item 1a
  3227. Set threshold A for 2nd plane. Default is 0.02.
  3228. Valid range is 0 to 0.3.
  3229. @item 1b
  3230. Set threshold B for 2nd plane. Default is 0.04.
  3231. Valid range is 0 to 5.
  3232. @item 2a
  3233. Set threshold A for 3rd plane. Default is 0.02.
  3234. Valid range is 0 to 0.3.
  3235. @item 2b
  3236. Set threshold B for 3rd plane. Default is 0.04.
  3237. Valid range is 0 to 5.
  3238. Threshold A is designed to react on abrupt changes in the input signal and
  3239. threshold B is designed to react on continuous changes in the input signal.
  3240. @item s
  3241. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3242. number in range [5, 129].
  3243. @end table
  3244. @section bbox
  3245. Compute the bounding box for the non-black pixels in the input frame
  3246. luminance plane.
  3247. This filter computes the bounding box containing all the pixels with a
  3248. luminance value greater than the minimum allowed value.
  3249. The parameters describing the bounding box are printed on the filter
  3250. log.
  3251. The filter accepts the following option:
  3252. @table @option
  3253. @item min_val
  3254. Set the minimal luminance value. Default is @code{16}.
  3255. @end table
  3256. @section blackdetect
  3257. Detect video intervals that are (almost) completely black. Can be
  3258. useful to detect chapter transitions, commercials, or invalid
  3259. recordings. Output lines contains the time for the start, end and
  3260. duration of the detected black interval expressed in seconds.
  3261. In order to display the output lines, you need to set the loglevel at
  3262. least to the AV_LOG_INFO value.
  3263. The filter accepts the following options:
  3264. @table @option
  3265. @item black_min_duration, d
  3266. Set the minimum detected black duration expressed in seconds. It must
  3267. be a non-negative floating point number.
  3268. Default value is 2.0.
  3269. @item picture_black_ratio_th, pic_th
  3270. Set the threshold for considering a picture "black".
  3271. Express the minimum value for the ratio:
  3272. @example
  3273. @var{nb_black_pixels} / @var{nb_pixels}
  3274. @end example
  3275. for which a picture is considered black.
  3276. Default value is 0.98.
  3277. @item pixel_black_th, pix_th
  3278. Set the threshold for considering a pixel "black".
  3279. The threshold expresses the maximum pixel luminance value for which a
  3280. pixel is considered "black". The provided value is scaled according to
  3281. the following equation:
  3282. @example
  3283. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3284. @end example
  3285. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3286. the input video format, the range is [0-255] for YUV full-range
  3287. formats and [16-235] for YUV non full-range formats.
  3288. Default value is 0.10.
  3289. @end table
  3290. The following example sets the maximum pixel threshold to the minimum
  3291. value, and detects only black intervals of 2 or more seconds:
  3292. @example
  3293. blackdetect=d=2:pix_th=0.00
  3294. @end example
  3295. @section blackframe
  3296. Detect frames that are (almost) completely black. Can be useful to
  3297. detect chapter transitions or commercials. Output lines consist of
  3298. the frame number of the detected frame, the percentage of blackness,
  3299. the position in the file if known or -1 and the timestamp in seconds.
  3300. In order to display the output lines, you need to set the loglevel at
  3301. least to the AV_LOG_INFO value.
  3302. It accepts the following parameters:
  3303. @table @option
  3304. @item amount
  3305. The percentage of the pixels that have to be below the threshold; it defaults to
  3306. @code{98}.
  3307. @item threshold, thresh
  3308. The threshold below which a pixel value is considered black; it defaults to
  3309. @code{32}.
  3310. @end table
  3311. @section blend, tblend
  3312. Blend two video frames into each other.
  3313. The @code{blend} filter takes two input streams and outputs one
  3314. stream, the first input is the "top" layer and second input is
  3315. "bottom" layer. Output terminates when shortest input terminates.
  3316. The @code{tblend} (time blend) filter takes two consecutive frames
  3317. from one single stream, and outputs the result obtained by blending
  3318. the new frame on top of the old frame.
  3319. A description of the accepted options follows.
  3320. @table @option
  3321. @item c0_mode
  3322. @item c1_mode
  3323. @item c2_mode
  3324. @item c3_mode
  3325. @item all_mode
  3326. Set blend mode for specific pixel component or all pixel components in case
  3327. of @var{all_mode}. Default value is @code{normal}.
  3328. Available values for component modes are:
  3329. @table @samp
  3330. @item addition
  3331. @item addition128
  3332. @item and
  3333. @item average
  3334. @item burn
  3335. @item darken
  3336. @item difference
  3337. @item difference128
  3338. @item divide
  3339. @item dodge
  3340. @item freeze
  3341. @item exclusion
  3342. @item glow
  3343. @item hardlight
  3344. @item hardmix
  3345. @item heat
  3346. @item lighten
  3347. @item linearlight
  3348. @item multiply
  3349. @item multiply128
  3350. @item negation
  3351. @item normal
  3352. @item or
  3353. @item overlay
  3354. @item phoenix
  3355. @item pinlight
  3356. @item reflect
  3357. @item screen
  3358. @item softlight
  3359. @item subtract
  3360. @item vividlight
  3361. @item xor
  3362. @end table
  3363. @item c0_opacity
  3364. @item c1_opacity
  3365. @item c2_opacity
  3366. @item c3_opacity
  3367. @item all_opacity
  3368. Set blend opacity for specific pixel component or all pixel components in case
  3369. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3370. @item c0_expr
  3371. @item c1_expr
  3372. @item c2_expr
  3373. @item c3_expr
  3374. @item all_expr
  3375. Set blend expression for specific pixel component or all pixel components in case
  3376. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3377. The expressions can use the following variables:
  3378. @table @option
  3379. @item N
  3380. The sequential number of the filtered frame, starting from @code{0}.
  3381. @item X
  3382. @item Y
  3383. the coordinates of the current sample
  3384. @item W
  3385. @item H
  3386. the width and height of currently filtered plane
  3387. @item SW
  3388. @item SH
  3389. Width and height scale depending on the currently filtered plane. It is the
  3390. ratio between the corresponding luma plane number of pixels and the current
  3391. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3392. @code{0.5,0.5} for chroma planes.
  3393. @item T
  3394. Time of the current frame, expressed in seconds.
  3395. @item TOP, A
  3396. Value of pixel component at current location for first video frame (top layer).
  3397. @item BOTTOM, B
  3398. Value of pixel component at current location for second video frame (bottom layer).
  3399. @end table
  3400. @item shortest
  3401. Force termination when the shortest input terminates. Default is
  3402. @code{0}. This option is only defined for the @code{blend} filter.
  3403. @item repeatlast
  3404. Continue applying the last bottom frame after the end of the stream. A value of
  3405. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3406. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3407. @end table
  3408. @subsection Examples
  3409. @itemize
  3410. @item
  3411. Apply transition from bottom layer to top layer in first 10 seconds:
  3412. @example
  3413. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3414. @end example
  3415. @item
  3416. Apply 1x1 checkerboard effect:
  3417. @example
  3418. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3419. @end example
  3420. @item
  3421. Apply uncover left effect:
  3422. @example
  3423. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3424. @end example
  3425. @item
  3426. Apply uncover down effect:
  3427. @example
  3428. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3429. @end example
  3430. @item
  3431. Apply uncover up-left effect:
  3432. @example
  3433. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3434. @end example
  3435. @item
  3436. Split diagonally video and shows top and bottom layer on each side:
  3437. @example
  3438. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3439. @end example
  3440. @item
  3441. Display differences between the current and the previous frame:
  3442. @example
  3443. tblend=all_mode=difference128
  3444. @end example
  3445. @end itemize
  3446. @section bwdif
  3447. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3448. Deinterlacing Filter").
  3449. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3450. interpolation algorithms.
  3451. It accepts the following parameters:
  3452. @table @option
  3453. @item mode
  3454. The interlacing mode to adopt. It accepts one of the following values:
  3455. @table @option
  3456. @item 0, send_frame
  3457. Output one frame for each frame.
  3458. @item 1, send_field
  3459. Output one frame for each field.
  3460. @end table
  3461. The default value is @code{send_field}.
  3462. @item parity
  3463. The picture field parity assumed for the input interlaced video. It accepts one
  3464. of the following values:
  3465. @table @option
  3466. @item 0, tff
  3467. Assume the top field is first.
  3468. @item 1, bff
  3469. Assume the bottom field is first.
  3470. @item -1, auto
  3471. Enable automatic detection of field parity.
  3472. @end table
  3473. The default value is @code{auto}.
  3474. If the interlacing is unknown or the decoder does not export this information,
  3475. top field first will be assumed.
  3476. @item deint
  3477. Specify which frames to deinterlace. Accept one of the following
  3478. values:
  3479. @table @option
  3480. @item 0, all
  3481. Deinterlace all frames.
  3482. @item 1, interlaced
  3483. Only deinterlace frames marked as interlaced.
  3484. @end table
  3485. The default value is @code{all}.
  3486. @end table
  3487. @section boxblur
  3488. Apply a boxblur algorithm to the input video.
  3489. It accepts the following parameters:
  3490. @table @option
  3491. @item luma_radius, lr
  3492. @item luma_power, lp
  3493. @item chroma_radius, cr
  3494. @item chroma_power, cp
  3495. @item alpha_radius, ar
  3496. @item alpha_power, ap
  3497. @end table
  3498. A description of the accepted options follows.
  3499. @table @option
  3500. @item luma_radius, lr
  3501. @item chroma_radius, cr
  3502. @item alpha_radius, ar
  3503. Set an expression for the box radius in pixels used for blurring the
  3504. corresponding input plane.
  3505. The radius value must be a non-negative number, and must not be
  3506. greater than the value of the expression @code{min(w,h)/2} for the
  3507. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3508. planes.
  3509. Default value for @option{luma_radius} is "2". If not specified,
  3510. @option{chroma_radius} and @option{alpha_radius} default to the
  3511. corresponding value set for @option{luma_radius}.
  3512. The expressions can contain the following constants:
  3513. @table @option
  3514. @item w
  3515. @item h
  3516. The input width and height in pixels.
  3517. @item cw
  3518. @item ch
  3519. The input chroma image width and height in pixels.
  3520. @item hsub
  3521. @item vsub
  3522. The horizontal and vertical chroma subsample values. For example, for the
  3523. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3524. @end table
  3525. @item luma_power, lp
  3526. @item chroma_power, cp
  3527. @item alpha_power, ap
  3528. Specify how many times the boxblur filter is applied to the
  3529. corresponding plane.
  3530. Default value for @option{luma_power} is 2. If not specified,
  3531. @option{chroma_power} and @option{alpha_power} default to the
  3532. corresponding value set for @option{luma_power}.
  3533. A value of 0 will disable the effect.
  3534. @end table
  3535. @subsection Examples
  3536. @itemize
  3537. @item
  3538. Apply a boxblur filter with the luma, chroma, and alpha radii
  3539. set to 2:
  3540. @example
  3541. boxblur=luma_radius=2:luma_power=1
  3542. boxblur=2:1
  3543. @end example
  3544. @item
  3545. Set the luma radius to 2, and alpha and chroma radius to 0:
  3546. @example
  3547. boxblur=2:1:cr=0:ar=0
  3548. @end example
  3549. @item
  3550. Set the luma and chroma radii to a fraction of the video dimension:
  3551. @example
  3552. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3553. @end example
  3554. @end itemize
  3555. @section chromakey
  3556. YUV colorspace color/chroma keying.
  3557. The filter accepts the following options:
  3558. @table @option
  3559. @item color
  3560. The color which will be replaced with transparency.
  3561. @item similarity
  3562. Similarity percentage with the key color.
  3563. 0.01 matches only the exact key color, while 1.0 matches everything.
  3564. @item blend
  3565. Blend percentage.
  3566. 0.0 makes pixels either fully transparent, or not transparent at all.
  3567. Higher values result in semi-transparent pixels, with a higher transparency
  3568. the more similar the pixels color is to the key color.
  3569. @item yuv
  3570. Signals that the color passed is already in YUV instead of RGB.
  3571. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3572. This can be used to pass exact YUV values as hexadecimal numbers.
  3573. @end table
  3574. @subsection Examples
  3575. @itemize
  3576. @item
  3577. Make every green pixel in the input image transparent:
  3578. @example
  3579. ffmpeg -i input.png -vf chromakey=green out.png
  3580. @end example
  3581. @item
  3582. Overlay a greenscreen-video on top of a static black background.
  3583. @example
  3584. 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
  3585. @end example
  3586. @end itemize
  3587. @section ciescope
  3588. Display CIE color diagram with pixels overlaid onto it.
  3589. The filter acccepts the following options:
  3590. @table @option
  3591. @item system
  3592. Set color system.
  3593. @table @samp
  3594. @item ntsc, 470m
  3595. @item ebu, 470bg
  3596. @item smpte
  3597. @item 240m
  3598. @item apple
  3599. @item widergb
  3600. @item cie1931
  3601. @item rec709, hdtv
  3602. @item uhdtv, rec2020
  3603. @end table
  3604. @item cie
  3605. Set CIE system.
  3606. @table @samp
  3607. @item xyy
  3608. @item ucs
  3609. @item luv
  3610. @end table
  3611. @item gamuts
  3612. Set what gamuts to draw.
  3613. See @code{system} option for avaiable values.
  3614. @item size, s
  3615. Set ciescope size, by default set to 512.
  3616. @item intensity, i
  3617. Set intensity used to map input pixel values to CIE diagram.
  3618. @item contrast
  3619. Set contrast used to draw tongue colors that are out of active color system gamut.
  3620. @item corrgamma
  3621. Correct gamma displayed on scope, by default enabled.
  3622. @item showwhite
  3623. Show white point on CIE diagram, by default disabled.
  3624. @item gamma
  3625. Set input gamma. Used only with XYZ input color space.
  3626. @end table
  3627. @section codecview
  3628. Visualize information exported by some codecs.
  3629. Some codecs can export information through frames using side-data or other
  3630. means. For example, some MPEG based codecs export motion vectors through the
  3631. @var{export_mvs} flag in the codec @option{flags2} option.
  3632. The filter accepts the following option:
  3633. @table @option
  3634. @item mv
  3635. Set motion vectors to visualize.
  3636. Available flags for @var{mv} are:
  3637. @table @samp
  3638. @item pf
  3639. forward predicted MVs of P-frames
  3640. @item bf
  3641. forward predicted MVs of B-frames
  3642. @item bb
  3643. backward predicted MVs of B-frames
  3644. @end table
  3645. @item qp
  3646. Display quantization parameters using the chroma planes
  3647. @end table
  3648. @subsection Examples
  3649. @itemize
  3650. @item
  3651. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  3652. @example
  3653. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  3654. @end example
  3655. @end itemize
  3656. @section colorbalance
  3657. Modify intensity of primary colors (red, green and blue) of input frames.
  3658. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3659. regions for the red-cyan, green-magenta or blue-yellow balance.
  3660. A positive adjustment value shifts the balance towards the primary color, a negative
  3661. value towards the complementary color.
  3662. The filter accepts the following options:
  3663. @table @option
  3664. @item rs
  3665. @item gs
  3666. @item bs
  3667. Adjust red, green and blue shadows (darkest pixels).
  3668. @item rm
  3669. @item gm
  3670. @item bm
  3671. Adjust red, green and blue midtones (medium pixels).
  3672. @item rh
  3673. @item gh
  3674. @item bh
  3675. Adjust red, green and blue highlights (brightest pixels).
  3676. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3677. @end table
  3678. @subsection Examples
  3679. @itemize
  3680. @item
  3681. Add red color cast to shadows:
  3682. @example
  3683. colorbalance=rs=.3
  3684. @end example
  3685. @end itemize
  3686. @section colorkey
  3687. RGB colorspace color keying.
  3688. The filter accepts the following options:
  3689. @table @option
  3690. @item color
  3691. The color which will be replaced with transparency.
  3692. @item similarity
  3693. Similarity percentage with the key color.
  3694. 0.01 matches only the exact key color, while 1.0 matches everything.
  3695. @item blend
  3696. Blend percentage.
  3697. 0.0 makes pixels either fully transparent, or not transparent at all.
  3698. Higher values result in semi-transparent pixels, with a higher transparency
  3699. the more similar the pixels color is to the key color.
  3700. @end table
  3701. @subsection Examples
  3702. @itemize
  3703. @item
  3704. Make every green pixel in the input image transparent:
  3705. @example
  3706. ffmpeg -i input.png -vf colorkey=green out.png
  3707. @end example
  3708. @item
  3709. Overlay a greenscreen-video on top of a static background image.
  3710. @example
  3711. 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
  3712. @end example
  3713. @end itemize
  3714. @section colorlevels
  3715. Adjust video input frames using levels.
  3716. The filter accepts the following options:
  3717. @table @option
  3718. @item rimin
  3719. @item gimin
  3720. @item bimin
  3721. @item aimin
  3722. Adjust red, green, blue and alpha input black point.
  3723. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3724. @item rimax
  3725. @item gimax
  3726. @item bimax
  3727. @item aimax
  3728. Adjust red, green, blue and alpha input white point.
  3729. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3730. Input levels are used to lighten highlights (bright tones), darken shadows
  3731. (dark tones), change the balance of bright and dark tones.
  3732. @item romin
  3733. @item gomin
  3734. @item bomin
  3735. @item aomin
  3736. Adjust red, green, blue and alpha output black point.
  3737. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3738. @item romax
  3739. @item gomax
  3740. @item bomax
  3741. @item aomax
  3742. Adjust red, green, blue and alpha output white point.
  3743. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3744. Output levels allows manual selection of a constrained output level range.
  3745. @end table
  3746. @subsection Examples
  3747. @itemize
  3748. @item
  3749. Make video output darker:
  3750. @example
  3751. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3752. @end example
  3753. @item
  3754. Increase contrast:
  3755. @example
  3756. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3757. @end example
  3758. @item
  3759. Make video output lighter:
  3760. @example
  3761. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3762. @end example
  3763. @item
  3764. Increase brightness:
  3765. @example
  3766. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3767. @end example
  3768. @end itemize
  3769. @section colorchannelmixer
  3770. Adjust video input frames by re-mixing color channels.
  3771. This filter modifies a color channel by adding the values associated to
  3772. the other channels of the same pixels. For example if the value to
  3773. modify is red, the output value will be:
  3774. @example
  3775. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3776. @end example
  3777. The filter accepts the following options:
  3778. @table @option
  3779. @item rr
  3780. @item rg
  3781. @item rb
  3782. @item ra
  3783. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3784. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3785. @item gr
  3786. @item gg
  3787. @item gb
  3788. @item ga
  3789. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3790. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3791. @item br
  3792. @item bg
  3793. @item bb
  3794. @item ba
  3795. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3796. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3797. @item ar
  3798. @item ag
  3799. @item ab
  3800. @item aa
  3801. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3802. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3803. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3804. @end table
  3805. @subsection Examples
  3806. @itemize
  3807. @item
  3808. Convert source to grayscale:
  3809. @example
  3810. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3811. @end example
  3812. @item
  3813. Simulate sepia tones:
  3814. @example
  3815. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3816. @end example
  3817. @end itemize
  3818. @section colormatrix
  3819. Convert color matrix.
  3820. The filter accepts the following options:
  3821. @table @option
  3822. @item src
  3823. @item dst
  3824. Specify the source and destination color matrix. Both values must be
  3825. specified.
  3826. The accepted values are:
  3827. @table @samp
  3828. @item bt709
  3829. BT.709
  3830. @item bt601
  3831. BT.601
  3832. @item smpte240m
  3833. SMPTE-240M
  3834. @item fcc
  3835. FCC
  3836. @end table
  3837. @end table
  3838. For example to convert from BT.601 to SMPTE-240M, use the command:
  3839. @example
  3840. colormatrix=bt601:smpte240m
  3841. @end example
  3842. @section convolution
  3843. Apply convolution 3x3 or 5x5 filter.
  3844. The filter accepts the following options:
  3845. @table @option
  3846. @item 0m
  3847. @item 1m
  3848. @item 2m
  3849. @item 3m
  3850. Set matrix for each plane.
  3851. Matrix is sequence of 9 or 25 signed integers.
  3852. @item 0rdiv
  3853. @item 1rdiv
  3854. @item 2rdiv
  3855. @item 3rdiv
  3856. Set multiplier for calculated value for each plane.
  3857. @item 0bias
  3858. @item 1bias
  3859. @item 2bias
  3860. @item 3bias
  3861. Set bias for each plane. This value is added to the result of the multiplication.
  3862. Useful for making the overall image brighter or darker. Default is 0.0.
  3863. @end table
  3864. @subsection Examples
  3865. @itemize
  3866. @item
  3867. Apply sharpen:
  3868. @example
  3869. convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0"
  3870. @end example
  3871. @item
  3872. Apply blur:
  3873. @example
  3874. convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9"
  3875. @end example
  3876. @item
  3877. Apply edge enhance:
  3878. @example
  3879. convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128"
  3880. @end example
  3881. @item
  3882. Apply edge detect:
  3883. @example
  3884. convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128"
  3885. @end example
  3886. @item
  3887. Apply emboss:
  3888. @example
  3889. convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2"
  3890. @end example
  3891. @end itemize
  3892. @section copy
  3893. Copy the input source unchanged to the output. This is mainly useful for
  3894. testing purposes.
  3895. @anchor{coreimage}
  3896. @section coreimage
  3897. Video filtering on GPU using Apple's CoreImage API on OSX.
  3898. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  3899. processed by video hardware. However, software-based OpenGL implementations
  3900. exist which means there is no guarantee for hardware processing. It depends on
  3901. the respective OSX.
  3902. There are many filters and image generators provided by Apple that come with a
  3903. large variety of options. The filter has to be referenced by its name along
  3904. with its options.
  3905. The coreimage filter accepts the following options:
  3906. @table @option
  3907. @item list_filters
  3908. List all available filters and generators along with all their respective
  3909. options as well as possible minimum and maximum values along with the default
  3910. values.
  3911. @example
  3912. list_filters=true
  3913. @end example
  3914. @item filter
  3915. Specify all filters by their respective name and options.
  3916. Use @var{list_filters} to determine all valid filter names and options.
  3917. Numerical options are specified by a float value and are automatically clamped
  3918. to their respective value range. Vector and color options have to be specified
  3919. by a list of space separated float values. Character escaping has to be done.
  3920. A special option name @code{default} is available to use default options for a
  3921. filter.
  3922. It is required to specify either @code{default} or at least one of the filter options.
  3923. All omitted options are used with their default values.
  3924. The syntax of the filter string is as follows:
  3925. @example
  3926. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  3927. @end example
  3928. @item output_rect
  3929. Specify a rectangle where the output of the filter chain is copied into the
  3930. input image. It is given by a list of space separated float values:
  3931. @example
  3932. output_rect=x\ y\ width\ height
  3933. @end example
  3934. If not given, the output rectangle equals the dimensions of the input image.
  3935. The output rectangle is automatically cropped at the borders of the input
  3936. image. Negative values are valid for each component.
  3937. @example
  3938. output_rect=25\ 25\ 100\ 100
  3939. @end example
  3940. @end table
  3941. Several filters can be chained for successive processing without GPU-HOST
  3942. transfers allowing for fast processing of complex filter chains.
  3943. Currently, only filters with zero (generators) or exactly one (filters) input
  3944. image and one output image are supported. Also, transition filters are not yet
  3945. usable as intended.
  3946. Some filters generate output images with additional padding depending on the
  3947. respective filter kernel. The padding is automatically removed to ensure the
  3948. filter output has the same size as the input image.
  3949. For image generators, the size of the output image is determined by the
  3950. previous output image of the filter chain or the input image of the whole
  3951. filterchain, respectively. The generators do not use the pixel information of
  3952. this image to generate their output. However, the generated output is
  3953. blended onto this image, resulting in partial or complete coverage of the
  3954. output image.
  3955. The @ref{coreimagesrc} video source can be used for generating input images
  3956. which are directly fed into the filter chain. By using it, providing input
  3957. images by another video source or an input video is not required.
  3958. @subsection Examples
  3959. @itemize
  3960. @item
  3961. List all filters available:
  3962. @example
  3963. coreimage=list_filters=true
  3964. @end example
  3965. @item
  3966. Use the CIBoxBlur filter with default options to blur an image:
  3967. @example
  3968. coreimage=filter=CIBoxBlur@@default
  3969. @end example
  3970. @item
  3971. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  3972. its center at 100x100 and a radius of 50 pixels:
  3973. @example
  3974. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  3975. @end example
  3976. @item
  3977. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  3978. given as complete and escaped command-line for Apple's standard bash shell:
  3979. @example
  3980. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  3981. @end example
  3982. @end itemize
  3983. @section crop
  3984. Crop the input video to given dimensions.
  3985. It accepts the following parameters:
  3986. @table @option
  3987. @item w, out_w
  3988. The width of the output video. It defaults to @code{iw}.
  3989. This expression is evaluated only once during the filter
  3990. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  3991. @item h, out_h
  3992. The height of the output video. It defaults to @code{ih}.
  3993. This expression is evaluated only once during the filter
  3994. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  3995. @item x
  3996. The horizontal position, in the input video, of the left edge of the output
  3997. video. It defaults to @code{(in_w-out_w)/2}.
  3998. This expression is evaluated per-frame.
  3999. @item y
  4000. The vertical position, in the input video, of the top edge of the output video.
  4001. It defaults to @code{(in_h-out_h)/2}.
  4002. This expression is evaluated per-frame.
  4003. @item keep_aspect
  4004. If set to 1 will force the output display aspect ratio
  4005. to be the same of the input, by changing the output sample aspect
  4006. ratio. It defaults to 0.
  4007. @end table
  4008. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4009. expressions containing the following constants:
  4010. @table @option
  4011. @item x
  4012. @item y
  4013. The computed values for @var{x} and @var{y}. They are evaluated for
  4014. each new frame.
  4015. @item in_w
  4016. @item in_h
  4017. The input width and height.
  4018. @item iw
  4019. @item ih
  4020. These are the same as @var{in_w} and @var{in_h}.
  4021. @item out_w
  4022. @item out_h
  4023. The output (cropped) width and height.
  4024. @item ow
  4025. @item oh
  4026. These are the same as @var{out_w} and @var{out_h}.
  4027. @item a
  4028. same as @var{iw} / @var{ih}
  4029. @item sar
  4030. input sample aspect ratio
  4031. @item dar
  4032. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4033. @item hsub
  4034. @item vsub
  4035. horizontal and vertical chroma subsample values. For example for the
  4036. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4037. @item n
  4038. The number of the input frame, starting from 0.
  4039. @item pos
  4040. the position in the file of the input frame, NAN if unknown
  4041. @item t
  4042. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4043. @end table
  4044. The expression for @var{out_w} may depend on the value of @var{out_h},
  4045. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4046. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4047. evaluated after @var{out_w} and @var{out_h}.
  4048. The @var{x} and @var{y} parameters specify the expressions for the
  4049. position of the top-left corner of the output (non-cropped) area. They
  4050. are evaluated for each frame. If the evaluated value is not valid, it
  4051. is approximated to the nearest valid value.
  4052. The expression for @var{x} may depend on @var{y}, and the expression
  4053. for @var{y} may depend on @var{x}.
  4054. @subsection Examples
  4055. @itemize
  4056. @item
  4057. Crop area with size 100x100 at position (12,34).
  4058. @example
  4059. crop=100:100:12:34
  4060. @end example
  4061. Using named options, the example above becomes:
  4062. @example
  4063. crop=w=100:h=100:x=12:y=34
  4064. @end example
  4065. @item
  4066. Crop the central input area with size 100x100:
  4067. @example
  4068. crop=100:100
  4069. @end example
  4070. @item
  4071. Crop the central input area with size 2/3 of the input video:
  4072. @example
  4073. crop=2/3*in_w:2/3*in_h
  4074. @end example
  4075. @item
  4076. Crop the input video central square:
  4077. @example
  4078. crop=out_w=in_h
  4079. crop=in_h
  4080. @end example
  4081. @item
  4082. Delimit the rectangle with the top-left corner placed at position
  4083. 100:100 and the right-bottom corner corresponding to the right-bottom
  4084. corner of the input image.
  4085. @example
  4086. crop=in_w-100:in_h-100:100:100
  4087. @end example
  4088. @item
  4089. Crop 10 pixels from the left and right borders, and 20 pixels from
  4090. the top and bottom borders
  4091. @example
  4092. crop=in_w-2*10:in_h-2*20
  4093. @end example
  4094. @item
  4095. Keep only the bottom right quarter of the input image:
  4096. @example
  4097. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4098. @end example
  4099. @item
  4100. Crop height for getting Greek harmony:
  4101. @example
  4102. crop=in_w:1/PHI*in_w
  4103. @end example
  4104. @item
  4105. Apply trembling effect:
  4106. @example
  4107. 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)
  4108. @end example
  4109. @item
  4110. Apply erratic camera effect depending on timestamp:
  4111. @example
  4112. 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)"
  4113. @end example
  4114. @item
  4115. Set x depending on the value of y:
  4116. @example
  4117. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4118. @end example
  4119. @end itemize
  4120. @subsection Commands
  4121. This filter supports the following commands:
  4122. @table @option
  4123. @item w, out_w
  4124. @item h, out_h
  4125. @item x
  4126. @item y
  4127. Set width/height of the output video and the horizontal/vertical position
  4128. in the input video.
  4129. The command accepts the same syntax of the corresponding option.
  4130. If the specified expression is not valid, it is kept at its current
  4131. value.
  4132. @end table
  4133. @section cropdetect
  4134. Auto-detect the crop size.
  4135. It calculates the necessary cropping parameters and prints the
  4136. recommended parameters via the logging system. The detected dimensions
  4137. correspond to the non-black area of the input video.
  4138. It accepts the following parameters:
  4139. @table @option
  4140. @item limit
  4141. Set higher black value threshold, which can be optionally specified
  4142. from nothing (0) to everything (255 for 8bit based formats). An intensity
  4143. value greater to the set value is considered non-black. It defaults to 24.
  4144. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4145. on the bitdepth of the pixel format.
  4146. @item round
  4147. The value which the width/height should be divisible by. It defaults to
  4148. 16. The offset is automatically adjusted to center the video. Use 2 to
  4149. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4150. encoding to most video codecs.
  4151. @item reset_count, reset
  4152. Set the counter that determines after how many frames cropdetect will
  4153. reset the previously detected largest video area and start over to
  4154. detect the current optimal crop area. Default value is 0.
  4155. This can be useful when channel logos distort the video area. 0
  4156. indicates 'never reset', and returns the largest area encountered during
  4157. playback.
  4158. @end table
  4159. @anchor{curves}
  4160. @section curves
  4161. Apply color adjustments using curves.
  4162. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4163. component (red, green and blue) has its values defined by @var{N} key points
  4164. tied from each other using a smooth curve. The x-axis represents the pixel
  4165. values from the input frame, and the y-axis the new pixel values to be set for
  4166. the output frame.
  4167. By default, a component curve is defined by the two points @var{(0;0)} and
  4168. @var{(1;1)}. This creates a straight line where each original pixel value is
  4169. "adjusted" to its own value, which means no change to the image.
  4170. The filter allows you to redefine these two points and add some more. A new
  4171. curve (using a natural cubic spline interpolation) will be define to pass
  4172. smoothly through all these new coordinates. The new defined points needs to be
  4173. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4174. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4175. the vector spaces, the values will be clipped accordingly.
  4176. If there is no key point defined in @code{x=0}, the filter will automatically
  4177. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  4178. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  4179. The filter accepts the following options:
  4180. @table @option
  4181. @item preset
  4182. Select one of the available color presets. This option can be used in addition
  4183. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4184. options takes priority on the preset values.
  4185. Available presets are:
  4186. @table @samp
  4187. @item none
  4188. @item color_negative
  4189. @item cross_process
  4190. @item darker
  4191. @item increase_contrast
  4192. @item lighter
  4193. @item linear_contrast
  4194. @item medium_contrast
  4195. @item negative
  4196. @item strong_contrast
  4197. @item vintage
  4198. @end table
  4199. Default is @code{none}.
  4200. @item master, m
  4201. Set the master key points. These points will define a second pass mapping. It
  4202. is sometimes called a "luminance" or "value" mapping. It can be used with
  4203. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4204. post-processing LUT.
  4205. @item red, r
  4206. Set the key points for the red component.
  4207. @item green, g
  4208. Set the key points for the green component.
  4209. @item blue, b
  4210. Set the key points for the blue component.
  4211. @item all
  4212. Set the key points for all components (not including master).
  4213. Can be used in addition to the other key points component
  4214. options. In this case, the unset component(s) will fallback on this
  4215. @option{all} setting.
  4216. @item psfile
  4217. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4218. @end table
  4219. To avoid some filtergraph syntax conflicts, each key points list need to be
  4220. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4221. @subsection Examples
  4222. @itemize
  4223. @item
  4224. Increase slightly the middle level of blue:
  4225. @example
  4226. curves=blue='0.5/0.58'
  4227. @end example
  4228. @item
  4229. Vintage effect:
  4230. @example
  4231. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  4232. @end example
  4233. Here we obtain the following coordinates for each components:
  4234. @table @var
  4235. @item red
  4236. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4237. @item green
  4238. @code{(0;0) (0.50;0.48) (1;1)}
  4239. @item blue
  4240. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4241. @end table
  4242. @item
  4243. The previous example can also be achieved with the associated built-in preset:
  4244. @example
  4245. curves=preset=vintage
  4246. @end example
  4247. @item
  4248. Or simply:
  4249. @example
  4250. curves=vintage
  4251. @end example
  4252. @item
  4253. Use a Photoshop preset and redefine the points of the green component:
  4254. @example
  4255. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  4256. @end example
  4257. @end itemize
  4258. @section datascope
  4259. Video data analysis filter.
  4260. This filter shows hexadecimal pixel values of part of video.
  4261. The filter accepts the following options:
  4262. @table @option
  4263. @item size, s
  4264. Set output video size.
  4265. @item x
  4266. Set x offset from where to pick pixels.
  4267. @item y
  4268. Set y offset from where to pick pixels.
  4269. @item mode
  4270. Set scope mode, can be one of the following:
  4271. @table @samp
  4272. @item mono
  4273. Draw hexadecimal pixel values with white color on black background.
  4274. @item color
  4275. Draw hexadecimal pixel values with input video pixel color on black
  4276. background.
  4277. @item color2
  4278. Draw hexadecimal pixel values on color background picked from input video,
  4279. the text color is picked in such way so its always visible.
  4280. @end table
  4281. @item axis
  4282. Draw rows and columns numbers on left and top of video.
  4283. @end table
  4284. @section dctdnoiz
  4285. Denoise frames using 2D DCT (frequency domain filtering).
  4286. This filter is not designed for real time.
  4287. The filter accepts the following options:
  4288. @table @option
  4289. @item sigma, s
  4290. Set the noise sigma constant.
  4291. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4292. coefficient (absolute value) below this threshold with be dropped.
  4293. If you need a more advanced filtering, see @option{expr}.
  4294. Default is @code{0}.
  4295. @item overlap
  4296. Set number overlapping pixels for each block. Since the filter can be slow, you
  4297. may want to reduce this value, at the cost of a less effective filter and the
  4298. risk of various artefacts.
  4299. If the overlapping value doesn't permit processing the whole input width or
  4300. height, a warning will be displayed and according borders won't be denoised.
  4301. Default value is @var{blocksize}-1, which is the best possible setting.
  4302. @item expr, e
  4303. Set the coefficient factor expression.
  4304. For each coefficient of a DCT block, this expression will be evaluated as a
  4305. multiplier value for the coefficient.
  4306. If this is option is set, the @option{sigma} option will be ignored.
  4307. The absolute value of the coefficient can be accessed through the @var{c}
  4308. variable.
  4309. @item n
  4310. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4311. @var{blocksize}, which is the width and height of the processed blocks.
  4312. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4313. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4314. on the speed processing. Also, a larger block size does not necessarily means a
  4315. better de-noising.
  4316. @end table
  4317. @subsection Examples
  4318. Apply a denoise with a @option{sigma} of @code{4.5}:
  4319. @example
  4320. dctdnoiz=4.5
  4321. @end example
  4322. The same operation can be achieved using the expression system:
  4323. @example
  4324. dctdnoiz=e='gte(c, 4.5*3)'
  4325. @end example
  4326. Violent denoise using a block size of @code{16x16}:
  4327. @example
  4328. dctdnoiz=15:n=4
  4329. @end example
  4330. @section deband
  4331. Remove banding artifacts from input video.
  4332. It works by replacing banded pixels with average value of referenced pixels.
  4333. The filter accepts the following options:
  4334. @table @option
  4335. @item 1thr
  4336. @item 2thr
  4337. @item 3thr
  4338. @item 4thr
  4339. Set banding detection threshold for each plane. Default is 0.02.
  4340. Valid range is 0.00003 to 0.5.
  4341. If difference between current pixel and reference pixel is less than threshold,
  4342. it will be considered as banded.
  4343. @item range, r
  4344. Banding detection range in pixels. Default is 16. If positive, random number
  4345. in range 0 to set value will be used. If negative, exact absolute value
  4346. will be used.
  4347. The range defines square of four pixels around current pixel.
  4348. @item direction, d
  4349. Set direction in radians from which four pixel will be compared. If positive,
  4350. random direction from 0 to set direction will be picked. If negative, exact of
  4351. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4352. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4353. column.
  4354. @item blur
  4355. If enabled, current pixel is compared with average value of all four
  4356. surrounding pixels. The default is enabled. If disabled current pixel is
  4357. compared with all four surrounding pixels. The pixel is considered banded
  4358. if only all four differences with surrounding pixels are less than threshold.
  4359. @end table
  4360. @anchor{decimate}
  4361. @section decimate
  4362. Drop duplicated frames at regular intervals.
  4363. The filter accepts the following options:
  4364. @table @option
  4365. @item cycle
  4366. Set the number of frames from which one will be dropped. Setting this to
  4367. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4368. Default is @code{5}.
  4369. @item dupthresh
  4370. Set the threshold for duplicate detection. If the difference metric for a frame
  4371. is less than or equal to this value, then it is declared as duplicate. Default
  4372. is @code{1.1}
  4373. @item scthresh
  4374. Set scene change threshold. Default is @code{15}.
  4375. @item blockx
  4376. @item blocky
  4377. Set the size of the x and y-axis blocks used during metric calculations.
  4378. Larger blocks give better noise suppression, but also give worse detection of
  4379. small movements. Must be a power of two. Default is @code{32}.
  4380. @item ppsrc
  4381. Mark main input as a pre-processed input and activate clean source input
  4382. stream. This allows the input to be pre-processed with various filters to help
  4383. the metrics calculation while keeping the frame selection lossless. When set to
  4384. @code{1}, the first stream is for the pre-processed input, and the second
  4385. stream is the clean source from where the kept frames are chosen. Default is
  4386. @code{0}.
  4387. @item chroma
  4388. Set whether or not chroma is considered in the metric calculations. Default is
  4389. @code{1}.
  4390. @end table
  4391. @section deflate
  4392. Apply deflate effect to the video.
  4393. This filter replaces the pixel by the local(3x3) average by taking into account
  4394. only values lower than the pixel.
  4395. It accepts the following options:
  4396. @table @option
  4397. @item threshold0
  4398. @item threshold1
  4399. @item threshold2
  4400. @item threshold3
  4401. Limit the maximum change for each plane, default is 65535.
  4402. If 0, plane will remain unchanged.
  4403. @end table
  4404. @section dejudder
  4405. Remove judder produced by partially interlaced telecined content.
  4406. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4407. source was partially telecined content then the output of @code{pullup,dejudder}
  4408. will have a variable frame rate. May change the recorded frame rate of the
  4409. container. Aside from that change, this filter will not affect constant frame
  4410. rate video.
  4411. The option available in this filter is:
  4412. @table @option
  4413. @item cycle
  4414. Specify the length of the window over which the judder repeats.
  4415. Accepts any integer greater than 1. Useful values are:
  4416. @table @samp
  4417. @item 4
  4418. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4419. @item 5
  4420. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4421. @item 20
  4422. If a mixture of the two.
  4423. @end table
  4424. The default is @samp{4}.
  4425. @end table
  4426. @section delogo
  4427. Suppress a TV station logo by a simple interpolation of the surrounding
  4428. pixels. Just set a rectangle covering the logo and watch it disappear
  4429. (and sometimes something even uglier appear - your mileage may vary).
  4430. It accepts the following parameters:
  4431. @table @option
  4432. @item x
  4433. @item y
  4434. Specify the top left corner coordinates of the logo. They must be
  4435. specified.
  4436. @item w
  4437. @item h
  4438. Specify the width and height of the logo to clear. They must be
  4439. specified.
  4440. @item band, t
  4441. Specify the thickness of the fuzzy edge of the rectangle (added to
  4442. @var{w} and @var{h}). The default value is 1. This option is
  4443. deprecated, setting higher values should no longer be necessary and
  4444. is not recommended.
  4445. @item show
  4446. When set to 1, a green rectangle is drawn on the screen to simplify
  4447. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4448. The default value is 0.
  4449. The rectangle is drawn on the outermost pixels which will be (partly)
  4450. replaced with interpolated values. The values of the next pixels
  4451. immediately outside this rectangle in each direction will be used to
  4452. compute the interpolated pixel values inside the rectangle.
  4453. @end table
  4454. @subsection Examples
  4455. @itemize
  4456. @item
  4457. Set a rectangle covering the area with top left corner coordinates 0,0
  4458. and size 100x77, and a band of size 10:
  4459. @example
  4460. delogo=x=0:y=0:w=100:h=77:band=10
  4461. @end example
  4462. @end itemize
  4463. @section deshake
  4464. Attempt to fix small changes in horizontal and/or vertical shift. This
  4465. filter helps remove camera shake from hand-holding a camera, bumping a
  4466. tripod, moving on a vehicle, etc.
  4467. The filter accepts the following options:
  4468. @table @option
  4469. @item x
  4470. @item y
  4471. @item w
  4472. @item h
  4473. Specify a rectangular area where to limit the search for motion
  4474. vectors.
  4475. If desired the search for motion vectors can be limited to a
  4476. rectangular area of the frame defined by its top left corner, width
  4477. and height. These parameters have the same meaning as the drawbox
  4478. filter which can be used to visualise the position of the bounding
  4479. box.
  4480. This is useful when simultaneous movement of subjects within the frame
  4481. might be confused for camera motion by the motion vector search.
  4482. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4483. then the full frame is used. This allows later options to be set
  4484. without specifying the bounding box for the motion vector search.
  4485. Default - search the whole frame.
  4486. @item rx
  4487. @item ry
  4488. Specify the maximum extent of movement in x and y directions in the
  4489. range 0-64 pixels. Default 16.
  4490. @item edge
  4491. Specify how to generate pixels to fill blanks at the edge of the
  4492. frame. Available values are:
  4493. @table @samp
  4494. @item blank, 0
  4495. Fill zeroes at blank locations
  4496. @item original, 1
  4497. Original image at blank locations
  4498. @item clamp, 2
  4499. Extruded edge value at blank locations
  4500. @item mirror, 3
  4501. Mirrored edge at blank locations
  4502. @end table
  4503. Default value is @samp{mirror}.
  4504. @item blocksize
  4505. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4506. default 8.
  4507. @item contrast
  4508. Specify the contrast threshold for blocks. Only blocks with more than
  4509. the specified contrast (difference between darkest and lightest
  4510. pixels) will be considered. Range 1-255, default 125.
  4511. @item search
  4512. Specify the search strategy. Available values are:
  4513. @table @samp
  4514. @item exhaustive, 0
  4515. Set exhaustive search
  4516. @item less, 1
  4517. Set less exhaustive search.
  4518. @end table
  4519. Default value is @samp{exhaustive}.
  4520. @item filename
  4521. If set then a detailed log of the motion search is written to the
  4522. specified file.
  4523. @item opencl
  4524. If set to 1, specify using OpenCL capabilities, only available if
  4525. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4526. @end table
  4527. @section detelecine
  4528. Apply an exact inverse of the telecine operation. It requires a predefined
  4529. pattern specified using the pattern option which must be the same as that passed
  4530. to the telecine filter.
  4531. This filter accepts the following options:
  4532. @table @option
  4533. @item first_field
  4534. @table @samp
  4535. @item top, t
  4536. top field first
  4537. @item bottom, b
  4538. bottom field first
  4539. The default value is @code{top}.
  4540. @end table
  4541. @item pattern
  4542. A string of numbers representing the pulldown pattern you wish to apply.
  4543. The default value is @code{23}.
  4544. @item start_frame
  4545. A number representing position of the first frame with respect to the telecine
  4546. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4547. @end table
  4548. @section dilation
  4549. Apply dilation effect to the video.
  4550. This filter replaces the pixel by the local(3x3) maximum.
  4551. It accepts the following options:
  4552. @table @option
  4553. @item threshold0
  4554. @item threshold1
  4555. @item threshold2
  4556. @item threshold3
  4557. Limit the maximum change for each plane, default is 65535.
  4558. If 0, plane will remain unchanged.
  4559. @item coordinates
  4560. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4561. pixels are used.
  4562. Flags to local 3x3 coordinates maps like this:
  4563. 1 2 3
  4564. 4 5
  4565. 6 7 8
  4566. @end table
  4567. @section displace
  4568. Displace pixels as indicated by second and third input stream.
  4569. It takes three input streams and outputs one stream, the first input is the
  4570. source, and second and third input are displacement maps.
  4571. The second input specifies how much to displace pixels along the
  4572. x-axis, while the third input specifies how much to displace pixels
  4573. along the y-axis.
  4574. If one of displacement map streams terminates, last frame from that
  4575. displacement map will be used.
  4576. Note that once generated, displacements maps can be reused over and over again.
  4577. A description of the accepted options follows.
  4578. @table @option
  4579. @item edge
  4580. Set displace behavior for pixels that are out of range.
  4581. Available values are:
  4582. @table @samp
  4583. @item blank
  4584. Missing pixels are replaced by black pixels.
  4585. @item smear
  4586. Adjacent pixels will spread out to replace missing pixels.
  4587. @item wrap
  4588. Out of range pixels are wrapped so they point to pixels of other side.
  4589. @end table
  4590. Default is @samp{smear}.
  4591. @end table
  4592. @subsection Examples
  4593. @itemize
  4594. @item
  4595. Add ripple effect to rgb input of video size hd720:
  4596. @example
  4597. 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
  4598. @end example
  4599. @item
  4600. Add wave effect to rgb input of video size hd720:
  4601. @example
  4602. 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
  4603. @end example
  4604. @end itemize
  4605. @section drawbox
  4606. Draw a colored box on the input image.
  4607. It accepts the following parameters:
  4608. @table @option
  4609. @item x
  4610. @item y
  4611. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4612. @item width, w
  4613. @item height, h
  4614. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4615. the input width and height. It defaults to 0.
  4616. @item color, c
  4617. Specify the color of the box to write. For the general syntax of this option,
  4618. check the "Color" section in the ffmpeg-utils manual. If the special
  4619. value @code{invert} is used, the box edge color is the same as the
  4620. video with inverted luma.
  4621. @item thickness, t
  4622. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4623. See below for the list of accepted constants.
  4624. @end table
  4625. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4626. following constants:
  4627. @table @option
  4628. @item dar
  4629. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4630. @item hsub
  4631. @item vsub
  4632. horizontal and vertical chroma subsample values. For example for the
  4633. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4634. @item in_h, ih
  4635. @item in_w, iw
  4636. The input width and height.
  4637. @item sar
  4638. The input sample aspect ratio.
  4639. @item x
  4640. @item y
  4641. The x and y offset coordinates where the box is drawn.
  4642. @item w
  4643. @item h
  4644. The width and height of the drawn box.
  4645. @item t
  4646. The thickness of the drawn box.
  4647. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4648. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4649. @end table
  4650. @subsection Examples
  4651. @itemize
  4652. @item
  4653. Draw a black box around the edge of the input image:
  4654. @example
  4655. drawbox
  4656. @end example
  4657. @item
  4658. Draw a box with color red and an opacity of 50%:
  4659. @example
  4660. drawbox=10:20:200:60:red@@0.5
  4661. @end example
  4662. The previous example can be specified as:
  4663. @example
  4664. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  4665. @end example
  4666. @item
  4667. Fill the box with pink color:
  4668. @example
  4669. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  4670. @end example
  4671. @item
  4672. Draw a 2-pixel red 2.40:1 mask:
  4673. @example
  4674. 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
  4675. @end example
  4676. @end itemize
  4677. @section drawgraph, adrawgraph
  4678. Draw a graph using input video or audio metadata.
  4679. It accepts the following parameters:
  4680. @table @option
  4681. @item m1
  4682. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  4683. @item fg1
  4684. Set 1st foreground color expression.
  4685. @item m2
  4686. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  4687. @item fg2
  4688. Set 2nd foreground color expression.
  4689. @item m3
  4690. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  4691. @item fg3
  4692. Set 3rd foreground color expression.
  4693. @item m4
  4694. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  4695. @item fg4
  4696. Set 4th foreground color expression.
  4697. @item min
  4698. Set minimal value of metadata value.
  4699. @item max
  4700. Set maximal value of metadata value.
  4701. @item bg
  4702. Set graph background color. Default is white.
  4703. @item mode
  4704. Set graph mode.
  4705. Available values for mode is:
  4706. @table @samp
  4707. @item bar
  4708. @item dot
  4709. @item line
  4710. @end table
  4711. Default is @code{line}.
  4712. @item slide
  4713. Set slide mode.
  4714. Available values for slide is:
  4715. @table @samp
  4716. @item frame
  4717. Draw new frame when right border is reached.
  4718. @item replace
  4719. Replace old columns with new ones.
  4720. @item scroll
  4721. Scroll from right to left.
  4722. @item rscroll
  4723. Scroll from left to right.
  4724. @end table
  4725. Default is @code{frame}.
  4726. @item size
  4727. Set size of graph video. For the syntax of this option, check the
  4728. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  4729. The default value is @code{900x256}.
  4730. The foreground color expressions can use the following variables:
  4731. @table @option
  4732. @item MIN
  4733. Minimal value of metadata value.
  4734. @item MAX
  4735. Maximal value of metadata value.
  4736. @item VAL
  4737. Current metadata key value.
  4738. @end table
  4739. The color is defined as 0xAABBGGRR.
  4740. @end table
  4741. Example using metadata from @ref{signalstats} filter:
  4742. @example
  4743. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  4744. @end example
  4745. Example using metadata from @ref{ebur128} filter:
  4746. @example
  4747. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  4748. @end example
  4749. @section drawgrid
  4750. Draw a grid on the input image.
  4751. It accepts the following parameters:
  4752. @table @option
  4753. @item x
  4754. @item y
  4755. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  4756. @item width, w
  4757. @item height, h
  4758. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  4759. input width and height, respectively, minus @code{thickness}, so image gets
  4760. framed. Default to 0.
  4761. @item color, c
  4762. Specify the color of the grid. For the general syntax of this option,
  4763. check the "Color" section in the ffmpeg-utils manual. If the special
  4764. value @code{invert} is used, the grid color is the same as the
  4765. video with inverted luma.
  4766. @item thickness, t
  4767. The expression which sets the thickness of the grid line. Default value is @code{1}.
  4768. See below for the list of accepted constants.
  4769. @end table
  4770. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4771. following constants:
  4772. @table @option
  4773. @item dar
  4774. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4775. @item hsub
  4776. @item vsub
  4777. horizontal and vertical chroma subsample values. For example for the
  4778. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4779. @item in_h, ih
  4780. @item in_w, iw
  4781. The input grid cell width and height.
  4782. @item sar
  4783. The input sample aspect ratio.
  4784. @item x
  4785. @item y
  4786. The x and y coordinates of some point of grid intersection (meant to configure offset).
  4787. @item w
  4788. @item h
  4789. The width and height of the drawn cell.
  4790. @item t
  4791. The thickness of the drawn cell.
  4792. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4793. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4794. @end table
  4795. @subsection Examples
  4796. @itemize
  4797. @item
  4798. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  4799. @example
  4800. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  4801. @end example
  4802. @item
  4803. Draw a white 3x3 grid with an opacity of 50%:
  4804. @example
  4805. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  4806. @end example
  4807. @end itemize
  4808. @anchor{drawtext}
  4809. @section drawtext
  4810. Draw a text string or text from a specified file on top of a video, using the
  4811. libfreetype library.
  4812. To enable compilation of this filter, you need to configure FFmpeg with
  4813. @code{--enable-libfreetype}.
  4814. To enable default font fallback and the @var{font} option you need to
  4815. configure FFmpeg with @code{--enable-libfontconfig}.
  4816. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  4817. @code{--enable-libfribidi}.
  4818. @subsection Syntax
  4819. It accepts the following parameters:
  4820. @table @option
  4821. @item box
  4822. Used to draw a box around text using the background color.
  4823. The value must be either 1 (enable) or 0 (disable).
  4824. The default value of @var{box} is 0.
  4825. @item boxborderw
  4826. Set the width of the border to be drawn around the box using @var{boxcolor}.
  4827. The default value of @var{boxborderw} is 0.
  4828. @item boxcolor
  4829. The color to be used for drawing box around text. For the syntax of this
  4830. option, check the "Color" section in the ffmpeg-utils manual.
  4831. The default value of @var{boxcolor} is "white".
  4832. @item borderw
  4833. Set the width of the border to be drawn around the text using @var{bordercolor}.
  4834. The default value of @var{borderw} is 0.
  4835. @item bordercolor
  4836. Set the color to be used for drawing border around text. For the syntax of this
  4837. option, check the "Color" section in the ffmpeg-utils manual.
  4838. The default value of @var{bordercolor} is "black".
  4839. @item expansion
  4840. Select how the @var{text} is expanded. Can be either @code{none},
  4841. @code{strftime} (deprecated) or
  4842. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  4843. below for details.
  4844. @item fix_bounds
  4845. If true, check and fix text coords to avoid clipping.
  4846. @item fontcolor
  4847. The color to be used for drawing fonts. For the syntax of this option, check
  4848. the "Color" section in the ffmpeg-utils manual.
  4849. The default value of @var{fontcolor} is "black".
  4850. @item fontcolor_expr
  4851. String which is expanded the same way as @var{text} to obtain dynamic
  4852. @var{fontcolor} value. By default this option has empty value and is not
  4853. processed. When this option is set, it overrides @var{fontcolor} option.
  4854. @item font
  4855. The font family to be used for drawing text. By default Sans.
  4856. @item fontfile
  4857. The font file to be used for drawing text. The path must be included.
  4858. This parameter is mandatory if the fontconfig support is disabled.
  4859. @item draw
  4860. This option does not exist, please see the timeline system
  4861. @item alpha
  4862. Draw the text applying alpha blending. The value can
  4863. be either a number between 0.0 and 1.0
  4864. The expression accepts the same variables @var{x, y} do.
  4865. The default value is 1.
  4866. Please see fontcolor_expr
  4867. @item fontsize
  4868. The font size to be used for drawing text.
  4869. The default value of @var{fontsize} is 16.
  4870. @item text_shaping
  4871. If set to 1, attempt to shape the text (for example, reverse the order of
  4872. right-to-left text and join Arabic characters) before drawing it.
  4873. Otherwise, just draw the text exactly as given.
  4874. By default 1 (if supported).
  4875. @item ft_load_flags
  4876. The flags to be used for loading the fonts.
  4877. The flags map the corresponding flags supported by libfreetype, and are
  4878. a combination of the following values:
  4879. @table @var
  4880. @item default
  4881. @item no_scale
  4882. @item no_hinting
  4883. @item render
  4884. @item no_bitmap
  4885. @item vertical_layout
  4886. @item force_autohint
  4887. @item crop_bitmap
  4888. @item pedantic
  4889. @item ignore_global_advance_width
  4890. @item no_recurse
  4891. @item ignore_transform
  4892. @item monochrome
  4893. @item linear_design
  4894. @item no_autohint
  4895. @end table
  4896. Default value is "default".
  4897. For more information consult the documentation for the FT_LOAD_*
  4898. libfreetype flags.
  4899. @item shadowcolor
  4900. The color to be used for drawing a shadow behind the drawn text. For the
  4901. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  4902. The default value of @var{shadowcolor} is "black".
  4903. @item shadowx
  4904. @item shadowy
  4905. The x and y offsets for the text shadow position with respect to the
  4906. position of the text. They can be either positive or negative
  4907. values. The default value for both is "0".
  4908. @item start_number
  4909. The starting frame number for the n/frame_num variable. The default value
  4910. is "0".
  4911. @item tabsize
  4912. The size in number of spaces to use for rendering the tab.
  4913. Default value is 4.
  4914. @item timecode
  4915. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  4916. format. It can be used with or without text parameter. @var{timecode_rate}
  4917. option must be specified.
  4918. @item timecode_rate, rate, r
  4919. Set the timecode frame rate (timecode only).
  4920. @item text
  4921. The text string to be drawn. The text must be a sequence of UTF-8
  4922. encoded characters.
  4923. This parameter is mandatory if no file is specified with the parameter
  4924. @var{textfile}.
  4925. @item textfile
  4926. A text file containing text to be drawn. The text must be a sequence
  4927. of UTF-8 encoded characters.
  4928. This parameter is mandatory if no text string is specified with the
  4929. parameter @var{text}.
  4930. If both @var{text} and @var{textfile} are specified, an error is thrown.
  4931. @item reload
  4932. If set to 1, the @var{textfile} will be reloaded before each frame.
  4933. Be sure to update it atomically, or it may be read partially, or even fail.
  4934. @item x
  4935. @item y
  4936. The expressions which specify the offsets where text will be drawn
  4937. within the video frame. They are relative to the top/left border of the
  4938. output image.
  4939. The default value of @var{x} and @var{y} is "0".
  4940. See below for the list of accepted constants and functions.
  4941. @end table
  4942. The parameters for @var{x} and @var{y} are expressions containing the
  4943. following constants and functions:
  4944. @table @option
  4945. @item dar
  4946. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  4947. @item hsub
  4948. @item vsub
  4949. horizontal and vertical chroma subsample values. For example for the
  4950. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4951. @item line_h, lh
  4952. the height of each text line
  4953. @item main_h, h, H
  4954. the input height
  4955. @item main_w, w, W
  4956. the input width
  4957. @item max_glyph_a, ascent
  4958. the maximum distance from the baseline to the highest/upper grid
  4959. coordinate used to place a glyph outline point, for all the rendered
  4960. glyphs.
  4961. It is a positive value, due to the grid's orientation with the Y axis
  4962. upwards.
  4963. @item max_glyph_d, descent
  4964. the maximum distance from the baseline to the lowest grid coordinate
  4965. used to place a glyph outline point, for all the rendered glyphs.
  4966. This is a negative value, due to the grid's orientation, with the Y axis
  4967. upwards.
  4968. @item max_glyph_h
  4969. maximum glyph height, that is the maximum height for all the glyphs
  4970. contained in the rendered text, it is equivalent to @var{ascent} -
  4971. @var{descent}.
  4972. @item max_glyph_w
  4973. maximum glyph width, that is the maximum width for all the glyphs
  4974. contained in the rendered text
  4975. @item n
  4976. the number of input frame, starting from 0
  4977. @item rand(min, max)
  4978. return a random number included between @var{min} and @var{max}
  4979. @item sar
  4980. The input sample aspect ratio.
  4981. @item t
  4982. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4983. @item text_h, th
  4984. the height of the rendered text
  4985. @item text_w, tw
  4986. the width of the rendered text
  4987. @item x
  4988. @item y
  4989. the x and y offset coordinates where the text is drawn.
  4990. These parameters allow the @var{x} and @var{y} expressions to refer
  4991. each other, so you can for example specify @code{y=x/dar}.
  4992. @end table
  4993. @anchor{drawtext_expansion}
  4994. @subsection Text expansion
  4995. If @option{expansion} is set to @code{strftime},
  4996. the filter recognizes strftime() sequences in the provided text and
  4997. expands them accordingly. Check the documentation of strftime(). This
  4998. feature is deprecated.
  4999. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5000. If @option{expansion} is set to @code{normal} (which is the default),
  5001. the following expansion mechanism is used.
  5002. The backslash character @samp{\}, followed by any character, always expands to
  5003. the second character.
  5004. Sequence of the form @code{%@{...@}} are expanded. The text between the
  5005. braces is a function name, possibly followed by arguments separated by ':'.
  5006. If the arguments contain special characters or delimiters (':' or '@}'),
  5007. they should be escaped.
  5008. Note that they probably must also be escaped as the value for the
  5009. @option{text} option in the filter argument string and as the filter
  5010. argument in the filtergraph description, and possibly also for the shell,
  5011. that makes up to four levels of escaping; using a text file avoids these
  5012. problems.
  5013. The following functions are available:
  5014. @table @command
  5015. @item expr, e
  5016. The expression evaluation result.
  5017. It must take one argument specifying the expression to be evaluated,
  5018. which accepts the same constants and functions as the @var{x} and
  5019. @var{y} values. Note that not all constants should be used, for
  5020. example the text size is not known when evaluating the expression, so
  5021. the constants @var{text_w} and @var{text_h} will have an undefined
  5022. value.
  5023. @item expr_int_format, eif
  5024. Evaluate the expression's value and output as formatted integer.
  5025. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5026. The second argument specifies the output format. Allowed values are @samp{x},
  5027. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5028. @code{printf} function.
  5029. The third parameter is optional and sets the number of positions taken by the output.
  5030. It can be used to add padding with zeros from the left.
  5031. @item gmtime
  5032. The time at which the filter is running, expressed in UTC.
  5033. It can accept an argument: a strftime() format string.
  5034. @item localtime
  5035. The time at which the filter is running, expressed in the local time zone.
  5036. It can accept an argument: a strftime() format string.
  5037. @item metadata
  5038. Frame metadata. It must take one argument specifying metadata key.
  5039. @item n, frame_num
  5040. The frame number, starting from 0.
  5041. @item pict_type
  5042. A 1 character description of the current picture type.
  5043. @item pts
  5044. The timestamp of the current frame.
  5045. It can take up to three arguments.
  5046. The first argument is the format of the timestamp; it defaults to @code{flt}
  5047. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5048. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5049. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5050. @code{localtime} stands for the timestamp of the frame formatted as
  5051. local time zone time.
  5052. The second argument is an offset added to the timestamp.
  5053. If the format is set to @code{localtime} or @code{gmtime},
  5054. a third argument may be supplied: a strftime() format string.
  5055. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5056. @end table
  5057. @subsection Examples
  5058. @itemize
  5059. @item
  5060. Draw "Test Text" with font FreeSerif, using the default values for the
  5061. optional parameters.
  5062. @example
  5063. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5064. @end example
  5065. @item
  5066. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5067. and y=50 (counting from the top-left corner of the screen), text is
  5068. yellow with a red box around it. Both the text and the box have an
  5069. opacity of 20%.
  5070. @example
  5071. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5072. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5073. @end example
  5074. Note that the double quotes are not necessary if spaces are not used
  5075. within the parameter list.
  5076. @item
  5077. Show the text at the center of the video frame:
  5078. @example
  5079. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5080. @end example
  5081. @item
  5082. Show the text at a random position, switching to a new position every 30 seconds:
  5083. @example
  5084. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=if(eq(mod(t\,30)\,0)\,rand(0\,(w-text_w))\,x):y=if(eq(mod(t\,30)\,0)\,rand(0\,(h-text_h))\,y)"
  5085. @end example
  5086. @item
  5087. Show a text line sliding from right to left in the last row of the video
  5088. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5089. with no newlines.
  5090. @example
  5091. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5092. @end example
  5093. @item
  5094. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5095. @example
  5096. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5097. @end example
  5098. @item
  5099. Draw a single green letter "g", at the center of the input video.
  5100. The glyph baseline is placed at half screen height.
  5101. @example
  5102. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5103. @end example
  5104. @item
  5105. Show text for 1 second every 3 seconds:
  5106. @example
  5107. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5108. @end example
  5109. @item
  5110. Use fontconfig to set the font. Note that the colons need to be escaped.
  5111. @example
  5112. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5113. @end example
  5114. @item
  5115. Print the date of a real-time encoding (see strftime(3)):
  5116. @example
  5117. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5118. @end example
  5119. @item
  5120. Show text fading in and out (appearing/disappearing):
  5121. @example
  5122. #!/bin/sh
  5123. DS=1.0 # display start
  5124. DE=10.0 # display end
  5125. FID=1.5 # fade in duration
  5126. FOD=5 # fade out duration
  5127. 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 @}"
  5128. @end example
  5129. @end itemize
  5130. For more information about libfreetype, check:
  5131. @url{http://www.freetype.org/}.
  5132. For more information about fontconfig, check:
  5133. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5134. For more information about libfribidi, check:
  5135. @url{http://fribidi.org/}.
  5136. @section edgedetect
  5137. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5138. The filter accepts the following options:
  5139. @table @option
  5140. @item low
  5141. @item high
  5142. Set low and high threshold values used by the Canny thresholding
  5143. algorithm.
  5144. The high threshold selects the "strong" edge pixels, which are then
  5145. connected through 8-connectivity with the "weak" edge pixels selected
  5146. by the low threshold.
  5147. @var{low} and @var{high} threshold values must be chosen in the range
  5148. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5149. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5150. is @code{50/255}.
  5151. @item mode
  5152. Define the drawing mode.
  5153. @table @samp
  5154. @item wires
  5155. Draw white/gray wires on black background.
  5156. @item colormix
  5157. Mix the colors to create a paint/cartoon effect.
  5158. @end table
  5159. Default value is @var{wires}.
  5160. @end table
  5161. @subsection Examples
  5162. @itemize
  5163. @item
  5164. Standard edge detection with custom values for the hysteresis thresholding:
  5165. @example
  5166. edgedetect=low=0.1:high=0.4
  5167. @end example
  5168. @item
  5169. Painting effect without thresholding:
  5170. @example
  5171. edgedetect=mode=colormix:high=0
  5172. @end example
  5173. @end itemize
  5174. @section eq
  5175. Set brightness, contrast, saturation and approximate gamma adjustment.
  5176. The filter accepts the following options:
  5177. @table @option
  5178. @item contrast
  5179. Set the contrast expression. The value must be a float value in range
  5180. @code{-2.0} to @code{2.0}. The default value is "1".
  5181. @item brightness
  5182. Set the brightness expression. The value must be a float value in
  5183. range @code{-1.0} to @code{1.0}. The default value is "0".
  5184. @item saturation
  5185. Set the saturation expression. The value must be a float in
  5186. range @code{0.0} to @code{3.0}. The default value is "1".
  5187. @item gamma
  5188. Set the gamma expression. The value must be a float in range
  5189. @code{0.1} to @code{10.0}. The default value is "1".
  5190. @item gamma_r
  5191. Set the gamma expression for red. The value must be a float in
  5192. range @code{0.1} to @code{10.0}. The default value is "1".
  5193. @item gamma_g
  5194. Set the gamma expression for green. The value must be a float in range
  5195. @code{0.1} to @code{10.0}. The default value is "1".
  5196. @item gamma_b
  5197. Set the gamma expression for blue. The value must be a float in range
  5198. @code{0.1} to @code{10.0}. The default value is "1".
  5199. @item gamma_weight
  5200. Set the gamma weight expression. It can be used to reduce the effect
  5201. of a high gamma value on bright image areas, e.g. keep them from
  5202. getting overamplified and just plain white. The value must be a float
  5203. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5204. gamma correction all the way down while @code{1.0} leaves it at its
  5205. full strength. Default is "1".
  5206. @item eval
  5207. Set when the expressions for brightness, contrast, saturation and
  5208. gamma expressions are evaluated.
  5209. It accepts the following values:
  5210. @table @samp
  5211. @item init
  5212. only evaluate expressions once during the filter initialization or
  5213. when a command is processed
  5214. @item frame
  5215. evaluate expressions for each incoming frame
  5216. @end table
  5217. Default value is @samp{init}.
  5218. @end table
  5219. The expressions accept the following parameters:
  5220. @table @option
  5221. @item n
  5222. frame count of the input frame starting from 0
  5223. @item pos
  5224. byte position of the corresponding packet in the input file, NAN if
  5225. unspecified
  5226. @item r
  5227. frame rate of the input video, NAN if the input frame rate is unknown
  5228. @item t
  5229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5230. @end table
  5231. @subsection Commands
  5232. The filter supports the following commands:
  5233. @table @option
  5234. @item contrast
  5235. Set the contrast expression.
  5236. @item brightness
  5237. Set the brightness expression.
  5238. @item saturation
  5239. Set the saturation expression.
  5240. @item gamma
  5241. Set the gamma expression.
  5242. @item gamma_r
  5243. Set the gamma_r expression.
  5244. @item gamma_g
  5245. Set gamma_g expression.
  5246. @item gamma_b
  5247. Set gamma_b expression.
  5248. @item gamma_weight
  5249. Set gamma_weight expression.
  5250. The command accepts the same syntax of the corresponding option.
  5251. If the specified expression is not valid, it is kept at its current
  5252. value.
  5253. @end table
  5254. @section erosion
  5255. Apply erosion effect to the video.
  5256. This filter replaces the pixel by the local(3x3) minimum.
  5257. It accepts the following options:
  5258. @table @option
  5259. @item threshold0
  5260. @item threshold1
  5261. @item threshold2
  5262. @item threshold3
  5263. Limit the maximum change for each plane, default is 65535.
  5264. If 0, plane will remain unchanged.
  5265. @item coordinates
  5266. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5267. pixels are used.
  5268. Flags to local 3x3 coordinates maps like this:
  5269. 1 2 3
  5270. 4 5
  5271. 6 7 8
  5272. @end table
  5273. @section extractplanes
  5274. Extract color channel components from input video stream into
  5275. separate grayscale video streams.
  5276. The filter accepts the following option:
  5277. @table @option
  5278. @item planes
  5279. Set plane(s) to extract.
  5280. Available values for planes are:
  5281. @table @samp
  5282. @item y
  5283. @item u
  5284. @item v
  5285. @item a
  5286. @item r
  5287. @item g
  5288. @item b
  5289. @end table
  5290. Choosing planes not available in the input will result in an error.
  5291. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5292. with @code{y}, @code{u}, @code{v} planes at same time.
  5293. @end table
  5294. @subsection Examples
  5295. @itemize
  5296. @item
  5297. Extract luma, u and v color channel component from input video frame
  5298. into 3 grayscale outputs:
  5299. @example
  5300. 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
  5301. @end example
  5302. @end itemize
  5303. @section elbg
  5304. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5305. For each input image, the filter will compute the optimal mapping from
  5306. the input to the output given the codebook length, that is the number
  5307. of distinct output colors.
  5308. This filter accepts the following options.
  5309. @table @option
  5310. @item codebook_length, l
  5311. Set codebook length. The value must be a positive integer, and
  5312. represents the number of distinct output colors. Default value is 256.
  5313. @item nb_steps, n
  5314. Set the maximum number of iterations to apply for computing the optimal
  5315. mapping. The higher the value the better the result and the higher the
  5316. computation time. Default value is 1.
  5317. @item seed, s
  5318. Set a random seed, must be an integer included between 0 and
  5319. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5320. will try to use a good random seed on a best effort basis.
  5321. @item pal8
  5322. Set pal8 output pixel format. This option does not work with codebook
  5323. length greater than 256.
  5324. @end table
  5325. @section fade
  5326. Apply a fade-in/out effect to the input video.
  5327. It accepts the following parameters:
  5328. @table @option
  5329. @item type, t
  5330. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5331. effect.
  5332. Default is @code{in}.
  5333. @item start_frame, s
  5334. Specify the number of the frame to start applying the fade
  5335. effect at. Default is 0.
  5336. @item nb_frames, n
  5337. The number of frames that the fade effect lasts. At the end of the
  5338. fade-in effect, the output video will have the same intensity as the input video.
  5339. At the end of the fade-out transition, the output video will be filled with the
  5340. selected @option{color}.
  5341. Default is 25.
  5342. @item alpha
  5343. If set to 1, fade only alpha channel, if one exists on the input.
  5344. Default value is 0.
  5345. @item start_time, st
  5346. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5347. effect. If both start_frame and start_time are specified, the fade will start at
  5348. whichever comes last. Default is 0.
  5349. @item duration, d
  5350. The number of seconds for which the fade effect has to last. At the end of the
  5351. fade-in effect the output video will have the same intensity as the input video,
  5352. at the end of the fade-out transition the output video will be filled with the
  5353. selected @option{color}.
  5354. If both duration and nb_frames are specified, duration is used. Default is 0
  5355. (nb_frames is used by default).
  5356. @item color, c
  5357. Specify the color of the fade. Default is "black".
  5358. @end table
  5359. @subsection Examples
  5360. @itemize
  5361. @item
  5362. Fade in the first 30 frames of video:
  5363. @example
  5364. fade=in:0:30
  5365. @end example
  5366. The command above is equivalent to:
  5367. @example
  5368. fade=t=in:s=0:n=30
  5369. @end example
  5370. @item
  5371. Fade out the last 45 frames of a 200-frame video:
  5372. @example
  5373. fade=out:155:45
  5374. fade=type=out:start_frame=155:nb_frames=45
  5375. @end example
  5376. @item
  5377. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5378. @example
  5379. fade=in:0:25, fade=out:975:25
  5380. @end example
  5381. @item
  5382. Make the first 5 frames yellow, then fade in from frame 5-24:
  5383. @example
  5384. fade=in:5:20:color=yellow
  5385. @end example
  5386. @item
  5387. Fade in alpha over first 25 frames of video:
  5388. @example
  5389. fade=in:0:25:alpha=1
  5390. @end example
  5391. @item
  5392. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5393. @example
  5394. fade=t=in:st=5.5:d=0.5
  5395. @end example
  5396. @end itemize
  5397. @section fftfilt
  5398. Apply arbitrary expressions to samples in frequency domain
  5399. @table @option
  5400. @item dc_Y
  5401. Adjust the dc value (gain) of the luma plane of the image. The filter
  5402. accepts an integer value in range @code{0} to @code{1000}. The default
  5403. value is set to @code{0}.
  5404. @item dc_U
  5405. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5406. filter accepts an integer value in range @code{0} to @code{1000}. The
  5407. default value is set to @code{0}.
  5408. @item dc_V
  5409. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5410. filter accepts an integer value in range @code{0} to @code{1000}. The
  5411. default value is set to @code{0}.
  5412. @item weight_Y
  5413. Set the frequency domain weight expression for the luma plane.
  5414. @item weight_U
  5415. Set the frequency domain weight expression for the 1st chroma plane.
  5416. @item weight_V
  5417. Set the frequency domain weight expression for the 2nd chroma plane.
  5418. The filter accepts the following variables:
  5419. @item X
  5420. @item Y
  5421. The coordinates of the current sample.
  5422. @item W
  5423. @item H
  5424. The width and height of the image.
  5425. @end table
  5426. @subsection Examples
  5427. @itemize
  5428. @item
  5429. High-pass:
  5430. @example
  5431. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5432. @end example
  5433. @item
  5434. Low-pass:
  5435. @example
  5436. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5437. @end example
  5438. @item
  5439. Sharpen:
  5440. @example
  5441. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5442. @end example
  5443. @item
  5444. Blur:
  5445. @example
  5446. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5447. @end example
  5448. @end itemize
  5449. @section field
  5450. Extract a single field from an interlaced image using stride
  5451. arithmetic to avoid wasting CPU time. The output frames are marked as
  5452. non-interlaced.
  5453. The filter accepts the following options:
  5454. @table @option
  5455. @item type
  5456. Specify whether to extract the top (if the value is @code{0} or
  5457. @code{top}) or the bottom field (if the value is @code{1} or
  5458. @code{bottom}).
  5459. @end table
  5460. @section fieldhint
  5461. Create new frames by copying the top and bottom fields from surrounding frames
  5462. supplied as numbers by the hint file.
  5463. @table @option
  5464. @item hint
  5465. Set file containing hints: absolute/relative frame numbers.
  5466. There must be one line for each frame in a clip. Each line must contain two
  5467. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5468. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5469. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5470. for @code{relative} mode. First number tells from which frame to pick up top
  5471. field and second number tells from which frame to pick up bottom field.
  5472. If optionally followed by @code{+} output frame will be marked as interlaced,
  5473. else if followed by @code{-} output frame will be marked as progressive, else
  5474. it will be marked same as input frame.
  5475. If line starts with @code{#} or @code{;} that line is skipped.
  5476. @item mode
  5477. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5478. @end table
  5479. Example of first several lines of @code{hint} file for @code{relative} mode:
  5480. @example
  5481. 0,0 - # first frame
  5482. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5483. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5484. 1,0 -
  5485. 0,0 -
  5486. 0,0 -
  5487. 1,0 -
  5488. 1,0 -
  5489. 1,0 -
  5490. 0,0 -
  5491. 0,0 -
  5492. 1,0 -
  5493. 1,0 -
  5494. 1,0 -
  5495. 0,0 -
  5496. @end example
  5497. @section fieldmatch
  5498. Field matching filter for inverse telecine. It is meant to reconstruct the
  5499. progressive frames from a telecined stream. The filter does not drop duplicated
  5500. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5501. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5502. The separation of the field matching and the decimation is notably motivated by
  5503. the possibility of inserting a de-interlacing filter fallback between the two.
  5504. If the source has mixed telecined and real interlaced content,
  5505. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5506. But these remaining combed frames will be marked as interlaced, and thus can be
  5507. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5508. In addition to the various configuration options, @code{fieldmatch} can take an
  5509. optional second stream, activated through the @option{ppsrc} option. If
  5510. enabled, the frames reconstruction will be based on the fields and frames from
  5511. this second stream. This allows the first input to be pre-processed in order to
  5512. help the various algorithms of the filter, while keeping the output lossless
  5513. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5514. or brightness/contrast adjustments can help.
  5515. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5516. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5517. which @code{fieldmatch} is based on. While the semantic and usage are very
  5518. close, some behaviour and options names can differ.
  5519. The @ref{decimate} filter currently only works for constant frame rate input.
  5520. If your input has mixed telecined (30fps) and progressive content with a lower
  5521. framerate like 24fps use the following filterchain to produce the necessary cfr
  5522. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5523. The filter accepts the following options:
  5524. @table @option
  5525. @item order
  5526. Specify the assumed field order of the input stream. Available values are:
  5527. @table @samp
  5528. @item auto
  5529. Auto detect parity (use FFmpeg's internal parity value).
  5530. @item bff
  5531. Assume bottom field first.
  5532. @item tff
  5533. Assume top field first.
  5534. @end table
  5535. Note that it is sometimes recommended not to trust the parity announced by the
  5536. stream.
  5537. Default value is @var{auto}.
  5538. @item mode
  5539. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5540. sense that it won't risk creating jerkiness due to duplicate frames when
  5541. possible, but if there are bad edits or blended fields it will end up
  5542. outputting combed frames when a good match might actually exist. On the other
  5543. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5544. but will almost always find a good frame if there is one. The other values are
  5545. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5546. jerkiness and creating duplicate frames versus finding good matches in sections
  5547. with bad edits, orphaned fields, blended fields, etc.
  5548. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5549. Available values are:
  5550. @table @samp
  5551. @item pc
  5552. 2-way matching (p/c)
  5553. @item pc_n
  5554. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5555. @item pc_u
  5556. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5557. @item pc_n_ub
  5558. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5559. still combed (p/c + n + u/b)
  5560. @item pcn
  5561. 3-way matching (p/c/n)
  5562. @item pcn_ub
  5563. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5564. detected as combed (p/c/n + u/b)
  5565. @end table
  5566. The parenthesis at the end indicate the matches that would be used for that
  5567. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5568. @var{top}).
  5569. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5570. the slowest.
  5571. Default value is @var{pc_n}.
  5572. @item ppsrc
  5573. Mark the main input stream as a pre-processed input, and enable the secondary
  5574. input stream as the clean source to pick the fields from. See the filter
  5575. introduction for more details. It is similar to the @option{clip2} feature from
  5576. VFM/TFM.
  5577. Default value is @code{0} (disabled).
  5578. @item field
  5579. Set the field to match from. It is recommended to set this to the same value as
  5580. @option{order} unless you experience matching failures with that setting. In
  5581. certain circumstances changing the field that is used to match from can have a
  5582. large impact on matching performance. Available values are:
  5583. @table @samp
  5584. @item auto
  5585. Automatic (same value as @option{order}).
  5586. @item bottom
  5587. Match from the bottom field.
  5588. @item top
  5589. Match from the top field.
  5590. @end table
  5591. Default value is @var{auto}.
  5592. @item mchroma
  5593. Set whether or not chroma is included during the match comparisons. In most
  5594. cases it is recommended to leave this enabled. You should set this to @code{0}
  5595. only if your clip has bad chroma problems such as heavy rainbowing or other
  5596. artifacts. Setting this to @code{0} could also be used to speed things up at
  5597. the cost of some accuracy.
  5598. Default value is @code{1}.
  5599. @item y0
  5600. @item y1
  5601. These define an exclusion band which excludes the lines between @option{y0} and
  5602. @option{y1} from being included in the field matching decision. An exclusion
  5603. band can be used to ignore subtitles, a logo, or other things that may
  5604. interfere with the matching. @option{y0} sets the starting scan line and
  5605. @option{y1} sets the ending line; all lines in between @option{y0} and
  5606. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5607. @option{y0} and @option{y1} to the same value will disable the feature.
  5608. @option{y0} and @option{y1} defaults to @code{0}.
  5609. @item scthresh
  5610. Set the scene change detection threshold as a percentage of maximum change on
  5611. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5612. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5613. @option{scthresh} is @code{[0.0, 100.0]}.
  5614. Default value is @code{12.0}.
  5615. @item combmatch
  5616. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5617. account the combed scores of matches when deciding what match to use as the
  5618. final match. Available values are:
  5619. @table @samp
  5620. @item none
  5621. No final matching based on combed scores.
  5622. @item sc
  5623. Combed scores are only used when a scene change is detected.
  5624. @item full
  5625. Use combed scores all the time.
  5626. @end table
  5627. Default is @var{sc}.
  5628. @item combdbg
  5629. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5630. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5631. Available values are:
  5632. @table @samp
  5633. @item none
  5634. No forced calculation.
  5635. @item pcn
  5636. Force p/c/n calculations.
  5637. @item pcnub
  5638. Force p/c/n/u/b calculations.
  5639. @end table
  5640. Default value is @var{none}.
  5641. @item cthresh
  5642. This is the area combing threshold used for combed frame detection. This
  5643. essentially controls how "strong" or "visible" combing must be to be detected.
  5644. Larger values mean combing must be more visible and smaller values mean combing
  5645. can be less visible or strong and still be detected. Valid settings are from
  5646. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5647. be detected as combed). This is basically a pixel difference value. A good
  5648. range is @code{[8, 12]}.
  5649. Default value is @code{9}.
  5650. @item chroma
  5651. Sets whether or not chroma is considered in the combed frame decision. Only
  5652. disable this if your source has chroma problems (rainbowing, etc.) that are
  5653. causing problems for the combed frame detection with chroma enabled. Actually,
  5654. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5655. where there is chroma only combing in the source.
  5656. Default value is @code{0}.
  5657. @item blockx
  5658. @item blocky
  5659. Respectively set the x-axis and y-axis size of the window used during combed
  5660. frame detection. This has to do with the size of the area in which
  5661. @option{combpel} pixels are required to be detected as combed for a frame to be
  5662. declared combed. See the @option{combpel} parameter description for more info.
  5663. Possible values are any number that is a power of 2 starting at 4 and going up
  5664. to 512.
  5665. Default value is @code{16}.
  5666. @item combpel
  5667. The number of combed pixels inside any of the @option{blocky} by
  5668. @option{blockx} size blocks on the frame for the frame to be detected as
  5669. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5670. setting controls "how much" combing there must be in any localized area (a
  5671. window defined by the @option{blockx} and @option{blocky} settings) on the
  5672. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5673. which point no frames will ever be detected as combed). This setting is known
  5674. as @option{MI} in TFM/VFM vocabulary.
  5675. Default value is @code{80}.
  5676. @end table
  5677. @anchor{p/c/n/u/b meaning}
  5678. @subsection p/c/n/u/b meaning
  5679. @subsubsection p/c/n
  5680. We assume the following telecined stream:
  5681. @example
  5682. Top fields: 1 2 2 3 4
  5683. Bottom fields: 1 2 3 4 4
  5684. @end example
  5685. The numbers correspond to the progressive frame the fields relate to. Here, the
  5686. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5687. When @code{fieldmatch} is configured to run a matching from bottom
  5688. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5689. @example
  5690. Input stream:
  5691. T 1 2 2 3 4
  5692. B 1 2 3 4 4 <-- matching reference
  5693. Matches: c c n n c
  5694. Output stream:
  5695. T 1 2 3 4 4
  5696. B 1 2 3 4 4
  5697. @end example
  5698. As a result of the field matching, we can see that some frames get duplicated.
  5699. To perform a complete inverse telecine, you need to rely on a decimation filter
  5700. after this operation. See for instance the @ref{decimate} filter.
  5701. The same operation now matching from top fields (@option{field}=@var{top})
  5702. looks like this:
  5703. @example
  5704. Input stream:
  5705. T 1 2 2 3 4 <-- matching reference
  5706. B 1 2 3 4 4
  5707. Matches: c c p p c
  5708. Output stream:
  5709. T 1 2 2 3 4
  5710. B 1 2 2 3 4
  5711. @end example
  5712. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5713. basically, they refer to the frame and field of the opposite parity:
  5714. @itemize
  5715. @item @var{p} matches the field of the opposite parity in the previous frame
  5716. @item @var{c} matches the field of the opposite parity in the current frame
  5717. @item @var{n} matches the field of the opposite parity in the next frame
  5718. @end itemize
  5719. @subsubsection u/b
  5720. The @var{u} and @var{b} matching are a bit special in the sense that they match
  5721. from the opposite parity flag. In the following examples, we assume that we are
  5722. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  5723. 'x' is placed above and below each matched fields.
  5724. With bottom matching (@option{field}=@var{bottom}):
  5725. @example
  5726. Match: c p n b u
  5727. x x x x x
  5728. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5729. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5730. x x x x x
  5731. Output frames:
  5732. 2 1 2 2 2
  5733. 2 2 2 1 3
  5734. @end example
  5735. With top matching (@option{field}=@var{top}):
  5736. @example
  5737. Match: c p n b u
  5738. x x x x x
  5739. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5740. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5741. x x x x x
  5742. Output frames:
  5743. 2 2 2 1 2
  5744. 2 1 3 2 2
  5745. @end example
  5746. @subsection Examples
  5747. Simple IVTC of a top field first telecined stream:
  5748. @example
  5749. fieldmatch=order=tff:combmatch=none, decimate
  5750. @end example
  5751. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  5752. @example
  5753. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  5754. @end example
  5755. @section fieldorder
  5756. Transform the field order of the input video.
  5757. It accepts the following parameters:
  5758. @table @option
  5759. @item order
  5760. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  5761. for bottom field first.
  5762. @end table
  5763. The default value is @samp{tff}.
  5764. The transformation is done by shifting the picture content up or down
  5765. by one line, and filling the remaining line with appropriate picture content.
  5766. This method is consistent with most broadcast field order converters.
  5767. If the input video is not flagged as being interlaced, or it is already
  5768. flagged as being of the required output field order, then this filter does
  5769. not alter the incoming video.
  5770. It is very useful when converting to or from PAL DV material,
  5771. which is bottom field first.
  5772. For example:
  5773. @example
  5774. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  5775. @end example
  5776. @section fifo, afifo
  5777. Buffer input images and send them when they are requested.
  5778. It is mainly useful when auto-inserted by the libavfilter
  5779. framework.
  5780. It does not take parameters.
  5781. @section find_rect
  5782. Find a rectangular object
  5783. It accepts the following options:
  5784. @table @option
  5785. @item object
  5786. Filepath of the object image, needs to be in gray8.
  5787. @item threshold
  5788. Detection threshold, default is 0.5.
  5789. @item mipmaps
  5790. Number of mipmaps, default is 3.
  5791. @item xmin, ymin, xmax, ymax
  5792. Specifies the rectangle in which to search.
  5793. @end table
  5794. @subsection Examples
  5795. @itemize
  5796. @item
  5797. Generate a representative palette of a given video using @command{ffmpeg}:
  5798. @example
  5799. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5800. @end example
  5801. @end itemize
  5802. @section cover_rect
  5803. Cover a rectangular object
  5804. It accepts the following options:
  5805. @table @option
  5806. @item cover
  5807. Filepath of the optional cover image, needs to be in yuv420.
  5808. @item mode
  5809. Set covering mode.
  5810. It accepts the following values:
  5811. @table @samp
  5812. @item cover
  5813. cover it by the supplied image
  5814. @item blur
  5815. cover it by interpolating the surrounding pixels
  5816. @end table
  5817. Default value is @var{blur}.
  5818. @end table
  5819. @subsection Examples
  5820. @itemize
  5821. @item
  5822. Generate a representative palette of a given video using @command{ffmpeg}:
  5823. @example
  5824. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5825. @end example
  5826. @end itemize
  5827. @anchor{format}
  5828. @section format
  5829. Convert the input video to one of the specified pixel formats.
  5830. Libavfilter will try to pick one that is suitable as input to
  5831. the next filter.
  5832. It accepts the following parameters:
  5833. @table @option
  5834. @item pix_fmts
  5835. A '|'-separated list of pixel format names, such as
  5836. "pix_fmts=yuv420p|monow|rgb24".
  5837. @end table
  5838. @subsection Examples
  5839. @itemize
  5840. @item
  5841. Convert the input video to the @var{yuv420p} format
  5842. @example
  5843. format=pix_fmts=yuv420p
  5844. @end example
  5845. Convert the input video to any of the formats in the list
  5846. @example
  5847. format=pix_fmts=yuv420p|yuv444p|yuv410p
  5848. @end example
  5849. @end itemize
  5850. @anchor{fps}
  5851. @section fps
  5852. Convert the video to specified constant frame rate by duplicating or dropping
  5853. frames as necessary.
  5854. It accepts the following parameters:
  5855. @table @option
  5856. @item fps
  5857. The desired output frame rate. The default is @code{25}.
  5858. @item round
  5859. Rounding method.
  5860. Possible values are:
  5861. @table @option
  5862. @item zero
  5863. zero round towards 0
  5864. @item inf
  5865. round away from 0
  5866. @item down
  5867. round towards -infinity
  5868. @item up
  5869. round towards +infinity
  5870. @item near
  5871. round to nearest
  5872. @end table
  5873. The default is @code{near}.
  5874. @item start_time
  5875. Assume the first PTS should be the given value, in seconds. This allows for
  5876. padding/trimming at the start of stream. By default, no assumption is made
  5877. about the first frame's expected PTS, so no padding or trimming is done.
  5878. For example, this could be set to 0 to pad the beginning with duplicates of
  5879. the first frame if a video stream starts after the audio stream or to trim any
  5880. frames with a negative PTS.
  5881. @end table
  5882. Alternatively, the options can be specified as a flat string:
  5883. @var{fps}[:@var{round}].
  5884. See also the @ref{setpts} filter.
  5885. @subsection Examples
  5886. @itemize
  5887. @item
  5888. A typical usage in order to set the fps to 25:
  5889. @example
  5890. fps=fps=25
  5891. @end example
  5892. @item
  5893. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  5894. @example
  5895. fps=fps=film:round=near
  5896. @end example
  5897. @end itemize
  5898. @section framepack
  5899. Pack two different video streams into a stereoscopic video, setting proper
  5900. metadata on supported codecs. The two views should have the same size and
  5901. framerate and processing will stop when the shorter video ends. Please note
  5902. that you may conveniently adjust view properties with the @ref{scale} and
  5903. @ref{fps} filters.
  5904. It accepts the following parameters:
  5905. @table @option
  5906. @item format
  5907. The desired packing format. Supported values are:
  5908. @table @option
  5909. @item sbs
  5910. The views are next to each other (default).
  5911. @item tab
  5912. The views are on top of each other.
  5913. @item lines
  5914. The views are packed by line.
  5915. @item columns
  5916. The views are packed by column.
  5917. @item frameseq
  5918. The views are temporally interleaved.
  5919. @end table
  5920. @end table
  5921. Some examples:
  5922. @example
  5923. # Convert left and right views into a frame-sequential video
  5924. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  5925. # Convert views into a side-by-side video with the same output resolution as the input
  5926. 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
  5927. @end example
  5928. @section framerate
  5929. Change the frame rate by interpolating new video output frames from the source
  5930. frames.
  5931. This filter is not designed to function correctly with interlaced media. If
  5932. you wish to change the frame rate of interlaced media then you are required
  5933. to deinterlace before this filter and re-interlace after this filter.
  5934. A description of the accepted options follows.
  5935. @table @option
  5936. @item fps
  5937. Specify the output frames per second. This option can also be specified
  5938. as a value alone. The default is @code{50}.
  5939. @item interp_start
  5940. Specify the start of a range where the output frame will be created as a
  5941. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5942. the default is @code{15}.
  5943. @item interp_end
  5944. Specify the end of a range where the output frame will be created as a
  5945. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5946. the default is @code{240}.
  5947. @item scene
  5948. Specify the level at which a scene change is detected as a value between
  5949. 0 and 100 to indicate a new scene; a low value reflects a low
  5950. probability for the current frame to introduce a new scene, while a higher
  5951. value means the current frame is more likely to be one.
  5952. The default is @code{7}.
  5953. @item flags
  5954. Specify flags influencing the filter process.
  5955. Available value for @var{flags} is:
  5956. @table @option
  5957. @item scene_change_detect, scd
  5958. Enable scene change detection using the value of the option @var{scene}.
  5959. This flag is enabled by default.
  5960. @end table
  5961. @end table
  5962. @section framestep
  5963. Select one frame every N-th frame.
  5964. This filter accepts the following option:
  5965. @table @option
  5966. @item step
  5967. Select frame after every @code{step} frames.
  5968. Allowed values are positive integers higher than 0. Default value is @code{1}.
  5969. @end table
  5970. @anchor{frei0r}
  5971. @section frei0r
  5972. Apply a frei0r effect to the input video.
  5973. To enable the compilation of this filter, you need to install the frei0r
  5974. header and configure FFmpeg with @code{--enable-frei0r}.
  5975. It accepts the following parameters:
  5976. @table @option
  5977. @item filter_name
  5978. The name of the frei0r effect to load. If the environment variable
  5979. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  5980. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  5981. Otherwise, the standard frei0r paths are searched, in this order:
  5982. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  5983. @file{/usr/lib/frei0r-1/}.
  5984. @item filter_params
  5985. A '|'-separated list of parameters to pass to the frei0r effect.
  5986. @end table
  5987. A frei0r effect parameter can be a boolean (its value is either
  5988. "y" or "n"), a double, a color (specified as
  5989. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  5990. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  5991. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  5992. @var{X} and @var{Y} are floating point numbers) and/or a string.
  5993. The number and types of parameters depend on the loaded effect. If an
  5994. effect parameter is not specified, the default value is set.
  5995. @subsection Examples
  5996. @itemize
  5997. @item
  5998. Apply the distort0r effect, setting the first two double parameters:
  5999. @example
  6000. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6001. @end example
  6002. @item
  6003. Apply the colordistance effect, taking a color as the first parameter:
  6004. @example
  6005. frei0r=colordistance:0.2/0.3/0.4
  6006. frei0r=colordistance:violet
  6007. frei0r=colordistance:0x112233
  6008. @end example
  6009. @item
  6010. Apply the perspective effect, specifying the top left and top right image
  6011. positions:
  6012. @example
  6013. frei0r=perspective:0.2/0.2|0.8/0.2
  6014. @end example
  6015. @end itemize
  6016. For more information, see
  6017. @url{http://frei0r.dyne.org}
  6018. @section fspp
  6019. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6020. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6021. processing filter, one of them is performed once per block, not per pixel.
  6022. This allows for much higher speed.
  6023. The filter accepts the following options:
  6024. @table @option
  6025. @item quality
  6026. Set quality. This option defines the number of levels for averaging. It accepts
  6027. an integer in the range 4-5. Default value is @code{4}.
  6028. @item qp
  6029. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6030. If not set, the filter will use the QP from the video stream (if available).
  6031. @item strength
  6032. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6033. more details but also more artifacts, while higher values make the image smoother
  6034. but also blurrier. Default value is @code{0} − PSNR optimal.
  6035. @item use_bframe_qp
  6036. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6037. option may cause flicker since the B-Frames have often larger QP. Default is
  6038. @code{0} (not enabled).
  6039. @end table
  6040. @section geq
  6041. The filter accepts the following options:
  6042. @table @option
  6043. @item lum_expr, lum
  6044. Set the luminance expression.
  6045. @item cb_expr, cb
  6046. Set the chrominance blue expression.
  6047. @item cr_expr, cr
  6048. Set the chrominance red expression.
  6049. @item alpha_expr, a
  6050. Set the alpha expression.
  6051. @item red_expr, r
  6052. Set the red expression.
  6053. @item green_expr, g
  6054. Set the green expression.
  6055. @item blue_expr, b
  6056. Set the blue expression.
  6057. @end table
  6058. The colorspace is selected according to the specified options. If one
  6059. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6060. options is specified, the filter will automatically select a YCbCr
  6061. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6062. @option{blue_expr} options is specified, it will select an RGB
  6063. colorspace.
  6064. If one of the chrominance expression is not defined, it falls back on the other
  6065. one. If no alpha expression is specified it will evaluate to opaque value.
  6066. If none of chrominance expressions are specified, they will evaluate
  6067. to the luminance expression.
  6068. The expressions can use the following variables and functions:
  6069. @table @option
  6070. @item N
  6071. The sequential number of the filtered frame, starting from @code{0}.
  6072. @item X
  6073. @item Y
  6074. The coordinates of the current sample.
  6075. @item W
  6076. @item H
  6077. The width and height of the image.
  6078. @item SW
  6079. @item SH
  6080. Width and height scale depending on the currently filtered plane. It is the
  6081. ratio between the corresponding luma plane number of pixels and the current
  6082. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6083. @code{0.5,0.5} for chroma planes.
  6084. @item T
  6085. Time of the current frame, expressed in seconds.
  6086. @item p(x, y)
  6087. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6088. plane.
  6089. @item lum(x, y)
  6090. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6091. plane.
  6092. @item cb(x, y)
  6093. Return the value of the pixel at location (@var{x},@var{y}) of the
  6094. blue-difference chroma plane. Return 0 if there is no such plane.
  6095. @item cr(x, y)
  6096. Return the value of the pixel at location (@var{x},@var{y}) of the
  6097. red-difference chroma plane. Return 0 if there is no such plane.
  6098. @item r(x, y)
  6099. @item g(x, y)
  6100. @item b(x, y)
  6101. Return the value of the pixel at location (@var{x},@var{y}) of the
  6102. red/green/blue component. Return 0 if there is no such component.
  6103. @item alpha(x, y)
  6104. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6105. plane. Return 0 if there is no such plane.
  6106. @end table
  6107. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6108. automatically clipped to the closer edge.
  6109. @subsection Examples
  6110. @itemize
  6111. @item
  6112. Flip the image horizontally:
  6113. @example
  6114. geq=p(W-X\,Y)
  6115. @end example
  6116. @item
  6117. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6118. wavelength of 100 pixels:
  6119. @example
  6120. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6121. @end example
  6122. @item
  6123. Generate a fancy enigmatic moving light:
  6124. @example
  6125. 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
  6126. @end example
  6127. @item
  6128. Generate a quick emboss effect:
  6129. @example
  6130. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6131. @end example
  6132. @item
  6133. Modify RGB components depending on pixel position:
  6134. @example
  6135. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6136. @end example
  6137. @item
  6138. Create a radial gradient that is the same size as the input (also see
  6139. the @ref{vignette} filter):
  6140. @example
  6141. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6142. @end example
  6143. @end itemize
  6144. @section gradfun
  6145. Fix the banding artifacts that are sometimes introduced into nearly flat
  6146. regions by truncation to 8bit color depth.
  6147. Interpolate the gradients that should go where the bands are, and
  6148. dither them.
  6149. It is designed for playback only. Do not use it prior to
  6150. lossy compression, because compression tends to lose the dither and
  6151. bring back the bands.
  6152. It accepts the following parameters:
  6153. @table @option
  6154. @item strength
  6155. The maximum amount by which the filter will change any one pixel. This is also
  6156. the threshold for detecting nearly flat regions. Acceptable values range from
  6157. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6158. valid range.
  6159. @item radius
  6160. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6161. gradients, but also prevents the filter from modifying the pixels near detailed
  6162. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6163. values will be clipped to the valid range.
  6164. @end table
  6165. Alternatively, the options can be specified as a flat string:
  6166. @var{strength}[:@var{radius}]
  6167. @subsection Examples
  6168. @itemize
  6169. @item
  6170. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6171. @example
  6172. gradfun=3.5:8
  6173. @end example
  6174. @item
  6175. Specify radius, omitting the strength (which will fall-back to the default
  6176. value):
  6177. @example
  6178. gradfun=radius=8
  6179. @end example
  6180. @end itemize
  6181. @anchor{haldclut}
  6182. @section haldclut
  6183. Apply a Hald CLUT to a video stream.
  6184. First input is the video stream to process, and second one is the Hald CLUT.
  6185. The Hald CLUT input can be a simple picture or a complete video stream.
  6186. The filter accepts the following options:
  6187. @table @option
  6188. @item shortest
  6189. Force termination when the shortest input terminates. Default is @code{0}.
  6190. @item repeatlast
  6191. Continue applying the last CLUT after the end of the stream. A value of
  6192. @code{0} disable the filter after the last frame of the CLUT is reached.
  6193. Default is @code{1}.
  6194. @end table
  6195. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6196. filters share the same internals).
  6197. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6198. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6199. @subsection Workflow examples
  6200. @subsubsection Hald CLUT video stream
  6201. Generate an identity Hald CLUT stream altered with various effects:
  6202. @example
  6203. 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
  6204. @end example
  6205. Note: make sure you use a lossless codec.
  6206. Then use it with @code{haldclut} to apply it on some random stream:
  6207. @example
  6208. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6209. @end example
  6210. The Hald CLUT will be applied to the 10 first seconds (duration of
  6211. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6212. to the remaining frames of the @code{mandelbrot} stream.
  6213. @subsubsection Hald CLUT with preview
  6214. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6215. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6216. biggest possible square starting at the top left of the picture. The remaining
  6217. padding pixels (bottom or right) will be ignored. This area can be used to add
  6218. a preview of the Hald CLUT.
  6219. Typically, the following generated Hald CLUT will be supported by the
  6220. @code{haldclut} filter:
  6221. @example
  6222. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6223. pad=iw+320 [padded_clut];
  6224. smptebars=s=320x256, split [a][b];
  6225. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6226. [main][b] overlay=W-320" -frames:v 1 clut.png
  6227. @end example
  6228. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6229. bars are displayed on the right-top, and below the same color bars processed by
  6230. the color changes.
  6231. Then, the effect of this Hald CLUT can be visualized with:
  6232. @example
  6233. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6234. @end example
  6235. @section hflip
  6236. Flip the input video horizontally.
  6237. For example, to horizontally flip the input video with @command{ffmpeg}:
  6238. @example
  6239. ffmpeg -i in.avi -vf "hflip" out.avi
  6240. @end example
  6241. @section histeq
  6242. This filter applies a global color histogram equalization on a
  6243. per-frame basis.
  6244. It can be used to correct video that has a compressed range of pixel
  6245. intensities. The filter redistributes the pixel intensities to
  6246. equalize their distribution across the intensity range. It may be
  6247. viewed as an "automatically adjusting contrast filter". This filter is
  6248. useful only for correcting degraded or poorly captured source
  6249. video.
  6250. The filter accepts the following options:
  6251. @table @option
  6252. @item strength
  6253. Determine the amount of equalization to be applied. As the strength
  6254. is reduced, the distribution of pixel intensities more-and-more
  6255. approaches that of the input frame. The value must be a float number
  6256. in the range [0,1] and defaults to 0.200.
  6257. @item intensity
  6258. Set the maximum intensity that can generated and scale the output
  6259. values appropriately. The strength should be set as desired and then
  6260. the intensity can be limited if needed to avoid washing-out. The value
  6261. must be a float number in the range [0,1] and defaults to 0.210.
  6262. @item antibanding
  6263. Set the antibanding level. If enabled the filter will randomly vary
  6264. the luminance of output pixels by a small amount to avoid banding of
  6265. the histogram. Possible values are @code{none}, @code{weak} or
  6266. @code{strong}. It defaults to @code{none}.
  6267. @end table
  6268. @section histogram
  6269. Compute and draw a color distribution histogram for the input video.
  6270. The computed histogram is a representation of the color component
  6271. distribution in an image.
  6272. Standard histogram displays the color components distribution in an image.
  6273. Displays color graph for each color component. Shows distribution of
  6274. the Y, U, V, A or R, G, B components, depending on input format, in the
  6275. current frame. Below each graph a color component scale meter is shown.
  6276. The filter accepts the following options:
  6277. @table @option
  6278. @item level_height
  6279. Set height of level. Default value is @code{200}.
  6280. Allowed range is [50, 2048].
  6281. @item scale_height
  6282. Set height of color scale. Default value is @code{12}.
  6283. Allowed range is [0, 40].
  6284. @item display_mode
  6285. Set display mode.
  6286. It accepts the following values:
  6287. @table @samp
  6288. @item parade
  6289. Per color component graphs are placed below each other.
  6290. @item overlay
  6291. Presents information identical to that in the @code{parade}, except
  6292. that the graphs representing color components are superimposed directly
  6293. over one another.
  6294. @end table
  6295. Default is @code{parade}.
  6296. @item levels_mode
  6297. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6298. Default is @code{linear}.
  6299. @item components
  6300. Set what color components to display.
  6301. Default is @code{7}.
  6302. @end table
  6303. @subsection Examples
  6304. @itemize
  6305. @item
  6306. Calculate and draw histogram:
  6307. @example
  6308. ffplay -i input -vf histogram
  6309. @end example
  6310. @end itemize
  6311. @anchor{hqdn3d}
  6312. @section hqdn3d
  6313. This is a high precision/quality 3d denoise filter. It aims to reduce
  6314. image noise, producing smooth images and making still images really
  6315. still. It should enhance compressibility.
  6316. It accepts the following optional parameters:
  6317. @table @option
  6318. @item luma_spatial
  6319. A non-negative floating point number which specifies spatial luma strength.
  6320. It defaults to 4.0.
  6321. @item chroma_spatial
  6322. A non-negative floating point number which specifies spatial chroma strength.
  6323. It defaults to 3.0*@var{luma_spatial}/4.0.
  6324. @item luma_tmp
  6325. A floating point number which specifies luma temporal strength. It defaults to
  6326. 6.0*@var{luma_spatial}/4.0.
  6327. @item chroma_tmp
  6328. A floating point number which specifies chroma temporal strength. It defaults to
  6329. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6330. @end table
  6331. @anchor{hwupload_cuda}
  6332. @section hwupload_cuda
  6333. Upload system memory frames to a CUDA device.
  6334. It accepts the following optional parameters:
  6335. @table @option
  6336. @item device
  6337. The number of the CUDA device to use
  6338. @end table
  6339. @section hqx
  6340. Apply a high-quality magnification filter designed for pixel art. This filter
  6341. was originally created by Maxim Stepin.
  6342. It accepts the following option:
  6343. @table @option
  6344. @item n
  6345. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6346. @code{hq3x} and @code{4} for @code{hq4x}.
  6347. Default is @code{3}.
  6348. @end table
  6349. @section hstack
  6350. Stack input videos horizontally.
  6351. All streams must be of same pixel format and of same height.
  6352. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6353. to create same output.
  6354. The filter accept the following option:
  6355. @table @option
  6356. @item inputs
  6357. Set number of input streams. Default is 2.
  6358. @item shortest
  6359. If set to 1, force the output to terminate when the shortest input
  6360. terminates. Default value is 0.
  6361. @end table
  6362. @section hue
  6363. Modify the hue and/or the saturation of the input.
  6364. It accepts the following parameters:
  6365. @table @option
  6366. @item h
  6367. Specify the hue angle as a number of degrees. It accepts an expression,
  6368. and defaults to "0".
  6369. @item s
  6370. Specify the saturation in the [-10,10] range. It accepts an expression and
  6371. defaults to "1".
  6372. @item H
  6373. Specify the hue angle as a number of radians. It accepts an
  6374. expression, and defaults to "0".
  6375. @item b
  6376. Specify the brightness in the [-10,10] range. It accepts an expression and
  6377. defaults to "0".
  6378. @end table
  6379. @option{h} and @option{H} are mutually exclusive, and can't be
  6380. specified at the same time.
  6381. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6382. expressions containing the following constants:
  6383. @table @option
  6384. @item n
  6385. frame count of the input frame starting from 0
  6386. @item pts
  6387. presentation timestamp of the input frame expressed in time base units
  6388. @item r
  6389. frame rate of the input video, NAN if the input frame rate is unknown
  6390. @item t
  6391. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6392. @item tb
  6393. time base of the input video
  6394. @end table
  6395. @subsection Examples
  6396. @itemize
  6397. @item
  6398. Set the hue to 90 degrees and the saturation to 1.0:
  6399. @example
  6400. hue=h=90:s=1
  6401. @end example
  6402. @item
  6403. Same command but expressing the hue in radians:
  6404. @example
  6405. hue=H=PI/2:s=1
  6406. @end example
  6407. @item
  6408. Rotate hue and make the saturation swing between 0
  6409. and 2 over a period of 1 second:
  6410. @example
  6411. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6412. @end example
  6413. @item
  6414. Apply a 3 seconds saturation fade-in effect starting at 0:
  6415. @example
  6416. hue="s=min(t/3\,1)"
  6417. @end example
  6418. The general fade-in expression can be written as:
  6419. @example
  6420. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6421. @end example
  6422. @item
  6423. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6424. @example
  6425. hue="s=max(0\, min(1\, (8-t)/3))"
  6426. @end example
  6427. The general fade-out expression can be written as:
  6428. @example
  6429. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6430. @end example
  6431. @end itemize
  6432. @subsection Commands
  6433. This filter supports the following commands:
  6434. @table @option
  6435. @item b
  6436. @item s
  6437. @item h
  6438. @item H
  6439. Modify the hue and/or the saturation and/or brightness of the input video.
  6440. The command accepts the same syntax of the corresponding option.
  6441. If the specified expression is not valid, it is kept at its current
  6442. value.
  6443. @end table
  6444. @section idet
  6445. Detect video interlacing type.
  6446. This filter tries to detect if the input frames as interlaced, progressive,
  6447. top or bottom field first. It will also try and detect fields that are
  6448. repeated between adjacent frames (a sign of telecine).
  6449. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6450. Multiple frame detection incorporates the classification history of previous frames.
  6451. The filter will log these metadata values:
  6452. @table @option
  6453. @item single.current_frame
  6454. Detected type of current frame using single-frame detection. One of:
  6455. ``tff'' (top field first), ``bff'' (bottom field first),
  6456. ``progressive'', or ``undetermined''
  6457. @item single.tff
  6458. Cumulative number of frames detected as top field first using single-frame detection.
  6459. @item multiple.tff
  6460. Cumulative number of frames detected as top field first using multiple-frame detection.
  6461. @item single.bff
  6462. Cumulative number of frames detected as bottom field first using single-frame detection.
  6463. @item multiple.current_frame
  6464. Detected type of current frame using multiple-frame detection. One of:
  6465. ``tff'' (top field first), ``bff'' (bottom field first),
  6466. ``progressive'', or ``undetermined''
  6467. @item multiple.bff
  6468. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6469. @item single.progressive
  6470. Cumulative number of frames detected as progressive using single-frame detection.
  6471. @item multiple.progressive
  6472. Cumulative number of frames detected as progressive using multiple-frame detection.
  6473. @item single.undetermined
  6474. Cumulative number of frames that could not be classified using single-frame detection.
  6475. @item multiple.undetermined
  6476. Cumulative number of frames that could not be classified using multiple-frame detection.
  6477. @item repeated.current_frame
  6478. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6479. @item repeated.neither
  6480. Cumulative number of frames with no repeated field.
  6481. @item repeated.top
  6482. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6483. @item repeated.bottom
  6484. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6485. @end table
  6486. The filter accepts the following options:
  6487. @table @option
  6488. @item intl_thres
  6489. Set interlacing threshold.
  6490. @item prog_thres
  6491. Set progressive threshold.
  6492. @item rep_thres
  6493. Threshold for repeated field detection.
  6494. @item half_life
  6495. Number of frames after which a given frame's contribution to the
  6496. statistics is halved (i.e., it contributes only 0.5 to it's
  6497. classification). The default of 0 means that all frames seen are given
  6498. full weight of 1.0 forever.
  6499. @item analyze_interlaced_flag
  6500. When this is not 0 then idet will use the specified number of frames to determine
  6501. if the interlaced flag is accurate, it will not count undetermined frames.
  6502. If the flag is found to be accurate it will be used without any further
  6503. computations, if it is found to be inaccurate it will be cleared without any
  6504. further computations. This allows inserting the idet filter as a low computational
  6505. method to clean up the interlaced flag
  6506. @end table
  6507. @section il
  6508. Deinterleave or interleave fields.
  6509. This filter allows one to process interlaced images fields without
  6510. deinterlacing them. Deinterleaving splits the input frame into 2
  6511. fields (so called half pictures). Odd lines are moved to the top
  6512. half of the output image, even lines to the bottom half.
  6513. You can process (filter) them independently and then re-interleave them.
  6514. The filter accepts the following options:
  6515. @table @option
  6516. @item luma_mode, l
  6517. @item chroma_mode, c
  6518. @item alpha_mode, a
  6519. Available values for @var{luma_mode}, @var{chroma_mode} and
  6520. @var{alpha_mode} are:
  6521. @table @samp
  6522. @item none
  6523. Do nothing.
  6524. @item deinterleave, d
  6525. Deinterleave fields, placing one above the other.
  6526. @item interleave, i
  6527. Interleave fields. Reverse the effect of deinterleaving.
  6528. @end table
  6529. Default value is @code{none}.
  6530. @item luma_swap, ls
  6531. @item chroma_swap, cs
  6532. @item alpha_swap, as
  6533. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6534. @end table
  6535. @section inflate
  6536. Apply inflate effect to the video.
  6537. This filter replaces the pixel by the local(3x3) average by taking into account
  6538. only values higher than the pixel.
  6539. It accepts the following options:
  6540. @table @option
  6541. @item threshold0
  6542. @item threshold1
  6543. @item threshold2
  6544. @item threshold3
  6545. Limit the maximum change for each plane, default is 65535.
  6546. If 0, plane will remain unchanged.
  6547. @end table
  6548. @section interlace
  6549. Simple interlacing filter from progressive contents. This interleaves upper (or
  6550. lower) lines from odd frames with lower (or upper) lines from even frames,
  6551. halving the frame rate and preserving image height.
  6552. @example
  6553. Original Original New Frame
  6554. Frame 'j' Frame 'j+1' (tff)
  6555. ========== =========== ==================
  6556. Line 0 --------------------> Frame 'j' Line 0
  6557. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6558. Line 2 ---------------------> Frame 'j' Line 2
  6559. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6560. ... ... ...
  6561. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6562. @end example
  6563. It accepts the following optional parameters:
  6564. @table @option
  6565. @item scan
  6566. This determines whether the interlaced frame is taken from the even
  6567. (tff - default) or odd (bff) lines of the progressive frame.
  6568. @item lowpass
  6569. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6570. interlacing and reduce moire patterns.
  6571. @end table
  6572. @section kerndeint
  6573. Deinterlace input video by applying Donald Graft's adaptive kernel
  6574. deinterling. Work on interlaced parts of a video to produce
  6575. progressive frames.
  6576. The description of the accepted parameters follows.
  6577. @table @option
  6578. @item thresh
  6579. Set the threshold which affects the filter's tolerance when
  6580. determining if a pixel line must be processed. It must be an integer
  6581. in the range [0,255] and defaults to 10. A value of 0 will result in
  6582. applying the process on every pixels.
  6583. @item map
  6584. Paint pixels exceeding the threshold value to white if set to 1.
  6585. Default is 0.
  6586. @item order
  6587. Set the fields order. Swap fields if set to 1, leave fields alone if
  6588. 0. Default is 0.
  6589. @item sharp
  6590. Enable additional sharpening if set to 1. Default is 0.
  6591. @item twoway
  6592. Enable twoway sharpening if set to 1. Default is 0.
  6593. @end table
  6594. @subsection Examples
  6595. @itemize
  6596. @item
  6597. Apply default values:
  6598. @example
  6599. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6600. @end example
  6601. @item
  6602. Enable additional sharpening:
  6603. @example
  6604. kerndeint=sharp=1
  6605. @end example
  6606. @item
  6607. Paint processed pixels in white:
  6608. @example
  6609. kerndeint=map=1
  6610. @end example
  6611. @end itemize
  6612. @section lenscorrection
  6613. Correct radial lens distortion
  6614. This filter can be used to correct for radial distortion as can result from the use
  6615. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6616. one can use tools available for example as part of opencv or simply trial-and-error.
  6617. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6618. and extract the k1 and k2 coefficients from the resulting matrix.
  6619. Note that effectively the same filter is available in the open-source tools Krita and
  6620. Digikam from the KDE project.
  6621. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6622. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6623. brightness distribution, so you may want to use both filters together in certain
  6624. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6625. be applied before or after lens correction.
  6626. @subsection Options
  6627. The filter accepts the following options:
  6628. @table @option
  6629. @item cx
  6630. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6631. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6632. width.
  6633. @item cy
  6634. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6635. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6636. height.
  6637. @item k1
  6638. Coefficient of the quadratic correction term. 0.5 means no correction.
  6639. @item k2
  6640. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6641. @end table
  6642. The formula that generates the correction is:
  6643. @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)
  6644. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6645. distances from the focal point in the source and target images, respectively.
  6646. @section loop, aloop
  6647. Loop video frames or audio samples.
  6648. Those filters accepts the following options:
  6649. @table @option
  6650. @item loop
  6651. Set the number of loops.
  6652. @item size
  6653. Set maximal size in number of frames for @code{loop} filter or maximal number
  6654. of samples in case of @code{aloop} filter.
  6655. @item start
  6656. Set first frame of loop for @code{loop} filter or first sample of loop in case
  6657. of @code{aloop} filter.
  6658. @end table
  6659. @anchor{lut3d}
  6660. @section lut3d
  6661. Apply a 3D LUT to an input video.
  6662. The filter accepts the following options:
  6663. @table @option
  6664. @item file
  6665. Set the 3D LUT file name.
  6666. Currently supported formats:
  6667. @table @samp
  6668. @item 3dl
  6669. AfterEffects
  6670. @item cube
  6671. Iridas
  6672. @item dat
  6673. DaVinci
  6674. @item m3d
  6675. Pandora
  6676. @end table
  6677. @item interp
  6678. Select interpolation mode.
  6679. Available values are:
  6680. @table @samp
  6681. @item nearest
  6682. Use values from the nearest defined point.
  6683. @item trilinear
  6684. Interpolate values using the 8 points defining a cube.
  6685. @item tetrahedral
  6686. Interpolate values using a tetrahedron.
  6687. @end table
  6688. @end table
  6689. @section lut, lutrgb, lutyuv
  6690. Compute a look-up table for binding each pixel component input value
  6691. to an output value, and apply it to the input video.
  6692. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6693. to an RGB input video.
  6694. These filters accept the following parameters:
  6695. @table @option
  6696. @item c0
  6697. set first pixel component expression
  6698. @item c1
  6699. set second pixel component expression
  6700. @item c2
  6701. set third pixel component expression
  6702. @item c3
  6703. set fourth pixel component expression, corresponds to the alpha component
  6704. @item r
  6705. set red component expression
  6706. @item g
  6707. set green component expression
  6708. @item b
  6709. set blue component expression
  6710. @item a
  6711. alpha component expression
  6712. @item y
  6713. set Y/luminance component expression
  6714. @item u
  6715. set U/Cb component expression
  6716. @item v
  6717. set V/Cr component expression
  6718. @end table
  6719. Each of them specifies the expression to use for computing the lookup table for
  6720. the corresponding pixel component values.
  6721. The exact component associated to each of the @var{c*} options depends on the
  6722. format in input.
  6723. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  6724. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  6725. The expressions can contain the following constants and functions:
  6726. @table @option
  6727. @item w
  6728. @item h
  6729. The input width and height.
  6730. @item val
  6731. The input value for the pixel component.
  6732. @item clipval
  6733. The input value, clipped to the @var{minval}-@var{maxval} range.
  6734. @item maxval
  6735. The maximum value for the pixel component.
  6736. @item minval
  6737. The minimum value for the pixel component.
  6738. @item negval
  6739. The negated value for the pixel component value, clipped to the
  6740. @var{minval}-@var{maxval} range; it corresponds to the expression
  6741. "maxval-clipval+minval".
  6742. @item clip(val)
  6743. The computed value in @var{val}, clipped to the
  6744. @var{minval}-@var{maxval} range.
  6745. @item gammaval(gamma)
  6746. The computed gamma correction value of the pixel component value,
  6747. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  6748. expression
  6749. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  6750. @end table
  6751. All expressions default to "val".
  6752. @subsection Examples
  6753. @itemize
  6754. @item
  6755. Negate input video:
  6756. @example
  6757. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  6758. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  6759. @end example
  6760. The above is the same as:
  6761. @example
  6762. lutrgb="r=negval:g=negval:b=negval"
  6763. lutyuv="y=negval:u=negval:v=negval"
  6764. @end example
  6765. @item
  6766. Negate luminance:
  6767. @example
  6768. lutyuv=y=negval
  6769. @end example
  6770. @item
  6771. Remove chroma components, turning the video into a graytone image:
  6772. @example
  6773. lutyuv="u=128:v=128"
  6774. @end example
  6775. @item
  6776. Apply a luma burning effect:
  6777. @example
  6778. lutyuv="y=2*val"
  6779. @end example
  6780. @item
  6781. Remove green and blue components:
  6782. @example
  6783. lutrgb="g=0:b=0"
  6784. @end example
  6785. @item
  6786. Set a constant alpha channel value on input:
  6787. @example
  6788. format=rgba,lutrgb=a="maxval-minval/2"
  6789. @end example
  6790. @item
  6791. Correct luminance gamma by a factor of 0.5:
  6792. @example
  6793. lutyuv=y=gammaval(0.5)
  6794. @end example
  6795. @item
  6796. Discard least significant bits of luma:
  6797. @example
  6798. lutyuv=y='bitand(val, 128+64+32)'
  6799. @end example
  6800. @end itemize
  6801. @section maskedmerge
  6802. Merge the first input stream with the second input stream using per pixel
  6803. weights in the third input stream.
  6804. A value of 0 in the third stream pixel component means that pixel component
  6805. from first stream is returned unchanged, while maximum value (eg. 255 for
  6806. 8-bit videos) means that pixel component from second stream is returned
  6807. unchanged. Intermediate values define the amount of merging between both
  6808. input stream's pixel components.
  6809. This filter accepts the following options:
  6810. @table @option
  6811. @item planes
  6812. Set which planes will be processed as bitmap, unprocessed planes will be
  6813. copied from first stream.
  6814. By default value 0xf, all planes will be processed.
  6815. @end table
  6816. @section mcdeint
  6817. Apply motion-compensation deinterlacing.
  6818. It needs one field per frame as input and must thus be used together
  6819. with yadif=1/3 or equivalent.
  6820. This filter accepts the following options:
  6821. @table @option
  6822. @item mode
  6823. Set the deinterlacing mode.
  6824. It accepts one of the following values:
  6825. @table @samp
  6826. @item fast
  6827. @item medium
  6828. @item slow
  6829. use iterative motion estimation
  6830. @item extra_slow
  6831. like @samp{slow}, but use multiple reference frames.
  6832. @end table
  6833. Default value is @samp{fast}.
  6834. @item parity
  6835. Set the picture field parity assumed for the input video. It must be
  6836. one of the following values:
  6837. @table @samp
  6838. @item 0, tff
  6839. assume top field first
  6840. @item 1, bff
  6841. assume bottom field first
  6842. @end table
  6843. Default value is @samp{bff}.
  6844. @item qp
  6845. Set per-block quantization parameter (QP) used by the internal
  6846. encoder.
  6847. Higher values should result in a smoother motion vector field but less
  6848. optimal individual vectors. Default value is 1.
  6849. @end table
  6850. @section mergeplanes
  6851. Merge color channel components from several video streams.
  6852. The filter accepts up to 4 input streams, and merge selected input
  6853. planes to the output video.
  6854. This filter accepts the following options:
  6855. @table @option
  6856. @item mapping
  6857. Set input to output plane mapping. Default is @code{0}.
  6858. The mappings is specified as a bitmap. It should be specified as a
  6859. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  6860. mapping for the first plane of the output stream. 'A' sets the number of
  6861. the input stream to use (from 0 to 3), and 'a' the plane number of the
  6862. corresponding input to use (from 0 to 3). The rest of the mappings is
  6863. similar, 'Bb' describes the mapping for the output stream second
  6864. plane, 'Cc' describes the mapping for the output stream third plane and
  6865. 'Dd' describes the mapping for the output stream fourth plane.
  6866. @item format
  6867. Set output pixel format. Default is @code{yuva444p}.
  6868. @end table
  6869. @subsection Examples
  6870. @itemize
  6871. @item
  6872. Merge three gray video streams of same width and height into single video stream:
  6873. @example
  6874. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  6875. @end example
  6876. @item
  6877. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  6878. @example
  6879. [a0][a1]mergeplanes=0x00010210:yuva444p
  6880. @end example
  6881. @item
  6882. Swap Y and A plane in yuva444p stream:
  6883. @example
  6884. format=yuva444p,mergeplanes=0x03010200:yuva444p
  6885. @end example
  6886. @item
  6887. Swap U and V plane in yuv420p stream:
  6888. @example
  6889. format=yuv420p,mergeplanes=0x000201:yuv420p
  6890. @end example
  6891. @item
  6892. Cast a rgb24 clip to yuv444p:
  6893. @example
  6894. format=rgb24,mergeplanes=0x000102:yuv444p
  6895. @end example
  6896. @end itemize
  6897. @section metadata, ametadata
  6898. Manipulate frame metadata.
  6899. This filter accepts the following options:
  6900. @table @option
  6901. @item mode
  6902. Set mode of operation of the filter.
  6903. Can be one of the following:
  6904. @table @samp
  6905. @item select
  6906. If both @code{value} and @code{key} is set, select frames
  6907. which have such metadata. If only @code{key} is set, select
  6908. every frame that has such key in metadata.
  6909. @item add
  6910. Add new metadata @code{key} and @code{value}. If key is already available
  6911. do nothing.
  6912. @item modify
  6913. Modify value of already present key.
  6914. @item delete
  6915. If @code{value} is set, delete only keys that have such value.
  6916. Otherwise, delete key.
  6917. @item print
  6918. Print key and its value if metadata was found. If @code{key} is not set print all
  6919. metadata values available in frame.
  6920. @end table
  6921. @item key
  6922. Set key used with all modes. Must be set for all modes except @code{print}.
  6923. @item value
  6924. Set metadata value which will be used. This option is mandatory for
  6925. @code{modify} and @code{add} mode.
  6926. @item function
  6927. Which function to use when comparing metadata value and @code{value}.
  6928. Can be one of following:
  6929. @table @samp
  6930. @item same_str
  6931. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  6932. @item starts_with
  6933. Values are interpreted as strings, returns true if metadata value starts with
  6934. the @code{value} option string.
  6935. @item less
  6936. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  6937. @item equal
  6938. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  6939. @item greater
  6940. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  6941. @item expr
  6942. Values are interpreted as floats, returns true if expression from option @code{expr}
  6943. evaluates to true.
  6944. @end table
  6945. @item expr
  6946. Set expression which is used when @code{function} is set to @code{expr}.
  6947. The expression is evaluated through the eval API and can contain the following
  6948. constants:
  6949. @table @option
  6950. @item VALUE1
  6951. Float representation of @code{value} from metadata key.
  6952. @item VALUE2
  6953. Float representation of @code{value} as supplied by user in @code{value} option.
  6954. @end table
  6955. @item file
  6956. If specified in @code{print} mode, output is written to the named file. When
  6957. filename equals "-" data is written to standard output.
  6958. If @code{file} option is not set, output is written to the log with AV_LOG_INFO
  6959. loglevel.
  6960. @end table
  6961. @subsection Examples
  6962. @itemize
  6963. @item
  6964. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  6965. between 0 and 1.
  6966. @example
  6967. @end example
  6968. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  6969. @end itemize
  6970. @section mpdecimate
  6971. Drop frames that do not differ greatly from the previous frame in
  6972. order to reduce frame rate.
  6973. The main use of this filter is for very-low-bitrate encoding
  6974. (e.g. streaming over dialup modem), but it could in theory be used for
  6975. fixing movies that were inverse-telecined incorrectly.
  6976. A description of the accepted options follows.
  6977. @table @option
  6978. @item max
  6979. Set the maximum number of consecutive frames which can be dropped (if
  6980. positive), or the minimum interval between dropped frames (if
  6981. negative). If the value is 0, the frame is dropped unregarding the
  6982. number of previous sequentially dropped frames.
  6983. Default value is 0.
  6984. @item hi
  6985. @item lo
  6986. @item frac
  6987. Set the dropping threshold values.
  6988. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  6989. represent actual pixel value differences, so a threshold of 64
  6990. corresponds to 1 unit of difference for each pixel, or the same spread
  6991. out differently over the block.
  6992. A frame is a candidate for dropping if no 8x8 blocks differ by more
  6993. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  6994. meaning the whole image) differ by more than a threshold of @option{lo}.
  6995. Default value for @option{hi} is 64*12, default value for @option{lo} is
  6996. 64*5, and default value for @option{frac} is 0.33.
  6997. @end table
  6998. @section negate
  6999. Negate input video.
  7000. It accepts an integer in input; if non-zero it negates the
  7001. alpha component (if available). The default value in input is 0.
  7002. @section nnedi
  7003. Deinterlace video using neural network edge directed interpolation.
  7004. This filter accepts the following options:
  7005. @table @option
  7006. @item weights
  7007. Mandatory option, without binary file filter can not work.
  7008. Currently file can be found here:
  7009. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7010. @item deint
  7011. Set which frames to deinterlace, by default it is @code{all}.
  7012. Can be @code{all} or @code{interlaced}.
  7013. @item field
  7014. Set mode of operation.
  7015. Can be one of the following:
  7016. @table @samp
  7017. @item af
  7018. Use frame flags, both fields.
  7019. @item a
  7020. Use frame flags, single field.
  7021. @item t
  7022. Use top field only.
  7023. @item b
  7024. Use bottom field only.
  7025. @item tf
  7026. Use both fields, top first.
  7027. @item bf
  7028. Use both fields, bottom first.
  7029. @end table
  7030. @item planes
  7031. Set which planes to process, by default filter process all frames.
  7032. @item nsize
  7033. Set size of local neighborhood around each pixel, used by the predictor neural
  7034. network.
  7035. Can be one of the following:
  7036. @table @samp
  7037. @item s8x6
  7038. @item s16x6
  7039. @item s32x6
  7040. @item s48x6
  7041. @item s8x4
  7042. @item s16x4
  7043. @item s32x4
  7044. @end table
  7045. @item nns
  7046. Set the number of neurons in predicctor neural network.
  7047. Can be one of the following:
  7048. @table @samp
  7049. @item n16
  7050. @item n32
  7051. @item n64
  7052. @item n128
  7053. @item n256
  7054. @end table
  7055. @item qual
  7056. Controls the number of different neural network predictions that are blended
  7057. together to compute the final output value. Can be @code{fast}, default or
  7058. @code{slow}.
  7059. @item etype
  7060. Set which set of weights to use in the predictor.
  7061. Can be one of the following:
  7062. @table @samp
  7063. @item a
  7064. weights trained to minimize absolute error
  7065. @item s
  7066. weights trained to minimize squared error
  7067. @end table
  7068. @item pscrn
  7069. Controls whether or not the prescreener neural network is used to decide
  7070. which pixels should be processed by the predictor neural network and which
  7071. can be handled by simple cubic interpolation.
  7072. The prescreener is trained to know whether cubic interpolation will be
  7073. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7074. The computational complexity of the prescreener nn is much less than that of
  7075. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7076. using the prescreener generally results in much faster processing.
  7077. The prescreener is pretty accurate, so the difference between using it and not
  7078. using it is almost always unnoticeable.
  7079. Can be one of the following:
  7080. @table @samp
  7081. @item none
  7082. @item original
  7083. @item new
  7084. @end table
  7085. Default is @code{new}.
  7086. @item fapprox
  7087. Set various debugging flags.
  7088. @end table
  7089. @section noformat
  7090. Force libavfilter not to use any of the specified pixel formats for the
  7091. input to the next filter.
  7092. It accepts the following parameters:
  7093. @table @option
  7094. @item pix_fmts
  7095. A '|'-separated list of pixel format names, such as
  7096. apix_fmts=yuv420p|monow|rgb24".
  7097. @end table
  7098. @subsection Examples
  7099. @itemize
  7100. @item
  7101. Force libavfilter to use a format different from @var{yuv420p} for the
  7102. input to the vflip filter:
  7103. @example
  7104. noformat=pix_fmts=yuv420p,vflip
  7105. @end example
  7106. @item
  7107. Convert the input video to any of the formats not contained in the list:
  7108. @example
  7109. noformat=yuv420p|yuv444p|yuv410p
  7110. @end example
  7111. @end itemize
  7112. @section noise
  7113. Add noise on video input frame.
  7114. The filter accepts the following options:
  7115. @table @option
  7116. @item all_seed
  7117. @item c0_seed
  7118. @item c1_seed
  7119. @item c2_seed
  7120. @item c3_seed
  7121. Set noise seed for specific pixel component or all pixel components in case
  7122. of @var{all_seed}. Default value is @code{123457}.
  7123. @item all_strength, alls
  7124. @item c0_strength, c0s
  7125. @item c1_strength, c1s
  7126. @item c2_strength, c2s
  7127. @item c3_strength, c3s
  7128. Set noise strength for specific pixel component or all pixel components in case
  7129. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7130. @item all_flags, allf
  7131. @item c0_flags, c0f
  7132. @item c1_flags, c1f
  7133. @item c2_flags, c2f
  7134. @item c3_flags, c3f
  7135. Set pixel component flags or set flags for all components if @var{all_flags}.
  7136. Available values for component flags are:
  7137. @table @samp
  7138. @item a
  7139. averaged temporal noise (smoother)
  7140. @item p
  7141. mix random noise with a (semi)regular pattern
  7142. @item t
  7143. temporal noise (noise pattern changes between frames)
  7144. @item u
  7145. uniform noise (gaussian otherwise)
  7146. @end table
  7147. @end table
  7148. @subsection Examples
  7149. Add temporal and uniform noise to input video:
  7150. @example
  7151. noise=alls=20:allf=t+u
  7152. @end example
  7153. @section null
  7154. Pass the video source unchanged to the output.
  7155. @section ocr
  7156. Optical Character Recognition
  7157. This filter uses Tesseract for optical character recognition.
  7158. It accepts the following options:
  7159. @table @option
  7160. @item datapath
  7161. Set datapath to tesseract data. Default is to use whatever was
  7162. set at installation.
  7163. @item language
  7164. Set language, default is "eng".
  7165. @item whitelist
  7166. Set character whitelist.
  7167. @item blacklist
  7168. Set character blacklist.
  7169. @end table
  7170. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7171. @section ocv
  7172. Apply a video transform using libopencv.
  7173. To enable this filter, install the libopencv library and headers and
  7174. configure FFmpeg with @code{--enable-libopencv}.
  7175. It accepts the following parameters:
  7176. @table @option
  7177. @item filter_name
  7178. The name of the libopencv filter to apply.
  7179. @item filter_params
  7180. The parameters to pass to the libopencv filter. If not specified, the default
  7181. values are assumed.
  7182. @end table
  7183. Refer to the official libopencv documentation for more precise
  7184. information:
  7185. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7186. Several libopencv filters are supported; see the following subsections.
  7187. @anchor{dilate}
  7188. @subsection dilate
  7189. Dilate an image by using a specific structuring element.
  7190. It corresponds to the libopencv function @code{cvDilate}.
  7191. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7192. @var{struct_el} represents a structuring element, and has the syntax:
  7193. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7194. @var{cols} and @var{rows} represent the number of columns and rows of
  7195. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7196. point, and @var{shape} the shape for the structuring element. @var{shape}
  7197. must be "rect", "cross", "ellipse", or "custom".
  7198. If the value for @var{shape} is "custom", it must be followed by a
  7199. string of the form "=@var{filename}". The file with name
  7200. @var{filename} is assumed to represent a binary image, with each
  7201. printable character corresponding to a bright pixel. When a custom
  7202. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7203. or columns and rows of the read file are assumed instead.
  7204. The default value for @var{struct_el} is "3x3+0x0/rect".
  7205. @var{nb_iterations} specifies the number of times the transform is
  7206. applied to the image, and defaults to 1.
  7207. Some examples:
  7208. @example
  7209. # Use the default values
  7210. ocv=dilate
  7211. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7212. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7213. # Read the shape from the file diamond.shape, iterating two times.
  7214. # The file diamond.shape may contain a pattern of characters like this
  7215. # *
  7216. # ***
  7217. # *****
  7218. # ***
  7219. # *
  7220. # The specified columns and rows are ignored
  7221. # but the anchor point coordinates are not
  7222. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7223. @end example
  7224. @subsection erode
  7225. Erode an image by using a specific structuring element.
  7226. It corresponds to the libopencv function @code{cvErode}.
  7227. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7228. with the same syntax and semantics as the @ref{dilate} filter.
  7229. @subsection smooth
  7230. Smooth the input video.
  7231. The filter takes the following parameters:
  7232. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7233. @var{type} is the type of smooth filter to apply, and must be one of
  7234. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7235. or "bilateral". The default value is "gaussian".
  7236. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7237. depend on the smooth type. @var{param1} and
  7238. @var{param2} accept integer positive values or 0. @var{param3} and
  7239. @var{param4} accept floating point values.
  7240. The default value for @var{param1} is 3. The default value for the
  7241. other parameters is 0.
  7242. These parameters correspond to the parameters assigned to the
  7243. libopencv function @code{cvSmooth}.
  7244. @anchor{overlay}
  7245. @section overlay
  7246. Overlay one video on top of another.
  7247. It takes two inputs and has one output. The first input is the "main"
  7248. video on which the second input is overlaid.
  7249. It accepts the following parameters:
  7250. A description of the accepted options follows.
  7251. @table @option
  7252. @item x
  7253. @item y
  7254. Set the expression for the x and y coordinates of the overlaid video
  7255. on the main video. Default value is "0" for both expressions. In case
  7256. the expression is invalid, it is set to a huge value (meaning that the
  7257. overlay will not be displayed within the output visible area).
  7258. @item eof_action
  7259. The action to take when EOF is encountered on the secondary input; it accepts
  7260. one of the following values:
  7261. @table @option
  7262. @item repeat
  7263. Repeat the last frame (the default).
  7264. @item endall
  7265. End both streams.
  7266. @item pass
  7267. Pass the main input through.
  7268. @end table
  7269. @item eval
  7270. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7271. It accepts the following values:
  7272. @table @samp
  7273. @item init
  7274. only evaluate expressions once during the filter initialization or
  7275. when a command is processed
  7276. @item frame
  7277. evaluate expressions for each incoming frame
  7278. @end table
  7279. Default value is @samp{frame}.
  7280. @item shortest
  7281. If set to 1, force the output to terminate when the shortest input
  7282. terminates. Default value is 0.
  7283. @item format
  7284. Set the format for the output video.
  7285. It accepts the following values:
  7286. @table @samp
  7287. @item yuv420
  7288. force YUV420 output
  7289. @item yuv422
  7290. force YUV422 output
  7291. @item yuv444
  7292. force YUV444 output
  7293. @item rgb
  7294. force RGB output
  7295. @end table
  7296. Default value is @samp{yuv420}.
  7297. @item rgb @emph{(deprecated)}
  7298. If set to 1, force the filter to accept inputs in the RGB
  7299. color space. Default value is 0. This option is deprecated, use
  7300. @option{format} instead.
  7301. @item repeatlast
  7302. If set to 1, force the filter to draw the last overlay frame over the
  7303. main input until the end of the stream. A value of 0 disables this
  7304. behavior. Default value is 1.
  7305. @end table
  7306. The @option{x}, and @option{y} expressions can contain the following
  7307. parameters.
  7308. @table @option
  7309. @item main_w, W
  7310. @item main_h, H
  7311. The main input width and height.
  7312. @item overlay_w, w
  7313. @item overlay_h, h
  7314. The overlay input width and height.
  7315. @item x
  7316. @item y
  7317. The computed values for @var{x} and @var{y}. They are evaluated for
  7318. each new frame.
  7319. @item hsub
  7320. @item vsub
  7321. horizontal and vertical chroma subsample values of the output
  7322. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7323. @var{vsub} is 1.
  7324. @item n
  7325. the number of input frame, starting from 0
  7326. @item pos
  7327. the position in the file of the input frame, NAN if unknown
  7328. @item t
  7329. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7330. @end table
  7331. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7332. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7333. when @option{eval} is set to @samp{init}.
  7334. Be aware that frames are taken from each input video in timestamp
  7335. order, hence, if their initial timestamps differ, it is a good idea
  7336. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7337. have them begin in the same zero timestamp, as the example for
  7338. the @var{movie} filter does.
  7339. You can chain together more overlays but you should test the
  7340. efficiency of such approach.
  7341. @subsection Commands
  7342. This filter supports the following commands:
  7343. @table @option
  7344. @item x
  7345. @item y
  7346. Modify the x and y of the overlay input.
  7347. The command accepts the same syntax of the corresponding option.
  7348. If the specified expression is not valid, it is kept at its current
  7349. value.
  7350. @end table
  7351. @subsection Examples
  7352. @itemize
  7353. @item
  7354. Draw the overlay at 10 pixels from the bottom right corner of the main
  7355. video:
  7356. @example
  7357. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7358. @end example
  7359. Using named options the example above becomes:
  7360. @example
  7361. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7362. @end example
  7363. @item
  7364. Insert a transparent PNG logo in the bottom left corner of the input,
  7365. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7366. @example
  7367. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7368. @end example
  7369. @item
  7370. Insert 2 different transparent PNG logos (second logo on bottom
  7371. right corner) using the @command{ffmpeg} tool:
  7372. @example
  7373. 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
  7374. @end example
  7375. @item
  7376. Add a transparent color layer on top of the main video; @code{WxH}
  7377. must specify the size of the main input to the overlay filter:
  7378. @example
  7379. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7380. @end example
  7381. @item
  7382. Play an original video and a filtered version (here with the deshake
  7383. filter) side by side using the @command{ffplay} tool:
  7384. @example
  7385. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7386. @end example
  7387. The above command is the same as:
  7388. @example
  7389. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7390. @end example
  7391. @item
  7392. Make a sliding overlay appearing from the left to the right top part of the
  7393. screen starting since time 2:
  7394. @example
  7395. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7396. @end example
  7397. @item
  7398. Compose output by putting two input videos side to side:
  7399. @example
  7400. ffmpeg -i left.avi -i right.avi -filter_complex "
  7401. nullsrc=size=200x100 [background];
  7402. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7403. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7404. [background][left] overlay=shortest=1 [background+left];
  7405. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7406. "
  7407. @end example
  7408. @item
  7409. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7410. @example
  7411. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7412. -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]'
  7413. masked.avi
  7414. @end example
  7415. @item
  7416. Chain several overlays in cascade:
  7417. @example
  7418. nullsrc=s=200x200 [bg];
  7419. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7420. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7421. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7422. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7423. [in3] null, [mid2] overlay=100:100 [out0]
  7424. @end example
  7425. @end itemize
  7426. @section owdenoise
  7427. Apply Overcomplete Wavelet denoiser.
  7428. The filter accepts the following options:
  7429. @table @option
  7430. @item depth
  7431. Set depth.
  7432. Larger depth values will denoise lower frequency components more, but
  7433. slow down filtering.
  7434. Must be an int in the range 8-16, default is @code{8}.
  7435. @item luma_strength, ls
  7436. Set luma strength.
  7437. Must be a double value in the range 0-1000, default is @code{1.0}.
  7438. @item chroma_strength, cs
  7439. Set chroma strength.
  7440. Must be a double value in the range 0-1000, default is @code{1.0}.
  7441. @end table
  7442. @anchor{pad}
  7443. @section pad
  7444. Add paddings to the input image, and place the original input at the
  7445. provided @var{x}, @var{y} coordinates.
  7446. It accepts the following parameters:
  7447. @table @option
  7448. @item width, w
  7449. @item height, h
  7450. Specify an expression for the size of the output image with the
  7451. paddings added. If the value for @var{width} or @var{height} is 0, the
  7452. corresponding input size is used for the output.
  7453. The @var{width} expression can reference the value set by the
  7454. @var{height} expression, and vice versa.
  7455. The default value of @var{width} and @var{height} is 0.
  7456. @item x
  7457. @item y
  7458. Specify the offsets to place the input image at within the padded area,
  7459. with respect to the top/left border of the output image.
  7460. The @var{x} expression can reference the value set by the @var{y}
  7461. expression, and vice versa.
  7462. The default value of @var{x} and @var{y} is 0.
  7463. @item color
  7464. Specify the color of the padded area. For the syntax of this option,
  7465. check the "Color" section in the ffmpeg-utils manual.
  7466. The default value of @var{color} is "black".
  7467. @end table
  7468. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  7469. options are expressions containing the following constants:
  7470. @table @option
  7471. @item in_w
  7472. @item in_h
  7473. The input video width and height.
  7474. @item iw
  7475. @item ih
  7476. These are the same as @var{in_w} and @var{in_h}.
  7477. @item out_w
  7478. @item out_h
  7479. The output width and height (the size of the padded area), as
  7480. specified by the @var{width} and @var{height} expressions.
  7481. @item ow
  7482. @item oh
  7483. These are the same as @var{out_w} and @var{out_h}.
  7484. @item x
  7485. @item y
  7486. The x and y offsets as specified by the @var{x} and @var{y}
  7487. expressions, or NAN if not yet specified.
  7488. @item a
  7489. same as @var{iw} / @var{ih}
  7490. @item sar
  7491. input sample aspect ratio
  7492. @item dar
  7493. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7494. @item hsub
  7495. @item vsub
  7496. The horizontal and vertical chroma subsample values. For example for the
  7497. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7498. @end table
  7499. @subsection Examples
  7500. @itemize
  7501. @item
  7502. Add paddings with the color "violet" to the input video. The output video
  7503. size is 640x480, and the top-left corner of the input video is placed at
  7504. column 0, row 40
  7505. @example
  7506. pad=640:480:0:40:violet
  7507. @end example
  7508. The example above is equivalent to the following command:
  7509. @example
  7510. pad=width=640:height=480:x=0:y=40:color=violet
  7511. @end example
  7512. @item
  7513. Pad the input to get an output with dimensions increased by 3/2,
  7514. and put the input video at the center of the padded area:
  7515. @example
  7516. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  7517. @end example
  7518. @item
  7519. Pad the input to get a squared output with size equal to the maximum
  7520. value between the input width and height, and put the input video at
  7521. the center of the padded area:
  7522. @example
  7523. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  7524. @end example
  7525. @item
  7526. Pad the input to get a final w/h ratio of 16:9:
  7527. @example
  7528. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  7529. @end example
  7530. @item
  7531. In case of anamorphic video, in order to set the output display aspect
  7532. correctly, it is necessary to use @var{sar} in the expression,
  7533. according to the relation:
  7534. @example
  7535. (ih * X / ih) * sar = output_dar
  7536. X = output_dar / sar
  7537. @end example
  7538. Thus the previous example needs to be modified to:
  7539. @example
  7540. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  7541. @end example
  7542. @item
  7543. Double the output size and put the input video in the bottom-right
  7544. corner of the output padded area:
  7545. @example
  7546. pad="2*iw:2*ih:ow-iw:oh-ih"
  7547. @end example
  7548. @end itemize
  7549. @anchor{palettegen}
  7550. @section palettegen
  7551. Generate one palette for a whole video stream.
  7552. It accepts the following options:
  7553. @table @option
  7554. @item max_colors
  7555. Set the maximum number of colors to quantize in the palette.
  7556. Note: the palette will still contain 256 colors; the unused palette entries
  7557. will be black.
  7558. @item reserve_transparent
  7559. Create a palette of 255 colors maximum and reserve the last one for
  7560. transparency. Reserving the transparency color is useful for GIF optimization.
  7561. If not set, the maximum of colors in the palette will be 256. You probably want
  7562. to disable this option for a standalone image.
  7563. Set by default.
  7564. @item stats_mode
  7565. Set statistics mode.
  7566. It accepts the following values:
  7567. @table @samp
  7568. @item full
  7569. Compute full frame histograms.
  7570. @item diff
  7571. Compute histograms only for the part that differs from previous frame. This
  7572. might be relevant to give more importance to the moving part of your input if
  7573. the background is static.
  7574. @end table
  7575. Default value is @var{full}.
  7576. @end table
  7577. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  7578. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  7579. color quantization of the palette. This information is also visible at
  7580. @var{info} logging level.
  7581. @subsection Examples
  7582. @itemize
  7583. @item
  7584. Generate a representative palette of a given video using @command{ffmpeg}:
  7585. @example
  7586. ffmpeg -i input.mkv -vf palettegen palette.png
  7587. @end example
  7588. @end itemize
  7589. @section paletteuse
  7590. Use a palette to downsample an input video stream.
  7591. The filter takes two inputs: one video stream and a palette. The palette must
  7592. be a 256 pixels image.
  7593. It accepts the following options:
  7594. @table @option
  7595. @item dither
  7596. Select dithering mode. Available algorithms are:
  7597. @table @samp
  7598. @item bayer
  7599. Ordered 8x8 bayer dithering (deterministic)
  7600. @item heckbert
  7601. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  7602. Note: this dithering is sometimes considered "wrong" and is included as a
  7603. reference.
  7604. @item floyd_steinberg
  7605. Floyd and Steingberg dithering (error diffusion)
  7606. @item sierra2
  7607. Frankie Sierra dithering v2 (error diffusion)
  7608. @item sierra2_4a
  7609. Frankie Sierra dithering v2 "Lite" (error diffusion)
  7610. @end table
  7611. Default is @var{sierra2_4a}.
  7612. @item bayer_scale
  7613. When @var{bayer} dithering is selected, this option defines the scale of the
  7614. pattern (how much the crosshatch pattern is visible). A low value means more
  7615. visible pattern for less banding, and higher value means less visible pattern
  7616. at the cost of more banding.
  7617. The option must be an integer value in the range [0,5]. Default is @var{2}.
  7618. @item diff_mode
  7619. If set, define the zone to process
  7620. @table @samp
  7621. @item rectangle
  7622. Only the changing rectangle will be reprocessed. This is similar to GIF
  7623. cropping/offsetting compression mechanism. This option can be useful for speed
  7624. if only a part of the image is changing, and has use cases such as limiting the
  7625. scope of the error diffusal @option{dither} to the rectangle that bounds the
  7626. moving scene (it leads to more deterministic output if the scene doesn't change
  7627. much, and as a result less moving noise and better GIF compression).
  7628. @end table
  7629. Default is @var{none}.
  7630. @end table
  7631. @subsection Examples
  7632. @itemize
  7633. @item
  7634. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  7635. using @command{ffmpeg}:
  7636. @example
  7637. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  7638. @end example
  7639. @end itemize
  7640. @section perspective
  7641. Correct perspective of video not recorded perpendicular to the screen.
  7642. A description of the accepted parameters follows.
  7643. @table @option
  7644. @item x0
  7645. @item y0
  7646. @item x1
  7647. @item y1
  7648. @item x2
  7649. @item y2
  7650. @item x3
  7651. @item y3
  7652. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  7653. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  7654. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  7655. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  7656. then the corners of the source will be sent to the specified coordinates.
  7657. The expressions can use the following variables:
  7658. @table @option
  7659. @item W
  7660. @item H
  7661. the width and height of video frame.
  7662. @end table
  7663. @item interpolation
  7664. Set interpolation for perspective correction.
  7665. It accepts the following values:
  7666. @table @samp
  7667. @item linear
  7668. @item cubic
  7669. @end table
  7670. Default value is @samp{linear}.
  7671. @item sense
  7672. Set interpretation of coordinate options.
  7673. It accepts the following values:
  7674. @table @samp
  7675. @item 0, source
  7676. Send point in the source specified by the given coordinates to
  7677. the corners of the destination.
  7678. @item 1, destination
  7679. Send the corners of the source to the point in the destination specified
  7680. by the given coordinates.
  7681. Default value is @samp{source}.
  7682. @end table
  7683. @end table
  7684. @section phase
  7685. Delay interlaced video by one field time so that the field order changes.
  7686. The intended use is to fix PAL movies that have been captured with the
  7687. opposite field order to the film-to-video transfer.
  7688. A description of the accepted parameters follows.
  7689. @table @option
  7690. @item mode
  7691. Set phase mode.
  7692. It accepts the following values:
  7693. @table @samp
  7694. @item t
  7695. Capture field order top-first, transfer bottom-first.
  7696. Filter will delay the bottom field.
  7697. @item b
  7698. Capture field order bottom-first, transfer top-first.
  7699. Filter will delay the top field.
  7700. @item p
  7701. Capture and transfer with the same field order. This mode only exists
  7702. for the documentation of the other options to refer to, but if you
  7703. actually select it, the filter will faithfully do nothing.
  7704. @item a
  7705. Capture field order determined automatically by field flags, transfer
  7706. opposite.
  7707. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  7708. basis using field flags. If no field information is available,
  7709. then this works just like @samp{u}.
  7710. @item u
  7711. Capture unknown or varying, transfer opposite.
  7712. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  7713. analyzing the images and selecting the alternative that produces best
  7714. match between the fields.
  7715. @item T
  7716. Capture top-first, transfer unknown or varying.
  7717. Filter selects among @samp{t} and @samp{p} using image analysis.
  7718. @item B
  7719. Capture bottom-first, transfer unknown or varying.
  7720. Filter selects among @samp{b} and @samp{p} using image analysis.
  7721. @item A
  7722. Capture determined by field flags, transfer unknown or varying.
  7723. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  7724. image analysis. If no field information is available, then this works just
  7725. like @samp{U}. This is the default mode.
  7726. @item U
  7727. Both capture and transfer unknown or varying.
  7728. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  7729. @end table
  7730. @end table
  7731. @section pixdesctest
  7732. Pixel format descriptor test filter, mainly useful for internal
  7733. testing. The output video should be equal to the input video.
  7734. For example:
  7735. @example
  7736. format=monow, pixdesctest
  7737. @end example
  7738. can be used to test the monowhite pixel format descriptor definition.
  7739. @section pp
  7740. Enable the specified chain of postprocessing subfilters using libpostproc. This
  7741. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  7742. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  7743. Each subfilter and some options have a short and a long name that can be used
  7744. interchangeably, i.e. dr/dering are the same.
  7745. The filters accept the following options:
  7746. @table @option
  7747. @item subfilters
  7748. Set postprocessing subfilters string.
  7749. @end table
  7750. All subfilters share common options to determine their scope:
  7751. @table @option
  7752. @item a/autoq
  7753. Honor the quality commands for this subfilter.
  7754. @item c/chrom
  7755. Do chrominance filtering, too (default).
  7756. @item y/nochrom
  7757. Do luminance filtering only (no chrominance).
  7758. @item n/noluma
  7759. Do chrominance filtering only (no luminance).
  7760. @end table
  7761. These options can be appended after the subfilter name, separated by a '|'.
  7762. Available subfilters are:
  7763. @table @option
  7764. @item hb/hdeblock[|difference[|flatness]]
  7765. Horizontal deblocking filter
  7766. @table @option
  7767. @item difference
  7768. Difference factor where higher values mean more deblocking (default: @code{32}).
  7769. @item flatness
  7770. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7771. @end table
  7772. @item vb/vdeblock[|difference[|flatness]]
  7773. Vertical deblocking filter
  7774. @table @option
  7775. @item difference
  7776. Difference factor where higher values mean more deblocking (default: @code{32}).
  7777. @item flatness
  7778. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7779. @end table
  7780. @item ha/hadeblock[|difference[|flatness]]
  7781. Accurate horizontal deblocking filter
  7782. @table @option
  7783. @item difference
  7784. Difference factor where higher values mean more deblocking (default: @code{32}).
  7785. @item flatness
  7786. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7787. @end table
  7788. @item va/vadeblock[|difference[|flatness]]
  7789. Accurate vertical deblocking filter
  7790. @table @option
  7791. @item difference
  7792. Difference factor where higher values mean more deblocking (default: @code{32}).
  7793. @item flatness
  7794. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7795. @end table
  7796. @end table
  7797. The horizontal and vertical deblocking filters share the difference and
  7798. flatness values so you cannot set different horizontal and vertical
  7799. thresholds.
  7800. @table @option
  7801. @item h1/x1hdeblock
  7802. Experimental horizontal deblocking filter
  7803. @item v1/x1vdeblock
  7804. Experimental vertical deblocking filter
  7805. @item dr/dering
  7806. Deringing filter
  7807. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  7808. @table @option
  7809. @item threshold1
  7810. larger -> stronger filtering
  7811. @item threshold2
  7812. larger -> stronger filtering
  7813. @item threshold3
  7814. larger -> stronger filtering
  7815. @end table
  7816. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  7817. @table @option
  7818. @item f/fullyrange
  7819. Stretch luminance to @code{0-255}.
  7820. @end table
  7821. @item lb/linblenddeint
  7822. Linear blend deinterlacing filter that deinterlaces the given block by
  7823. filtering all lines with a @code{(1 2 1)} filter.
  7824. @item li/linipoldeint
  7825. Linear interpolating deinterlacing filter that deinterlaces the given block by
  7826. linearly interpolating every second line.
  7827. @item ci/cubicipoldeint
  7828. Cubic interpolating deinterlacing filter deinterlaces the given block by
  7829. cubically interpolating every second line.
  7830. @item md/mediandeint
  7831. Median deinterlacing filter that deinterlaces the given block by applying a
  7832. median filter to every second line.
  7833. @item fd/ffmpegdeint
  7834. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  7835. second line with a @code{(-1 4 2 4 -1)} filter.
  7836. @item l5/lowpass5
  7837. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  7838. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  7839. @item fq/forceQuant[|quantizer]
  7840. Overrides the quantizer table from the input with the constant quantizer you
  7841. specify.
  7842. @table @option
  7843. @item quantizer
  7844. Quantizer to use
  7845. @end table
  7846. @item de/default
  7847. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  7848. @item fa/fast
  7849. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  7850. @item ac
  7851. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  7852. @end table
  7853. @subsection Examples
  7854. @itemize
  7855. @item
  7856. Apply horizontal and vertical deblocking, deringing and automatic
  7857. brightness/contrast:
  7858. @example
  7859. pp=hb/vb/dr/al
  7860. @end example
  7861. @item
  7862. Apply default filters without brightness/contrast correction:
  7863. @example
  7864. pp=de/-al
  7865. @end example
  7866. @item
  7867. Apply default filters and temporal denoiser:
  7868. @example
  7869. pp=default/tmpnoise|1|2|3
  7870. @end example
  7871. @item
  7872. Apply deblocking on luminance only, and switch vertical deblocking on or off
  7873. automatically depending on available CPU time:
  7874. @example
  7875. pp=hb|y/vb|a
  7876. @end example
  7877. @end itemize
  7878. @section pp7
  7879. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  7880. similar to spp = 6 with 7 point DCT, where only the center sample is
  7881. used after IDCT.
  7882. The filter accepts the following options:
  7883. @table @option
  7884. @item qp
  7885. Force a constant quantization parameter. It accepts an integer in range
  7886. 0 to 63. If not set, the filter will use the QP from the video stream
  7887. (if available).
  7888. @item mode
  7889. Set thresholding mode. Available modes are:
  7890. @table @samp
  7891. @item hard
  7892. Set hard thresholding.
  7893. @item soft
  7894. Set soft thresholding (better de-ringing effect, but likely blurrier).
  7895. @item medium
  7896. Set medium thresholding (good results, default).
  7897. @end table
  7898. @end table
  7899. @section psnr
  7900. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  7901. Ratio) between two input videos.
  7902. This filter takes in input two input videos, the first input is
  7903. considered the "main" source and is passed unchanged to the
  7904. output. The second input is used as a "reference" video for computing
  7905. the PSNR.
  7906. Both video inputs must have the same resolution and pixel format for
  7907. this filter to work correctly. Also it assumes that both inputs
  7908. have the same number of frames, which are compared one by one.
  7909. The obtained average PSNR is printed through the logging system.
  7910. The filter stores the accumulated MSE (mean squared error) of each
  7911. frame, and at the end of the processing it is averaged across all frames
  7912. equally, and the following formula is applied to obtain the PSNR:
  7913. @example
  7914. PSNR = 10*log10(MAX^2/MSE)
  7915. @end example
  7916. Where MAX is the average of the maximum values of each component of the
  7917. image.
  7918. The description of the accepted parameters follows.
  7919. @table @option
  7920. @item stats_file, f
  7921. If specified the filter will use the named file to save the PSNR of
  7922. each individual frame. When filename equals "-" the data is sent to
  7923. standard output.
  7924. @end table
  7925. The file printed if @var{stats_file} is selected, contains a sequence of
  7926. key/value pairs of the form @var{key}:@var{value} for each compared
  7927. couple of frames.
  7928. A description of each shown parameter follows:
  7929. @table @option
  7930. @item n
  7931. sequential number of the input frame, starting from 1
  7932. @item mse_avg
  7933. Mean Square Error pixel-by-pixel average difference of the compared
  7934. frames, averaged over all the image components.
  7935. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  7936. Mean Square Error pixel-by-pixel average difference of the compared
  7937. frames for the component specified by the suffix.
  7938. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  7939. Peak Signal to Noise ratio of the compared frames for the component
  7940. specified by the suffix.
  7941. @end table
  7942. For example:
  7943. @example
  7944. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7945. [main][ref] psnr="stats_file=stats.log" [out]
  7946. @end example
  7947. On this example the input file being processed is compared with the
  7948. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  7949. is stored in @file{stats.log}.
  7950. @anchor{pullup}
  7951. @section pullup
  7952. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  7953. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  7954. content.
  7955. The pullup filter is designed to take advantage of future context in making
  7956. its decisions. This filter is stateless in the sense that it does not lock
  7957. onto a pattern to follow, but it instead looks forward to the following
  7958. fields in order to identify matches and rebuild progressive frames.
  7959. To produce content with an even framerate, insert the fps filter after
  7960. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  7961. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  7962. The filter accepts the following options:
  7963. @table @option
  7964. @item jl
  7965. @item jr
  7966. @item jt
  7967. @item jb
  7968. These options set the amount of "junk" to ignore at the left, right, top, and
  7969. bottom of the image, respectively. Left and right are in units of 8 pixels,
  7970. while top and bottom are in units of 2 lines.
  7971. The default is 8 pixels on each side.
  7972. @item sb
  7973. Set the strict breaks. Setting this option to 1 will reduce the chances of
  7974. filter generating an occasional mismatched frame, but it may also cause an
  7975. excessive number of frames to be dropped during high motion sequences.
  7976. Conversely, setting it to -1 will make filter match fields more easily.
  7977. This may help processing of video where there is slight blurring between
  7978. the fields, but may also cause there to be interlaced frames in the output.
  7979. Default value is @code{0}.
  7980. @item mp
  7981. Set the metric plane to use. It accepts the following values:
  7982. @table @samp
  7983. @item l
  7984. Use luma plane.
  7985. @item u
  7986. Use chroma blue plane.
  7987. @item v
  7988. Use chroma red plane.
  7989. @end table
  7990. This option may be set to use chroma plane instead of the default luma plane
  7991. for doing filter's computations. This may improve accuracy on very clean
  7992. source material, but more likely will decrease accuracy, especially if there
  7993. is chroma noise (rainbow effect) or any grayscale video.
  7994. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  7995. load and make pullup usable in realtime on slow machines.
  7996. @end table
  7997. For best results (without duplicated frames in the output file) it is
  7998. necessary to change the output frame rate. For example, to inverse
  7999. telecine NTSC input:
  8000. @example
  8001. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8002. @end example
  8003. @section qp
  8004. Change video quantization parameters (QP).
  8005. The filter accepts the following option:
  8006. @table @option
  8007. @item qp
  8008. Set expression for quantization parameter.
  8009. @end table
  8010. The expression is evaluated through the eval API and can contain, among others,
  8011. the following constants:
  8012. @table @var
  8013. @item known
  8014. 1 if index is not 129, 0 otherwise.
  8015. @item qp
  8016. Sequentional index starting from -129 to 128.
  8017. @end table
  8018. @subsection Examples
  8019. @itemize
  8020. @item
  8021. Some equation like:
  8022. @example
  8023. qp=2+2*sin(PI*qp)
  8024. @end example
  8025. @end itemize
  8026. @section random
  8027. Flush video frames from internal cache of frames into a random order.
  8028. No frame is discarded.
  8029. Inspired by @ref{frei0r} nervous filter.
  8030. @table @option
  8031. @item frames
  8032. Set size in number of frames of internal cache, in range from @code{2} to
  8033. @code{512}. Default is @code{30}.
  8034. @item seed
  8035. Set seed for random number generator, must be an integer included between
  8036. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8037. less than @code{0}, the filter will try to use a good random seed on a
  8038. best effort basis.
  8039. @end table
  8040. @section remap
  8041. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8042. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8043. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8044. value for pixel will be used for destination pixel.
  8045. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8046. will have Xmap/Ymap video stream dimensions.
  8047. Xmap and Ymap input video streams are 16bit depth, single channel.
  8048. @section removegrain
  8049. The removegrain filter is a spatial denoiser for progressive video.
  8050. @table @option
  8051. @item m0
  8052. Set mode for the first plane.
  8053. @item m1
  8054. Set mode for the second plane.
  8055. @item m2
  8056. Set mode for the third plane.
  8057. @item m3
  8058. Set mode for the fourth plane.
  8059. @end table
  8060. Range of mode is from 0 to 24. Description of each mode follows:
  8061. @table @var
  8062. @item 0
  8063. Leave input plane unchanged. Default.
  8064. @item 1
  8065. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8066. @item 2
  8067. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8068. @item 3
  8069. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8070. @item 4
  8071. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8072. This is equivalent to a median filter.
  8073. @item 5
  8074. Line-sensitive clipping giving the minimal change.
  8075. @item 6
  8076. Line-sensitive clipping, intermediate.
  8077. @item 7
  8078. Line-sensitive clipping, intermediate.
  8079. @item 8
  8080. Line-sensitive clipping, intermediate.
  8081. @item 9
  8082. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8083. @item 10
  8084. Replaces the target pixel with the closest neighbour.
  8085. @item 11
  8086. [1 2 1] horizontal and vertical kernel blur.
  8087. @item 12
  8088. Same as mode 11.
  8089. @item 13
  8090. Bob mode, interpolates top field from the line where the neighbours
  8091. pixels are the closest.
  8092. @item 14
  8093. Bob mode, interpolates bottom field from the line where the neighbours
  8094. pixels are the closest.
  8095. @item 15
  8096. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8097. interpolation formula.
  8098. @item 16
  8099. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8100. interpolation formula.
  8101. @item 17
  8102. Clips the pixel with the minimum and maximum of respectively the maximum and
  8103. minimum of each pair of opposite neighbour pixels.
  8104. @item 18
  8105. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8106. the current pixel is minimal.
  8107. @item 19
  8108. Replaces the pixel with the average of its 8 neighbours.
  8109. @item 20
  8110. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8111. @item 21
  8112. Clips pixels using the averages of opposite neighbour.
  8113. @item 22
  8114. Same as mode 21 but simpler and faster.
  8115. @item 23
  8116. Small edge and halo removal, but reputed useless.
  8117. @item 24
  8118. Similar as 23.
  8119. @end table
  8120. @section removelogo
  8121. Suppress a TV station logo, using an image file to determine which
  8122. pixels comprise the logo. It works by filling in the pixels that
  8123. comprise the logo with neighboring pixels.
  8124. The filter accepts the following options:
  8125. @table @option
  8126. @item filename, f
  8127. Set the filter bitmap file, which can be any image format supported by
  8128. libavformat. The width and height of the image file must match those of the
  8129. video stream being processed.
  8130. @end table
  8131. Pixels in the provided bitmap image with a value of zero are not
  8132. considered part of the logo, non-zero pixels are considered part of
  8133. the logo. If you use white (255) for the logo and black (0) for the
  8134. rest, you will be safe. For making the filter bitmap, it is
  8135. recommended to take a screen capture of a black frame with the logo
  8136. visible, and then using a threshold filter followed by the erode
  8137. filter once or twice.
  8138. If needed, little splotches can be fixed manually. Remember that if
  8139. logo pixels are not covered, the filter quality will be much
  8140. reduced. Marking too many pixels as part of the logo does not hurt as
  8141. much, but it will increase the amount of blurring needed to cover over
  8142. the image and will destroy more information than necessary, and extra
  8143. pixels will slow things down on a large logo.
  8144. @section repeatfields
  8145. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8146. fields based on its value.
  8147. @section reverse, areverse
  8148. Reverse a clip.
  8149. Warning: This filter requires memory to buffer the entire clip, so trimming
  8150. is suggested.
  8151. @subsection Examples
  8152. @itemize
  8153. @item
  8154. Take the first 5 seconds of a clip, and reverse it.
  8155. @example
  8156. trim=end=5,reverse
  8157. @end example
  8158. @end itemize
  8159. @section rotate
  8160. Rotate video by an arbitrary angle expressed in radians.
  8161. The filter accepts the following options:
  8162. A description of the optional parameters follows.
  8163. @table @option
  8164. @item angle, a
  8165. Set an expression for the angle by which to rotate the input video
  8166. clockwise, expressed as a number of radians. A negative value will
  8167. result in a counter-clockwise rotation. By default it is set to "0".
  8168. This expression is evaluated for each frame.
  8169. @item out_w, ow
  8170. Set the output width expression, default value is "iw".
  8171. This expression is evaluated just once during configuration.
  8172. @item out_h, oh
  8173. Set the output height expression, default value is "ih".
  8174. This expression is evaluated just once during configuration.
  8175. @item bilinear
  8176. Enable bilinear interpolation if set to 1, a value of 0 disables
  8177. it. Default value is 1.
  8178. @item fillcolor, c
  8179. Set the color used to fill the output area not covered by the rotated
  8180. image. For the general syntax of this option, check the "Color" section in the
  8181. ffmpeg-utils manual. If the special value "none" is selected then no
  8182. background is printed (useful for example if the background is never shown).
  8183. Default value is "black".
  8184. @end table
  8185. The expressions for the angle and the output size can contain the
  8186. following constants and functions:
  8187. @table @option
  8188. @item n
  8189. sequential number of the input frame, starting from 0. It is always NAN
  8190. before the first frame is filtered.
  8191. @item t
  8192. time in seconds of the input frame, it is set to 0 when the filter is
  8193. configured. It is always NAN before the first frame is filtered.
  8194. @item hsub
  8195. @item vsub
  8196. horizontal and vertical chroma subsample values. For example for the
  8197. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8198. @item in_w, iw
  8199. @item in_h, ih
  8200. the input video width and height
  8201. @item out_w, ow
  8202. @item out_h, oh
  8203. the output width and height, that is the size of the padded area as
  8204. specified by the @var{width} and @var{height} expressions
  8205. @item rotw(a)
  8206. @item roth(a)
  8207. the minimal width/height required for completely containing the input
  8208. video rotated by @var{a} radians.
  8209. These are only available when computing the @option{out_w} and
  8210. @option{out_h} expressions.
  8211. @end table
  8212. @subsection Examples
  8213. @itemize
  8214. @item
  8215. Rotate the input by PI/6 radians clockwise:
  8216. @example
  8217. rotate=PI/6
  8218. @end example
  8219. @item
  8220. Rotate the input by PI/6 radians counter-clockwise:
  8221. @example
  8222. rotate=-PI/6
  8223. @end example
  8224. @item
  8225. Rotate the input by 45 degrees clockwise:
  8226. @example
  8227. rotate=45*PI/180
  8228. @end example
  8229. @item
  8230. Apply a constant rotation with period T, starting from an angle of PI/3:
  8231. @example
  8232. rotate=PI/3+2*PI*t/T
  8233. @end example
  8234. @item
  8235. Make the input video rotation oscillating with a period of T
  8236. seconds and an amplitude of A radians:
  8237. @example
  8238. rotate=A*sin(2*PI/T*t)
  8239. @end example
  8240. @item
  8241. Rotate the video, output size is chosen so that the whole rotating
  8242. input video is always completely contained in the output:
  8243. @example
  8244. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8245. @end example
  8246. @item
  8247. Rotate the video, reduce the output size so that no background is ever
  8248. shown:
  8249. @example
  8250. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8251. @end example
  8252. @end itemize
  8253. @subsection Commands
  8254. The filter supports the following commands:
  8255. @table @option
  8256. @item a, angle
  8257. Set the angle expression.
  8258. The command accepts the same syntax of the corresponding option.
  8259. If the specified expression is not valid, it is kept at its current
  8260. value.
  8261. @end table
  8262. @section sab
  8263. Apply Shape Adaptive Blur.
  8264. The filter accepts the following options:
  8265. @table @option
  8266. @item luma_radius, lr
  8267. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8268. value is 1.0. A greater value will result in a more blurred image, and
  8269. in slower processing.
  8270. @item luma_pre_filter_radius, lpfr
  8271. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8272. value is 1.0.
  8273. @item luma_strength, ls
  8274. Set luma maximum difference between pixels to still be considered, must
  8275. be a value in the 0.1-100.0 range, default value is 1.0.
  8276. @item chroma_radius, cr
  8277. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  8278. greater value will result in a more blurred image, and in slower
  8279. processing.
  8280. @item chroma_pre_filter_radius, cpfr
  8281. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  8282. @item chroma_strength, cs
  8283. Set chroma maximum difference between pixels to still be considered,
  8284. must be a value in the 0.1-100.0 range.
  8285. @end table
  8286. Each chroma option value, if not explicitly specified, is set to the
  8287. corresponding luma option value.
  8288. @anchor{scale}
  8289. @section scale
  8290. Scale (resize) the input video, using the libswscale library.
  8291. The scale filter forces the output display aspect ratio to be the same
  8292. of the input, by changing the output sample aspect ratio.
  8293. If the input image format is different from the format requested by
  8294. the next filter, the scale filter will convert the input to the
  8295. requested format.
  8296. @subsection Options
  8297. The filter accepts the following options, or any of the options
  8298. supported by the libswscale scaler.
  8299. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8300. the complete list of scaler options.
  8301. @table @option
  8302. @item width, w
  8303. @item height, h
  8304. Set the output video dimension expression. Default value is the input
  8305. dimension.
  8306. If the value is 0, the input width is used for the output.
  8307. If one of the values is -1, the scale filter will use a value that
  8308. maintains the aspect ratio of the input image, calculated from the
  8309. other specified dimension. If both of them are -1, the input size is
  8310. used
  8311. If one of the values is -n with n > 1, the scale filter will also use a value
  8312. that maintains the aspect ratio of the input image, calculated from the other
  8313. specified dimension. After that it will, however, make sure that the calculated
  8314. dimension is divisible by n and adjust the value if necessary.
  8315. See below for the list of accepted constants for use in the dimension
  8316. expression.
  8317. @item eval
  8318. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8319. @table @samp
  8320. @item init
  8321. Only evaluate expressions once during the filter initialization or when a command is processed.
  8322. @item frame
  8323. Evaluate expressions for each incoming frame.
  8324. @end table
  8325. Default value is @samp{init}.
  8326. @item interl
  8327. Set the interlacing mode. It accepts the following values:
  8328. @table @samp
  8329. @item 1
  8330. Force interlaced aware scaling.
  8331. @item 0
  8332. Do not apply interlaced scaling.
  8333. @item -1
  8334. Select interlaced aware scaling depending on whether the source frames
  8335. are flagged as interlaced or not.
  8336. @end table
  8337. Default value is @samp{0}.
  8338. @item flags
  8339. Set libswscale scaling flags. See
  8340. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8341. complete list of values. If not explicitly specified the filter applies
  8342. the default flags.
  8343. @item param0, param1
  8344. Set libswscale input parameters for scaling algorithms that need them. See
  8345. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8346. complete documentation. If not explicitly specified the filter applies
  8347. empty parameters.
  8348. @item size, s
  8349. Set the video size. For the syntax of this option, check the
  8350. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8351. @item in_color_matrix
  8352. @item out_color_matrix
  8353. Set in/output YCbCr color space type.
  8354. This allows the autodetected value to be overridden as well as allows forcing
  8355. a specific value used for the output and encoder.
  8356. If not specified, the color space type depends on the pixel format.
  8357. Possible values:
  8358. @table @samp
  8359. @item auto
  8360. Choose automatically.
  8361. @item bt709
  8362. Format conforming to International Telecommunication Union (ITU)
  8363. Recommendation BT.709.
  8364. @item fcc
  8365. Set color space conforming to the United States Federal Communications
  8366. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  8367. @item bt601
  8368. Set color space conforming to:
  8369. @itemize
  8370. @item
  8371. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  8372. @item
  8373. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  8374. @item
  8375. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  8376. @end itemize
  8377. @item smpte240m
  8378. Set color space conforming to SMPTE ST 240:1999.
  8379. @end table
  8380. @item in_range
  8381. @item out_range
  8382. Set in/output YCbCr sample range.
  8383. This allows the autodetected value to be overridden as well as allows forcing
  8384. a specific value used for the output and encoder. If not specified, the
  8385. range depends on the pixel format. Possible values:
  8386. @table @samp
  8387. @item auto
  8388. Choose automatically.
  8389. @item jpeg/full/pc
  8390. Set full range (0-255 in case of 8-bit luma).
  8391. @item mpeg/tv
  8392. Set "MPEG" range (16-235 in case of 8-bit luma).
  8393. @end table
  8394. @item force_original_aspect_ratio
  8395. Enable decreasing or increasing output video width or height if necessary to
  8396. keep the original aspect ratio. Possible values:
  8397. @table @samp
  8398. @item disable
  8399. Scale the video as specified and disable this feature.
  8400. @item decrease
  8401. The output video dimensions will automatically be decreased if needed.
  8402. @item increase
  8403. The output video dimensions will automatically be increased if needed.
  8404. @end table
  8405. One useful instance of this option is that when you know a specific device's
  8406. maximum allowed resolution, you can use this to limit the output video to
  8407. that, while retaining the aspect ratio. For example, device A allows
  8408. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  8409. decrease) and specifying 1280x720 to the command line makes the output
  8410. 1280x533.
  8411. Please note that this is a different thing than specifying -1 for @option{w}
  8412. or @option{h}, you still need to specify the output resolution for this option
  8413. to work.
  8414. @end table
  8415. The values of the @option{w} and @option{h} options are expressions
  8416. containing the following constants:
  8417. @table @var
  8418. @item in_w
  8419. @item in_h
  8420. The input width and height
  8421. @item iw
  8422. @item ih
  8423. These are the same as @var{in_w} and @var{in_h}.
  8424. @item out_w
  8425. @item out_h
  8426. The output (scaled) width and height
  8427. @item ow
  8428. @item oh
  8429. These are the same as @var{out_w} and @var{out_h}
  8430. @item a
  8431. The same as @var{iw} / @var{ih}
  8432. @item sar
  8433. input sample aspect ratio
  8434. @item dar
  8435. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  8436. @item hsub
  8437. @item vsub
  8438. horizontal and vertical input chroma subsample values. For example for the
  8439. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8440. @item ohsub
  8441. @item ovsub
  8442. horizontal and vertical output chroma subsample values. For example for the
  8443. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8444. @end table
  8445. @subsection Examples
  8446. @itemize
  8447. @item
  8448. Scale the input video to a size of 200x100
  8449. @example
  8450. scale=w=200:h=100
  8451. @end example
  8452. This is equivalent to:
  8453. @example
  8454. scale=200:100
  8455. @end example
  8456. or:
  8457. @example
  8458. scale=200x100
  8459. @end example
  8460. @item
  8461. Specify a size abbreviation for the output size:
  8462. @example
  8463. scale=qcif
  8464. @end example
  8465. which can also be written as:
  8466. @example
  8467. scale=size=qcif
  8468. @end example
  8469. @item
  8470. Scale the input to 2x:
  8471. @example
  8472. scale=w=2*iw:h=2*ih
  8473. @end example
  8474. @item
  8475. The above is the same as:
  8476. @example
  8477. scale=2*in_w:2*in_h
  8478. @end example
  8479. @item
  8480. Scale the input to 2x with forced interlaced scaling:
  8481. @example
  8482. scale=2*iw:2*ih:interl=1
  8483. @end example
  8484. @item
  8485. Scale the input to half size:
  8486. @example
  8487. scale=w=iw/2:h=ih/2
  8488. @end example
  8489. @item
  8490. Increase the width, and set the height to the same size:
  8491. @example
  8492. scale=3/2*iw:ow
  8493. @end example
  8494. @item
  8495. Seek Greek harmony:
  8496. @example
  8497. scale=iw:1/PHI*iw
  8498. scale=ih*PHI:ih
  8499. @end example
  8500. @item
  8501. Increase the height, and set the width to 3/2 of the height:
  8502. @example
  8503. scale=w=3/2*oh:h=3/5*ih
  8504. @end example
  8505. @item
  8506. Increase the size, making the size a multiple of the chroma
  8507. subsample values:
  8508. @example
  8509. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  8510. @end example
  8511. @item
  8512. Increase the width to a maximum of 500 pixels,
  8513. keeping the same aspect ratio as the input:
  8514. @example
  8515. scale=w='min(500\, iw*3/2):h=-1'
  8516. @end example
  8517. @end itemize
  8518. @subsection Commands
  8519. This filter supports the following commands:
  8520. @table @option
  8521. @item width, w
  8522. @item height, h
  8523. Set the output video dimension expression.
  8524. The command accepts the same syntax of the corresponding option.
  8525. If the specified expression is not valid, it is kept at its current
  8526. value.
  8527. @end table
  8528. @section scale2ref
  8529. Scale (resize) the input video, based on a reference video.
  8530. See the scale filter for available options, scale2ref supports the same but
  8531. uses the reference video instead of the main input as basis.
  8532. @subsection Examples
  8533. @itemize
  8534. @item
  8535. Scale a subtitle stream to match the main video in size before overlaying
  8536. @example
  8537. 'scale2ref[b][a];[a][b]overlay'
  8538. @end example
  8539. @end itemize
  8540. @anchor{selectivecolor}
  8541. @section selectivecolor
  8542. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  8543. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  8544. by the "purity" of the color (that is, how saturated it already is).
  8545. This filter is similar to the Adobe Photoshop Selective Color tool.
  8546. The filter accepts the following options:
  8547. @table @option
  8548. @item correction_method
  8549. Select color correction method.
  8550. Available values are:
  8551. @table @samp
  8552. @item absolute
  8553. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  8554. component value).
  8555. @item relative
  8556. Specified adjustments are relative to the original component value.
  8557. @end table
  8558. Default is @code{absolute}.
  8559. @item reds
  8560. Adjustments for red pixels (pixels where the red component is the maximum)
  8561. @item yellows
  8562. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  8563. @item greens
  8564. Adjustments for green pixels (pixels where the green component is the maximum)
  8565. @item cyans
  8566. Adjustments for cyan pixels (pixels where the red component is the minimum)
  8567. @item blues
  8568. Adjustments for blue pixels (pixels where the blue component is the maximum)
  8569. @item magentas
  8570. Adjustments for magenta pixels (pixels where the green component is the minimum)
  8571. @item whites
  8572. Adjustments for white pixels (pixels where all components are greater than 128)
  8573. @item neutrals
  8574. Adjustments for all pixels except pure black and pure white
  8575. @item blacks
  8576. Adjustments for black pixels (pixels where all components are lesser than 128)
  8577. @item psfile
  8578. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  8579. @end table
  8580. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  8581. 4 space separated floating point adjustment values in the [-1,1] range,
  8582. respectively to adjust the amount of cyan, magenta, yellow and black for the
  8583. pixels of its range.
  8584. @subsection Examples
  8585. @itemize
  8586. @item
  8587. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  8588. increase magenta by 27% in blue areas:
  8589. @example
  8590. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  8591. @end example
  8592. @item
  8593. Use a Photoshop selective color preset:
  8594. @example
  8595. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  8596. @end example
  8597. @end itemize
  8598. @section separatefields
  8599. The @code{separatefields} takes a frame-based video input and splits
  8600. each frame into its components fields, producing a new half height clip
  8601. with twice the frame rate and twice the frame count.
  8602. This filter use field-dominance information in frame to decide which
  8603. of each pair of fields to place first in the output.
  8604. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  8605. @section setdar, setsar
  8606. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  8607. output video.
  8608. This is done by changing the specified Sample (aka Pixel) Aspect
  8609. Ratio, according to the following equation:
  8610. @example
  8611. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  8612. @end example
  8613. Keep in mind that the @code{setdar} filter does not modify the pixel
  8614. dimensions of the video frame. Also, the display aspect ratio set by
  8615. this filter may be changed by later filters in the filterchain,
  8616. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  8617. applied.
  8618. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  8619. the filter output video.
  8620. Note that as a consequence of the application of this filter, the
  8621. output display aspect ratio will change according to the equation
  8622. above.
  8623. Keep in mind that the sample aspect ratio set by the @code{setsar}
  8624. filter may be changed by later filters in the filterchain, e.g. if
  8625. another "setsar" or a "setdar" filter is applied.
  8626. It accepts the following parameters:
  8627. @table @option
  8628. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  8629. Set the aspect ratio used by the filter.
  8630. The parameter can be a floating point number string, an expression, or
  8631. a string of the form @var{num}:@var{den}, where @var{num} and
  8632. @var{den} are the numerator and denominator of the aspect ratio. If
  8633. the parameter is not specified, it is assumed the value "0".
  8634. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  8635. should be escaped.
  8636. @item max
  8637. Set the maximum integer value to use for expressing numerator and
  8638. denominator when reducing the expressed aspect ratio to a rational.
  8639. Default value is @code{100}.
  8640. @end table
  8641. The parameter @var{sar} is an expression containing
  8642. the following constants:
  8643. @table @option
  8644. @item E, PI, PHI
  8645. These are approximated values for the mathematical constants e
  8646. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  8647. @item w, h
  8648. The input width and height.
  8649. @item a
  8650. These are the same as @var{w} / @var{h}.
  8651. @item sar
  8652. The input sample aspect ratio.
  8653. @item dar
  8654. The input display aspect ratio. It is the same as
  8655. (@var{w} / @var{h}) * @var{sar}.
  8656. @item hsub, vsub
  8657. Horizontal and vertical chroma subsample values. For example, for the
  8658. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8659. @end table
  8660. @subsection Examples
  8661. @itemize
  8662. @item
  8663. To change the display aspect ratio to 16:9, specify one of the following:
  8664. @example
  8665. setdar=dar=1.77777
  8666. setdar=dar=16/9
  8667. setdar=dar=1.77777
  8668. @end example
  8669. @item
  8670. To change the sample aspect ratio to 10:11, specify:
  8671. @example
  8672. setsar=sar=10/11
  8673. @end example
  8674. @item
  8675. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  8676. 1000 in the aspect ratio reduction, use the command:
  8677. @example
  8678. setdar=ratio=16/9:max=1000
  8679. @end example
  8680. @end itemize
  8681. @anchor{setfield}
  8682. @section setfield
  8683. Force field for the output video frame.
  8684. The @code{setfield} filter marks the interlace type field for the
  8685. output frames. It does not change the input frame, but only sets the
  8686. corresponding property, which affects how the frame is treated by
  8687. following filters (e.g. @code{fieldorder} or @code{yadif}).
  8688. The filter accepts the following options:
  8689. @table @option
  8690. @item mode
  8691. Available values are:
  8692. @table @samp
  8693. @item auto
  8694. Keep the same field property.
  8695. @item bff
  8696. Mark the frame as bottom-field-first.
  8697. @item tff
  8698. Mark the frame as top-field-first.
  8699. @item prog
  8700. Mark the frame as progressive.
  8701. @end table
  8702. @end table
  8703. @section showinfo
  8704. Show a line containing various information for each input video frame.
  8705. The input video is not modified.
  8706. The shown line contains a sequence of key/value pairs of the form
  8707. @var{key}:@var{value}.
  8708. The following values are shown in the output:
  8709. @table @option
  8710. @item n
  8711. The (sequential) number of the input frame, starting from 0.
  8712. @item pts
  8713. The Presentation TimeStamp of the input frame, expressed as a number of
  8714. time base units. The time base unit depends on the filter input pad.
  8715. @item pts_time
  8716. The Presentation TimeStamp of the input frame, expressed as a number of
  8717. seconds.
  8718. @item pos
  8719. The position of the frame in the input stream, or -1 if this information is
  8720. unavailable and/or meaningless (for example in case of synthetic video).
  8721. @item fmt
  8722. The pixel format name.
  8723. @item sar
  8724. The sample aspect ratio of the input frame, expressed in the form
  8725. @var{num}/@var{den}.
  8726. @item s
  8727. The size of the input frame. For the syntax of this option, check the
  8728. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8729. @item i
  8730. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  8731. for bottom field first).
  8732. @item iskey
  8733. This is 1 if the frame is a key frame, 0 otherwise.
  8734. @item type
  8735. The picture type of the input frame ("I" for an I-frame, "P" for a
  8736. P-frame, "B" for a B-frame, or "?" for an unknown type).
  8737. Also refer to the documentation of the @code{AVPictureType} enum and of
  8738. the @code{av_get_picture_type_char} function defined in
  8739. @file{libavutil/avutil.h}.
  8740. @item checksum
  8741. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  8742. @item plane_checksum
  8743. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  8744. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  8745. @end table
  8746. @section showpalette
  8747. Displays the 256 colors palette of each frame. This filter is only relevant for
  8748. @var{pal8} pixel format frames.
  8749. It accepts the following option:
  8750. @table @option
  8751. @item s
  8752. Set the size of the box used to represent one palette color entry. Default is
  8753. @code{30} (for a @code{30x30} pixel box).
  8754. @end table
  8755. @section shuffleframes
  8756. Reorder and/or duplicate video frames.
  8757. It accepts the following parameters:
  8758. @table @option
  8759. @item mapping
  8760. Set the destination indexes of input frames.
  8761. This is space or '|' separated list of indexes that maps input frames to output
  8762. frames. Number of indexes also sets maximal value that each index may have.
  8763. @end table
  8764. The first frame has the index 0. The default is to keep the input unchanged.
  8765. Swap second and third frame of every three frames of the input:
  8766. @example
  8767. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  8768. @end example
  8769. @section shuffleplanes
  8770. Reorder and/or duplicate video planes.
  8771. It accepts the following parameters:
  8772. @table @option
  8773. @item map0
  8774. The index of the input plane to be used as the first output plane.
  8775. @item map1
  8776. The index of the input plane to be used as the second output plane.
  8777. @item map2
  8778. The index of the input plane to be used as the third output plane.
  8779. @item map3
  8780. The index of the input plane to be used as the fourth output plane.
  8781. @end table
  8782. The first plane has the index 0. The default is to keep the input unchanged.
  8783. Swap the second and third planes of the input:
  8784. @example
  8785. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  8786. @end example
  8787. @anchor{signalstats}
  8788. @section signalstats
  8789. Evaluate various visual metrics that assist in determining issues associated
  8790. with the digitization of analog video media.
  8791. By default the filter will log these metadata values:
  8792. @table @option
  8793. @item YMIN
  8794. Display the minimal Y value contained within the input frame. Expressed in
  8795. range of [0-255].
  8796. @item YLOW
  8797. Display the Y value at the 10% percentile within the input frame. Expressed in
  8798. range of [0-255].
  8799. @item YAVG
  8800. Display the average Y value within the input frame. Expressed in range of
  8801. [0-255].
  8802. @item YHIGH
  8803. Display the Y value at the 90% percentile within the input frame. Expressed in
  8804. range of [0-255].
  8805. @item YMAX
  8806. Display the maximum Y value contained within the input frame. Expressed in
  8807. range of [0-255].
  8808. @item UMIN
  8809. Display the minimal U value contained within the input frame. Expressed in
  8810. range of [0-255].
  8811. @item ULOW
  8812. Display the U value at the 10% percentile within the input frame. Expressed in
  8813. range of [0-255].
  8814. @item UAVG
  8815. Display the average U value within the input frame. Expressed in range of
  8816. [0-255].
  8817. @item UHIGH
  8818. Display the U value at the 90% percentile within the input frame. Expressed in
  8819. range of [0-255].
  8820. @item UMAX
  8821. Display the maximum U value contained within the input frame. Expressed in
  8822. range of [0-255].
  8823. @item VMIN
  8824. Display the minimal V value contained within the input frame. Expressed in
  8825. range of [0-255].
  8826. @item VLOW
  8827. Display the V value at the 10% percentile within the input frame. Expressed in
  8828. range of [0-255].
  8829. @item VAVG
  8830. Display the average V value within the input frame. Expressed in range of
  8831. [0-255].
  8832. @item VHIGH
  8833. Display the V value at the 90% percentile within the input frame. Expressed in
  8834. range of [0-255].
  8835. @item VMAX
  8836. Display the maximum V value contained within the input frame. Expressed in
  8837. range of [0-255].
  8838. @item SATMIN
  8839. Display the minimal saturation value contained within the input frame.
  8840. Expressed in range of [0-~181.02].
  8841. @item SATLOW
  8842. Display the saturation value at the 10% percentile within the input frame.
  8843. Expressed in range of [0-~181.02].
  8844. @item SATAVG
  8845. Display the average saturation value within the input frame. Expressed in range
  8846. of [0-~181.02].
  8847. @item SATHIGH
  8848. Display the saturation value at the 90% percentile within the input frame.
  8849. Expressed in range of [0-~181.02].
  8850. @item SATMAX
  8851. Display the maximum saturation value contained within the input frame.
  8852. Expressed in range of [0-~181.02].
  8853. @item HUEMED
  8854. Display the median value for hue within the input frame. Expressed in range of
  8855. [0-360].
  8856. @item HUEAVG
  8857. Display the average value for hue within the input frame. Expressed in range of
  8858. [0-360].
  8859. @item YDIF
  8860. Display the average of sample value difference between all values of the Y
  8861. plane in the current frame and corresponding values of the previous input frame.
  8862. Expressed in range of [0-255].
  8863. @item UDIF
  8864. Display the average of sample value difference between all values of the U
  8865. plane in the current frame and corresponding values of the previous input frame.
  8866. Expressed in range of [0-255].
  8867. @item VDIF
  8868. Display the average of sample value difference between all values of the V
  8869. plane in the current frame and corresponding values of the previous input frame.
  8870. Expressed in range of [0-255].
  8871. @end table
  8872. The filter accepts the following options:
  8873. @table @option
  8874. @item stat
  8875. @item out
  8876. @option{stat} specify an additional form of image analysis.
  8877. @option{out} output video with the specified type of pixel highlighted.
  8878. Both options accept the following values:
  8879. @table @samp
  8880. @item tout
  8881. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  8882. unlike the neighboring pixels of the same field. Examples of temporal outliers
  8883. include the results of video dropouts, head clogs, or tape tracking issues.
  8884. @item vrep
  8885. Identify @var{vertical line repetition}. Vertical line repetition includes
  8886. similar rows of pixels within a frame. In born-digital video vertical line
  8887. repetition is common, but this pattern is uncommon in video digitized from an
  8888. analog source. When it occurs in video that results from the digitization of an
  8889. analog source it can indicate concealment from a dropout compensator.
  8890. @item brng
  8891. Identify pixels that fall outside of legal broadcast range.
  8892. @end table
  8893. @item color, c
  8894. Set the highlight color for the @option{out} option. The default color is
  8895. yellow.
  8896. @end table
  8897. @subsection Examples
  8898. @itemize
  8899. @item
  8900. Output data of various video metrics:
  8901. @example
  8902. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  8903. @end example
  8904. @item
  8905. Output specific data about the minimum and maximum values of the Y plane per frame:
  8906. @example
  8907. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  8908. @end example
  8909. @item
  8910. Playback video while highlighting pixels that are outside of broadcast range in red.
  8911. @example
  8912. ffplay example.mov -vf signalstats="out=brng:color=red"
  8913. @end example
  8914. @item
  8915. Playback video with signalstats metadata drawn over the frame.
  8916. @example
  8917. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  8918. @end example
  8919. The contents of signalstat_drawtext.txt used in the command are:
  8920. @example
  8921. time %@{pts:hms@}
  8922. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  8923. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  8924. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  8925. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  8926. @end example
  8927. @end itemize
  8928. @anchor{smartblur}
  8929. @section smartblur
  8930. Blur the input video without impacting the outlines.
  8931. It accepts the following options:
  8932. @table @option
  8933. @item luma_radius, lr
  8934. Set the luma radius. The option value must be a float number in
  8935. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8936. used to blur the image (slower if larger). Default value is 1.0.
  8937. @item luma_strength, ls
  8938. Set the luma strength. The option value must be a float number
  8939. in the range [-1.0,1.0] that configures the blurring. A value included
  8940. in [0.0,1.0] will blur the image whereas a value included in
  8941. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8942. @item luma_threshold, lt
  8943. Set the luma threshold used as a coefficient to determine
  8944. whether a pixel should be blurred or not. The option value must be an
  8945. integer in the range [-30,30]. A value of 0 will filter all the image,
  8946. a value included in [0,30] will filter flat areas and a value included
  8947. in [-30,0] will filter edges. Default value is 0.
  8948. @item chroma_radius, cr
  8949. Set the chroma radius. The option value must be a float number in
  8950. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8951. used to blur the image (slower if larger). Default value is 1.0.
  8952. @item chroma_strength, cs
  8953. Set the chroma strength. The option value must be a float number
  8954. in the range [-1.0,1.0] that configures the blurring. A value included
  8955. in [0.0,1.0] will blur the image whereas a value included in
  8956. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8957. @item chroma_threshold, ct
  8958. Set the chroma threshold used as a coefficient to determine
  8959. whether a pixel should be blurred or not. The option value must be an
  8960. integer in the range [-30,30]. A value of 0 will filter all the image,
  8961. a value included in [0,30] will filter flat areas and a value included
  8962. in [-30,0] will filter edges. Default value is 0.
  8963. @end table
  8964. If a chroma option is not explicitly set, the corresponding luma value
  8965. is set.
  8966. @section ssim
  8967. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  8968. This filter takes in input two input videos, the first input is
  8969. considered the "main" source and is passed unchanged to the
  8970. output. The second input is used as a "reference" video for computing
  8971. the SSIM.
  8972. Both video inputs must have the same resolution and pixel format for
  8973. this filter to work correctly. Also it assumes that both inputs
  8974. have the same number of frames, which are compared one by one.
  8975. The filter stores the calculated SSIM of each frame.
  8976. The description of the accepted parameters follows.
  8977. @table @option
  8978. @item stats_file, f
  8979. If specified the filter will use the named file to save the SSIM of
  8980. each individual frame. When filename equals "-" the data is sent to
  8981. standard output.
  8982. @end table
  8983. The file printed if @var{stats_file} is selected, contains a sequence of
  8984. key/value pairs of the form @var{key}:@var{value} for each compared
  8985. couple of frames.
  8986. A description of each shown parameter follows:
  8987. @table @option
  8988. @item n
  8989. sequential number of the input frame, starting from 1
  8990. @item Y, U, V, R, G, B
  8991. SSIM of the compared frames for the component specified by the suffix.
  8992. @item All
  8993. SSIM of the compared frames for the whole frame.
  8994. @item dB
  8995. Same as above but in dB representation.
  8996. @end table
  8997. For example:
  8998. @example
  8999. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9000. [main][ref] ssim="stats_file=stats.log" [out]
  9001. @end example
  9002. On this example the input file being processed is compared with the
  9003. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9004. is stored in @file{stats.log}.
  9005. Another example with both psnr and ssim at same time:
  9006. @example
  9007. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9008. @end example
  9009. @section stereo3d
  9010. Convert between different stereoscopic image formats.
  9011. The filters accept the following options:
  9012. @table @option
  9013. @item in
  9014. Set stereoscopic image format of input.
  9015. Available values for input image formats are:
  9016. @table @samp
  9017. @item sbsl
  9018. side by side parallel (left eye left, right eye right)
  9019. @item sbsr
  9020. side by side crosseye (right eye left, left eye right)
  9021. @item sbs2l
  9022. side by side parallel with half width resolution
  9023. (left eye left, right eye right)
  9024. @item sbs2r
  9025. side by side crosseye with half width resolution
  9026. (right eye left, left eye right)
  9027. @item abl
  9028. above-below (left eye above, right eye below)
  9029. @item abr
  9030. above-below (right eye above, left eye below)
  9031. @item ab2l
  9032. above-below with half height resolution
  9033. (left eye above, right eye below)
  9034. @item ab2r
  9035. above-below with half height resolution
  9036. (right eye above, left eye below)
  9037. @item al
  9038. alternating frames (left eye first, right eye second)
  9039. @item ar
  9040. alternating frames (right eye first, left eye second)
  9041. @item irl
  9042. interleaved rows (left eye has top row, right eye starts on next row)
  9043. @item irr
  9044. interleaved rows (right eye has top row, left eye starts on next row)
  9045. @item icl
  9046. interleaved columns, left eye first
  9047. @item icr
  9048. interleaved columns, right eye first
  9049. Default value is @samp{sbsl}.
  9050. @end table
  9051. @item out
  9052. Set stereoscopic image format of output.
  9053. @table @samp
  9054. @item sbsl
  9055. side by side parallel (left eye left, right eye right)
  9056. @item sbsr
  9057. side by side crosseye (right eye left, left eye right)
  9058. @item sbs2l
  9059. side by side parallel with half width resolution
  9060. (left eye left, right eye right)
  9061. @item sbs2r
  9062. side by side crosseye with half width resolution
  9063. (right eye left, left eye right)
  9064. @item abl
  9065. above-below (left eye above, right eye below)
  9066. @item abr
  9067. above-below (right eye above, left eye below)
  9068. @item ab2l
  9069. above-below with half height resolution
  9070. (left eye above, right eye below)
  9071. @item ab2r
  9072. above-below with half height resolution
  9073. (right eye above, left eye below)
  9074. @item al
  9075. alternating frames (left eye first, right eye second)
  9076. @item ar
  9077. alternating frames (right eye first, left eye second)
  9078. @item irl
  9079. interleaved rows (left eye has top row, right eye starts on next row)
  9080. @item irr
  9081. interleaved rows (right eye has top row, left eye starts on next row)
  9082. @item arbg
  9083. anaglyph red/blue gray
  9084. (red filter on left eye, blue filter on right eye)
  9085. @item argg
  9086. anaglyph red/green gray
  9087. (red filter on left eye, green filter on right eye)
  9088. @item arcg
  9089. anaglyph red/cyan gray
  9090. (red filter on left eye, cyan filter on right eye)
  9091. @item arch
  9092. anaglyph red/cyan half colored
  9093. (red filter on left eye, cyan filter on right eye)
  9094. @item arcc
  9095. anaglyph red/cyan color
  9096. (red filter on left eye, cyan filter on right eye)
  9097. @item arcd
  9098. anaglyph red/cyan color optimized with the least squares projection of dubois
  9099. (red filter on left eye, cyan filter on right eye)
  9100. @item agmg
  9101. anaglyph green/magenta gray
  9102. (green filter on left eye, magenta filter on right eye)
  9103. @item agmh
  9104. anaglyph green/magenta half colored
  9105. (green filter on left eye, magenta filter on right eye)
  9106. @item agmc
  9107. anaglyph green/magenta colored
  9108. (green filter on left eye, magenta filter on right eye)
  9109. @item agmd
  9110. anaglyph green/magenta color optimized with the least squares projection of dubois
  9111. (green filter on left eye, magenta filter on right eye)
  9112. @item aybg
  9113. anaglyph yellow/blue gray
  9114. (yellow filter on left eye, blue filter on right eye)
  9115. @item aybh
  9116. anaglyph yellow/blue half colored
  9117. (yellow filter on left eye, blue filter on right eye)
  9118. @item aybc
  9119. anaglyph yellow/blue colored
  9120. (yellow filter on left eye, blue filter on right eye)
  9121. @item aybd
  9122. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9123. (yellow filter on left eye, blue filter on right eye)
  9124. @item ml
  9125. mono output (left eye only)
  9126. @item mr
  9127. mono output (right eye only)
  9128. @item chl
  9129. checkerboard, left eye first
  9130. @item chr
  9131. checkerboard, right eye first
  9132. @item icl
  9133. interleaved columns, left eye first
  9134. @item icr
  9135. interleaved columns, right eye first
  9136. @end table
  9137. Default value is @samp{arcd}.
  9138. @end table
  9139. @subsection Examples
  9140. @itemize
  9141. @item
  9142. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9143. @example
  9144. stereo3d=sbsl:aybd
  9145. @end example
  9146. @item
  9147. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9148. @example
  9149. stereo3d=abl:sbsr
  9150. @end example
  9151. @end itemize
  9152. @section streamselect, astreamselect
  9153. Select video or audio streams.
  9154. The filter accepts the following options:
  9155. @table @option
  9156. @item inputs
  9157. Set number of inputs. Default is 2.
  9158. @item map
  9159. Set input indexes to remap to outputs.
  9160. @end table
  9161. @subsection Commands
  9162. The @code{streamselect} and @code{astreamselect} filter supports the following
  9163. commands:
  9164. @table @option
  9165. @item map
  9166. Set input indexes to remap to outputs.
  9167. @end table
  9168. @subsection Examples
  9169. @itemize
  9170. @item
  9171. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9172. @example
  9173. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9174. @end example
  9175. @item
  9176. Same as above, but for audio:
  9177. @example
  9178. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9179. @end example
  9180. @end itemize
  9181. @anchor{spp}
  9182. @section spp
  9183. Apply a simple postprocessing filter that compresses and decompresses the image
  9184. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9185. and average the results.
  9186. The filter accepts the following options:
  9187. @table @option
  9188. @item quality
  9189. Set quality. This option defines the number of levels for averaging. It accepts
  9190. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9191. effect. A value of @code{6} means the higher quality. For each increment of
  9192. that value the speed drops by a factor of approximately 2. Default value is
  9193. @code{3}.
  9194. @item qp
  9195. Force a constant quantization parameter. If not set, the filter will use the QP
  9196. from the video stream (if available).
  9197. @item mode
  9198. Set thresholding mode. Available modes are:
  9199. @table @samp
  9200. @item hard
  9201. Set hard thresholding (default).
  9202. @item soft
  9203. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9204. @end table
  9205. @item use_bframe_qp
  9206. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9207. option may cause flicker since the B-Frames have often larger QP. Default is
  9208. @code{0} (not enabled).
  9209. @end table
  9210. @anchor{subtitles}
  9211. @section subtitles
  9212. Draw subtitles on top of input video using the libass library.
  9213. To enable compilation of this filter you need to configure FFmpeg with
  9214. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9215. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9216. Alpha) subtitles format.
  9217. The filter accepts the following options:
  9218. @table @option
  9219. @item filename, f
  9220. Set the filename of the subtitle file to read. It must be specified.
  9221. @item original_size
  9222. Specify the size of the original video, the video for which the ASS file
  9223. was composed. For the syntax of this option, check the
  9224. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9225. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9226. correctly scale the fonts if the aspect ratio has been changed.
  9227. @item fontsdir
  9228. Set a directory path containing fonts that can be used by the filter.
  9229. These fonts will be used in addition to whatever the font provider uses.
  9230. @item charenc
  9231. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9232. useful if not UTF-8.
  9233. @item stream_index, si
  9234. Set subtitles stream index. @code{subtitles} filter only.
  9235. @item force_style
  9236. Override default style or script info parameters of the subtitles. It accepts a
  9237. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9238. @end table
  9239. If the first key is not specified, it is assumed that the first value
  9240. specifies the @option{filename}.
  9241. For example, to render the file @file{sub.srt} on top of the input
  9242. video, use the command:
  9243. @example
  9244. subtitles=sub.srt
  9245. @end example
  9246. which is equivalent to:
  9247. @example
  9248. subtitles=filename=sub.srt
  9249. @end example
  9250. To render the default subtitles stream from file @file{video.mkv}, use:
  9251. @example
  9252. subtitles=video.mkv
  9253. @end example
  9254. To render the second subtitles stream from that file, use:
  9255. @example
  9256. subtitles=video.mkv:si=1
  9257. @end example
  9258. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9259. @code{DejaVu Serif}, use:
  9260. @example
  9261. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9262. @end example
  9263. @section super2xsai
  9264. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9265. Interpolate) pixel art scaling algorithm.
  9266. Useful for enlarging pixel art images without reducing sharpness.
  9267. @section swaprect
  9268. Swap two rectangular objects in video.
  9269. This filter accepts the following options:
  9270. @table @option
  9271. @item w
  9272. Set object width.
  9273. @item h
  9274. Set object height.
  9275. @item x1
  9276. Set 1st rect x coordinate.
  9277. @item y1
  9278. Set 1st rect y coordinate.
  9279. @item x2
  9280. Set 2nd rect x coordinate.
  9281. @item y2
  9282. Set 2nd rect y coordinate.
  9283. All expressions are evaluated once for each frame.
  9284. @end table
  9285. The all options are expressions containing the following constants:
  9286. @table @option
  9287. @item w
  9288. @item h
  9289. The input width and height.
  9290. @item a
  9291. same as @var{w} / @var{h}
  9292. @item sar
  9293. input sample aspect ratio
  9294. @item dar
  9295. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9296. @item n
  9297. The number of the input frame, starting from 0.
  9298. @item t
  9299. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9300. @item pos
  9301. the position in the file of the input frame, NAN if unknown
  9302. @end table
  9303. @section swapuv
  9304. Swap U & V plane.
  9305. @section telecine
  9306. Apply telecine process to the video.
  9307. This filter accepts the following options:
  9308. @table @option
  9309. @item first_field
  9310. @table @samp
  9311. @item top, t
  9312. top field first
  9313. @item bottom, b
  9314. bottom field first
  9315. The default value is @code{top}.
  9316. @end table
  9317. @item pattern
  9318. A string of numbers representing the pulldown pattern you wish to apply.
  9319. The default value is @code{23}.
  9320. @end table
  9321. @example
  9322. Some typical patterns:
  9323. NTSC output (30i):
  9324. 27.5p: 32222
  9325. 24p: 23 (classic)
  9326. 24p: 2332 (preferred)
  9327. 20p: 33
  9328. 18p: 334
  9329. 16p: 3444
  9330. PAL output (25i):
  9331. 27.5p: 12222
  9332. 24p: 222222222223 ("Euro pulldown")
  9333. 16.67p: 33
  9334. 16p: 33333334
  9335. @end example
  9336. @section thumbnail
  9337. Select the most representative frame in a given sequence of consecutive frames.
  9338. The filter accepts the following options:
  9339. @table @option
  9340. @item n
  9341. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  9342. will pick one of them, and then handle the next batch of @var{n} frames until
  9343. the end. Default is @code{100}.
  9344. @end table
  9345. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  9346. value will result in a higher memory usage, so a high value is not recommended.
  9347. @subsection Examples
  9348. @itemize
  9349. @item
  9350. Extract one picture each 50 frames:
  9351. @example
  9352. thumbnail=50
  9353. @end example
  9354. @item
  9355. Complete example of a thumbnail creation with @command{ffmpeg}:
  9356. @example
  9357. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  9358. @end example
  9359. @end itemize
  9360. @section tile
  9361. Tile several successive frames together.
  9362. The filter accepts the following options:
  9363. @table @option
  9364. @item layout
  9365. Set the grid size (i.e. the number of lines and columns). For the syntax of
  9366. this option, check the
  9367. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9368. @item nb_frames
  9369. Set the maximum number of frames to render in the given area. It must be less
  9370. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  9371. the area will be used.
  9372. @item margin
  9373. Set the outer border margin in pixels.
  9374. @item padding
  9375. Set the inner border thickness (i.e. the number of pixels between frames). For
  9376. more advanced padding options (such as having different values for the edges),
  9377. refer to the pad video filter.
  9378. @item color
  9379. Specify the color of the unused area. For the syntax of this option, check the
  9380. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  9381. is "black".
  9382. @end table
  9383. @subsection Examples
  9384. @itemize
  9385. @item
  9386. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  9387. @example
  9388. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  9389. @end example
  9390. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  9391. duplicating each output frame to accommodate the originally detected frame
  9392. rate.
  9393. @item
  9394. Display @code{5} pictures in an area of @code{3x2} frames,
  9395. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  9396. mixed flat and named options:
  9397. @example
  9398. tile=3x2:nb_frames=5:padding=7:margin=2
  9399. @end example
  9400. @end itemize
  9401. @section tinterlace
  9402. Perform various types of temporal field interlacing.
  9403. Frames are counted starting from 1, so the first input frame is
  9404. considered odd.
  9405. The filter accepts the following options:
  9406. @table @option
  9407. @item mode
  9408. Specify the mode of the interlacing. This option can also be specified
  9409. as a value alone. See below for a list of values for this option.
  9410. Available values are:
  9411. @table @samp
  9412. @item merge, 0
  9413. Move odd frames into the upper field, even into the lower field,
  9414. generating a double height frame at half frame rate.
  9415. @example
  9416. ------> time
  9417. Input:
  9418. Frame 1 Frame 2 Frame 3 Frame 4
  9419. 11111 22222 33333 44444
  9420. 11111 22222 33333 44444
  9421. 11111 22222 33333 44444
  9422. 11111 22222 33333 44444
  9423. Output:
  9424. 11111 33333
  9425. 22222 44444
  9426. 11111 33333
  9427. 22222 44444
  9428. 11111 33333
  9429. 22222 44444
  9430. 11111 33333
  9431. 22222 44444
  9432. @end example
  9433. @item drop_odd, 1
  9434. Only output even frames, odd frames are dropped, generating a frame with
  9435. unchanged height at half frame rate.
  9436. @example
  9437. ------> time
  9438. Input:
  9439. Frame 1 Frame 2 Frame 3 Frame 4
  9440. 11111 22222 33333 44444
  9441. 11111 22222 33333 44444
  9442. 11111 22222 33333 44444
  9443. 11111 22222 33333 44444
  9444. Output:
  9445. 22222 44444
  9446. 22222 44444
  9447. 22222 44444
  9448. 22222 44444
  9449. @end example
  9450. @item drop_even, 2
  9451. Only output odd frames, even frames are dropped, generating a frame with
  9452. unchanged height at half frame rate.
  9453. @example
  9454. ------> time
  9455. Input:
  9456. Frame 1 Frame 2 Frame 3 Frame 4
  9457. 11111 22222 33333 44444
  9458. 11111 22222 33333 44444
  9459. 11111 22222 33333 44444
  9460. 11111 22222 33333 44444
  9461. Output:
  9462. 11111 33333
  9463. 11111 33333
  9464. 11111 33333
  9465. 11111 33333
  9466. @end example
  9467. @item pad, 3
  9468. Expand each frame to full height, but pad alternate lines with black,
  9469. generating a frame with double height at the same input frame rate.
  9470. @example
  9471. ------> time
  9472. Input:
  9473. Frame 1 Frame 2 Frame 3 Frame 4
  9474. 11111 22222 33333 44444
  9475. 11111 22222 33333 44444
  9476. 11111 22222 33333 44444
  9477. 11111 22222 33333 44444
  9478. Output:
  9479. 11111 ..... 33333 .....
  9480. ..... 22222 ..... 44444
  9481. 11111 ..... 33333 .....
  9482. ..... 22222 ..... 44444
  9483. 11111 ..... 33333 .....
  9484. ..... 22222 ..... 44444
  9485. 11111 ..... 33333 .....
  9486. ..... 22222 ..... 44444
  9487. @end example
  9488. @item interleave_top, 4
  9489. Interleave the upper field from odd frames with the lower field from
  9490. even frames, generating a frame with unchanged height at half frame rate.
  9491. @example
  9492. ------> time
  9493. Input:
  9494. Frame 1 Frame 2 Frame 3 Frame 4
  9495. 11111<- 22222 33333<- 44444
  9496. 11111 22222<- 33333 44444<-
  9497. 11111<- 22222 33333<- 44444
  9498. 11111 22222<- 33333 44444<-
  9499. Output:
  9500. 11111 33333
  9501. 22222 44444
  9502. 11111 33333
  9503. 22222 44444
  9504. @end example
  9505. @item interleave_bottom, 5
  9506. Interleave the lower field from odd frames with the upper field from
  9507. even frames, generating a frame with unchanged height at half frame rate.
  9508. @example
  9509. ------> time
  9510. Input:
  9511. Frame 1 Frame 2 Frame 3 Frame 4
  9512. 11111 22222<- 33333 44444<-
  9513. 11111<- 22222 33333<- 44444
  9514. 11111 22222<- 33333 44444<-
  9515. 11111<- 22222 33333<- 44444
  9516. Output:
  9517. 22222 44444
  9518. 11111 33333
  9519. 22222 44444
  9520. 11111 33333
  9521. @end example
  9522. @item interlacex2, 6
  9523. Double frame rate with unchanged height. Frames are inserted each
  9524. containing the second temporal field from the previous input frame and
  9525. the first temporal field from the next input frame. This mode relies on
  9526. the top_field_first flag. Useful for interlaced video displays with no
  9527. field synchronisation.
  9528. @example
  9529. ------> time
  9530. Input:
  9531. Frame 1 Frame 2 Frame 3 Frame 4
  9532. 11111 22222 33333 44444
  9533. 11111 22222 33333 44444
  9534. 11111 22222 33333 44444
  9535. 11111 22222 33333 44444
  9536. Output:
  9537. 11111 22222 22222 33333 33333 44444 44444
  9538. 11111 11111 22222 22222 33333 33333 44444
  9539. 11111 22222 22222 33333 33333 44444 44444
  9540. 11111 11111 22222 22222 33333 33333 44444
  9541. @end example
  9542. @item mergex2, 7
  9543. Move odd frames into the upper field, even into the lower field,
  9544. generating a double height frame at same frame rate.
  9545. @example
  9546. ------> time
  9547. Input:
  9548. Frame 1 Frame 2 Frame 3 Frame 4
  9549. 11111 22222 33333 44444
  9550. 11111 22222 33333 44444
  9551. 11111 22222 33333 44444
  9552. 11111 22222 33333 44444
  9553. Output:
  9554. 11111 33333 33333 55555
  9555. 22222 22222 44444 44444
  9556. 11111 33333 33333 55555
  9557. 22222 22222 44444 44444
  9558. 11111 33333 33333 55555
  9559. 22222 22222 44444 44444
  9560. 11111 33333 33333 55555
  9561. 22222 22222 44444 44444
  9562. @end example
  9563. @end table
  9564. Numeric values are deprecated but are accepted for backward
  9565. compatibility reasons.
  9566. Default mode is @code{merge}.
  9567. @item flags
  9568. Specify flags influencing the filter process.
  9569. Available value for @var{flags} is:
  9570. @table @option
  9571. @item low_pass_filter, vlfp
  9572. Enable vertical low-pass filtering in the filter.
  9573. Vertical low-pass filtering is required when creating an interlaced
  9574. destination from a progressive source which contains high-frequency
  9575. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  9576. patterning.
  9577. Vertical low-pass filtering can only be enabled for @option{mode}
  9578. @var{interleave_top} and @var{interleave_bottom}.
  9579. @end table
  9580. @end table
  9581. @section transpose
  9582. Transpose rows with columns in the input video and optionally flip it.
  9583. It accepts the following parameters:
  9584. @table @option
  9585. @item dir
  9586. Specify the transposition direction.
  9587. Can assume the following values:
  9588. @table @samp
  9589. @item 0, 4, cclock_flip
  9590. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  9591. @example
  9592. L.R L.l
  9593. . . -> . .
  9594. l.r R.r
  9595. @end example
  9596. @item 1, 5, clock
  9597. Rotate by 90 degrees clockwise, that is:
  9598. @example
  9599. L.R l.L
  9600. . . -> . .
  9601. l.r r.R
  9602. @end example
  9603. @item 2, 6, cclock
  9604. Rotate by 90 degrees counterclockwise, that is:
  9605. @example
  9606. L.R R.r
  9607. . . -> . .
  9608. l.r L.l
  9609. @end example
  9610. @item 3, 7, clock_flip
  9611. Rotate by 90 degrees clockwise and vertically flip, that is:
  9612. @example
  9613. L.R r.R
  9614. . . -> . .
  9615. l.r l.L
  9616. @end example
  9617. @end table
  9618. For values between 4-7, the transposition is only done if the input
  9619. video geometry is portrait and not landscape. These values are
  9620. deprecated, the @code{passthrough} option should be used instead.
  9621. Numerical values are deprecated, and should be dropped in favor of
  9622. symbolic constants.
  9623. @item passthrough
  9624. Do not apply the transposition if the input geometry matches the one
  9625. specified by the specified value. It accepts the following values:
  9626. @table @samp
  9627. @item none
  9628. Always apply transposition.
  9629. @item portrait
  9630. Preserve portrait geometry (when @var{height} >= @var{width}).
  9631. @item landscape
  9632. Preserve landscape geometry (when @var{width} >= @var{height}).
  9633. @end table
  9634. Default value is @code{none}.
  9635. @end table
  9636. For example to rotate by 90 degrees clockwise and preserve portrait
  9637. layout:
  9638. @example
  9639. transpose=dir=1:passthrough=portrait
  9640. @end example
  9641. The command above can also be specified as:
  9642. @example
  9643. transpose=1:portrait
  9644. @end example
  9645. @section trim
  9646. Trim the input so that the output contains one continuous subpart of the input.
  9647. It accepts the following parameters:
  9648. @table @option
  9649. @item start
  9650. Specify the time of the start of the kept section, i.e. the frame with the
  9651. timestamp @var{start} will be the first frame in the output.
  9652. @item end
  9653. Specify the time of the first frame that will be dropped, i.e. the frame
  9654. immediately preceding the one with the timestamp @var{end} will be the last
  9655. frame in the output.
  9656. @item start_pts
  9657. This is the same as @var{start}, except this option sets the start timestamp
  9658. in timebase units instead of seconds.
  9659. @item end_pts
  9660. This is the same as @var{end}, except this option sets the end timestamp
  9661. in timebase units instead of seconds.
  9662. @item duration
  9663. The maximum duration of the output in seconds.
  9664. @item start_frame
  9665. The number of the first frame that should be passed to the output.
  9666. @item end_frame
  9667. The number of the first frame that should be dropped.
  9668. @end table
  9669. @option{start}, @option{end}, and @option{duration} are expressed as time
  9670. duration specifications; see
  9671. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9672. for the accepted syntax.
  9673. Note that the first two sets of the start/end options and the @option{duration}
  9674. option look at the frame timestamp, while the _frame variants simply count the
  9675. frames that pass through the filter. Also note that this filter does not modify
  9676. the timestamps. If you wish for the output timestamps to start at zero, insert a
  9677. setpts filter after the trim filter.
  9678. If multiple start or end options are set, this filter tries to be greedy and
  9679. keep all the frames that match at least one of the specified constraints. To keep
  9680. only the part that matches all the constraints at once, chain multiple trim
  9681. filters.
  9682. The defaults are such that all the input is kept. So it is possible to set e.g.
  9683. just the end values to keep everything before the specified time.
  9684. Examples:
  9685. @itemize
  9686. @item
  9687. Drop everything except the second minute of input:
  9688. @example
  9689. ffmpeg -i INPUT -vf trim=60:120
  9690. @end example
  9691. @item
  9692. Keep only the first second:
  9693. @example
  9694. ffmpeg -i INPUT -vf trim=duration=1
  9695. @end example
  9696. @end itemize
  9697. @anchor{unsharp}
  9698. @section unsharp
  9699. Sharpen or blur the input video.
  9700. It accepts the following parameters:
  9701. @table @option
  9702. @item luma_msize_x, lx
  9703. Set the luma matrix horizontal size. It must be an odd integer between
  9704. 3 and 63. The default value is 5.
  9705. @item luma_msize_y, ly
  9706. Set the luma matrix vertical size. It must be an odd integer between 3
  9707. and 63. The default value is 5.
  9708. @item luma_amount, la
  9709. Set the luma effect strength. It must be a floating point number, reasonable
  9710. values lay between -1.5 and 1.5.
  9711. Negative values will blur the input video, while positive values will
  9712. sharpen it, a value of zero will disable the effect.
  9713. Default value is 1.0.
  9714. @item chroma_msize_x, cx
  9715. Set the chroma matrix horizontal size. It must be an odd integer
  9716. between 3 and 63. The default value is 5.
  9717. @item chroma_msize_y, cy
  9718. Set the chroma matrix vertical size. It must be an odd integer
  9719. between 3 and 63. The default value is 5.
  9720. @item chroma_amount, ca
  9721. Set the chroma effect strength. It must be a floating point number, reasonable
  9722. values lay between -1.5 and 1.5.
  9723. Negative values will blur the input video, while positive values will
  9724. sharpen it, a value of zero will disable the effect.
  9725. Default value is 0.0.
  9726. @item opencl
  9727. If set to 1, specify using OpenCL capabilities, only available if
  9728. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  9729. @end table
  9730. All parameters are optional and default to the equivalent of the
  9731. string '5:5:1.0:5:5:0.0'.
  9732. @subsection Examples
  9733. @itemize
  9734. @item
  9735. Apply strong luma sharpen effect:
  9736. @example
  9737. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  9738. @end example
  9739. @item
  9740. Apply a strong blur of both luma and chroma parameters:
  9741. @example
  9742. unsharp=7:7:-2:7:7:-2
  9743. @end example
  9744. @end itemize
  9745. @section uspp
  9746. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  9747. the image at several (or - in the case of @option{quality} level @code{8} - all)
  9748. shifts and average the results.
  9749. The way this differs from the behavior of spp is that uspp actually encodes &
  9750. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  9751. DCT similar to MJPEG.
  9752. The filter accepts the following options:
  9753. @table @option
  9754. @item quality
  9755. Set quality. This option defines the number of levels for averaging. It accepts
  9756. an integer in the range 0-8. If set to @code{0}, the filter will have no
  9757. effect. A value of @code{8} means the higher quality. For each increment of
  9758. that value the speed drops by a factor of approximately 2. Default value is
  9759. @code{3}.
  9760. @item qp
  9761. Force a constant quantization parameter. If not set, the filter will use the QP
  9762. from the video stream (if available).
  9763. @end table
  9764. @section vectorscope
  9765. Display 2 color component values in the two dimensional graph (which is called
  9766. a vectorscope).
  9767. This filter accepts the following options:
  9768. @table @option
  9769. @item mode, m
  9770. Set vectorscope mode.
  9771. It accepts the following values:
  9772. @table @samp
  9773. @item gray
  9774. Gray values are displayed on graph, higher brightness means more pixels have
  9775. same component color value on location in graph. This is the default mode.
  9776. @item color
  9777. Gray values are displayed on graph. Surrounding pixels values which are not
  9778. present in video frame are drawn in gradient of 2 color components which are
  9779. set by option @code{x} and @code{y}. The 3rd color component is static.
  9780. @item color2
  9781. Actual color components values present in video frame are displayed on graph.
  9782. @item color3
  9783. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  9784. on graph increases value of another color component, which is luminance by
  9785. default values of @code{x} and @code{y}.
  9786. @item color4
  9787. Actual colors present in video frame are displayed on graph. If two different
  9788. colors map to same position on graph then color with higher value of component
  9789. not present in graph is picked.
  9790. @item color5
  9791. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  9792. component picked from radial gradient.
  9793. @end table
  9794. @item x
  9795. Set which color component will be represented on X-axis. Default is @code{1}.
  9796. @item y
  9797. Set which color component will be represented on Y-axis. Default is @code{2}.
  9798. @item intensity, i
  9799. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  9800. of color component which represents frequency of (X, Y) location in graph.
  9801. @item envelope, e
  9802. @table @samp
  9803. @item none
  9804. No envelope, this is default.
  9805. @item instant
  9806. Instant envelope, even darkest single pixel will be clearly highlighted.
  9807. @item peak
  9808. Hold maximum and minimum values presented in graph over time. This way you
  9809. can still spot out of range values without constantly looking at vectorscope.
  9810. @item peak+instant
  9811. Peak and instant envelope combined together.
  9812. @end table
  9813. @item graticule, g
  9814. Set what kind of graticule to draw.
  9815. @table @samp
  9816. @item none
  9817. @item green
  9818. @item color
  9819. @end table
  9820. @item opacity, o
  9821. Set graticule opacity.
  9822. @item flags, f
  9823. Set graticule flags.
  9824. @table @samp
  9825. @item white
  9826. Draw graticule for white point.
  9827. @item black
  9828. Draw graticule for black point.
  9829. @item name
  9830. Draw color points short names.
  9831. @end table
  9832. @item bgopacity, b
  9833. Set background opacity.
  9834. @item lthreshold, l
  9835. Set low threshold for color component not represented on X or Y axis.
  9836. Values lower than this value will be ignored. Default is 0.
  9837. Note this value is multiplied with actual max possible value one pixel component
  9838. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  9839. is 0.1 * 255 = 25.
  9840. @item hthreshold, h
  9841. Set high threshold for color component not represented on X or Y axis.
  9842. Values higher than this value will be ignored. Default is 1.
  9843. Note this value is multiplied with actual max possible value one pixel component
  9844. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  9845. is 0.9 * 255 = 230.
  9846. @item colorspace, c
  9847. Set what kind of colorspace to use when drawing graticule.
  9848. @table @samp
  9849. @item auto
  9850. @item 601
  9851. @item 709
  9852. @end table
  9853. Default is auto.
  9854. @end table
  9855. @anchor{vidstabdetect}
  9856. @section vidstabdetect
  9857. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  9858. @ref{vidstabtransform} for pass 2.
  9859. This filter generates a file with relative translation and rotation
  9860. transform information about subsequent frames, which is then used by
  9861. the @ref{vidstabtransform} filter.
  9862. To enable compilation of this filter you need to configure FFmpeg with
  9863. @code{--enable-libvidstab}.
  9864. This filter accepts the following options:
  9865. @table @option
  9866. @item result
  9867. Set the path to the file used to write the transforms information.
  9868. Default value is @file{transforms.trf}.
  9869. @item shakiness
  9870. Set how shaky the video is and how quick the camera is. It accepts an
  9871. integer in the range 1-10, a value of 1 means little shakiness, a
  9872. value of 10 means strong shakiness. Default value is 5.
  9873. @item accuracy
  9874. Set the accuracy of the detection process. It must be a value in the
  9875. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  9876. accuracy. Default value is 15.
  9877. @item stepsize
  9878. Set stepsize of the search process. The region around minimum is
  9879. scanned with 1 pixel resolution. Default value is 6.
  9880. @item mincontrast
  9881. Set minimum contrast. Below this value a local measurement field is
  9882. discarded. Must be a floating point value in the range 0-1. Default
  9883. value is 0.3.
  9884. @item tripod
  9885. Set reference frame number for tripod mode.
  9886. If enabled, the motion of the frames is compared to a reference frame
  9887. in the filtered stream, identified by the specified number. The idea
  9888. is to compensate all movements in a more-or-less static scene and keep
  9889. the camera view absolutely still.
  9890. If set to 0, it is disabled. The frames are counted starting from 1.
  9891. @item show
  9892. Show fields and transforms in the resulting frames. It accepts an
  9893. integer in the range 0-2. Default value is 0, which disables any
  9894. visualization.
  9895. @end table
  9896. @subsection Examples
  9897. @itemize
  9898. @item
  9899. Use default values:
  9900. @example
  9901. vidstabdetect
  9902. @end example
  9903. @item
  9904. Analyze strongly shaky movie and put the results in file
  9905. @file{mytransforms.trf}:
  9906. @example
  9907. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  9908. @end example
  9909. @item
  9910. Visualize the result of internal transformations in the resulting
  9911. video:
  9912. @example
  9913. vidstabdetect=show=1
  9914. @end example
  9915. @item
  9916. Analyze a video with medium shakiness using @command{ffmpeg}:
  9917. @example
  9918. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  9919. @end example
  9920. @end itemize
  9921. @anchor{vidstabtransform}
  9922. @section vidstabtransform
  9923. Video stabilization/deshaking: pass 2 of 2,
  9924. see @ref{vidstabdetect} for pass 1.
  9925. Read a file with transform information for each frame and
  9926. apply/compensate them. Together with the @ref{vidstabdetect}
  9927. filter this can be used to deshake videos. See also
  9928. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  9929. the @ref{unsharp} filter, see below.
  9930. To enable compilation of this filter you need to configure FFmpeg with
  9931. @code{--enable-libvidstab}.
  9932. @subsection Options
  9933. @table @option
  9934. @item input
  9935. Set path to the file used to read the transforms. Default value is
  9936. @file{transforms.trf}.
  9937. @item smoothing
  9938. Set the number of frames (value*2 + 1) used for lowpass filtering the
  9939. camera movements. Default value is 10.
  9940. For example a number of 10 means that 21 frames are used (10 in the
  9941. past and 10 in the future) to smoothen the motion in the video. A
  9942. larger value leads to a smoother video, but limits the acceleration of
  9943. the camera (pan/tilt movements). 0 is a special case where a static
  9944. camera is simulated.
  9945. @item optalgo
  9946. Set the camera path optimization algorithm.
  9947. Accepted values are:
  9948. @table @samp
  9949. @item gauss
  9950. gaussian kernel low-pass filter on camera motion (default)
  9951. @item avg
  9952. averaging on transformations
  9953. @end table
  9954. @item maxshift
  9955. Set maximal number of pixels to translate frames. Default value is -1,
  9956. meaning no limit.
  9957. @item maxangle
  9958. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  9959. value is -1, meaning no limit.
  9960. @item crop
  9961. Specify how to deal with borders that may be visible due to movement
  9962. compensation.
  9963. Available values are:
  9964. @table @samp
  9965. @item keep
  9966. keep image information from previous frame (default)
  9967. @item black
  9968. fill the border black
  9969. @end table
  9970. @item invert
  9971. Invert transforms if set to 1. Default value is 0.
  9972. @item relative
  9973. Consider transforms as relative to previous frame if set to 1,
  9974. absolute if set to 0. Default value is 0.
  9975. @item zoom
  9976. Set percentage to zoom. A positive value will result in a zoom-in
  9977. effect, a negative value in a zoom-out effect. Default value is 0 (no
  9978. zoom).
  9979. @item optzoom
  9980. Set optimal zooming to avoid borders.
  9981. Accepted values are:
  9982. @table @samp
  9983. @item 0
  9984. disabled
  9985. @item 1
  9986. optimal static zoom value is determined (only very strong movements
  9987. will lead to visible borders) (default)
  9988. @item 2
  9989. optimal adaptive zoom value is determined (no borders will be
  9990. visible), see @option{zoomspeed}
  9991. @end table
  9992. Note that the value given at zoom is added to the one calculated here.
  9993. @item zoomspeed
  9994. Set percent to zoom maximally each frame (enabled when
  9995. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  9996. 0.25.
  9997. @item interpol
  9998. Specify type of interpolation.
  9999. Available values are:
  10000. @table @samp
  10001. @item no
  10002. no interpolation
  10003. @item linear
  10004. linear only horizontal
  10005. @item bilinear
  10006. linear in both directions (default)
  10007. @item bicubic
  10008. cubic in both directions (slow)
  10009. @end table
  10010. @item tripod
  10011. Enable virtual tripod mode if set to 1, which is equivalent to
  10012. @code{relative=0:smoothing=0}. Default value is 0.
  10013. Use also @code{tripod} option of @ref{vidstabdetect}.
  10014. @item debug
  10015. Increase log verbosity if set to 1. Also the detected global motions
  10016. are written to the temporary file @file{global_motions.trf}. Default
  10017. value is 0.
  10018. @end table
  10019. @subsection Examples
  10020. @itemize
  10021. @item
  10022. Use @command{ffmpeg} for a typical stabilization with default values:
  10023. @example
  10024. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10025. @end example
  10026. Note the use of the @ref{unsharp} filter which is always recommended.
  10027. @item
  10028. Zoom in a bit more and load transform data from a given file:
  10029. @example
  10030. vidstabtransform=zoom=5:input="mytransforms.trf"
  10031. @end example
  10032. @item
  10033. Smoothen the video even more:
  10034. @example
  10035. vidstabtransform=smoothing=30
  10036. @end example
  10037. @end itemize
  10038. @section vflip
  10039. Flip the input video vertically.
  10040. For example, to vertically flip a video with @command{ffmpeg}:
  10041. @example
  10042. ffmpeg -i in.avi -vf "vflip" out.avi
  10043. @end example
  10044. @anchor{vignette}
  10045. @section vignette
  10046. Make or reverse a natural vignetting effect.
  10047. The filter accepts the following options:
  10048. @table @option
  10049. @item angle, a
  10050. Set lens angle expression as a number of radians.
  10051. The value is clipped in the @code{[0,PI/2]} range.
  10052. Default value: @code{"PI/5"}
  10053. @item x0
  10054. @item y0
  10055. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10056. by default.
  10057. @item mode
  10058. Set forward/backward mode.
  10059. Available modes are:
  10060. @table @samp
  10061. @item forward
  10062. The larger the distance from the central point, the darker the image becomes.
  10063. @item backward
  10064. The larger the distance from the central point, the brighter the image becomes.
  10065. This can be used to reverse a vignette effect, though there is no automatic
  10066. detection to extract the lens @option{angle} and other settings (yet). It can
  10067. also be used to create a burning effect.
  10068. @end table
  10069. Default value is @samp{forward}.
  10070. @item eval
  10071. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10072. It accepts the following values:
  10073. @table @samp
  10074. @item init
  10075. Evaluate expressions only once during the filter initialization.
  10076. @item frame
  10077. Evaluate expressions for each incoming frame. This is way slower than the
  10078. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10079. allows advanced dynamic expressions.
  10080. @end table
  10081. Default value is @samp{init}.
  10082. @item dither
  10083. Set dithering to reduce the circular banding effects. Default is @code{1}
  10084. (enabled).
  10085. @item aspect
  10086. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10087. Setting this value to the SAR of the input will make a rectangular vignetting
  10088. following the dimensions of the video.
  10089. Default is @code{1/1}.
  10090. @end table
  10091. @subsection Expressions
  10092. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10093. following parameters.
  10094. @table @option
  10095. @item w
  10096. @item h
  10097. input width and height
  10098. @item n
  10099. the number of input frame, starting from 0
  10100. @item pts
  10101. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10102. @var{TB} units, NAN if undefined
  10103. @item r
  10104. frame rate of the input video, NAN if the input frame rate is unknown
  10105. @item t
  10106. the PTS (Presentation TimeStamp) of the filtered video frame,
  10107. expressed in seconds, NAN if undefined
  10108. @item tb
  10109. time base of the input video
  10110. @end table
  10111. @subsection Examples
  10112. @itemize
  10113. @item
  10114. Apply simple strong vignetting effect:
  10115. @example
  10116. vignette=PI/4
  10117. @end example
  10118. @item
  10119. Make a flickering vignetting:
  10120. @example
  10121. vignette='PI/4+random(1)*PI/50':eval=frame
  10122. @end example
  10123. @end itemize
  10124. @section vstack
  10125. Stack input videos vertically.
  10126. All streams must be of same pixel format and of same width.
  10127. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10128. to create same output.
  10129. The filter accept the following option:
  10130. @table @option
  10131. @item inputs
  10132. Set number of input streams. Default is 2.
  10133. @item shortest
  10134. If set to 1, force the output to terminate when the shortest input
  10135. terminates. Default value is 0.
  10136. @end table
  10137. @section w3fdif
  10138. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  10139. Deinterlacing Filter").
  10140. Based on the process described by Martin Weston for BBC R&D, and
  10141. implemented based on the de-interlace algorithm written by Jim
  10142. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  10143. uses filter coefficients calculated by BBC R&D.
  10144. There are two sets of filter coefficients, so called "simple":
  10145. and "complex". Which set of filter coefficients is used can
  10146. be set by passing an optional parameter:
  10147. @table @option
  10148. @item filter
  10149. Set the interlacing filter coefficients. Accepts one of the following values:
  10150. @table @samp
  10151. @item simple
  10152. Simple filter coefficient set.
  10153. @item complex
  10154. More-complex filter coefficient set.
  10155. @end table
  10156. Default value is @samp{complex}.
  10157. @item deint
  10158. Specify which frames to deinterlace. Accept one of the following values:
  10159. @table @samp
  10160. @item all
  10161. Deinterlace all frames,
  10162. @item interlaced
  10163. Only deinterlace frames marked as interlaced.
  10164. @end table
  10165. Default value is @samp{all}.
  10166. @end table
  10167. @section waveform
  10168. Video waveform monitor.
  10169. The waveform monitor plots color component intensity. By default luminance
  10170. only. Each column of the waveform corresponds to a column of pixels in the
  10171. source video.
  10172. It accepts the following options:
  10173. @table @option
  10174. @item mode, m
  10175. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10176. In row mode, the graph on the left side represents color component value 0 and
  10177. the right side represents value = 255. In column mode, the top side represents
  10178. color component value = 0 and bottom side represents value = 255.
  10179. @item intensity, i
  10180. Set intensity. Smaller values are useful to find out how many values of the same
  10181. luminance are distributed across input rows/columns.
  10182. Default value is @code{0.04}. Allowed range is [0, 1].
  10183. @item mirror, r
  10184. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10185. In mirrored mode, higher values will be represented on the left
  10186. side for @code{row} mode and at the top for @code{column} mode. Default is
  10187. @code{1} (mirrored).
  10188. @item display, d
  10189. Set display mode.
  10190. It accepts the following values:
  10191. @table @samp
  10192. @item overlay
  10193. Presents information identical to that in the @code{parade}, except
  10194. that the graphs representing color components are superimposed directly
  10195. over one another.
  10196. This display mode makes it easier to spot relative differences or similarities
  10197. in overlapping areas of the color components that are supposed to be identical,
  10198. such as neutral whites, grays, or blacks.
  10199. @item stack
  10200. Display separate graph for the color components side by side in
  10201. @code{row} mode or one below the other in @code{column} mode.
  10202. @item parade
  10203. Display separate graph for the color components side by side in
  10204. @code{column} mode or one below the other in @code{row} mode.
  10205. Using this display mode makes it easy to spot color casts in the highlights
  10206. and shadows of an image, by comparing the contours of the top and the bottom
  10207. graphs of each waveform. Since whites, grays, and blacks are characterized
  10208. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10209. should display three waveforms of roughly equal width/height. If not, the
  10210. correction is easy to perform by making level adjustments the three waveforms.
  10211. @end table
  10212. Default is @code{stack}.
  10213. @item components, c
  10214. Set which color components to display. Default is 1, which means only luminance
  10215. or red color component if input is in RGB colorspace. If is set for example to
  10216. 7 it will display all 3 (if) available color components.
  10217. @item envelope, e
  10218. @table @samp
  10219. @item none
  10220. No envelope, this is default.
  10221. @item instant
  10222. Instant envelope, minimum and maximum values presented in graph will be easily
  10223. visible even with small @code{step} value.
  10224. @item peak
  10225. Hold minimum and maximum values presented in graph across time. This way you
  10226. can still spot out of range values without constantly looking at waveforms.
  10227. @item peak+instant
  10228. Peak and instant envelope combined together.
  10229. @end table
  10230. @item filter, f
  10231. @table @samp
  10232. @item lowpass
  10233. No filtering, this is default.
  10234. @item flat
  10235. Luma and chroma combined together.
  10236. @item aflat
  10237. Similar as above, but shows difference between blue and red chroma.
  10238. @item chroma
  10239. Displays only chroma.
  10240. @item color
  10241. Displays actual color value on waveform.
  10242. @item acolor
  10243. Similar as above, but with luma showing frequency of chroma values.
  10244. @end table
  10245. @item graticule, g
  10246. Set which graticule to display.
  10247. @table @samp
  10248. @item none
  10249. Do not display graticule.
  10250. @item green
  10251. Display green graticule showing legal broadcast ranges.
  10252. @end table
  10253. @item opacity, o
  10254. Set graticule opacity.
  10255. @item flags, fl
  10256. Set graticule flags.
  10257. @table @samp
  10258. @item numbers
  10259. Draw numbers above lines. By default enabled.
  10260. @item dots
  10261. Draw dots instead of lines.
  10262. @end table
  10263. @item scale, s
  10264. Set scale used for displaying graticule.
  10265. @table @samp
  10266. @item digital
  10267. @item millivolts
  10268. @item ire
  10269. @end table
  10270. Default is digital.
  10271. @end table
  10272. @section xbr
  10273. Apply the xBR high-quality magnification filter which is designed for pixel
  10274. art. It follows a set of edge-detection rules, see
  10275. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  10276. It accepts the following option:
  10277. @table @option
  10278. @item n
  10279. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  10280. @code{3xBR} and @code{4} for @code{4xBR}.
  10281. Default is @code{3}.
  10282. @end table
  10283. @anchor{yadif}
  10284. @section yadif
  10285. Deinterlace the input video ("yadif" means "yet another deinterlacing
  10286. filter").
  10287. It accepts the following parameters:
  10288. @table @option
  10289. @item mode
  10290. The interlacing mode to adopt. It accepts one of the following values:
  10291. @table @option
  10292. @item 0, send_frame
  10293. Output one frame for each frame.
  10294. @item 1, send_field
  10295. Output one frame for each field.
  10296. @item 2, send_frame_nospatial
  10297. Like @code{send_frame}, but it skips the spatial interlacing check.
  10298. @item 3, send_field_nospatial
  10299. Like @code{send_field}, but it skips the spatial interlacing check.
  10300. @end table
  10301. The default value is @code{send_frame}.
  10302. @item parity
  10303. The picture field parity assumed for the input interlaced video. It accepts one
  10304. of the following values:
  10305. @table @option
  10306. @item 0, tff
  10307. Assume the top field is first.
  10308. @item 1, bff
  10309. Assume the bottom field is first.
  10310. @item -1, auto
  10311. Enable automatic detection of field parity.
  10312. @end table
  10313. The default value is @code{auto}.
  10314. If the interlacing is unknown or the decoder does not export this information,
  10315. top field first will be assumed.
  10316. @item deint
  10317. Specify which frames to deinterlace. Accept one of the following
  10318. values:
  10319. @table @option
  10320. @item 0, all
  10321. Deinterlace all frames.
  10322. @item 1, interlaced
  10323. Only deinterlace frames marked as interlaced.
  10324. @end table
  10325. The default value is @code{all}.
  10326. @end table
  10327. @section zoompan
  10328. Apply Zoom & Pan effect.
  10329. This filter accepts the following options:
  10330. @table @option
  10331. @item zoom, z
  10332. Set the zoom expression. Default is 1.
  10333. @item x
  10334. @item y
  10335. Set the x and y expression. Default is 0.
  10336. @item d
  10337. Set the duration expression in number of frames.
  10338. This sets for how many number of frames effect will last for
  10339. single input image.
  10340. @item s
  10341. Set the output image size, default is 'hd720'.
  10342. @item fps
  10343. Set the output frame rate, default is '25'.
  10344. @end table
  10345. Each expression can contain the following constants:
  10346. @table @option
  10347. @item in_w, iw
  10348. Input width.
  10349. @item in_h, ih
  10350. Input height.
  10351. @item out_w, ow
  10352. Output width.
  10353. @item out_h, oh
  10354. Output height.
  10355. @item in
  10356. Input frame count.
  10357. @item on
  10358. Output frame count.
  10359. @item x
  10360. @item y
  10361. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  10362. for current input frame.
  10363. @item px
  10364. @item py
  10365. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  10366. not yet such frame (first input frame).
  10367. @item zoom
  10368. Last calculated zoom from 'z' expression for current input frame.
  10369. @item pzoom
  10370. Last calculated zoom of last output frame of previous input frame.
  10371. @item duration
  10372. Number of output frames for current input frame. Calculated from 'd' expression
  10373. for each input frame.
  10374. @item pduration
  10375. number of output frames created for previous input frame
  10376. @item a
  10377. Rational number: input width / input height
  10378. @item sar
  10379. sample aspect ratio
  10380. @item dar
  10381. display aspect ratio
  10382. @end table
  10383. @subsection Examples
  10384. @itemize
  10385. @item
  10386. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  10387. @example
  10388. 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
  10389. @end example
  10390. @item
  10391. Zoom-in up to 1.5 and pan always at center of picture:
  10392. @example
  10393. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10394. @end example
  10395. @end itemize
  10396. @section zscale
  10397. Scale (resize) the input video, using the z.lib library:
  10398. https://github.com/sekrit-twc/zimg.
  10399. The zscale filter forces the output display aspect ratio to be the same
  10400. as the input, by changing the output sample aspect ratio.
  10401. If the input image format is different from the format requested by
  10402. the next filter, the zscale filter will convert the input to the
  10403. requested format.
  10404. @subsection Options
  10405. The filter accepts the following options.
  10406. @table @option
  10407. @item width, w
  10408. @item height, h
  10409. Set the output video dimension expression. Default value is the input
  10410. dimension.
  10411. If the @var{width} or @var{w} is 0, the input width is used for the output.
  10412. If the @var{height} or @var{h} is 0, the input height is used for the output.
  10413. If one of the values is -1, the zscale filter will use a value that
  10414. maintains the aspect ratio of the input image, calculated from the
  10415. other specified dimension. If both of them are -1, the input size is
  10416. used
  10417. If one of the values is -n with n > 1, the zscale filter will also use a value
  10418. that maintains the aspect ratio of the input image, calculated from the other
  10419. specified dimension. After that it will, however, make sure that the calculated
  10420. dimension is divisible by n and adjust the value if necessary.
  10421. See below for the list of accepted constants for use in the dimension
  10422. expression.
  10423. @item size, s
  10424. Set the video size. For the syntax of this option, check the
  10425. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10426. @item dither, d
  10427. Set the dither type.
  10428. Possible values are:
  10429. @table @var
  10430. @item none
  10431. @item ordered
  10432. @item random
  10433. @item error_diffusion
  10434. @end table
  10435. Default is none.
  10436. @item filter, f
  10437. Set the resize filter type.
  10438. Possible values are:
  10439. @table @var
  10440. @item point
  10441. @item bilinear
  10442. @item bicubic
  10443. @item spline16
  10444. @item spline36
  10445. @item lanczos
  10446. @end table
  10447. Default is bilinear.
  10448. @item range, r
  10449. Set the color range.
  10450. Possible values are:
  10451. @table @var
  10452. @item input
  10453. @item limited
  10454. @item full
  10455. @end table
  10456. Default is same as input.
  10457. @item primaries, p
  10458. Set the color primaries.
  10459. Possible values are:
  10460. @table @var
  10461. @item input
  10462. @item 709
  10463. @item unspecified
  10464. @item 170m
  10465. @item 240m
  10466. @item 2020
  10467. @end table
  10468. Default is same as input.
  10469. @item transfer, t
  10470. Set the transfer characteristics.
  10471. Possible values are:
  10472. @table @var
  10473. @item input
  10474. @item 709
  10475. @item unspecified
  10476. @item 601
  10477. @item linear
  10478. @item 2020_10
  10479. @item 2020_12
  10480. @end table
  10481. Default is same as input.
  10482. @item matrix, m
  10483. Set the colorspace matrix.
  10484. Possible value are:
  10485. @table @var
  10486. @item input
  10487. @item 709
  10488. @item unspecified
  10489. @item 470bg
  10490. @item 170m
  10491. @item 2020_ncl
  10492. @item 2020_cl
  10493. @end table
  10494. Default is same as input.
  10495. @item rangein, rin
  10496. Set the input color range.
  10497. Possible values are:
  10498. @table @var
  10499. @item input
  10500. @item limited
  10501. @item full
  10502. @end table
  10503. Default is same as input.
  10504. @item primariesin, pin
  10505. Set the input color primaries.
  10506. Possible values are:
  10507. @table @var
  10508. @item input
  10509. @item 709
  10510. @item unspecified
  10511. @item 170m
  10512. @item 240m
  10513. @item 2020
  10514. @end table
  10515. Default is same as input.
  10516. @item transferin, tin
  10517. Set the input transfer characteristics.
  10518. Possible values are:
  10519. @table @var
  10520. @item input
  10521. @item 709
  10522. @item unspecified
  10523. @item 601
  10524. @item linear
  10525. @item 2020_10
  10526. @item 2020_12
  10527. @end table
  10528. Default is same as input.
  10529. @item matrixin, min
  10530. Set the input colorspace matrix.
  10531. Possible value are:
  10532. @table @var
  10533. @item input
  10534. @item 709
  10535. @item unspecified
  10536. @item 470bg
  10537. @item 170m
  10538. @item 2020_ncl
  10539. @item 2020_cl
  10540. @end table
  10541. @end table
  10542. The values of the @option{w} and @option{h} options are expressions
  10543. containing the following constants:
  10544. @table @var
  10545. @item in_w
  10546. @item in_h
  10547. The input width and height
  10548. @item iw
  10549. @item ih
  10550. These are the same as @var{in_w} and @var{in_h}.
  10551. @item out_w
  10552. @item out_h
  10553. The output (scaled) width and height
  10554. @item ow
  10555. @item oh
  10556. These are the same as @var{out_w} and @var{out_h}
  10557. @item a
  10558. The same as @var{iw} / @var{ih}
  10559. @item sar
  10560. input sample aspect ratio
  10561. @item dar
  10562. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10563. @item hsub
  10564. @item vsub
  10565. horizontal and vertical input chroma subsample values. For example for the
  10566. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10567. @item ohsub
  10568. @item ovsub
  10569. horizontal and vertical output chroma subsample values. For example for the
  10570. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10571. @end table
  10572. @table @option
  10573. @end table
  10574. @c man end VIDEO FILTERS
  10575. @chapter Video Sources
  10576. @c man begin VIDEO SOURCES
  10577. Below is a description of the currently available video sources.
  10578. @section buffer
  10579. Buffer video frames, and make them available to the filter chain.
  10580. This source is mainly intended for a programmatic use, in particular
  10581. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  10582. It accepts the following parameters:
  10583. @table @option
  10584. @item video_size
  10585. Specify the size (width and height) of the buffered video frames. For the
  10586. syntax of this option, check the
  10587. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10588. @item width
  10589. The input video width.
  10590. @item height
  10591. The input video height.
  10592. @item pix_fmt
  10593. A string representing the pixel format of the buffered video frames.
  10594. It may be a number corresponding to a pixel format, or a pixel format
  10595. name.
  10596. @item time_base
  10597. Specify the timebase assumed by the timestamps of the buffered frames.
  10598. @item frame_rate
  10599. Specify the frame rate expected for the video stream.
  10600. @item pixel_aspect, sar
  10601. The sample (pixel) aspect ratio of the input video.
  10602. @item sws_param
  10603. Specify the optional parameters to be used for the scale filter which
  10604. is automatically inserted when an input change is detected in the
  10605. input size or format.
  10606. @item hw_frames_ctx
  10607. When using a hardware pixel format, this should be a reference to an
  10608. AVHWFramesContext describing input frames.
  10609. @end table
  10610. For example:
  10611. @example
  10612. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  10613. @end example
  10614. will instruct the source to accept video frames with size 320x240 and
  10615. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  10616. square pixels (1:1 sample aspect ratio).
  10617. Since the pixel format with name "yuv410p" corresponds to the number 6
  10618. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  10619. this example corresponds to:
  10620. @example
  10621. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  10622. @end example
  10623. Alternatively, the options can be specified as a flat string, but this
  10624. syntax is deprecated:
  10625. @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}]
  10626. @section cellauto
  10627. Create a pattern generated by an elementary cellular automaton.
  10628. The initial state of the cellular automaton can be defined through the
  10629. @option{filename}, and @option{pattern} options. If such options are
  10630. not specified an initial state is created randomly.
  10631. At each new frame a new row in the video is filled with the result of
  10632. the cellular automaton next generation. The behavior when the whole
  10633. frame is filled is defined by the @option{scroll} option.
  10634. This source accepts the following options:
  10635. @table @option
  10636. @item filename, f
  10637. Read the initial cellular automaton state, i.e. the starting row, from
  10638. the specified file.
  10639. In the file, each non-whitespace character is considered an alive
  10640. cell, a newline will terminate the row, and further characters in the
  10641. file will be ignored.
  10642. @item pattern, p
  10643. Read the initial cellular automaton state, i.e. the starting row, from
  10644. the specified string.
  10645. Each non-whitespace character in the string is considered an alive
  10646. cell, a newline will terminate the row, and further characters in the
  10647. string will be ignored.
  10648. @item rate, r
  10649. Set the video rate, that is the number of frames generated per second.
  10650. Default is 25.
  10651. @item random_fill_ratio, ratio
  10652. Set the random fill ratio for the initial cellular automaton row. It
  10653. is a floating point number value ranging from 0 to 1, defaults to
  10654. 1/PHI.
  10655. This option is ignored when a file or a pattern is specified.
  10656. @item random_seed, seed
  10657. Set the seed for filling randomly the initial row, must be an integer
  10658. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10659. set to -1, the filter will try to use a good random seed on a best
  10660. effort basis.
  10661. @item rule
  10662. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  10663. Default value is 110.
  10664. @item size, s
  10665. Set the size of the output video. For the syntax of this option, check the
  10666. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10667. If @option{filename} or @option{pattern} is specified, the size is set
  10668. by default to the width of the specified initial state row, and the
  10669. height is set to @var{width} * PHI.
  10670. If @option{size} is set, it must contain the width of the specified
  10671. pattern string, and the specified pattern will be centered in the
  10672. larger row.
  10673. If a filename or a pattern string is not specified, the size value
  10674. defaults to "320x518" (used for a randomly generated initial state).
  10675. @item scroll
  10676. If set to 1, scroll the output upward when all the rows in the output
  10677. have been already filled. If set to 0, the new generated row will be
  10678. written over the top row just after the bottom row is filled.
  10679. Defaults to 1.
  10680. @item start_full, full
  10681. If set to 1, completely fill the output with generated rows before
  10682. outputting the first frame.
  10683. This is the default behavior, for disabling set the value to 0.
  10684. @item stitch
  10685. If set to 1, stitch the left and right row edges together.
  10686. This is the default behavior, for disabling set the value to 0.
  10687. @end table
  10688. @subsection Examples
  10689. @itemize
  10690. @item
  10691. Read the initial state from @file{pattern}, and specify an output of
  10692. size 200x400.
  10693. @example
  10694. cellauto=f=pattern:s=200x400
  10695. @end example
  10696. @item
  10697. Generate a random initial row with a width of 200 cells, with a fill
  10698. ratio of 2/3:
  10699. @example
  10700. cellauto=ratio=2/3:s=200x200
  10701. @end example
  10702. @item
  10703. Create a pattern generated by rule 18 starting by a single alive cell
  10704. centered on an initial row with width 100:
  10705. @example
  10706. cellauto=p=@@:s=100x400:full=0:rule=18
  10707. @end example
  10708. @item
  10709. Specify a more elaborated initial pattern:
  10710. @example
  10711. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  10712. @end example
  10713. @end itemize
  10714. @anchor{coreimagesrc}
  10715. @section coreimagesrc
  10716. Video source generated on GPU using Apple's CoreImage API on OSX.
  10717. This video source is a specialized version of the @ref{coreimage} video filter.
  10718. Use a core image generator at the beginning of the applied filterchain to
  10719. generate the content.
  10720. The coreimagesrc video source accepts the following options:
  10721. @table @option
  10722. @item list_generators
  10723. List all available generators along with all their respective options as well as
  10724. possible minimum and maximum values along with the default values.
  10725. @example
  10726. list_generators=true
  10727. @end example
  10728. @item size, s
  10729. Specify the size of the sourced video. For the syntax of this option, check the
  10730. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10731. The default value is @code{320x240}.
  10732. @item rate, r
  10733. Specify the frame rate of the sourced video, as the number of frames
  10734. generated per second. It has to be a string in the format
  10735. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  10736. number or a valid video frame rate abbreviation. The default value is
  10737. "25".
  10738. @item sar
  10739. Set the sample aspect ratio of the sourced video.
  10740. @item duration, d
  10741. Set the duration of the sourced video. See
  10742. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10743. for the accepted syntax.
  10744. If not specified, or the expressed duration is negative, the video is
  10745. supposed to be generated forever.
  10746. @end table
  10747. Additionally, all options of the @ref{coreimage} video filter are accepted.
  10748. A complete filterchain can be used for further processing of the
  10749. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  10750. and examples for details.
  10751. @subsection Examples
  10752. @itemize
  10753. @item
  10754. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  10755. given as complete and escaped command-line for Apple's standard bash shell:
  10756. @example
  10757. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  10758. @end example
  10759. This example is equivalent to the QRCode example of @ref{coreimage} without the
  10760. need for a nullsrc video source.
  10761. @end itemize
  10762. @section mandelbrot
  10763. Generate a Mandelbrot set fractal, and progressively zoom towards the
  10764. point specified with @var{start_x} and @var{start_y}.
  10765. This source accepts the following options:
  10766. @table @option
  10767. @item end_pts
  10768. Set the terminal pts value. Default value is 400.
  10769. @item end_scale
  10770. Set the terminal scale value.
  10771. Must be a floating point value. Default value is 0.3.
  10772. @item inner
  10773. Set the inner coloring mode, that is the algorithm used to draw the
  10774. Mandelbrot fractal internal region.
  10775. It shall assume one of the following values:
  10776. @table @option
  10777. @item black
  10778. Set black mode.
  10779. @item convergence
  10780. Show time until convergence.
  10781. @item mincol
  10782. Set color based on point closest to the origin of the iterations.
  10783. @item period
  10784. Set period mode.
  10785. @end table
  10786. Default value is @var{mincol}.
  10787. @item bailout
  10788. Set the bailout value. Default value is 10.0.
  10789. @item maxiter
  10790. Set the maximum of iterations performed by the rendering
  10791. algorithm. Default value is 7189.
  10792. @item outer
  10793. Set outer coloring mode.
  10794. It shall assume one of following values:
  10795. @table @option
  10796. @item iteration_count
  10797. Set iteration cound mode.
  10798. @item normalized_iteration_count
  10799. set normalized iteration count mode.
  10800. @end table
  10801. Default value is @var{normalized_iteration_count}.
  10802. @item rate, r
  10803. Set frame rate, expressed as number of frames per second. Default
  10804. value is "25".
  10805. @item size, s
  10806. Set frame size. For the syntax of this option, check the "Video
  10807. size" section in the ffmpeg-utils manual. Default value is "640x480".
  10808. @item start_scale
  10809. Set the initial scale value. Default value is 3.0.
  10810. @item start_x
  10811. Set the initial x position. Must be a floating point value between
  10812. -100 and 100. Default value is -0.743643887037158704752191506114774.
  10813. @item start_y
  10814. Set the initial y position. Must be a floating point value between
  10815. -100 and 100. Default value is -0.131825904205311970493132056385139.
  10816. @end table
  10817. @section mptestsrc
  10818. Generate various test patterns, as generated by the MPlayer test filter.
  10819. The size of the generated video is fixed, and is 256x256.
  10820. This source is useful in particular for testing encoding features.
  10821. This source accepts the following options:
  10822. @table @option
  10823. @item rate, r
  10824. Specify the frame rate of the sourced video, as the number of frames
  10825. generated per second. It has to be a string in the format
  10826. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  10827. number or a valid video frame rate abbreviation. The default value is
  10828. "25".
  10829. @item duration, d
  10830. Set the duration of the sourced video. See
  10831. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10832. for the accepted syntax.
  10833. If not specified, or the expressed duration is negative, the video is
  10834. supposed to be generated forever.
  10835. @item test, t
  10836. Set the number or the name of the test to perform. Supported tests are:
  10837. @table @option
  10838. @item dc_luma
  10839. @item dc_chroma
  10840. @item freq_luma
  10841. @item freq_chroma
  10842. @item amp_luma
  10843. @item amp_chroma
  10844. @item cbp
  10845. @item mv
  10846. @item ring1
  10847. @item ring2
  10848. @item all
  10849. @end table
  10850. Default value is "all", which will cycle through the list of all tests.
  10851. @end table
  10852. Some examples:
  10853. @example
  10854. mptestsrc=t=dc_luma
  10855. @end example
  10856. will generate a "dc_luma" test pattern.
  10857. @section frei0r_src
  10858. Provide a frei0r source.
  10859. To enable compilation of this filter you need to install the frei0r
  10860. header and configure FFmpeg with @code{--enable-frei0r}.
  10861. This source accepts the following parameters:
  10862. @table @option
  10863. @item size
  10864. The size of the video to generate. For the syntax of this option, check the
  10865. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10866. @item framerate
  10867. The framerate of the generated video. It may be a string of the form
  10868. @var{num}/@var{den} or a frame rate abbreviation.
  10869. @item filter_name
  10870. The name to the frei0r source to load. For more information regarding frei0r and
  10871. how to set the parameters, read the @ref{frei0r} section in the video filters
  10872. documentation.
  10873. @item filter_params
  10874. A '|'-separated list of parameters to pass to the frei0r source.
  10875. @end table
  10876. For example, to generate a frei0r partik0l source with size 200x200
  10877. and frame rate 10 which is overlaid on the overlay filter main input:
  10878. @example
  10879. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  10880. @end example
  10881. @section life
  10882. Generate a life pattern.
  10883. This source is based on a generalization of John Conway's life game.
  10884. The sourced input represents a life grid, each pixel represents a cell
  10885. which can be in one of two possible states, alive or dead. Every cell
  10886. interacts with its eight neighbours, which are the cells that are
  10887. horizontally, vertically, or diagonally adjacent.
  10888. At each interaction the grid evolves according to the adopted rule,
  10889. which specifies the number of neighbor alive cells which will make a
  10890. cell stay alive or born. The @option{rule} option allows one to specify
  10891. the rule to adopt.
  10892. This source accepts the following options:
  10893. @table @option
  10894. @item filename, f
  10895. Set the file from which to read the initial grid state. In the file,
  10896. each non-whitespace character is considered an alive cell, and newline
  10897. is used to delimit the end of each row.
  10898. If this option is not specified, the initial grid is generated
  10899. randomly.
  10900. @item rate, r
  10901. Set the video rate, that is the number of frames generated per second.
  10902. Default is 25.
  10903. @item random_fill_ratio, ratio
  10904. Set the random fill ratio for the initial random grid. It is a
  10905. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  10906. It is ignored when a file is specified.
  10907. @item random_seed, seed
  10908. Set the seed for filling the initial random grid, must be an integer
  10909. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10910. set to -1, the filter will try to use a good random seed on a best
  10911. effort basis.
  10912. @item rule
  10913. Set the life rule.
  10914. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  10915. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  10916. @var{NS} specifies the number of alive neighbor cells which make a
  10917. live cell stay alive, and @var{NB} the number of alive neighbor cells
  10918. which make a dead cell to become alive (i.e. to "born").
  10919. "s" and "b" can be used in place of "S" and "B", respectively.
  10920. Alternatively a rule can be specified by an 18-bits integer. The 9
  10921. high order bits are used to encode the next cell state if it is alive
  10922. for each number of neighbor alive cells, the low order bits specify
  10923. the rule for "borning" new cells. Higher order bits encode for an
  10924. higher number of neighbor cells.
  10925. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  10926. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  10927. Default value is "S23/B3", which is the original Conway's game of life
  10928. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  10929. cells, and will born a new cell if there are three alive cells around
  10930. a dead cell.
  10931. @item size, s
  10932. Set the size of the output video. For the syntax of this option, check the
  10933. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10934. If @option{filename} is specified, the size is set by default to the
  10935. same size of the input file. If @option{size} is set, it must contain
  10936. the size specified in the input file, and the initial grid defined in
  10937. that file is centered in the larger resulting area.
  10938. If a filename is not specified, the size value defaults to "320x240"
  10939. (used for a randomly generated initial grid).
  10940. @item stitch
  10941. If set to 1, stitch the left and right grid edges together, and the
  10942. top and bottom edges also. Defaults to 1.
  10943. @item mold
  10944. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  10945. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  10946. value from 0 to 255.
  10947. @item life_color
  10948. Set the color of living (or new born) cells.
  10949. @item death_color
  10950. Set the color of dead cells. If @option{mold} is set, this is the first color
  10951. used to represent a dead cell.
  10952. @item mold_color
  10953. Set mold color, for definitely dead and moldy cells.
  10954. For the syntax of these 3 color options, check the "Color" section in the
  10955. ffmpeg-utils manual.
  10956. @end table
  10957. @subsection Examples
  10958. @itemize
  10959. @item
  10960. Read a grid from @file{pattern}, and center it on a grid of size
  10961. 300x300 pixels:
  10962. @example
  10963. life=f=pattern:s=300x300
  10964. @end example
  10965. @item
  10966. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  10967. @example
  10968. life=ratio=2/3:s=200x200
  10969. @end example
  10970. @item
  10971. Specify a custom rule for evolving a randomly generated grid:
  10972. @example
  10973. life=rule=S14/B34
  10974. @end example
  10975. @item
  10976. Full example with slow death effect (mold) using @command{ffplay}:
  10977. @example
  10978. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  10979. @end example
  10980. @end itemize
  10981. @anchor{allrgb}
  10982. @anchor{allyuv}
  10983. @anchor{color}
  10984. @anchor{haldclutsrc}
  10985. @anchor{nullsrc}
  10986. @anchor{rgbtestsrc}
  10987. @anchor{smptebars}
  10988. @anchor{smptehdbars}
  10989. @anchor{testsrc}
  10990. @anchor{testsrc2}
  10991. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2
  10992. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  10993. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  10994. The @code{color} source provides an uniformly colored input.
  10995. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  10996. @ref{haldclut} filter.
  10997. The @code{nullsrc} source returns unprocessed video frames. It is
  10998. mainly useful to be employed in analysis / debugging tools, or as the
  10999. source for filters which ignore the input data.
  11000. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11001. detecting RGB vs BGR issues. You should see a red, green and blue
  11002. stripe from top to bottom.
  11003. The @code{smptebars} source generates a color bars pattern, based on
  11004. the SMPTE Engineering Guideline EG 1-1990.
  11005. The @code{smptehdbars} source generates a color bars pattern, based on
  11006. the SMPTE RP 219-2002.
  11007. The @code{testsrc} source generates a test video pattern, showing a
  11008. color pattern, a scrolling gradient and a timestamp. This is mainly
  11009. intended for testing purposes.
  11010. The @code{testsrc2} source is similar to testsrc, but supports more
  11011. pixel formats instead of just @code{rgb24}. This allows using it as an
  11012. input for other tests without requiring a format conversion.
  11013. The sources accept the following parameters:
  11014. @table @option
  11015. @item color, c
  11016. Specify the color of the source, only available in the @code{color}
  11017. source. For the syntax of this option, check the "Color" section in the
  11018. ffmpeg-utils manual.
  11019. @item level
  11020. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11021. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11022. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11023. coded on a @code{1/(N*N)} scale.
  11024. @item size, s
  11025. Specify the size of the sourced video. For the syntax of this option, check the
  11026. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11027. The default value is @code{320x240}.
  11028. This option is not available with the @code{haldclutsrc} filter.
  11029. @item rate, r
  11030. Specify the frame rate of the sourced video, as the number of frames
  11031. generated per second. It has to be a string in the format
  11032. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11033. number or a valid video frame rate abbreviation. The default value is
  11034. "25".
  11035. @item sar
  11036. Set the sample aspect ratio of the sourced video.
  11037. @item duration, d
  11038. Set the duration of the sourced video. See
  11039. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11040. for the accepted syntax.
  11041. If not specified, or the expressed duration is negative, the video is
  11042. supposed to be generated forever.
  11043. @item decimals, n
  11044. Set the number of decimals to show in the timestamp, only available in the
  11045. @code{testsrc} source.
  11046. The displayed timestamp value will correspond to the original
  11047. timestamp value multiplied by the power of 10 of the specified
  11048. value. Default value is 0.
  11049. @end table
  11050. For example the following:
  11051. @example
  11052. testsrc=duration=5.3:size=qcif:rate=10
  11053. @end example
  11054. will generate a video with a duration of 5.3 seconds, with size
  11055. 176x144 and a frame rate of 10 frames per second.
  11056. The following graph description will generate a red source
  11057. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11058. frames per second.
  11059. @example
  11060. color=c=red@@0.2:s=qcif:r=10
  11061. @end example
  11062. If the input content is to be ignored, @code{nullsrc} can be used. The
  11063. following command generates noise in the luminance plane by employing
  11064. the @code{geq} filter:
  11065. @example
  11066. nullsrc=s=256x256, geq=random(1)*255:128:128
  11067. @end example
  11068. @subsection Commands
  11069. The @code{color} source supports the following commands:
  11070. @table @option
  11071. @item c, color
  11072. Set the color of the created image. Accepts the same syntax of the
  11073. corresponding @option{color} option.
  11074. @end table
  11075. @c man end VIDEO SOURCES
  11076. @chapter Video Sinks
  11077. @c man begin VIDEO SINKS
  11078. Below is a description of the currently available video sinks.
  11079. @section buffersink
  11080. Buffer video frames, and make them available to the end of the filter
  11081. graph.
  11082. This sink is mainly intended for programmatic use, in particular
  11083. through the interface defined in @file{libavfilter/buffersink.h}
  11084. or the options system.
  11085. It accepts a pointer to an AVBufferSinkContext structure, which
  11086. defines the incoming buffers' formats, to be passed as the opaque
  11087. parameter to @code{avfilter_init_filter} for initialization.
  11088. @section nullsink
  11089. Null video sink: do absolutely nothing with the input video. It is
  11090. mainly useful as a template and for use in analysis / debugging
  11091. tools.
  11092. @c man end VIDEO SINKS
  11093. @chapter Multimedia Filters
  11094. @c man begin MULTIMEDIA FILTERS
  11095. Below is a description of the currently available multimedia filters.
  11096. @section ahistogram
  11097. Convert input audio to a video output, displaying the volume histogram.
  11098. The filter accepts the following options:
  11099. @table @option
  11100. @item dmode
  11101. Specify how histogram is calculated.
  11102. It accepts the following values:
  11103. @table @samp
  11104. @item single
  11105. Use single histogram for all channels.
  11106. @item separate
  11107. Use separate histogram for each channel.
  11108. @end table
  11109. Default is @code{single}.
  11110. @item rate, r
  11111. Set frame rate, expressed as number of frames per second. Default
  11112. value is "25".
  11113. @item size, s
  11114. Specify the video size for the output. For the syntax of this option, check the
  11115. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11116. Default value is @code{hd720}.
  11117. @item scale
  11118. Set display scale.
  11119. It accepts the following values:
  11120. @table @samp
  11121. @item log
  11122. logarithmic
  11123. @item sqrt
  11124. square root
  11125. @item cbrt
  11126. cubic root
  11127. @item lin
  11128. linear
  11129. @item rlog
  11130. reverse logarithmic
  11131. @end table
  11132. Default is @code{log}.
  11133. @item ascale
  11134. Set amplitude scale.
  11135. It accepts the following values:
  11136. @table @samp
  11137. @item log
  11138. logarithmic
  11139. @item lin
  11140. linear
  11141. @end table
  11142. Default is @code{log}.
  11143. @item acount
  11144. Set how much frames to accumulate in histogram.
  11145. Defauls is 1. Setting this to -1 accumulates all frames.
  11146. @item rheight
  11147. Set histogram ratio of window height.
  11148. @item slide
  11149. Set sonogram sliding.
  11150. It accepts the following values:
  11151. @table @samp
  11152. @item replace
  11153. replace old rows with new ones.
  11154. @item scroll
  11155. scroll from top to bottom.
  11156. @end table
  11157. Default is @code{replace}.
  11158. @end table
  11159. @section aphasemeter
  11160. Convert input audio to a video output, displaying the audio phase.
  11161. The filter accepts the following options:
  11162. @table @option
  11163. @item rate, r
  11164. Set the output frame rate. Default value is @code{25}.
  11165. @item size, s
  11166. Set 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{800x400}.
  11169. @item rc
  11170. @item gc
  11171. @item bc
  11172. Specify the red, green, blue contrast. Default values are @code{2},
  11173. @code{7} and @code{1}.
  11174. Allowed range is @code{[0, 255]}.
  11175. @item mpc
  11176. Set color which will be used for drawing median phase. If color is
  11177. @code{none} which is default, no median phase value will be drawn.
  11178. @end table
  11179. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  11180. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  11181. The @code{-1} means left and right channels are completely out of phase and
  11182. @code{1} means channels are in phase.
  11183. @section avectorscope
  11184. Convert input audio to a video output, representing the audio vector
  11185. scope.
  11186. The filter is used to measure the difference between channels of stereo
  11187. audio stream. A monoaural signal, consisting of identical left and right
  11188. signal, results in straight vertical line. Any stereo separation is visible
  11189. as a deviation from this line, creating a Lissajous figure.
  11190. If the straight (or deviation from it) but horizontal line appears this
  11191. indicates that the left and right channels are out of phase.
  11192. The filter accepts the following options:
  11193. @table @option
  11194. @item mode, m
  11195. Set the vectorscope mode.
  11196. Available values are:
  11197. @table @samp
  11198. @item lissajous
  11199. Lissajous rotated by 45 degrees.
  11200. @item lissajous_xy
  11201. Same as above but not rotated.
  11202. @item polar
  11203. Shape resembling half of circle.
  11204. @end table
  11205. Default value is @samp{lissajous}.
  11206. @item size, s
  11207. Set the video size for the output. For the syntax of this option, check the
  11208. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11209. Default value is @code{400x400}.
  11210. @item rate, r
  11211. Set the output frame rate. Default value is @code{25}.
  11212. @item rc
  11213. @item gc
  11214. @item bc
  11215. @item ac
  11216. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  11217. @code{160}, @code{80} and @code{255}.
  11218. Allowed range is @code{[0, 255]}.
  11219. @item rf
  11220. @item gf
  11221. @item bf
  11222. @item af
  11223. Specify the red, green, blue and alpha fade. Default values are @code{15},
  11224. @code{10}, @code{5} and @code{5}.
  11225. Allowed range is @code{[0, 255]}.
  11226. @item zoom
  11227. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  11228. @item draw
  11229. Set the vectorscope drawing mode.
  11230. Available values are:
  11231. @table @samp
  11232. @item dot
  11233. Draw dot for each sample.
  11234. @item line
  11235. Draw line between previous and current sample.
  11236. @end table
  11237. Default value is @samp{dot}.
  11238. @end table
  11239. @subsection Examples
  11240. @itemize
  11241. @item
  11242. Complete example using @command{ffplay}:
  11243. @example
  11244. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11245. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  11246. @end example
  11247. @end itemize
  11248. @section bench, abench
  11249. Benchmark part of a filtergraph.
  11250. The filter accepts the following options:
  11251. @table @option
  11252. @item action
  11253. Start or stop a timer.
  11254. Available values are:
  11255. @table @samp
  11256. @item start
  11257. Get the current time, set it as frame metadata (using the key
  11258. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  11259. @item stop
  11260. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  11261. the input frame metadata to get the time difference. Time difference, average,
  11262. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  11263. @code{min}) are then printed. The timestamps are expressed in seconds.
  11264. @end table
  11265. @end table
  11266. @subsection Examples
  11267. @itemize
  11268. @item
  11269. Benchmark @ref{selectivecolor} filter:
  11270. @example
  11271. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  11272. @end example
  11273. @end itemize
  11274. @section concat
  11275. Concatenate audio and video streams, joining them together one after the
  11276. other.
  11277. The filter works on segments of synchronized video and audio streams. All
  11278. segments must have the same number of streams of each type, and that will
  11279. also be the number of streams at output.
  11280. The filter accepts the following options:
  11281. @table @option
  11282. @item n
  11283. Set the number of segments. Default is 2.
  11284. @item v
  11285. Set the number of output video streams, that is also the number of video
  11286. streams in each segment. Default is 1.
  11287. @item a
  11288. Set the number of output audio streams, that is also the number of audio
  11289. streams in each segment. Default is 0.
  11290. @item unsafe
  11291. Activate unsafe mode: do not fail if segments have a different format.
  11292. @end table
  11293. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  11294. @var{a} audio outputs.
  11295. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  11296. segment, in the same order as the outputs, then the inputs for the second
  11297. segment, etc.
  11298. Related streams do not always have exactly the same duration, for various
  11299. reasons including codec frame size or sloppy authoring. For that reason,
  11300. related synchronized streams (e.g. a video and its audio track) should be
  11301. concatenated at once. The concat filter will use the duration of the longest
  11302. stream in each segment (except the last one), and if necessary pad shorter
  11303. audio streams with silence.
  11304. For this filter to work correctly, all segments must start at timestamp 0.
  11305. All corresponding streams must have the same parameters in all segments; the
  11306. filtering system will automatically select a common pixel format for video
  11307. streams, and a common sample format, sample rate and channel layout for
  11308. audio streams, but other settings, such as resolution, must be converted
  11309. explicitly by the user.
  11310. Different frame rates are acceptable but will result in variable frame rate
  11311. at output; be sure to configure the output file to handle it.
  11312. @subsection Examples
  11313. @itemize
  11314. @item
  11315. Concatenate an opening, an episode and an ending, all in bilingual version
  11316. (video in stream 0, audio in streams 1 and 2):
  11317. @example
  11318. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  11319. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  11320. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  11321. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  11322. @end example
  11323. @item
  11324. Concatenate two parts, handling audio and video separately, using the
  11325. (a)movie sources, and adjusting the resolution:
  11326. @example
  11327. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  11328. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  11329. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  11330. @end example
  11331. Note that a desync will happen at the stitch if the audio and video streams
  11332. do not have exactly the same duration in the first file.
  11333. @end itemize
  11334. @anchor{ebur128}
  11335. @section ebur128
  11336. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  11337. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  11338. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  11339. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  11340. The filter also has a video output (see the @var{video} option) with a real
  11341. time graph to observe the loudness evolution. The graphic contains the logged
  11342. message mentioned above, so it is not printed anymore when this option is set,
  11343. unless the verbose logging is set. The main graphing area contains the
  11344. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  11345. the momentary loudness (400 milliseconds).
  11346. More information about the Loudness Recommendation EBU R128 on
  11347. @url{http://tech.ebu.ch/loudness}.
  11348. The filter accepts the following options:
  11349. @table @option
  11350. @item video
  11351. Activate the video output. The audio stream is passed unchanged whether this
  11352. option is set or no. The video stream will be the first output stream if
  11353. activated. Default is @code{0}.
  11354. @item size
  11355. Set the video size. This option is for video only. For the syntax of this
  11356. option, check the
  11357. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11358. Default and minimum resolution is @code{640x480}.
  11359. @item meter
  11360. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  11361. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  11362. other integer value between this range is allowed.
  11363. @item metadata
  11364. Set metadata injection. If set to @code{1}, the audio input will be segmented
  11365. into 100ms output frames, each of them containing various loudness information
  11366. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  11367. Default is @code{0}.
  11368. @item framelog
  11369. Force the frame logging level.
  11370. Available values are:
  11371. @table @samp
  11372. @item info
  11373. information logging level
  11374. @item verbose
  11375. verbose logging level
  11376. @end table
  11377. By default, the logging level is set to @var{info}. If the @option{video} or
  11378. the @option{metadata} options are set, it switches to @var{verbose}.
  11379. @item peak
  11380. Set peak mode(s).
  11381. Available modes can be cumulated (the option is a @code{flag} type). Possible
  11382. values are:
  11383. @table @samp
  11384. @item none
  11385. Disable any peak mode (default).
  11386. @item sample
  11387. Enable sample-peak mode.
  11388. Simple peak mode looking for the higher sample value. It logs a message
  11389. for sample-peak (identified by @code{SPK}).
  11390. @item true
  11391. Enable true-peak mode.
  11392. If enabled, the peak lookup is done on an over-sampled version of the input
  11393. stream for better peak accuracy. It logs a message for true-peak.
  11394. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  11395. This mode requires a build with @code{libswresample}.
  11396. @end table
  11397. @item dualmono
  11398. Treat mono input files as "dual mono". If a mono file is intended for playback
  11399. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  11400. If set to @code{true}, this option will compensate for this effect.
  11401. Multi-channel input files are not affected by this option.
  11402. @item panlaw
  11403. Set a specific pan law to be used for the measurement of dual mono files.
  11404. This parameter is optional, and has a default value of -3.01dB.
  11405. @end table
  11406. @subsection Examples
  11407. @itemize
  11408. @item
  11409. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  11410. @example
  11411. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  11412. @end example
  11413. @item
  11414. Run an analysis with @command{ffmpeg}:
  11415. @example
  11416. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  11417. @end example
  11418. @end itemize
  11419. @section interleave, ainterleave
  11420. Temporally interleave frames from several inputs.
  11421. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  11422. These filters read frames from several inputs and send the oldest
  11423. queued frame to the output.
  11424. Input streams must have a well defined, monotonically increasing frame
  11425. timestamp values.
  11426. In order to submit one frame to output, these filters need to enqueue
  11427. at least one frame for each input, so they cannot work in case one
  11428. input is not yet terminated and will not receive incoming frames.
  11429. For example consider the case when one input is a @code{select} filter
  11430. which always drop input frames. The @code{interleave} filter will keep
  11431. reading from that input, but it will never be able to send new frames
  11432. to output until the input will send an end-of-stream signal.
  11433. Also, depending on inputs synchronization, the filters will drop
  11434. frames in case one input receives more frames than the other ones, and
  11435. the queue is already filled.
  11436. These filters accept the following options:
  11437. @table @option
  11438. @item nb_inputs, n
  11439. Set the number of different inputs, it is 2 by default.
  11440. @end table
  11441. @subsection Examples
  11442. @itemize
  11443. @item
  11444. Interleave frames belonging to different streams using @command{ffmpeg}:
  11445. @example
  11446. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  11447. @end example
  11448. @item
  11449. Add flickering blur effect:
  11450. @example
  11451. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  11452. @end example
  11453. @end itemize
  11454. @section perms, aperms
  11455. Set read/write permissions for the output frames.
  11456. These filters are mainly aimed at developers to test direct path in the
  11457. following filter in the filtergraph.
  11458. The filters accept the following options:
  11459. @table @option
  11460. @item mode
  11461. Select the permissions mode.
  11462. It accepts the following values:
  11463. @table @samp
  11464. @item none
  11465. Do nothing. This is the default.
  11466. @item ro
  11467. Set all the output frames read-only.
  11468. @item rw
  11469. Set all the output frames directly writable.
  11470. @item toggle
  11471. Make the frame read-only if writable, and writable if read-only.
  11472. @item random
  11473. Set each output frame read-only or writable randomly.
  11474. @end table
  11475. @item seed
  11476. Set the seed for the @var{random} mode, must be an integer included between
  11477. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11478. @code{-1}, the filter will try to use a good random seed on a best effort
  11479. basis.
  11480. @end table
  11481. Note: in case of auto-inserted filter between the permission filter and the
  11482. following one, the permission might not be received as expected in that
  11483. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  11484. perms/aperms filter can avoid this problem.
  11485. @section realtime, arealtime
  11486. Slow down filtering to match real time approximatively.
  11487. These filters will pause the filtering for a variable amount of time to
  11488. match the output rate with the input timestamps.
  11489. They are similar to the @option{re} option to @code{ffmpeg}.
  11490. They accept the following options:
  11491. @table @option
  11492. @item limit
  11493. Time limit for the pauses. Any pause longer than that will be considered
  11494. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  11495. @end table
  11496. @section select, aselect
  11497. Select frames to pass in output.
  11498. This filter accepts the following options:
  11499. @table @option
  11500. @item expr, e
  11501. Set expression, which is evaluated for each input frame.
  11502. If the expression is evaluated to zero, the frame is discarded.
  11503. If the evaluation result is negative or NaN, the frame is sent to the
  11504. first output; otherwise it is sent to the output with index
  11505. @code{ceil(val)-1}, assuming that the input index starts from 0.
  11506. For example a value of @code{1.2} corresponds to the output with index
  11507. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  11508. @item outputs, n
  11509. Set the number of outputs. The output to which to send the selected
  11510. frame is based on the result of the evaluation. Default value is 1.
  11511. @end table
  11512. The expression can contain the following constants:
  11513. @table @option
  11514. @item n
  11515. The (sequential) number of the filtered frame, starting from 0.
  11516. @item selected_n
  11517. The (sequential) number of the selected frame, starting from 0.
  11518. @item prev_selected_n
  11519. The sequential number of the last selected frame. It's NAN if undefined.
  11520. @item TB
  11521. The timebase of the input timestamps.
  11522. @item pts
  11523. The PTS (Presentation TimeStamp) of the filtered video frame,
  11524. expressed in @var{TB} units. It's NAN if undefined.
  11525. @item t
  11526. The PTS of the filtered video frame,
  11527. expressed in seconds. It's NAN if undefined.
  11528. @item prev_pts
  11529. The PTS of the previously filtered video frame. It's NAN if undefined.
  11530. @item prev_selected_pts
  11531. The PTS of the last previously filtered video frame. It's NAN if undefined.
  11532. @item prev_selected_t
  11533. The PTS of the last previously selected video frame. It's NAN if undefined.
  11534. @item start_pts
  11535. The PTS of the first video frame in the video. It's NAN if undefined.
  11536. @item start_t
  11537. The time of the first video frame in the video. It's NAN if undefined.
  11538. @item pict_type @emph{(video only)}
  11539. The type of the filtered frame. It can assume one of the following
  11540. values:
  11541. @table @option
  11542. @item I
  11543. @item P
  11544. @item B
  11545. @item S
  11546. @item SI
  11547. @item SP
  11548. @item BI
  11549. @end table
  11550. @item interlace_type @emph{(video only)}
  11551. The frame interlace type. It can assume one of the following values:
  11552. @table @option
  11553. @item PROGRESSIVE
  11554. The frame is progressive (not interlaced).
  11555. @item TOPFIRST
  11556. The frame is top-field-first.
  11557. @item BOTTOMFIRST
  11558. The frame is bottom-field-first.
  11559. @end table
  11560. @item consumed_sample_n @emph{(audio only)}
  11561. the number of selected samples before the current frame
  11562. @item samples_n @emph{(audio only)}
  11563. the number of samples in the current frame
  11564. @item sample_rate @emph{(audio only)}
  11565. the input sample rate
  11566. @item key
  11567. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  11568. @item pos
  11569. the position in the file of the filtered frame, -1 if the information
  11570. is not available (e.g. for synthetic video)
  11571. @item scene @emph{(video only)}
  11572. value between 0 and 1 to indicate a new scene; a low value reflects a low
  11573. probability for the current frame to introduce a new scene, while a higher
  11574. value means the current frame is more likely to be one (see the example below)
  11575. @item concatdec_select
  11576. The concat demuxer can select only part of a concat input file by setting an
  11577. inpoint and an outpoint, but the output packets may not be entirely contained
  11578. in the selected interval. By using this variable, it is possible to skip frames
  11579. generated by the concat demuxer which are not exactly contained in the selected
  11580. interval.
  11581. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  11582. and the @var{lavf.concat.duration} packet metadata values which are also
  11583. present in the decoded frames.
  11584. The @var{concatdec_select} variable is -1 if the frame pts is at least
  11585. start_time and either the duration metadata is missing or the frame pts is less
  11586. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  11587. missing.
  11588. That basically means that an input frame is selected if its pts is within the
  11589. interval set by the concat demuxer.
  11590. @end table
  11591. The default value of the select expression is "1".
  11592. @subsection Examples
  11593. @itemize
  11594. @item
  11595. Select all frames in input:
  11596. @example
  11597. select
  11598. @end example
  11599. The example above is the same as:
  11600. @example
  11601. select=1
  11602. @end example
  11603. @item
  11604. Skip all frames:
  11605. @example
  11606. select=0
  11607. @end example
  11608. @item
  11609. Select only I-frames:
  11610. @example
  11611. select='eq(pict_type\,I)'
  11612. @end example
  11613. @item
  11614. Select one frame every 100:
  11615. @example
  11616. select='not(mod(n\,100))'
  11617. @end example
  11618. @item
  11619. Select only frames contained in the 10-20 time interval:
  11620. @example
  11621. select=between(t\,10\,20)
  11622. @end example
  11623. @item
  11624. Select only I frames contained in the 10-20 time interval:
  11625. @example
  11626. select=between(t\,10\,20)*eq(pict_type\,I)
  11627. @end example
  11628. @item
  11629. Select frames with a minimum distance of 10 seconds:
  11630. @example
  11631. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  11632. @end example
  11633. @item
  11634. Use aselect to select only audio frames with samples number > 100:
  11635. @example
  11636. aselect='gt(samples_n\,100)'
  11637. @end example
  11638. @item
  11639. Create a mosaic of the first scenes:
  11640. @example
  11641. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  11642. @end example
  11643. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  11644. choice.
  11645. @item
  11646. Send even and odd frames to separate outputs, and compose them:
  11647. @example
  11648. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  11649. @end example
  11650. @item
  11651. Select useful frames from an ffconcat file which is using inpoints and
  11652. outpoints but where the source files are not intra frame only.
  11653. @example
  11654. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  11655. @end example
  11656. @end itemize
  11657. @section sendcmd, asendcmd
  11658. Send commands to filters in the filtergraph.
  11659. These filters read commands to be sent to other filters in the
  11660. filtergraph.
  11661. @code{sendcmd} must be inserted between two video filters,
  11662. @code{asendcmd} must be inserted between two audio filters, but apart
  11663. from that they act the same way.
  11664. The specification of commands can be provided in the filter arguments
  11665. with the @var{commands} option, or in a file specified by the
  11666. @var{filename} option.
  11667. These filters accept the following options:
  11668. @table @option
  11669. @item commands, c
  11670. Set the commands to be read and sent to the other filters.
  11671. @item filename, f
  11672. Set the filename of the commands to be read and sent to the other
  11673. filters.
  11674. @end table
  11675. @subsection Commands syntax
  11676. A commands description consists of a sequence of interval
  11677. specifications, comprising a list of commands to be executed when a
  11678. particular event related to that interval occurs. The occurring event
  11679. is typically the current frame time entering or leaving a given time
  11680. interval.
  11681. An interval is specified by the following syntax:
  11682. @example
  11683. @var{START}[-@var{END}] @var{COMMANDS};
  11684. @end example
  11685. The time interval is specified by the @var{START} and @var{END} times.
  11686. @var{END} is optional and defaults to the maximum time.
  11687. The current frame time is considered within the specified interval if
  11688. it is included in the interval [@var{START}, @var{END}), that is when
  11689. the time is greater or equal to @var{START} and is lesser than
  11690. @var{END}.
  11691. @var{COMMANDS} consists of a sequence of one or more command
  11692. specifications, separated by ",", relating to that interval. The
  11693. syntax of a command specification is given by:
  11694. @example
  11695. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  11696. @end example
  11697. @var{FLAGS} is optional and specifies the type of events relating to
  11698. the time interval which enable sending the specified command, and must
  11699. be a non-null sequence of identifier flags separated by "+" or "|" and
  11700. enclosed between "[" and "]".
  11701. The following flags are recognized:
  11702. @table @option
  11703. @item enter
  11704. The command is sent when the current frame timestamp enters the
  11705. specified interval. In other words, the command is sent when the
  11706. previous frame timestamp was not in the given interval, and the
  11707. current is.
  11708. @item leave
  11709. The command is sent when the current frame timestamp leaves the
  11710. specified interval. In other words, the command is sent when the
  11711. previous frame timestamp was in the given interval, and the
  11712. current is not.
  11713. @end table
  11714. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  11715. assumed.
  11716. @var{TARGET} specifies the target of the command, usually the name of
  11717. the filter class or a specific filter instance name.
  11718. @var{COMMAND} specifies the name of the command for the target filter.
  11719. @var{ARG} is optional and specifies the optional list of argument for
  11720. the given @var{COMMAND}.
  11721. Between one interval specification and another, whitespaces, or
  11722. sequences of characters starting with @code{#} until the end of line,
  11723. are ignored and can be used to annotate comments.
  11724. A simplified BNF description of the commands specification syntax
  11725. follows:
  11726. @example
  11727. @var{COMMAND_FLAG} ::= "enter" | "leave"
  11728. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  11729. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  11730. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  11731. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  11732. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  11733. @end example
  11734. @subsection Examples
  11735. @itemize
  11736. @item
  11737. Specify audio tempo change at second 4:
  11738. @example
  11739. asendcmd=c='4.0 atempo tempo 1.5',atempo
  11740. @end example
  11741. @item
  11742. Specify a list of drawtext and hue commands in a file.
  11743. @example
  11744. # show text in the interval 5-10
  11745. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  11746. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  11747. # desaturate the image in the interval 15-20
  11748. 15.0-20.0 [enter] hue s 0,
  11749. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  11750. [leave] hue s 1,
  11751. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  11752. # apply an exponential saturation fade-out effect, starting from time 25
  11753. 25 [enter] hue s exp(25-t)
  11754. @end example
  11755. A filtergraph allowing to read and process the above command list
  11756. stored in a file @file{test.cmd}, can be specified with:
  11757. @example
  11758. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  11759. @end example
  11760. @end itemize
  11761. @anchor{setpts}
  11762. @section setpts, asetpts
  11763. Change the PTS (presentation timestamp) of the input frames.
  11764. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  11765. This filter accepts the following options:
  11766. @table @option
  11767. @item expr
  11768. The expression which is evaluated for each frame to construct its timestamp.
  11769. @end table
  11770. The expression is evaluated through the eval API and can contain the following
  11771. constants:
  11772. @table @option
  11773. @item FRAME_RATE
  11774. frame rate, only defined for constant frame-rate video
  11775. @item PTS
  11776. The presentation timestamp in input
  11777. @item N
  11778. The count of the input frame for video or the number of consumed samples,
  11779. not including the current frame for audio, starting from 0.
  11780. @item NB_CONSUMED_SAMPLES
  11781. The number of consumed samples, not including the current frame (only
  11782. audio)
  11783. @item NB_SAMPLES, S
  11784. The number of samples in the current frame (only audio)
  11785. @item SAMPLE_RATE, SR
  11786. The audio sample rate.
  11787. @item STARTPTS
  11788. The PTS of the first frame.
  11789. @item STARTT
  11790. the time in seconds of the first frame
  11791. @item INTERLACED
  11792. State whether the current frame is interlaced.
  11793. @item T
  11794. the time in seconds of the current frame
  11795. @item POS
  11796. original position in the file of the frame, or undefined if undefined
  11797. for the current frame
  11798. @item PREV_INPTS
  11799. The previous input PTS.
  11800. @item PREV_INT
  11801. previous input time in seconds
  11802. @item PREV_OUTPTS
  11803. The previous output PTS.
  11804. @item PREV_OUTT
  11805. previous output time in seconds
  11806. @item RTCTIME
  11807. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  11808. instead.
  11809. @item RTCSTART
  11810. The wallclock (RTC) time at the start of the movie in microseconds.
  11811. @item TB
  11812. The timebase of the input timestamps.
  11813. @end table
  11814. @subsection Examples
  11815. @itemize
  11816. @item
  11817. Start counting PTS from zero
  11818. @example
  11819. setpts=PTS-STARTPTS
  11820. @end example
  11821. @item
  11822. Apply fast motion effect:
  11823. @example
  11824. setpts=0.5*PTS
  11825. @end example
  11826. @item
  11827. Apply slow motion effect:
  11828. @example
  11829. setpts=2.0*PTS
  11830. @end example
  11831. @item
  11832. Set fixed rate of 25 frames per second:
  11833. @example
  11834. setpts=N/(25*TB)
  11835. @end example
  11836. @item
  11837. Set fixed rate 25 fps with some jitter:
  11838. @example
  11839. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  11840. @end example
  11841. @item
  11842. Apply an offset of 10 seconds to the input PTS:
  11843. @example
  11844. setpts=PTS+10/TB
  11845. @end example
  11846. @item
  11847. Generate timestamps from a "live source" and rebase onto the current timebase:
  11848. @example
  11849. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  11850. @end example
  11851. @item
  11852. Generate timestamps by counting samples:
  11853. @example
  11854. asetpts=N/SR/TB
  11855. @end example
  11856. @end itemize
  11857. @section settb, asettb
  11858. Set the timebase to use for the output frames timestamps.
  11859. It is mainly useful for testing timebase configuration.
  11860. It accepts the following parameters:
  11861. @table @option
  11862. @item expr, tb
  11863. The expression which is evaluated into the output timebase.
  11864. @end table
  11865. The value for @option{tb} is an arithmetic expression representing a
  11866. rational. The expression can contain the constants "AVTB" (the default
  11867. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  11868. audio only). Default value is "intb".
  11869. @subsection Examples
  11870. @itemize
  11871. @item
  11872. Set the timebase to 1/25:
  11873. @example
  11874. settb=expr=1/25
  11875. @end example
  11876. @item
  11877. Set the timebase to 1/10:
  11878. @example
  11879. settb=expr=0.1
  11880. @end example
  11881. @item
  11882. Set the timebase to 1001/1000:
  11883. @example
  11884. settb=1+0.001
  11885. @end example
  11886. @item
  11887. Set the timebase to 2*intb:
  11888. @example
  11889. settb=2*intb
  11890. @end example
  11891. @item
  11892. Set the default timebase value:
  11893. @example
  11894. settb=AVTB
  11895. @end example
  11896. @end itemize
  11897. @section showcqt
  11898. Convert input audio to a video output representing frequency spectrum
  11899. logarithmically using Brown-Puckette constant Q transform algorithm with
  11900. direct frequency domain coefficient calculation (but the transform itself
  11901. is not really constant Q, instead the Q factor is actually variable/clamped),
  11902. with musical tone scale, from E0 to D#10.
  11903. The filter accepts the following options:
  11904. @table @option
  11905. @item size, s
  11906. Specify the video size for the output. It must be even. For the syntax of this option,
  11907. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11908. Default value is @code{1920x1080}.
  11909. @item fps, rate, r
  11910. Set the output frame rate. Default value is @code{25}.
  11911. @item bar_h
  11912. Set the bargraph height. It must be even. Default value is @code{-1} which
  11913. computes the bargraph height automatically.
  11914. @item axis_h
  11915. Set the axis height. It must be even. Default value is @code{-1} which computes
  11916. the axis height automatically.
  11917. @item sono_h
  11918. Set the sonogram height. It must be even. Default value is @code{-1} which
  11919. computes the sonogram height automatically.
  11920. @item fullhd
  11921. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  11922. instead. Default value is @code{1}.
  11923. @item sono_v, volume
  11924. Specify the sonogram volume expression. It can contain variables:
  11925. @table @option
  11926. @item bar_v
  11927. the @var{bar_v} evaluated expression
  11928. @item frequency, freq, f
  11929. the frequency where it is evaluated
  11930. @item timeclamp, tc
  11931. the value of @var{timeclamp} option
  11932. @end table
  11933. and functions:
  11934. @table @option
  11935. @item a_weighting(f)
  11936. A-weighting of equal loudness
  11937. @item b_weighting(f)
  11938. B-weighting of equal loudness
  11939. @item c_weighting(f)
  11940. C-weighting of equal loudness.
  11941. @end table
  11942. Default value is @code{16}.
  11943. @item bar_v, volume2
  11944. Specify the bargraph volume expression. It can contain variables:
  11945. @table @option
  11946. @item sono_v
  11947. the @var{sono_v} evaluated expression
  11948. @item frequency, freq, f
  11949. the frequency where it is evaluated
  11950. @item timeclamp, tc
  11951. the value of @var{timeclamp} option
  11952. @end table
  11953. and functions:
  11954. @table @option
  11955. @item a_weighting(f)
  11956. A-weighting of equal loudness
  11957. @item b_weighting(f)
  11958. B-weighting of equal loudness
  11959. @item c_weighting(f)
  11960. C-weighting of equal loudness.
  11961. @end table
  11962. Default value is @code{sono_v}.
  11963. @item sono_g, gamma
  11964. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  11965. higher gamma makes the spectrum having more range. Default value is @code{3}.
  11966. Acceptable range is @code{[1, 7]}.
  11967. @item bar_g, gamma2
  11968. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  11969. @code{[1, 7]}.
  11970. @item timeclamp, tc
  11971. Specify the transform timeclamp. At low frequency, there is trade-off between
  11972. accuracy in time domain and frequency domain. If timeclamp is lower,
  11973. event in time domain is represented more accurately (such as fast bass drum),
  11974. otherwise event in frequency domain is represented more accurately
  11975. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  11976. @item basefreq
  11977. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  11978. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  11979. @item endfreq
  11980. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  11981. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  11982. @item coeffclamp
  11983. This option is deprecated and ignored.
  11984. @item tlength
  11985. Specify the transform length in time domain. Use this option to control accuracy
  11986. trade-off between time domain and frequency domain at every frequency sample.
  11987. It can contain variables:
  11988. @table @option
  11989. @item frequency, freq, f
  11990. the frequency where it is evaluated
  11991. @item timeclamp, tc
  11992. the value of @var{timeclamp} option.
  11993. @end table
  11994. Default value is @code{384*tc/(384+tc*f)}.
  11995. @item count
  11996. Specify the transform count for every video frame. Default value is @code{6}.
  11997. Acceptable range is @code{[1, 30]}.
  11998. @item fcount
  11999. Specify the transform count for every single pixel. Default value is @code{0},
  12000. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  12001. @item fontfile
  12002. Specify font file for use with freetype to draw the axis. If not specified,
  12003. use embedded font. Note that drawing with font file or embedded font is not
  12004. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  12005. option instead.
  12006. @item fontcolor
  12007. Specify font color expression. This is arithmetic expression that should return
  12008. integer value 0xRRGGBB. It can contain variables:
  12009. @table @option
  12010. @item frequency, freq, f
  12011. the frequency where it is evaluated
  12012. @item timeclamp, tc
  12013. the value of @var{timeclamp} option
  12014. @end table
  12015. and functions:
  12016. @table @option
  12017. @item midi(f)
  12018. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  12019. @item r(x), g(x), b(x)
  12020. red, green, and blue value of intensity x.
  12021. @end table
  12022. Default value is @code{st(0, (midi(f)-59.5)/12);
  12023. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  12024. r(1-ld(1)) + b(ld(1))}.
  12025. @item axisfile
  12026. Specify image file to draw the axis. This option override @var{fontfile} and
  12027. @var{fontcolor} option.
  12028. @item axis, text
  12029. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  12030. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  12031. Default value is @code{1}.
  12032. @end table
  12033. @subsection Examples
  12034. @itemize
  12035. @item
  12036. Playing audio while showing the spectrum:
  12037. @example
  12038. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  12039. @end example
  12040. @item
  12041. Same as above, but with frame rate 30 fps:
  12042. @example
  12043. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  12044. @end example
  12045. @item
  12046. Playing at 1280x720:
  12047. @example
  12048. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  12049. @end example
  12050. @item
  12051. Disable sonogram display:
  12052. @example
  12053. sono_h=0
  12054. @end example
  12055. @item
  12056. A1 and its harmonics: A1, A2, (near)E3, A3:
  12057. @example
  12058. 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),
  12059. asplit[a][out1]; [a] showcqt [out0]'
  12060. @end example
  12061. @item
  12062. Same as above, but with more accuracy in frequency domain:
  12063. @example
  12064. 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),
  12065. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  12066. @end example
  12067. @item
  12068. Custom volume:
  12069. @example
  12070. bar_v=10:sono_v=bar_v*a_weighting(f)
  12071. @end example
  12072. @item
  12073. Custom gamma, now spectrum is linear to the amplitude.
  12074. @example
  12075. bar_g=2:sono_g=2
  12076. @end example
  12077. @item
  12078. Custom tlength equation:
  12079. @example
  12080. 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)))'
  12081. @end example
  12082. @item
  12083. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  12084. @example
  12085. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  12086. @end example
  12087. @item
  12088. Custom frequency range with custom axis using image file:
  12089. @example
  12090. axisfile=myaxis.png:basefreq=40:endfreq=10000
  12091. @end example
  12092. @end itemize
  12093. @section showfreqs
  12094. Convert input audio to video output representing the audio power spectrum.
  12095. Audio amplitude is on Y-axis while frequency is on X-axis.
  12096. The filter accepts the following options:
  12097. @table @option
  12098. @item size, s
  12099. Specify size of video. For the syntax of this option, check the
  12100. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12101. Default is @code{1024x512}.
  12102. @item mode
  12103. Set display mode.
  12104. This set how each frequency bin will be represented.
  12105. It accepts the following values:
  12106. @table @samp
  12107. @item line
  12108. @item bar
  12109. @item dot
  12110. @end table
  12111. Default is @code{bar}.
  12112. @item ascale
  12113. Set amplitude scale.
  12114. It accepts the following values:
  12115. @table @samp
  12116. @item lin
  12117. Linear scale.
  12118. @item sqrt
  12119. Square root scale.
  12120. @item cbrt
  12121. Cubic root scale.
  12122. @item log
  12123. Logarithmic scale.
  12124. @end table
  12125. Default is @code{log}.
  12126. @item fscale
  12127. Set frequency scale.
  12128. It accepts the following values:
  12129. @table @samp
  12130. @item lin
  12131. Linear scale.
  12132. @item log
  12133. Logarithmic scale.
  12134. @item rlog
  12135. Reverse logarithmic scale.
  12136. @end table
  12137. Default is @code{lin}.
  12138. @item win_size
  12139. Set window size.
  12140. It accepts the following values:
  12141. @table @samp
  12142. @item w16
  12143. @item w32
  12144. @item w64
  12145. @item w128
  12146. @item w256
  12147. @item w512
  12148. @item w1024
  12149. @item w2048
  12150. @item w4096
  12151. @item w8192
  12152. @item w16384
  12153. @item w32768
  12154. @item w65536
  12155. @end table
  12156. Default is @code{w2048}
  12157. @item win_func
  12158. Set windowing function.
  12159. It accepts the following values:
  12160. @table @samp
  12161. @item rect
  12162. @item bartlett
  12163. @item hanning
  12164. @item hamming
  12165. @item blackman
  12166. @item welch
  12167. @item flattop
  12168. @item bharris
  12169. @item bnuttall
  12170. @item bhann
  12171. @item sine
  12172. @item nuttall
  12173. @item lanczos
  12174. @item gauss
  12175. @item tukey
  12176. @end table
  12177. Default is @code{hanning}.
  12178. @item overlap
  12179. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12180. which means optimal overlap for selected window function will be picked.
  12181. @item averaging
  12182. Set time averaging. Setting this to 0 will display current maximal peaks.
  12183. Default is @code{1}, which means time averaging is disabled.
  12184. @item colors
  12185. Specify list of colors separated by space or by '|' which will be used to
  12186. draw channel frequencies. Unrecognized or missing colors will be replaced
  12187. by white color.
  12188. @item cmode
  12189. Set channel display mode.
  12190. It accepts the following values:
  12191. @table @samp
  12192. @item combined
  12193. @item separate
  12194. @end table
  12195. Default is @code{combined}.
  12196. @end table
  12197. @anchor{showspectrum}
  12198. @section showspectrum
  12199. Convert input audio to a video output, representing the audio frequency
  12200. spectrum.
  12201. The filter accepts the following options:
  12202. @table @option
  12203. @item size, s
  12204. Specify the video size for the output. For the syntax of this option, check the
  12205. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12206. Default value is @code{640x512}.
  12207. @item slide
  12208. Specify how the spectrum should slide along the window.
  12209. It accepts the following values:
  12210. @table @samp
  12211. @item replace
  12212. the samples start again on the left when they reach the right
  12213. @item scroll
  12214. the samples scroll from right to left
  12215. @item rscroll
  12216. the samples scroll from left to right
  12217. @item fullframe
  12218. frames are only produced when the samples reach the right
  12219. @end table
  12220. Default value is @code{replace}.
  12221. @item mode
  12222. Specify display mode.
  12223. It accepts the following values:
  12224. @table @samp
  12225. @item combined
  12226. all channels are displayed in the same row
  12227. @item separate
  12228. all channels are displayed in separate rows
  12229. @end table
  12230. Default value is @samp{combined}.
  12231. @item color
  12232. Specify display color mode.
  12233. It accepts the following values:
  12234. @table @samp
  12235. @item channel
  12236. each channel is displayed in a separate color
  12237. @item intensity
  12238. each channel is displayed using the same color scheme
  12239. @item rainbow
  12240. each channel is displayed using the rainbow color scheme
  12241. @item moreland
  12242. each channel is displayed using the moreland color scheme
  12243. @item nebulae
  12244. each channel is displayed using the nebulae color scheme
  12245. @item fire
  12246. each channel is displayed using the fire color scheme
  12247. @item fiery
  12248. each channel is displayed using the fiery color scheme
  12249. @item fruit
  12250. each channel is displayed using the fruit color scheme
  12251. @item cool
  12252. each channel is displayed using the cool color scheme
  12253. @end table
  12254. Default value is @samp{channel}.
  12255. @item scale
  12256. Specify scale used for calculating intensity color values.
  12257. It accepts the following values:
  12258. @table @samp
  12259. @item lin
  12260. linear
  12261. @item sqrt
  12262. square root, default
  12263. @item cbrt
  12264. cubic root
  12265. @item 4thrt
  12266. 4th root
  12267. @item 5thrt
  12268. 5th root
  12269. @item log
  12270. logarithmic
  12271. @end table
  12272. Default value is @samp{sqrt}.
  12273. @item saturation
  12274. Set saturation modifier for displayed colors. Negative values provide
  12275. alternative color scheme. @code{0} is no saturation at all.
  12276. Saturation must be in [-10.0, 10.0] range.
  12277. Default value is @code{1}.
  12278. @item win_func
  12279. Set window function.
  12280. It accepts the following values:
  12281. @table @samp
  12282. @item rect
  12283. @item bartlett
  12284. @item hann
  12285. @item hanning
  12286. @item hamming
  12287. @item blackman
  12288. @item welch
  12289. @item flattop
  12290. @item bharris
  12291. @item bnuttall
  12292. @item bhann
  12293. @item sine
  12294. @item nuttall
  12295. @item lanczos
  12296. @item gauss
  12297. @item tukey
  12298. @end table
  12299. Default value is @code{hann}.
  12300. @item orientation
  12301. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12302. @code{horizontal}. Default is @code{vertical}.
  12303. @item overlap
  12304. Set ratio of overlap window. Default value is @code{0}.
  12305. When value is @code{1} overlap is set to recommended size for specific
  12306. window function currently used.
  12307. @item gain
  12308. Set scale gain for calculating intensity color values.
  12309. Default value is @code{1}.
  12310. @item data
  12311. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  12312. @end table
  12313. The usage is very similar to the showwaves filter; see the examples in that
  12314. section.
  12315. @subsection Examples
  12316. @itemize
  12317. @item
  12318. Large window with logarithmic color scaling:
  12319. @example
  12320. showspectrum=s=1280x480:scale=log
  12321. @end example
  12322. @item
  12323. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  12324. @example
  12325. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12326. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  12327. @end example
  12328. @end itemize
  12329. @section showspectrumpic
  12330. Convert input audio to a single video frame, representing the audio frequency
  12331. spectrum.
  12332. The filter accepts the following options:
  12333. @table @option
  12334. @item size, s
  12335. Specify the video size for the output. For the syntax of this option, check the
  12336. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12337. Default value is @code{4096x2048}.
  12338. @item mode
  12339. Specify display mode.
  12340. It accepts the following values:
  12341. @table @samp
  12342. @item combined
  12343. all channels are displayed in the same row
  12344. @item separate
  12345. all channels are displayed in separate rows
  12346. @end table
  12347. Default value is @samp{combined}.
  12348. @item color
  12349. Specify display color mode.
  12350. It accepts the following values:
  12351. @table @samp
  12352. @item channel
  12353. each channel is displayed in a separate color
  12354. @item intensity
  12355. each channel is displayed using the same color scheme
  12356. @item rainbow
  12357. each channel is displayed using the rainbow color scheme
  12358. @item moreland
  12359. each channel is displayed using the moreland color scheme
  12360. @item nebulae
  12361. each channel is displayed using the nebulae color scheme
  12362. @item fire
  12363. each channel is displayed using the fire color scheme
  12364. @item fiery
  12365. each channel is displayed using the fiery color scheme
  12366. @item fruit
  12367. each channel is displayed using the fruit color scheme
  12368. @item cool
  12369. each channel is displayed using the cool color scheme
  12370. @end table
  12371. Default value is @samp{intensity}.
  12372. @item scale
  12373. Specify scale used for calculating intensity color values.
  12374. It accepts the following values:
  12375. @table @samp
  12376. @item lin
  12377. linear
  12378. @item sqrt
  12379. square root, default
  12380. @item cbrt
  12381. cubic root
  12382. @item 4thrt
  12383. 4th root
  12384. @item 5thrt
  12385. 5th root
  12386. @item log
  12387. logarithmic
  12388. @end table
  12389. Default value is @samp{log}.
  12390. @item saturation
  12391. Set saturation modifier for displayed colors. Negative values provide
  12392. alternative color scheme. @code{0} is no saturation at all.
  12393. Saturation must be in [-10.0, 10.0] range.
  12394. Default value is @code{1}.
  12395. @item win_func
  12396. Set window function.
  12397. It accepts the following values:
  12398. @table @samp
  12399. @item rect
  12400. @item bartlett
  12401. @item hann
  12402. @item hanning
  12403. @item hamming
  12404. @item blackman
  12405. @item welch
  12406. @item flattop
  12407. @item bharris
  12408. @item bnuttall
  12409. @item bhann
  12410. @item sine
  12411. @item nuttall
  12412. @item lanczos
  12413. @item gauss
  12414. @item tukey
  12415. @end table
  12416. Default value is @code{hann}.
  12417. @item orientation
  12418. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12419. @code{horizontal}. Default is @code{vertical}.
  12420. @item gain
  12421. Set scale gain for calculating intensity color values.
  12422. Default value is @code{1}.
  12423. @item legend
  12424. Draw time and frequency axes and legends. Default is enabled.
  12425. @end table
  12426. @subsection Examples
  12427. @itemize
  12428. @item
  12429. Extract an audio spectrogram of a whole audio track
  12430. in a 1024x1024 picture using @command{ffmpeg}:
  12431. @example
  12432. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  12433. @end example
  12434. @end itemize
  12435. @section showvolume
  12436. Convert input audio volume to a video output.
  12437. The filter accepts the following options:
  12438. @table @option
  12439. @item rate, r
  12440. Set video rate.
  12441. @item b
  12442. Set border width, allowed range is [0, 5]. Default is 1.
  12443. @item w
  12444. Set channel width, allowed range is [80, 8192]. Default is 400.
  12445. @item h
  12446. Set channel height, allowed range is [1, 900]. Default is 20.
  12447. @item f
  12448. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  12449. @item c
  12450. Set volume color expression.
  12451. The expression can use the following variables:
  12452. @table @option
  12453. @item VOLUME
  12454. Current max volume of channel in dB.
  12455. @item CHANNEL
  12456. Current channel number, starting from 0.
  12457. @end table
  12458. @item t
  12459. If set, displays channel names. Default is enabled.
  12460. @item v
  12461. If set, displays volume values. Default is enabled.
  12462. @item o
  12463. Set orientation, can be @code{horizontal} or @code{vertical},
  12464. default is @code{horizontal}.
  12465. @item s
  12466. Set step size, allowed range s [0, 5]. Default is 0, which means
  12467. step is disabled.
  12468. @end table
  12469. @section showwaves
  12470. Convert input audio to a video output, representing the samples waves.
  12471. The filter accepts the following options:
  12472. @table @option
  12473. @item size, s
  12474. Specify the video size for the output. For the syntax of this option, check the
  12475. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12476. Default value is @code{600x240}.
  12477. @item mode
  12478. Set display mode.
  12479. Available values are:
  12480. @table @samp
  12481. @item point
  12482. Draw a point for each sample.
  12483. @item line
  12484. Draw a vertical line for each sample.
  12485. @item p2p
  12486. Draw a point for each sample and a line between them.
  12487. @item cline
  12488. Draw a centered vertical line for each sample.
  12489. @end table
  12490. Default value is @code{point}.
  12491. @item n
  12492. Set the number of samples which are printed on the same column. A
  12493. larger value will decrease the frame rate. Must be a positive
  12494. integer. This option can be set only if the value for @var{rate}
  12495. is not explicitly specified.
  12496. @item rate, r
  12497. Set the (approximate) output frame rate. This is done by setting the
  12498. option @var{n}. Default value is "25".
  12499. @item split_channels
  12500. Set if channels should be drawn separately or overlap. Default value is 0.
  12501. @item colors
  12502. Set colors separated by '|' which are going to be used for drawing of each channel.
  12503. @item scale
  12504. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12505. Default is linear.
  12506. @end table
  12507. @subsection Examples
  12508. @itemize
  12509. @item
  12510. Output the input file audio and the corresponding video representation
  12511. at the same time:
  12512. @example
  12513. amovie=a.mp3,asplit[out0],showwaves[out1]
  12514. @end example
  12515. @item
  12516. Create a synthetic signal and show it with showwaves, forcing a
  12517. frame rate of 30 frames per second:
  12518. @example
  12519. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  12520. @end example
  12521. @end itemize
  12522. @section showwavespic
  12523. Convert input audio to a single video frame, representing the samples waves.
  12524. The filter accepts the following options:
  12525. @table @option
  12526. @item size, s
  12527. Specify the video size for the output. For the syntax of this option, check the
  12528. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12529. Default value is @code{600x240}.
  12530. @item split_channels
  12531. Set if channels should be drawn separately or overlap. Default value is 0.
  12532. @item colors
  12533. Set colors separated by '|' which are going to be used for drawing of each channel.
  12534. @item scale
  12535. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12536. Default is linear.
  12537. @end table
  12538. @subsection Examples
  12539. @itemize
  12540. @item
  12541. Extract a channel split representation of the wave form of a whole audio track
  12542. in a 1024x800 picture using @command{ffmpeg}:
  12543. @example
  12544. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  12545. @end example
  12546. @item
  12547. Colorize the waveform with colorchannelmixer. This example will make
  12548. the waveform a green color approximately RGB(66,217,150). Additional
  12549. channels will be shades of this color.
  12550. @example
  12551. ffmpeg -i audio.mp3 -filter_complex "showwavespic,colorchannelmixer=rr=66/255:gg=217/255:bb=150/255" waveform.png
  12552. @end example
  12553. @end itemize
  12554. @section spectrumsynth
  12555. Sythesize audio from 2 input video spectrums, first input stream represents
  12556. magnitude across time and second represents phase across time.
  12557. The filter will transform from frequency domain as displayed in videos back
  12558. to time domain as presented in audio output.
  12559. This filter is primarly created for reversing processed @ref{showspectrum}
  12560. filter outputs, but can synthesize sound from other spectrograms too.
  12561. But in such case results are going to be poor if the phase data is not
  12562. available, because in such cases phase data need to be recreated, usually
  12563. its just recreated from random noise.
  12564. For best results use gray only output (@code{channel} color mode in
  12565. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  12566. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  12567. @code{data} option. Inputs videos should generally use @code{fullframe}
  12568. slide mode as that saves resources needed for decoding video.
  12569. The filter accepts the following options:
  12570. @table @option
  12571. @item sample_rate
  12572. Specify sample rate of output audio, the sample rate of audio from which
  12573. spectrum was generated may differ.
  12574. @item channels
  12575. Set number of channels represented in input video spectrums.
  12576. @item scale
  12577. Set scale which was used when generating magnitude input spectrum.
  12578. Can be @code{lin} or @code{log}. Default is @code{log}.
  12579. @item slide
  12580. Set slide which was used when generating inputs spectrums.
  12581. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  12582. Default is @code{fullframe}.
  12583. @item win_func
  12584. Set window function used for resynthesis.
  12585. @item overlap
  12586. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12587. which means optimal overlap for selected window function will be picked.
  12588. @item orientation
  12589. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  12590. Default is @code{vertical}.
  12591. @end table
  12592. @subsection Examples
  12593. @itemize
  12594. @item
  12595. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  12596. then resynthesize videos back to audio with spectrumsynth:
  12597. @example
  12598. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=log:overlap=0.875:color=channel:slide=fullframe:data=magnitude -an -c:v rawvideo magnitude.nut
  12599. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=lin:overlap=0.875:color=channel:slide=fullframe:data=phase -an -c:v rawvideo phase.nut
  12600. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  12601. @end example
  12602. @end itemize
  12603. @section split, asplit
  12604. Split input into several identical outputs.
  12605. @code{asplit} works with audio input, @code{split} with video.
  12606. The filter accepts a single parameter which specifies the number of outputs. If
  12607. unspecified, it defaults to 2.
  12608. @subsection Examples
  12609. @itemize
  12610. @item
  12611. Create two separate outputs from the same input:
  12612. @example
  12613. [in] split [out0][out1]
  12614. @end example
  12615. @item
  12616. To create 3 or more outputs, you need to specify the number of
  12617. outputs, like in:
  12618. @example
  12619. [in] asplit=3 [out0][out1][out2]
  12620. @end example
  12621. @item
  12622. Create two separate outputs from the same input, one cropped and
  12623. one padded:
  12624. @example
  12625. [in] split [splitout1][splitout2];
  12626. [splitout1] crop=100:100:0:0 [cropout];
  12627. [splitout2] pad=200:200:100:100 [padout];
  12628. @end example
  12629. @item
  12630. Create 5 copies of the input audio with @command{ffmpeg}:
  12631. @example
  12632. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  12633. @end example
  12634. @end itemize
  12635. @section zmq, azmq
  12636. Receive commands sent through a libzmq client, and forward them to
  12637. filters in the filtergraph.
  12638. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  12639. must be inserted between two video filters, @code{azmq} between two
  12640. audio filters.
  12641. To enable these filters you need to install the libzmq library and
  12642. headers and configure FFmpeg with @code{--enable-libzmq}.
  12643. For more information about libzmq see:
  12644. @url{http://www.zeromq.org/}
  12645. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  12646. receives messages sent through a network interface defined by the
  12647. @option{bind_address} option.
  12648. The received message must be in the form:
  12649. @example
  12650. @var{TARGET} @var{COMMAND} [@var{ARG}]
  12651. @end example
  12652. @var{TARGET} specifies the target of the command, usually the name of
  12653. the filter class or a specific filter instance name.
  12654. @var{COMMAND} specifies the name of the command for the target filter.
  12655. @var{ARG} is optional and specifies the optional argument list for the
  12656. given @var{COMMAND}.
  12657. Upon reception, the message is processed and the corresponding command
  12658. is injected into the filtergraph. Depending on the result, the filter
  12659. will send a reply to the client, adopting the format:
  12660. @example
  12661. @var{ERROR_CODE} @var{ERROR_REASON}
  12662. @var{MESSAGE}
  12663. @end example
  12664. @var{MESSAGE} is optional.
  12665. @subsection Examples
  12666. Look at @file{tools/zmqsend} for an example of a zmq client which can
  12667. be used to send commands processed by these filters.
  12668. Consider the following filtergraph generated by @command{ffplay}
  12669. @example
  12670. ffplay -dumpgraph 1 -f lavfi "
  12671. color=s=100x100:c=red [l];
  12672. color=s=100x100:c=blue [r];
  12673. nullsrc=s=200x100, zmq [bg];
  12674. [bg][l] overlay [bg+l];
  12675. [bg+l][r] overlay=x=100 "
  12676. @end example
  12677. To change the color of the left side of the video, the following
  12678. command can be used:
  12679. @example
  12680. echo Parsed_color_0 c yellow | tools/zmqsend
  12681. @end example
  12682. To change the right side:
  12683. @example
  12684. echo Parsed_color_1 c pink | tools/zmqsend
  12685. @end example
  12686. @c man end MULTIMEDIA FILTERS
  12687. @chapter Multimedia Sources
  12688. @c man begin MULTIMEDIA SOURCES
  12689. Below is a description of the currently available multimedia sources.
  12690. @section amovie
  12691. This is the same as @ref{movie} source, except it selects an audio
  12692. stream by default.
  12693. @anchor{movie}
  12694. @section movie
  12695. Read audio and/or video stream(s) from a movie container.
  12696. It accepts the following parameters:
  12697. @table @option
  12698. @item filename
  12699. The name of the resource to read (not necessarily a file; it can also be a
  12700. device or a stream accessed through some protocol).
  12701. @item format_name, f
  12702. Specifies the format assumed for the movie to read, and can be either
  12703. the name of a container or an input device. If not specified, the
  12704. format is guessed from @var{movie_name} or by probing.
  12705. @item seek_point, sp
  12706. Specifies the seek point in seconds. The frames will be output
  12707. starting from this seek point. The parameter is evaluated with
  12708. @code{av_strtod}, so the numerical value may be suffixed by an IS
  12709. postfix. The default value is "0".
  12710. @item streams, s
  12711. Specifies the streams to read. Several streams can be specified,
  12712. separated by "+". The source will then have as many outputs, in the
  12713. same order. The syntax is explained in the ``Stream specifiers''
  12714. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  12715. respectively the default (best suited) video and audio stream. Default
  12716. is "dv", or "da" if the filter is called as "amovie".
  12717. @item stream_index, si
  12718. Specifies the index of the video stream to read. If the value is -1,
  12719. the most suitable video stream will be automatically selected. The default
  12720. value is "-1". Deprecated. If the filter is called "amovie", it will select
  12721. audio instead of video.
  12722. @item loop
  12723. Specifies how many times to read the stream in sequence.
  12724. If the value is less than 1, the stream will be read again and again.
  12725. Default value is "1".
  12726. Note that when the movie is looped the source timestamps are not
  12727. changed, so it will generate non monotonically increasing timestamps.
  12728. @end table
  12729. It allows overlaying a second video on top of the main input of
  12730. a filtergraph, as shown in this graph:
  12731. @example
  12732. input -----------> deltapts0 --> overlay --> output
  12733. ^
  12734. |
  12735. movie --> scale--> deltapts1 -------+
  12736. @end example
  12737. @subsection Examples
  12738. @itemize
  12739. @item
  12740. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  12741. on top of the input labelled "in":
  12742. @example
  12743. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  12744. [in] setpts=PTS-STARTPTS [main];
  12745. [main][over] overlay=16:16 [out]
  12746. @end example
  12747. @item
  12748. Read from a video4linux2 device, and overlay it on top of the input
  12749. labelled "in":
  12750. @example
  12751. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  12752. [in] setpts=PTS-STARTPTS [main];
  12753. [main][over] overlay=16:16 [out]
  12754. @end example
  12755. @item
  12756. Read the first video stream and the audio stream with id 0x81 from
  12757. dvd.vob; the video is connected to the pad named "video" and the audio is
  12758. connected to the pad named "audio":
  12759. @example
  12760. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  12761. @end example
  12762. @end itemize
  12763. @c man end MULTIMEDIA SOURCES