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.

14460 lines
394KB

  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 acrossfade
  256. Apply cross fade from one input audio stream to another input audio stream.
  257. The cross fade is applied for specified duration near the end of first stream.
  258. The filter accepts the following options:
  259. @table @option
  260. @item nb_samples, ns
  261. Specify the number of samples for which the cross fade effect has to last.
  262. At the end of the cross fade effect the first input audio will be completely
  263. silent. Default is 44100.
  264. @item duration, d
  265. Specify the duration of the cross fade effect. See
  266. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  267. for the accepted syntax.
  268. By default the duration is determined by @var{nb_samples}.
  269. If set this option is used instead of @var{nb_samples}.
  270. @item overlap, o
  271. Should first stream end overlap with second stream start. Default is enabled.
  272. @item curve1
  273. Set curve for cross fade transition for first stream.
  274. @item curve2
  275. Set curve for cross fade transition for second stream.
  276. For description of available curve types see @ref{afade} filter description.
  277. @end table
  278. @subsection Examples
  279. @itemize
  280. @item
  281. Cross fade from one input to another:
  282. @example
  283. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  284. @end example
  285. @item
  286. Cross fade from one input to another but without overlapping:
  287. @example
  288. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  289. @end example
  290. @end itemize
  291. @section adelay
  292. Delay one or more audio channels.
  293. Samples in delayed channel are filled with silence.
  294. The filter accepts the following option:
  295. @table @option
  296. @item delays
  297. Set list of delays in milliseconds for each channel separated by '|'.
  298. At least one delay greater than 0 should be provided.
  299. Unused delays will be silently ignored. If number of given delays is
  300. smaller than number of channels all remaining channels will not be delayed.
  301. @end table
  302. @subsection Examples
  303. @itemize
  304. @item
  305. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  306. the second channel (and any other channels that may be present) unchanged.
  307. @example
  308. adelay=1500|0|500
  309. @end example
  310. @end itemize
  311. @section aecho
  312. Apply echoing to the input audio.
  313. Echoes are reflected sound and can occur naturally amongst mountains
  314. (and sometimes large buildings) when talking or shouting; digital echo
  315. effects emulate this behaviour and are often used to help fill out the
  316. sound of a single instrument or vocal. The time difference between the
  317. original signal and the reflection is the @code{delay}, and the
  318. loudness of the reflected signal is the @code{decay}.
  319. Multiple echoes can have different delays and decays.
  320. A description of the accepted parameters follows.
  321. @table @option
  322. @item in_gain
  323. Set input gain of reflected signal. Default is @code{0.6}.
  324. @item out_gain
  325. Set output gain of reflected signal. Default is @code{0.3}.
  326. @item delays
  327. Set list of time intervals in milliseconds between original signal and reflections
  328. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  329. Default is @code{1000}.
  330. @item decays
  331. Set list of loudnesses of reflected signals separated by '|'.
  332. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  333. Default is @code{0.5}.
  334. @end table
  335. @subsection Examples
  336. @itemize
  337. @item
  338. Make it sound as if there are twice as many instruments as are actually playing:
  339. @example
  340. aecho=0.8:0.88:60:0.4
  341. @end example
  342. @item
  343. If delay is very short, then it sound like a (metallic) robot playing music:
  344. @example
  345. aecho=0.8:0.88:6:0.4
  346. @end example
  347. @item
  348. A longer delay will sound like an open air concert in the mountains:
  349. @example
  350. aecho=0.8:0.9:1000:0.3
  351. @end example
  352. @item
  353. Same as above but with one more mountain:
  354. @example
  355. aecho=0.8:0.9:1000|1800:0.3|0.25
  356. @end example
  357. @end itemize
  358. @section aeval
  359. Modify an audio signal according to the specified expressions.
  360. This filter accepts one or more expressions (one for each channel),
  361. which are evaluated and used to modify a corresponding audio signal.
  362. It accepts the following parameters:
  363. @table @option
  364. @item exprs
  365. Set the '|'-separated expressions list for each separate channel. If
  366. the number of input channels is greater than the number of
  367. expressions, the last specified expression is used for the remaining
  368. output channels.
  369. @item channel_layout, c
  370. Set output channel layout. If not specified, the channel layout is
  371. specified by the number of expressions. If set to @samp{same}, it will
  372. use by default the same input channel layout.
  373. @end table
  374. Each expression in @var{exprs} can contain the following constants and functions:
  375. @table @option
  376. @item ch
  377. channel number of the current expression
  378. @item n
  379. number of the evaluated sample, starting from 0
  380. @item s
  381. sample rate
  382. @item t
  383. time of the evaluated sample expressed in seconds
  384. @item nb_in_channels
  385. @item nb_out_channels
  386. input and output number of channels
  387. @item val(CH)
  388. the value of input channel with number @var{CH}
  389. @end table
  390. Note: this filter is slow. For faster processing you should use a
  391. dedicated filter.
  392. @subsection Examples
  393. @itemize
  394. @item
  395. Half volume:
  396. @example
  397. aeval=val(ch)/2:c=same
  398. @end example
  399. @item
  400. Invert phase of the second channel:
  401. @example
  402. aeval=val(0)|-val(1)
  403. @end example
  404. @end itemize
  405. @anchor{afade}
  406. @section afade
  407. Apply fade-in/out effect to input audio.
  408. A description of the accepted parameters follows.
  409. @table @option
  410. @item type, t
  411. Specify the effect type, can be either @code{in} for fade-in, or
  412. @code{out} for a fade-out effect. Default is @code{in}.
  413. @item start_sample, ss
  414. Specify the number of the start sample for starting to apply the fade
  415. effect. Default is 0.
  416. @item nb_samples, ns
  417. Specify the number of samples for which the fade effect has to last. At
  418. the end of the fade-in effect the output audio will have the same
  419. volume as the input audio, at the end of the fade-out transition
  420. the output audio will be silence. Default is 44100.
  421. @item start_time, st
  422. Specify the start time of the fade effect. Default is 0.
  423. The value must be specified as a time duration; see
  424. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  425. for the accepted syntax.
  426. If set this option is used instead of @var{start_sample}.
  427. @item duration, d
  428. Specify the duration of the fade effect. See
  429. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  430. for the accepted syntax.
  431. At the end of the fade-in effect the output audio will have the same
  432. volume as the input audio, at the end of the fade-out transition
  433. the output audio will be silence.
  434. By default the duration is determined by @var{nb_samples}.
  435. If set this option is used instead of @var{nb_samples}.
  436. @item curve
  437. Set curve for fade transition.
  438. It accepts the following values:
  439. @table @option
  440. @item tri
  441. select triangular, linear slope (default)
  442. @item qsin
  443. select quarter of sine wave
  444. @item hsin
  445. select half of sine wave
  446. @item esin
  447. select exponential sine wave
  448. @item log
  449. select logarithmic
  450. @item ipar
  451. select inverted parabola
  452. @item qua
  453. select quadratic
  454. @item cub
  455. select cubic
  456. @item squ
  457. select square root
  458. @item cbr
  459. select cubic root
  460. @item par
  461. select parabola
  462. @item exp
  463. select exponential
  464. @item iqsin
  465. select inverted quarter of sine wave
  466. @item ihsin
  467. select inverted half of sine wave
  468. @item dese
  469. select double-exponential seat
  470. @item desi
  471. select double-exponential sigmoid
  472. @end table
  473. @end table
  474. @subsection Examples
  475. @itemize
  476. @item
  477. Fade in first 15 seconds of audio:
  478. @example
  479. afade=t=in:ss=0:d=15
  480. @end example
  481. @item
  482. Fade out last 25 seconds of a 900 seconds audio:
  483. @example
  484. afade=t=out:st=875:d=25
  485. @end example
  486. @end itemize
  487. @anchor{aformat}
  488. @section aformat
  489. Set output format constraints for the input audio. The framework will
  490. negotiate the most appropriate format to minimize conversions.
  491. It accepts the following parameters:
  492. @table @option
  493. @item sample_fmts
  494. A '|'-separated list of requested sample formats.
  495. @item sample_rates
  496. A '|'-separated list of requested sample rates.
  497. @item channel_layouts
  498. A '|'-separated list of requested channel layouts.
  499. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  500. for the required syntax.
  501. @end table
  502. If a parameter is omitted, all values are allowed.
  503. Force the output to either unsigned 8-bit or signed 16-bit stereo
  504. @example
  505. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  506. @end example
  507. @section agate
  508. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  509. processing reduces disturbing noise between useful signals.
  510. Gating is done by detecting the volume below a chosen level @var{threshold}
  511. and divide it by the factor set with @var{ratio}. The bottom of the noise
  512. floor is set via @var{range}. Because an exact manipulation of the signal
  513. would cause distortion of the waveform the reduction can be levelled over
  514. time. This is done by setting @var{attack} and @var{release}.
  515. @var{attack} determines how long the signal has to fall below the threshold
  516. before any reduction will occur and @var{release} sets the time the signal
  517. has to raise above the threshold to reduce the reduction again.
  518. Shorter signals than the chosen attack time will be left untouched.
  519. @table @option
  520. @item level_in
  521. Set input level before filtering.
  522. @item range
  523. Set the level of gain reduction when the signal is below the threshold.
  524. @item threshold
  525. If a signal rises above this level the gain reduction is released.
  526. @item ratio
  527. Set a ratio about which the signal is reduced.
  528. @item attack
  529. Amount of milliseconds the signal has to rise above the threshold before gain
  530. reduction stops.
  531. @item release
  532. Amount of milliseconds the signal has to fall below the threshold before the
  533. reduction is increased again.
  534. @item makeup
  535. Set amount of amplification of signal after processing.
  536. @item knee
  537. Curve the sharp knee around the threshold to enter gain reduction more softly.
  538. @item detection
  539. Choose if exact signal should be taken for detection or an RMS like one.
  540. @item link
  541. Choose if the average level between all channels or the louder channel affects
  542. the reduction.
  543. @end table
  544. @section alimiter
  545. The limiter prevents input signal from raising over a desired threshold.
  546. This limiter uses lookahead technology to prevent your signal from distorting.
  547. It means that there is a small delay after signal is processed. Keep in mind
  548. that the delay it produces is the attack time you set.
  549. The filter accepts the following options:
  550. @table @option
  551. @item limit
  552. Don't let signals above this level pass the limiter. The removed amplitude is
  553. added automatically. Default is 1.
  554. @item attack
  555. The limiter will reach its attenuation level in this amount of time in
  556. milliseconds. Default is 5 milliseconds.
  557. @item release
  558. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  559. Default is 50 milliseconds.
  560. @item asc
  561. When gain reduction is always needed ASC takes care of releasing to an
  562. average reduction level rather than reaching a reduction of 0 in the release
  563. time.
  564. @item asc_level
  565. Select how much the release time is affected by ASC, 0 means nearly no changes
  566. in release time while 1 produces higher release times.
  567. @end table
  568. Depending on picked setting it is recommended to upsample input 2x or 4x times
  569. with @ref{aresample} before applying this filter.
  570. @section allpass
  571. Apply a two-pole all-pass filter with central frequency (in Hz)
  572. @var{frequency}, and filter-width @var{width}.
  573. An all-pass filter changes the audio's frequency to phase relationship
  574. without changing its frequency to amplitude relationship.
  575. The filter accepts the following options:
  576. @table @option
  577. @item frequency, f
  578. Set frequency in Hz.
  579. @item width_type
  580. Set method to specify band-width of filter.
  581. @table @option
  582. @item h
  583. Hz
  584. @item q
  585. Q-Factor
  586. @item o
  587. octave
  588. @item s
  589. slope
  590. @end table
  591. @item width, w
  592. Specify the band-width of a filter in width_type units.
  593. @end table
  594. @anchor{amerge}
  595. @section amerge
  596. Merge two or more audio streams into a single multi-channel stream.
  597. The filter accepts the following options:
  598. @table @option
  599. @item inputs
  600. Set the number of inputs. Default is 2.
  601. @end table
  602. If the channel layouts of the inputs are disjoint, and therefore compatible,
  603. the channel layout of the output will be set accordingly and the channels
  604. will be reordered as necessary. If the channel layouts of the inputs are not
  605. disjoint, the output will have all the channels of the first input then all
  606. the channels of the second input, in that order, and the channel layout of
  607. the output will be the default value corresponding to the total number of
  608. channels.
  609. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  610. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  611. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  612. first input, b1 is the first channel of the second input).
  613. On the other hand, if both input are in stereo, the output channels will be
  614. in the default order: a1, a2, b1, b2, and the channel layout will be
  615. arbitrarily set to 4.0, which may or may not be the expected value.
  616. All inputs must have the same sample rate, and format.
  617. If inputs do not have the same duration, the output will stop with the
  618. shortest.
  619. @subsection Examples
  620. @itemize
  621. @item
  622. Merge two mono files into a stereo stream:
  623. @example
  624. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  625. @end example
  626. @item
  627. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  628. @example
  629. 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
  630. @end example
  631. @end itemize
  632. @section amix
  633. Mixes multiple audio inputs into a single output.
  634. Note that this filter only supports float samples (the @var{amerge}
  635. and @var{pan} audio filters support many formats). If the @var{amix}
  636. input has integer samples then @ref{aresample} will be automatically
  637. inserted to perform the conversion to float samples.
  638. For example
  639. @example
  640. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  641. @end example
  642. will mix 3 input audio streams to a single output with the same duration as the
  643. first input and a dropout transition time of 3 seconds.
  644. It accepts the following parameters:
  645. @table @option
  646. @item inputs
  647. The number of inputs. If unspecified, it defaults to 2.
  648. @item duration
  649. How to determine the end-of-stream.
  650. @table @option
  651. @item longest
  652. The duration of the longest input. (default)
  653. @item shortest
  654. The duration of the shortest input.
  655. @item first
  656. The duration of the first input.
  657. @end table
  658. @item dropout_transition
  659. The transition time, in seconds, for volume renormalization when an input
  660. stream ends. The default value is 2 seconds.
  661. @end table
  662. @section anull
  663. Pass the audio source unchanged to the output.
  664. @section apad
  665. Pad the end of an audio stream with silence.
  666. This can be used together with @command{ffmpeg} @option{-shortest} to
  667. extend audio streams to the same length as the video stream.
  668. A description of the accepted options follows.
  669. @table @option
  670. @item packet_size
  671. Set silence packet size. Default value is 4096.
  672. @item pad_len
  673. Set the number of samples of silence to add to the end. After the
  674. value is reached, the stream is terminated. This option is mutually
  675. exclusive with @option{whole_len}.
  676. @item whole_len
  677. Set the minimum total number of samples in the output audio stream. If
  678. the value is longer than the input audio length, silence is added to
  679. the end, until the value is reached. This option is mutually exclusive
  680. with @option{pad_len}.
  681. @end table
  682. If neither the @option{pad_len} nor the @option{whole_len} option is
  683. set, the filter will add silence to the end of the input stream
  684. indefinitely.
  685. @subsection Examples
  686. @itemize
  687. @item
  688. Add 1024 samples of silence to the end of the input:
  689. @example
  690. apad=pad_len=1024
  691. @end example
  692. @item
  693. Make sure the audio output will contain at least 10000 samples, pad
  694. the input with silence if required:
  695. @example
  696. apad=whole_len=10000
  697. @end example
  698. @item
  699. Use @command{ffmpeg} to pad the audio input with silence, so that the
  700. video stream will always result the shortest and will be converted
  701. until the end in the output file when using the @option{shortest}
  702. option:
  703. @example
  704. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  705. @end example
  706. @end itemize
  707. @section aphaser
  708. Add a phasing effect to the input audio.
  709. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  710. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  711. A description of the accepted parameters follows.
  712. @table @option
  713. @item in_gain
  714. Set input gain. Default is 0.4.
  715. @item out_gain
  716. Set output gain. Default is 0.74
  717. @item delay
  718. Set delay in milliseconds. Default is 3.0.
  719. @item decay
  720. Set decay. Default is 0.4.
  721. @item speed
  722. Set modulation speed in Hz. Default is 0.5.
  723. @item type
  724. Set modulation type. Default is triangular.
  725. It accepts the following values:
  726. @table @samp
  727. @item triangular, t
  728. @item sinusoidal, s
  729. @end table
  730. @end table
  731. @anchor{aresample}
  732. @section aresample
  733. Resample the input audio to the specified parameters, using the
  734. libswresample library. If none are specified then the filter will
  735. automatically convert between its input and output.
  736. This filter is also able to stretch/squeeze the audio data to make it match
  737. the timestamps or to inject silence / cut out audio to make it match the
  738. timestamps, do a combination of both or do neither.
  739. The filter accepts the syntax
  740. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  741. expresses a sample rate and @var{resampler_options} is a list of
  742. @var{key}=@var{value} pairs, separated by ":". See the
  743. ffmpeg-resampler manual for the complete list of supported options.
  744. @subsection Examples
  745. @itemize
  746. @item
  747. Resample the input audio to 44100Hz:
  748. @example
  749. aresample=44100
  750. @end example
  751. @item
  752. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  753. samples per second compensation:
  754. @example
  755. aresample=async=1000
  756. @end example
  757. @end itemize
  758. @section asetnsamples
  759. Set the number of samples per each output audio frame.
  760. The last output packet may contain a different number of samples, as
  761. the filter will flush all the remaining samples when the input audio
  762. signal its end.
  763. The filter accepts the following options:
  764. @table @option
  765. @item nb_out_samples, n
  766. Set the number of frames per each output audio frame. The number is
  767. intended as the number of samples @emph{per each channel}.
  768. Default value is 1024.
  769. @item pad, p
  770. If set to 1, the filter will pad the last audio frame with zeroes, so
  771. that the last frame will contain the same number of samples as the
  772. previous ones. Default value is 1.
  773. @end table
  774. For example, to set the number of per-frame samples to 1234 and
  775. disable padding for the last frame, use:
  776. @example
  777. asetnsamples=n=1234:p=0
  778. @end example
  779. @section asetrate
  780. Set the sample rate without altering the PCM data.
  781. This will result in a change of speed and pitch.
  782. The filter accepts the following options:
  783. @table @option
  784. @item sample_rate, r
  785. Set the output sample rate. Default is 44100 Hz.
  786. @end table
  787. @section ashowinfo
  788. Show a line containing various information for each input audio frame.
  789. The input audio is not modified.
  790. The shown line contains a sequence of key/value pairs of the form
  791. @var{key}:@var{value}.
  792. The following values are shown in the output:
  793. @table @option
  794. @item n
  795. The (sequential) number of the input frame, starting from 0.
  796. @item pts
  797. The presentation timestamp of the input frame, in time base units; the time base
  798. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  799. @item pts_time
  800. The presentation timestamp of the input frame in seconds.
  801. @item pos
  802. position of the frame in the input stream, -1 if this information in
  803. unavailable and/or meaningless (for example in case of synthetic audio)
  804. @item fmt
  805. The sample format.
  806. @item chlayout
  807. The channel layout.
  808. @item rate
  809. The sample rate for the audio frame.
  810. @item nb_samples
  811. The number of samples (per channel) in the frame.
  812. @item checksum
  813. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  814. audio, the data is treated as if all the planes were concatenated.
  815. @item plane_checksums
  816. A list of Adler-32 checksums for each data plane.
  817. @end table
  818. @anchor{astats}
  819. @section astats
  820. Display time domain statistical information about the audio channels.
  821. Statistics are calculated and displayed for each audio channel and,
  822. where applicable, an overall figure is also given.
  823. It accepts the following option:
  824. @table @option
  825. @item length
  826. Short window length in seconds, used for peak and trough RMS measurement.
  827. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  828. @item metadata
  829. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  830. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  831. disabled.
  832. Available keys for each channel are:
  833. DC_offset
  834. Min_level
  835. Max_level
  836. Min_difference
  837. Max_difference
  838. Mean_difference
  839. Peak_level
  840. RMS_peak
  841. RMS_trough
  842. Crest_factor
  843. Flat_factor
  844. Peak_count
  845. Bit_depth
  846. and for Overall:
  847. DC_offset
  848. Min_level
  849. Max_level
  850. Min_difference
  851. Max_difference
  852. Mean_difference
  853. Peak_level
  854. RMS_level
  855. RMS_peak
  856. RMS_trough
  857. Flat_factor
  858. Peak_count
  859. Bit_depth
  860. Number_of_samples
  861. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  862. this @code{lavfi.astats.Overall.Peak_count}.
  863. For description what each key means read below.
  864. @item reset
  865. Set number of frame after which stats are going to be recalculated.
  866. Default is disabled.
  867. @end table
  868. A description of each shown parameter follows:
  869. @table @option
  870. @item DC offset
  871. Mean amplitude displacement from zero.
  872. @item Min level
  873. Minimal sample level.
  874. @item Max level
  875. Maximal sample level.
  876. @item Min difference
  877. Minimal difference between two consecutive samples.
  878. @item Max difference
  879. Maximal difference between two consecutive samples.
  880. @item Mean difference
  881. Mean difference between two consecutive samples.
  882. The average of each difference between two consecutive samples.
  883. @item Peak level dB
  884. @item RMS level dB
  885. Standard peak and RMS level measured in dBFS.
  886. @item RMS peak dB
  887. @item RMS trough dB
  888. Peak and trough values for RMS level measured over a short window.
  889. @item Crest factor
  890. Standard ratio of peak to RMS level (note: not in dB).
  891. @item Flat factor
  892. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  893. (i.e. either @var{Min level} or @var{Max level}).
  894. @item Peak count
  895. Number of occasions (not the number of samples) that the signal attained either
  896. @var{Min level} or @var{Max level}.
  897. @item Bit depth
  898. Overall bit depth of audio. Number of bits used for each sample.
  899. @end table
  900. @section asyncts
  901. Synchronize audio data with timestamps by squeezing/stretching it and/or
  902. dropping samples/adding silence when needed.
  903. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  904. It accepts the following parameters:
  905. @table @option
  906. @item compensate
  907. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  908. by default. When disabled, time gaps are covered with silence.
  909. @item min_delta
  910. The minimum difference between timestamps and audio data (in seconds) to trigger
  911. adding/dropping samples. The default value is 0.1. If you get an imperfect
  912. sync with this filter, try setting this parameter to 0.
  913. @item max_comp
  914. The maximum compensation in samples per second. Only relevant with compensate=1.
  915. The default value is 500.
  916. @item first_pts
  917. Assume that the first PTS should be this value. The time base is 1 / sample
  918. rate. This allows for padding/trimming at the start of the stream. By default,
  919. no assumption is made about the first frame's expected PTS, so no padding or
  920. trimming is done. For example, this could be set to 0 to pad the beginning with
  921. silence if an audio stream starts after the video stream or to trim any samples
  922. with a negative PTS due to encoder delay.
  923. @end table
  924. @section atempo
  925. Adjust audio tempo.
  926. The filter accepts exactly one parameter, the audio tempo. If not
  927. specified then the filter will assume nominal 1.0 tempo. Tempo must
  928. be in the [0.5, 2.0] range.
  929. @subsection Examples
  930. @itemize
  931. @item
  932. Slow down audio to 80% tempo:
  933. @example
  934. atempo=0.8
  935. @end example
  936. @item
  937. To speed up audio to 125% tempo:
  938. @example
  939. atempo=1.25
  940. @end example
  941. @end itemize
  942. @section atrim
  943. Trim the input so that the output contains one continuous subpart of the input.
  944. It accepts the following parameters:
  945. @table @option
  946. @item start
  947. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  948. sample with the timestamp @var{start} will be the first sample in the output.
  949. @item end
  950. Specify time of the first audio sample that will be dropped, i.e. the
  951. audio sample immediately preceding the one with the timestamp @var{end} will be
  952. the last sample in the output.
  953. @item start_pts
  954. Same as @var{start}, except this option sets the start timestamp in samples
  955. instead of seconds.
  956. @item end_pts
  957. Same as @var{end}, except this option sets the end timestamp in samples instead
  958. of seconds.
  959. @item duration
  960. The maximum duration of the output in seconds.
  961. @item start_sample
  962. The number of the first sample that should be output.
  963. @item end_sample
  964. The number of the first sample that should be dropped.
  965. @end table
  966. @option{start}, @option{end}, and @option{duration} are expressed as time
  967. duration specifications; see
  968. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  969. Note that the first two sets of the start/end options and the @option{duration}
  970. option look at the frame timestamp, while the _sample options simply count the
  971. samples that pass through the filter. So start/end_pts and start/end_sample will
  972. give different results when the timestamps are wrong, inexact or do not start at
  973. zero. Also note that this filter does not modify the timestamps. If you wish
  974. to have the output timestamps start at zero, insert the asetpts filter after the
  975. atrim filter.
  976. If multiple start or end options are set, this filter tries to be greedy and
  977. keep all samples that match at least one of the specified constraints. To keep
  978. only the part that matches all the constraints at once, chain multiple atrim
  979. filters.
  980. The defaults are such that all the input is kept. So it is possible to set e.g.
  981. just the end values to keep everything before the specified time.
  982. Examples:
  983. @itemize
  984. @item
  985. Drop everything except the second minute of input:
  986. @example
  987. ffmpeg -i INPUT -af atrim=60:120
  988. @end example
  989. @item
  990. Keep only the first 1000 samples:
  991. @example
  992. ffmpeg -i INPUT -af atrim=end_sample=1000
  993. @end example
  994. @end itemize
  995. @section bandpass
  996. Apply a two-pole Butterworth band-pass filter with central
  997. frequency @var{frequency}, and (3dB-point) band-width width.
  998. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  999. instead of the default: constant 0dB peak gain.
  1000. The filter roll off at 6dB per octave (20dB per decade).
  1001. The filter accepts the following options:
  1002. @table @option
  1003. @item frequency, f
  1004. Set the filter's central frequency. Default is @code{3000}.
  1005. @item csg
  1006. Constant skirt gain if set to 1. Defaults to 0.
  1007. @item width_type
  1008. Set method to specify band-width of filter.
  1009. @table @option
  1010. @item h
  1011. Hz
  1012. @item q
  1013. Q-Factor
  1014. @item o
  1015. octave
  1016. @item s
  1017. slope
  1018. @end table
  1019. @item width, w
  1020. Specify the band-width of a filter in width_type units.
  1021. @end table
  1022. @section bandreject
  1023. Apply a two-pole Butterworth band-reject filter with central
  1024. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1025. The filter roll off at 6dB per octave (20dB per decade).
  1026. The filter accepts the following options:
  1027. @table @option
  1028. @item frequency, f
  1029. Set the filter's central frequency. Default is @code{3000}.
  1030. @item width_type
  1031. Set method to specify band-width of filter.
  1032. @table @option
  1033. @item h
  1034. Hz
  1035. @item q
  1036. Q-Factor
  1037. @item o
  1038. octave
  1039. @item s
  1040. slope
  1041. @end table
  1042. @item width, w
  1043. Specify the band-width of a filter in width_type units.
  1044. @end table
  1045. @section bass
  1046. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1047. shelving filter with a response similar to that of a standard
  1048. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1049. The filter accepts the following options:
  1050. @table @option
  1051. @item gain, g
  1052. Give the gain at 0 Hz. Its useful range is about -20
  1053. (for a large cut) to +20 (for a large boost).
  1054. Beware of clipping when using a positive gain.
  1055. @item frequency, f
  1056. Set the filter's central frequency and so can be used
  1057. to extend or reduce the frequency range to be boosted or cut.
  1058. The default value is @code{100} Hz.
  1059. @item width_type
  1060. Set method to specify band-width of filter.
  1061. @table @option
  1062. @item h
  1063. Hz
  1064. @item q
  1065. Q-Factor
  1066. @item o
  1067. octave
  1068. @item s
  1069. slope
  1070. @end table
  1071. @item width, w
  1072. Determine how steep is the filter's shelf transition.
  1073. @end table
  1074. @section biquad
  1075. Apply a biquad IIR filter with the given coefficients.
  1076. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1077. are the numerator and denominator coefficients respectively.
  1078. @section bs2b
  1079. Bauer stereo to binaural transformation, which improves headphone listening of
  1080. stereo audio records.
  1081. It accepts the following parameters:
  1082. @table @option
  1083. @item profile
  1084. Pre-defined crossfeed level.
  1085. @table @option
  1086. @item default
  1087. Default level (fcut=700, feed=50).
  1088. @item cmoy
  1089. Chu Moy circuit (fcut=700, feed=60).
  1090. @item jmeier
  1091. Jan Meier circuit (fcut=650, feed=95).
  1092. @end table
  1093. @item fcut
  1094. Cut frequency (in Hz).
  1095. @item feed
  1096. Feed level (in Hz).
  1097. @end table
  1098. @section channelmap
  1099. Remap input channels to new locations.
  1100. It accepts the following parameters:
  1101. @table @option
  1102. @item channel_layout
  1103. The channel layout of the output stream.
  1104. @item map
  1105. Map channels from input to output. The argument is a '|'-separated list of
  1106. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1107. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1108. channel (e.g. FL for front left) or its index in the input channel layout.
  1109. @var{out_channel} is the name of the output channel or its index in the output
  1110. channel layout. If @var{out_channel} is not given then it is implicitly an
  1111. index, starting with zero and increasing by one for each mapping.
  1112. @end table
  1113. If no mapping is present, the filter will implicitly map input channels to
  1114. output channels, preserving indices.
  1115. For example, assuming a 5.1+downmix input MOV file,
  1116. @example
  1117. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1118. @end example
  1119. will create an output WAV file tagged as stereo from the downmix channels of
  1120. the input.
  1121. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1122. @example
  1123. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1124. @end example
  1125. @section channelsplit
  1126. Split each channel from an input audio stream into a separate output stream.
  1127. It accepts the following parameters:
  1128. @table @option
  1129. @item channel_layout
  1130. The channel layout of the input stream. The default is "stereo".
  1131. @end table
  1132. For example, assuming a stereo input MP3 file,
  1133. @example
  1134. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1135. @end example
  1136. will create an output Matroska file with two audio streams, one containing only
  1137. the left channel and the other the right channel.
  1138. Split a 5.1 WAV file into per-channel files:
  1139. @example
  1140. ffmpeg -i in.wav -filter_complex
  1141. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1142. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1143. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1144. side_right.wav
  1145. @end example
  1146. @section chorus
  1147. Add a chorus effect to the audio.
  1148. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1149. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1150. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1151. The modulation depth defines the range the modulated delay is played before or after
  1152. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1153. sound tuned around the original one, like in a chorus where some vocals are slightly
  1154. off key.
  1155. It accepts the following parameters:
  1156. @table @option
  1157. @item in_gain
  1158. Set input gain. Default is 0.4.
  1159. @item out_gain
  1160. Set output gain. Default is 0.4.
  1161. @item delays
  1162. Set delays. A typical delay is around 40ms to 60ms.
  1163. @item decays
  1164. Set decays.
  1165. @item speeds
  1166. Set speeds.
  1167. @item depths
  1168. Set depths.
  1169. @end table
  1170. @subsection Examples
  1171. @itemize
  1172. @item
  1173. A single delay:
  1174. @example
  1175. chorus=0.7:0.9:55:0.4:0.25:2
  1176. @end example
  1177. @item
  1178. Two delays:
  1179. @example
  1180. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1181. @end example
  1182. @item
  1183. Fuller sounding chorus with three delays:
  1184. @example
  1185. 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
  1186. @end example
  1187. @end itemize
  1188. @section compand
  1189. Compress or expand the audio's dynamic range.
  1190. It accepts the following parameters:
  1191. @table @option
  1192. @item attacks
  1193. @item decays
  1194. A list of times in seconds for each channel over which the instantaneous level
  1195. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1196. increase of volume and @var{decays} refers to decrease of volume. For most
  1197. situations, the attack time (response to the audio getting louder) should be
  1198. shorter than the decay time, because the human ear is more sensitive to sudden
  1199. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1200. a typical value for decay is 0.8 seconds.
  1201. If specified number of attacks & decays is lower than number of channels, the last
  1202. set attack/decay will be used for all remaining channels.
  1203. @item points
  1204. A list of points for the transfer function, specified in dB relative to the
  1205. maximum possible signal amplitude. Each key points list must be defined using
  1206. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1207. @code{x0/y0 x1/y1 x2/y2 ....}
  1208. The input values must be in strictly increasing order but the transfer function
  1209. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1210. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1211. function are @code{-70/-70|-60/-20}.
  1212. @item soft-knee
  1213. Set the curve radius in dB for all joints. It defaults to 0.01.
  1214. @item gain
  1215. Set the additional gain in dB to be applied at all points on the transfer
  1216. function. This allows for easy adjustment of the overall gain.
  1217. It defaults to 0.
  1218. @item volume
  1219. Set an initial volume, in dB, to be assumed for each channel when filtering
  1220. starts. This permits the user to supply a nominal level initially, so that, for
  1221. example, a very large gain is not applied to initial signal levels before the
  1222. companding has begun to operate. A typical value for audio which is initially
  1223. quiet is -90 dB. It defaults to 0.
  1224. @item delay
  1225. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1226. delayed before being fed to the volume adjuster. Specifying a delay
  1227. approximately equal to the attack/decay times allows the filter to effectively
  1228. operate in predictive rather than reactive mode. It defaults to 0.
  1229. @end table
  1230. @subsection Examples
  1231. @itemize
  1232. @item
  1233. Make music with both quiet and loud passages suitable for listening to in a
  1234. noisy environment:
  1235. @example
  1236. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1237. @end example
  1238. Another example for audio with whisper and explosion parts:
  1239. @example
  1240. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1241. @end example
  1242. @item
  1243. A noise gate for when the noise is at a lower level than the signal:
  1244. @example
  1245. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1246. @end example
  1247. @item
  1248. Here is another noise gate, this time for when the noise is at a higher level
  1249. than the signal (making it, in some ways, similar to squelch):
  1250. @example
  1251. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1252. @end example
  1253. @end itemize
  1254. @section dcshift
  1255. Apply a DC shift to the audio.
  1256. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1257. in the recording chain) from the audio. The effect of a DC offset is reduced
  1258. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1259. a signal has a DC offset.
  1260. @table @option
  1261. @item shift
  1262. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1263. the audio.
  1264. @item limitergain
  1265. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1266. used to prevent clipping.
  1267. @end table
  1268. @section dynaudnorm
  1269. Dynamic Audio Normalizer.
  1270. This filter applies a certain amount of gain to the input audio in order
  1271. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1272. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1273. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1274. This allows for applying extra gain to the "quiet" sections of the audio
  1275. while avoiding distortions or clipping the "loud" sections. In other words:
  1276. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1277. sections, in the sense that the volume of each section is brought to the
  1278. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1279. this goal *without* applying "dynamic range compressing". It will retain 100%
  1280. of the dynamic range *within* each section of the audio file.
  1281. @table @option
  1282. @item f
  1283. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1284. Default is 500 milliseconds.
  1285. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1286. referred to as frames. This is required, because a peak magnitude has no
  1287. meaning for just a single sample value. Instead, we need to determine the
  1288. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1289. normalizer would simply use the peak magnitude of the complete file, the
  1290. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1291. frame. The length of a frame is specified in milliseconds. By default, the
  1292. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1293. been found to give good results with most files.
  1294. Note that the exact frame length, in number of samples, will be determined
  1295. automatically, based on the sampling rate of the individual input audio file.
  1296. @item g
  1297. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1298. number. Default is 31.
  1299. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1300. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1301. is specified in frames, centered around the current frame. For the sake of
  1302. simplicity, this must be an odd number. Consequently, the default value of 31
  1303. takes into account the current frame, as well as the 15 preceding frames and
  1304. the 15 subsequent frames. Using a larger window results in a stronger
  1305. smoothing effect and thus in less gain variation, i.e. slower gain
  1306. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1307. effect and thus in more gain variation, i.e. faster gain adaptation.
  1308. In other words, the more you increase this value, the more the Dynamic Audio
  1309. Normalizer will behave like a "traditional" normalization filter. On the
  1310. contrary, the more you decrease this value, the more the Dynamic Audio
  1311. Normalizer will behave like a dynamic range compressor.
  1312. @item p
  1313. Set the target peak value. This specifies the highest permissible magnitude
  1314. level for the normalized audio input. This filter will try to approach the
  1315. target peak magnitude as closely as possible, but at the same time it also
  1316. makes sure that the normalized signal will never exceed the peak magnitude.
  1317. A frame's maximum local gain factor is imposed directly by the target peak
  1318. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1319. It is not recommended to go above this value.
  1320. @item m
  1321. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1322. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1323. factor for each input frame, i.e. the maximum gain factor that does not
  1324. result in clipping or distortion. The maximum gain factor is determined by
  1325. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1326. additionally bounds the frame's maximum gain factor by a predetermined
  1327. (global) maximum gain factor. This is done in order to avoid excessive gain
  1328. factors in "silent" or almost silent frames. By default, the maximum gain
  1329. factor is 10.0, For most inputs the default value should be sufficient and
  1330. it usually is not recommended to increase this value. Though, for input
  1331. with an extremely low overall volume level, it may be necessary to allow even
  1332. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1333. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1334. Instead, a "sigmoid" threshold function will be applied. This way, the
  1335. gain factors will smoothly approach the threshold value, but never exceed that
  1336. value.
  1337. @item r
  1338. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1339. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1340. This means that the maximum local gain factor for each frame is defined
  1341. (only) by the frame's highest magnitude sample. This way, the samples can
  1342. be amplified as much as possible without exceeding the maximum signal
  1343. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1344. Normalizer can also take into account the frame's root mean square,
  1345. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1346. determine the power of a time-varying signal. It is therefore considered
  1347. that the RMS is a better approximation of the "perceived loudness" than
  1348. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1349. frames to a constant RMS value, a uniform "perceived loudness" can be
  1350. established. If a target RMS value has been specified, a frame's local gain
  1351. factor is defined as the factor that would result in exactly that RMS value.
  1352. Note, however, that the maximum local gain factor is still restricted by the
  1353. frame's highest magnitude sample, in order to prevent clipping.
  1354. @item n
  1355. Enable channels coupling. By default is enabled.
  1356. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1357. amount. This means the same gain factor will be applied to all channels, i.e.
  1358. the maximum possible gain factor is determined by the "loudest" channel.
  1359. However, in some recordings, it may happen that the volume of the different
  1360. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1361. In this case, this option can be used to disable the channel coupling. This way,
  1362. the gain factor will be determined independently for each channel, depending
  1363. only on the individual channel's highest magnitude sample. This allows for
  1364. harmonizing the volume of the different channels.
  1365. @item c
  1366. Enable DC bias correction. By default is disabled.
  1367. An audio signal (in the time domain) is a sequence of sample values.
  1368. In the Dynamic Audio Normalizer these sample values are represented in the
  1369. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1370. audio signal, or "waveform", should be centered around the zero point.
  1371. That means if we calculate the mean value of all samples in a file, or in a
  1372. single frame, then the result should be 0.0 or at least very close to that
  1373. value. If, however, there is a significant deviation of the mean value from
  1374. 0.0, in either positive or negative direction, this is referred to as a
  1375. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1376. Audio Normalizer provides optional DC bias correction.
  1377. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1378. the mean value, or "DC correction" offset, of each input frame and subtract
  1379. that value from all of the frame's sample values which ensures those samples
  1380. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1381. boundaries, the DC correction offset values will be interpolated smoothly
  1382. between neighbouring frames.
  1383. @item b
  1384. Enable alternative boundary mode. By default is disabled.
  1385. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1386. around each frame. This includes the preceding frames as well as the
  1387. subsequent frames. However, for the "boundary" frames, located at the very
  1388. beginning and at the very end of the audio file, not all neighbouring
  1389. frames are available. In particular, for the first few frames in the audio
  1390. file, the preceding frames are not known. And, similarly, for the last few
  1391. frames in the audio file, the subsequent frames are not known. Thus, the
  1392. question arises which gain factors should be assumed for the missing frames
  1393. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1394. to deal with this situation. The default boundary mode assumes a gain factor
  1395. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1396. "fade out" at the beginning and at the end of the input, respectively.
  1397. @item s
  1398. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1399. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1400. compression. This means that signal peaks will not be pruned and thus the
  1401. full dynamic range will be retained within each local neighbourhood. However,
  1402. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1403. normalization algorithm with a more "traditional" compression.
  1404. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1405. (thresholding) function. If (and only if) the compression feature is enabled,
  1406. all input frames will be processed by a soft knee thresholding function prior
  1407. to the actual normalization process. Put simply, the thresholding function is
  1408. going to prune all samples whose magnitude exceeds a certain threshold value.
  1409. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1410. value. Instead, the threshold value will be adjusted for each individual
  1411. frame.
  1412. In general, smaller parameters result in stronger compression, and vice versa.
  1413. Values below 3.0 are not recommended, because audible distortion may appear.
  1414. @end table
  1415. @section earwax
  1416. Make audio easier to listen to on headphones.
  1417. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1418. so that when listened to on headphones the stereo image is moved from
  1419. inside your head (standard for headphones) to outside and in front of
  1420. the listener (standard for speakers).
  1421. Ported from SoX.
  1422. @section equalizer
  1423. Apply a two-pole peaking equalisation (EQ) filter. With this
  1424. filter, the signal-level at and around a selected frequency can
  1425. be increased or decreased, whilst (unlike bandpass and bandreject
  1426. filters) that at all other frequencies is unchanged.
  1427. In order to produce complex equalisation curves, this filter can
  1428. be given several times, each with a different central frequency.
  1429. The filter accepts the following options:
  1430. @table @option
  1431. @item frequency, f
  1432. Set the filter's central frequency in Hz.
  1433. @item width_type
  1434. Set method to specify band-width of filter.
  1435. @table @option
  1436. @item h
  1437. Hz
  1438. @item q
  1439. Q-Factor
  1440. @item o
  1441. octave
  1442. @item s
  1443. slope
  1444. @end table
  1445. @item width, w
  1446. Specify the band-width of a filter in width_type units.
  1447. @item gain, g
  1448. Set the required gain or attenuation in dB.
  1449. Beware of clipping when using a positive gain.
  1450. @end table
  1451. @subsection Examples
  1452. @itemize
  1453. @item
  1454. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1455. @example
  1456. equalizer=f=1000:width_type=h:width=200:g=-10
  1457. @end example
  1458. @item
  1459. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1460. @example
  1461. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1462. @end example
  1463. @end itemize
  1464. @section extrastereo
  1465. Linearly increases the difference between left and right channels which
  1466. adds some sort of "live" effect to playback.
  1467. The filter accepts the following option:
  1468. @table @option
  1469. @item m
  1470. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1471. (average of both channels), with 1.0 sound will be unchanged, with
  1472. -1.0 left and right channels will be swapped.
  1473. @item c
  1474. Enable clipping. By default is enabled.
  1475. @end table
  1476. @section flanger
  1477. Apply a flanging effect to the audio.
  1478. The filter accepts the following options:
  1479. @table @option
  1480. @item delay
  1481. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1482. @item depth
  1483. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1484. @item regen
  1485. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1486. Default value is 0.
  1487. @item width
  1488. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1489. Default value is 71.
  1490. @item speed
  1491. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1492. @item shape
  1493. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1494. Default value is @var{sinusoidal}.
  1495. @item phase
  1496. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1497. Default value is 25.
  1498. @item interp
  1499. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1500. Default is @var{linear}.
  1501. @end table
  1502. @section highpass
  1503. Apply a high-pass filter with 3dB point frequency.
  1504. The filter can be either single-pole, or double-pole (the default).
  1505. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1506. The filter accepts the following options:
  1507. @table @option
  1508. @item frequency, f
  1509. Set frequency in Hz. Default is 3000.
  1510. @item poles, p
  1511. Set number of poles. Default is 2.
  1512. @item width_type
  1513. Set method to specify band-width of filter.
  1514. @table @option
  1515. @item h
  1516. Hz
  1517. @item q
  1518. Q-Factor
  1519. @item o
  1520. octave
  1521. @item s
  1522. slope
  1523. @end table
  1524. @item width, w
  1525. Specify the band-width of a filter in width_type units.
  1526. Applies only to double-pole filter.
  1527. The default is 0.707q and gives a Butterworth response.
  1528. @end table
  1529. @section join
  1530. Join multiple input streams into one multi-channel stream.
  1531. It accepts the following parameters:
  1532. @table @option
  1533. @item inputs
  1534. The number of input streams. It defaults to 2.
  1535. @item channel_layout
  1536. The desired output channel layout. It defaults to stereo.
  1537. @item map
  1538. Map channels from inputs to output. The argument is a '|'-separated list of
  1539. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  1540. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  1541. can be either the name of the input channel (e.g. FL for front left) or its
  1542. index in the specified input stream. @var{out_channel} is the name of the output
  1543. channel.
  1544. @end table
  1545. The filter will attempt to guess the mappings when they are not specified
  1546. explicitly. It does so by first trying to find an unused matching input channel
  1547. and if that fails it picks the first unused input channel.
  1548. Join 3 inputs (with properly set channel layouts):
  1549. @example
  1550. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1551. @end example
  1552. Build a 5.1 output from 6 single-channel streams:
  1553. @example
  1554. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1555. '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'
  1556. out
  1557. @end example
  1558. @section ladspa
  1559. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  1560. To enable compilation of this filter you need to configure FFmpeg with
  1561. @code{--enable-ladspa}.
  1562. @table @option
  1563. @item file, f
  1564. Specifies the name of LADSPA plugin library to load. If the environment
  1565. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  1566. each one of the directories specified by the colon separated list in
  1567. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  1568. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  1569. @file{/usr/lib/ladspa/}.
  1570. @item plugin, p
  1571. Specifies the plugin within the library. Some libraries contain only
  1572. one plugin, but others contain many of them. If this is not set filter
  1573. will list all available plugins within the specified library.
  1574. @item controls, c
  1575. Set the '|' separated list of controls which are zero or more floating point
  1576. values that determine the behavior of the loaded plugin (for example delay,
  1577. threshold or gain).
  1578. Controls need to be defined using the following syntax:
  1579. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  1580. @var{valuei} is the value set on the @var{i}-th control.
  1581. Alternatively they can be also defined using the following syntax:
  1582. @var{value0}|@var{value1}|@var{value2}|..., where
  1583. @var{valuei} is the value set on the @var{i}-th control.
  1584. If @option{controls} is set to @code{help}, all available controls and
  1585. their valid ranges are printed.
  1586. @item sample_rate, s
  1587. Specify the sample rate, default to 44100. Only used if plugin have
  1588. zero inputs.
  1589. @item nb_samples, n
  1590. Set the number of samples per channel per each output frame, default
  1591. is 1024. Only used if plugin have zero inputs.
  1592. @item duration, d
  1593. Set the minimum duration of the sourced audio. See
  1594. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1595. for the accepted syntax.
  1596. Note that the resulting duration may be greater than the specified duration,
  1597. as the generated audio is always cut at the end of a complete frame.
  1598. If not specified, or the expressed duration is negative, the audio is
  1599. supposed to be generated forever.
  1600. Only used if plugin have zero inputs.
  1601. @end table
  1602. @subsection Examples
  1603. @itemize
  1604. @item
  1605. List all available plugins within amp (LADSPA example plugin) library:
  1606. @example
  1607. ladspa=file=amp
  1608. @end example
  1609. @item
  1610. List all available controls and their valid ranges for @code{vcf_notch}
  1611. plugin from @code{VCF} library:
  1612. @example
  1613. ladspa=f=vcf:p=vcf_notch:c=help
  1614. @end example
  1615. @item
  1616. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  1617. plugin library:
  1618. @example
  1619. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  1620. @end example
  1621. @item
  1622. Add reverberation to the audio using TAP-plugins
  1623. (Tom's Audio Processing plugins):
  1624. @example
  1625. ladspa=file=tap_reverb:tap_reverb
  1626. @end example
  1627. @item
  1628. Generate white noise, with 0.2 amplitude:
  1629. @example
  1630. ladspa=file=cmt:noise_source_white:c=c0=.2
  1631. @end example
  1632. @item
  1633. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  1634. @code{C* Audio Plugin Suite} (CAPS) library:
  1635. @example
  1636. ladspa=file=caps:Click:c=c1=20'
  1637. @end example
  1638. @item
  1639. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  1640. @example
  1641. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  1642. @end example
  1643. @item
  1644. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  1645. @code{SWH Plugins} collection:
  1646. @example
  1647. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  1648. @end example
  1649. @item
  1650. Attenuate low frequencies using Multiband EQ from Steve Harris
  1651. @code{SWH Plugins} collection:
  1652. @example
  1653. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  1654. @end example
  1655. @end itemize
  1656. @subsection Commands
  1657. This filter supports the following commands:
  1658. @table @option
  1659. @item cN
  1660. Modify the @var{N}-th control value.
  1661. If the specified value is not valid, it is ignored and prior one is kept.
  1662. @end table
  1663. @section lowpass
  1664. Apply a low-pass filter with 3dB point frequency.
  1665. The filter can be either single-pole or double-pole (the default).
  1666. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1667. The filter accepts the following options:
  1668. @table @option
  1669. @item frequency, f
  1670. Set frequency in Hz. Default is 500.
  1671. @item poles, p
  1672. Set number of poles. Default is 2.
  1673. @item width_type
  1674. Set method to specify band-width of filter.
  1675. @table @option
  1676. @item h
  1677. Hz
  1678. @item q
  1679. Q-Factor
  1680. @item o
  1681. octave
  1682. @item s
  1683. slope
  1684. @end table
  1685. @item width, w
  1686. Specify the band-width of a filter in width_type units.
  1687. Applies only to double-pole filter.
  1688. The default is 0.707q and gives a Butterworth response.
  1689. @end table
  1690. @anchor{pan}
  1691. @section pan
  1692. Mix channels with specific gain levels. The filter accepts the output
  1693. channel layout followed by a set of channels definitions.
  1694. This filter is also designed to efficiently remap the channels of an audio
  1695. stream.
  1696. The filter accepts parameters of the form:
  1697. "@var{l}|@var{outdef}|@var{outdef}|..."
  1698. @table @option
  1699. @item l
  1700. output channel layout or number of channels
  1701. @item outdef
  1702. output channel specification, of the form:
  1703. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  1704. @item out_name
  1705. output channel to define, either a channel name (FL, FR, etc.) or a channel
  1706. number (c0, c1, etc.)
  1707. @item gain
  1708. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  1709. @item in_name
  1710. input channel to use, see out_name for details; it is not possible to mix
  1711. named and numbered input channels
  1712. @end table
  1713. If the `=' in a channel specification is replaced by `<', then the gains for
  1714. that specification will be renormalized so that the total is 1, thus
  1715. avoiding clipping noise.
  1716. @subsection Mixing examples
  1717. For example, if you want to down-mix from stereo to mono, but with a bigger
  1718. factor for the left channel:
  1719. @example
  1720. pan=1c|c0=0.9*c0+0.1*c1
  1721. @end example
  1722. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  1723. 7-channels surround:
  1724. @example
  1725. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  1726. @end example
  1727. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  1728. that should be preferred (see "-ac" option) unless you have very specific
  1729. needs.
  1730. @subsection Remapping examples
  1731. The channel remapping will be effective if, and only if:
  1732. @itemize
  1733. @item gain coefficients are zeroes or ones,
  1734. @item only one input per channel output,
  1735. @end itemize
  1736. If all these conditions are satisfied, the filter will notify the user ("Pure
  1737. channel mapping detected"), and use an optimized and lossless method to do the
  1738. remapping.
  1739. For example, if you have a 5.1 source and want a stereo audio stream by
  1740. dropping the extra channels:
  1741. @example
  1742. pan="stereo| c0=FL | c1=FR"
  1743. @end example
  1744. Given the same source, you can also switch front left and front right channels
  1745. and keep the input channel layout:
  1746. @example
  1747. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  1748. @end example
  1749. If the input is a stereo audio stream, you can mute the front left channel (and
  1750. still keep the stereo channel layout) with:
  1751. @example
  1752. pan="stereo|c1=c1"
  1753. @end example
  1754. Still with a stereo audio stream input, you can copy the right channel in both
  1755. front left and right:
  1756. @example
  1757. pan="stereo| c0=FR | c1=FR"
  1758. @end example
  1759. @section replaygain
  1760. ReplayGain scanner filter. This filter takes an audio stream as an input and
  1761. outputs it unchanged.
  1762. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  1763. @section resample
  1764. Convert the audio sample format, sample rate and channel layout. It is
  1765. not meant to be used directly.
  1766. @section rubberband
  1767. Apply time-stretching and pitch-shifting with librubberband.
  1768. The filter accepts the following options:
  1769. @table @option
  1770. @item tempo
  1771. Set tempo scale factor.
  1772. @item pitch
  1773. Set pitch scale factor.
  1774. @item transients
  1775. Set transients detector.
  1776. Possible values are:
  1777. @table @var
  1778. @item crisp
  1779. @item mixed
  1780. @item smooth
  1781. @end table
  1782. @item detector
  1783. Set detector.
  1784. Possible values are:
  1785. @table @var
  1786. @item compound
  1787. @item percussive
  1788. @item soft
  1789. @end table
  1790. @item phase
  1791. Set phase.
  1792. Possible values are:
  1793. @table @var
  1794. @item laminar
  1795. @item independent
  1796. @end table
  1797. @item window
  1798. Set processing window size.
  1799. Possible values are:
  1800. @table @var
  1801. @item standard
  1802. @item short
  1803. @item long
  1804. @end table
  1805. @item smoothing
  1806. Set smoothing.
  1807. Possible values are:
  1808. @table @var
  1809. @item off
  1810. @item on
  1811. @end table
  1812. @item formant
  1813. Enable formant preservation when shift pitching.
  1814. Possible values are:
  1815. @table @var
  1816. @item shifted
  1817. @item preserved
  1818. @end table
  1819. @item pitchq
  1820. Set pitch quality.
  1821. Possible values are:
  1822. @table @var
  1823. @item quality
  1824. @item speed
  1825. @item consistency
  1826. @end table
  1827. @item channels
  1828. Set channels.
  1829. Possible values are:
  1830. @table @var
  1831. @item apart
  1832. @item together
  1833. @end table
  1834. @end table
  1835. @section sidechaincompress
  1836. This filter acts like normal compressor but has the ability to compress
  1837. detected signal using second input signal.
  1838. It needs two input streams and returns one output stream.
  1839. First input stream will be processed depending on second stream signal.
  1840. The filtered signal then can be filtered with other filters in later stages of
  1841. processing. See @ref{pan} and @ref{amerge} filter.
  1842. The filter accepts the following options:
  1843. @table @option
  1844. @item threshold
  1845. If a signal of second stream raises above this level it will affect the gain
  1846. reduction of first stream.
  1847. By default is 0.125. Range is between 0.00097563 and 1.
  1848. @item ratio
  1849. Set a ratio about which the signal is reduced. 1:2 means that if the level
  1850. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  1851. Default is 2. Range is between 1 and 20.
  1852. @item attack
  1853. Amount of milliseconds the signal has to rise above the threshold before gain
  1854. reduction starts. Default is 20. Range is between 0.01 and 2000.
  1855. @item release
  1856. Amount of milliseconds the signal has to fall below the threshold before
  1857. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  1858. @item makeup
  1859. Set the amount by how much signal will be amplified after processing.
  1860. Default is 2. Range is from 1 and 64.
  1861. @item knee
  1862. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1863. Default is 2.82843. Range is between 1 and 8.
  1864. @item link
  1865. Choose if the @code{average} level between all channels of side-chain stream
  1866. or the louder(@code{maximum}) channel of side-chain stream affects the
  1867. reduction. Default is @code{average}.
  1868. @item detection
  1869. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  1870. of @code{rms}. Default is @code{rms} which is mainly smoother.
  1871. @end table
  1872. @subsection Examples
  1873. @itemize
  1874. @item
  1875. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  1876. depending on the signal of 2nd input and later compressed signal to be
  1877. merged with 2nd input:
  1878. @example
  1879. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  1880. @end example
  1881. @end itemize
  1882. @section silencedetect
  1883. Detect silence in an audio stream.
  1884. This filter logs a message when it detects that the input audio volume is less
  1885. or equal to a noise tolerance value for a duration greater or equal to the
  1886. minimum detected noise duration.
  1887. The printed times and duration are expressed in seconds.
  1888. The filter accepts the following options:
  1889. @table @option
  1890. @item duration, d
  1891. Set silence duration until notification (default is 2 seconds).
  1892. @item noise, n
  1893. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  1894. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  1895. @end table
  1896. @subsection Examples
  1897. @itemize
  1898. @item
  1899. Detect 5 seconds of silence with -50dB noise tolerance:
  1900. @example
  1901. silencedetect=n=-50dB:d=5
  1902. @end example
  1903. @item
  1904. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  1905. tolerance in @file{silence.mp3}:
  1906. @example
  1907. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  1908. @end example
  1909. @end itemize
  1910. @section silenceremove
  1911. Remove silence from the beginning, middle or end of the audio.
  1912. The filter accepts the following options:
  1913. @table @option
  1914. @item start_periods
  1915. This value is used to indicate if audio should be trimmed at beginning of
  1916. the audio. A value of zero indicates no silence should be trimmed from the
  1917. beginning. When specifying a non-zero value, it trims audio up until it
  1918. finds non-silence. Normally, when trimming silence from beginning of audio
  1919. the @var{start_periods} will be @code{1} but it can be increased to higher
  1920. values to trim all audio up to specific count of non-silence periods.
  1921. Default value is @code{0}.
  1922. @item start_duration
  1923. Specify the amount of time that non-silence must be detected before it stops
  1924. trimming audio. By increasing the duration, bursts of noises can be treated
  1925. as silence and trimmed off. Default value is @code{0}.
  1926. @item start_threshold
  1927. This indicates what sample value should be treated as silence. For digital
  1928. audio, a value of @code{0} may be fine but for audio recorded from analog,
  1929. you may wish to increase the value to account for background noise.
  1930. Can be specified in dB (in case "dB" is appended to the specified value)
  1931. or amplitude ratio. Default value is @code{0}.
  1932. @item stop_periods
  1933. Set the count for trimming silence from the end of audio.
  1934. To remove silence from the middle of a file, specify a @var{stop_periods}
  1935. that is negative. This value is then treated as a positive value and is
  1936. used to indicate the effect should restart processing as specified by
  1937. @var{start_periods}, making it suitable for removing periods of silence
  1938. in the middle of the audio.
  1939. Default value is @code{0}.
  1940. @item stop_duration
  1941. Specify a duration of silence that must exist before audio is not copied any
  1942. more. By specifying a higher duration, silence that is wanted can be left in
  1943. the audio.
  1944. Default value is @code{0}.
  1945. @item stop_threshold
  1946. This is the same as @option{start_threshold} but for trimming silence from
  1947. the end of audio.
  1948. Can be specified in dB (in case "dB" is appended to the specified value)
  1949. or amplitude ratio. Default value is @code{0}.
  1950. @item leave_silence
  1951. This indicate that @var{stop_duration} length of audio should be left intact
  1952. at the beginning of each period of silence.
  1953. For example, if you want to remove long pauses between words but do not want
  1954. to remove the pauses completely. Default value is @code{0}.
  1955. @end table
  1956. @subsection Examples
  1957. @itemize
  1958. @item
  1959. The following example shows how this filter can be used to start a recording
  1960. that does not contain the delay at the start which usually occurs between
  1961. pressing the record button and the start of the performance:
  1962. @example
  1963. silenceremove=1:5:0.02
  1964. @end example
  1965. @end itemize
  1966. @section stereotools
  1967. This filter has some handy utilities to manage stereo signals, for converting
  1968. M/S stereo recordings to L/R signal while having control over the parameters
  1969. or spreading the stereo image of master track.
  1970. The filter accepts the following options:
  1971. @table @option
  1972. @item level_in
  1973. Set input level before filtering for both channels. Defaults is 1.
  1974. Allowed range is from 0.015625 to 64.
  1975. @item level_out
  1976. Set output level after filtering for both channels. Defaults is 1.
  1977. Allowed range is from 0.015625 to 64.
  1978. @item balance_in
  1979. Set input balance between both channels. Default is 0.
  1980. Allowed range is from -1 to 1.
  1981. @item balance_out
  1982. Set output balance between both channels. Default is 0.
  1983. Allowed range is from -1 to 1.
  1984. @item softclip
  1985. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  1986. clipping. Disabled by default.
  1987. @item mutel
  1988. Mute the left channel. Disabled by default.
  1989. @item muter
  1990. Mute the right channel. Disabled by default.
  1991. @item phasel
  1992. Change the phase of the left channel. Disabled by default.
  1993. @item phaser
  1994. Change the phase of the right channel. Disabled by default.
  1995. @item mode
  1996. Set stereo mode. Available values are:
  1997. @table @samp
  1998. @item lr>lr
  1999. Left/Right to Left/Right, this is default.
  2000. @item lr>ms
  2001. Left/Right to Mid/Side.
  2002. @item ms>lr
  2003. Mid/Side to Left/Right.
  2004. @item lr>ll
  2005. Left/Right to Left/Left.
  2006. @item lr>rr
  2007. Left/Right to Right/Right.
  2008. @item lr>l+r
  2009. Left/Right to Left + Right.
  2010. @item lr>rl
  2011. Left/Right to Right/Left.
  2012. @end table
  2013. @item slev
  2014. Set level of side signal. Default is 1.
  2015. Allowed range is from 0.015625 to 64.
  2016. @item sbal
  2017. Set balance of side signal. Default is 0.
  2018. Allowed range is from -1 to 1.
  2019. @item mlev
  2020. Set level of the middle signal. Default is 1.
  2021. Allowed range is from 0.015625 to 64.
  2022. @item mpan
  2023. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2024. @item base
  2025. Set stereo base between mono and inversed channels. Default is 0.
  2026. Allowed range is from -1 to 1.
  2027. @item delay
  2028. Set delay in milliseconds how much to delay left from right channel and
  2029. vice versa. Default is 0. Allowed range is from -20 to 20.
  2030. @item sclevel
  2031. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2032. @item phase
  2033. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2034. @end table
  2035. @section stereowiden
  2036. This filter enhance the stereo effect by suppressing signal common to both
  2037. channels and by delaying the signal of left into right and vice versa,
  2038. thereby widening the stereo effect.
  2039. The filter accepts the following options:
  2040. @table @option
  2041. @item delay
  2042. Time in milliseconds of the delay of left signal into right and vice versa.
  2043. Default is 20 milliseconds.
  2044. @item feedback
  2045. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2046. effect of left signal in right output and vice versa which gives widening
  2047. effect. Default is 0.3.
  2048. @item crossfeed
  2049. Cross feed of left into right with inverted phase. This helps in suppressing
  2050. the mono. If the value is 1 it will cancel all the signal common to both
  2051. channels. Default is 0.3.
  2052. @item drymix
  2053. Set level of input signal of original channel. Default is 0.8.
  2054. @end table
  2055. @section treble
  2056. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2057. shelving filter with a response similar to that of a standard
  2058. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2059. The filter accepts the following options:
  2060. @table @option
  2061. @item gain, g
  2062. Give the gain at whichever is the lower of ~22 kHz and the
  2063. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2064. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2065. @item frequency, f
  2066. Set the filter's central frequency and so can be used
  2067. to extend or reduce the frequency range to be boosted or cut.
  2068. The default value is @code{3000} Hz.
  2069. @item width_type
  2070. Set method to specify band-width of filter.
  2071. @table @option
  2072. @item h
  2073. Hz
  2074. @item q
  2075. Q-Factor
  2076. @item o
  2077. octave
  2078. @item s
  2079. slope
  2080. @end table
  2081. @item width, w
  2082. Determine how steep is the filter's shelf transition.
  2083. @end table
  2084. @section tremolo
  2085. Sinusoidal amplitude modulation.
  2086. The filter accepts the following options:
  2087. @table @option
  2088. @item f
  2089. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2090. (20 Hz or lower) will result in a tremolo effect.
  2091. This filter may also be used as a ring modulator by specifying
  2092. a modulation frequency higher than 20 Hz.
  2093. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2094. @item d
  2095. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2096. Default value is 0.5.
  2097. @end table
  2098. @section vibrato
  2099. Sinusoidal phase modulation.
  2100. The filter accepts the following options:
  2101. @table @option
  2102. @item f
  2103. Modulation frequency in Hertz.
  2104. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2105. @item d
  2106. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2107. Default value is 0.5.
  2108. @end table
  2109. @section volume
  2110. Adjust the input audio volume.
  2111. It accepts the following parameters:
  2112. @table @option
  2113. @item volume
  2114. Set audio volume expression.
  2115. Output values are clipped to the maximum value.
  2116. The output audio volume is given by the relation:
  2117. @example
  2118. @var{output_volume} = @var{volume} * @var{input_volume}
  2119. @end example
  2120. The default value for @var{volume} is "1.0".
  2121. @item precision
  2122. This parameter represents the mathematical precision.
  2123. It determines which input sample formats will be allowed, which affects the
  2124. precision of the volume scaling.
  2125. @table @option
  2126. @item fixed
  2127. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2128. @item float
  2129. 32-bit floating-point; this limits input sample format to FLT. (default)
  2130. @item double
  2131. 64-bit floating-point; this limits input sample format to DBL.
  2132. @end table
  2133. @item replaygain
  2134. Choose the behaviour on encountering ReplayGain side data in input frames.
  2135. @table @option
  2136. @item drop
  2137. Remove ReplayGain side data, ignoring its contents (the default).
  2138. @item ignore
  2139. Ignore ReplayGain side data, but leave it in the frame.
  2140. @item track
  2141. Prefer the track gain, if present.
  2142. @item album
  2143. Prefer the album gain, if present.
  2144. @end table
  2145. @item replaygain_preamp
  2146. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2147. Default value for @var{replaygain_preamp} is 0.0.
  2148. @item eval
  2149. Set when the volume expression is evaluated.
  2150. It accepts the following values:
  2151. @table @samp
  2152. @item once
  2153. only evaluate expression once during the filter initialization, or
  2154. when the @samp{volume} command is sent
  2155. @item frame
  2156. evaluate expression for each incoming frame
  2157. @end table
  2158. Default value is @samp{once}.
  2159. @end table
  2160. The volume expression can contain the following parameters.
  2161. @table @option
  2162. @item n
  2163. frame number (starting at zero)
  2164. @item nb_channels
  2165. number of channels
  2166. @item nb_consumed_samples
  2167. number of samples consumed by the filter
  2168. @item nb_samples
  2169. number of samples in the current frame
  2170. @item pos
  2171. original frame position in the file
  2172. @item pts
  2173. frame PTS
  2174. @item sample_rate
  2175. sample rate
  2176. @item startpts
  2177. PTS at start of stream
  2178. @item startt
  2179. time at start of stream
  2180. @item t
  2181. frame time
  2182. @item tb
  2183. timestamp timebase
  2184. @item volume
  2185. last set volume value
  2186. @end table
  2187. Note that when @option{eval} is set to @samp{once} only the
  2188. @var{sample_rate} and @var{tb} variables are available, all other
  2189. variables will evaluate to NAN.
  2190. @subsection Commands
  2191. This filter supports the following commands:
  2192. @table @option
  2193. @item volume
  2194. Modify the volume expression.
  2195. The command accepts the same syntax of the corresponding option.
  2196. If the specified expression is not valid, it is kept at its current
  2197. value.
  2198. @item replaygain_noclip
  2199. Prevent clipping by limiting the gain applied.
  2200. Default value for @var{replaygain_noclip} is 1.
  2201. @end table
  2202. @subsection Examples
  2203. @itemize
  2204. @item
  2205. Halve the input audio volume:
  2206. @example
  2207. volume=volume=0.5
  2208. volume=volume=1/2
  2209. volume=volume=-6.0206dB
  2210. @end example
  2211. In all the above example the named key for @option{volume} can be
  2212. omitted, for example like in:
  2213. @example
  2214. volume=0.5
  2215. @end example
  2216. @item
  2217. Increase input audio power by 6 decibels using fixed-point precision:
  2218. @example
  2219. volume=volume=6dB:precision=fixed
  2220. @end example
  2221. @item
  2222. Fade volume after time 10 with an annihilation period of 5 seconds:
  2223. @example
  2224. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2225. @end example
  2226. @end itemize
  2227. @section volumedetect
  2228. Detect the volume of the input video.
  2229. The filter has no parameters. The input is not modified. Statistics about
  2230. the volume will be printed in the log when the input stream end is reached.
  2231. In particular it will show the mean volume (root mean square), maximum
  2232. volume (on a per-sample basis), and the beginning of a histogram of the
  2233. registered volume values (from the maximum value to a cumulated 1/1000 of
  2234. the samples).
  2235. All volumes are in decibels relative to the maximum PCM value.
  2236. @subsection Examples
  2237. Here is an excerpt of the output:
  2238. @example
  2239. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2240. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2241. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2242. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2243. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2244. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2245. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2246. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2247. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2248. @end example
  2249. It means that:
  2250. @itemize
  2251. @item
  2252. The mean square energy is approximately -27 dB, or 10^-2.7.
  2253. @item
  2254. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2255. @item
  2256. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2257. @end itemize
  2258. In other words, raising the volume by +4 dB does not cause any clipping,
  2259. raising it by +5 dB causes clipping for 6 samples, etc.
  2260. @c man end AUDIO FILTERS
  2261. @chapter Audio Sources
  2262. @c man begin AUDIO SOURCES
  2263. Below is a description of the currently available audio sources.
  2264. @section abuffer
  2265. Buffer audio frames, and make them available to the filter chain.
  2266. This source is mainly intended for a programmatic use, in particular
  2267. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2268. It accepts the following parameters:
  2269. @table @option
  2270. @item time_base
  2271. The timebase which will be used for timestamps of submitted frames. It must be
  2272. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2273. @item sample_rate
  2274. The sample rate of the incoming audio buffers.
  2275. @item sample_fmt
  2276. The sample format of the incoming audio buffers.
  2277. Either a sample format name or its corresponding integer representation from
  2278. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2279. @item channel_layout
  2280. The channel layout of the incoming audio buffers.
  2281. Either a channel layout name from channel_layout_map in
  2282. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2283. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2284. @item channels
  2285. The number of channels of the incoming audio buffers.
  2286. If both @var{channels} and @var{channel_layout} are specified, then they
  2287. must be consistent.
  2288. @end table
  2289. @subsection Examples
  2290. @example
  2291. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2292. @end example
  2293. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2294. Since the sample format with name "s16p" corresponds to the number
  2295. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2296. equivalent to:
  2297. @example
  2298. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2299. @end example
  2300. @section aevalsrc
  2301. Generate an audio signal specified by an expression.
  2302. This source accepts in input one or more expressions (one for each
  2303. channel), which are evaluated and used to generate a corresponding
  2304. audio signal.
  2305. This source accepts the following options:
  2306. @table @option
  2307. @item exprs
  2308. Set the '|'-separated expressions list for each separate channel. In case the
  2309. @option{channel_layout} option is not specified, the selected channel layout
  2310. depends on the number of provided expressions. Otherwise the last
  2311. specified expression is applied to the remaining output channels.
  2312. @item channel_layout, c
  2313. Set the channel layout. The number of channels in the specified layout
  2314. must be equal to the number of specified expressions.
  2315. @item duration, d
  2316. Set the minimum duration of the sourced audio. See
  2317. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2318. for the accepted syntax.
  2319. Note that the resulting duration may be greater than the specified
  2320. duration, as the generated audio is always cut at the end of a
  2321. complete frame.
  2322. If not specified, or the expressed duration is negative, the audio is
  2323. supposed to be generated forever.
  2324. @item nb_samples, n
  2325. Set the number of samples per channel per each output frame,
  2326. default to 1024.
  2327. @item sample_rate, s
  2328. Specify the sample rate, default to 44100.
  2329. @end table
  2330. Each expression in @var{exprs} can contain the following constants:
  2331. @table @option
  2332. @item n
  2333. number of the evaluated sample, starting from 0
  2334. @item t
  2335. time of the evaluated sample expressed in seconds, starting from 0
  2336. @item s
  2337. sample rate
  2338. @end table
  2339. @subsection Examples
  2340. @itemize
  2341. @item
  2342. Generate silence:
  2343. @example
  2344. aevalsrc=0
  2345. @end example
  2346. @item
  2347. Generate a sin signal with frequency of 440 Hz, set sample rate to
  2348. 8000 Hz:
  2349. @example
  2350. aevalsrc="sin(440*2*PI*t):s=8000"
  2351. @end example
  2352. @item
  2353. Generate a two channels signal, specify the channel layout (Front
  2354. Center + Back Center) explicitly:
  2355. @example
  2356. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  2357. @end example
  2358. @item
  2359. Generate white noise:
  2360. @example
  2361. aevalsrc="-2+random(0)"
  2362. @end example
  2363. @item
  2364. Generate an amplitude modulated signal:
  2365. @example
  2366. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  2367. @end example
  2368. @item
  2369. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  2370. @example
  2371. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  2372. @end example
  2373. @end itemize
  2374. @section anullsrc
  2375. The null audio source, return unprocessed audio frames. It is mainly useful
  2376. as a template and to be employed in analysis / debugging tools, or as
  2377. the source for filters which ignore the input data (for example the sox
  2378. synth filter).
  2379. This source accepts the following options:
  2380. @table @option
  2381. @item channel_layout, cl
  2382. Specifies the channel layout, and can be either an integer or a string
  2383. representing a channel layout. The default value of @var{channel_layout}
  2384. is "stereo".
  2385. Check the channel_layout_map definition in
  2386. @file{libavutil/channel_layout.c} for the mapping between strings and
  2387. channel layout values.
  2388. @item sample_rate, r
  2389. Specifies the sample rate, and defaults to 44100.
  2390. @item nb_samples, n
  2391. Set the number of samples per requested frames.
  2392. @end table
  2393. @subsection Examples
  2394. @itemize
  2395. @item
  2396. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  2397. @example
  2398. anullsrc=r=48000:cl=4
  2399. @end example
  2400. @item
  2401. Do the same operation with a more obvious syntax:
  2402. @example
  2403. anullsrc=r=48000:cl=mono
  2404. @end example
  2405. @end itemize
  2406. All the parameters need to be explicitly defined.
  2407. @section flite
  2408. Synthesize a voice utterance using the libflite library.
  2409. To enable compilation of this filter you need to configure FFmpeg with
  2410. @code{--enable-libflite}.
  2411. Note that the flite library is not thread-safe.
  2412. The filter accepts the following options:
  2413. @table @option
  2414. @item list_voices
  2415. If set to 1, list the names of the available voices and exit
  2416. immediately. Default value is 0.
  2417. @item nb_samples, n
  2418. Set the maximum number of samples per frame. Default value is 512.
  2419. @item textfile
  2420. Set the filename containing the text to speak.
  2421. @item text
  2422. Set the text to speak.
  2423. @item voice, v
  2424. Set the voice to use for the speech synthesis. Default value is
  2425. @code{kal}. See also the @var{list_voices} option.
  2426. @end table
  2427. @subsection Examples
  2428. @itemize
  2429. @item
  2430. Read from file @file{speech.txt}, and synthesize the text using the
  2431. standard flite voice:
  2432. @example
  2433. flite=textfile=speech.txt
  2434. @end example
  2435. @item
  2436. Read the specified text selecting the @code{slt} voice:
  2437. @example
  2438. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2439. @end example
  2440. @item
  2441. Input text to ffmpeg:
  2442. @example
  2443. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2444. @end example
  2445. @item
  2446. Make @file{ffplay} speak the specified text, using @code{flite} and
  2447. the @code{lavfi} device:
  2448. @example
  2449. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  2450. @end example
  2451. @end itemize
  2452. For more information about libflite, check:
  2453. @url{http://www.speech.cs.cmu.edu/flite/}
  2454. @section anoisesrc
  2455. Generate a noise audio signal.
  2456. The filter accepts the following options:
  2457. @table @option
  2458. @item sample_rate, r
  2459. Specify the sample rate. Default value is 48000 Hz.
  2460. @item amplitude, a
  2461. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  2462. is 1.0.
  2463. @item duration, d
  2464. Specify the duration of the generated audio stream. Not specifying this option
  2465. results in noise with an infinite length.
  2466. @item color, colour, c
  2467. Specify the color of noise. Available noise colors are white, pink, and brown.
  2468. Default color is white.
  2469. @item seed, s
  2470. Specify a value used to seed the PRNG.
  2471. @item nb_samples, n
  2472. Set the number of samples per each output frame, default is 1024.
  2473. @end table
  2474. @subsection Examples
  2475. @itemize
  2476. @item
  2477. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  2478. @example
  2479. anoisesrc=d=60:c=pink:r=44100:a=0.5
  2480. @end example
  2481. @end itemize
  2482. @section sine
  2483. Generate an audio signal made of a sine wave with amplitude 1/8.
  2484. The audio signal is bit-exact.
  2485. The filter accepts the following options:
  2486. @table @option
  2487. @item frequency, f
  2488. Set the carrier frequency. Default is 440 Hz.
  2489. @item beep_factor, b
  2490. Enable a periodic beep every second with frequency @var{beep_factor} times
  2491. the carrier frequency. Default is 0, meaning the beep is disabled.
  2492. @item sample_rate, r
  2493. Specify the sample rate, default is 44100.
  2494. @item duration, d
  2495. Specify the duration of the generated audio stream.
  2496. @item samples_per_frame
  2497. Set the number of samples per output frame.
  2498. The expression can contain the following constants:
  2499. @table @option
  2500. @item n
  2501. The (sequential) number of the output audio frame, starting from 0.
  2502. @item pts
  2503. The PTS (Presentation TimeStamp) of the output audio frame,
  2504. expressed in @var{TB} units.
  2505. @item t
  2506. The PTS of the output audio frame, expressed in seconds.
  2507. @item TB
  2508. The timebase of the output audio frames.
  2509. @end table
  2510. Default is @code{1024}.
  2511. @end table
  2512. @subsection Examples
  2513. @itemize
  2514. @item
  2515. Generate a simple 440 Hz sine wave:
  2516. @example
  2517. sine
  2518. @end example
  2519. @item
  2520. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  2521. @example
  2522. sine=220:4:d=5
  2523. sine=f=220:b=4:d=5
  2524. sine=frequency=220:beep_factor=4:duration=5
  2525. @end example
  2526. @item
  2527. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  2528. pattern:
  2529. @example
  2530. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  2531. @end example
  2532. @end itemize
  2533. @c man end AUDIO SOURCES
  2534. @chapter Audio Sinks
  2535. @c man begin AUDIO SINKS
  2536. Below is a description of the currently available audio sinks.
  2537. @section abuffersink
  2538. Buffer audio frames, and make them available to the end of filter chain.
  2539. This sink is mainly intended for programmatic use, in particular
  2540. through the interface defined in @file{libavfilter/buffersink.h}
  2541. or the options system.
  2542. It accepts a pointer to an AVABufferSinkContext structure, which
  2543. defines the incoming buffers' formats, to be passed as the opaque
  2544. parameter to @code{avfilter_init_filter} for initialization.
  2545. @section anullsink
  2546. Null audio sink; do absolutely nothing with the input audio. It is
  2547. mainly useful as a template and for use in analysis / debugging
  2548. tools.
  2549. @c man end AUDIO SINKS
  2550. @chapter Video Filters
  2551. @c man begin VIDEO FILTERS
  2552. When you configure your FFmpeg build, you can disable any of the
  2553. existing filters using @code{--disable-filters}.
  2554. The configure output will show the video filters included in your
  2555. build.
  2556. Below is a description of the currently available video filters.
  2557. @section alphaextract
  2558. Extract the alpha component from the input as a grayscale video. This
  2559. is especially useful with the @var{alphamerge} filter.
  2560. @section alphamerge
  2561. Add or replace the alpha component of the primary input with the
  2562. grayscale value of a second input. This is intended for use with
  2563. @var{alphaextract} to allow the transmission or storage of frame
  2564. sequences that have alpha in a format that doesn't support an alpha
  2565. channel.
  2566. For example, to reconstruct full frames from a normal YUV-encoded video
  2567. and a separate video created with @var{alphaextract}, you might use:
  2568. @example
  2569. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  2570. @end example
  2571. Since this filter is designed for reconstruction, it operates on frame
  2572. sequences without considering timestamps, and terminates when either
  2573. input reaches end of stream. This will cause problems if your encoding
  2574. pipeline drops frames. If you're trying to apply an image as an
  2575. overlay to a video stream, consider the @var{overlay} filter instead.
  2576. @section ass
  2577. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  2578. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  2579. Substation Alpha) subtitles files.
  2580. This filter accepts the following option in addition to the common options from
  2581. the @ref{subtitles} filter:
  2582. @table @option
  2583. @item shaping
  2584. Set the shaping engine
  2585. Available values are:
  2586. @table @samp
  2587. @item auto
  2588. The default libass shaping engine, which is the best available.
  2589. @item simple
  2590. Fast, font-agnostic shaper that can do only substitutions
  2591. @item complex
  2592. Slower shaper using OpenType for substitutions and positioning
  2593. @end table
  2594. The default is @code{auto}.
  2595. @end table
  2596. @section atadenoise
  2597. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  2598. The filter accepts the following options:
  2599. @table @option
  2600. @item 0a
  2601. Set threshold A for 1st plane. Default is 0.02.
  2602. Valid range is 0 to 0.3.
  2603. @item 0b
  2604. Set threshold B for 1st plane. Default is 0.04.
  2605. Valid range is 0 to 5.
  2606. @item 1a
  2607. Set threshold A for 2nd plane. Default is 0.02.
  2608. Valid range is 0 to 0.3.
  2609. @item 1b
  2610. Set threshold B for 2nd plane. Default is 0.04.
  2611. Valid range is 0 to 5.
  2612. @item 2a
  2613. Set threshold A for 3rd plane. Default is 0.02.
  2614. Valid range is 0 to 0.3.
  2615. @item 2b
  2616. Set threshold B for 3rd plane. Default is 0.04.
  2617. Valid range is 0 to 5.
  2618. Threshold A is designed to react on abrupt changes in the input signal and
  2619. threshold B is designed to react on continuous changes in the input signal.
  2620. @item s
  2621. Set number of frames filter will use for averaging. Default is 33. Must be odd
  2622. number in range [5, 129].
  2623. @end table
  2624. @section bbox
  2625. Compute the bounding box for the non-black pixels in the input frame
  2626. luminance plane.
  2627. This filter computes the bounding box containing all the pixels with a
  2628. luminance value greater than the minimum allowed value.
  2629. The parameters describing the bounding box are printed on the filter
  2630. log.
  2631. The filter accepts the following option:
  2632. @table @option
  2633. @item min_val
  2634. Set the minimal luminance value. Default is @code{16}.
  2635. @end table
  2636. @section blackdetect
  2637. Detect video intervals that are (almost) completely black. Can be
  2638. useful to detect chapter transitions, commercials, or invalid
  2639. recordings. Output lines contains the time for the start, end and
  2640. duration of the detected black interval expressed in seconds.
  2641. In order to display the output lines, you need to set the loglevel at
  2642. least to the AV_LOG_INFO value.
  2643. The filter accepts the following options:
  2644. @table @option
  2645. @item black_min_duration, d
  2646. Set the minimum detected black duration expressed in seconds. It must
  2647. be a non-negative floating point number.
  2648. Default value is 2.0.
  2649. @item picture_black_ratio_th, pic_th
  2650. Set the threshold for considering a picture "black".
  2651. Express the minimum value for the ratio:
  2652. @example
  2653. @var{nb_black_pixels} / @var{nb_pixels}
  2654. @end example
  2655. for which a picture is considered black.
  2656. Default value is 0.98.
  2657. @item pixel_black_th, pix_th
  2658. Set the threshold for considering a pixel "black".
  2659. The threshold expresses the maximum pixel luminance value for which a
  2660. pixel is considered "black". The provided value is scaled according to
  2661. the following equation:
  2662. @example
  2663. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  2664. @end example
  2665. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  2666. the input video format, the range is [0-255] for YUV full-range
  2667. formats and [16-235] for YUV non full-range formats.
  2668. Default value is 0.10.
  2669. @end table
  2670. The following example sets the maximum pixel threshold to the minimum
  2671. value, and detects only black intervals of 2 or more seconds:
  2672. @example
  2673. blackdetect=d=2:pix_th=0.00
  2674. @end example
  2675. @section blackframe
  2676. Detect frames that are (almost) completely black. Can be useful to
  2677. detect chapter transitions or commercials. Output lines consist of
  2678. the frame number of the detected frame, the percentage of blackness,
  2679. the position in the file if known or -1 and the timestamp in seconds.
  2680. In order to display the output lines, you need to set the loglevel at
  2681. least to the AV_LOG_INFO value.
  2682. It accepts the following parameters:
  2683. @table @option
  2684. @item amount
  2685. The percentage of the pixels that have to be below the threshold; it defaults to
  2686. @code{98}.
  2687. @item threshold, thresh
  2688. The threshold below which a pixel value is considered black; it defaults to
  2689. @code{32}.
  2690. @end table
  2691. @section blend, tblend
  2692. Blend two video frames into each other.
  2693. The @code{blend} filter takes two input streams and outputs one
  2694. stream, the first input is the "top" layer and second input is
  2695. "bottom" layer. Output terminates when shortest input terminates.
  2696. The @code{tblend} (time blend) filter takes two consecutive frames
  2697. from one single stream, and outputs the result obtained by blending
  2698. the new frame on top of the old frame.
  2699. A description of the accepted options follows.
  2700. @table @option
  2701. @item c0_mode
  2702. @item c1_mode
  2703. @item c2_mode
  2704. @item c3_mode
  2705. @item all_mode
  2706. Set blend mode for specific pixel component or all pixel components in case
  2707. of @var{all_mode}. Default value is @code{normal}.
  2708. Available values for component modes are:
  2709. @table @samp
  2710. @item addition
  2711. @item addition128
  2712. @item and
  2713. @item average
  2714. @item burn
  2715. @item darken
  2716. @item difference
  2717. @item difference128
  2718. @item divide
  2719. @item dodge
  2720. @item exclusion
  2721. @item glow
  2722. @item hardlight
  2723. @item hardmix
  2724. @item lighten
  2725. @item linearlight
  2726. @item multiply
  2727. @item negation
  2728. @item normal
  2729. @item or
  2730. @item overlay
  2731. @item phoenix
  2732. @item pinlight
  2733. @item reflect
  2734. @item screen
  2735. @item softlight
  2736. @item subtract
  2737. @item vividlight
  2738. @item xor
  2739. @end table
  2740. @item c0_opacity
  2741. @item c1_opacity
  2742. @item c2_opacity
  2743. @item c3_opacity
  2744. @item all_opacity
  2745. Set blend opacity for specific pixel component or all pixel components in case
  2746. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  2747. @item c0_expr
  2748. @item c1_expr
  2749. @item c2_expr
  2750. @item c3_expr
  2751. @item all_expr
  2752. Set blend expression for specific pixel component or all pixel components in case
  2753. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  2754. The expressions can use the following variables:
  2755. @table @option
  2756. @item N
  2757. The sequential number of the filtered frame, starting from @code{0}.
  2758. @item X
  2759. @item Y
  2760. the coordinates of the current sample
  2761. @item W
  2762. @item H
  2763. the width and height of currently filtered plane
  2764. @item SW
  2765. @item SH
  2766. Width and height scale depending on the currently filtered plane. It is the
  2767. ratio between the corresponding luma plane number of pixels and the current
  2768. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  2769. @code{0.5,0.5} for chroma planes.
  2770. @item T
  2771. Time of the current frame, expressed in seconds.
  2772. @item TOP, A
  2773. Value of pixel component at current location for first video frame (top layer).
  2774. @item BOTTOM, B
  2775. Value of pixel component at current location for second video frame (bottom layer).
  2776. @end table
  2777. @item shortest
  2778. Force termination when the shortest input terminates. Default is
  2779. @code{0}. This option is only defined for the @code{blend} filter.
  2780. @item repeatlast
  2781. Continue applying the last bottom frame after the end of the stream. A value of
  2782. @code{0} disable the filter after the last frame of the bottom layer is reached.
  2783. Default is @code{1}. This option is only defined for the @code{blend} filter.
  2784. @end table
  2785. @subsection Examples
  2786. @itemize
  2787. @item
  2788. Apply transition from bottom layer to top layer in first 10 seconds:
  2789. @example
  2790. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  2791. @end example
  2792. @item
  2793. Apply 1x1 checkerboard effect:
  2794. @example
  2795. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  2796. @end example
  2797. @item
  2798. Apply uncover left effect:
  2799. @example
  2800. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  2801. @end example
  2802. @item
  2803. Apply uncover down effect:
  2804. @example
  2805. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  2806. @end example
  2807. @item
  2808. Apply uncover up-left effect:
  2809. @example
  2810. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  2811. @end example
  2812. @item
  2813. Display differences between the current and the previous frame:
  2814. @example
  2815. tblend=all_mode=difference128
  2816. @end example
  2817. @end itemize
  2818. @section boxblur
  2819. Apply a boxblur algorithm to the input video.
  2820. It accepts the following parameters:
  2821. @table @option
  2822. @item luma_radius, lr
  2823. @item luma_power, lp
  2824. @item chroma_radius, cr
  2825. @item chroma_power, cp
  2826. @item alpha_radius, ar
  2827. @item alpha_power, ap
  2828. @end table
  2829. A description of the accepted options follows.
  2830. @table @option
  2831. @item luma_radius, lr
  2832. @item chroma_radius, cr
  2833. @item alpha_radius, ar
  2834. Set an expression for the box radius in pixels used for blurring the
  2835. corresponding input plane.
  2836. The radius value must be a non-negative number, and must not be
  2837. greater than the value of the expression @code{min(w,h)/2} for the
  2838. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  2839. planes.
  2840. Default value for @option{luma_radius} is "2". If not specified,
  2841. @option{chroma_radius} and @option{alpha_radius} default to the
  2842. corresponding value set for @option{luma_radius}.
  2843. The expressions can contain the following constants:
  2844. @table @option
  2845. @item w
  2846. @item h
  2847. The input width and height in pixels.
  2848. @item cw
  2849. @item ch
  2850. The input chroma image width and height in pixels.
  2851. @item hsub
  2852. @item vsub
  2853. The horizontal and vertical chroma subsample values. For example, for the
  2854. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  2855. @end table
  2856. @item luma_power, lp
  2857. @item chroma_power, cp
  2858. @item alpha_power, ap
  2859. Specify how many times the boxblur filter is applied to the
  2860. corresponding plane.
  2861. Default value for @option{luma_power} is 2. If not specified,
  2862. @option{chroma_power} and @option{alpha_power} default to the
  2863. corresponding value set for @option{luma_power}.
  2864. A value of 0 will disable the effect.
  2865. @end table
  2866. @subsection Examples
  2867. @itemize
  2868. @item
  2869. Apply a boxblur filter with the luma, chroma, and alpha radii
  2870. set to 2:
  2871. @example
  2872. boxblur=luma_radius=2:luma_power=1
  2873. boxblur=2:1
  2874. @end example
  2875. @item
  2876. Set the luma radius to 2, and alpha and chroma radius to 0:
  2877. @example
  2878. boxblur=2:1:cr=0:ar=0
  2879. @end example
  2880. @item
  2881. Set the luma and chroma radii to a fraction of the video dimension:
  2882. @example
  2883. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  2884. @end example
  2885. @end itemize
  2886. @section chromakey
  2887. YUV colorspace color/chroma keying.
  2888. The filter accepts the following options:
  2889. @table @option
  2890. @item color
  2891. The color which will be replaced with transparency.
  2892. @item similarity
  2893. Similarity percentage with the key color.
  2894. 0.01 matches only the exact key color, while 1.0 matches everything.
  2895. @item blend
  2896. Blend percentage.
  2897. 0.0 makes pixels either fully transparent, or not transparent at all.
  2898. Higher values result in semi-transparent pixels, with a higher transparency
  2899. the more similar the pixels color is to the key color.
  2900. @item yuv
  2901. Signals that the color passed is already in YUV instead of RGB.
  2902. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  2903. This can be used to pass exact YUV values as hexadecimal numbers.
  2904. @end table
  2905. @subsection Examples
  2906. @itemize
  2907. @item
  2908. Make every green pixel in the input image transparent:
  2909. @example
  2910. ffmpeg -i input.png -vf chromakey=green out.png
  2911. @end example
  2912. @item
  2913. Overlay a greenscreen-video on top of a static black background.
  2914. @example
  2915. 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
  2916. @end example
  2917. @end itemize
  2918. @section codecview
  2919. Visualize information exported by some codecs.
  2920. Some codecs can export information through frames using side-data or other
  2921. means. For example, some MPEG based codecs export motion vectors through the
  2922. @var{export_mvs} flag in the codec @option{flags2} option.
  2923. The filter accepts the following option:
  2924. @table @option
  2925. @item mv
  2926. Set motion vectors to visualize.
  2927. Available flags for @var{mv} are:
  2928. @table @samp
  2929. @item pf
  2930. forward predicted MVs of P-frames
  2931. @item bf
  2932. forward predicted MVs of B-frames
  2933. @item bb
  2934. backward predicted MVs of B-frames
  2935. @end table
  2936. @end table
  2937. @subsection Examples
  2938. @itemize
  2939. @item
  2940. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  2941. @example
  2942. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  2943. @end example
  2944. @end itemize
  2945. @section colorbalance
  2946. Modify intensity of primary colors (red, green and blue) of input frames.
  2947. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  2948. regions for the red-cyan, green-magenta or blue-yellow balance.
  2949. A positive adjustment value shifts the balance towards the primary color, a negative
  2950. value towards the complementary color.
  2951. The filter accepts the following options:
  2952. @table @option
  2953. @item rs
  2954. @item gs
  2955. @item bs
  2956. Adjust red, green and blue shadows (darkest pixels).
  2957. @item rm
  2958. @item gm
  2959. @item bm
  2960. Adjust red, green and blue midtones (medium pixels).
  2961. @item rh
  2962. @item gh
  2963. @item bh
  2964. Adjust red, green and blue highlights (brightest pixels).
  2965. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  2966. @end table
  2967. @subsection Examples
  2968. @itemize
  2969. @item
  2970. Add red color cast to shadows:
  2971. @example
  2972. colorbalance=rs=.3
  2973. @end example
  2974. @end itemize
  2975. @section colorkey
  2976. RGB colorspace color keying.
  2977. The filter accepts the following options:
  2978. @table @option
  2979. @item color
  2980. The color which will be replaced with transparency.
  2981. @item similarity
  2982. Similarity percentage with the key color.
  2983. 0.01 matches only the exact key color, while 1.0 matches everything.
  2984. @item blend
  2985. Blend percentage.
  2986. 0.0 makes pixels either fully transparent, or not transparent at all.
  2987. Higher values result in semi-transparent pixels, with a higher transparency
  2988. the more similar the pixels color is to the key color.
  2989. @end table
  2990. @subsection Examples
  2991. @itemize
  2992. @item
  2993. Make every green pixel in the input image transparent:
  2994. @example
  2995. ffmpeg -i input.png -vf colorkey=green out.png
  2996. @end example
  2997. @item
  2998. Overlay a greenscreen-video on top of a static background image.
  2999. @example
  3000. 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
  3001. @end example
  3002. @end itemize
  3003. @section colorlevels
  3004. Adjust video input frames using levels.
  3005. The filter accepts the following options:
  3006. @table @option
  3007. @item rimin
  3008. @item gimin
  3009. @item bimin
  3010. @item aimin
  3011. Adjust red, green, blue and alpha input black point.
  3012. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3013. @item rimax
  3014. @item gimax
  3015. @item bimax
  3016. @item aimax
  3017. Adjust red, green, blue and alpha input white point.
  3018. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3019. Input levels are used to lighten highlights (bright tones), darken shadows
  3020. (dark tones), change the balance of bright and dark tones.
  3021. @item romin
  3022. @item gomin
  3023. @item bomin
  3024. @item aomin
  3025. Adjust red, green, blue and alpha output black point.
  3026. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3027. @item romax
  3028. @item gomax
  3029. @item bomax
  3030. @item aomax
  3031. Adjust red, green, blue and alpha output white point.
  3032. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3033. Output levels allows manual selection of a constrained output level range.
  3034. @end table
  3035. @subsection Examples
  3036. @itemize
  3037. @item
  3038. Make video output darker:
  3039. @example
  3040. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3041. @end example
  3042. @item
  3043. Increase contrast:
  3044. @example
  3045. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3046. @end example
  3047. @item
  3048. Make video output lighter:
  3049. @example
  3050. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3051. @end example
  3052. @item
  3053. Increase brightness:
  3054. @example
  3055. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3056. @end example
  3057. @end itemize
  3058. @section colorchannelmixer
  3059. Adjust video input frames by re-mixing color channels.
  3060. This filter modifies a color channel by adding the values associated to
  3061. the other channels of the same pixels. For example if the value to
  3062. modify is red, the output value will be:
  3063. @example
  3064. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3065. @end example
  3066. The filter accepts the following options:
  3067. @table @option
  3068. @item rr
  3069. @item rg
  3070. @item rb
  3071. @item ra
  3072. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3073. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3074. @item gr
  3075. @item gg
  3076. @item gb
  3077. @item ga
  3078. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3079. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3080. @item br
  3081. @item bg
  3082. @item bb
  3083. @item ba
  3084. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3085. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3086. @item ar
  3087. @item ag
  3088. @item ab
  3089. @item aa
  3090. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3091. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3092. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3093. @end table
  3094. @subsection Examples
  3095. @itemize
  3096. @item
  3097. Convert source to grayscale:
  3098. @example
  3099. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3100. @end example
  3101. @item
  3102. Simulate sepia tones:
  3103. @example
  3104. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3105. @end example
  3106. @end itemize
  3107. @section colormatrix
  3108. Convert color matrix.
  3109. The filter accepts the following options:
  3110. @table @option
  3111. @item src
  3112. @item dst
  3113. Specify the source and destination color matrix. Both values must be
  3114. specified.
  3115. The accepted values are:
  3116. @table @samp
  3117. @item bt709
  3118. BT.709
  3119. @item bt601
  3120. BT.601
  3121. @item smpte240m
  3122. SMPTE-240M
  3123. @item fcc
  3124. FCC
  3125. @end table
  3126. @end table
  3127. For example to convert from BT.601 to SMPTE-240M, use the command:
  3128. @example
  3129. colormatrix=bt601:smpte240m
  3130. @end example
  3131. @section copy
  3132. Copy the input source unchanged to the output. This is mainly useful for
  3133. testing purposes.
  3134. @section crop
  3135. Crop the input video to given dimensions.
  3136. It accepts the following parameters:
  3137. @table @option
  3138. @item w, out_w
  3139. The width of the output video. It defaults to @code{iw}.
  3140. This expression is evaluated only once during the filter
  3141. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  3142. @item h, out_h
  3143. The height of the output video. It defaults to @code{ih}.
  3144. This expression is evaluated only once during the filter
  3145. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  3146. @item x
  3147. The horizontal position, in the input video, of the left edge of the output
  3148. video. It defaults to @code{(in_w-out_w)/2}.
  3149. This expression is evaluated per-frame.
  3150. @item y
  3151. The vertical position, in the input video, of the top edge of the output video.
  3152. It defaults to @code{(in_h-out_h)/2}.
  3153. This expression is evaluated per-frame.
  3154. @item keep_aspect
  3155. If set to 1 will force the output display aspect ratio
  3156. to be the same of the input, by changing the output sample aspect
  3157. ratio. It defaults to 0.
  3158. @end table
  3159. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  3160. expressions containing the following constants:
  3161. @table @option
  3162. @item x
  3163. @item y
  3164. The computed values for @var{x} and @var{y}. They are evaluated for
  3165. each new frame.
  3166. @item in_w
  3167. @item in_h
  3168. The input width and height.
  3169. @item iw
  3170. @item ih
  3171. These are the same as @var{in_w} and @var{in_h}.
  3172. @item out_w
  3173. @item out_h
  3174. The output (cropped) width and height.
  3175. @item ow
  3176. @item oh
  3177. These are the same as @var{out_w} and @var{out_h}.
  3178. @item a
  3179. same as @var{iw} / @var{ih}
  3180. @item sar
  3181. input sample aspect ratio
  3182. @item dar
  3183. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  3184. @item hsub
  3185. @item vsub
  3186. horizontal and vertical chroma subsample values. For example for the
  3187. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3188. @item n
  3189. The number of the input frame, starting from 0.
  3190. @item pos
  3191. the position in the file of the input frame, NAN if unknown
  3192. @item t
  3193. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  3194. @end table
  3195. The expression for @var{out_w} may depend on the value of @var{out_h},
  3196. and the expression for @var{out_h} may depend on @var{out_w}, but they
  3197. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  3198. evaluated after @var{out_w} and @var{out_h}.
  3199. The @var{x} and @var{y} parameters specify the expressions for the
  3200. position of the top-left corner of the output (non-cropped) area. They
  3201. are evaluated for each frame. If the evaluated value is not valid, it
  3202. is approximated to the nearest valid value.
  3203. The expression for @var{x} may depend on @var{y}, and the expression
  3204. for @var{y} may depend on @var{x}.
  3205. @subsection Examples
  3206. @itemize
  3207. @item
  3208. Crop area with size 100x100 at position (12,34).
  3209. @example
  3210. crop=100:100:12:34
  3211. @end example
  3212. Using named options, the example above becomes:
  3213. @example
  3214. crop=w=100:h=100:x=12:y=34
  3215. @end example
  3216. @item
  3217. Crop the central input area with size 100x100:
  3218. @example
  3219. crop=100:100
  3220. @end example
  3221. @item
  3222. Crop the central input area with size 2/3 of the input video:
  3223. @example
  3224. crop=2/3*in_w:2/3*in_h
  3225. @end example
  3226. @item
  3227. Crop the input video central square:
  3228. @example
  3229. crop=out_w=in_h
  3230. crop=in_h
  3231. @end example
  3232. @item
  3233. Delimit the rectangle with the top-left corner placed at position
  3234. 100:100 and the right-bottom corner corresponding to the right-bottom
  3235. corner of the input image.
  3236. @example
  3237. crop=in_w-100:in_h-100:100:100
  3238. @end example
  3239. @item
  3240. Crop 10 pixels from the left and right borders, and 20 pixels from
  3241. the top and bottom borders
  3242. @example
  3243. crop=in_w-2*10:in_h-2*20
  3244. @end example
  3245. @item
  3246. Keep only the bottom right quarter of the input image:
  3247. @example
  3248. crop=in_w/2:in_h/2:in_w/2:in_h/2
  3249. @end example
  3250. @item
  3251. Crop height for getting Greek harmony:
  3252. @example
  3253. crop=in_w:1/PHI*in_w
  3254. @end example
  3255. @item
  3256. Apply trembling effect:
  3257. @example
  3258. 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)
  3259. @end example
  3260. @item
  3261. Apply erratic camera effect depending on timestamp:
  3262. @example
  3263. 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)"
  3264. @end example
  3265. @item
  3266. Set x depending on the value of y:
  3267. @example
  3268. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  3269. @end example
  3270. @end itemize
  3271. @subsection Commands
  3272. This filter supports the following commands:
  3273. @table @option
  3274. @item w, out_w
  3275. @item h, out_h
  3276. @item x
  3277. @item y
  3278. Set width/height of the output video and the horizontal/vertical position
  3279. in the input video.
  3280. The command accepts the same syntax of the corresponding option.
  3281. If the specified expression is not valid, it is kept at its current
  3282. value.
  3283. @end table
  3284. @section cropdetect
  3285. Auto-detect the crop size.
  3286. It calculates the necessary cropping parameters and prints the
  3287. recommended parameters via the logging system. The detected dimensions
  3288. correspond to the non-black area of the input video.
  3289. It accepts the following parameters:
  3290. @table @option
  3291. @item limit
  3292. Set higher black value threshold, which can be optionally specified
  3293. from nothing (0) to everything (255 for 8bit based formats). An intensity
  3294. value greater to the set value is considered non-black. It defaults to 24.
  3295. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  3296. on the bitdepth of the pixel format.
  3297. @item round
  3298. The value which the width/height should be divisible by. It defaults to
  3299. 16. The offset is automatically adjusted to center the video. Use 2 to
  3300. get only even dimensions (needed for 4:2:2 video). 16 is best when
  3301. encoding to most video codecs.
  3302. @item reset_count, reset
  3303. Set the counter that determines after how many frames cropdetect will
  3304. reset the previously detected largest video area and start over to
  3305. detect the current optimal crop area. Default value is 0.
  3306. This can be useful when channel logos distort the video area. 0
  3307. indicates 'never reset', and returns the largest area encountered during
  3308. playback.
  3309. @end table
  3310. @anchor{curves}
  3311. @section curves
  3312. Apply color adjustments using curves.
  3313. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  3314. component (red, green and blue) has its values defined by @var{N} key points
  3315. tied from each other using a smooth curve. The x-axis represents the pixel
  3316. values from the input frame, and the y-axis the new pixel values to be set for
  3317. the output frame.
  3318. By default, a component curve is defined by the two points @var{(0;0)} and
  3319. @var{(1;1)}. This creates a straight line where each original pixel value is
  3320. "adjusted" to its own value, which means no change to the image.
  3321. The filter allows you to redefine these two points and add some more. A new
  3322. curve (using a natural cubic spline interpolation) will be define to pass
  3323. smoothly through all these new coordinates. The new defined points needs to be
  3324. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  3325. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  3326. the vector spaces, the values will be clipped accordingly.
  3327. If there is no key point defined in @code{x=0}, the filter will automatically
  3328. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  3329. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  3330. The filter accepts the following options:
  3331. @table @option
  3332. @item preset
  3333. Select one of the available color presets. This option can be used in addition
  3334. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  3335. options takes priority on the preset values.
  3336. Available presets are:
  3337. @table @samp
  3338. @item none
  3339. @item color_negative
  3340. @item cross_process
  3341. @item darker
  3342. @item increase_contrast
  3343. @item lighter
  3344. @item linear_contrast
  3345. @item medium_contrast
  3346. @item negative
  3347. @item strong_contrast
  3348. @item vintage
  3349. @end table
  3350. Default is @code{none}.
  3351. @item master, m
  3352. Set the master key points. These points will define a second pass mapping. It
  3353. is sometimes called a "luminance" or "value" mapping. It can be used with
  3354. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  3355. post-processing LUT.
  3356. @item red, r
  3357. Set the key points for the red component.
  3358. @item green, g
  3359. Set the key points for the green component.
  3360. @item blue, b
  3361. Set the key points for the blue component.
  3362. @item all
  3363. Set the key points for all components (not including master).
  3364. Can be used in addition to the other key points component
  3365. options. In this case, the unset component(s) will fallback on this
  3366. @option{all} setting.
  3367. @item psfile
  3368. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  3369. @end table
  3370. To avoid some filtergraph syntax conflicts, each key points list need to be
  3371. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  3372. @subsection Examples
  3373. @itemize
  3374. @item
  3375. Increase slightly the middle level of blue:
  3376. @example
  3377. curves=blue='0.5/0.58'
  3378. @end example
  3379. @item
  3380. Vintage effect:
  3381. @example
  3382. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  3383. @end example
  3384. Here we obtain the following coordinates for each components:
  3385. @table @var
  3386. @item red
  3387. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  3388. @item green
  3389. @code{(0;0) (0.50;0.48) (1;1)}
  3390. @item blue
  3391. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  3392. @end table
  3393. @item
  3394. The previous example can also be achieved with the associated built-in preset:
  3395. @example
  3396. curves=preset=vintage
  3397. @end example
  3398. @item
  3399. Or simply:
  3400. @example
  3401. curves=vintage
  3402. @end example
  3403. @item
  3404. Use a Photoshop preset and redefine the points of the green component:
  3405. @example
  3406. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  3407. @end example
  3408. @end itemize
  3409. @section dctdnoiz
  3410. Denoise frames using 2D DCT (frequency domain filtering).
  3411. This filter is not designed for real time.
  3412. The filter accepts the following options:
  3413. @table @option
  3414. @item sigma, s
  3415. Set the noise sigma constant.
  3416. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  3417. coefficient (absolute value) below this threshold with be dropped.
  3418. If you need a more advanced filtering, see @option{expr}.
  3419. Default is @code{0}.
  3420. @item overlap
  3421. Set number overlapping pixels for each block. Since the filter can be slow, you
  3422. may want to reduce this value, at the cost of a less effective filter and the
  3423. risk of various artefacts.
  3424. If the overlapping value doesn't permit processing the whole input width or
  3425. height, a warning will be displayed and according borders won't be denoised.
  3426. Default value is @var{blocksize}-1, which is the best possible setting.
  3427. @item expr, e
  3428. Set the coefficient factor expression.
  3429. For each coefficient of a DCT block, this expression will be evaluated as a
  3430. multiplier value for the coefficient.
  3431. If this is option is set, the @option{sigma} option will be ignored.
  3432. The absolute value of the coefficient can be accessed through the @var{c}
  3433. variable.
  3434. @item n
  3435. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  3436. @var{blocksize}, which is the width and height of the processed blocks.
  3437. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  3438. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  3439. on the speed processing. Also, a larger block size does not necessarily means a
  3440. better de-noising.
  3441. @end table
  3442. @subsection Examples
  3443. Apply a denoise with a @option{sigma} of @code{4.5}:
  3444. @example
  3445. dctdnoiz=4.5
  3446. @end example
  3447. The same operation can be achieved using the expression system:
  3448. @example
  3449. dctdnoiz=e='gte(c, 4.5*3)'
  3450. @end example
  3451. Violent denoise using a block size of @code{16x16}:
  3452. @example
  3453. dctdnoiz=15:n=4
  3454. @end example
  3455. @section deband
  3456. Remove banding artifacts from input video.
  3457. It works by replacing banded pixels with average value of referenced pixels.
  3458. The filter accepts the following options:
  3459. @table @option
  3460. @item 1thr
  3461. @item 2thr
  3462. @item 3thr
  3463. @item 4thr
  3464. Set banding detection threshold for each plane. Default is 0.02.
  3465. Valid range is 0.00003 to 0.5.
  3466. If difference between current pixel and reference pixel is less than threshold,
  3467. it will be considered as banded.
  3468. @item range, r
  3469. Banding detection range in pixels. Default is 16. If positive, random number
  3470. in range 0 to set value will be used. If negative, exact absolute value
  3471. will be used.
  3472. The range defines square of four pixels around current pixel.
  3473. @item direction, d
  3474. Set direction in radians from which four pixel will be compared. If positive,
  3475. random direction from 0 to set direction will be picked. If negative, exact of
  3476. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  3477. will pick only pixels on same row and -PI/2 will pick only pixels on same
  3478. column.
  3479. @item blur
  3480. If enabled, current pixel is compared with average value of all four
  3481. surrounding pixels. The default is enabled. If disabled current pixel is
  3482. compared with all four surrounding pixels. The pixel is considered banded
  3483. if only all four differences with surrounding pixels are less than threshold.
  3484. @end table
  3485. @anchor{decimate}
  3486. @section decimate
  3487. Drop duplicated frames at regular intervals.
  3488. The filter accepts the following options:
  3489. @table @option
  3490. @item cycle
  3491. Set the number of frames from which one will be dropped. Setting this to
  3492. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  3493. Default is @code{5}.
  3494. @item dupthresh
  3495. Set the threshold for duplicate detection. If the difference metric for a frame
  3496. is less than or equal to this value, then it is declared as duplicate. Default
  3497. is @code{1.1}
  3498. @item scthresh
  3499. Set scene change threshold. Default is @code{15}.
  3500. @item blockx
  3501. @item blocky
  3502. Set the size of the x and y-axis blocks used during metric calculations.
  3503. Larger blocks give better noise suppression, but also give worse detection of
  3504. small movements. Must be a power of two. Default is @code{32}.
  3505. @item ppsrc
  3506. Mark main input as a pre-processed input and activate clean source input
  3507. stream. This allows the input to be pre-processed with various filters to help
  3508. the metrics calculation while keeping the frame selection lossless. When set to
  3509. @code{1}, the first stream is for the pre-processed input, and the second
  3510. stream is the clean source from where the kept frames are chosen. Default is
  3511. @code{0}.
  3512. @item chroma
  3513. Set whether or not chroma is considered in the metric calculations. Default is
  3514. @code{1}.
  3515. @end table
  3516. @section deflate
  3517. Apply deflate effect to the video.
  3518. This filter replaces the pixel by the local(3x3) average by taking into account
  3519. only values lower than the pixel.
  3520. It accepts the following options:
  3521. @table @option
  3522. @item threshold0
  3523. @item threshold1
  3524. @item threshold2
  3525. @item threshold3
  3526. Limit the maximum change for each plane, default is 65535.
  3527. If 0, plane will remain unchanged.
  3528. @end table
  3529. @section dejudder
  3530. Remove judder produced by partially interlaced telecined content.
  3531. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  3532. source was partially telecined content then the output of @code{pullup,dejudder}
  3533. will have a variable frame rate. May change the recorded frame rate of the
  3534. container. Aside from that change, this filter will not affect constant frame
  3535. rate video.
  3536. The option available in this filter is:
  3537. @table @option
  3538. @item cycle
  3539. Specify the length of the window over which the judder repeats.
  3540. Accepts any integer greater than 1. Useful values are:
  3541. @table @samp
  3542. @item 4
  3543. If the original was telecined from 24 to 30 fps (Film to NTSC).
  3544. @item 5
  3545. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  3546. @item 20
  3547. If a mixture of the two.
  3548. @end table
  3549. The default is @samp{4}.
  3550. @end table
  3551. @section delogo
  3552. Suppress a TV station logo by a simple interpolation of the surrounding
  3553. pixels. Just set a rectangle covering the logo and watch it disappear
  3554. (and sometimes something even uglier appear - your mileage may vary).
  3555. It accepts the following parameters:
  3556. @table @option
  3557. @item x
  3558. @item y
  3559. Specify the top left corner coordinates of the logo. They must be
  3560. specified.
  3561. @item w
  3562. @item h
  3563. Specify the width and height of the logo to clear. They must be
  3564. specified.
  3565. @item band, t
  3566. Specify the thickness of the fuzzy edge of the rectangle (added to
  3567. @var{w} and @var{h}). The default value is 1. This option is
  3568. deprecated, setting higher values should no longer be necessary and
  3569. is not recommended.
  3570. @item show
  3571. When set to 1, a green rectangle is drawn on the screen to simplify
  3572. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  3573. The default value is 0.
  3574. The rectangle is drawn on the outermost pixels which will be (partly)
  3575. replaced with interpolated values. The values of the next pixels
  3576. immediately outside this rectangle in each direction will be used to
  3577. compute the interpolated pixel values inside the rectangle.
  3578. @end table
  3579. @subsection Examples
  3580. @itemize
  3581. @item
  3582. Set a rectangle covering the area with top left corner coordinates 0,0
  3583. and size 100x77, and a band of size 10:
  3584. @example
  3585. delogo=x=0:y=0:w=100:h=77:band=10
  3586. @end example
  3587. @end itemize
  3588. @section deshake
  3589. Attempt to fix small changes in horizontal and/or vertical shift. This
  3590. filter helps remove camera shake from hand-holding a camera, bumping a
  3591. tripod, moving on a vehicle, etc.
  3592. The filter accepts the following options:
  3593. @table @option
  3594. @item x
  3595. @item y
  3596. @item w
  3597. @item h
  3598. Specify a rectangular area where to limit the search for motion
  3599. vectors.
  3600. If desired the search for motion vectors can be limited to a
  3601. rectangular area of the frame defined by its top left corner, width
  3602. and height. These parameters have the same meaning as the drawbox
  3603. filter which can be used to visualise the position of the bounding
  3604. box.
  3605. This is useful when simultaneous movement of subjects within the frame
  3606. might be confused for camera motion by the motion vector search.
  3607. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  3608. then the full frame is used. This allows later options to be set
  3609. without specifying the bounding box for the motion vector search.
  3610. Default - search the whole frame.
  3611. @item rx
  3612. @item ry
  3613. Specify the maximum extent of movement in x and y directions in the
  3614. range 0-64 pixels. Default 16.
  3615. @item edge
  3616. Specify how to generate pixels to fill blanks at the edge of the
  3617. frame. Available values are:
  3618. @table @samp
  3619. @item blank, 0
  3620. Fill zeroes at blank locations
  3621. @item original, 1
  3622. Original image at blank locations
  3623. @item clamp, 2
  3624. Extruded edge value at blank locations
  3625. @item mirror, 3
  3626. Mirrored edge at blank locations
  3627. @end table
  3628. Default value is @samp{mirror}.
  3629. @item blocksize
  3630. Specify the blocksize to use for motion search. Range 4-128 pixels,
  3631. default 8.
  3632. @item contrast
  3633. Specify the contrast threshold for blocks. Only blocks with more than
  3634. the specified contrast (difference between darkest and lightest
  3635. pixels) will be considered. Range 1-255, default 125.
  3636. @item search
  3637. Specify the search strategy. Available values are:
  3638. @table @samp
  3639. @item exhaustive, 0
  3640. Set exhaustive search
  3641. @item less, 1
  3642. Set less exhaustive search.
  3643. @end table
  3644. Default value is @samp{exhaustive}.
  3645. @item filename
  3646. If set then a detailed log of the motion search is written to the
  3647. specified file.
  3648. @item opencl
  3649. If set to 1, specify using OpenCL capabilities, only available if
  3650. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  3651. @end table
  3652. @section detelecine
  3653. Apply an exact inverse of the telecine operation. It requires a predefined
  3654. pattern specified using the pattern option which must be the same as that passed
  3655. to the telecine filter.
  3656. This filter accepts the following options:
  3657. @table @option
  3658. @item first_field
  3659. @table @samp
  3660. @item top, t
  3661. top field first
  3662. @item bottom, b
  3663. bottom field first
  3664. The default value is @code{top}.
  3665. @end table
  3666. @item pattern
  3667. A string of numbers representing the pulldown pattern you wish to apply.
  3668. The default value is @code{23}.
  3669. @item start_frame
  3670. A number representing position of the first frame with respect to the telecine
  3671. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  3672. @end table
  3673. @section dilation
  3674. Apply dilation effect to the video.
  3675. This filter replaces the pixel by the local(3x3) maximum.
  3676. It accepts the following options:
  3677. @table @option
  3678. @item threshold0
  3679. @item threshold1
  3680. @item threshold2
  3681. @item threshold3
  3682. Limit the maximum change for each plane, default is 65535.
  3683. If 0, plane will remain unchanged.
  3684. @item coordinates
  3685. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  3686. pixels are used.
  3687. Flags to local 3x3 coordinates maps like this:
  3688. 1 2 3
  3689. 4 5
  3690. 6 7 8
  3691. @end table
  3692. @section displace
  3693. Displace pixels as indicated by second and third input stream.
  3694. It takes three input streams and outputs one stream, the first input is the
  3695. source, and second and third input are displacement maps.
  3696. The second input specifies how much to displace pixels along the
  3697. x-axis, while the third input specifies how much to displace pixels
  3698. along the y-axis.
  3699. If one of displacement map streams terminates, last frame from that
  3700. displacement map will be used.
  3701. Note that once generated, displacements maps can be reused over and over again.
  3702. A description of the accepted options follows.
  3703. @table @option
  3704. @item edge
  3705. Set displace behavior for pixels that are out of range.
  3706. Available values are:
  3707. @table @samp
  3708. @item blank
  3709. Missing pixels are replaced by black pixels.
  3710. @item smear
  3711. Adjacent pixels will spread out to replace missing pixels.
  3712. @item wrap
  3713. Out of range pixels are wrapped so they point to pixels of other side.
  3714. @end table
  3715. Default is @samp{smear}.
  3716. @end table
  3717. @subsection Examples
  3718. @itemize
  3719. @item
  3720. Add ripple effect to rgb input of video size hd720:
  3721. @example
  3722. 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
  3723. @end example
  3724. @item
  3725. Add wave effect to rgb input of video size hd720:
  3726. @example
  3727. 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
  3728. @end example
  3729. @end itemize
  3730. @section drawbox
  3731. Draw a colored box on the input image.
  3732. It accepts the following parameters:
  3733. @table @option
  3734. @item x
  3735. @item y
  3736. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  3737. @item width, w
  3738. @item height, h
  3739. The expressions which specify the width and height of the box; if 0 they are interpreted as
  3740. the input width and height. It defaults to 0.
  3741. @item color, c
  3742. Specify the color of the box to write. For the general syntax of this option,
  3743. check the "Color" section in the ffmpeg-utils manual. If the special
  3744. value @code{invert} is used, the box edge color is the same as the
  3745. video with inverted luma.
  3746. @item thickness, t
  3747. The expression which sets the thickness of the box edge. Default value is @code{3}.
  3748. See below for the list of accepted constants.
  3749. @end table
  3750. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  3751. following constants:
  3752. @table @option
  3753. @item dar
  3754. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  3755. @item hsub
  3756. @item vsub
  3757. horizontal and vertical chroma subsample values. For example for the
  3758. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3759. @item in_h, ih
  3760. @item in_w, iw
  3761. The input width and height.
  3762. @item sar
  3763. The input sample aspect ratio.
  3764. @item x
  3765. @item y
  3766. The x and y offset coordinates where the box is drawn.
  3767. @item w
  3768. @item h
  3769. The width and height of the drawn box.
  3770. @item t
  3771. The thickness of the drawn box.
  3772. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  3773. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  3774. @end table
  3775. @subsection Examples
  3776. @itemize
  3777. @item
  3778. Draw a black box around the edge of the input image:
  3779. @example
  3780. drawbox
  3781. @end example
  3782. @item
  3783. Draw a box with color red and an opacity of 50%:
  3784. @example
  3785. drawbox=10:20:200:60:red@@0.5
  3786. @end example
  3787. The previous example can be specified as:
  3788. @example
  3789. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  3790. @end example
  3791. @item
  3792. Fill the box with pink color:
  3793. @example
  3794. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  3795. @end example
  3796. @item
  3797. Draw a 2-pixel red 2.40:1 mask:
  3798. @example
  3799. 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
  3800. @end example
  3801. @end itemize
  3802. @section drawgraph, adrawgraph
  3803. Draw a graph using input video or audio metadata.
  3804. It accepts the following parameters:
  3805. @table @option
  3806. @item m1
  3807. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  3808. @item fg1
  3809. Set 1st foreground color expression.
  3810. @item m2
  3811. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  3812. @item fg2
  3813. Set 2nd foreground color expression.
  3814. @item m3
  3815. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  3816. @item fg3
  3817. Set 3rd foreground color expression.
  3818. @item m4
  3819. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  3820. @item fg4
  3821. Set 4th foreground color expression.
  3822. @item min
  3823. Set minimal value of metadata value.
  3824. @item max
  3825. Set maximal value of metadata value.
  3826. @item bg
  3827. Set graph background color. Default is white.
  3828. @item mode
  3829. Set graph mode.
  3830. Available values for mode is:
  3831. @table @samp
  3832. @item bar
  3833. @item dot
  3834. @item line
  3835. @end table
  3836. Default is @code{line}.
  3837. @item slide
  3838. Set slide mode.
  3839. Available values for slide is:
  3840. @table @samp
  3841. @item frame
  3842. Draw new frame when right border is reached.
  3843. @item replace
  3844. Replace old columns with new ones.
  3845. @item scroll
  3846. Scroll from right to left.
  3847. @item rscroll
  3848. Scroll from left to right.
  3849. @end table
  3850. Default is @code{frame}.
  3851. @item size
  3852. Set size of graph video. For the syntax of this option, check the
  3853. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  3854. The default value is @code{900x256}.
  3855. The foreground color expressions can use the following variables:
  3856. @table @option
  3857. @item MIN
  3858. Minimal value of metadata value.
  3859. @item MAX
  3860. Maximal value of metadata value.
  3861. @item VAL
  3862. Current metadata key value.
  3863. @end table
  3864. The color is defined as 0xAABBGGRR.
  3865. @end table
  3866. Example using metadata from @ref{signalstats} filter:
  3867. @example
  3868. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  3869. @end example
  3870. Example using metadata from @ref{ebur128} filter:
  3871. @example
  3872. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  3873. @end example
  3874. @section drawgrid
  3875. Draw a grid on the input image.
  3876. It accepts the following parameters:
  3877. @table @option
  3878. @item x
  3879. @item y
  3880. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  3881. @item width, w
  3882. @item height, h
  3883. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  3884. input width and height, respectively, minus @code{thickness}, so image gets
  3885. framed. Default to 0.
  3886. @item color, c
  3887. Specify the color of the grid. For the general syntax of this option,
  3888. check the "Color" section in the ffmpeg-utils manual. If the special
  3889. value @code{invert} is used, the grid color is the same as the
  3890. video with inverted luma.
  3891. @item thickness, t
  3892. The expression which sets the thickness of the grid line. Default value is @code{1}.
  3893. See below for the list of accepted constants.
  3894. @end table
  3895. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  3896. following constants:
  3897. @table @option
  3898. @item dar
  3899. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  3900. @item hsub
  3901. @item vsub
  3902. horizontal and vertical chroma subsample values. For example for the
  3903. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3904. @item in_h, ih
  3905. @item in_w, iw
  3906. The input grid cell width and height.
  3907. @item sar
  3908. The input sample aspect ratio.
  3909. @item x
  3910. @item y
  3911. The x and y coordinates of some point of grid intersection (meant to configure offset).
  3912. @item w
  3913. @item h
  3914. The width and height of the drawn cell.
  3915. @item t
  3916. The thickness of the drawn cell.
  3917. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  3918. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  3919. @end table
  3920. @subsection Examples
  3921. @itemize
  3922. @item
  3923. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  3924. @example
  3925. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  3926. @end example
  3927. @item
  3928. Draw a white 3x3 grid with an opacity of 50%:
  3929. @example
  3930. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  3931. @end example
  3932. @end itemize
  3933. @anchor{drawtext}
  3934. @section drawtext
  3935. Draw a text string or text from a specified file on top of a video, using the
  3936. libfreetype library.
  3937. To enable compilation of this filter, you need to configure FFmpeg with
  3938. @code{--enable-libfreetype}.
  3939. To enable default font fallback and the @var{font} option you need to
  3940. configure FFmpeg with @code{--enable-libfontconfig}.
  3941. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  3942. @code{--enable-libfribidi}.
  3943. @subsection Syntax
  3944. It accepts the following parameters:
  3945. @table @option
  3946. @item box
  3947. Used to draw a box around text using the background color.
  3948. The value must be either 1 (enable) or 0 (disable).
  3949. The default value of @var{box} is 0.
  3950. @item boxborderw
  3951. Set the width of the border to be drawn around the box using @var{boxcolor}.
  3952. The default value of @var{boxborderw} is 0.
  3953. @item boxcolor
  3954. The color to be used for drawing box around text. For the syntax of this
  3955. option, check the "Color" section in the ffmpeg-utils manual.
  3956. The default value of @var{boxcolor} is "white".
  3957. @item borderw
  3958. Set the width of the border to be drawn around the text using @var{bordercolor}.
  3959. The default value of @var{borderw} is 0.
  3960. @item bordercolor
  3961. Set the color to be used for drawing border around text. For the syntax of this
  3962. option, check the "Color" section in the ffmpeg-utils manual.
  3963. The default value of @var{bordercolor} is "black".
  3964. @item expansion
  3965. Select how the @var{text} is expanded. Can be either @code{none},
  3966. @code{strftime} (deprecated) or
  3967. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  3968. below for details.
  3969. @item fix_bounds
  3970. If true, check and fix text coords to avoid clipping.
  3971. @item fontcolor
  3972. The color to be used for drawing fonts. For the syntax of this option, check
  3973. the "Color" section in the ffmpeg-utils manual.
  3974. The default value of @var{fontcolor} is "black".
  3975. @item fontcolor_expr
  3976. String which is expanded the same way as @var{text} to obtain dynamic
  3977. @var{fontcolor} value. By default this option has empty value and is not
  3978. processed. When this option is set, it overrides @var{fontcolor} option.
  3979. @item font
  3980. The font family to be used for drawing text. By default Sans.
  3981. @item fontfile
  3982. The font file to be used for drawing text. The path must be included.
  3983. This parameter is mandatory if the fontconfig support is disabled.
  3984. @item draw
  3985. This option does not exist, please see the timeline system
  3986. @item alpha
  3987. Draw the text applying alpha blending. The value can
  3988. be either a number between 0.0 and 1.0
  3989. The expression accepts the same variables @var{x, y} do.
  3990. The default value is 1.
  3991. Please see fontcolor_expr
  3992. @item fontsize
  3993. The font size to be used for drawing text.
  3994. The default value of @var{fontsize} is 16.
  3995. @item text_shaping
  3996. If set to 1, attempt to shape the text (for example, reverse the order of
  3997. right-to-left text and join Arabic characters) before drawing it.
  3998. Otherwise, just draw the text exactly as given.
  3999. By default 1 (if supported).
  4000. @item ft_load_flags
  4001. The flags to be used for loading the fonts.
  4002. The flags map the corresponding flags supported by libfreetype, and are
  4003. a combination of the following values:
  4004. @table @var
  4005. @item default
  4006. @item no_scale
  4007. @item no_hinting
  4008. @item render
  4009. @item no_bitmap
  4010. @item vertical_layout
  4011. @item force_autohint
  4012. @item crop_bitmap
  4013. @item pedantic
  4014. @item ignore_global_advance_width
  4015. @item no_recurse
  4016. @item ignore_transform
  4017. @item monochrome
  4018. @item linear_design
  4019. @item no_autohint
  4020. @end table
  4021. Default value is "default".
  4022. For more information consult the documentation for the FT_LOAD_*
  4023. libfreetype flags.
  4024. @item shadowcolor
  4025. The color to be used for drawing a shadow behind the drawn text. For the
  4026. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  4027. The default value of @var{shadowcolor} is "black".
  4028. @item shadowx
  4029. @item shadowy
  4030. The x and y offsets for the text shadow position with respect to the
  4031. position of the text. They can be either positive or negative
  4032. values. The default value for both is "0".
  4033. @item start_number
  4034. The starting frame number for the n/frame_num variable. The default value
  4035. is "0".
  4036. @item tabsize
  4037. The size in number of spaces to use for rendering the tab.
  4038. Default value is 4.
  4039. @item timecode
  4040. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  4041. format. It can be used with or without text parameter. @var{timecode_rate}
  4042. option must be specified.
  4043. @item timecode_rate, rate, r
  4044. Set the timecode frame rate (timecode only).
  4045. @item text
  4046. The text string to be drawn. The text must be a sequence of UTF-8
  4047. encoded characters.
  4048. This parameter is mandatory if no file is specified with the parameter
  4049. @var{textfile}.
  4050. @item textfile
  4051. A text file containing text to be drawn. The text must be a sequence
  4052. of UTF-8 encoded characters.
  4053. This parameter is mandatory if no text string is specified with the
  4054. parameter @var{text}.
  4055. If both @var{text} and @var{textfile} are specified, an error is thrown.
  4056. @item reload
  4057. If set to 1, the @var{textfile} will be reloaded before each frame.
  4058. Be sure to update it atomically, or it may be read partially, or even fail.
  4059. @item x
  4060. @item y
  4061. The expressions which specify the offsets where text will be drawn
  4062. within the video frame. They are relative to the top/left border of the
  4063. output image.
  4064. The default value of @var{x} and @var{y} is "0".
  4065. See below for the list of accepted constants and functions.
  4066. @end table
  4067. The parameters for @var{x} and @var{y} are expressions containing the
  4068. following constants and functions:
  4069. @table @option
  4070. @item dar
  4071. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  4072. @item hsub
  4073. @item vsub
  4074. horizontal and vertical chroma subsample values. For example for the
  4075. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4076. @item line_h, lh
  4077. the height of each text line
  4078. @item main_h, h, H
  4079. the input height
  4080. @item main_w, w, W
  4081. the input width
  4082. @item max_glyph_a, ascent
  4083. the maximum distance from the baseline to the highest/upper grid
  4084. coordinate used to place a glyph outline point, for all the rendered
  4085. glyphs.
  4086. It is a positive value, due to the grid's orientation with the Y axis
  4087. upwards.
  4088. @item max_glyph_d, descent
  4089. the maximum distance from the baseline to the lowest grid coordinate
  4090. used to place a glyph outline point, for all the rendered glyphs.
  4091. This is a negative value, due to the grid's orientation, with the Y axis
  4092. upwards.
  4093. @item max_glyph_h
  4094. maximum glyph height, that is the maximum height for all the glyphs
  4095. contained in the rendered text, it is equivalent to @var{ascent} -
  4096. @var{descent}.
  4097. @item max_glyph_w
  4098. maximum glyph width, that is the maximum width for all the glyphs
  4099. contained in the rendered text
  4100. @item n
  4101. the number of input frame, starting from 0
  4102. @item rand(min, max)
  4103. return a random number included between @var{min} and @var{max}
  4104. @item sar
  4105. The input sample aspect ratio.
  4106. @item t
  4107. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4108. @item text_h, th
  4109. the height of the rendered text
  4110. @item text_w, tw
  4111. the width of the rendered text
  4112. @item x
  4113. @item y
  4114. the x and y offset coordinates where the text is drawn.
  4115. These parameters allow the @var{x} and @var{y} expressions to refer
  4116. each other, so you can for example specify @code{y=x/dar}.
  4117. @end table
  4118. @anchor{drawtext_expansion}
  4119. @subsection Text expansion
  4120. If @option{expansion} is set to @code{strftime},
  4121. the filter recognizes strftime() sequences in the provided text and
  4122. expands them accordingly. Check the documentation of strftime(). This
  4123. feature is deprecated.
  4124. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  4125. If @option{expansion} is set to @code{normal} (which is the default),
  4126. the following expansion mechanism is used.
  4127. The backslash character @samp{\}, followed by any character, always expands to
  4128. the second character.
  4129. Sequence of the form @code{%@{...@}} are expanded. The text between the
  4130. braces is a function name, possibly followed by arguments separated by ':'.
  4131. If the arguments contain special characters or delimiters (':' or '@}'),
  4132. they should be escaped.
  4133. Note that they probably must also be escaped as the value for the
  4134. @option{text} option in the filter argument string and as the filter
  4135. argument in the filtergraph description, and possibly also for the shell,
  4136. that makes up to four levels of escaping; using a text file avoids these
  4137. problems.
  4138. The following functions are available:
  4139. @table @command
  4140. @item expr, e
  4141. The expression evaluation result.
  4142. It must take one argument specifying the expression to be evaluated,
  4143. which accepts the same constants and functions as the @var{x} and
  4144. @var{y} values. Note that not all constants should be used, for
  4145. example the text size is not known when evaluating the expression, so
  4146. the constants @var{text_w} and @var{text_h} will have an undefined
  4147. value.
  4148. @item expr_int_format, eif
  4149. Evaluate the expression's value and output as formatted integer.
  4150. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  4151. The second argument specifies the output format. Allowed values are @samp{x},
  4152. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  4153. @code{printf} function.
  4154. The third parameter is optional and sets the number of positions taken by the output.
  4155. It can be used to add padding with zeros from the left.
  4156. @item gmtime
  4157. The time at which the filter is running, expressed in UTC.
  4158. It can accept an argument: a strftime() format string.
  4159. @item localtime
  4160. The time at which the filter is running, expressed in the local time zone.
  4161. It can accept an argument: a strftime() format string.
  4162. @item metadata
  4163. Frame metadata. It must take one argument specifying metadata key.
  4164. @item n, frame_num
  4165. The frame number, starting from 0.
  4166. @item pict_type
  4167. A 1 character description of the current picture type.
  4168. @item pts
  4169. The timestamp of the current frame.
  4170. It can take up to three arguments.
  4171. The first argument is the format of the timestamp; it defaults to @code{flt}
  4172. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  4173. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  4174. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  4175. @code{localtime} stands for the timestamp of the frame formatted as
  4176. local time zone time.
  4177. The second argument is an offset added to the timestamp.
  4178. If the format is set to @code{localtime} or @code{gmtime},
  4179. a third argument may be supplied: a strftime() format string.
  4180. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  4181. @end table
  4182. @subsection Examples
  4183. @itemize
  4184. @item
  4185. Draw "Test Text" with font FreeSerif, using the default values for the
  4186. optional parameters.
  4187. @example
  4188. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  4189. @end example
  4190. @item
  4191. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  4192. and y=50 (counting from the top-left corner of the screen), text is
  4193. yellow with a red box around it. Both the text and the box have an
  4194. opacity of 20%.
  4195. @example
  4196. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  4197. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  4198. @end example
  4199. Note that the double quotes are not necessary if spaces are not used
  4200. within the parameter list.
  4201. @item
  4202. Show the text at the center of the video frame:
  4203. @example
  4204. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
  4205. @end example
  4206. @item
  4207. Show a text line sliding from right to left in the last row of the video
  4208. frame. The file @file{LONG_LINE} is assumed to contain a single line
  4209. with no newlines.
  4210. @example
  4211. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  4212. @end example
  4213. @item
  4214. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  4215. @example
  4216. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  4217. @end example
  4218. @item
  4219. Draw a single green letter "g", at the center of the input video.
  4220. The glyph baseline is placed at half screen height.
  4221. @example
  4222. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  4223. @end example
  4224. @item
  4225. Show text for 1 second every 3 seconds:
  4226. @example
  4227. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  4228. @end example
  4229. @item
  4230. Use fontconfig to set the font. Note that the colons need to be escaped.
  4231. @example
  4232. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  4233. @end example
  4234. @item
  4235. Print the date of a real-time encoding (see strftime(3)):
  4236. @example
  4237. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  4238. @end example
  4239. @item
  4240. Show text fading in and out (appearing/disappearing):
  4241. @example
  4242. #!/bin/sh
  4243. DS=1.0 # display start
  4244. DE=10.0 # display end
  4245. FID=1.5 # fade in duration
  4246. FOD=5 # fade out duration
  4247. 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 @}"
  4248. @end example
  4249. @end itemize
  4250. For more information about libfreetype, check:
  4251. @url{http://www.freetype.org/}.
  4252. For more information about fontconfig, check:
  4253. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  4254. For more information about libfribidi, check:
  4255. @url{http://fribidi.org/}.
  4256. @section edgedetect
  4257. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  4258. The filter accepts the following options:
  4259. @table @option
  4260. @item low
  4261. @item high
  4262. Set low and high threshold values used by the Canny thresholding
  4263. algorithm.
  4264. The high threshold selects the "strong" edge pixels, which are then
  4265. connected through 8-connectivity with the "weak" edge pixels selected
  4266. by the low threshold.
  4267. @var{low} and @var{high} threshold values must be chosen in the range
  4268. [0,1], and @var{low} should be lesser or equal to @var{high}.
  4269. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  4270. is @code{50/255}.
  4271. @item mode
  4272. Define the drawing mode.
  4273. @table @samp
  4274. @item wires
  4275. Draw white/gray wires on black background.
  4276. @item colormix
  4277. Mix the colors to create a paint/cartoon effect.
  4278. @end table
  4279. Default value is @var{wires}.
  4280. @end table
  4281. @subsection Examples
  4282. @itemize
  4283. @item
  4284. Standard edge detection with custom values for the hysteresis thresholding:
  4285. @example
  4286. edgedetect=low=0.1:high=0.4
  4287. @end example
  4288. @item
  4289. Painting effect without thresholding:
  4290. @example
  4291. edgedetect=mode=colormix:high=0
  4292. @end example
  4293. @end itemize
  4294. @section eq
  4295. Set brightness, contrast, saturation and approximate gamma adjustment.
  4296. The filter accepts the following options:
  4297. @table @option
  4298. @item contrast
  4299. Set the contrast expression. The value must be a float value in range
  4300. @code{-2.0} to @code{2.0}. The default value is "1".
  4301. @item brightness
  4302. Set the brightness expression. The value must be a float value in
  4303. range @code{-1.0} to @code{1.0}. The default value is "0".
  4304. @item saturation
  4305. Set the saturation expression. The value must be a float in
  4306. range @code{0.0} to @code{3.0}. The default value is "1".
  4307. @item gamma
  4308. Set the gamma expression. The value must be a float in range
  4309. @code{0.1} to @code{10.0}. The default value is "1".
  4310. @item gamma_r
  4311. Set the gamma expression for red. The value must be a float in
  4312. range @code{0.1} to @code{10.0}. The default value is "1".
  4313. @item gamma_g
  4314. Set the gamma expression for green. The value must be a float in range
  4315. @code{0.1} to @code{10.0}. The default value is "1".
  4316. @item gamma_b
  4317. Set the gamma expression for blue. The value must be a float in range
  4318. @code{0.1} to @code{10.0}. The default value is "1".
  4319. @item gamma_weight
  4320. Set the gamma weight expression. It can be used to reduce the effect
  4321. of a high gamma value on bright image areas, e.g. keep them from
  4322. getting overamplified and just plain white. The value must be a float
  4323. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  4324. gamma correction all the way down while @code{1.0} leaves it at its
  4325. full strength. Default is "1".
  4326. @item eval
  4327. Set when the expressions for brightness, contrast, saturation and
  4328. gamma expressions are evaluated.
  4329. It accepts the following values:
  4330. @table @samp
  4331. @item init
  4332. only evaluate expressions once during the filter initialization or
  4333. when a command is processed
  4334. @item frame
  4335. evaluate expressions for each incoming frame
  4336. @end table
  4337. Default value is @samp{init}.
  4338. @end table
  4339. The expressions accept the following parameters:
  4340. @table @option
  4341. @item n
  4342. frame count of the input frame starting from 0
  4343. @item pos
  4344. byte position of the corresponding packet in the input file, NAN if
  4345. unspecified
  4346. @item r
  4347. frame rate of the input video, NAN if the input frame rate is unknown
  4348. @item t
  4349. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4350. @end table
  4351. @subsection Commands
  4352. The filter supports the following commands:
  4353. @table @option
  4354. @item contrast
  4355. Set the contrast expression.
  4356. @item brightness
  4357. Set the brightness expression.
  4358. @item saturation
  4359. Set the saturation expression.
  4360. @item gamma
  4361. Set the gamma expression.
  4362. @item gamma_r
  4363. Set the gamma_r expression.
  4364. @item gamma_g
  4365. Set gamma_g expression.
  4366. @item gamma_b
  4367. Set gamma_b expression.
  4368. @item gamma_weight
  4369. Set gamma_weight expression.
  4370. The command accepts the same syntax of the corresponding option.
  4371. If the specified expression is not valid, it is kept at its current
  4372. value.
  4373. @end table
  4374. @section erosion
  4375. Apply erosion effect to the video.
  4376. This filter replaces the pixel by the local(3x3) minimum.
  4377. It accepts the following options:
  4378. @table @option
  4379. @item threshold0
  4380. @item threshold1
  4381. @item threshold2
  4382. @item threshold3
  4383. Limit the maximum change for each plane, default is 65535.
  4384. If 0, plane will remain unchanged.
  4385. @item coordinates
  4386. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4387. pixels are used.
  4388. Flags to local 3x3 coordinates maps like this:
  4389. 1 2 3
  4390. 4 5
  4391. 6 7 8
  4392. @end table
  4393. @section extractplanes
  4394. Extract color channel components from input video stream into
  4395. separate grayscale video streams.
  4396. The filter accepts the following option:
  4397. @table @option
  4398. @item planes
  4399. Set plane(s) to extract.
  4400. Available values for planes are:
  4401. @table @samp
  4402. @item y
  4403. @item u
  4404. @item v
  4405. @item a
  4406. @item r
  4407. @item g
  4408. @item b
  4409. @end table
  4410. Choosing planes not available in the input will result in an error.
  4411. That means you cannot select @code{r}, @code{g}, @code{b} planes
  4412. with @code{y}, @code{u}, @code{v} planes at same time.
  4413. @end table
  4414. @subsection Examples
  4415. @itemize
  4416. @item
  4417. Extract luma, u and v color channel component from input video frame
  4418. into 3 grayscale outputs:
  4419. @example
  4420. 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
  4421. @end example
  4422. @end itemize
  4423. @section elbg
  4424. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  4425. For each input image, the filter will compute the optimal mapping from
  4426. the input to the output given the codebook length, that is the number
  4427. of distinct output colors.
  4428. This filter accepts the following options.
  4429. @table @option
  4430. @item codebook_length, l
  4431. Set codebook length. The value must be a positive integer, and
  4432. represents the number of distinct output colors. Default value is 256.
  4433. @item nb_steps, n
  4434. Set the maximum number of iterations to apply for computing the optimal
  4435. mapping. The higher the value the better the result and the higher the
  4436. computation time. Default value is 1.
  4437. @item seed, s
  4438. Set a random seed, must be an integer included between 0 and
  4439. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  4440. will try to use a good random seed on a best effort basis.
  4441. @item pal8
  4442. Set pal8 output pixel format. This option does not work with codebook
  4443. length greater than 256.
  4444. @end table
  4445. @section fade
  4446. Apply a fade-in/out effect to the input video.
  4447. It accepts the following parameters:
  4448. @table @option
  4449. @item type, t
  4450. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  4451. effect.
  4452. Default is @code{in}.
  4453. @item start_frame, s
  4454. Specify the number of the frame to start applying the fade
  4455. effect at. Default is 0.
  4456. @item nb_frames, n
  4457. The number of frames that the fade effect lasts. At the end of the
  4458. fade-in effect, the output video will have the same intensity as the input video.
  4459. At the end of the fade-out transition, the output video will be filled with the
  4460. selected @option{color}.
  4461. Default is 25.
  4462. @item alpha
  4463. If set to 1, fade only alpha channel, if one exists on the input.
  4464. Default value is 0.
  4465. @item start_time, st
  4466. Specify the timestamp (in seconds) of the frame to start to apply the fade
  4467. effect. If both start_frame and start_time are specified, the fade will start at
  4468. whichever comes last. Default is 0.
  4469. @item duration, d
  4470. The number of seconds for which the fade effect has to last. At the end of the
  4471. fade-in effect the output video will have the same intensity as the input video,
  4472. at the end of the fade-out transition the output video will be filled with the
  4473. selected @option{color}.
  4474. If both duration and nb_frames are specified, duration is used. Default is 0
  4475. (nb_frames is used by default).
  4476. @item color, c
  4477. Specify the color of the fade. Default is "black".
  4478. @end table
  4479. @subsection Examples
  4480. @itemize
  4481. @item
  4482. Fade in the first 30 frames of video:
  4483. @example
  4484. fade=in:0:30
  4485. @end example
  4486. The command above is equivalent to:
  4487. @example
  4488. fade=t=in:s=0:n=30
  4489. @end example
  4490. @item
  4491. Fade out the last 45 frames of a 200-frame video:
  4492. @example
  4493. fade=out:155:45
  4494. fade=type=out:start_frame=155:nb_frames=45
  4495. @end example
  4496. @item
  4497. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  4498. @example
  4499. fade=in:0:25, fade=out:975:25
  4500. @end example
  4501. @item
  4502. Make the first 5 frames yellow, then fade in from frame 5-24:
  4503. @example
  4504. fade=in:5:20:color=yellow
  4505. @end example
  4506. @item
  4507. Fade in alpha over first 25 frames of video:
  4508. @example
  4509. fade=in:0:25:alpha=1
  4510. @end example
  4511. @item
  4512. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  4513. @example
  4514. fade=t=in:st=5.5:d=0.5
  4515. @end example
  4516. @end itemize
  4517. @section fftfilt
  4518. Apply arbitrary expressions to samples in frequency domain
  4519. @table @option
  4520. @item dc_Y
  4521. Adjust the dc value (gain) of the luma plane of the image. The filter
  4522. accepts an integer value in range @code{0} to @code{1000}. The default
  4523. value is set to @code{0}.
  4524. @item dc_U
  4525. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  4526. filter accepts an integer value in range @code{0} to @code{1000}. The
  4527. default value is set to @code{0}.
  4528. @item dc_V
  4529. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  4530. filter accepts an integer value in range @code{0} to @code{1000}. The
  4531. default value is set to @code{0}.
  4532. @item weight_Y
  4533. Set the frequency domain weight expression for the luma plane.
  4534. @item weight_U
  4535. Set the frequency domain weight expression for the 1st chroma plane.
  4536. @item weight_V
  4537. Set the frequency domain weight expression for the 2nd chroma plane.
  4538. The filter accepts the following variables:
  4539. @item X
  4540. @item Y
  4541. The coordinates of the current sample.
  4542. @item W
  4543. @item H
  4544. The width and height of the image.
  4545. @end table
  4546. @subsection Examples
  4547. @itemize
  4548. @item
  4549. High-pass:
  4550. @example
  4551. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  4552. @end example
  4553. @item
  4554. Low-pass:
  4555. @example
  4556. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  4557. @end example
  4558. @item
  4559. Sharpen:
  4560. @example
  4561. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  4562. @end example
  4563. @end itemize
  4564. @section field
  4565. Extract a single field from an interlaced image using stride
  4566. arithmetic to avoid wasting CPU time. The output frames are marked as
  4567. non-interlaced.
  4568. The filter accepts the following options:
  4569. @table @option
  4570. @item type
  4571. Specify whether to extract the top (if the value is @code{0} or
  4572. @code{top}) or the bottom field (if the value is @code{1} or
  4573. @code{bottom}).
  4574. @end table
  4575. @section fieldmatch
  4576. Field matching filter for inverse telecine. It is meant to reconstruct the
  4577. progressive frames from a telecined stream. The filter does not drop duplicated
  4578. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  4579. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  4580. The separation of the field matching and the decimation is notably motivated by
  4581. the possibility of inserting a de-interlacing filter fallback between the two.
  4582. If the source has mixed telecined and real interlaced content,
  4583. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  4584. But these remaining combed frames will be marked as interlaced, and thus can be
  4585. de-interlaced by a later filter such as @ref{yadif} before decimation.
  4586. In addition to the various configuration options, @code{fieldmatch} can take an
  4587. optional second stream, activated through the @option{ppsrc} option. If
  4588. enabled, the frames reconstruction will be based on the fields and frames from
  4589. this second stream. This allows the first input to be pre-processed in order to
  4590. help the various algorithms of the filter, while keeping the output lossless
  4591. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  4592. or brightness/contrast adjustments can help.
  4593. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  4594. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  4595. which @code{fieldmatch} is based on. While the semantic and usage are very
  4596. close, some behaviour and options names can differ.
  4597. The @ref{decimate} filter currently only works for constant frame rate input.
  4598. If your input has mixed telecined (30fps) and progressive content with a lower
  4599. framerate like 24fps use the following filterchain to produce the necessary cfr
  4600. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  4601. The filter accepts the following options:
  4602. @table @option
  4603. @item order
  4604. Specify the assumed field order of the input stream. Available values are:
  4605. @table @samp
  4606. @item auto
  4607. Auto detect parity (use FFmpeg's internal parity value).
  4608. @item bff
  4609. Assume bottom field first.
  4610. @item tff
  4611. Assume top field first.
  4612. @end table
  4613. Note that it is sometimes recommended not to trust the parity announced by the
  4614. stream.
  4615. Default value is @var{auto}.
  4616. @item mode
  4617. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  4618. sense that it won't risk creating jerkiness due to duplicate frames when
  4619. possible, but if there are bad edits or blended fields it will end up
  4620. outputting combed frames when a good match might actually exist. On the other
  4621. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  4622. but will almost always find a good frame if there is one. The other values are
  4623. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  4624. jerkiness and creating duplicate frames versus finding good matches in sections
  4625. with bad edits, orphaned fields, blended fields, etc.
  4626. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  4627. Available values are:
  4628. @table @samp
  4629. @item pc
  4630. 2-way matching (p/c)
  4631. @item pc_n
  4632. 2-way matching, and trying 3rd match if still combed (p/c + n)
  4633. @item pc_u
  4634. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  4635. @item pc_n_ub
  4636. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  4637. still combed (p/c + n + u/b)
  4638. @item pcn
  4639. 3-way matching (p/c/n)
  4640. @item pcn_ub
  4641. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  4642. detected as combed (p/c/n + u/b)
  4643. @end table
  4644. The parenthesis at the end indicate the matches that would be used for that
  4645. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  4646. @var{top}).
  4647. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  4648. the slowest.
  4649. Default value is @var{pc_n}.
  4650. @item ppsrc
  4651. Mark the main input stream as a pre-processed input, and enable the secondary
  4652. input stream as the clean source to pick the fields from. See the filter
  4653. introduction for more details. It is similar to the @option{clip2} feature from
  4654. VFM/TFM.
  4655. Default value is @code{0} (disabled).
  4656. @item field
  4657. Set the field to match from. It is recommended to set this to the same value as
  4658. @option{order} unless you experience matching failures with that setting. In
  4659. certain circumstances changing the field that is used to match from can have a
  4660. large impact on matching performance. Available values are:
  4661. @table @samp
  4662. @item auto
  4663. Automatic (same value as @option{order}).
  4664. @item bottom
  4665. Match from the bottom field.
  4666. @item top
  4667. Match from the top field.
  4668. @end table
  4669. Default value is @var{auto}.
  4670. @item mchroma
  4671. Set whether or not chroma is included during the match comparisons. In most
  4672. cases it is recommended to leave this enabled. You should set this to @code{0}
  4673. only if your clip has bad chroma problems such as heavy rainbowing or other
  4674. artifacts. Setting this to @code{0} could also be used to speed things up at
  4675. the cost of some accuracy.
  4676. Default value is @code{1}.
  4677. @item y0
  4678. @item y1
  4679. These define an exclusion band which excludes the lines between @option{y0} and
  4680. @option{y1} from being included in the field matching decision. An exclusion
  4681. band can be used to ignore subtitles, a logo, or other things that may
  4682. interfere with the matching. @option{y0} sets the starting scan line and
  4683. @option{y1} sets the ending line; all lines in between @option{y0} and
  4684. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  4685. @option{y0} and @option{y1} to the same value will disable the feature.
  4686. @option{y0} and @option{y1} defaults to @code{0}.
  4687. @item scthresh
  4688. Set the scene change detection threshold as a percentage of maximum change on
  4689. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  4690. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  4691. @option{scthresh} is @code{[0.0, 100.0]}.
  4692. Default value is @code{12.0}.
  4693. @item combmatch
  4694. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  4695. account the combed scores of matches when deciding what match to use as the
  4696. final match. Available values are:
  4697. @table @samp
  4698. @item none
  4699. No final matching based on combed scores.
  4700. @item sc
  4701. Combed scores are only used when a scene change is detected.
  4702. @item full
  4703. Use combed scores all the time.
  4704. @end table
  4705. Default is @var{sc}.
  4706. @item combdbg
  4707. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  4708. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  4709. Available values are:
  4710. @table @samp
  4711. @item none
  4712. No forced calculation.
  4713. @item pcn
  4714. Force p/c/n calculations.
  4715. @item pcnub
  4716. Force p/c/n/u/b calculations.
  4717. @end table
  4718. Default value is @var{none}.
  4719. @item cthresh
  4720. This is the area combing threshold used for combed frame detection. This
  4721. essentially controls how "strong" or "visible" combing must be to be detected.
  4722. Larger values mean combing must be more visible and smaller values mean combing
  4723. can be less visible or strong and still be detected. Valid settings are from
  4724. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  4725. be detected as combed). This is basically a pixel difference value. A good
  4726. range is @code{[8, 12]}.
  4727. Default value is @code{9}.
  4728. @item chroma
  4729. Sets whether or not chroma is considered in the combed frame decision. Only
  4730. disable this if your source has chroma problems (rainbowing, etc.) that are
  4731. causing problems for the combed frame detection with chroma enabled. Actually,
  4732. using @option{chroma}=@var{0} is usually more reliable, except for the case
  4733. where there is chroma only combing in the source.
  4734. Default value is @code{0}.
  4735. @item blockx
  4736. @item blocky
  4737. Respectively set the x-axis and y-axis size of the window used during combed
  4738. frame detection. This has to do with the size of the area in which
  4739. @option{combpel} pixels are required to be detected as combed for a frame to be
  4740. declared combed. See the @option{combpel} parameter description for more info.
  4741. Possible values are any number that is a power of 2 starting at 4 and going up
  4742. to 512.
  4743. Default value is @code{16}.
  4744. @item combpel
  4745. The number of combed pixels inside any of the @option{blocky} by
  4746. @option{blockx} size blocks on the frame for the frame to be detected as
  4747. combed. While @option{cthresh} controls how "visible" the combing must be, this
  4748. setting controls "how much" combing there must be in any localized area (a
  4749. window defined by the @option{blockx} and @option{blocky} settings) on the
  4750. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  4751. which point no frames will ever be detected as combed). This setting is known
  4752. as @option{MI} in TFM/VFM vocabulary.
  4753. Default value is @code{80}.
  4754. @end table
  4755. @anchor{p/c/n/u/b meaning}
  4756. @subsection p/c/n/u/b meaning
  4757. @subsubsection p/c/n
  4758. We assume the following telecined stream:
  4759. @example
  4760. Top fields: 1 2 2 3 4
  4761. Bottom fields: 1 2 3 4 4
  4762. @end example
  4763. The numbers correspond to the progressive frame the fields relate to. Here, the
  4764. first two frames are progressive, the 3rd and 4th are combed, and so on.
  4765. When @code{fieldmatch} is configured to run a matching from bottom
  4766. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  4767. @example
  4768. Input stream:
  4769. T 1 2 2 3 4
  4770. B 1 2 3 4 4 <-- matching reference
  4771. Matches: c c n n c
  4772. Output stream:
  4773. T 1 2 3 4 4
  4774. B 1 2 3 4 4
  4775. @end example
  4776. As a result of the field matching, we can see that some frames get duplicated.
  4777. To perform a complete inverse telecine, you need to rely on a decimation filter
  4778. after this operation. See for instance the @ref{decimate} filter.
  4779. The same operation now matching from top fields (@option{field}=@var{top})
  4780. looks like this:
  4781. @example
  4782. Input stream:
  4783. T 1 2 2 3 4 <-- matching reference
  4784. B 1 2 3 4 4
  4785. Matches: c c p p c
  4786. Output stream:
  4787. T 1 2 2 3 4
  4788. B 1 2 2 3 4
  4789. @end example
  4790. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  4791. basically, they refer to the frame and field of the opposite parity:
  4792. @itemize
  4793. @item @var{p} matches the field of the opposite parity in the previous frame
  4794. @item @var{c} matches the field of the opposite parity in the current frame
  4795. @item @var{n} matches the field of the opposite parity in the next frame
  4796. @end itemize
  4797. @subsubsection u/b
  4798. The @var{u} and @var{b} matching are a bit special in the sense that they match
  4799. from the opposite parity flag. In the following examples, we assume that we are
  4800. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  4801. 'x' is placed above and below each matched fields.
  4802. With bottom matching (@option{field}=@var{bottom}):
  4803. @example
  4804. Match: c p n b u
  4805. x x x x x
  4806. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  4807. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  4808. x x x x x
  4809. Output frames:
  4810. 2 1 2 2 2
  4811. 2 2 2 1 3
  4812. @end example
  4813. With top matching (@option{field}=@var{top}):
  4814. @example
  4815. Match: c p n b u
  4816. x x x x x
  4817. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  4818. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  4819. x x x x x
  4820. Output frames:
  4821. 2 2 2 1 2
  4822. 2 1 3 2 2
  4823. @end example
  4824. @subsection Examples
  4825. Simple IVTC of a top field first telecined stream:
  4826. @example
  4827. fieldmatch=order=tff:combmatch=none, decimate
  4828. @end example
  4829. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  4830. @example
  4831. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  4832. @end example
  4833. @section fieldorder
  4834. Transform the field order of the input video.
  4835. It accepts the following parameters:
  4836. @table @option
  4837. @item order
  4838. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  4839. for bottom field first.
  4840. @end table
  4841. The default value is @samp{tff}.
  4842. The transformation is done by shifting the picture content up or down
  4843. by one line, and filling the remaining line with appropriate picture content.
  4844. This method is consistent with most broadcast field order converters.
  4845. If the input video is not flagged as being interlaced, or it is already
  4846. flagged as being of the required output field order, then this filter does
  4847. not alter the incoming video.
  4848. It is very useful when converting to or from PAL DV material,
  4849. which is bottom field first.
  4850. For example:
  4851. @example
  4852. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  4853. @end example
  4854. @section fifo
  4855. Buffer input images and send them when they are requested.
  4856. It is mainly useful when auto-inserted by the libavfilter
  4857. framework.
  4858. It does not take parameters.
  4859. @section find_rect
  4860. Find a rectangular object
  4861. It accepts the following options:
  4862. @table @option
  4863. @item object
  4864. Filepath of the object image, needs to be in gray8.
  4865. @item threshold
  4866. Detection threshold, default is 0.5.
  4867. @item mipmaps
  4868. Number of mipmaps, default is 3.
  4869. @item xmin, ymin, xmax, ymax
  4870. Specifies the rectangle in which to search.
  4871. @end table
  4872. @subsection Examples
  4873. @itemize
  4874. @item
  4875. Generate a representative palette of a given video using @command{ffmpeg}:
  4876. @example
  4877. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  4878. @end example
  4879. @end itemize
  4880. @section cover_rect
  4881. Cover a rectangular object
  4882. It accepts the following options:
  4883. @table @option
  4884. @item cover
  4885. Filepath of the optional cover image, needs to be in yuv420.
  4886. @item mode
  4887. Set covering mode.
  4888. It accepts the following values:
  4889. @table @samp
  4890. @item cover
  4891. cover it by the supplied image
  4892. @item blur
  4893. cover it by interpolating the surrounding pixels
  4894. @end table
  4895. Default value is @var{blur}.
  4896. @end table
  4897. @subsection Examples
  4898. @itemize
  4899. @item
  4900. Generate a representative palette of a given video using @command{ffmpeg}:
  4901. @example
  4902. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  4903. @end example
  4904. @end itemize
  4905. @anchor{format}
  4906. @section format
  4907. Convert the input video to one of the specified pixel formats.
  4908. Libavfilter will try to pick one that is suitable as input to
  4909. the next filter.
  4910. It accepts the following parameters:
  4911. @table @option
  4912. @item pix_fmts
  4913. A '|'-separated list of pixel format names, such as
  4914. "pix_fmts=yuv420p|monow|rgb24".
  4915. @end table
  4916. @subsection Examples
  4917. @itemize
  4918. @item
  4919. Convert the input video to the @var{yuv420p} format
  4920. @example
  4921. format=pix_fmts=yuv420p
  4922. @end example
  4923. Convert the input video to any of the formats in the list
  4924. @example
  4925. format=pix_fmts=yuv420p|yuv444p|yuv410p
  4926. @end example
  4927. @end itemize
  4928. @anchor{fps}
  4929. @section fps
  4930. Convert the video to specified constant frame rate by duplicating or dropping
  4931. frames as necessary.
  4932. It accepts the following parameters:
  4933. @table @option
  4934. @item fps
  4935. The desired output frame rate. The default is @code{25}.
  4936. @item round
  4937. Rounding method.
  4938. Possible values are:
  4939. @table @option
  4940. @item zero
  4941. zero round towards 0
  4942. @item inf
  4943. round away from 0
  4944. @item down
  4945. round towards -infinity
  4946. @item up
  4947. round towards +infinity
  4948. @item near
  4949. round to nearest
  4950. @end table
  4951. The default is @code{near}.
  4952. @item start_time
  4953. Assume the first PTS should be the given value, in seconds. This allows for
  4954. padding/trimming at the start of stream. By default, no assumption is made
  4955. about the first frame's expected PTS, so no padding or trimming is done.
  4956. For example, this could be set to 0 to pad the beginning with duplicates of
  4957. the first frame if a video stream starts after the audio stream or to trim any
  4958. frames with a negative PTS.
  4959. @end table
  4960. Alternatively, the options can be specified as a flat string:
  4961. @var{fps}[:@var{round}].
  4962. See also the @ref{setpts} filter.
  4963. @subsection Examples
  4964. @itemize
  4965. @item
  4966. A typical usage in order to set the fps to 25:
  4967. @example
  4968. fps=fps=25
  4969. @end example
  4970. @item
  4971. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  4972. @example
  4973. fps=fps=film:round=near
  4974. @end example
  4975. @end itemize
  4976. @section framepack
  4977. Pack two different video streams into a stereoscopic video, setting proper
  4978. metadata on supported codecs. The two views should have the same size and
  4979. framerate and processing will stop when the shorter video ends. Please note
  4980. that you may conveniently adjust view properties with the @ref{scale} and
  4981. @ref{fps} filters.
  4982. It accepts the following parameters:
  4983. @table @option
  4984. @item format
  4985. The desired packing format. Supported values are:
  4986. @table @option
  4987. @item sbs
  4988. The views are next to each other (default).
  4989. @item tab
  4990. The views are on top of each other.
  4991. @item lines
  4992. The views are packed by line.
  4993. @item columns
  4994. The views are packed by column.
  4995. @item frameseq
  4996. The views are temporally interleaved.
  4997. @end table
  4998. @end table
  4999. Some examples:
  5000. @example
  5001. # Convert left and right views into a frame-sequential video
  5002. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  5003. # Convert views into a side-by-side video with the same output resolution as the input
  5004. 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
  5005. @end example
  5006. @section framerate
  5007. Change the frame rate by interpolating new video output frames from the source
  5008. frames.
  5009. This filter is not designed to function correctly with interlaced media. If
  5010. you wish to change the frame rate of interlaced media then you are required
  5011. to deinterlace before this filter and re-interlace after this filter.
  5012. A description of the accepted options follows.
  5013. @table @option
  5014. @item fps
  5015. Specify the output frames per second. This option can also be specified
  5016. as a value alone. The default is @code{50}.
  5017. @item interp_start
  5018. Specify the start of a range where the output frame will be created as a
  5019. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5020. the default is @code{15}.
  5021. @item interp_end
  5022. Specify the end of a range where the output frame will be created as a
  5023. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5024. the default is @code{240}.
  5025. @item scene
  5026. Specify the level at which a scene change is detected as a value between
  5027. 0 and 100 to indicate a new scene; a low value reflects a low
  5028. probability for the current frame to introduce a new scene, while a higher
  5029. value means the current frame is more likely to be one.
  5030. The default is @code{7}.
  5031. @item flags
  5032. Specify flags influencing the filter process.
  5033. Available value for @var{flags} is:
  5034. @table @option
  5035. @item scene_change_detect, scd
  5036. Enable scene change detection using the value of the option @var{scene}.
  5037. This flag is enabled by default.
  5038. @end table
  5039. @end table
  5040. @section framestep
  5041. Select one frame every N-th frame.
  5042. This filter accepts the following option:
  5043. @table @option
  5044. @item step
  5045. Select frame after every @code{step} frames.
  5046. Allowed values are positive integers higher than 0. Default value is @code{1}.
  5047. @end table
  5048. @anchor{frei0r}
  5049. @section frei0r
  5050. Apply a frei0r effect to the input video.
  5051. To enable the compilation of this filter, you need to install the frei0r
  5052. header and configure FFmpeg with @code{--enable-frei0r}.
  5053. It accepts the following parameters:
  5054. @table @option
  5055. @item filter_name
  5056. The name of the frei0r effect to load. If the environment variable
  5057. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  5058. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  5059. Otherwise, the standard frei0r paths are searched, in this order:
  5060. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  5061. @file{/usr/lib/frei0r-1/}.
  5062. @item filter_params
  5063. A '|'-separated list of parameters to pass to the frei0r effect.
  5064. @end table
  5065. A frei0r effect parameter can be a boolean (its value is either
  5066. "y" or "n"), a double, a color (specified as
  5067. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  5068. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  5069. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  5070. @var{X} and @var{Y} are floating point numbers) and/or a string.
  5071. The number and types of parameters depend on the loaded effect. If an
  5072. effect parameter is not specified, the default value is set.
  5073. @subsection Examples
  5074. @itemize
  5075. @item
  5076. Apply the distort0r effect, setting the first two double parameters:
  5077. @example
  5078. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  5079. @end example
  5080. @item
  5081. Apply the colordistance effect, taking a color as the first parameter:
  5082. @example
  5083. frei0r=colordistance:0.2/0.3/0.4
  5084. frei0r=colordistance:violet
  5085. frei0r=colordistance:0x112233
  5086. @end example
  5087. @item
  5088. Apply the perspective effect, specifying the top left and top right image
  5089. positions:
  5090. @example
  5091. frei0r=perspective:0.2/0.2|0.8/0.2
  5092. @end example
  5093. @end itemize
  5094. For more information, see
  5095. @url{http://frei0r.dyne.org}
  5096. @section fspp
  5097. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  5098. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  5099. processing filter, one of them is performed once per block, not per pixel.
  5100. This allows for much higher speed.
  5101. The filter accepts the following options:
  5102. @table @option
  5103. @item quality
  5104. Set quality. This option defines the number of levels for averaging. It accepts
  5105. an integer in the range 4-5. Default value is @code{4}.
  5106. @item qp
  5107. Force a constant quantization parameter. It accepts an integer in range 0-63.
  5108. If not set, the filter will use the QP from the video stream (if available).
  5109. @item strength
  5110. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  5111. more details but also more artifacts, while higher values make the image smoother
  5112. but also blurrier. Default value is @code{0} − PSNR optimal.
  5113. @item use_bframe_qp
  5114. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5115. option may cause flicker since the B-Frames have often larger QP. Default is
  5116. @code{0} (not enabled).
  5117. @end table
  5118. @section geq
  5119. The filter accepts the following options:
  5120. @table @option
  5121. @item lum_expr, lum
  5122. Set the luminance expression.
  5123. @item cb_expr, cb
  5124. Set the chrominance blue expression.
  5125. @item cr_expr, cr
  5126. Set the chrominance red expression.
  5127. @item alpha_expr, a
  5128. Set the alpha expression.
  5129. @item red_expr, r
  5130. Set the red expression.
  5131. @item green_expr, g
  5132. Set the green expression.
  5133. @item blue_expr, b
  5134. Set the blue expression.
  5135. @end table
  5136. The colorspace is selected according to the specified options. If one
  5137. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  5138. options is specified, the filter will automatically select a YCbCr
  5139. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  5140. @option{blue_expr} options is specified, it will select an RGB
  5141. colorspace.
  5142. If one of the chrominance expression is not defined, it falls back on the other
  5143. one. If no alpha expression is specified it will evaluate to opaque value.
  5144. If none of chrominance expressions are specified, they will evaluate
  5145. to the luminance expression.
  5146. The expressions can use the following variables and functions:
  5147. @table @option
  5148. @item N
  5149. The sequential number of the filtered frame, starting from @code{0}.
  5150. @item X
  5151. @item Y
  5152. The coordinates of the current sample.
  5153. @item W
  5154. @item H
  5155. The width and height of the image.
  5156. @item SW
  5157. @item SH
  5158. Width and height scale depending on the currently filtered plane. It is the
  5159. ratio between the corresponding luma plane number of pixels and the current
  5160. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  5161. @code{0.5,0.5} for chroma planes.
  5162. @item T
  5163. Time of the current frame, expressed in seconds.
  5164. @item p(x, y)
  5165. Return the value of the pixel at location (@var{x},@var{y}) of the current
  5166. plane.
  5167. @item lum(x, y)
  5168. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  5169. plane.
  5170. @item cb(x, y)
  5171. Return the value of the pixel at location (@var{x},@var{y}) of the
  5172. blue-difference chroma plane. Return 0 if there is no such plane.
  5173. @item cr(x, y)
  5174. Return the value of the pixel at location (@var{x},@var{y}) of the
  5175. red-difference chroma plane. Return 0 if there is no such plane.
  5176. @item r(x, y)
  5177. @item g(x, y)
  5178. @item b(x, y)
  5179. Return the value of the pixel at location (@var{x},@var{y}) of the
  5180. red/green/blue component. Return 0 if there is no such component.
  5181. @item alpha(x, y)
  5182. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  5183. plane. Return 0 if there is no such plane.
  5184. @end table
  5185. For functions, if @var{x} and @var{y} are outside the area, the value will be
  5186. automatically clipped to the closer edge.
  5187. @subsection Examples
  5188. @itemize
  5189. @item
  5190. Flip the image horizontally:
  5191. @example
  5192. geq=p(W-X\,Y)
  5193. @end example
  5194. @item
  5195. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  5196. wavelength of 100 pixels:
  5197. @example
  5198. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  5199. @end example
  5200. @item
  5201. Generate a fancy enigmatic moving light:
  5202. @example
  5203. 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
  5204. @end example
  5205. @item
  5206. Generate a quick emboss effect:
  5207. @example
  5208. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  5209. @end example
  5210. @item
  5211. Modify RGB components depending on pixel position:
  5212. @example
  5213. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  5214. @end example
  5215. @item
  5216. Create a radial gradient that is the same size as the input (also see
  5217. the @ref{vignette} filter):
  5218. @example
  5219. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  5220. @end example
  5221. @item
  5222. Create a linear gradient to use as a mask for another filter, then
  5223. compose with @ref{overlay}. In this example the video will gradually
  5224. become more blurry from the top to the bottom of the y-axis as defined
  5225. by the linear gradient:
  5226. @example
  5227. ffmpeg -i input.mp4 -filter_complex "geq=lum=255*(Y/H),format=gray[grad];[0:v]boxblur=4[blur];[blur][grad]alphamerge[alpha];[0:v][alpha]overlay" output.mp4
  5228. @end example
  5229. @end itemize
  5230. @section gradfun
  5231. Fix the banding artifacts that are sometimes introduced into nearly flat
  5232. regions by truncation to 8bit color depth.
  5233. Interpolate the gradients that should go where the bands are, and
  5234. dither them.
  5235. It is designed for playback only. Do not use it prior to
  5236. lossy compression, because compression tends to lose the dither and
  5237. bring back the bands.
  5238. It accepts the following parameters:
  5239. @table @option
  5240. @item strength
  5241. The maximum amount by which the filter will change any one pixel. This is also
  5242. the threshold for detecting nearly flat regions. Acceptable values range from
  5243. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  5244. valid range.
  5245. @item radius
  5246. The neighborhood to fit the gradient to. A larger radius makes for smoother
  5247. gradients, but also prevents the filter from modifying the pixels near detailed
  5248. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  5249. values will be clipped to the valid range.
  5250. @end table
  5251. Alternatively, the options can be specified as a flat string:
  5252. @var{strength}[:@var{radius}]
  5253. @subsection Examples
  5254. @itemize
  5255. @item
  5256. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  5257. @example
  5258. gradfun=3.5:8
  5259. @end example
  5260. @item
  5261. Specify radius, omitting the strength (which will fall-back to the default
  5262. value):
  5263. @example
  5264. gradfun=radius=8
  5265. @end example
  5266. @end itemize
  5267. @anchor{haldclut}
  5268. @section haldclut
  5269. Apply a Hald CLUT to a video stream.
  5270. First input is the video stream to process, and second one is the Hald CLUT.
  5271. The Hald CLUT input can be a simple picture or a complete video stream.
  5272. The filter accepts the following options:
  5273. @table @option
  5274. @item shortest
  5275. Force termination when the shortest input terminates. Default is @code{0}.
  5276. @item repeatlast
  5277. Continue applying the last CLUT after the end of the stream. A value of
  5278. @code{0} disable the filter after the last frame of the CLUT is reached.
  5279. Default is @code{1}.
  5280. @end table
  5281. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  5282. filters share the same internals).
  5283. More information about the Hald CLUT can be found on Eskil Steenberg's website
  5284. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  5285. @subsection Workflow examples
  5286. @subsubsection Hald CLUT video stream
  5287. Generate an identity Hald CLUT stream altered with various effects:
  5288. @example
  5289. 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
  5290. @end example
  5291. Note: make sure you use a lossless codec.
  5292. Then use it with @code{haldclut} to apply it on some random stream:
  5293. @example
  5294. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  5295. @end example
  5296. The Hald CLUT will be applied to the 10 first seconds (duration of
  5297. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  5298. to the remaining frames of the @code{mandelbrot} stream.
  5299. @subsubsection Hald CLUT with preview
  5300. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  5301. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  5302. biggest possible square starting at the top left of the picture. The remaining
  5303. padding pixels (bottom or right) will be ignored. This area can be used to add
  5304. a preview of the Hald CLUT.
  5305. Typically, the following generated Hald CLUT will be supported by the
  5306. @code{haldclut} filter:
  5307. @example
  5308. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  5309. pad=iw+320 [padded_clut];
  5310. smptebars=s=320x256, split [a][b];
  5311. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  5312. [main][b] overlay=W-320" -frames:v 1 clut.png
  5313. @end example
  5314. It contains the original and a preview of the effect of the CLUT: SMPTE color
  5315. bars are displayed on the right-top, and below the same color bars processed by
  5316. the color changes.
  5317. Then, the effect of this Hald CLUT can be visualized with:
  5318. @example
  5319. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  5320. @end example
  5321. @section hflip
  5322. Flip the input video horizontally.
  5323. For example, to horizontally flip the input video with @command{ffmpeg}:
  5324. @example
  5325. ffmpeg -i in.avi -vf "hflip" out.avi
  5326. @end example
  5327. @section histeq
  5328. This filter applies a global color histogram equalization on a
  5329. per-frame basis.
  5330. It can be used to correct video that has a compressed range of pixel
  5331. intensities. The filter redistributes the pixel intensities to
  5332. equalize their distribution across the intensity range. It may be
  5333. viewed as an "automatically adjusting contrast filter". This filter is
  5334. useful only for correcting degraded or poorly captured source
  5335. video.
  5336. The filter accepts the following options:
  5337. @table @option
  5338. @item strength
  5339. Determine the amount of equalization to be applied. As the strength
  5340. is reduced, the distribution of pixel intensities more-and-more
  5341. approaches that of the input frame. The value must be a float number
  5342. in the range [0,1] and defaults to 0.200.
  5343. @item intensity
  5344. Set the maximum intensity that can generated and scale the output
  5345. values appropriately. The strength should be set as desired and then
  5346. the intensity can be limited if needed to avoid washing-out. The value
  5347. must be a float number in the range [0,1] and defaults to 0.210.
  5348. @item antibanding
  5349. Set the antibanding level. If enabled the filter will randomly vary
  5350. the luminance of output pixels by a small amount to avoid banding of
  5351. the histogram. Possible values are @code{none}, @code{weak} or
  5352. @code{strong}. It defaults to @code{none}.
  5353. @end table
  5354. @section histogram
  5355. Compute and draw a color distribution histogram for the input video.
  5356. The computed histogram is a representation of the color component
  5357. distribution in an image.
  5358. The filter accepts the following options:
  5359. @table @option
  5360. @item mode
  5361. Set histogram mode.
  5362. It accepts the following values:
  5363. @table @samp
  5364. @item levels
  5365. Standard histogram that displays the color components distribution in an
  5366. image. Displays color graph for each color component. Shows distribution of
  5367. the Y, U, V, A or R, G, B components, depending on input format, in the
  5368. current frame. Below each graph a color component scale meter is shown.
  5369. @item color
  5370. Displays chroma values (U/V color placement) in a two dimensional
  5371. graph (which is called a vectorscope). The brighter a pixel in the
  5372. vectorscope, the more pixels of the input frame correspond to that pixel
  5373. (i.e., more pixels have this chroma value). The V component is displayed on
  5374. the horizontal (X) axis, with the leftmost side being V = 0 and the rightmost
  5375. side being V = 255. The U component is displayed on the vertical (Y) axis,
  5376. with the top representing U = 0 and the bottom representing U = 255.
  5377. The position of a white pixel in the graph corresponds to the chroma value of
  5378. a pixel of the input clip. The graph can therefore be used to read the hue
  5379. (color flavor) and the saturation (the dominance of the hue in the color). As
  5380. the hue of a color changes, it moves around the square. At the center of the
  5381. square the saturation is zero, which means that the corresponding pixel has no
  5382. color. If the amount of a specific color is increased (while leaving the other
  5383. colors unchanged) the saturation increases, and the indicator moves towards
  5384. the edge of the square.
  5385. @item color2
  5386. Chroma values in vectorscope, similar as @code{color} but actual chroma values
  5387. are displayed.
  5388. @item waveform
  5389. Per row/column color component graph. In row mode, the graph on the left side
  5390. represents color component value 0 and the right side represents value = 255.
  5391. In column mode, the top side represents color component value = 0 and bottom
  5392. side represents value = 255.
  5393. @end table
  5394. Default value is @code{levels}.
  5395. @item level_height
  5396. Set height of level in @code{levels}. Default value is @code{200}.
  5397. Allowed range is [50, 2048].
  5398. @item scale_height
  5399. Set height of color scale in @code{levels}. Default value is @code{12}.
  5400. Allowed range is [0, 40].
  5401. @item step
  5402. Set step for @code{waveform} mode. Smaller values are useful to find out how
  5403. many values of the same luminance are distributed across input rows/columns.
  5404. Default value is @code{10}. Allowed range is [1, 255].
  5405. @item waveform_mode
  5406. Set mode for @code{waveform}. Can be either @code{row}, or @code{column}.
  5407. Default is @code{row}.
  5408. @item waveform_mirror
  5409. Set mirroring mode for @code{waveform}. @code{0} means unmirrored, @code{1}
  5410. means mirrored. In mirrored mode, higher values will be represented on the left
  5411. side for @code{row} mode and at the top for @code{column} mode. Default is
  5412. @code{0} (unmirrored).
  5413. @item display_mode
  5414. Set display mode for @code{waveform} and @code{levels}.
  5415. It accepts the following values:
  5416. @table @samp
  5417. @item parade
  5418. Display separate graph for the color components side by side in
  5419. @code{row} waveform mode or one below the other in @code{column} waveform mode
  5420. for @code{waveform} histogram mode. For @code{levels} histogram mode,
  5421. per color component graphs are placed below each other.
  5422. Using this display mode in @code{waveform} histogram mode makes it easy to
  5423. spot color casts in the highlights and shadows of an image, by comparing the
  5424. contours of the top and the bottom graphs of each waveform. Since whites,
  5425. grays, and blacks are characterized by exactly equal amounts of red, green,
  5426. and blue, neutral areas of the picture should display three waveforms of
  5427. roughly equal width/height. If not, the correction is easy to perform by
  5428. making level adjustments the three waveforms.
  5429. @item overlay
  5430. Presents information identical to that in the @code{parade}, except
  5431. that the graphs representing color components are superimposed directly
  5432. over one another.
  5433. This display mode in @code{waveform} histogram mode makes it easier to spot
  5434. relative differences or similarities in overlapping areas of the color
  5435. components that are supposed to be identical, such as neutral whites, grays,
  5436. or blacks.
  5437. @end table
  5438. Default is @code{parade}.
  5439. @item levels_mode
  5440. Set mode for @code{levels}. Can be either @code{linear}, or @code{logarithmic}.
  5441. Default is @code{linear}.
  5442. @item components
  5443. Set what color components to display for mode @code{levels}.
  5444. Default is @code{7}.
  5445. @end table
  5446. @subsection Examples
  5447. @itemize
  5448. @item
  5449. Calculate and draw histogram:
  5450. @example
  5451. ffplay -i input -vf histogram
  5452. @end example
  5453. @end itemize
  5454. @anchor{hqdn3d}
  5455. @section hqdn3d
  5456. This is a high precision/quality 3d denoise filter. It aims to reduce
  5457. image noise, producing smooth images and making still images really
  5458. still. It should enhance compressibility.
  5459. It accepts the following optional parameters:
  5460. @table @option
  5461. @item luma_spatial
  5462. A non-negative floating point number which specifies spatial luma strength.
  5463. It defaults to 4.0.
  5464. @item chroma_spatial
  5465. A non-negative floating point number which specifies spatial chroma strength.
  5466. It defaults to 3.0*@var{luma_spatial}/4.0.
  5467. @item luma_tmp
  5468. A floating point number which specifies luma temporal strength. It defaults to
  5469. 6.0*@var{luma_spatial}/4.0.
  5470. @item chroma_tmp
  5471. A floating point number which specifies chroma temporal strength. It defaults to
  5472. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  5473. @end table
  5474. @section hqx
  5475. Apply a high-quality magnification filter designed for pixel art. This filter
  5476. was originally created by Maxim Stepin.
  5477. It accepts the following option:
  5478. @table @option
  5479. @item n
  5480. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  5481. @code{hq3x} and @code{4} for @code{hq4x}.
  5482. Default is @code{3}.
  5483. @end table
  5484. @section hstack
  5485. Stack input videos horizontally.
  5486. All streams must be of same pixel format and of same height.
  5487. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  5488. to create same output.
  5489. The filter accept the following option:
  5490. @table @option
  5491. @item inputs
  5492. Set number of input streams. Default is 2.
  5493. @end table
  5494. @section hue
  5495. Modify the hue and/or the saturation of the input.
  5496. It accepts the following parameters:
  5497. @table @option
  5498. @item h
  5499. Specify the hue angle as a number of degrees. It accepts an expression,
  5500. and defaults to "0".
  5501. @item s
  5502. Specify the saturation in the [-10,10] range. It accepts an expression and
  5503. defaults to "1".
  5504. @item H
  5505. Specify the hue angle as a number of radians. It accepts an
  5506. expression, and defaults to "0".
  5507. @item b
  5508. Specify the brightness in the [-10,10] range. It accepts an expression and
  5509. defaults to "0".
  5510. @end table
  5511. @option{h} and @option{H} are mutually exclusive, and can't be
  5512. specified at the same time.
  5513. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  5514. expressions containing the following constants:
  5515. @table @option
  5516. @item n
  5517. frame count of the input frame starting from 0
  5518. @item pts
  5519. presentation timestamp of the input frame expressed in time base units
  5520. @item r
  5521. frame rate of the input video, NAN if the input frame rate is unknown
  5522. @item t
  5523. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5524. @item tb
  5525. time base of the input video
  5526. @end table
  5527. @subsection Examples
  5528. @itemize
  5529. @item
  5530. Set the hue to 90 degrees and the saturation to 1.0:
  5531. @example
  5532. hue=h=90:s=1
  5533. @end example
  5534. @item
  5535. Same command but expressing the hue in radians:
  5536. @example
  5537. hue=H=PI/2:s=1
  5538. @end example
  5539. @item
  5540. Rotate hue and make the saturation swing between 0
  5541. and 2 over a period of 1 second:
  5542. @example
  5543. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  5544. @end example
  5545. @item
  5546. Apply a 3 seconds saturation fade-in effect starting at 0:
  5547. @example
  5548. hue="s=min(t/3\,1)"
  5549. @end example
  5550. The general fade-in expression can be written as:
  5551. @example
  5552. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  5553. @end example
  5554. @item
  5555. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  5556. @example
  5557. hue="s=max(0\, min(1\, (8-t)/3))"
  5558. @end example
  5559. The general fade-out expression can be written as:
  5560. @example
  5561. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  5562. @end example
  5563. @end itemize
  5564. @subsection Commands
  5565. This filter supports the following commands:
  5566. @table @option
  5567. @item b
  5568. @item s
  5569. @item h
  5570. @item H
  5571. Modify the hue and/or the saturation and/or brightness of the input video.
  5572. The command accepts the same syntax of the corresponding option.
  5573. If the specified expression is not valid, it is kept at its current
  5574. value.
  5575. @end table
  5576. @section idet
  5577. Detect video interlacing type.
  5578. This filter tries to detect if the input frames as interlaced, progressive,
  5579. top or bottom field first. It will also try and detect fields that are
  5580. repeated between adjacent frames (a sign of telecine).
  5581. Single frame detection considers only immediately adjacent frames when classifying each frame.
  5582. Multiple frame detection incorporates the classification history of previous frames.
  5583. The filter will log these metadata values:
  5584. @table @option
  5585. @item single.current_frame
  5586. Detected type of current frame using single-frame detection. One of:
  5587. ``tff'' (top field first), ``bff'' (bottom field first),
  5588. ``progressive'', or ``undetermined''
  5589. @item single.tff
  5590. Cumulative number of frames detected as top field first using single-frame detection.
  5591. @item multiple.tff
  5592. Cumulative number of frames detected as top field first using multiple-frame detection.
  5593. @item single.bff
  5594. Cumulative number of frames detected as bottom field first using single-frame detection.
  5595. @item multiple.current_frame
  5596. Detected type of current frame using multiple-frame detection. One of:
  5597. ``tff'' (top field first), ``bff'' (bottom field first),
  5598. ``progressive'', or ``undetermined''
  5599. @item multiple.bff
  5600. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  5601. @item single.progressive
  5602. Cumulative number of frames detected as progressive using single-frame detection.
  5603. @item multiple.progressive
  5604. Cumulative number of frames detected as progressive using multiple-frame detection.
  5605. @item single.undetermined
  5606. Cumulative number of frames that could not be classified using single-frame detection.
  5607. @item multiple.undetermined
  5608. Cumulative number of frames that could not be classified using multiple-frame detection.
  5609. @item repeated.current_frame
  5610. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  5611. @item repeated.neither
  5612. Cumulative number of frames with no repeated field.
  5613. @item repeated.top
  5614. Cumulative number of frames with the top field repeated from the previous frame's top field.
  5615. @item repeated.bottom
  5616. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  5617. @end table
  5618. The filter accepts the following options:
  5619. @table @option
  5620. @item intl_thres
  5621. Set interlacing threshold.
  5622. @item prog_thres
  5623. Set progressive threshold.
  5624. @item repeat_thres
  5625. Threshold for repeated field detection.
  5626. @item half_life
  5627. Number of frames after which a given frame's contribution to the
  5628. statistics is halved (i.e., it contributes only 0.5 to it's
  5629. classification). The default of 0 means that all frames seen are given
  5630. full weight of 1.0 forever.
  5631. @item analyze_interlaced_flag
  5632. When this is not 0 then idet will use the specified number of frames to determine
  5633. if the interlaced flag is accurate, it will not count undetermined frames.
  5634. If the flag is found to be accurate it will be used without any further
  5635. computations, if it is found to be inaccurate it will be cleared without any
  5636. further computations. This allows inserting the idet filter as a low computational
  5637. method to clean up the interlaced flag
  5638. @end table
  5639. @section il
  5640. Deinterleave or interleave fields.
  5641. This filter allows one to process interlaced images fields without
  5642. deinterlacing them. Deinterleaving splits the input frame into 2
  5643. fields (so called half pictures). Odd lines are moved to the top
  5644. half of the output image, even lines to the bottom half.
  5645. You can process (filter) them independently and then re-interleave them.
  5646. The filter accepts the following options:
  5647. @table @option
  5648. @item luma_mode, l
  5649. @item chroma_mode, c
  5650. @item alpha_mode, a
  5651. Available values for @var{luma_mode}, @var{chroma_mode} and
  5652. @var{alpha_mode} are:
  5653. @table @samp
  5654. @item none
  5655. Do nothing.
  5656. @item deinterleave, d
  5657. Deinterleave fields, placing one above the other.
  5658. @item interleave, i
  5659. Interleave fields. Reverse the effect of deinterleaving.
  5660. @end table
  5661. Default value is @code{none}.
  5662. @item luma_swap, ls
  5663. @item chroma_swap, cs
  5664. @item alpha_swap, as
  5665. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  5666. @end table
  5667. @section inflate
  5668. Apply inflate effect to the video.
  5669. This filter replaces the pixel by the local(3x3) average by taking into account
  5670. only values higher than the pixel.
  5671. It accepts the following options:
  5672. @table @option
  5673. @item threshold0
  5674. @item threshold1
  5675. @item threshold2
  5676. @item threshold3
  5677. Limit the maximum change for each plane, default is 65535.
  5678. If 0, plane will remain unchanged.
  5679. @end table
  5680. @section interlace
  5681. Simple interlacing filter from progressive contents. This interleaves upper (or
  5682. lower) lines from odd frames with lower (or upper) lines from even frames,
  5683. halving the frame rate and preserving image height.
  5684. @example
  5685. Original Original New Frame
  5686. Frame 'j' Frame 'j+1' (tff)
  5687. ========== =========== ==================
  5688. Line 0 --------------------> Frame 'j' Line 0
  5689. Line 1 Line 1 ----> Frame 'j+1' Line 1
  5690. Line 2 ---------------------> Frame 'j' Line 2
  5691. Line 3 Line 3 ----> Frame 'j+1' Line 3
  5692. ... ... ...
  5693. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  5694. @end example
  5695. It accepts the following optional parameters:
  5696. @table @option
  5697. @item scan
  5698. This determines whether the interlaced frame is taken from the even
  5699. (tff - default) or odd (bff) lines of the progressive frame.
  5700. @item lowpass
  5701. Enable (default) or disable the vertical lowpass filter to avoid twitter
  5702. interlacing and reduce moire patterns.
  5703. @end table
  5704. @section kerndeint
  5705. Deinterlace input video by applying Donald Graft's adaptive kernel
  5706. deinterling. Work on interlaced parts of a video to produce
  5707. progressive frames.
  5708. The description of the accepted parameters follows.
  5709. @table @option
  5710. @item thresh
  5711. Set the threshold which affects the filter's tolerance when
  5712. determining if a pixel line must be processed. It must be an integer
  5713. in the range [0,255] and defaults to 10. A value of 0 will result in
  5714. applying the process on every pixels.
  5715. @item map
  5716. Paint pixels exceeding the threshold value to white if set to 1.
  5717. Default is 0.
  5718. @item order
  5719. Set the fields order. Swap fields if set to 1, leave fields alone if
  5720. 0. Default is 0.
  5721. @item sharp
  5722. Enable additional sharpening if set to 1. Default is 0.
  5723. @item twoway
  5724. Enable twoway sharpening if set to 1. Default is 0.
  5725. @end table
  5726. @subsection Examples
  5727. @itemize
  5728. @item
  5729. Apply default values:
  5730. @example
  5731. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  5732. @end example
  5733. @item
  5734. Enable additional sharpening:
  5735. @example
  5736. kerndeint=sharp=1
  5737. @end example
  5738. @item
  5739. Paint processed pixels in white:
  5740. @example
  5741. kerndeint=map=1
  5742. @end example
  5743. @end itemize
  5744. @section lenscorrection
  5745. Correct radial lens distortion
  5746. This filter can be used to correct for radial distortion as can result from the use
  5747. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  5748. one can use tools available for example as part of opencv or simply trial-and-error.
  5749. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  5750. and extract the k1 and k2 coefficients from the resulting matrix.
  5751. Note that effectively the same filter is available in the open-source tools Krita and
  5752. Digikam from the KDE project.
  5753. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  5754. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  5755. brightness distribution, so you may want to use both filters together in certain
  5756. cases, though you will have to take care of ordering, i.e. whether vignetting should
  5757. be applied before or after lens correction.
  5758. @subsection Options
  5759. The filter accepts the following options:
  5760. @table @option
  5761. @item cx
  5762. Relative x-coordinate of the focal point of the image, and thereby the center of the
  5763. distortion. This value has a range [0,1] and is expressed as fractions of the image
  5764. width.
  5765. @item cy
  5766. Relative y-coordinate of the focal point of the image, and thereby the center of the
  5767. distortion. This value has a range [0,1] and is expressed as fractions of the image
  5768. height.
  5769. @item k1
  5770. Coefficient of the quadratic correction term. 0.5 means no correction.
  5771. @item k2
  5772. Coefficient of the double quadratic correction term. 0.5 means no correction.
  5773. @end table
  5774. The formula that generates the correction is:
  5775. @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)
  5776. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  5777. distances from the focal point in the source and target images, respectively.
  5778. @anchor{lut3d}
  5779. @section lut3d
  5780. Apply a 3D LUT to an input video.
  5781. The filter accepts the following options:
  5782. @table @option
  5783. @item file
  5784. Set the 3D LUT file name.
  5785. Currently supported formats:
  5786. @table @samp
  5787. @item 3dl
  5788. AfterEffects
  5789. @item cube
  5790. Iridas
  5791. @item dat
  5792. DaVinci
  5793. @item m3d
  5794. Pandora
  5795. @end table
  5796. @item interp
  5797. Select interpolation mode.
  5798. Available values are:
  5799. @table @samp
  5800. @item nearest
  5801. Use values from the nearest defined point.
  5802. @item trilinear
  5803. Interpolate values using the 8 points defining a cube.
  5804. @item tetrahedral
  5805. Interpolate values using a tetrahedron.
  5806. @end table
  5807. @end table
  5808. @section lut, lutrgb, lutyuv
  5809. Compute a look-up table for binding each pixel component input value
  5810. to an output value, and apply it to the input video.
  5811. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  5812. to an RGB input video.
  5813. These filters accept the following parameters:
  5814. @table @option
  5815. @item c0
  5816. set first pixel component expression
  5817. @item c1
  5818. set second pixel component expression
  5819. @item c2
  5820. set third pixel component expression
  5821. @item c3
  5822. set fourth pixel component expression, corresponds to the alpha component
  5823. @item r
  5824. set red component expression
  5825. @item g
  5826. set green component expression
  5827. @item b
  5828. set blue component expression
  5829. @item a
  5830. alpha component expression
  5831. @item y
  5832. set Y/luminance component expression
  5833. @item u
  5834. set U/Cb component expression
  5835. @item v
  5836. set V/Cr component expression
  5837. @end table
  5838. Each of them specifies the expression to use for computing the lookup table for
  5839. the corresponding pixel component values.
  5840. The exact component associated to each of the @var{c*} options depends on the
  5841. format in input.
  5842. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  5843. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  5844. The expressions can contain the following constants and functions:
  5845. @table @option
  5846. @item w
  5847. @item h
  5848. The input width and height.
  5849. @item val
  5850. The input value for the pixel component.
  5851. @item clipval
  5852. The input value, clipped to the @var{minval}-@var{maxval} range.
  5853. @item maxval
  5854. The maximum value for the pixel component.
  5855. @item minval
  5856. The minimum value for the pixel component.
  5857. @item negval
  5858. The negated value for the pixel component value, clipped to the
  5859. @var{minval}-@var{maxval} range; it corresponds to the expression
  5860. "maxval-clipval+minval".
  5861. @item clip(val)
  5862. The computed value in @var{val}, clipped to the
  5863. @var{minval}-@var{maxval} range.
  5864. @item gammaval(gamma)
  5865. The computed gamma correction value of the pixel component value,
  5866. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  5867. expression
  5868. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  5869. @end table
  5870. All expressions default to "val".
  5871. @subsection Examples
  5872. @itemize
  5873. @item
  5874. Negate input video:
  5875. @example
  5876. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  5877. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  5878. @end example
  5879. The above is the same as:
  5880. @example
  5881. lutrgb="r=negval:g=negval:b=negval"
  5882. lutyuv="y=negval:u=negval:v=negval"
  5883. @end example
  5884. @item
  5885. Negate luminance:
  5886. @example
  5887. lutyuv=y=negval
  5888. @end example
  5889. @item
  5890. Remove chroma components, turning the video into a graytone image:
  5891. @example
  5892. lutyuv="u=128:v=128"
  5893. @end example
  5894. @item
  5895. Apply a luma burning effect:
  5896. @example
  5897. lutyuv="y=2*val"
  5898. @end example
  5899. @item
  5900. Remove green and blue components:
  5901. @example
  5902. lutrgb="g=0:b=0"
  5903. @end example
  5904. @item
  5905. Set a constant alpha channel value on input:
  5906. @example
  5907. format=rgba,lutrgb=a="maxval-minval/2"
  5908. @end example
  5909. @item
  5910. Correct luminance gamma by a factor of 0.5:
  5911. @example
  5912. lutyuv=y=gammaval(0.5)
  5913. @end example
  5914. @item
  5915. Discard least significant bits of luma:
  5916. @example
  5917. lutyuv=y='bitand(val, 128+64+32)'
  5918. @end example
  5919. @end itemize
  5920. @section maskedmerge
  5921. Merge the first input stream with the second input stream using per pixel
  5922. weights in the third input stream.
  5923. A value of 0 in the third stream pixel component means that pixel component
  5924. from first stream is returned unchanged, while maximum value (eg. 255 for
  5925. 8-bit videos) means that pixel component from second stream is returned
  5926. unchanged. Intermediate values define the amount of merging between both
  5927. input stream's pixel components.
  5928. This filter accepts the following options:
  5929. @table @option
  5930. @item planes
  5931. Set which planes will be processed as bitmap, unprocessed planes will be
  5932. copied from first stream.
  5933. By default value 0xf, all planes will be processed.
  5934. @end table
  5935. @section mcdeint
  5936. Apply motion-compensation deinterlacing.
  5937. It needs one field per frame as input and must thus be used together
  5938. with yadif=1/3 or equivalent.
  5939. This filter accepts the following options:
  5940. @table @option
  5941. @item mode
  5942. Set the deinterlacing mode.
  5943. It accepts one of the following values:
  5944. @table @samp
  5945. @item fast
  5946. @item medium
  5947. @item slow
  5948. use iterative motion estimation
  5949. @item extra_slow
  5950. like @samp{slow}, but use multiple reference frames.
  5951. @end table
  5952. Default value is @samp{fast}.
  5953. @item parity
  5954. Set the picture field parity assumed for the input video. It must be
  5955. one of the following values:
  5956. @table @samp
  5957. @item 0, tff
  5958. assume top field first
  5959. @item 1, bff
  5960. assume bottom field first
  5961. @end table
  5962. Default value is @samp{bff}.
  5963. @item qp
  5964. Set per-block quantization parameter (QP) used by the internal
  5965. encoder.
  5966. Higher values should result in a smoother motion vector field but less
  5967. optimal individual vectors. Default value is 1.
  5968. @end table
  5969. @section mergeplanes
  5970. Merge color channel components from several video streams.
  5971. The filter accepts up to 4 input streams, and merge selected input
  5972. planes to the output video.
  5973. This filter accepts the following options:
  5974. @table @option
  5975. @item mapping
  5976. Set input to output plane mapping. Default is @code{0}.
  5977. The mappings is specified as a bitmap. It should be specified as a
  5978. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  5979. mapping for the first plane of the output stream. 'A' sets the number of
  5980. the input stream to use (from 0 to 3), and 'a' the plane number of the
  5981. corresponding input to use (from 0 to 3). The rest of the mappings is
  5982. similar, 'Bb' describes the mapping for the output stream second
  5983. plane, 'Cc' describes the mapping for the output stream third plane and
  5984. 'Dd' describes the mapping for the output stream fourth plane.
  5985. @item format
  5986. Set output pixel format. Default is @code{yuva444p}.
  5987. @end table
  5988. @subsection Examples
  5989. @itemize
  5990. @item
  5991. Merge three gray video streams of same width and height into single video stream:
  5992. @example
  5993. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  5994. @end example
  5995. @item
  5996. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  5997. @example
  5998. [a0][a1]mergeplanes=0x00010210:yuva444p
  5999. @end example
  6000. @item
  6001. Swap Y and A plane in yuva444p stream:
  6002. @example
  6003. format=yuva444p,mergeplanes=0x03010200:yuva444p
  6004. @end example
  6005. @item
  6006. Swap U and V plane in yuv420p stream:
  6007. @example
  6008. format=yuv420p,mergeplanes=0x000201:yuv420p
  6009. @end example
  6010. @item
  6011. Cast a rgb24 clip to yuv444p:
  6012. @example
  6013. format=rgb24,mergeplanes=0x000102:yuv444p
  6014. @end example
  6015. @end itemize
  6016. @section mpdecimate
  6017. Drop frames that do not differ greatly from the previous frame in
  6018. order to reduce frame rate.
  6019. The main use of this filter is for very-low-bitrate encoding
  6020. (e.g. streaming over dialup modem), but it could in theory be used for
  6021. fixing movies that were inverse-telecined incorrectly.
  6022. A description of the accepted options follows.
  6023. @table @option
  6024. @item max
  6025. Set the maximum number of consecutive frames which can be dropped (if
  6026. positive), or the minimum interval between dropped frames (if
  6027. negative). If the value is 0, the frame is dropped unregarding the
  6028. number of previous sequentially dropped frames.
  6029. Default value is 0.
  6030. @item hi
  6031. @item lo
  6032. @item frac
  6033. Set the dropping threshold values.
  6034. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  6035. represent actual pixel value differences, so a threshold of 64
  6036. corresponds to 1 unit of difference for each pixel, or the same spread
  6037. out differently over the block.
  6038. A frame is a candidate for dropping if no 8x8 blocks differ by more
  6039. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  6040. meaning the whole image) differ by more than a threshold of @option{lo}.
  6041. Default value for @option{hi} is 64*12, default value for @option{lo} is
  6042. 64*5, and default value for @option{frac} is 0.33.
  6043. @end table
  6044. @section negate
  6045. Negate input video.
  6046. It accepts an integer in input; if non-zero it negates the
  6047. alpha component (if available). The default value in input is 0.
  6048. @section noformat
  6049. Force libavfilter not to use any of the specified pixel formats for the
  6050. input to the next filter.
  6051. It accepts the following parameters:
  6052. @table @option
  6053. @item pix_fmts
  6054. A '|'-separated list of pixel format names, such as
  6055. apix_fmts=yuv420p|monow|rgb24".
  6056. @end table
  6057. @subsection Examples
  6058. @itemize
  6059. @item
  6060. Force libavfilter to use a format different from @var{yuv420p} for the
  6061. input to the vflip filter:
  6062. @example
  6063. noformat=pix_fmts=yuv420p,vflip
  6064. @end example
  6065. @item
  6066. Convert the input video to any of the formats not contained in the list:
  6067. @example
  6068. noformat=yuv420p|yuv444p|yuv410p
  6069. @end example
  6070. @end itemize
  6071. @section noise
  6072. Add noise on video input frame.
  6073. The filter accepts the following options:
  6074. @table @option
  6075. @item all_seed
  6076. @item c0_seed
  6077. @item c1_seed
  6078. @item c2_seed
  6079. @item c3_seed
  6080. Set noise seed for specific pixel component or all pixel components in case
  6081. of @var{all_seed}. Default value is @code{123457}.
  6082. @item all_strength, alls
  6083. @item c0_strength, c0s
  6084. @item c1_strength, c1s
  6085. @item c2_strength, c2s
  6086. @item c3_strength, c3s
  6087. Set noise strength for specific pixel component or all pixel components in case
  6088. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  6089. @item all_flags, allf
  6090. @item c0_flags, c0f
  6091. @item c1_flags, c1f
  6092. @item c2_flags, c2f
  6093. @item c3_flags, c3f
  6094. Set pixel component flags or set flags for all components if @var{all_flags}.
  6095. Available values for component flags are:
  6096. @table @samp
  6097. @item a
  6098. averaged temporal noise (smoother)
  6099. @item p
  6100. mix random noise with a (semi)regular pattern
  6101. @item t
  6102. temporal noise (noise pattern changes between frames)
  6103. @item u
  6104. uniform noise (gaussian otherwise)
  6105. @end table
  6106. @end table
  6107. @subsection Examples
  6108. Add temporal and uniform noise to input video:
  6109. @example
  6110. noise=alls=20:allf=t+u
  6111. @end example
  6112. @section null
  6113. Pass the video source unchanged to the output.
  6114. @section ocr
  6115. Optical Character Recognition
  6116. This filter uses Tesseract for optical character recognition.
  6117. It accepts the following options:
  6118. @table @option
  6119. @item datapath
  6120. Set datapath to tesseract data. Default is to use whatever was
  6121. set at installation.
  6122. @item language
  6123. Set language, default is "eng".
  6124. @item whitelist
  6125. Set character whitelist.
  6126. @item blacklist
  6127. Set character blacklist.
  6128. @end table
  6129. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  6130. @section ocv
  6131. Apply a video transform using libopencv.
  6132. To enable this filter, install the libopencv library and headers and
  6133. configure FFmpeg with @code{--enable-libopencv}.
  6134. It accepts the following parameters:
  6135. @table @option
  6136. @item filter_name
  6137. The name of the libopencv filter to apply.
  6138. @item filter_params
  6139. The parameters to pass to the libopencv filter. If not specified, the default
  6140. values are assumed.
  6141. @end table
  6142. Refer to the official libopencv documentation for more precise
  6143. information:
  6144. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  6145. Several libopencv filters are supported; see the following subsections.
  6146. @anchor{dilate}
  6147. @subsection dilate
  6148. Dilate an image by using a specific structuring element.
  6149. It corresponds to the libopencv function @code{cvDilate}.
  6150. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  6151. @var{struct_el} represents a structuring element, and has the syntax:
  6152. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  6153. @var{cols} and @var{rows} represent the number of columns and rows of
  6154. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  6155. point, and @var{shape} the shape for the structuring element. @var{shape}
  6156. must be "rect", "cross", "ellipse", or "custom".
  6157. If the value for @var{shape} is "custom", it must be followed by a
  6158. string of the form "=@var{filename}". The file with name
  6159. @var{filename} is assumed to represent a binary image, with each
  6160. printable character corresponding to a bright pixel. When a custom
  6161. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  6162. or columns and rows of the read file are assumed instead.
  6163. The default value for @var{struct_el} is "3x3+0x0/rect".
  6164. @var{nb_iterations} specifies the number of times the transform is
  6165. applied to the image, and defaults to 1.
  6166. Some examples:
  6167. @example
  6168. # Use the default values
  6169. ocv=dilate
  6170. # Dilate using a structuring element with a 5x5 cross, iterating two times
  6171. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  6172. # Read the shape from the file diamond.shape, iterating two times.
  6173. # The file diamond.shape may contain a pattern of characters like this
  6174. # *
  6175. # ***
  6176. # *****
  6177. # ***
  6178. # *
  6179. # The specified columns and rows are ignored
  6180. # but the anchor point coordinates are not
  6181. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  6182. @end example
  6183. @subsection erode
  6184. Erode an image by using a specific structuring element.
  6185. It corresponds to the libopencv function @code{cvErode}.
  6186. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  6187. with the same syntax and semantics as the @ref{dilate} filter.
  6188. @subsection smooth
  6189. Smooth the input video.
  6190. The filter takes the following parameters:
  6191. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  6192. @var{type} is the type of smooth filter to apply, and must be one of
  6193. the following values: "blur", "blur_no_scale", "median", "gaussian",
  6194. or "bilateral". The default value is "gaussian".
  6195. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  6196. depend on the smooth type. @var{param1} and
  6197. @var{param2} accept integer positive values or 0. @var{param3} and
  6198. @var{param4} accept floating point values.
  6199. The default value for @var{param1} is 3. The default value for the
  6200. other parameters is 0.
  6201. These parameters correspond to the parameters assigned to the
  6202. libopencv function @code{cvSmooth}.
  6203. @anchor{overlay}
  6204. @section overlay
  6205. Overlay one video on top of another.
  6206. It takes two inputs and has one output. The first input is the "main"
  6207. video on which the second input is overlaid.
  6208. It accepts the following parameters:
  6209. A description of the accepted options follows.
  6210. @table @option
  6211. @item x
  6212. @item y
  6213. Set the expression for the x and y coordinates of the overlaid video
  6214. on the main video. Default value is "0" for both expressions. In case
  6215. the expression is invalid, it is set to a huge value (meaning that the
  6216. overlay will not be displayed within the output visible area).
  6217. @item eof_action
  6218. The action to take when EOF is encountered on the secondary input; it accepts
  6219. one of the following values:
  6220. @table @option
  6221. @item repeat
  6222. Repeat the last frame (the default).
  6223. @item endall
  6224. End both streams.
  6225. @item pass
  6226. Pass the main input through.
  6227. @end table
  6228. @item eval
  6229. Set when the expressions for @option{x}, and @option{y} are evaluated.
  6230. It accepts the following values:
  6231. @table @samp
  6232. @item init
  6233. only evaluate expressions once during the filter initialization or
  6234. when a command is processed
  6235. @item frame
  6236. evaluate expressions for each incoming frame
  6237. @end table
  6238. Default value is @samp{frame}.
  6239. @item shortest
  6240. If set to 1, force the output to terminate when the shortest input
  6241. terminates. Default value is 0.
  6242. @item format
  6243. Set the format for the output video.
  6244. It accepts the following values:
  6245. @table @samp
  6246. @item yuv420
  6247. force YUV420 output
  6248. @item yuv422
  6249. force YUV422 output
  6250. @item yuv444
  6251. force YUV444 output
  6252. @item rgb
  6253. force RGB output
  6254. @end table
  6255. Default value is @samp{yuv420}.
  6256. @item rgb @emph{(deprecated)}
  6257. If set to 1, force the filter to accept inputs in the RGB
  6258. color space. Default value is 0. This option is deprecated, use
  6259. @option{format} instead.
  6260. @item repeatlast
  6261. If set to 1, force the filter to draw the last overlay frame over the
  6262. main input until the end of the stream. A value of 0 disables this
  6263. behavior. Default value is 1.
  6264. @end table
  6265. The @option{x}, and @option{y} expressions can contain the following
  6266. parameters.
  6267. @table @option
  6268. @item main_w, W
  6269. @item main_h, H
  6270. The main input width and height.
  6271. @item overlay_w, w
  6272. @item overlay_h, h
  6273. The overlay input width and height.
  6274. @item x
  6275. @item y
  6276. The computed values for @var{x} and @var{y}. They are evaluated for
  6277. each new frame.
  6278. @item hsub
  6279. @item vsub
  6280. horizontal and vertical chroma subsample values of the output
  6281. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  6282. @var{vsub} is 1.
  6283. @item n
  6284. the number of input frame, starting from 0
  6285. @item pos
  6286. the position in the file of the input frame, NAN if unknown
  6287. @item t
  6288. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  6289. @end table
  6290. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  6291. when evaluation is done @emph{per frame}, and will evaluate to NAN
  6292. when @option{eval} is set to @samp{init}.
  6293. Be aware that frames are taken from each input video in timestamp
  6294. order, hence, if their initial timestamps differ, it is a good idea
  6295. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  6296. have them begin in the same zero timestamp, as the example for
  6297. the @var{movie} filter does.
  6298. You can chain together more overlays but you should test the
  6299. efficiency of such approach.
  6300. @subsection Commands
  6301. This filter supports the following commands:
  6302. @table @option
  6303. @item x
  6304. @item y
  6305. Modify the x and y of the overlay input.
  6306. The command accepts the same syntax of the corresponding option.
  6307. If the specified expression is not valid, it is kept at its current
  6308. value.
  6309. @end table
  6310. @subsection Examples
  6311. @itemize
  6312. @item
  6313. Draw the overlay at 10 pixels from the bottom right corner of the main
  6314. video:
  6315. @example
  6316. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  6317. @end example
  6318. Using named options the example above becomes:
  6319. @example
  6320. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  6321. @end example
  6322. @item
  6323. Insert a transparent PNG logo in the bottom left corner of the input,
  6324. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  6325. @example
  6326. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  6327. @end example
  6328. @item
  6329. Insert 2 different transparent PNG logos (second logo on bottom
  6330. right corner) using the @command{ffmpeg} tool:
  6331. @example
  6332. 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
  6333. @end example
  6334. @item
  6335. Add a transparent color layer on top of the main video; @code{WxH}
  6336. must specify the size of the main input to the overlay filter:
  6337. @example
  6338. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  6339. @end example
  6340. @item
  6341. Play an original video and a filtered version (here with the deshake
  6342. filter) side by side using the @command{ffplay} tool:
  6343. @example
  6344. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  6345. @end example
  6346. The above command is the same as:
  6347. @example
  6348. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  6349. @end example
  6350. @item
  6351. Make a sliding overlay appearing from the left to the right top part of the
  6352. screen starting since time 2:
  6353. @example
  6354. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  6355. @end example
  6356. @item
  6357. Compose output by putting two input videos side to side:
  6358. @example
  6359. ffmpeg -i left.avi -i right.avi -filter_complex "
  6360. nullsrc=size=200x100 [background];
  6361. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  6362. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  6363. [background][left] overlay=shortest=1 [background+left];
  6364. [background+left][right] overlay=shortest=1:x=100 [left+right]
  6365. "
  6366. @end example
  6367. @item
  6368. Mask 10-20 seconds of a video by applying the delogo filter to a section
  6369. @example
  6370. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  6371. -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]'
  6372. masked.avi
  6373. @end example
  6374. @item
  6375. Chain several overlays in cascade:
  6376. @example
  6377. nullsrc=s=200x200 [bg];
  6378. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  6379. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  6380. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  6381. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  6382. [in3] null, [mid2] overlay=100:100 [out0]
  6383. @end example
  6384. @end itemize
  6385. @section owdenoise
  6386. Apply Overcomplete Wavelet denoiser.
  6387. The filter accepts the following options:
  6388. @table @option
  6389. @item depth
  6390. Set depth.
  6391. Larger depth values will denoise lower frequency components more, but
  6392. slow down filtering.
  6393. Must be an int in the range 8-16, default is @code{8}.
  6394. @item luma_strength, ls
  6395. Set luma strength.
  6396. Must be a double value in the range 0-1000, default is @code{1.0}.
  6397. @item chroma_strength, cs
  6398. Set chroma strength.
  6399. Must be a double value in the range 0-1000, default is @code{1.0}.
  6400. @end table
  6401. @anchor{pad}
  6402. @section pad
  6403. Add paddings to the input image, and place the original input at the
  6404. provided @var{x}, @var{y} coordinates.
  6405. It accepts the following parameters:
  6406. @table @option
  6407. @item width, w
  6408. @item height, h
  6409. Specify an expression for the size of the output image with the
  6410. paddings added. If the value for @var{width} or @var{height} is 0, the
  6411. corresponding input size is used for the output.
  6412. The @var{width} expression can reference the value set by the
  6413. @var{height} expression, and vice versa.
  6414. The default value of @var{width} and @var{height} is 0.
  6415. @item x
  6416. @item y
  6417. Specify the offsets to place the input image at within the padded area,
  6418. with respect to the top/left border of the output image.
  6419. The @var{x} expression can reference the value set by the @var{y}
  6420. expression, and vice versa.
  6421. The default value of @var{x} and @var{y} is 0.
  6422. @item color
  6423. Specify the color of the padded area. For the syntax of this option,
  6424. check the "Color" section in the ffmpeg-utils manual.
  6425. The default value of @var{color} is "black".
  6426. @end table
  6427. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  6428. options are expressions containing the following constants:
  6429. @table @option
  6430. @item in_w
  6431. @item in_h
  6432. The input video width and height.
  6433. @item iw
  6434. @item ih
  6435. These are the same as @var{in_w} and @var{in_h}.
  6436. @item out_w
  6437. @item out_h
  6438. The output width and height (the size of the padded area), as
  6439. specified by the @var{width} and @var{height} expressions.
  6440. @item ow
  6441. @item oh
  6442. These are the same as @var{out_w} and @var{out_h}.
  6443. @item x
  6444. @item y
  6445. The x and y offsets as specified by the @var{x} and @var{y}
  6446. expressions, or NAN if not yet specified.
  6447. @item a
  6448. same as @var{iw} / @var{ih}
  6449. @item sar
  6450. input sample aspect ratio
  6451. @item dar
  6452. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6453. @item hsub
  6454. @item vsub
  6455. The horizontal and vertical chroma subsample values. For example for the
  6456. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6457. @end table
  6458. @subsection Examples
  6459. @itemize
  6460. @item
  6461. Add paddings with the color "violet" to the input video. The output video
  6462. size is 640x480, and the top-left corner of the input video is placed at
  6463. column 0, row 40
  6464. @example
  6465. pad=640:480:0:40:violet
  6466. @end example
  6467. The example above is equivalent to the following command:
  6468. @example
  6469. pad=width=640:height=480:x=0:y=40:color=violet
  6470. @end example
  6471. @item
  6472. Pad the input to get an output with dimensions increased by 3/2,
  6473. and put the input video at the center of the padded area:
  6474. @example
  6475. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  6476. @end example
  6477. @item
  6478. Pad the input to get a squared output with size equal to the maximum
  6479. value between the input width and height, and put the input video at
  6480. the center of the padded area:
  6481. @example
  6482. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  6483. @end example
  6484. @item
  6485. Pad the input to get a final w/h ratio of 16:9:
  6486. @example
  6487. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  6488. @end example
  6489. @item
  6490. In case of anamorphic video, in order to set the output display aspect
  6491. correctly, it is necessary to use @var{sar} in the expression,
  6492. according to the relation:
  6493. @example
  6494. (ih * X / ih) * sar = output_dar
  6495. X = output_dar / sar
  6496. @end example
  6497. Thus the previous example needs to be modified to:
  6498. @example
  6499. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  6500. @end example
  6501. @item
  6502. Double the output size and put the input video in the bottom-right
  6503. corner of the output padded area:
  6504. @example
  6505. pad="2*iw:2*ih:ow-iw:oh-ih"
  6506. @end example
  6507. @end itemize
  6508. @anchor{palettegen}
  6509. @section palettegen
  6510. Generate one palette for a whole video stream.
  6511. It accepts the following options:
  6512. @table @option
  6513. @item max_colors
  6514. Set the maximum number of colors to quantize in the palette.
  6515. Note: the palette will still contain 256 colors; the unused palette entries
  6516. will be black.
  6517. @item reserve_transparent
  6518. Create a palette of 255 colors maximum and reserve the last one for
  6519. transparency. Reserving the transparency color is useful for GIF optimization.
  6520. If not set, the maximum of colors in the palette will be 256. You probably want
  6521. to disable this option for a standalone image.
  6522. Set by default.
  6523. @item stats_mode
  6524. Set statistics mode.
  6525. It accepts the following values:
  6526. @table @samp
  6527. @item full
  6528. Compute full frame histograms.
  6529. @item diff
  6530. Compute histograms only for the part that differs from previous frame. This
  6531. might be relevant to give more importance to the moving part of your input if
  6532. the background is static.
  6533. @end table
  6534. Default value is @var{full}.
  6535. @end table
  6536. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  6537. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  6538. color quantization of the palette. This information is also visible at
  6539. @var{info} logging level.
  6540. @subsection Examples
  6541. @itemize
  6542. @item
  6543. Generate a representative palette of a given video using @command{ffmpeg}:
  6544. @example
  6545. ffmpeg -i input.mkv -vf palettegen palette.png
  6546. @end example
  6547. @end itemize
  6548. @section paletteuse
  6549. Use a palette to downsample an input video stream.
  6550. The filter takes two inputs: one video stream and a palette. The palette must
  6551. be a 256 pixels image.
  6552. It accepts the following options:
  6553. @table @option
  6554. @item dither
  6555. Select dithering mode. Available algorithms are:
  6556. @table @samp
  6557. @item bayer
  6558. Ordered 8x8 bayer dithering (deterministic)
  6559. @item heckbert
  6560. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  6561. Note: this dithering is sometimes considered "wrong" and is included as a
  6562. reference.
  6563. @item floyd_steinberg
  6564. Floyd and Steingberg dithering (error diffusion)
  6565. @item sierra2
  6566. Frankie Sierra dithering v2 (error diffusion)
  6567. @item sierra2_4a
  6568. Frankie Sierra dithering v2 "Lite" (error diffusion)
  6569. @end table
  6570. Default is @var{sierra2_4a}.
  6571. @item bayer_scale
  6572. When @var{bayer} dithering is selected, this option defines the scale of the
  6573. pattern (how much the crosshatch pattern is visible). A low value means more
  6574. visible pattern for less banding, and higher value means less visible pattern
  6575. at the cost of more banding.
  6576. The option must be an integer value in the range [0,5]. Default is @var{2}.
  6577. @item diff_mode
  6578. If set, define the zone to process
  6579. @table @samp
  6580. @item rectangle
  6581. Only the changing rectangle will be reprocessed. This is similar to GIF
  6582. cropping/offsetting compression mechanism. This option can be useful for speed
  6583. if only a part of the image is changing, and has use cases such as limiting the
  6584. scope of the error diffusal @option{dither} to the rectangle that bounds the
  6585. moving scene (it leads to more deterministic output if the scene doesn't change
  6586. much, and as a result less moving noise and better GIF compression).
  6587. @end table
  6588. Default is @var{none}.
  6589. @end table
  6590. @subsection Examples
  6591. @itemize
  6592. @item
  6593. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  6594. using @command{ffmpeg}:
  6595. @example
  6596. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  6597. @end example
  6598. @end itemize
  6599. @section perspective
  6600. Correct perspective of video not recorded perpendicular to the screen.
  6601. A description of the accepted parameters follows.
  6602. @table @option
  6603. @item x0
  6604. @item y0
  6605. @item x1
  6606. @item y1
  6607. @item x2
  6608. @item y2
  6609. @item x3
  6610. @item y3
  6611. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  6612. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  6613. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  6614. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  6615. then the corners of the source will be sent to the specified coordinates.
  6616. The expressions can use the following variables:
  6617. @table @option
  6618. @item W
  6619. @item H
  6620. the width and height of video frame.
  6621. @end table
  6622. @item interpolation
  6623. Set interpolation for perspective correction.
  6624. It accepts the following values:
  6625. @table @samp
  6626. @item linear
  6627. @item cubic
  6628. @end table
  6629. Default value is @samp{linear}.
  6630. @item sense
  6631. Set interpretation of coordinate options.
  6632. It accepts the following values:
  6633. @table @samp
  6634. @item 0, source
  6635. Send point in the source specified by the given coordinates to
  6636. the corners of the destination.
  6637. @item 1, destination
  6638. Send the corners of the source to the point in the destination specified
  6639. by the given coordinates.
  6640. Default value is @samp{source}.
  6641. @end table
  6642. @end table
  6643. @section phase
  6644. Delay interlaced video by one field time so that the field order changes.
  6645. The intended use is to fix PAL movies that have been captured with the
  6646. opposite field order to the film-to-video transfer.
  6647. A description of the accepted parameters follows.
  6648. @table @option
  6649. @item mode
  6650. Set phase mode.
  6651. It accepts the following values:
  6652. @table @samp
  6653. @item t
  6654. Capture field order top-first, transfer bottom-first.
  6655. Filter will delay the bottom field.
  6656. @item b
  6657. Capture field order bottom-first, transfer top-first.
  6658. Filter will delay the top field.
  6659. @item p
  6660. Capture and transfer with the same field order. This mode only exists
  6661. for the documentation of the other options to refer to, but if you
  6662. actually select it, the filter will faithfully do nothing.
  6663. @item a
  6664. Capture field order determined automatically by field flags, transfer
  6665. opposite.
  6666. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  6667. basis using field flags. If no field information is available,
  6668. then this works just like @samp{u}.
  6669. @item u
  6670. Capture unknown or varying, transfer opposite.
  6671. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  6672. analyzing the images and selecting the alternative that produces best
  6673. match between the fields.
  6674. @item T
  6675. Capture top-first, transfer unknown or varying.
  6676. Filter selects among @samp{t} and @samp{p} using image analysis.
  6677. @item B
  6678. Capture bottom-first, transfer unknown or varying.
  6679. Filter selects among @samp{b} and @samp{p} using image analysis.
  6680. @item A
  6681. Capture determined by field flags, transfer unknown or varying.
  6682. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  6683. image analysis. If no field information is available, then this works just
  6684. like @samp{U}. This is the default mode.
  6685. @item U
  6686. Both capture and transfer unknown or varying.
  6687. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  6688. @end table
  6689. @end table
  6690. @section pixdesctest
  6691. Pixel format descriptor test filter, mainly useful for internal
  6692. testing. The output video should be equal to the input video.
  6693. For example:
  6694. @example
  6695. format=monow, pixdesctest
  6696. @end example
  6697. can be used to test the monowhite pixel format descriptor definition.
  6698. @section pp
  6699. Enable the specified chain of postprocessing subfilters using libpostproc. This
  6700. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  6701. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  6702. Each subfilter and some options have a short and a long name that can be used
  6703. interchangeably, i.e. dr/dering are the same.
  6704. The filters accept the following options:
  6705. @table @option
  6706. @item subfilters
  6707. Set postprocessing subfilters string.
  6708. @end table
  6709. All subfilters share common options to determine their scope:
  6710. @table @option
  6711. @item a/autoq
  6712. Honor the quality commands for this subfilter.
  6713. @item c/chrom
  6714. Do chrominance filtering, too (default).
  6715. @item y/nochrom
  6716. Do luminance filtering only (no chrominance).
  6717. @item n/noluma
  6718. Do chrominance filtering only (no luminance).
  6719. @end table
  6720. These options can be appended after the subfilter name, separated by a '|'.
  6721. Available subfilters are:
  6722. @table @option
  6723. @item hb/hdeblock[|difference[|flatness]]
  6724. Horizontal deblocking filter
  6725. @table @option
  6726. @item difference
  6727. Difference factor where higher values mean more deblocking (default: @code{32}).
  6728. @item flatness
  6729. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6730. @end table
  6731. @item vb/vdeblock[|difference[|flatness]]
  6732. Vertical deblocking filter
  6733. @table @option
  6734. @item difference
  6735. Difference factor where higher values mean more deblocking (default: @code{32}).
  6736. @item flatness
  6737. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6738. @end table
  6739. @item ha/hadeblock[|difference[|flatness]]
  6740. Accurate horizontal deblocking filter
  6741. @table @option
  6742. @item difference
  6743. Difference factor where higher values mean more deblocking (default: @code{32}).
  6744. @item flatness
  6745. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6746. @end table
  6747. @item va/vadeblock[|difference[|flatness]]
  6748. Accurate vertical deblocking filter
  6749. @table @option
  6750. @item difference
  6751. Difference factor where higher values mean more deblocking (default: @code{32}).
  6752. @item flatness
  6753. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6754. @end table
  6755. @end table
  6756. The horizontal and vertical deblocking filters share the difference and
  6757. flatness values so you cannot set different horizontal and vertical
  6758. thresholds.
  6759. @table @option
  6760. @item h1/x1hdeblock
  6761. Experimental horizontal deblocking filter
  6762. @item v1/x1vdeblock
  6763. Experimental vertical deblocking filter
  6764. @item dr/dering
  6765. Deringing filter
  6766. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  6767. @table @option
  6768. @item threshold1
  6769. larger -> stronger filtering
  6770. @item threshold2
  6771. larger -> stronger filtering
  6772. @item threshold3
  6773. larger -> stronger filtering
  6774. @end table
  6775. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  6776. @table @option
  6777. @item f/fullyrange
  6778. Stretch luminance to @code{0-255}.
  6779. @end table
  6780. @item lb/linblenddeint
  6781. Linear blend deinterlacing filter that deinterlaces the given block by
  6782. filtering all lines with a @code{(1 2 1)} filter.
  6783. @item li/linipoldeint
  6784. Linear interpolating deinterlacing filter that deinterlaces the given block by
  6785. linearly interpolating every second line.
  6786. @item ci/cubicipoldeint
  6787. Cubic interpolating deinterlacing filter deinterlaces the given block by
  6788. cubically interpolating every second line.
  6789. @item md/mediandeint
  6790. Median deinterlacing filter that deinterlaces the given block by applying a
  6791. median filter to every second line.
  6792. @item fd/ffmpegdeint
  6793. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  6794. second line with a @code{(-1 4 2 4 -1)} filter.
  6795. @item l5/lowpass5
  6796. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  6797. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  6798. @item fq/forceQuant[|quantizer]
  6799. Overrides the quantizer table from the input with the constant quantizer you
  6800. specify.
  6801. @table @option
  6802. @item quantizer
  6803. Quantizer to use
  6804. @end table
  6805. @item de/default
  6806. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  6807. @item fa/fast
  6808. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  6809. @item ac
  6810. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  6811. @end table
  6812. @subsection Examples
  6813. @itemize
  6814. @item
  6815. Apply horizontal and vertical deblocking, deringing and automatic
  6816. brightness/contrast:
  6817. @example
  6818. pp=hb/vb/dr/al
  6819. @end example
  6820. @item
  6821. Apply default filters without brightness/contrast correction:
  6822. @example
  6823. pp=de/-al
  6824. @end example
  6825. @item
  6826. Apply default filters and temporal denoiser:
  6827. @example
  6828. pp=default/tmpnoise|1|2|3
  6829. @end example
  6830. @item
  6831. Apply deblocking on luminance only, and switch vertical deblocking on or off
  6832. automatically depending on available CPU time:
  6833. @example
  6834. pp=hb|y/vb|a
  6835. @end example
  6836. @end itemize
  6837. @section pp7
  6838. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  6839. similar to spp = 6 with 7 point DCT, where only the center sample is
  6840. used after IDCT.
  6841. The filter accepts the following options:
  6842. @table @option
  6843. @item qp
  6844. Force a constant quantization parameter. It accepts an integer in range
  6845. 0 to 63. If not set, the filter will use the QP from the video stream
  6846. (if available).
  6847. @item mode
  6848. Set thresholding mode. Available modes are:
  6849. @table @samp
  6850. @item hard
  6851. Set hard thresholding.
  6852. @item soft
  6853. Set soft thresholding (better de-ringing effect, but likely blurrier).
  6854. @item medium
  6855. Set medium thresholding (good results, default).
  6856. @end table
  6857. @end table
  6858. @section psnr
  6859. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  6860. Ratio) between two input videos.
  6861. This filter takes in input two input videos, the first input is
  6862. considered the "main" source and is passed unchanged to the
  6863. output. The second input is used as a "reference" video for computing
  6864. the PSNR.
  6865. Both video inputs must have the same resolution and pixel format for
  6866. this filter to work correctly. Also it assumes that both inputs
  6867. have the same number of frames, which are compared one by one.
  6868. The obtained average PSNR is printed through the logging system.
  6869. The filter stores the accumulated MSE (mean squared error) of each
  6870. frame, and at the end of the processing it is averaged across all frames
  6871. equally, and the following formula is applied to obtain the PSNR:
  6872. @example
  6873. PSNR = 10*log10(MAX^2/MSE)
  6874. @end example
  6875. Where MAX is the average of the maximum values of each component of the
  6876. image.
  6877. The description of the accepted parameters follows.
  6878. @table @option
  6879. @item stats_file, f
  6880. If specified the filter will use the named file to save the PSNR of
  6881. each individual frame. When filename equals "-" the data is sent to
  6882. standard output.
  6883. @end table
  6884. The file printed if @var{stats_file} is selected, contains a sequence of
  6885. key/value pairs of the form @var{key}:@var{value} for each compared
  6886. couple of frames.
  6887. A description of each shown parameter follows:
  6888. @table @option
  6889. @item n
  6890. sequential number of the input frame, starting from 1
  6891. @item mse_avg
  6892. Mean Square Error pixel-by-pixel average difference of the compared
  6893. frames, averaged over all the image components.
  6894. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  6895. Mean Square Error pixel-by-pixel average difference of the compared
  6896. frames for the component specified by the suffix.
  6897. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  6898. Peak Signal to Noise ratio of the compared frames for the component
  6899. specified by the suffix.
  6900. @end table
  6901. For example:
  6902. @example
  6903. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  6904. [main][ref] psnr="stats_file=stats.log" [out]
  6905. @end example
  6906. On this example the input file being processed is compared with the
  6907. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  6908. is stored in @file{stats.log}.
  6909. @anchor{pullup}
  6910. @section pullup
  6911. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  6912. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  6913. content.
  6914. The pullup filter is designed to take advantage of future context in making
  6915. its decisions. This filter is stateless in the sense that it does not lock
  6916. onto a pattern to follow, but it instead looks forward to the following
  6917. fields in order to identify matches and rebuild progressive frames.
  6918. To produce content with an even framerate, insert the fps filter after
  6919. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  6920. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  6921. The filter accepts the following options:
  6922. @table @option
  6923. @item jl
  6924. @item jr
  6925. @item jt
  6926. @item jb
  6927. These options set the amount of "junk" to ignore at the left, right, top, and
  6928. bottom of the image, respectively. Left and right are in units of 8 pixels,
  6929. while top and bottom are in units of 2 lines.
  6930. The default is 8 pixels on each side.
  6931. @item sb
  6932. Set the strict breaks. Setting this option to 1 will reduce the chances of
  6933. filter generating an occasional mismatched frame, but it may also cause an
  6934. excessive number of frames to be dropped during high motion sequences.
  6935. Conversely, setting it to -1 will make filter match fields more easily.
  6936. This may help processing of video where there is slight blurring between
  6937. the fields, but may also cause there to be interlaced frames in the output.
  6938. Default value is @code{0}.
  6939. @item mp
  6940. Set the metric plane to use. It accepts the following values:
  6941. @table @samp
  6942. @item l
  6943. Use luma plane.
  6944. @item u
  6945. Use chroma blue plane.
  6946. @item v
  6947. Use chroma red plane.
  6948. @end table
  6949. This option may be set to use chroma plane instead of the default luma plane
  6950. for doing filter's computations. This may improve accuracy on very clean
  6951. source material, but more likely will decrease accuracy, especially if there
  6952. is chroma noise (rainbow effect) or any grayscale video.
  6953. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  6954. load and make pullup usable in realtime on slow machines.
  6955. @end table
  6956. For best results (without duplicated frames in the output file) it is
  6957. necessary to change the output frame rate. For example, to inverse
  6958. telecine NTSC input:
  6959. @example
  6960. ffmpeg -i input -vf pullup -r 24000/1001 ...
  6961. @end example
  6962. @section qp
  6963. Change video quantization parameters (QP).
  6964. The filter accepts the following option:
  6965. @table @option
  6966. @item qp
  6967. Set expression for quantization parameter.
  6968. @end table
  6969. The expression is evaluated through the eval API and can contain, among others,
  6970. the following constants:
  6971. @table @var
  6972. @item known
  6973. 1 if index is not 129, 0 otherwise.
  6974. @item qp
  6975. Sequentional index starting from -129 to 128.
  6976. @end table
  6977. @subsection Examples
  6978. @itemize
  6979. @item
  6980. Some equation like:
  6981. @example
  6982. qp=2+2*sin(PI*qp)
  6983. @end example
  6984. @end itemize
  6985. @section random
  6986. Flush video frames from internal cache of frames into a random order.
  6987. No frame is discarded.
  6988. Inspired by @ref{frei0r} nervous filter.
  6989. @table @option
  6990. @item frames
  6991. Set size in number of frames of internal cache, in range from @code{2} to
  6992. @code{512}. Default is @code{30}.
  6993. @item seed
  6994. Set seed for random number generator, must be an integer included between
  6995. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  6996. less than @code{0}, the filter will try to use a good random seed on a
  6997. best effort basis.
  6998. @end table
  6999. @section removegrain
  7000. The removegrain filter is a spatial denoiser for progressive video.
  7001. @table @option
  7002. @item m0
  7003. Set mode for the first plane.
  7004. @item m1
  7005. Set mode for the second plane.
  7006. @item m2
  7007. Set mode for the third plane.
  7008. @item m3
  7009. Set mode for the fourth plane.
  7010. @end table
  7011. Range of mode is from 0 to 24. Description of each mode follows:
  7012. @table @var
  7013. @item 0
  7014. Leave input plane unchanged. Default.
  7015. @item 1
  7016. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  7017. @item 2
  7018. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  7019. @item 3
  7020. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  7021. @item 4
  7022. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  7023. This is equivalent to a median filter.
  7024. @item 5
  7025. Line-sensitive clipping giving the minimal change.
  7026. @item 6
  7027. Line-sensitive clipping, intermediate.
  7028. @item 7
  7029. Line-sensitive clipping, intermediate.
  7030. @item 8
  7031. Line-sensitive clipping, intermediate.
  7032. @item 9
  7033. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  7034. @item 10
  7035. Replaces the target pixel with the closest neighbour.
  7036. @item 11
  7037. [1 2 1] horizontal and vertical kernel blur.
  7038. @item 12
  7039. Same as mode 11.
  7040. @item 13
  7041. Bob mode, interpolates top field from the line where the neighbours
  7042. pixels are the closest.
  7043. @item 14
  7044. Bob mode, interpolates bottom field from the line where the neighbours
  7045. pixels are the closest.
  7046. @item 15
  7047. Bob mode, interpolates top field. Same as 13 but with a more complicated
  7048. interpolation formula.
  7049. @item 16
  7050. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  7051. interpolation formula.
  7052. @item 17
  7053. Clips the pixel with the minimum and maximum of respectively the maximum and
  7054. minimum of each pair of opposite neighbour pixels.
  7055. @item 18
  7056. Line-sensitive clipping using opposite neighbours whose greatest distance from
  7057. the current pixel is minimal.
  7058. @item 19
  7059. Replaces the pixel with the average of its 8 neighbours.
  7060. @item 20
  7061. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  7062. @item 21
  7063. Clips pixels using the averages of opposite neighbour.
  7064. @item 22
  7065. Same as mode 21 but simpler and faster.
  7066. @item 23
  7067. Small edge and halo removal, but reputed useless.
  7068. @item 24
  7069. Similar as 23.
  7070. @end table
  7071. @section removelogo
  7072. Suppress a TV station logo, using an image file to determine which
  7073. pixels comprise the logo. It works by filling in the pixels that
  7074. comprise the logo with neighboring pixels.
  7075. The filter accepts the following options:
  7076. @table @option
  7077. @item filename, f
  7078. Set the filter bitmap file, which can be any image format supported by
  7079. libavformat. The width and height of the image file must match those of the
  7080. video stream being processed.
  7081. @end table
  7082. Pixels in the provided bitmap image with a value of zero are not
  7083. considered part of the logo, non-zero pixels are considered part of
  7084. the logo. If you use white (255) for the logo and black (0) for the
  7085. rest, you will be safe. For making the filter bitmap, it is
  7086. recommended to take a screen capture of a black frame with the logo
  7087. visible, and then using a threshold filter followed by the erode
  7088. filter once or twice.
  7089. If needed, little splotches can be fixed manually. Remember that if
  7090. logo pixels are not covered, the filter quality will be much
  7091. reduced. Marking too many pixels as part of the logo does not hurt as
  7092. much, but it will increase the amount of blurring needed to cover over
  7093. the image and will destroy more information than necessary, and extra
  7094. pixels will slow things down on a large logo.
  7095. @section repeatfields
  7096. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  7097. fields based on its value.
  7098. @section reverse, areverse
  7099. Reverse a clip.
  7100. Warning: This filter requires memory to buffer the entire clip, so trimming
  7101. is suggested.
  7102. @subsection Examples
  7103. @itemize
  7104. @item
  7105. Take the first 5 seconds of a clip, and reverse it.
  7106. @example
  7107. trim=end=5,reverse
  7108. @end example
  7109. @end itemize
  7110. @section rotate
  7111. Rotate video by an arbitrary angle expressed in radians.
  7112. The filter accepts the following options:
  7113. A description of the optional parameters follows.
  7114. @table @option
  7115. @item angle, a
  7116. Set an expression for the angle by which to rotate the input video
  7117. clockwise, expressed as a number of radians. A negative value will
  7118. result in a counter-clockwise rotation. By default it is set to "0".
  7119. This expression is evaluated for each frame.
  7120. @item out_w, ow
  7121. Set the output width expression, default value is "iw".
  7122. This expression is evaluated just once during configuration.
  7123. @item out_h, oh
  7124. Set the output height expression, default value is "ih".
  7125. This expression is evaluated just once during configuration.
  7126. @item bilinear
  7127. Enable bilinear interpolation if set to 1, a value of 0 disables
  7128. it. Default value is 1.
  7129. @item fillcolor, c
  7130. Set the color used to fill the output area not covered by the rotated
  7131. image. For the general syntax of this option, check the "Color" section in the
  7132. ffmpeg-utils manual. If the special value "none" is selected then no
  7133. background is printed (useful for example if the background is never shown).
  7134. Default value is "black".
  7135. @end table
  7136. The expressions for the angle and the output size can contain the
  7137. following constants and functions:
  7138. @table @option
  7139. @item n
  7140. sequential number of the input frame, starting from 0. It is always NAN
  7141. before the first frame is filtered.
  7142. @item t
  7143. time in seconds of the input frame, it is set to 0 when the filter is
  7144. configured. It is always NAN before the first frame is filtered.
  7145. @item hsub
  7146. @item vsub
  7147. horizontal and vertical chroma subsample values. For example for the
  7148. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7149. @item in_w, iw
  7150. @item in_h, ih
  7151. the input video width and height
  7152. @item out_w, ow
  7153. @item out_h, oh
  7154. the output width and height, that is the size of the padded area as
  7155. specified by the @var{width} and @var{height} expressions
  7156. @item rotw(a)
  7157. @item roth(a)
  7158. the minimal width/height required for completely containing the input
  7159. video rotated by @var{a} radians.
  7160. These are only available when computing the @option{out_w} and
  7161. @option{out_h} expressions.
  7162. @end table
  7163. @subsection Examples
  7164. @itemize
  7165. @item
  7166. Rotate the input by PI/6 radians clockwise:
  7167. @example
  7168. rotate=PI/6
  7169. @end example
  7170. @item
  7171. Rotate the input by PI/6 radians counter-clockwise:
  7172. @example
  7173. rotate=-PI/6
  7174. @end example
  7175. @item
  7176. Rotate the input by 45 degrees clockwise:
  7177. @example
  7178. rotate=45*PI/180
  7179. @end example
  7180. @item
  7181. Apply a constant rotation with period T, starting from an angle of PI/3:
  7182. @example
  7183. rotate=PI/3+2*PI*t/T
  7184. @end example
  7185. @item
  7186. Make the input video rotation oscillating with a period of T
  7187. seconds and an amplitude of A radians:
  7188. @example
  7189. rotate=A*sin(2*PI/T*t)
  7190. @end example
  7191. @item
  7192. Rotate the video, output size is chosen so that the whole rotating
  7193. input video is always completely contained in the output:
  7194. @example
  7195. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  7196. @end example
  7197. @item
  7198. Rotate the video, reduce the output size so that no background is ever
  7199. shown:
  7200. @example
  7201. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  7202. @end example
  7203. @end itemize
  7204. @subsection Commands
  7205. The filter supports the following commands:
  7206. @table @option
  7207. @item a, angle
  7208. Set the angle expression.
  7209. The command accepts the same syntax of the corresponding option.
  7210. If the specified expression is not valid, it is kept at its current
  7211. value.
  7212. @end table
  7213. @section sab
  7214. Apply Shape Adaptive Blur.
  7215. The filter accepts the following options:
  7216. @table @option
  7217. @item luma_radius, lr
  7218. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  7219. value is 1.0. A greater value will result in a more blurred image, and
  7220. in slower processing.
  7221. @item luma_pre_filter_radius, lpfr
  7222. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  7223. value is 1.0.
  7224. @item luma_strength, ls
  7225. Set luma maximum difference between pixels to still be considered, must
  7226. be a value in the 0.1-100.0 range, default value is 1.0.
  7227. @item chroma_radius, cr
  7228. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  7229. greater value will result in a more blurred image, and in slower
  7230. processing.
  7231. @item chroma_pre_filter_radius, cpfr
  7232. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  7233. @item chroma_strength, cs
  7234. Set chroma maximum difference between pixels to still be considered,
  7235. must be a value in the 0.1-100.0 range.
  7236. @end table
  7237. Each chroma option value, if not explicitly specified, is set to the
  7238. corresponding luma option value.
  7239. @anchor{scale}
  7240. @section scale
  7241. Scale (resize) the input video, using the libswscale library.
  7242. The scale filter forces the output display aspect ratio to be the same
  7243. of the input, by changing the output sample aspect ratio.
  7244. If the input image format is different from the format requested by
  7245. the next filter, the scale filter will convert the input to the
  7246. requested format.
  7247. @subsection Options
  7248. The filter accepts the following options, or any of the options
  7249. supported by the libswscale scaler.
  7250. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  7251. the complete list of scaler options.
  7252. @table @option
  7253. @item width, w
  7254. @item height, h
  7255. Set the output video dimension expression. Default value is the input
  7256. dimension.
  7257. If the value is 0, the input width is used for the output.
  7258. If one of the values is -1, the scale filter will use a value that
  7259. maintains the aspect ratio of the input image, calculated from the
  7260. other specified dimension. If both of them are -1, the input size is
  7261. used
  7262. If one of the values is -n with n > 1, the scale filter will also use a value
  7263. that maintains the aspect ratio of the input image, calculated from the other
  7264. specified dimension. After that it will, however, make sure that the calculated
  7265. dimension is divisible by n and adjust the value if necessary.
  7266. See below for the list of accepted constants for use in the dimension
  7267. expression.
  7268. @item interl
  7269. Set the interlacing mode. It accepts the following values:
  7270. @table @samp
  7271. @item 1
  7272. Force interlaced aware scaling.
  7273. @item 0
  7274. Do not apply interlaced scaling.
  7275. @item -1
  7276. Select interlaced aware scaling depending on whether the source frames
  7277. are flagged as interlaced or not.
  7278. @end table
  7279. Default value is @samp{0}.
  7280. @item flags
  7281. Set libswscale scaling flags. See
  7282. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  7283. complete list of values. If not explicitly specified the filter applies
  7284. the default flags.
  7285. @item size, s
  7286. Set the video size. For the syntax of this option, check the
  7287. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7288. @item in_color_matrix
  7289. @item out_color_matrix
  7290. Set in/output YCbCr color space type.
  7291. This allows the autodetected value to be overridden as well as allows forcing
  7292. a specific value used for the output and encoder.
  7293. If not specified, the color space type depends on the pixel format.
  7294. Possible values:
  7295. @table @samp
  7296. @item auto
  7297. Choose automatically.
  7298. @item bt709
  7299. Format conforming to International Telecommunication Union (ITU)
  7300. Recommendation BT.709.
  7301. @item fcc
  7302. Set color space conforming to the United States Federal Communications
  7303. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  7304. @item bt601
  7305. Set color space conforming to:
  7306. @itemize
  7307. @item
  7308. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  7309. @item
  7310. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  7311. @item
  7312. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  7313. @end itemize
  7314. @item smpte240m
  7315. Set color space conforming to SMPTE ST 240:1999.
  7316. @end table
  7317. @item in_range
  7318. @item out_range
  7319. Set in/output YCbCr sample range.
  7320. This allows the autodetected value to be overridden as well as allows forcing
  7321. a specific value used for the output and encoder. If not specified, the
  7322. range depends on the pixel format. Possible values:
  7323. @table @samp
  7324. @item auto
  7325. Choose automatically.
  7326. @item jpeg/full/pc
  7327. Set full range (0-255 in case of 8-bit luma).
  7328. @item mpeg/tv
  7329. Set "MPEG" range (16-235 in case of 8-bit luma).
  7330. @end table
  7331. @item force_original_aspect_ratio
  7332. Enable decreasing or increasing output video width or height if necessary to
  7333. keep the original aspect ratio. Possible values:
  7334. @table @samp
  7335. @item disable
  7336. Scale the video as specified and disable this feature.
  7337. @item decrease
  7338. The output video dimensions will automatically be decreased if needed.
  7339. @item increase
  7340. The output video dimensions will automatically be increased if needed.
  7341. @end table
  7342. One useful instance of this option is that when you know a specific device's
  7343. maximum allowed resolution, you can use this to limit the output video to
  7344. that, while retaining the aspect ratio. For example, device A allows
  7345. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  7346. decrease) and specifying 1280x720 to the command line makes the output
  7347. 1280x533.
  7348. Please note that this is a different thing than specifying -1 for @option{w}
  7349. or @option{h}, you still need to specify the output resolution for this option
  7350. to work.
  7351. @end table
  7352. The values of the @option{w} and @option{h} options are expressions
  7353. containing the following constants:
  7354. @table @var
  7355. @item in_w
  7356. @item in_h
  7357. The input width and height
  7358. @item iw
  7359. @item ih
  7360. These are the same as @var{in_w} and @var{in_h}.
  7361. @item out_w
  7362. @item out_h
  7363. The output (scaled) width and height
  7364. @item ow
  7365. @item oh
  7366. These are the same as @var{out_w} and @var{out_h}
  7367. @item a
  7368. The same as @var{iw} / @var{ih}
  7369. @item sar
  7370. input sample aspect ratio
  7371. @item dar
  7372. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  7373. @item hsub
  7374. @item vsub
  7375. horizontal and vertical input chroma subsample values. For example for the
  7376. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7377. @item ohsub
  7378. @item ovsub
  7379. horizontal and vertical output chroma subsample values. For example for the
  7380. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7381. @end table
  7382. @subsection Examples
  7383. @itemize
  7384. @item
  7385. Scale the input video to a size of 200x100
  7386. @example
  7387. scale=w=200:h=100
  7388. @end example
  7389. This is equivalent to:
  7390. @example
  7391. scale=200:100
  7392. @end example
  7393. or:
  7394. @example
  7395. scale=200x100
  7396. @end example
  7397. @item
  7398. Specify a size abbreviation for the output size:
  7399. @example
  7400. scale=qcif
  7401. @end example
  7402. which can also be written as:
  7403. @example
  7404. scale=size=qcif
  7405. @end example
  7406. @item
  7407. Scale the input to 2x:
  7408. @example
  7409. scale=w=2*iw:h=2*ih
  7410. @end example
  7411. @item
  7412. The above is the same as:
  7413. @example
  7414. scale=2*in_w:2*in_h
  7415. @end example
  7416. @item
  7417. Scale the input to 2x with forced interlaced scaling:
  7418. @example
  7419. scale=2*iw:2*ih:interl=1
  7420. @end example
  7421. @item
  7422. Scale the input to half size:
  7423. @example
  7424. scale=w=iw/2:h=ih/2
  7425. @end example
  7426. @item
  7427. Increase the width, and set the height to the same size:
  7428. @example
  7429. scale=3/2*iw:ow
  7430. @end example
  7431. @item
  7432. Seek Greek harmony:
  7433. @example
  7434. scale=iw:1/PHI*iw
  7435. scale=ih*PHI:ih
  7436. @end example
  7437. @item
  7438. Increase the height, and set the width to 3/2 of the height:
  7439. @example
  7440. scale=w=3/2*oh:h=3/5*ih
  7441. @end example
  7442. @item
  7443. Increase the size, making the size a multiple of the chroma
  7444. subsample values:
  7445. @example
  7446. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  7447. @end example
  7448. @item
  7449. Increase the width to a maximum of 500 pixels,
  7450. keeping the same aspect ratio as the input:
  7451. @example
  7452. scale=w='min(500\, iw*3/2):h=-1'
  7453. @end example
  7454. @end itemize
  7455. @subsection Commands
  7456. This filter supports the following commands:
  7457. @table @option
  7458. @item width, w
  7459. @item height, h
  7460. Set the output video dimension expression.
  7461. The command accepts the same syntax of the corresponding option.
  7462. If the specified expression is not valid, it is kept at its current
  7463. value.
  7464. @end table
  7465. @section scale2ref
  7466. Scale (resize) the input video, based on a reference video.
  7467. See the scale filter for available options, scale2ref supports the same but
  7468. uses the reference video instead of the main input as basis.
  7469. @subsection Examples
  7470. @itemize
  7471. @item
  7472. Scale a subtitle stream to match the main video in size before overlaying
  7473. @example
  7474. 'scale2ref[b][a];[a][b]overlay'
  7475. @end example
  7476. @end itemize
  7477. @section separatefields
  7478. The @code{separatefields} takes a frame-based video input and splits
  7479. each frame into its components fields, producing a new half height clip
  7480. with twice the frame rate and twice the frame count.
  7481. This filter use field-dominance information in frame to decide which
  7482. of each pair of fields to place first in the output.
  7483. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  7484. @section setdar, setsar
  7485. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  7486. output video.
  7487. This is done by changing the specified Sample (aka Pixel) Aspect
  7488. Ratio, according to the following equation:
  7489. @example
  7490. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  7491. @end example
  7492. Keep in mind that the @code{setdar} filter does not modify the pixel
  7493. dimensions of the video frame. Also, the display aspect ratio set by
  7494. this filter may be changed by later filters in the filterchain,
  7495. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  7496. applied.
  7497. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  7498. the filter output video.
  7499. Note that as a consequence of the application of this filter, the
  7500. output display aspect ratio will change according to the equation
  7501. above.
  7502. Keep in mind that the sample aspect ratio set by the @code{setsar}
  7503. filter may be changed by later filters in the filterchain, e.g. if
  7504. another "setsar" or a "setdar" filter is applied.
  7505. It accepts the following parameters:
  7506. @table @option
  7507. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  7508. Set the aspect ratio used by the filter.
  7509. The parameter can be a floating point number string, an expression, or
  7510. a string of the form @var{num}:@var{den}, where @var{num} and
  7511. @var{den} are the numerator and denominator of the aspect ratio. If
  7512. the parameter is not specified, it is assumed the value "0".
  7513. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  7514. should be escaped.
  7515. @item max
  7516. Set the maximum integer value to use for expressing numerator and
  7517. denominator when reducing the expressed aspect ratio to a rational.
  7518. Default value is @code{100}.
  7519. @end table
  7520. The parameter @var{sar} is an expression containing
  7521. the following constants:
  7522. @table @option
  7523. @item E, PI, PHI
  7524. These are approximated values for the mathematical constants e
  7525. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  7526. @item w, h
  7527. The input width and height.
  7528. @item a
  7529. These are the same as @var{w} / @var{h}.
  7530. @item sar
  7531. The input sample aspect ratio.
  7532. @item dar
  7533. The input display aspect ratio. It is the same as
  7534. (@var{w} / @var{h}) * @var{sar}.
  7535. @item hsub, vsub
  7536. Horizontal and vertical chroma subsample values. For example, for the
  7537. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7538. @end table
  7539. @subsection Examples
  7540. @itemize
  7541. @item
  7542. To change the display aspect ratio to 16:9, specify one of the following:
  7543. @example
  7544. setdar=dar=1.77777
  7545. setdar=dar=16/9
  7546. setdar=dar=1.77777
  7547. @end example
  7548. @item
  7549. To change the sample aspect ratio to 10:11, specify:
  7550. @example
  7551. setsar=sar=10/11
  7552. @end example
  7553. @item
  7554. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  7555. 1000 in the aspect ratio reduction, use the command:
  7556. @example
  7557. setdar=ratio=16/9:max=1000
  7558. @end example
  7559. @end itemize
  7560. @anchor{setfield}
  7561. @section setfield
  7562. Force field for the output video frame.
  7563. The @code{setfield} filter marks the interlace type field for the
  7564. output frames. It does not change the input frame, but only sets the
  7565. corresponding property, which affects how the frame is treated by
  7566. following filters (e.g. @code{fieldorder} or @code{yadif}).
  7567. The filter accepts the following options:
  7568. @table @option
  7569. @item mode
  7570. Available values are:
  7571. @table @samp
  7572. @item auto
  7573. Keep the same field property.
  7574. @item bff
  7575. Mark the frame as bottom-field-first.
  7576. @item tff
  7577. Mark the frame as top-field-first.
  7578. @item prog
  7579. Mark the frame as progressive.
  7580. @end table
  7581. @end table
  7582. @section showinfo
  7583. Show a line containing various information for each input video frame.
  7584. The input video is not modified.
  7585. The shown line contains a sequence of key/value pairs of the form
  7586. @var{key}:@var{value}.
  7587. The following values are shown in the output:
  7588. @table @option
  7589. @item n
  7590. The (sequential) number of the input frame, starting from 0.
  7591. @item pts
  7592. The Presentation TimeStamp of the input frame, expressed as a number of
  7593. time base units. The time base unit depends on the filter input pad.
  7594. @item pts_time
  7595. The Presentation TimeStamp of the input frame, expressed as a number of
  7596. seconds.
  7597. @item pos
  7598. The position of the frame in the input stream, or -1 if this information is
  7599. unavailable and/or meaningless (for example in case of synthetic video).
  7600. @item fmt
  7601. The pixel format name.
  7602. @item sar
  7603. The sample aspect ratio of the input frame, expressed in the form
  7604. @var{num}/@var{den}.
  7605. @item s
  7606. The size of the input frame. For the syntax of this option, check the
  7607. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7608. @item i
  7609. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  7610. for bottom field first).
  7611. @item iskey
  7612. This is 1 if the frame is a key frame, 0 otherwise.
  7613. @item type
  7614. The picture type of the input frame ("I" for an I-frame, "P" for a
  7615. P-frame, "B" for a B-frame, or "?" for an unknown type).
  7616. Also refer to the documentation of the @code{AVPictureType} enum and of
  7617. the @code{av_get_picture_type_char} function defined in
  7618. @file{libavutil/avutil.h}.
  7619. @item checksum
  7620. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  7621. @item plane_checksum
  7622. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  7623. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  7624. @end table
  7625. @section showpalette
  7626. Displays the 256 colors palette of each frame. This filter is only relevant for
  7627. @var{pal8} pixel format frames.
  7628. It accepts the following option:
  7629. @table @option
  7630. @item s
  7631. Set the size of the box used to represent one palette color entry. Default is
  7632. @code{30} (for a @code{30x30} pixel box).
  7633. @end table
  7634. @section shuffleframes
  7635. Reorder and/or duplicate video frames.
  7636. It accepts the following parameters:
  7637. @table @option
  7638. @item mapping
  7639. Set the destination indexes of input frames.
  7640. This is space or '|' separated list of indexes that maps input frames to output
  7641. frames. Number of indexes also sets maximal value that each index may have.
  7642. @end table
  7643. The first frame has the index 0. The default is to keep the input unchanged.
  7644. Swap second and third frame of every three frames of the input:
  7645. @example
  7646. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  7647. @end example
  7648. @section shuffleplanes
  7649. Reorder and/or duplicate video planes.
  7650. It accepts the following parameters:
  7651. @table @option
  7652. @item map0
  7653. The index of the input plane to be used as the first output plane.
  7654. @item map1
  7655. The index of the input plane to be used as the second output plane.
  7656. @item map2
  7657. The index of the input plane to be used as the third output plane.
  7658. @item map3
  7659. The index of the input plane to be used as the fourth output plane.
  7660. @end table
  7661. The first plane has the index 0. The default is to keep the input unchanged.
  7662. Swap the second and third planes of the input:
  7663. @example
  7664. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  7665. @end example
  7666. @anchor{signalstats}
  7667. @section signalstats
  7668. Evaluate various visual metrics that assist in determining issues associated
  7669. with the digitization of analog video media.
  7670. By default the filter will log these metadata values:
  7671. @table @option
  7672. @item YMIN
  7673. Display the minimal Y value contained within the input frame. Expressed in
  7674. range of [0-255].
  7675. @item YLOW
  7676. Display the Y value at the 10% percentile within the input frame. Expressed in
  7677. range of [0-255].
  7678. @item YAVG
  7679. Display the average Y value within the input frame. Expressed in range of
  7680. [0-255].
  7681. @item YHIGH
  7682. Display the Y value at the 90% percentile within the input frame. Expressed in
  7683. range of [0-255].
  7684. @item YMAX
  7685. Display the maximum Y value contained within the input frame. Expressed in
  7686. range of [0-255].
  7687. @item UMIN
  7688. Display the minimal U value contained within the input frame. Expressed in
  7689. range of [0-255].
  7690. @item ULOW
  7691. Display the U value at the 10% percentile within the input frame. Expressed in
  7692. range of [0-255].
  7693. @item UAVG
  7694. Display the average U value within the input frame. Expressed in range of
  7695. [0-255].
  7696. @item UHIGH
  7697. Display the U value at the 90% percentile within the input frame. Expressed in
  7698. range of [0-255].
  7699. @item UMAX
  7700. Display the maximum U value contained within the input frame. Expressed in
  7701. range of [0-255].
  7702. @item VMIN
  7703. Display the minimal V value contained within the input frame. Expressed in
  7704. range of [0-255].
  7705. @item VLOW
  7706. Display the V value at the 10% percentile within the input frame. Expressed in
  7707. range of [0-255].
  7708. @item VAVG
  7709. Display the average V value within the input frame. Expressed in range of
  7710. [0-255].
  7711. @item VHIGH
  7712. Display the V value at the 90% percentile within the input frame. Expressed in
  7713. range of [0-255].
  7714. @item VMAX
  7715. Display the maximum V value contained within the input frame. Expressed in
  7716. range of [0-255].
  7717. @item SATMIN
  7718. Display the minimal saturation value contained within the input frame.
  7719. Expressed in range of [0-~181.02].
  7720. @item SATLOW
  7721. Display the saturation value at the 10% percentile within the input frame.
  7722. Expressed in range of [0-~181.02].
  7723. @item SATAVG
  7724. Display the average saturation value within the input frame. Expressed in range
  7725. of [0-~181.02].
  7726. @item SATHIGH
  7727. Display the saturation value at the 90% percentile within the input frame.
  7728. Expressed in range of [0-~181.02].
  7729. @item SATMAX
  7730. Display the maximum saturation value contained within the input frame.
  7731. Expressed in range of [0-~181.02].
  7732. @item HUEMED
  7733. Display the median value for hue within the input frame. Expressed in range of
  7734. [0-360].
  7735. @item HUEAVG
  7736. Display the average value for hue within the input frame. Expressed in range of
  7737. [0-360].
  7738. @item YDIF
  7739. Display the average of sample value difference between all values of the Y
  7740. plane in the current frame and corresponding values of the previous input frame.
  7741. Expressed in range of [0-255].
  7742. @item UDIF
  7743. Display the average of sample value difference between all values of the U
  7744. plane in the current frame and corresponding values of the previous input frame.
  7745. Expressed in range of [0-255].
  7746. @item VDIF
  7747. Display the average of sample value difference between all values of the V
  7748. plane in the current frame and corresponding values of the previous input frame.
  7749. Expressed in range of [0-255].
  7750. @end table
  7751. The filter accepts the following options:
  7752. @table @option
  7753. @item stat
  7754. @item out
  7755. @option{stat} specify an additional form of image analysis.
  7756. @option{out} output video with the specified type of pixel highlighted.
  7757. Both options accept the following values:
  7758. @table @samp
  7759. @item tout
  7760. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  7761. unlike the neighboring pixels of the same field. Examples of temporal outliers
  7762. include the results of video dropouts, head clogs, or tape tracking issues.
  7763. @item vrep
  7764. Identify @var{vertical line repetition}. Vertical line repetition includes
  7765. similar rows of pixels within a frame. In born-digital video vertical line
  7766. repetition is common, but this pattern is uncommon in video digitized from an
  7767. analog source. When it occurs in video that results from the digitization of an
  7768. analog source it can indicate concealment from a dropout compensator.
  7769. @item brng
  7770. Identify pixels that fall outside of legal broadcast range.
  7771. @end table
  7772. @item color, c
  7773. Set the highlight color for the @option{out} option. The default color is
  7774. yellow.
  7775. @end table
  7776. @subsection Examples
  7777. @itemize
  7778. @item
  7779. Output data of various video metrics:
  7780. @example
  7781. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  7782. @end example
  7783. @item
  7784. Output specific data about the minimum and maximum values of the Y plane per frame:
  7785. @example
  7786. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  7787. @end example
  7788. @item
  7789. Playback video while highlighting pixels that are outside of broadcast range in red.
  7790. @example
  7791. ffplay example.mov -vf signalstats="out=brng:color=red"
  7792. @end example
  7793. @item
  7794. Playback video with signalstats metadata drawn over the frame.
  7795. @example
  7796. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  7797. @end example
  7798. The contents of signalstat_drawtext.txt used in the command are:
  7799. @example
  7800. time %@{pts:hms@}
  7801. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  7802. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  7803. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  7804. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  7805. @end example
  7806. @end itemize
  7807. @anchor{smartblur}
  7808. @section smartblur
  7809. Blur the input video without impacting the outlines.
  7810. It accepts the following options:
  7811. @table @option
  7812. @item luma_radius, lr
  7813. Set the luma radius. The option value must be a float number in
  7814. the range [0.1,5.0] that specifies the variance of the gaussian filter
  7815. used to blur the image (slower if larger). Default value is 1.0.
  7816. @item luma_strength, ls
  7817. Set the luma strength. The option value must be a float number
  7818. in the range [-1.0,1.0] that configures the blurring. A value included
  7819. in [0.0,1.0] will blur the image whereas a value included in
  7820. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  7821. @item luma_threshold, lt
  7822. Set the luma threshold used as a coefficient to determine
  7823. whether a pixel should be blurred or not. The option value must be an
  7824. integer in the range [-30,30]. A value of 0 will filter all the image,
  7825. a value included in [0,30] will filter flat areas and a value included
  7826. in [-30,0] will filter edges. Default value is 0.
  7827. @item chroma_radius, cr
  7828. Set the chroma radius. The option value must be a float number in
  7829. the range [0.1,5.0] that specifies the variance of the gaussian filter
  7830. used to blur the image (slower if larger). Default value is 1.0.
  7831. @item chroma_strength, cs
  7832. Set the chroma strength. The option value must be a float number
  7833. in the range [-1.0,1.0] that configures the blurring. A value included
  7834. in [0.0,1.0] will blur the image whereas a value included in
  7835. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  7836. @item chroma_threshold, ct
  7837. Set the chroma threshold used as a coefficient to determine
  7838. whether a pixel should be blurred or not. The option value must be an
  7839. integer in the range [-30,30]. A value of 0 will filter all the image,
  7840. a value included in [0,30] will filter flat areas and a value included
  7841. in [-30,0] will filter edges. Default value is 0.
  7842. @end table
  7843. If a chroma option is not explicitly set, the corresponding luma value
  7844. is set.
  7845. @section ssim
  7846. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  7847. This filter takes in input two input videos, the first input is
  7848. considered the "main" source and is passed unchanged to the
  7849. output. The second input is used as a "reference" video for computing
  7850. the SSIM.
  7851. Both video inputs must have the same resolution and pixel format for
  7852. this filter to work correctly. Also it assumes that both inputs
  7853. have the same number of frames, which are compared one by one.
  7854. The filter stores the calculated SSIM of each frame.
  7855. The description of the accepted parameters follows.
  7856. @table @option
  7857. @item stats_file, f
  7858. If specified the filter will use the named file to save the SSIM of
  7859. each individual frame. When filename equals "-" the data is sent to
  7860. standard output.
  7861. @end table
  7862. The file printed if @var{stats_file} is selected, contains a sequence of
  7863. key/value pairs of the form @var{key}:@var{value} for each compared
  7864. couple of frames.
  7865. A description of each shown parameter follows:
  7866. @table @option
  7867. @item n
  7868. sequential number of the input frame, starting from 1
  7869. @item Y, U, V, R, G, B
  7870. SSIM of the compared frames for the component specified by the suffix.
  7871. @item All
  7872. SSIM of the compared frames for the whole frame.
  7873. @item dB
  7874. Same as above but in dB representation.
  7875. @end table
  7876. For example:
  7877. @example
  7878. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7879. [main][ref] ssim="stats_file=stats.log" [out]
  7880. @end example
  7881. On this example the input file being processed is compared with the
  7882. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  7883. is stored in @file{stats.log}.
  7884. Another example with both psnr and ssim at same time:
  7885. @example
  7886. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  7887. @end example
  7888. @section stereo3d
  7889. Convert between different stereoscopic image formats.
  7890. The filters accept the following options:
  7891. @table @option
  7892. @item in
  7893. Set stereoscopic image format of input.
  7894. Available values for input image formats are:
  7895. @table @samp
  7896. @item sbsl
  7897. side by side parallel (left eye left, right eye right)
  7898. @item sbsr
  7899. side by side crosseye (right eye left, left eye right)
  7900. @item sbs2l
  7901. side by side parallel with half width resolution
  7902. (left eye left, right eye right)
  7903. @item sbs2r
  7904. side by side crosseye with half width resolution
  7905. (right eye left, left eye right)
  7906. @item abl
  7907. above-below (left eye above, right eye below)
  7908. @item abr
  7909. above-below (right eye above, left eye below)
  7910. @item ab2l
  7911. above-below with half height resolution
  7912. (left eye above, right eye below)
  7913. @item ab2r
  7914. above-below with half height resolution
  7915. (right eye above, left eye below)
  7916. @item al
  7917. alternating frames (left eye first, right eye second)
  7918. @item ar
  7919. alternating frames (right eye first, left eye second)
  7920. @item irl
  7921. interleaved rows (left eye has top row, right eye starts on next row)
  7922. @item irr
  7923. interleaved rows (right eye has top row, left eye starts on next row)
  7924. Default value is @samp{sbsl}.
  7925. @end table
  7926. @item out
  7927. Set stereoscopic image format of output.
  7928. Available values for output image formats are all the input formats as well as:
  7929. @table @samp
  7930. @item arbg
  7931. anaglyph red/blue gray
  7932. (red filter on left eye, blue filter on right eye)
  7933. @item argg
  7934. anaglyph red/green gray
  7935. (red filter on left eye, green filter on right eye)
  7936. @item arcg
  7937. anaglyph red/cyan gray
  7938. (red filter on left eye, cyan filter on right eye)
  7939. @item arch
  7940. anaglyph red/cyan half colored
  7941. (red filter on left eye, cyan filter on right eye)
  7942. @item arcc
  7943. anaglyph red/cyan color
  7944. (red filter on left eye, cyan filter on right eye)
  7945. @item arcd
  7946. anaglyph red/cyan color optimized with the least squares projection of dubois
  7947. (red filter on left eye, cyan filter on right eye)
  7948. @item agmg
  7949. anaglyph green/magenta gray
  7950. (green filter on left eye, magenta filter on right eye)
  7951. @item agmh
  7952. anaglyph green/magenta half colored
  7953. (green filter on left eye, magenta filter on right eye)
  7954. @item agmc
  7955. anaglyph green/magenta colored
  7956. (green filter on left eye, magenta filter on right eye)
  7957. @item agmd
  7958. anaglyph green/magenta color optimized with the least squares projection of dubois
  7959. (green filter on left eye, magenta filter on right eye)
  7960. @item aybg
  7961. anaglyph yellow/blue gray
  7962. (yellow filter on left eye, blue filter on right eye)
  7963. @item aybh
  7964. anaglyph yellow/blue half colored
  7965. (yellow filter on left eye, blue filter on right eye)
  7966. @item aybc
  7967. anaglyph yellow/blue colored
  7968. (yellow filter on left eye, blue filter on right eye)
  7969. @item aybd
  7970. anaglyph yellow/blue color optimized with the least squares projection of dubois
  7971. (yellow filter on left eye, blue filter on right eye)
  7972. @item ml
  7973. mono output (left eye only)
  7974. @item mr
  7975. mono output (right eye only)
  7976. @item chl
  7977. checkerboard, left eye first
  7978. @item chr
  7979. checkerboard, right eye first
  7980. @item icl
  7981. interleaved columns, left eye first
  7982. @item icr
  7983. interleaved columns, right eye first
  7984. @end table
  7985. Default value is @samp{arcd}.
  7986. @end table
  7987. @subsection Examples
  7988. @itemize
  7989. @item
  7990. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  7991. @example
  7992. stereo3d=sbsl:aybd
  7993. @end example
  7994. @item
  7995. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  7996. @example
  7997. stereo3d=abl:sbsr
  7998. @end example
  7999. @end itemize
  8000. @anchor{spp}
  8001. @section spp
  8002. Apply a simple postprocessing filter that compresses and decompresses the image
  8003. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  8004. and average the results.
  8005. The filter accepts the following options:
  8006. @table @option
  8007. @item quality
  8008. Set quality. This option defines the number of levels for averaging. It accepts
  8009. an integer in the range 0-6. If set to @code{0}, the filter will have no
  8010. effect. A value of @code{6} means the higher quality. For each increment of
  8011. that value the speed drops by a factor of approximately 2. Default value is
  8012. @code{3}.
  8013. @item qp
  8014. Force a constant quantization parameter. If not set, the filter will use the QP
  8015. from the video stream (if available).
  8016. @item mode
  8017. Set thresholding mode. Available modes are:
  8018. @table @samp
  8019. @item hard
  8020. Set hard thresholding (default).
  8021. @item soft
  8022. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8023. @end table
  8024. @item use_bframe_qp
  8025. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8026. option may cause flicker since the B-Frames have often larger QP. Default is
  8027. @code{0} (not enabled).
  8028. @end table
  8029. @anchor{subtitles}
  8030. @section subtitles
  8031. Draw subtitles on top of input video using the libass library.
  8032. To enable compilation of this filter you need to configure FFmpeg with
  8033. @code{--enable-libass}. This filter also requires a build with libavcodec and
  8034. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  8035. Alpha) subtitles format.
  8036. The filter accepts the following options:
  8037. @table @option
  8038. @item filename, f
  8039. Set the filename of the subtitle file to read. It must be specified.
  8040. @item original_size
  8041. Specify the size of the original video, the video for which the ASS file
  8042. was composed. For the syntax of this option, check the
  8043. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8044. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  8045. correctly scale the fonts if the aspect ratio has been changed.
  8046. @item fontsdir
  8047. Set a directory path containing fonts that can be used by the filter.
  8048. These fonts will be used in addition to whatever the font provider uses.
  8049. @item charenc
  8050. Set subtitles input character encoding. @code{subtitles} filter only. Only
  8051. useful if not UTF-8.
  8052. @item stream_index, si
  8053. Set subtitles stream index. @code{subtitles} filter only.
  8054. @item force_style
  8055. Override default style or script info parameters of the subtitles. It accepts a
  8056. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  8057. @end table
  8058. If the first key is not specified, it is assumed that the first value
  8059. specifies the @option{filename}.
  8060. For example, to render the file @file{sub.srt} on top of the input
  8061. video, use the command:
  8062. @example
  8063. subtitles=sub.srt
  8064. @end example
  8065. which is equivalent to:
  8066. @example
  8067. subtitles=filename=sub.srt
  8068. @end example
  8069. To render the default subtitles stream from file @file{video.mkv}, use:
  8070. @example
  8071. subtitles=video.mkv
  8072. @end example
  8073. To render the second subtitles stream from that file, use:
  8074. @example
  8075. subtitles=video.mkv:si=1
  8076. @end example
  8077. To make the subtitles stream from @file{sub.srt} appear in transparent green
  8078. @code{DejaVu Serif}, use:
  8079. @example
  8080. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  8081. @end example
  8082. @section super2xsai
  8083. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  8084. Interpolate) pixel art scaling algorithm.
  8085. Useful for enlarging pixel art images without reducing sharpness.
  8086. @section swapuv
  8087. Swap U & V plane.
  8088. @section telecine
  8089. Apply telecine process to the video.
  8090. This filter accepts the following options:
  8091. @table @option
  8092. @item first_field
  8093. @table @samp
  8094. @item top, t
  8095. top field first
  8096. @item bottom, b
  8097. bottom field first
  8098. The default value is @code{top}.
  8099. @end table
  8100. @item pattern
  8101. A string of numbers representing the pulldown pattern you wish to apply.
  8102. The default value is @code{23}.
  8103. @end table
  8104. @example
  8105. Some typical patterns:
  8106. NTSC output (30i):
  8107. 27.5p: 32222
  8108. 24p: 23 (classic)
  8109. 24p: 2332 (preferred)
  8110. 20p: 33
  8111. 18p: 334
  8112. 16p: 3444
  8113. PAL output (25i):
  8114. 27.5p: 12222
  8115. 24p: 222222222223 ("Euro pulldown")
  8116. 16.67p: 33
  8117. 16p: 33333334
  8118. @end example
  8119. @section thumbnail
  8120. Select the most representative frame in a given sequence of consecutive frames.
  8121. The filter accepts the following options:
  8122. @table @option
  8123. @item n
  8124. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  8125. will pick one of them, and then handle the next batch of @var{n} frames until
  8126. the end. Default is @code{100}.
  8127. @end table
  8128. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  8129. value will result in a higher memory usage, so a high value is not recommended.
  8130. @subsection Examples
  8131. @itemize
  8132. @item
  8133. Extract one picture each 50 frames:
  8134. @example
  8135. thumbnail=50
  8136. @end example
  8137. @item
  8138. Complete example of a thumbnail creation with @command{ffmpeg}:
  8139. @example
  8140. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  8141. @end example
  8142. @end itemize
  8143. @section tile
  8144. Tile several successive frames together.
  8145. The filter accepts the following options:
  8146. @table @option
  8147. @item layout
  8148. Set the grid size (i.e. the number of lines and columns). For the syntax of
  8149. this option, check the
  8150. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8151. @item nb_frames
  8152. Set the maximum number of frames to render in the given area. It must be less
  8153. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  8154. the area will be used.
  8155. @item margin
  8156. Set the outer border margin in pixels.
  8157. @item padding
  8158. Set the inner border thickness (i.e. the number of pixels between frames). For
  8159. more advanced padding options (such as having different values for the edges),
  8160. refer to the pad video filter.
  8161. @item color
  8162. Specify the color of the unused area. For the syntax of this option, check the
  8163. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  8164. is "black".
  8165. @end table
  8166. @subsection Examples
  8167. @itemize
  8168. @item
  8169. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  8170. @example
  8171. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  8172. @end example
  8173. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  8174. duplicating each output frame to accommodate the originally detected frame
  8175. rate.
  8176. @item
  8177. Display @code{5} pictures in an area of @code{3x2} frames,
  8178. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  8179. mixed flat and named options:
  8180. @example
  8181. tile=3x2:nb_frames=5:padding=7:margin=2
  8182. @end example
  8183. @end itemize
  8184. @section tinterlace
  8185. Perform various types of temporal field interlacing.
  8186. Frames are counted starting from 1, so the first input frame is
  8187. considered odd.
  8188. The filter accepts the following options:
  8189. @table @option
  8190. @item mode
  8191. Specify the mode of the interlacing. This option can also be specified
  8192. as a value alone. See below for a list of values for this option.
  8193. Available values are:
  8194. @table @samp
  8195. @item merge, 0
  8196. Move odd frames into the upper field, even into the lower field,
  8197. generating a double height frame at half frame rate.
  8198. @example
  8199. ------> time
  8200. Input:
  8201. Frame 1 Frame 2 Frame 3 Frame 4
  8202. 11111 22222 33333 44444
  8203. 11111 22222 33333 44444
  8204. 11111 22222 33333 44444
  8205. 11111 22222 33333 44444
  8206. Output:
  8207. 11111 33333
  8208. 22222 44444
  8209. 11111 33333
  8210. 22222 44444
  8211. 11111 33333
  8212. 22222 44444
  8213. 11111 33333
  8214. 22222 44444
  8215. @end example
  8216. @item drop_odd, 1
  8217. Only output even frames, odd frames are dropped, generating a frame with
  8218. unchanged height at half frame rate.
  8219. @example
  8220. ------> time
  8221. Input:
  8222. Frame 1 Frame 2 Frame 3 Frame 4
  8223. 11111 22222 33333 44444
  8224. 11111 22222 33333 44444
  8225. 11111 22222 33333 44444
  8226. 11111 22222 33333 44444
  8227. Output:
  8228. 22222 44444
  8229. 22222 44444
  8230. 22222 44444
  8231. 22222 44444
  8232. @end example
  8233. @item drop_even, 2
  8234. Only output odd frames, even frames are dropped, generating a frame with
  8235. unchanged height at half frame rate.
  8236. @example
  8237. ------> time
  8238. Input:
  8239. Frame 1 Frame 2 Frame 3 Frame 4
  8240. 11111 22222 33333 44444
  8241. 11111 22222 33333 44444
  8242. 11111 22222 33333 44444
  8243. 11111 22222 33333 44444
  8244. Output:
  8245. 11111 33333
  8246. 11111 33333
  8247. 11111 33333
  8248. 11111 33333
  8249. @end example
  8250. @item pad, 3
  8251. Expand each frame to full height, but pad alternate lines with black,
  8252. generating a frame with double height at the same input frame rate.
  8253. @example
  8254. ------> time
  8255. Input:
  8256. Frame 1 Frame 2 Frame 3 Frame 4
  8257. 11111 22222 33333 44444
  8258. 11111 22222 33333 44444
  8259. 11111 22222 33333 44444
  8260. 11111 22222 33333 44444
  8261. Output:
  8262. 11111 ..... 33333 .....
  8263. ..... 22222 ..... 44444
  8264. 11111 ..... 33333 .....
  8265. ..... 22222 ..... 44444
  8266. 11111 ..... 33333 .....
  8267. ..... 22222 ..... 44444
  8268. 11111 ..... 33333 .....
  8269. ..... 22222 ..... 44444
  8270. @end example
  8271. @item interleave_top, 4
  8272. Interleave the upper field from odd frames with the lower field from
  8273. even frames, generating a frame with unchanged height at half frame rate.
  8274. @example
  8275. ------> time
  8276. Input:
  8277. Frame 1 Frame 2 Frame 3 Frame 4
  8278. 11111<- 22222 33333<- 44444
  8279. 11111 22222<- 33333 44444<-
  8280. 11111<- 22222 33333<- 44444
  8281. 11111 22222<- 33333 44444<-
  8282. Output:
  8283. 11111 33333
  8284. 22222 44444
  8285. 11111 33333
  8286. 22222 44444
  8287. @end example
  8288. @item interleave_bottom, 5
  8289. Interleave the lower field from odd frames with the upper field from
  8290. even frames, generating a frame with unchanged height at half frame rate.
  8291. @example
  8292. ------> time
  8293. Input:
  8294. Frame 1 Frame 2 Frame 3 Frame 4
  8295. 11111 22222<- 33333 44444<-
  8296. 11111<- 22222 33333<- 44444
  8297. 11111 22222<- 33333 44444<-
  8298. 11111<- 22222 33333<- 44444
  8299. Output:
  8300. 22222 44444
  8301. 11111 33333
  8302. 22222 44444
  8303. 11111 33333
  8304. @end example
  8305. @item interlacex2, 6
  8306. Double frame rate with unchanged height. Frames are inserted each
  8307. containing the second temporal field from the previous input frame and
  8308. the first temporal field from the next input frame. This mode relies on
  8309. the top_field_first flag. Useful for interlaced video displays with no
  8310. field synchronisation.
  8311. @example
  8312. ------> time
  8313. Input:
  8314. Frame 1 Frame 2 Frame 3 Frame 4
  8315. 11111 22222 33333 44444
  8316. 11111 22222 33333 44444
  8317. 11111 22222 33333 44444
  8318. 11111 22222 33333 44444
  8319. Output:
  8320. 11111 22222 22222 33333 33333 44444 44444
  8321. 11111 11111 22222 22222 33333 33333 44444
  8322. 11111 22222 22222 33333 33333 44444 44444
  8323. 11111 11111 22222 22222 33333 33333 44444
  8324. @end example
  8325. @item mergex2, 7
  8326. Move odd frames into the upper field, even into the lower field,
  8327. generating a double height frame at same frame rate.
  8328. @example
  8329. ------> time
  8330. Input:
  8331. Frame 1 Frame 2 Frame 3 Frame 4
  8332. 11111 22222 33333 44444
  8333. 11111 22222 33333 44444
  8334. 11111 22222 33333 44444
  8335. 11111 22222 33333 44444
  8336. Output:
  8337. 11111 33333 33333 55555
  8338. 22222 22222 44444 44444
  8339. 11111 33333 33333 55555
  8340. 22222 22222 44444 44444
  8341. 11111 33333 33333 55555
  8342. 22222 22222 44444 44444
  8343. 11111 33333 33333 55555
  8344. 22222 22222 44444 44444
  8345. @end example
  8346. @end table
  8347. Numeric values are deprecated but are accepted for backward
  8348. compatibility reasons.
  8349. Default mode is @code{merge}.
  8350. @item flags
  8351. Specify flags influencing the filter process.
  8352. Available value for @var{flags} is:
  8353. @table @option
  8354. @item low_pass_filter, vlfp
  8355. Enable vertical low-pass filtering in the filter.
  8356. Vertical low-pass filtering is required when creating an interlaced
  8357. destination from a progressive source which contains high-frequency
  8358. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  8359. patterning.
  8360. Vertical low-pass filtering can only be enabled for @option{mode}
  8361. @var{interleave_top} and @var{interleave_bottom}.
  8362. @end table
  8363. @end table
  8364. @section transpose
  8365. Transpose rows with columns in the input video and optionally flip it.
  8366. It accepts the following parameters:
  8367. @table @option
  8368. @item dir
  8369. Specify the transposition direction.
  8370. Can assume the following values:
  8371. @table @samp
  8372. @item 0, 4, cclock_flip
  8373. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  8374. @example
  8375. L.R L.l
  8376. . . -> . .
  8377. l.r R.r
  8378. @end example
  8379. @item 1, 5, clock
  8380. Rotate by 90 degrees clockwise, that is:
  8381. @example
  8382. L.R l.L
  8383. . . -> . .
  8384. l.r r.R
  8385. @end example
  8386. @item 2, 6, cclock
  8387. Rotate by 90 degrees counterclockwise, that is:
  8388. @example
  8389. L.R R.r
  8390. . . -> . .
  8391. l.r L.l
  8392. @end example
  8393. @item 3, 7, clock_flip
  8394. Rotate by 90 degrees clockwise and vertically flip, that is:
  8395. @example
  8396. L.R r.R
  8397. . . -> . .
  8398. l.r l.L
  8399. @end example
  8400. @end table
  8401. For values between 4-7, the transposition is only done if the input
  8402. video geometry is portrait and not landscape. These values are
  8403. deprecated, the @code{passthrough} option should be used instead.
  8404. Numerical values are deprecated, and should be dropped in favor of
  8405. symbolic constants.
  8406. @item passthrough
  8407. Do not apply the transposition if the input geometry matches the one
  8408. specified by the specified value. It accepts the following values:
  8409. @table @samp
  8410. @item none
  8411. Always apply transposition.
  8412. @item portrait
  8413. Preserve portrait geometry (when @var{height} >= @var{width}).
  8414. @item landscape
  8415. Preserve landscape geometry (when @var{width} >= @var{height}).
  8416. @end table
  8417. Default value is @code{none}.
  8418. @end table
  8419. For example to rotate by 90 degrees clockwise and preserve portrait
  8420. layout:
  8421. @example
  8422. transpose=dir=1:passthrough=portrait
  8423. @end example
  8424. The command above can also be specified as:
  8425. @example
  8426. transpose=1:portrait
  8427. @end example
  8428. @section trim
  8429. Trim the input so that the output contains one continuous subpart of the input.
  8430. It accepts the following parameters:
  8431. @table @option
  8432. @item start
  8433. Specify the time of the start of the kept section, i.e. the frame with the
  8434. timestamp @var{start} will be the first frame in the output.
  8435. @item end
  8436. Specify the time of the first frame that will be dropped, i.e. the frame
  8437. immediately preceding the one with the timestamp @var{end} will be the last
  8438. frame in the output.
  8439. @item start_pts
  8440. This is the same as @var{start}, except this option sets the start timestamp
  8441. in timebase units instead of seconds.
  8442. @item end_pts
  8443. This is the same as @var{end}, except this option sets the end timestamp
  8444. in timebase units instead of seconds.
  8445. @item duration
  8446. The maximum duration of the output in seconds.
  8447. @item start_frame
  8448. The number of the first frame that should be passed to the output.
  8449. @item end_frame
  8450. The number of the first frame that should be dropped.
  8451. @end table
  8452. @option{start}, @option{end}, and @option{duration} are expressed as time
  8453. duration specifications; see
  8454. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  8455. for the accepted syntax.
  8456. Note that the first two sets of the start/end options and the @option{duration}
  8457. option look at the frame timestamp, while the _frame variants simply count the
  8458. frames that pass through the filter. Also note that this filter does not modify
  8459. the timestamps. If you wish for the output timestamps to start at zero, insert a
  8460. setpts filter after the trim filter.
  8461. If multiple start or end options are set, this filter tries to be greedy and
  8462. keep all the frames that match at least one of the specified constraints. To keep
  8463. only the part that matches all the constraints at once, chain multiple trim
  8464. filters.
  8465. The defaults are such that all the input is kept. So it is possible to set e.g.
  8466. just the end values to keep everything before the specified time.
  8467. Examples:
  8468. @itemize
  8469. @item
  8470. Drop everything except the second minute of input:
  8471. @example
  8472. ffmpeg -i INPUT -vf trim=60:120
  8473. @end example
  8474. @item
  8475. Keep only the first second:
  8476. @example
  8477. ffmpeg -i INPUT -vf trim=duration=1
  8478. @end example
  8479. @end itemize
  8480. @anchor{unsharp}
  8481. @section unsharp
  8482. Sharpen or blur the input video.
  8483. It accepts the following parameters:
  8484. @table @option
  8485. @item luma_msize_x, lx
  8486. Set the luma matrix horizontal size. It must be an odd integer between
  8487. 3 and 63. The default value is 5.
  8488. @item luma_msize_y, ly
  8489. Set the luma matrix vertical size. It must be an odd integer between 3
  8490. and 63. The default value is 5.
  8491. @item luma_amount, la
  8492. Set the luma effect strength. It must be a floating point number, reasonable
  8493. values lay between -1.5 and 1.5.
  8494. Negative values will blur the input video, while positive values will
  8495. sharpen it, a value of zero will disable the effect.
  8496. Default value is 1.0.
  8497. @item chroma_msize_x, cx
  8498. Set the chroma matrix horizontal size. It must be an odd integer
  8499. between 3 and 63. The default value is 5.
  8500. @item chroma_msize_y, cy
  8501. Set the chroma matrix vertical size. It must be an odd integer
  8502. between 3 and 63. The default value is 5.
  8503. @item chroma_amount, ca
  8504. Set the chroma effect strength. It must be a floating point number, reasonable
  8505. values lay between -1.5 and 1.5.
  8506. Negative values will blur the input video, while positive values will
  8507. sharpen it, a value of zero will disable the effect.
  8508. Default value is 0.0.
  8509. @item opencl
  8510. If set to 1, specify using OpenCL capabilities, only available if
  8511. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  8512. @end table
  8513. All parameters are optional and default to the equivalent of the
  8514. string '5:5:1.0:5:5:0.0'.
  8515. @subsection Examples
  8516. @itemize
  8517. @item
  8518. Apply strong luma sharpen effect:
  8519. @example
  8520. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  8521. @end example
  8522. @item
  8523. Apply a strong blur of both luma and chroma parameters:
  8524. @example
  8525. unsharp=7:7:-2:7:7:-2
  8526. @end example
  8527. @end itemize
  8528. @section uspp
  8529. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  8530. the image at several (or - in the case of @option{quality} level @code{8} - all)
  8531. shifts and average the results.
  8532. The way this differs from the behavior of spp is that uspp actually encodes &
  8533. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  8534. DCT similar to MJPEG.
  8535. The filter accepts the following options:
  8536. @table @option
  8537. @item quality
  8538. Set quality. This option defines the number of levels for averaging. It accepts
  8539. an integer in the range 0-8. If set to @code{0}, the filter will have no
  8540. effect. A value of @code{8} means the higher quality. For each increment of
  8541. that value the speed drops by a factor of approximately 2. Default value is
  8542. @code{3}.
  8543. @item qp
  8544. Force a constant quantization parameter. If not set, the filter will use the QP
  8545. from the video stream (if available).
  8546. @end table
  8547. @section vectorscope
  8548. Display 2 color component values in the two dimensional graph (which is called
  8549. a vectorscope).
  8550. This filter accepts the following options:
  8551. @table @option
  8552. @item mode, m
  8553. Set vectorscope mode.
  8554. It accepts the following values:
  8555. @table @samp
  8556. @item gray
  8557. Gray values are displayed on graph, higher brightness means more pixels have
  8558. same component color value on location in graph. This is the default mode.
  8559. @item color
  8560. Gray values are displayed on graph. Surrounding pixels values which are not
  8561. present in video frame are drawn in gradient of 2 color components which are
  8562. set by option @code{x} and @code{y}.
  8563. @item color2
  8564. Actual color components values present in video frame are displayed on graph.
  8565. @item color3
  8566. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  8567. on graph increases value of another color component, which is luminance by
  8568. default values of @code{x} and @code{y}.
  8569. @item color4
  8570. Actual colors present in video frame are displayed on graph. If two different
  8571. colors map to same position on graph then color with higher value of component
  8572. not present in graph is picked.
  8573. @end table
  8574. @item x
  8575. Set which color component will be represented on X-axis. Default is @code{1}.
  8576. @item y
  8577. Set which color component will be represented on Y-axis. Default is @code{2}.
  8578. @item intensity, i
  8579. Set intensity, used by modes: gray, color and color3 for increasing brightness
  8580. of color component which represents frequency of (X, Y) location in graph.
  8581. @item envelope, e
  8582. @table @samp
  8583. @item none
  8584. No envelope, this is default.
  8585. @item instant
  8586. Instant envelope, even darkest single pixel will be clearly highlighted.
  8587. @item peak
  8588. Hold maximum and minimum values presented in graph over time. This way you
  8589. can still spot out of range values without constantly looking at vectorscope.
  8590. @item peak+instant
  8591. Peak and instant envelope combined together.
  8592. @end table
  8593. @end table
  8594. @anchor{vidstabdetect}
  8595. @section vidstabdetect
  8596. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  8597. @ref{vidstabtransform} for pass 2.
  8598. This filter generates a file with relative translation and rotation
  8599. transform information about subsequent frames, which is then used by
  8600. the @ref{vidstabtransform} filter.
  8601. To enable compilation of this filter you need to configure FFmpeg with
  8602. @code{--enable-libvidstab}.
  8603. This filter accepts the following options:
  8604. @table @option
  8605. @item result
  8606. Set the path to the file used to write the transforms information.
  8607. Default value is @file{transforms.trf}.
  8608. @item shakiness
  8609. Set how shaky the video is and how quick the camera is. It accepts an
  8610. integer in the range 1-10, a value of 1 means little shakiness, a
  8611. value of 10 means strong shakiness. Default value is 5.
  8612. @item accuracy
  8613. Set the accuracy of the detection process. It must be a value in the
  8614. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  8615. accuracy. Default value is 15.
  8616. @item stepsize
  8617. Set stepsize of the search process. The region around minimum is
  8618. scanned with 1 pixel resolution. Default value is 6.
  8619. @item mincontrast
  8620. Set minimum contrast. Below this value a local measurement field is
  8621. discarded. Must be a floating point value in the range 0-1. Default
  8622. value is 0.3.
  8623. @item tripod
  8624. Set reference frame number for tripod mode.
  8625. If enabled, the motion of the frames is compared to a reference frame
  8626. in the filtered stream, identified by the specified number. The idea
  8627. is to compensate all movements in a more-or-less static scene and keep
  8628. the camera view absolutely still.
  8629. If set to 0, it is disabled. The frames are counted starting from 1.
  8630. @item show
  8631. Show fields and transforms in the resulting frames. It accepts an
  8632. integer in the range 0-2. Default value is 0, which disables any
  8633. visualization.
  8634. @end table
  8635. @subsection Examples
  8636. @itemize
  8637. @item
  8638. Use default values:
  8639. @example
  8640. vidstabdetect
  8641. @end example
  8642. @item
  8643. Analyze strongly shaky movie and put the results in file
  8644. @file{mytransforms.trf}:
  8645. @example
  8646. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  8647. @end example
  8648. @item
  8649. Visualize the result of internal transformations in the resulting
  8650. video:
  8651. @example
  8652. vidstabdetect=show=1
  8653. @end example
  8654. @item
  8655. Analyze a video with medium shakiness using @command{ffmpeg}:
  8656. @example
  8657. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  8658. @end example
  8659. @end itemize
  8660. @anchor{vidstabtransform}
  8661. @section vidstabtransform
  8662. Video stabilization/deshaking: pass 2 of 2,
  8663. see @ref{vidstabdetect} for pass 1.
  8664. Read a file with transform information for each frame and
  8665. apply/compensate them. Together with the @ref{vidstabdetect}
  8666. filter this can be used to deshake videos. See also
  8667. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  8668. the @ref{unsharp} filter, see below.
  8669. To enable compilation of this filter you need to configure FFmpeg with
  8670. @code{--enable-libvidstab}.
  8671. @subsection Options
  8672. @table @option
  8673. @item input
  8674. Set path to the file used to read the transforms. Default value is
  8675. @file{transforms.trf}.
  8676. @item smoothing
  8677. Set the number of frames (value*2 + 1) used for lowpass filtering the
  8678. camera movements. Default value is 10.
  8679. For example a number of 10 means that 21 frames are used (10 in the
  8680. past and 10 in the future) to smoothen the motion in the video. A
  8681. larger value leads to a smoother video, but limits the acceleration of
  8682. the camera (pan/tilt movements). 0 is a special case where a static
  8683. camera is simulated.
  8684. @item optalgo
  8685. Set the camera path optimization algorithm.
  8686. Accepted values are:
  8687. @table @samp
  8688. @item gauss
  8689. gaussian kernel low-pass filter on camera motion (default)
  8690. @item avg
  8691. averaging on transformations
  8692. @end table
  8693. @item maxshift
  8694. Set maximal number of pixels to translate frames. Default value is -1,
  8695. meaning no limit.
  8696. @item maxangle
  8697. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  8698. value is -1, meaning no limit.
  8699. @item crop
  8700. Specify how to deal with borders that may be visible due to movement
  8701. compensation.
  8702. Available values are:
  8703. @table @samp
  8704. @item keep
  8705. keep image information from previous frame (default)
  8706. @item black
  8707. fill the border black
  8708. @end table
  8709. @item invert
  8710. Invert transforms if set to 1. Default value is 0.
  8711. @item relative
  8712. Consider transforms as relative to previous frame if set to 1,
  8713. absolute if set to 0. Default value is 0.
  8714. @item zoom
  8715. Set percentage to zoom. A positive value will result in a zoom-in
  8716. effect, a negative value in a zoom-out effect. Default value is 0 (no
  8717. zoom).
  8718. @item optzoom
  8719. Set optimal zooming to avoid borders.
  8720. Accepted values are:
  8721. @table @samp
  8722. @item 0
  8723. disabled
  8724. @item 1
  8725. optimal static zoom value is determined (only very strong movements
  8726. will lead to visible borders) (default)
  8727. @item 2
  8728. optimal adaptive zoom value is determined (no borders will be
  8729. visible), see @option{zoomspeed}
  8730. @end table
  8731. Note that the value given at zoom is added to the one calculated here.
  8732. @item zoomspeed
  8733. Set percent to zoom maximally each frame (enabled when
  8734. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  8735. 0.25.
  8736. @item interpol
  8737. Specify type of interpolation.
  8738. Available values are:
  8739. @table @samp
  8740. @item no
  8741. no interpolation
  8742. @item linear
  8743. linear only horizontal
  8744. @item bilinear
  8745. linear in both directions (default)
  8746. @item bicubic
  8747. cubic in both directions (slow)
  8748. @end table
  8749. @item tripod
  8750. Enable virtual tripod mode if set to 1, which is equivalent to
  8751. @code{relative=0:smoothing=0}. Default value is 0.
  8752. Use also @code{tripod} option of @ref{vidstabdetect}.
  8753. @item debug
  8754. Increase log verbosity if set to 1. Also the detected global motions
  8755. are written to the temporary file @file{global_motions.trf}. Default
  8756. value is 0.
  8757. @end table
  8758. @subsection Examples
  8759. @itemize
  8760. @item
  8761. Use @command{ffmpeg} for a typical stabilization with default values:
  8762. @example
  8763. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  8764. @end example
  8765. Note the use of the @ref{unsharp} filter which is always recommended.
  8766. @item
  8767. Zoom in a bit more and load transform data from a given file:
  8768. @example
  8769. vidstabtransform=zoom=5:input="mytransforms.trf"
  8770. @end example
  8771. @item
  8772. Smoothen the video even more:
  8773. @example
  8774. vidstabtransform=smoothing=30
  8775. @end example
  8776. @end itemize
  8777. @section vflip
  8778. Flip the input video vertically.
  8779. For example, to vertically flip a video with @command{ffmpeg}:
  8780. @example
  8781. ffmpeg -i in.avi -vf "vflip" out.avi
  8782. @end example
  8783. @anchor{vignette}
  8784. @section vignette
  8785. Make or reverse a natural vignetting effect.
  8786. The filter accepts the following options:
  8787. @table @option
  8788. @item angle, a
  8789. Set lens angle expression as a number of radians.
  8790. The value is clipped in the @code{[0,PI/2]} range.
  8791. Default value: @code{"PI/5"}
  8792. @item x0
  8793. @item y0
  8794. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  8795. by default.
  8796. @item mode
  8797. Set forward/backward mode.
  8798. Available modes are:
  8799. @table @samp
  8800. @item forward
  8801. The larger the distance from the central point, the darker the image becomes.
  8802. @item backward
  8803. The larger the distance from the central point, the brighter the image becomes.
  8804. This can be used to reverse a vignette effect, though there is no automatic
  8805. detection to extract the lens @option{angle} and other settings (yet). It can
  8806. also be used to create a burning effect.
  8807. @end table
  8808. Default value is @samp{forward}.
  8809. @item eval
  8810. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  8811. It accepts the following values:
  8812. @table @samp
  8813. @item init
  8814. Evaluate expressions only once during the filter initialization.
  8815. @item frame
  8816. Evaluate expressions for each incoming frame. This is way slower than the
  8817. @samp{init} mode since it requires all the scalers to be re-computed, but it
  8818. allows advanced dynamic expressions.
  8819. @end table
  8820. Default value is @samp{init}.
  8821. @item dither
  8822. Set dithering to reduce the circular banding effects. Default is @code{1}
  8823. (enabled).
  8824. @item aspect
  8825. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  8826. Setting this value to the SAR of the input will make a rectangular vignetting
  8827. following the dimensions of the video.
  8828. Default is @code{1/1}.
  8829. @end table
  8830. @subsection Expressions
  8831. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  8832. following parameters.
  8833. @table @option
  8834. @item w
  8835. @item h
  8836. input width and height
  8837. @item n
  8838. the number of input frame, starting from 0
  8839. @item pts
  8840. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  8841. @var{TB} units, NAN if undefined
  8842. @item r
  8843. frame rate of the input video, NAN if the input frame rate is unknown
  8844. @item t
  8845. the PTS (Presentation TimeStamp) of the filtered video frame,
  8846. expressed in seconds, NAN if undefined
  8847. @item tb
  8848. time base of the input video
  8849. @end table
  8850. @subsection Examples
  8851. @itemize
  8852. @item
  8853. Apply simple strong vignetting effect:
  8854. @example
  8855. vignette=PI/4
  8856. @end example
  8857. @item
  8858. Make a flickering vignetting:
  8859. @example
  8860. vignette='PI/4+random(1)*PI/50':eval=frame
  8861. @end example
  8862. @end itemize
  8863. @section vstack
  8864. Stack input videos vertically.
  8865. All streams must be of same pixel format and of same width.
  8866. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8867. to create same output.
  8868. The filter accept the following option:
  8869. @table @option
  8870. @item inputs
  8871. Set number of input streams. Default is 2.
  8872. @end table
  8873. @section w3fdif
  8874. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  8875. Deinterlacing Filter").
  8876. Based on the process described by Martin Weston for BBC R&D, and
  8877. implemented based on the de-interlace algorithm written by Jim
  8878. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  8879. uses filter coefficients calculated by BBC R&D.
  8880. There are two sets of filter coefficients, so called "simple":
  8881. and "complex". Which set of filter coefficients is used can
  8882. be set by passing an optional parameter:
  8883. @table @option
  8884. @item filter
  8885. Set the interlacing filter coefficients. Accepts one of the following values:
  8886. @table @samp
  8887. @item simple
  8888. Simple filter coefficient set.
  8889. @item complex
  8890. More-complex filter coefficient set.
  8891. @end table
  8892. Default value is @samp{complex}.
  8893. @item deint
  8894. Specify which frames to deinterlace. Accept one of the following values:
  8895. @table @samp
  8896. @item all
  8897. Deinterlace all frames,
  8898. @item interlaced
  8899. Only deinterlace frames marked as interlaced.
  8900. @end table
  8901. Default value is @samp{all}.
  8902. @end table
  8903. @section waveform
  8904. Video waveform monitor.
  8905. The waveform monitor plots color component intensity. By default luminance
  8906. only. Each column of the waveform corresponds to a column of pixels in the
  8907. source video.
  8908. It accepts the following options:
  8909. @table @option
  8910. @item mode, m
  8911. Can be either @code{row}, or @code{column}. Default is @code{column}.
  8912. In row mode, the graph on the left side represents color component value 0 and
  8913. the right side represents value = 255. In column mode, the top side represents
  8914. color component value = 0 and bottom side represents value = 255.
  8915. @item intensity, i
  8916. Set intensity. Smaller values are useful to find out how many values of the same
  8917. luminance are distributed across input rows/columns.
  8918. Default value is @code{0.04}. Allowed range is [0, 1].
  8919. @item mirror, r
  8920. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  8921. In mirrored mode, higher values will be represented on the left
  8922. side for @code{row} mode and at the top for @code{column} mode. Default is
  8923. @code{1} (mirrored).
  8924. @item display, d
  8925. Set display mode.
  8926. It accepts the following values:
  8927. @table @samp
  8928. @item overlay
  8929. Presents information identical to that in the @code{parade}, except
  8930. that the graphs representing color components are superimposed directly
  8931. over one another.
  8932. This display mode makes it easier to spot relative differences or similarities
  8933. in overlapping areas of the color components that are supposed to be identical,
  8934. such as neutral whites, grays, or blacks.
  8935. @item parade
  8936. Display separate graph for the color components side by side in
  8937. @code{row} mode or one below the other in @code{column} mode.
  8938. Using this display mode makes it easy to spot color casts in the highlights
  8939. and shadows of an image, by comparing the contours of the top and the bottom
  8940. graphs of each waveform. Since whites, grays, and blacks are characterized
  8941. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  8942. should display three waveforms of roughly equal width/height. If not, the
  8943. correction is easy to perform by making level adjustments the three waveforms.
  8944. @end table
  8945. Default is @code{parade}.
  8946. @item components, c
  8947. Set which color components to display. Default is 1, which means only luminance
  8948. or red color component if input is in RGB colorspace. If is set for example to
  8949. 7 it will display all 3 (if) available color components.
  8950. @item envelope, e
  8951. @table @samp
  8952. @item none
  8953. No envelope, this is default.
  8954. @item instant
  8955. Instant envelope, minimum and maximum values presented in graph will be easily
  8956. visible even with small @code{step} value.
  8957. @item peak
  8958. Hold minimum and maximum values presented in graph across time. This way you
  8959. can still spot out of range values without constantly looking at waveforms.
  8960. @item peak+instant
  8961. Peak and instant envelope combined together.
  8962. @end table
  8963. @item filter, f
  8964. @table @samp
  8965. @item lowpass
  8966. No filtering, this is default.
  8967. @item flat
  8968. Luma and chroma combined together.
  8969. @item aflat
  8970. Similar as above, but shows difference between blue and red chroma.
  8971. @item chroma
  8972. Displays only chroma.
  8973. @item achroma
  8974. Similar as above, but shows difference between blue and red chroma.
  8975. @item color
  8976. Displays actual color value on waveform.
  8977. @end table
  8978. @end table
  8979. @section xbr
  8980. Apply the xBR high-quality magnification filter which is designed for pixel
  8981. art. It follows a set of edge-detection rules, see
  8982. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  8983. It accepts the following option:
  8984. @table @option
  8985. @item n
  8986. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  8987. @code{3xBR} and @code{4} for @code{4xBR}.
  8988. Default is @code{3}.
  8989. @end table
  8990. @anchor{yadif}
  8991. @section yadif
  8992. Deinterlace the input video ("yadif" means "yet another deinterlacing
  8993. filter").
  8994. It accepts the following parameters:
  8995. @table @option
  8996. @item mode
  8997. The interlacing mode to adopt. It accepts one of the following values:
  8998. @table @option
  8999. @item 0, send_frame
  9000. Output one frame for each frame.
  9001. @item 1, send_field
  9002. Output one frame for each field.
  9003. @item 2, send_frame_nospatial
  9004. Like @code{send_frame}, but it skips the spatial interlacing check.
  9005. @item 3, send_field_nospatial
  9006. Like @code{send_field}, but it skips the spatial interlacing check.
  9007. @end table
  9008. The default value is @code{send_frame}.
  9009. @item parity
  9010. The picture field parity assumed for the input interlaced video. It accepts one
  9011. of the following values:
  9012. @table @option
  9013. @item 0, tff
  9014. Assume the top field is first.
  9015. @item 1, bff
  9016. Assume the bottom field is first.
  9017. @item -1, auto
  9018. Enable automatic detection of field parity.
  9019. @end table
  9020. The default value is @code{auto}.
  9021. If the interlacing is unknown or the decoder does not export this information,
  9022. top field first will be assumed.
  9023. @item deint
  9024. Specify which frames to deinterlace. Accept one of the following
  9025. values:
  9026. @table @option
  9027. @item 0, all
  9028. Deinterlace all frames.
  9029. @item 1, interlaced
  9030. Only deinterlace frames marked as interlaced.
  9031. @end table
  9032. The default value is @code{all}.
  9033. @end table
  9034. @section zoompan
  9035. Apply Zoom & Pan effect.
  9036. This filter accepts the following options:
  9037. @table @option
  9038. @item zoom, z
  9039. Set the zoom expression. Default is 1.
  9040. @item x
  9041. @item y
  9042. Set the x and y expression. Default is 0.
  9043. @item d
  9044. Set the duration expression in number of frames.
  9045. This sets for how many number of frames effect will last for
  9046. single input image.
  9047. @item s
  9048. Set the output image size, default is 'hd720'.
  9049. @end table
  9050. Each expression can contain the following constants:
  9051. @table @option
  9052. @item in_w, iw
  9053. Input width.
  9054. @item in_h, ih
  9055. Input height.
  9056. @item out_w, ow
  9057. Output width.
  9058. @item out_h, oh
  9059. Output height.
  9060. @item in
  9061. Input frame count.
  9062. @item on
  9063. Output frame count.
  9064. @item x
  9065. @item y
  9066. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  9067. for current input frame.
  9068. @item px
  9069. @item py
  9070. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  9071. not yet such frame (first input frame).
  9072. @item zoom
  9073. Last calculated zoom from 'z' expression for current input frame.
  9074. @item pzoom
  9075. Last calculated zoom of last output frame of previous input frame.
  9076. @item duration
  9077. Number of output frames for current input frame. Calculated from 'd' expression
  9078. for each input frame.
  9079. @item pduration
  9080. number of output frames created for previous input frame
  9081. @item a
  9082. Rational number: input width / input height
  9083. @item sar
  9084. sample aspect ratio
  9085. @item dar
  9086. display aspect ratio
  9087. @end table
  9088. @subsection Examples
  9089. @itemize
  9090. @item
  9091. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  9092. @example
  9093. 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
  9094. @end example
  9095. @item
  9096. Zoom-in up to 1.5 and pan always at center of picture:
  9097. @example
  9098. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  9099. @end example
  9100. @end itemize
  9101. @section zscale
  9102. Scale (resize) the input video, using the z.lib library:
  9103. https://github.com/sekrit-twc/zimg.
  9104. The zscale filter forces the output display aspect ratio to be the same
  9105. as the input, by changing the output sample aspect ratio.
  9106. If the input image format is different from the format requested by
  9107. the next filter, the zscale filter will convert the input to the
  9108. requested format.
  9109. @subsection Options
  9110. The filter accepts the following options.
  9111. @table @option
  9112. @item width, w
  9113. @item height, h
  9114. Set the output video dimension expression. Default value is the input
  9115. dimension.
  9116. If the @var{width} or @var{w} is 0, the input width is used for the output.
  9117. If the @var{height} or @var{h} is 0, the input height is used for the output.
  9118. If one of the values is -1, the zscale filter will use a value that
  9119. maintains the aspect ratio of the input image, calculated from the
  9120. other specified dimension. If both of them are -1, the input size is
  9121. used
  9122. If one of the values is -n with n > 1, the zscale filter will also use a value
  9123. that maintains the aspect ratio of the input image, calculated from the other
  9124. specified dimension. After that it will, however, make sure that the calculated
  9125. dimension is divisible by n and adjust the value if necessary.
  9126. See below for the list of accepted constants for use in the dimension
  9127. expression.
  9128. @item size, s
  9129. Set the video size. For the syntax of this option, check the
  9130. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9131. @item dither, d
  9132. Set the dither type.
  9133. Possible values are:
  9134. @table @var
  9135. @item none
  9136. @item ordered
  9137. @item random
  9138. @item error_diffusion
  9139. @end table
  9140. Default is none.
  9141. @item filter, f
  9142. Set the resize filter type.
  9143. Possible values are:
  9144. @table @var
  9145. @item point
  9146. @item bilinear
  9147. @item bicubic
  9148. @item spline16
  9149. @item spline36
  9150. @item lanczos
  9151. @end table
  9152. Default is bilinear.
  9153. @item range, r
  9154. Set the color range.
  9155. Possible values are:
  9156. @table @var
  9157. @item input
  9158. @item limited
  9159. @item full
  9160. @end table
  9161. Default is same as input.
  9162. @item primaries, p
  9163. Set the color primaries.
  9164. Possible values are:
  9165. @table @var
  9166. @item input
  9167. @item 709
  9168. @item unspecified
  9169. @item 170m
  9170. @item 240m
  9171. @item 2020
  9172. @end table
  9173. Default is same as input.
  9174. @item transfer, t
  9175. Set the transfer characteristics.
  9176. Possible values are:
  9177. @table @var
  9178. @item input
  9179. @item 709
  9180. @item unspecified
  9181. @item 601
  9182. @item linear
  9183. @item 2020_10
  9184. @item 2020_12
  9185. @end table
  9186. Default is same as input.
  9187. @item matrix, m
  9188. Set the colorspace matrix.
  9189. Possible value are:
  9190. @table @var
  9191. @item input
  9192. @item 709
  9193. @item unspecified
  9194. @item 470bg
  9195. @item 170m
  9196. @item 2020_ncl
  9197. @item 2020_cl
  9198. @end table
  9199. Default is same as input.
  9200. @end table
  9201. The values of the @option{w} and @option{h} options are expressions
  9202. containing the following constants:
  9203. @table @var
  9204. @item in_w
  9205. @item in_h
  9206. The input width and height
  9207. @item iw
  9208. @item ih
  9209. These are the same as @var{in_w} and @var{in_h}.
  9210. @item out_w
  9211. @item out_h
  9212. The output (scaled) width and height
  9213. @item ow
  9214. @item oh
  9215. These are the same as @var{out_w} and @var{out_h}
  9216. @item a
  9217. The same as @var{iw} / @var{ih}
  9218. @item sar
  9219. input sample aspect ratio
  9220. @item dar
  9221. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9222. @item hsub
  9223. @item vsub
  9224. horizontal and vertical input chroma subsample values. For example for the
  9225. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9226. @item ohsub
  9227. @item ovsub
  9228. horizontal and vertical output chroma subsample values. For example for the
  9229. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9230. @end table
  9231. @table @option
  9232. @end table
  9233. @c man end VIDEO FILTERS
  9234. @chapter Video Sources
  9235. @c man begin VIDEO SOURCES
  9236. Below is a description of the currently available video sources.
  9237. @section buffer
  9238. Buffer video frames, and make them available to the filter chain.
  9239. This source is mainly intended for a programmatic use, in particular
  9240. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  9241. It accepts the following parameters:
  9242. @table @option
  9243. @item video_size
  9244. Specify the size (width and height) of the buffered video frames. For the
  9245. syntax of this option, check the
  9246. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9247. @item width
  9248. The input video width.
  9249. @item height
  9250. The input video height.
  9251. @item pix_fmt
  9252. A string representing the pixel format of the buffered video frames.
  9253. It may be a number corresponding to a pixel format, or a pixel format
  9254. name.
  9255. @item time_base
  9256. Specify the timebase assumed by the timestamps of the buffered frames.
  9257. @item frame_rate
  9258. Specify the frame rate expected for the video stream.
  9259. @item pixel_aspect, sar
  9260. The sample (pixel) aspect ratio of the input video.
  9261. @item sws_param
  9262. Specify the optional parameters to be used for the scale filter which
  9263. is automatically inserted when an input change is detected in the
  9264. input size or format.
  9265. @end table
  9266. For example:
  9267. @example
  9268. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  9269. @end example
  9270. will instruct the source to accept video frames with size 320x240 and
  9271. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  9272. square pixels (1:1 sample aspect ratio).
  9273. Since the pixel format with name "yuv410p" corresponds to the number 6
  9274. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  9275. this example corresponds to:
  9276. @example
  9277. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  9278. @end example
  9279. Alternatively, the options can be specified as a flat string, but this
  9280. syntax is deprecated:
  9281. @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}]
  9282. @section cellauto
  9283. Create a pattern generated by an elementary cellular automaton.
  9284. The initial state of the cellular automaton can be defined through the
  9285. @option{filename}, and @option{pattern} options. If such options are
  9286. not specified an initial state is created randomly.
  9287. At each new frame a new row in the video is filled with the result of
  9288. the cellular automaton next generation. The behavior when the whole
  9289. frame is filled is defined by the @option{scroll} option.
  9290. This source accepts the following options:
  9291. @table @option
  9292. @item filename, f
  9293. Read the initial cellular automaton state, i.e. the starting row, from
  9294. the specified file.
  9295. In the file, each non-whitespace character is considered an alive
  9296. cell, a newline will terminate the row, and further characters in the
  9297. file will be ignored.
  9298. @item pattern, p
  9299. Read the initial cellular automaton state, i.e. the starting row, from
  9300. the specified string.
  9301. Each non-whitespace character in the string is considered an alive
  9302. cell, a newline will terminate the row, and further characters in the
  9303. string will be ignored.
  9304. @item rate, r
  9305. Set the video rate, that is the number of frames generated per second.
  9306. Default is 25.
  9307. @item random_fill_ratio, ratio
  9308. Set the random fill ratio for the initial cellular automaton row. It
  9309. is a floating point number value ranging from 0 to 1, defaults to
  9310. 1/PHI.
  9311. This option is ignored when a file or a pattern is specified.
  9312. @item random_seed, seed
  9313. Set the seed for filling randomly the initial row, must be an integer
  9314. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9315. set to -1, the filter will try to use a good random seed on a best
  9316. effort basis.
  9317. @item rule
  9318. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  9319. Default value is 110.
  9320. @item size, s
  9321. Set the size of the output video. For the syntax of this option, check the
  9322. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9323. If @option{filename} or @option{pattern} is specified, the size is set
  9324. by default to the width of the specified initial state row, and the
  9325. height is set to @var{width} * PHI.
  9326. If @option{size} is set, it must contain the width of the specified
  9327. pattern string, and the specified pattern will be centered in the
  9328. larger row.
  9329. If a filename or a pattern string is not specified, the size value
  9330. defaults to "320x518" (used for a randomly generated initial state).
  9331. @item scroll
  9332. If set to 1, scroll the output upward when all the rows in the output
  9333. have been already filled. If set to 0, the new generated row will be
  9334. written over the top row just after the bottom row is filled.
  9335. Defaults to 1.
  9336. @item start_full, full
  9337. If set to 1, completely fill the output with generated rows before
  9338. outputting the first frame.
  9339. This is the default behavior, for disabling set the value to 0.
  9340. @item stitch
  9341. If set to 1, stitch the left and right row edges together.
  9342. This is the default behavior, for disabling set the value to 0.
  9343. @end table
  9344. @subsection Examples
  9345. @itemize
  9346. @item
  9347. Read the initial state from @file{pattern}, and specify an output of
  9348. size 200x400.
  9349. @example
  9350. cellauto=f=pattern:s=200x400
  9351. @end example
  9352. @item
  9353. Generate a random initial row with a width of 200 cells, with a fill
  9354. ratio of 2/3:
  9355. @example
  9356. cellauto=ratio=2/3:s=200x200
  9357. @end example
  9358. @item
  9359. Create a pattern generated by rule 18 starting by a single alive cell
  9360. centered on an initial row with width 100:
  9361. @example
  9362. cellauto=p=@@:s=100x400:full=0:rule=18
  9363. @end example
  9364. @item
  9365. Specify a more elaborated initial pattern:
  9366. @example
  9367. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  9368. @end example
  9369. @end itemize
  9370. @section mandelbrot
  9371. Generate a Mandelbrot set fractal, and progressively zoom towards the
  9372. point specified with @var{start_x} and @var{start_y}.
  9373. This source accepts the following options:
  9374. @table @option
  9375. @item end_pts
  9376. Set the terminal pts value. Default value is 400.
  9377. @item end_scale
  9378. Set the terminal scale value.
  9379. Must be a floating point value. Default value is 0.3.
  9380. @item inner
  9381. Set the inner coloring mode, that is the algorithm used to draw the
  9382. Mandelbrot fractal internal region.
  9383. It shall assume one of the following values:
  9384. @table @option
  9385. @item black
  9386. Set black mode.
  9387. @item convergence
  9388. Show time until convergence.
  9389. @item mincol
  9390. Set color based on point closest to the origin of the iterations.
  9391. @item period
  9392. Set period mode.
  9393. @end table
  9394. Default value is @var{mincol}.
  9395. @item bailout
  9396. Set the bailout value. Default value is 10.0.
  9397. @item maxiter
  9398. Set the maximum of iterations performed by the rendering
  9399. algorithm. Default value is 7189.
  9400. @item outer
  9401. Set outer coloring mode.
  9402. It shall assume one of following values:
  9403. @table @option
  9404. @item iteration_count
  9405. Set iteration cound mode.
  9406. @item normalized_iteration_count
  9407. set normalized iteration count mode.
  9408. @end table
  9409. Default value is @var{normalized_iteration_count}.
  9410. @item rate, r
  9411. Set frame rate, expressed as number of frames per second. Default
  9412. value is "25".
  9413. @item size, s
  9414. Set frame size. For the syntax of this option, check the "Video
  9415. size" section in the ffmpeg-utils manual. Default value is "640x480".
  9416. @item start_scale
  9417. Set the initial scale value. Default value is 3.0.
  9418. @item start_x
  9419. Set the initial x position. Must be a floating point value between
  9420. -100 and 100. Default value is -0.743643887037158704752191506114774.
  9421. @item start_y
  9422. Set the initial y position. Must be a floating point value between
  9423. -100 and 100. Default value is -0.131825904205311970493132056385139.
  9424. @end table
  9425. @section mptestsrc
  9426. Generate various test patterns, as generated by the MPlayer test filter.
  9427. The size of the generated video is fixed, and is 256x256.
  9428. This source is useful in particular for testing encoding features.
  9429. This source accepts the following options:
  9430. @table @option
  9431. @item rate, r
  9432. Specify the frame rate of the sourced video, as the number of frames
  9433. generated per second. It has to be a string in the format
  9434. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9435. number or a valid video frame rate abbreviation. The default value is
  9436. "25".
  9437. @item duration, d
  9438. Set the duration of the sourced video. See
  9439. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9440. for the accepted syntax.
  9441. If not specified, or the expressed duration is negative, the video is
  9442. supposed to be generated forever.
  9443. @item test, t
  9444. Set the number or the name of the test to perform. Supported tests are:
  9445. @table @option
  9446. @item dc_luma
  9447. @item dc_chroma
  9448. @item freq_luma
  9449. @item freq_chroma
  9450. @item amp_luma
  9451. @item amp_chroma
  9452. @item cbp
  9453. @item mv
  9454. @item ring1
  9455. @item ring2
  9456. @item all
  9457. @end table
  9458. Default value is "all", which will cycle through the list of all tests.
  9459. @end table
  9460. Some examples:
  9461. @example
  9462. mptestsrc=t=dc_luma
  9463. @end example
  9464. will generate a "dc_luma" test pattern.
  9465. @section frei0r_src
  9466. Provide a frei0r source.
  9467. To enable compilation of this filter you need to install the frei0r
  9468. header and configure FFmpeg with @code{--enable-frei0r}.
  9469. This source accepts the following parameters:
  9470. @table @option
  9471. @item size
  9472. The size of the video to generate. For the syntax of this option, check the
  9473. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9474. @item framerate
  9475. The framerate of the generated video. It may be a string of the form
  9476. @var{num}/@var{den} or a frame rate abbreviation.
  9477. @item filter_name
  9478. The name to the frei0r source to load. For more information regarding frei0r and
  9479. how to set the parameters, read the @ref{frei0r} section in the video filters
  9480. documentation.
  9481. @item filter_params
  9482. A '|'-separated list of parameters to pass to the frei0r source.
  9483. @end table
  9484. For example, to generate a frei0r partik0l source with size 200x200
  9485. and frame rate 10 which is overlaid on the overlay filter main input:
  9486. @example
  9487. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  9488. @end example
  9489. @section life
  9490. Generate a life pattern.
  9491. This source is based on a generalization of John Conway's life game.
  9492. The sourced input represents a life grid, each pixel represents a cell
  9493. which can be in one of two possible states, alive or dead. Every cell
  9494. interacts with its eight neighbours, which are the cells that are
  9495. horizontally, vertically, or diagonally adjacent.
  9496. At each interaction the grid evolves according to the adopted rule,
  9497. which specifies the number of neighbor alive cells which will make a
  9498. cell stay alive or born. The @option{rule} option allows one to specify
  9499. the rule to adopt.
  9500. This source accepts the following options:
  9501. @table @option
  9502. @item filename, f
  9503. Set the file from which to read the initial grid state. In the file,
  9504. each non-whitespace character is considered an alive cell, and newline
  9505. is used to delimit the end of each row.
  9506. If this option is not specified, the initial grid is generated
  9507. randomly.
  9508. @item rate, r
  9509. Set the video rate, that is the number of frames generated per second.
  9510. Default is 25.
  9511. @item random_fill_ratio, ratio
  9512. Set the random fill ratio for the initial random grid. It is a
  9513. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  9514. It is ignored when a file is specified.
  9515. @item random_seed, seed
  9516. Set the seed for filling the initial random grid, must be an integer
  9517. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9518. set to -1, the filter will try to use a good random seed on a best
  9519. effort basis.
  9520. @item rule
  9521. Set the life rule.
  9522. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  9523. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  9524. @var{NS} specifies the number of alive neighbor cells which make a
  9525. live cell stay alive, and @var{NB} the number of alive neighbor cells
  9526. which make a dead cell to become alive (i.e. to "born").
  9527. "s" and "b" can be used in place of "S" and "B", respectively.
  9528. Alternatively a rule can be specified by an 18-bits integer. The 9
  9529. high order bits are used to encode the next cell state if it is alive
  9530. for each number of neighbor alive cells, the low order bits specify
  9531. the rule for "borning" new cells. Higher order bits encode for an
  9532. higher number of neighbor cells.
  9533. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  9534. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  9535. Default value is "S23/B3", which is the original Conway's game of life
  9536. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  9537. cells, and will born a new cell if there are three alive cells around
  9538. a dead cell.
  9539. @item size, s
  9540. Set the size of the output video. For the syntax of this option, check the
  9541. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9542. If @option{filename} is specified, the size is set by default to the
  9543. same size of the input file. If @option{size} is set, it must contain
  9544. the size specified in the input file, and the initial grid defined in
  9545. that file is centered in the larger resulting area.
  9546. If a filename is not specified, the size value defaults to "320x240"
  9547. (used for a randomly generated initial grid).
  9548. @item stitch
  9549. If set to 1, stitch the left and right grid edges together, and the
  9550. top and bottom edges also. Defaults to 1.
  9551. @item mold
  9552. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  9553. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  9554. value from 0 to 255.
  9555. @item life_color
  9556. Set the color of living (or new born) cells.
  9557. @item death_color
  9558. Set the color of dead cells. If @option{mold} is set, this is the first color
  9559. used to represent a dead cell.
  9560. @item mold_color
  9561. Set mold color, for definitely dead and moldy cells.
  9562. For the syntax of these 3 color options, check the "Color" section in the
  9563. ffmpeg-utils manual.
  9564. @end table
  9565. @subsection Examples
  9566. @itemize
  9567. @item
  9568. Read a grid from @file{pattern}, and center it on a grid of size
  9569. 300x300 pixels:
  9570. @example
  9571. life=f=pattern:s=300x300
  9572. @end example
  9573. @item
  9574. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  9575. @example
  9576. life=ratio=2/3:s=200x200
  9577. @end example
  9578. @item
  9579. Specify a custom rule for evolving a randomly generated grid:
  9580. @example
  9581. life=rule=S14/B34
  9582. @end example
  9583. @item
  9584. Full example with slow death effect (mold) using @command{ffplay}:
  9585. @example
  9586. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  9587. @end example
  9588. @end itemize
  9589. @anchor{allrgb}
  9590. @anchor{allyuv}
  9591. @anchor{color}
  9592. @anchor{haldclutsrc}
  9593. @anchor{nullsrc}
  9594. @anchor{rgbtestsrc}
  9595. @anchor{smptebars}
  9596. @anchor{smptehdbars}
  9597. @anchor{testsrc}
  9598. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  9599. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  9600. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  9601. The @code{color} source provides an uniformly colored input.
  9602. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  9603. @ref{haldclut} filter.
  9604. The @code{nullsrc} source returns unprocessed video frames. It is
  9605. mainly useful to be employed in analysis / debugging tools, or as the
  9606. source for filters which ignore the input data.
  9607. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  9608. detecting RGB vs BGR issues. You should see a red, green and blue
  9609. stripe from top to bottom.
  9610. The @code{smptebars} source generates a color bars pattern, based on
  9611. the SMPTE Engineering Guideline EG 1-1990.
  9612. The @code{smptehdbars} source generates a color bars pattern, based on
  9613. the SMPTE RP 219-2002.
  9614. The @code{testsrc} source generates a test video pattern, showing a
  9615. color pattern, a scrolling gradient and a timestamp. This is mainly
  9616. intended for testing purposes.
  9617. The sources accept the following parameters:
  9618. @table @option
  9619. @item color, c
  9620. Specify the color of the source, only available in the @code{color}
  9621. source. For the syntax of this option, check the "Color" section in the
  9622. ffmpeg-utils manual.
  9623. @item level
  9624. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  9625. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  9626. pixels to be used as identity matrix for 3D lookup tables. Each component is
  9627. coded on a @code{1/(N*N)} scale.
  9628. @item size, s
  9629. Specify the size of the sourced video. For the syntax of this option, check the
  9630. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9631. The default value is @code{320x240}.
  9632. This option is not available with the @code{haldclutsrc} filter.
  9633. @item rate, r
  9634. Specify the frame rate of the sourced video, as the number of frames
  9635. generated per second. It has to be a string in the format
  9636. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9637. number or a valid video frame rate abbreviation. The default value is
  9638. "25".
  9639. @item sar
  9640. Set the sample aspect ratio of the sourced video.
  9641. @item duration, d
  9642. Set the duration of the sourced video. See
  9643. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9644. for the accepted syntax.
  9645. If not specified, or the expressed duration is negative, the video is
  9646. supposed to be generated forever.
  9647. @item decimals, n
  9648. Set the number of decimals to show in the timestamp, only available in the
  9649. @code{testsrc} source.
  9650. The displayed timestamp value will correspond to the original
  9651. timestamp value multiplied by the power of 10 of the specified
  9652. value. Default value is 0.
  9653. @end table
  9654. For example the following:
  9655. @example
  9656. testsrc=duration=5.3:size=qcif:rate=10
  9657. @end example
  9658. will generate a video with a duration of 5.3 seconds, with size
  9659. 176x144 and a frame rate of 10 frames per second.
  9660. The following graph description will generate a red source
  9661. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  9662. frames per second.
  9663. @example
  9664. color=c=red@@0.2:s=qcif:r=10
  9665. @end example
  9666. If the input content is to be ignored, @code{nullsrc} can be used. The
  9667. following command generates noise in the luminance plane by employing
  9668. the @code{geq} filter:
  9669. @example
  9670. nullsrc=s=256x256, geq=random(1)*255:128:128
  9671. @end example
  9672. @subsection Commands
  9673. The @code{color} source supports the following commands:
  9674. @table @option
  9675. @item c, color
  9676. Set the color of the created image. Accepts the same syntax of the
  9677. corresponding @option{color} option.
  9678. @end table
  9679. @c man end VIDEO SOURCES
  9680. @chapter Video Sinks
  9681. @c man begin VIDEO SINKS
  9682. Below is a description of the currently available video sinks.
  9683. @section buffersink
  9684. Buffer video frames, and make them available to the end of the filter
  9685. graph.
  9686. This sink is mainly intended for programmatic use, in particular
  9687. through the interface defined in @file{libavfilter/buffersink.h}
  9688. or the options system.
  9689. It accepts a pointer to an AVBufferSinkContext structure, which
  9690. defines the incoming buffers' formats, to be passed as the opaque
  9691. parameter to @code{avfilter_init_filter} for initialization.
  9692. @section nullsink
  9693. Null video sink: do absolutely nothing with the input video. It is
  9694. mainly useful as a template and for use in analysis / debugging
  9695. tools.
  9696. @c man end VIDEO SINKS
  9697. @chapter Multimedia Filters
  9698. @c man begin MULTIMEDIA FILTERS
  9699. Below is a description of the currently available multimedia filters.
  9700. @section aphasemeter
  9701. Convert input audio to a video output, displaying the audio phase.
  9702. The filter accepts the following options:
  9703. @table @option
  9704. @item rate, r
  9705. Set the output frame rate. Default value is @code{25}.
  9706. @item size, s
  9707. Set the video size for the output. For the syntax of this option, check the
  9708. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9709. Default value is @code{800x400}.
  9710. @item rc
  9711. @item gc
  9712. @item bc
  9713. Specify the red, green, blue contrast. Default values are @code{2},
  9714. @code{7} and @code{1}.
  9715. Allowed range is @code{[0, 255]}.
  9716. @item mpc
  9717. Set color which will be used for drawing median phase. If color is
  9718. @code{none} which is default, no median phase value will be drawn.
  9719. @end table
  9720. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  9721. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  9722. The @code{-1} means left and right channels are completely out of phase and
  9723. @code{1} means channels are in phase.
  9724. @section avectorscope
  9725. Convert input audio to a video output, representing the audio vector
  9726. scope.
  9727. The filter is used to measure the difference between channels of stereo
  9728. audio stream. A monoaural signal, consisting of identical left and right
  9729. signal, results in straight vertical line. Any stereo separation is visible
  9730. as a deviation from this line, creating a Lissajous figure.
  9731. If the straight (or deviation from it) but horizontal line appears this
  9732. indicates that the left and right channels are out of phase.
  9733. The filter accepts the following options:
  9734. @table @option
  9735. @item mode, m
  9736. Set the vectorscope mode.
  9737. Available values are:
  9738. @table @samp
  9739. @item lissajous
  9740. Lissajous rotated by 45 degrees.
  9741. @item lissajous_xy
  9742. Same as above but not rotated.
  9743. @item polar
  9744. Shape resembling half of circle.
  9745. @end table
  9746. Default value is @samp{lissajous}.
  9747. @item size, s
  9748. Set the video size for the output. For the syntax of this option, check the
  9749. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9750. Default value is @code{400x400}.
  9751. @item rate, r
  9752. Set the output frame rate. Default value is @code{25}.
  9753. @item rc
  9754. @item gc
  9755. @item bc
  9756. @item ac
  9757. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  9758. @code{160}, @code{80} and @code{255}.
  9759. Allowed range is @code{[0, 255]}.
  9760. @item rf
  9761. @item gf
  9762. @item bf
  9763. @item af
  9764. Specify the red, green, blue and alpha fade. Default values are @code{15},
  9765. @code{10}, @code{5} and @code{5}.
  9766. Allowed range is @code{[0, 255]}.
  9767. @item zoom
  9768. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  9769. @end table
  9770. @subsection Examples
  9771. @itemize
  9772. @item
  9773. Complete example using @command{ffplay}:
  9774. @example
  9775. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  9776. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  9777. @end example
  9778. @end itemize
  9779. @section concat
  9780. Concatenate audio and video streams, joining them together one after the
  9781. other.
  9782. The filter works on segments of synchronized video and audio streams. All
  9783. segments must have the same number of streams of each type, and that will
  9784. also be the number of streams at output.
  9785. The filter accepts the following options:
  9786. @table @option
  9787. @item n
  9788. Set the number of segments. Default is 2.
  9789. @item v
  9790. Set the number of output video streams, that is also the number of video
  9791. streams in each segment. Default is 1.
  9792. @item a
  9793. Set the number of output audio streams, that is also the number of audio
  9794. streams in each segment. Default is 0.
  9795. @item unsafe
  9796. Activate unsafe mode: do not fail if segments have a different format.
  9797. @end table
  9798. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  9799. @var{a} audio outputs.
  9800. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  9801. segment, in the same order as the outputs, then the inputs for the second
  9802. segment, etc.
  9803. Related streams do not always have exactly the same duration, for various
  9804. reasons including codec frame size or sloppy authoring. For that reason,
  9805. related synchronized streams (e.g. a video and its audio track) should be
  9806. concatenated at once. The concat filter will use the duration of the longest
  9807. stream in each segment (except the last one), and if necessary pad shorter
  9808. audio streams with silence.
  9809. For this filter to work correctly, all segments must start at timestamp 0.
  9810. All corresponding streams must have the same parameters in all segments; the
  9811. filtering system will automatically select a common pixel format for video
  9812. streams, and a common sample format, sample rate and channel layout for
  9813. audio streams, but other settings, such as resolution, must be converted
  9814. explicitly by the user.
  9815. Different frame rates are acceptable but will result in variable frame rate
  9816. at output; be sure to configure the output file to handle it.
  9817. @subsection Examples
  9818. @itemize
  9819. @item
  9820. Concatenate an opening, an episode and an ending, all in bilingual version
  9821. (video in stream 0, audio in streams 1 and 2):
  9822. @example
  9823. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  9824. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  9825. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  9826. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  9827. @end example
  9828. @item
  9829. Concatenate two parts, handling audio and video separately, using the
  9830. (a)movie sources, and adjusting the resolution:
  9831. @example
  9832. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  9833. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  9834. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  9835. @end example
  9836. Note that a desync will happen at the stitch if the audio and video streams
  9837. do not have exactly the same duration in the first file.
  9838. @end itemize
  9839. @anchor{ebur128}
  9840. @section ebur128
  9841. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  9842. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  9843. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  9844. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  9845. The filter also has a video output (see the @var{video} option) with a real
  9846. time graph to observe the loudness evolution. The graphic contains the logged
  9847. message mentioned above, so it is not printed anymore when this option is set,
  9848. unless the verbose logging is set. The main graphing area contains the
  9849. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  9850. the momentary loudness (400 milliseconds).
  9851. More information about the Loudness Recommendation EBU R128 on
  9852. @url{http://tech.ebu.ch/loudness}.
  9853. The filter accepts the following options:
  9854. @table @option
  9855. @item video
  9856. Activate the video output. The audio stream is passed unchanged whether this
  9857. option is set or no. The video stream will be the first output stream if
  9858. activated. Default is @code{0}.
  9859. @item size
  9860. Set the video size. This option is for video only. For the syntax of this
  9861. option, check the
  9862. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9863. Default and minimum resolution is @code{640x480}.
  9864. @item meter
  9865. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  9866. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  9867. other integer value between this range is allowed.
  9868. @item metadata
  9869. Set metadata injection. If set to @code{1}, the audio input will be segmented
  9870. into 100ms output frames, each of them containing various loudness information
  9871. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  9872. Default is @code{0}.
  9873. @item framelog
  9874. Force the frame logging level.
  9875. Available values are:
  9876. @table @samp
  9877. @item info
  9878. information logging level
  9879. @item verbose
  9880. verbose logging level
  9881. @end table
  9882. By default, the logging level is set to @var{info}. If the @option{video} or
  9883. the @option{metadata} options are set, it switches to @var{verbose}.
  9884. @item peak
  9885. Set peak mode(s).
  9886. Available modes can be cumulated (the option is a @code{flag} type). Possible
  9887. values are:
  9888. @table @samp
  9889. @item none
  9890. Disable any peak mode (default).
  9891. @item sample
  9892. Enable sample-peak mode.
  9893. Simple peak mode looking for the higher sample value. It logs a message
  9894. for sample-peak (identified by @code{SPK}).
  9895. @item true
  9896. Enable true-peak mode.
  9897. If enabled, the peak lookup is done on an over-sampled version of the input
  9898. stream for better peak accuracy. It logs a message for true-peak.
  9899. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  9900. This mode requires a build with @code{libswresample}.
  9901. @end table
  9902. @item dualmono
  9903. Treat mono input files as "dual mono". If a mono file is intended for playback
  9904. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  9905. If set to @code{true}, this option will compensate for this effect.
  9906. Multi-channel input files are not affected by this option.
  9907. @item panlaw
  9908. Set a specific pan law to be used for the measurement of dual mono files.
  9909. This parameter is optional, and has a default value of -3.01dB.
  9910. @end table
  9911. @subsection Examples
  9912. @itemize
  9913. @item
  9914. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  9915. @example
  9916. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  9917. @end example
  9918. @item
  9919. Run an analysis with @command{ffmpeg}:
  9920. @example
  9921. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  9922. @end example
  9923. @end itemize
  9924. @section interleave, ainterleave
  9925. Temporally interleave frames from several inputs.
  9926. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  9927. These filters read frames from several inputs and send the oldest
  9928. queued frame to the output.
  9929. Input streams must have a well defined, monotonically increasing frame
  9930. timestamp values.
  9931. In order to submit one frame to output, these filters need to enqueue
  9932. at least one frame for each input, so they cannot work in case one
  9933. input is not yet terminated and will not receive incoming frames.
  9934. For example consider the case when one input is a @code{select} filter
  9935. which always drop input frames. The @code{interleave} filter will keep
  9936. reading from that input, but it will never be able to send new frames
  9937. to output until the input will send an end-of-stream signal.
  9938. Also, depending on inputs synchronization, the filters will drop
  9939. frames in case one input receives more frames than the other ones, and
  9940. the queue is already filled.
  9941. These filters accept the following options:
  9942. @table @option
  9943. @item nb_inputs, n
  9944. Set the number of different inputs, it is 2 by default.
  9945. @end table
  9946. @subsection Examples
  9947. @itemize
  9948. @item
  9949. Interleave frames belonging to different streams using @command{ffmpeg}:
  9950. @example
  9951. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  9952. @end example
  9953. @item
  9954. Add flickering blur effect:
  9955. @example
  9956. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  9957. @end example
  9958. @end itemize
  9959. @section perms, aperms
  9960. Set read/write permissions for the output frames.
  9961. These filters are mainly aimed at developers to test direct path in the
  9962. following filter in the filtergraph.
  9963. The filters accept the following options:
  9964. @table @option
  9965. @item mode
  9966. Select the permissions mode.
  9967. It accepts the following values:
  9968. @table @samp
  9969. @item none
  9970. Do nothing. This is the default.
  9971. @item ro
  9972. Set all the output frames read-only.
  9973. @item rw
  9974. Set all the output frames directly writable.
  9975. @item toggle
  9976. Make the frame read-only if writable, and writable if read-only.
  9977. @item random
  9978. Set each output frame read-only or writable randomly.
  9979. @end table
  9980. @item seed
  9981. Set the seed for the @var{random} mode, must be an integer included between
  9982. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9983. @code{-1}, the filter will try to use a good random seed on a best effort
  9984. basis.
  9985. @end table
  9986. Note: in case of auto-inserted filter between the permission filter and the
  9987. following one, the permission might not be received as expected in that
  9988. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  9989. perms/aperms filter can avoid this problem.
  9990. @section realtime, arealtime
  9991. Slow down filtering to match real time approximatively.
  9992. These filters will pause the filtering for a variable amount of time to
  9993. match the output rate with the input timestamps.
  9994. They are similar to the @option{re} option to @code{ffmpeg}.
  9995. They accept the following options:
  9996. @table @option
  9997. @item limit
  9998. Time limit for the pauses. Any pause longer than that will be considered
  9999. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  10000. @end table
  10001. @section select, aselect
  10002. Select frames to pass in output.
  10003. This filter accepts the following options:
  10004. @table @option
  10005. @item expr, e
  10006. Set expression, which is evaluated for each input frame.
  10007. If the expression is evaluated to zero, the frame is discarded.
  10008. If the evaluation result is negative or NaN, the frame is sent to the
  10009. first output; otherwise it is sent to the output with index
  10010. @code{ceil(val)-1}, assuming that the input index starts from 0.
  10011. For example a value of @code{1.2} corresponds to the output with index
  10012. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  10013. @item outputs, n
  10014. Set the number of outputs. The output to which to send the selected
  10015. frame is based on the result of the evaluation. Default value is 1.
  10016. @end table
  10017. The expression can contain the following constants:
  10018. @table @option
  10019. @item n
  10020. The (sequential) number of the filtered frame, starting from 0.
  10021. @item selected_n
  10022. The (sequential) number of the selected frame, starting from 0.
  10023. @item prev_selected_n
  10024. The sequential number of the last selected frame. It's NAN if undefined.
  10025. @item TB
  10026. The timebase of the input timestamps.
  10027. @item pts
  10028. The PTS (Presentation TimeStamp) of the filtered video frame,
  10029. expressed in @var{TB} units. It's NAN if undefined.
  10030. @item t
  10031. The PTS of the filtered video frame,
  10032. expressed in seconds. It's NAN if undefined.
  10033. @item prev_pts
  10034. The PTS of the previously filtered video frame. It's NAN if undefined.
  10035. @item prev_selected_pts
  10036. The PTS of the last previously filtered video frame. It's NAN if undefined.
  10037. @item prev_selected_t
  10038. The PTS of the last previously selected video frame. It's NAN if undefined.
  10039. @item start_pts
  10040. The PTS of the first video frame in the video. It's NAN if undefined.
  10041. @item start_t
  10042. The time of the first video frame in the video. It's NAN if undefined.
  10043. @item pict_type @emph{(video only)}
  10044. The type of the filtered frame. It can assume one of the following
  10045. values:
  10046. @table @option
  10047. @item I
  10048. @item P
  10049. @item B
  10050. @item S
  10051. @item SI
  10052. @item SP
  10053. @item BI
  10054. @end table
  10055. @item interlace_type @emph{(video only)}
  10056. The frame interlace type. It can assume one of the following values:
  10057. @table @option
  10058. @item PROGRESSIVE
  10059. The frame is progressive (not interlaced).
  10060. @item TOPFIRST
  10061. The frame is top-field-first.
  10062. @item BOTTOMFIRST
  10063. The frame is bottom-field-first.
  10064. @end table
  10065. @item consumed_sample_n @emph{(audio only)}
  10066. the number of selected samples before the current frame
  10067. @item samples_n @emph{(audio only)}
  10068. the number of samples in the current frame
  10069. @item sample_rate @emph{(audio only)}
  10070. the input sample rate
  10071. @item key
  10072. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  10073. @item pos
  10074. the position in the file of the filtered frame, -1 if the information
  10075. is not available (e.g. for synthetic video)
  10076. @item scene @emph{(video only)}
  10077. value between 0 and 1 to indicate a new scene; a low value reflects a low
  10078. probability for the current frame to introduce a new scene, while a higher
  10079. value means the current frame is more likely to be one (see the example below)
  10080. @end table
  10081. The default value of the select expression is "1".
  10082. @subsection Examples
  10083. @itemize
  10084. @item
  10085. Select all frames in input:
  10086. @example
  10087. select
  10088. @end example
  10089. The example above is the same as:
  10090. @example
  10091. select=1
  10092. @end example
  10093. @item
  10094. Skip all frames:
  10095. @example
  10096. select=0
  10097. @end example
  10098. @item
  10099. Select only I-frames:
  10100. @example
  10101. select='eq(pict_type\,I)'
  10102. @end example
  10103. @item
  10104. Select one frame every 100:
  10105. @example
  10106. select='not(mod(n\,100))'
  10107. @end example
  10108. @item
  10109. Select only frames contained in the 10-20 time interval:
  10110. @example
  10111. select=between(t\,10\,20)
  10112. @end example
  10113. @item
  10114. Select only I frames contained in the 10-20 time interval:
  10115. @example
  10116. select=between(t\,10\,20)*eq(pict_type\,I)
  10117. @end example
  10118. @item
  10119. Select frames with a minimum distance of 10 seconds:
  10120. @example
  10121. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  10122. @end example
  10123. @item
  10124. Use aselect to select only audio frames with samples number > 100:
  10125. @example
  10126. aselect='gt(samples_n\,100)'
  10127. @end example
  10128. @item
  10129. Create a mosaic of the first scenes:
  10130. @example
  10131. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  10132. @end example
  10133. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  10134. choice.
  10135. @item
  10136. Send even and odd frames to separate outputs, and compose them:
  10137. @example
  10138. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  10139. @end example
  10140. @end itemize
  10141. @section selectivecolor
  10142. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10143. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10144. by the "purity" of the color (that is, how saturated it already is).
  10145. This filter is similar to the Adobe Photoshop Selective Color tool.
  10146. The filter accepts the following options:
  10147. @table @option
  10148. @item correction_method
  10149. Select color correction method.
  10150. Available values are:
  10151. @table @samp
  10152. @item absolute
  10153. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10154. component value).
  10155. @item relative
  10156. Specified adjustments are relative to the original component value.
  10157. @end table
  10158. Default is @code{absolute}.
  10159. @item reds
  10160. Adjustments for red pixels (pixels where the red component is the maximum)
  10161. @item yellows
  10162. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10163. @item greens
  10164. Adjustments for green pixels (pixels where the green component is the maximum)
  10165. @item cyans
  10166. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10167. @item blues
  10168. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10169. @item magentas
  10170. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10171. @item whites
  10172. Adjustments for white pixels (pixels where all components are greater than 128)
  10173. @item neutrals
  10174. Adjustments for all pixels except pure black and pure white
  10175. @item blacks
  10176. Adjustments for black pixels (pixels where all components are lesser than 128)
  10177. @item psfile
  10178. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10179. @end table
  10180. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10181. 4 space separated floating point adjustment values in the [-1,1] range,
  10182. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10183. pixels of its range.
  10184. @subsection Examples
  10185. @itemize
  10186. @item
  10187. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10188. increase magenta by 27% in blue areas:
  10189. @example
  10190. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10191. @end example
  10192. @item
  10193. Use a Photoshop selective color preset:
  10194. @example
  10195. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10196. @end example
  10197. @end itemize
  10198. @section sendcmd, asendcmd
  10199. Send commands to filters in the filtergraph.
  10200. These filters read commands to be sent to other filters in the
  10201. filtergraph.
  10202. @code{sendcmd} must be inserted between two video filters,
  10203. @code{asendcmd} must be inserted between two audio filters, but apart
  10204. from that they act the same way.
  10205. The specification of commands can be provided in the filter arguments
  10206. with the @var{commands} option, or in a file specified by the
  10207. @var{filename} option.
  10208. These filters accept the following options:
  10209. @table @option
  10210. @item commands, c
  10211. Set the commands to be read and sent to the other filters.
  10212. @item filename, f
  10213. Set the filename of the commands to be read and sent to the other
  10214. filters.
  10215. @end table
  10216. @subsection Commands syntax
  10217. A commands description consists of a sequence of interval
  10218. specifications, comprising a list of commands to be executed when a
  10219. particular event related to that interval occurs. The occurring event
  10220. is typically the current frame time entering or leaving a given time
  10221. interval.
  10222. An interval is specified by the following syntax:
  10223. @example
  10224. @var{START}[-@var{END}] @var{COMMANDS};
  10225. @end example
  10226. The time interval is specified by the @var{START} and @var{END} times.
  10227. @var{END} is optional and defaults to the maximum time.
  10228. The current frame time is considered within the specified interval if
  10229. it is included in the interval [@var{START}, @var{END}), that is when
  10230. the time is greater or equal to @var{START} and is lesser than
  10231. @var{END}.
  10232. @var{COMMANDS} consists of a sequence of one or more command
  10233. specifications, separated by ",", relating to that interval. The
  10234. syntax of a command specification is given by:
  10235. @example
  10236. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  10237. @end example
  10238. @var{FLAGS} is optional and specifies the type of events relating to
  10239. the time interval which enable sending the specified command, and must
  10240. be a non-null sequence of identifier flags separated by "+" or "|" and
  10241. enclosed between "[" and "]".
  10242. The following flags are recognized:
  10243. @table @option
  10244. @item enter
  10245. The command is sent when the current frame timestamp enters the
  10246. specified interval. In other words, the command is sent when the
  10247. previous frame timestamp was not in the given interval, and the
  10248. current is.
  10249. @item leave
  10250. The command is sent when the current frame timestamp leaves the
  10251. specified interval. In other words, the command is sent when the
  10252. previous frame timestamp was in the given interval, and the
  10253. current is not.
  10254. @end table
  10255. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  10256. assumed.
  10257. @var{TARGET} specifies the target of the command, usually the name of
  10258. the filter class or a specific filter instance name.
  10259. @var{COMMAND} specifies the name of the command for the target filter.
  10260. @var{ARG} is optional and specifies the optional list of argument for
  10261. the given @var{COMMAND}.
  10262. Between one interval specification and another, whitespaces, or
  10263. sequences of characters starting with @code{#} until the end of line,
  10264. are ignored and can be used to annotate comments.
  10265. A simplified BNF description of the commands specification syntax
  10266. follows:
  10267. @example
  10268. @var{COMMAND_FLAG} ::= "enter" | "leave"
  10269. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  10270. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  10271. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  10272. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  10273. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  10274. @end example
  10275. @subsection Examples
  10276. @itemize
  10277. @item
  10278. Specify audio tempo change at second 4:
  10279. @example
  10280. asendcmd=c='4.0 atempo tempo 1.5',atempo
  10281. @end example
  10282. @item
  10283. Specify a list of drawtext and hue commands in a file.
  10284. @example
  10285. # show text in the interval 5-10
  10286. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  10287. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  10288. # desaturate the image in the interval 15-20
  10289. 15.0-20.0 [enter] hue s 0,
  10290. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  10291. [leave] hue s 1,
  10292. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  10293. # apply an exponential saturation fade-out effect, starting from time 25
  10294. 25 [enter] hue s exp(25-t)
  10295. @end example
  10296. A filtergraph allowing to read and process the above command list
  10297. stored in a file @file{test.cmd}, can be specified with:
  10298. @example
  10299. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  10300. @end example
  10301. @end itemize
  10302. @anchor{setpts}
  10303. @section setpts, asetpts
  10304. Change the PTS (presentation timestamp) of the input frames.
  10305. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  10306. This filter accepts the following options:
  10307. @table @option
  10308. @item expr
  10309. The expression which is evaluated for each frame to construct its timestamp.
  10310. @end table
  10311. The expression is evaluated through the eval API and can contain the following
  10312. constants:
  10313. @table @option
  10314. @item FRAME_RATE
  10315. frame rate, only defined for constant frame-rate video
  10316. @item PTS
  10317. The presentation timestamp in input
  10318. @item N
  10319. The count of the input frame for video or the number of consumed samples,
  10320. not including the current frame for audio, starting from 0.
  10321. @item NB_CONSUMED_SAMPLES
  10322. The number of consumed samples, not including the current frame (only
  10323. audio)
  10324. @item NB_SAMPLES, S
  10325. The number of samples in the current frame (only audio)
  10326. @item SAMPLE_RATE, SR
  10327. The audio sample rate.
  10328. @item STARTPTS
  10329. The PTS of the first frame.
  10330. @item STARTT
  10331. the time in seconds of the first frame
  10332. @item INTERLACED
  10333. State whether the current frame is interlaced.
  10334. @item T
  10335. the time in seconds of the current frame
  10336. @item POS
  10337. original position in the file of the frame, or undefined if undefined
  10338. for the current frame
  10339. @item PREV_INPTS
  10340. The previous input PTS.
  10341. @item PREV_INT
  10342. previous input time in seconds
  10343. @item PREV_OUTPTS
  10344. The previous output PTS.
  10345. @item PREV_OUTT
  10346. previous output time in seconds
  10347. @item RTCTIME
  10348. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  10349. instead.
  10350. @item RTCSTART
  10351. The wallclock (RTC) time at the start of the movie in microseconds.
  10352. @item TB
  10353. The timebase of the input timestamps.
  10354. @end table
  10355. @subsection Examples
  10356. @itemize
  10357. @item
  10358. Start counting PTS from zero
  10359. @example
  10360. setpts=PTS-STARTPTS
  10361. @end example
  10362. @item
  10363. Apply fast motion effect:
  10364. @example
  10365. setpts=0.5*PTS
  10366. @end example
  10367. @item
  10368. Apply slow motion effect:
  10369. @example
  10370. setpts=2.0*PTS
  10371. @end example
  10372. @item
  10373. Set fixed rate of 25 frames per second:
  10374. @example
  10375. setpts=N/(25*TB)
  10376. @end example
  10377. @item
  10378. Set fixed rate 25 fps with some jitter:
  10379. @example
  10380. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  10381. @end example
  10382. @item
  10383. Apply an offset of 10 seconds to the input PTS:
  10384. @example
  10385. setpts=PTS+10/TB
  10386. @end example
  10387. @item
  10388. Generate timestamps from a "live source" and rebase onto the current timebase:
  10389. @example
  10390. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  10391. @end example
  10392. @item
  10393. Generate timestamps by counting samples:
  10394. @example
  10395. asetpts=N/SR/TB
  10396. @end example
  10397. @end itemize
  10398. @section settb, asettb
  10399. Set the timebase to use for the output frames timestamps.
  10400. It is mainly useful for testing timebase configuration.
  10401. It accepts the following parameters:
  10402. @table @option
  10403. @item expr, tb
  10404. The expression which is evaluated into the output timebase.
  10405. @end table
  10406. The value for @option{tb} is an arithmetic expression representing a
  10407. rational. The expression can contain the constants "AVTB" (the default
  10408. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  10409. audio only). Default value is "intb".
  10410. @subsection Examples
  10411. @itemize
  10412. @item
  10413. Set the timebase to 1/25:
  10414. @example
  10415. settb=expr=1/25
  10416. @end example
  10417. @item
  10418. Set the timebase to 1/10:
  10419. @example
  10420. settb=expr=0.1
  10421. @end example
  10422. @item
  10423. Set the timebase to 1001/1000:
  10424. @example
  10425. settb=1+0.001
  10426. @end example
  10427. @item
  10428. Set the timebase to 2*intb:
  10429. @example
  10430. settb=2*intb
  10431. @end example
  10432. @item
  10433. Set the default timebase value:
  10434. @example
  10435. settb=AVTB
  10436. @end example
  10437. @end itemize
  10438. @section showcqt
  10439. Convert input audio to a video output representing frequency spectrum
  10440. logarithmically using Brown-Puckette constant Q transform algorithm with
  10441. direct frequency domain coefficient calculation (but the transform itself
  10442. is not really constant Q, instead the Q factor is actually variable/clamped),
  10443. with musical tone scale, from E0 to D#10.
  10444. The filter accepts the following options:
  10445. @table @option
  10446. @item size, s
  10447. Specify the video size for the output. It must be even. For the syntax of this option,
  10448. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10449. Default value is @code{1920x1080}.
  10450. @item fps, rate, r
  10451. Set the output frame rate. Default value is @code{25}.
  10452. @item bar_h
  10453. Set the bargraph height. It must be even. Default value is @code{-1} which
  10454. computes the bargraph height automatically.
  10455. @item axis_h
  10456. Set the axis height. It must be even. Default value is @code{-1} which computes
  10457. the axis height automatically.
  10458. @item sono_h
  10459. Set the sonogram height. It must be even. Default value is @code{-1} which
  10460. computes the sonogram height automatically.
  10461. @item fullhd
  10462. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  10463. instead. Default value is @code{1}.
  10464. @item sono_v, volume
  10465. Specify the sonogram volume expression. It can contain variables:
  10466. @table @option
  10467. @item bar_v
  10468. the @var{bar_v} evaluated expression
  10469. @item frequency, freq, f
  10470. the frequency where it is evaluated
  10471. @item timeclamp, tc
  10472. the value of @var{timeclamp} option
  10473. @end table
  10474. and functions:
  10475. @table @option
  10476. @item a_weighting(f)
  10477. A-weighting of equal loudness
  10478. @item b_weighting(f)
  10479. B-weighting of equal loudness
  10480. @item c_weighting(f)
  10481. C-weighting of equal loudness.
  10482. @end table
  10483. Default value is @code{16}.
  10484. @item bar_v, volume2
  10485. Specify the bargraph volume expression. It can contain variables:
  10486. @table @option
  10487. @item sono_v
  10488. the @var{sono_v} evaluated expression
  10489. @item frequency, freq, f
  10490. the frequency where it is evaluated
  10491. @item timeclamp, tc
  10492. the value of @var{timeclamp} option
  10493. @end table
  10494. and functions:
  10495. @table @option
  10496. @item a_weighting(f)
  10497. A-weighting of equal loudness
  10498. @item b_weighting(f)
  10499. B-weighting of equal loudness
  10500. @item c_weighting(f)
  10501. C-weighting of equal loudness.
  10502. @end table
  10503. Default value is @code{sono_v}.
  10504. @item sono_g, gamma
  10505. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  10506. higher gamma makes the spectrum having more range. Default value is @code{3}.
  10507. Acceptable range is @code{[1, 7]}.
  10508. @item bar_g, gamma2
  10509. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  10510. @code{[1, 7]}.
  10511. @item timeclamp, tc
  10512. Specify the transform timeclamp. At low frequency, there is trade-off between
  10513. accuracy in time domain and frequency domain. If timeclamp is lower,
  10514. event in time domain is represented more accurately (such as fast bass drum),
  10515. otherwise event in frequency domain is represented more accurately
  10516. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  10517. @item basefreq
  10518. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  10519. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  10520. @item endfreq
  10521. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  10522. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  10523. @item coeffclamp
  10524. This option is deprecated and ignored.
  10525. @item tlength
  10526. Specify the transform length in time domain. Use this option to control accuracy
  10527. trade-off between time domain and frequency domain at every frequency sample.
  10528. It can contain variables:
  10529. @table @option
  10530. @item frequency, freq, f
  10531. the frequency where it is evaluated
  10532. @item timeclamp, tc
  10533. the value of @var{timeclamp} option.
  10534. @end table
  10535. Default value is @code{384*tc/(384+tc*f)}.
  10536. @item count
  10537. Specify the transform count for every video frame. Default value is @code{6}.
  10538. Acceptable range is @code{[1, 30]}.
  10539. @item fcount
  10540. Specify the transform count for every single pixel. Default value is @code{0},
  10541. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  10542. @item fontfile
  10543. Specify font file for use with freetype to draw the axis. If not specified,
  10544. use embedded font. Note that drawing with font file or embedded font is not
  10545. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  10546. option instead.
  10547. @item fontcolor
  10548. Specify font color expression. This is arithmetic expression that should return
  10549. integer value 0xRRGGBB. It can contain variables:
  10550. @table @option
  10551. @item frequency, freq, f
  10552. the frequency where it is evaluated
  10553. @item timeclamp, tc
  10554. the value of @var{timeclamp} option
  10555. @end table
  10556. and functions:
  10557. @table @option
  10558. @item midi(f)
  10559. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  10560. @item r(x), g(x), b(x)
  10561. red, green, and blue value of intensity x.
  10562. @end table
  10563. Default value is @code{st(0, (midi(f)-59.5)/12);
  10564. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  10565. r(1-ld(1)) + b(ld(1))}.
  10566. @item axisfile
  10567. Specify image file to draw the axis. This option override @var{fontfile} and
  10568. @var{fontcolor} option.
  10569. @item axis, text
  10570. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  10571. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  10572. Default value is @code{1}.
  10573. @end table
  10574. @subsection Examples
  10575. @itemize
  10576. @item
  10577. Playing audio while showing the spectrum:
  10578. @example
  10579. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  10580. @end example
  10581. @item
  10582. Same as above, but with frame rate 30 fps:
  10583. @example
  10584. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  10585. @end example
  10586. @item
  10587. Playing at 1280x720:
  10588. @example
  10589. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  10590. @end example
  10591. @item
  10592. Disable sonogram display:
  10593. @example
  10594. sono_h=0
  10595. @end example
  10596. @item
  10597. A1 and its harmonics: A1, A2, (near)E3, A3:
  10598. @example
  10599. 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),
  10600. asplit[a][out1]; [a] showcqt [out0]'
  10601. @end example
  10602. @item
  10603. Same as above, but with more accuracy in frequency domain:
  10604. @example
  10605. 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),
  10606. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  10607. @end example
  10608. @item
  10609. Custom volume:
  10610. @example
  10611. bar_v=10:sono_v=bar_v*a_weighting(f)
  10612. @end example
  10613. @item
  10614. Custom gamma, now spectrum is linear to the amplitude.
  10615. @example
  10616. bar_g=2:sono_g=2
  10617. @end example
  10618. @item
  10619. Custom tlength equation:
  10620. @example
  10621. 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)))'
  10622. @end example
  10623. @item
  10624. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  10625. @example
  10626. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  10627. @end example
  10628. @item
  10629. Custom frequency range with custom axis using image file:
  10630. @example
  10631. axisfile=myaxis.png:basefreq=40:endfreq=10000
  10632. @end example
  10633. @end itemize
  10634. @section showfreqs
  10635. Convert input audio to video output representing the audio power spectrum.
  10636. Audio amplitude is on Y-axis while frequency is on X-axis.
  10637. The filter accepts the following options:
  10638. @table @option
  10639. @item size, s
  10640. Specify size of video. For the syntax of this option, check the
  10641. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10642. Default is @code{1024x512}.
  10643. @item mode
  10644. Set display mode.
  10645. This set how each frequency bin will be represented.
  10646. It accepts the following values:
  10647. @table @samp
  10648. @item line
  10649. @item bar
  10650. @item dot
  10651. @end table
  10652. Default is @code{bar}.
  10653. @item ascale
  10654. Set amplitude scale.
  10655. It accepts the following values:
  10656. @table @samp
  10657. @item lin
  10658. Linear scale.
  10659. @item sqrt
  10660. Square root scale.
  10661. @item cbrt
  10662. Cubic root scale.
  10663. @item log
  10664. Logarithmic scale.
  10665. @end table
  10666. Default is @code{log}.
  10667. @item fscale
  10668. Set frequency scale.
  10669. It accepts the following values:
  10670. @table @samp
  10671. @item lin
  10672. Linear scale.
  10673. @item log
  10674. Logarithmic scale.
  10675. @item rlog
  10676. Reverse logarithmic scale.
  10677. @end table
  10678. Default is @code{lin}.
  10679. @item win_size
  10680. Set window size.
  10681. It accepts the following values:
  10682. @table @samp
  10683. @item w16
  10684. @item w32
  10685. @item w64
  10686. @item w128
  10687. @item w256
  10688. @item w512
  10689. @item w1024
  10690. @item w2048
  10691. @item w4096
  10692. @item w8192
  10693. @item w16384
  10694. @item w32768
  10695. @item w65536
  10696. @end table
  10697. Default is @code{w2048}
  10698. @item win_func
  10699. Set windowing function.
  10700. It accepts the following values:
  10701. @table @samp
  10702. @item rect
  10703. @item bartlett
  10704. @item hanning
  10705. @item hamming
  10706. @item blackman
  10707. @item welch
  10708. @item flattop
  10709. @item bharris
  10710. @item bnuttall
  10711. @item bhann
  10712. @item sine
  10713. @item nuttall
  10714. @item lanczos
  10715. @item gauss
  10716. @end table
  10717. Default is @code{hanning}.
  10718. @item overlap
  10719. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  10720. which means optimal overlap for selected window function will be picked.
  10721. @item averaging
  10722. Set time averaging. Setting this to 0 will display current maximal peaks.
  10723. Default is @code{1}, which means time averaging is disabled.
  10724. @item colors
  10725. Specify list of colors separated by space or by '|' which will be used to
  10726. draw channel frequencies. Unrecognized or missing colors will be replaced
  10727. by white color.
  10728. @end table
  10729. @section showspectrum
  10730. Convert input audio to a video output, representing the audio frequency
  10731. spectrum.
  10732. The filter accepts the following options:
  10733. @table @option
  10734. @item size, s
  10735. Specify the video size for the output. For the syntax of this option, check the
  10736. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10737. Default value is @code{640x512}.
  10738. @item slide
  10739. Specify how the spectrum should slide along the window.
  10740. It accepts the following values:
  10741. @table @samp
  10742. @item replace
  10743. the samples start again on the left when they reach the right
  10744. @item scroll
  10745. the samples scroll from right to left
  10746. @item fullframe
  10747. frames are only produced when the samples reach the right
  10748. @end table
  10749. Default value is @code{replace}.
  10750. @item mode
  10751. Specify display mode.
  10752. It accepts the following values:
  10753. @table @samp
  10754. @item combined
  10755. all channels are displayed in the same row
  10756. @item separate
  10757. all channels are displayed in separate rows
  10758. @end table
  10759. Default value is @samp{combined}.
  10760. @item color
  10761. Specify display color mode.
  10762. It accepts the following values:
  10763. @table @samp
  10764. @item channel
  10765. each channel is displayed in a separate color
  10766. @item intensity
  10767. each channel is is displayed using the same color scheme
  10768. @end table
  10769. Default value is @samp{channel}.
  10770. @item scale
  10771. Specify scale used for calculating intensity color values.
  10772. It accepts the following values:
  10773. @table @samp
  10774. @item lin
  10775. linear
  10776. @item sqrt
  10777. square root, default
  10778. @item cbrt
  10779. cubic root
  10780. @item log
  10781. logarithmic
  10782. @end table
  10783. Default value is @samp{sqrt}.
  10784. @item saturation
  10785. Set saturation modifier for displayed colors. Negative values provide
  10786. alternative color scheme. @code{0} is no saturation at all.
  10787. Saturation must be in [-10.0, 10.0] range.
  10788. Default value is @code{1}.
  10789. @item win_func
  10790. Set window function.
  10791. It accepts the following values:
  10792. @table @samp
  10793. @item none
  10794. No samples pre-processing (do not expect this to be faster)
  10795. @item hann
  10796. Hann window
  10797. @item hamming
  10798. Hamming window
  10799. @item blackman
  10800. Blackman window
  10801. @end table
  10802. Default value is @code{hann}.
  10803. @end table
  10804. The usage is very similar to the showwaves filter; see the examples in that
  10805. section.
  10806. @subsection Examples
  10807. @itemize
  10808. @item
  10809. Large window with logarithmic color scaling:
  10810. @example
  10811. showspectrum=s=1280x480:scale=log
  10812. @end example
  10813. @item
  10814. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  10815. @example
  10816. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  10817. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  10818. @end example
  10819. @end itemize
  10820. @section showvolume
  10821. Convert input audio volume to a video output.
  10822. The filter accepts the following options:
  10823. @table @option
  10824. @item rate, r
  10825. Set video rate.
  10826. @item b
  10827. Set border width, allowed range is [0, 5]. Default is 1.
  10828. @item w
  10829. Set channel width, allowed range is [40, 1080]. Default is 400.
  10830. @item h
  10831. Set channel height, allowed range is [1, 100]. Default is 20.
  10832. @item f
  10833. Set fade, allowed range is [1, 255]. Default is 20.
  10834. @item c
  10835. Set volume color expression.
  10836. The expression can use the following variables:
  10837. @table @option
  10838. @item VOLUME
  10839. Current max volume of channel in dB.
  10840. @item CHANNEL
  10841. Current channel number, starting from 0.
  10842. @end table
  10843. @item t
  10844. If set, displays channel names. Default is enabled.
  10845. @end table
  10846. @section showwaves
  10847. Convert input audio to a video output, representing the samples waves.
  10848. The filter accepts the following options:
  10849. @table @option
  10850. @item size, s
  10851. Specify the video size for the output. For the syntax of this option, check the
  10852. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10853. Default value is @code{600x240}.
  10854. @item mode
  10855. Set display mode.
  10856. Available values are:
  10857. @table @samp
  10858. @item point
  10859. Draw a point for each sample.
  10860. @item line
  10861. Draw a vertical line for each sample.
  10862. @item p2p
  10863. Draw a point for each sample and a line between them.
  10864. @item cline
  10865. Draw a centered vertical line for each sample.
  10866. @end table
  10867. Default value is @code{point}.
  10868. @item n
  10869. Set the number of samples which are printed on the same column. A
  10870. larger value will decrease the frame rate. Must be a positive
  10871. integer. This option can be set only if the value for @var{rate}
  10872. is not explicitly specified.
  10873. @item rate, r
  10874. Set the (approximate) output frame rate. This is done by setting the
  10875. option @var{n}. Default value is "25".
  10876. @item split_channels
  10877. Set if channels should be drawn separately or overlap. Default value is 0.
  10878. @end table
  10879. @subsection Examples
  10880. @itemize
  10881. @item
  10882. Output the input file audio and the corresponding video representation
  10883. at the same time:
  10884. @example
  10885. amovie=a.mp3,asplit[out0],showwaves[out1]
  10886. @end example
  10887. @item
  10888. Create a synthetic signal and show it with showwaves, forcing a
  10889. frame rate of 30 frames per second:
  10890. @example
  10891. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  10892. @end example
  10893. @end itemize
  10894. @section showwavespic
  10895. Convert input audio to a single video frame, representing the samples waves.
  10896. The filter accepts the following options:
  10897. @table @option
  10898. @item size, s
  10899. Specify the video size for the output. For the syntax of this option, check the
  10900. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10901. Default value is @code{600x240}.
  10902. @item split_channels
  10903. Set if channels should be drawn separately or overlap. Default value is 0.
  10904. @end table
  10905. @subsection Examples
  10906. @itemize
  10907. @item
  10908. Extract a channel split representation of the wave form of a whole audio track
  10909. in a 1024x800 picture using @command{ffmpeg}:
  10910. @example
  10911. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  10912. @end example
  10913. @end itemize
  10914. @section split, asplit
  10915. Split input into several identical outputs.
  10916. @code{asplit} works with audio input, @code{split} with video.
  10917. The filter accepts a single parameter which specifies the number of outputs. If
  10918. unspecified, it defaults to 2.
  10919. @subsection Examples
  10920. @itemize
  10921. @item
  10922. Create two separate outputs from the same input:
  10923. @example
  10924. [in] split [out0][out1]
  10925. @end example
  10926. @item
  10927. To create 3 or more outputs, you need to specify the number of
  10928. outputs, like in:
  10929. @example
  10930. [in] asplit=3 [out0][out1][out2]
  10931. @end example
  10932. @item
  10933. Create two separate outputs from the same input, one cropped and
  10934. one padded:
  10935. @example
  10936. [in] split [splitout1][splitout2];
  10937. [splitout1] crop=100:100:0:0 [cropout];
  10938. [splitout2] pad=200:200:100:100 [padout];
  10939. @end example
  10940. @item
  10941. Create 5 copies of the input audio with @command{ffmpeg}:
  10942. @example
  10943. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  10944. @end example
  10945. @end itemize
  10946. @section zmq, azmq
  10947. Receive commands sent through a libzmq client, and forward them to
  10948. filters in the filtergraph.
  10949. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  10950. must be inserted between two video filters, @code{azmq} between two
  10951. audio filters.
  10952. To enable these filters you need to install the libzmq library and
  10953. headers and configure FFmpeg with @code{--enable-libzmq}.
  10954. For more information about libzmq see:
  10955. @url{http://www.zeromq.org/}
  10956. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  10957. receives messages sent through a network interface defined by the
  10958. @option{bind_address} option.
  10959. The received message must be in the form:
  10960. @example
  10961. @var{TARGET} @var{COMMAND} [@var{ARG}]
  10962. @end example
  10963. @var{TARGET} specifies the target of the command, usually the name of
  10964. the filter class or a specific filter instance name.
  10965. @var{COMMAND} specifies the name of the command for the target filter.
  10966. @var{ARG} is optional and specifies the optional argument list for the
  10967. given @var{COMMAND}.
  10968. Upon reception, the message is processed and the corresponding command
  10969. is injected into the filtergraph. Depending on the result, the filter
  10970. will send a reply to the client, adopting the format:
  10971. @example
  10972. @var{ERROR_CODE} @var{ERROR_REASON}
  10973. @var{MESSAGE}
  10974. @end example
  10975. @var{MESSAGE} is optional.
  10976. @subsection Examples
  10977. Look at @file{tools/zmqsend} for an example of a zmq client which can
  10978. be used to send commands processed by these filters.
  10979. Consider the following filtergraph generated by @command{ffplay}
  10980. @example
  10981. ffplay -dumpgraph 1 -f lavfi "
  10982. color=s=100x100:c=red [l];
  10983. color=s=100x100:c=blue [r];
  10984. nullsrc=s=200x100, zmq [bg];
  10985. [bg][l] overlay [bg+l];
  10986. [bg+l][r] overlay=x=100 "
  10987. @end example
  10988. To change the color of the left side of the video, the following
  10989. command can be used:
  10990. @example
  10991. echo Parsed_color_0 c yellow | tools/zmqsend
  10992. @end example
  10993. To change the right side:
  10994. @example
  10995. echo Parsed_color_1 c pink | tools/zmqsend
  10996. @end example
  10997. @c man end MULTIMEDIA FILTERS
  10998. @chapter Multimedia Sources
  10999. @c man begin MULTIMEDIA SOURCES
  11000. Below is a description of the currently available multimedia sources.
  11001. @section amovie
  11002. This is the same as @ref{movie} source, except it selects an audio
  11003. stream by default.
  11004. @anchor{movie}
  11005. @section movie
  11006. Read audio and/or video stream(s) from a movie container.
  11007. It accepts the following parameters:
  11008. @table @option
  11009. @item filename
  11010. The name of the resource to read (not necessarily a file; it can also be a
  11011. device or a stream accessed through some protocol).
  11012. @item format_name, f
  11013. Specifies the format assumed for the movie to read, and can be either
  11014. the name of a container or an input device. If not specified, the
  11015. format is guessed from @var{movie_name} or by probing.
  11016. @item seek_point, sp
  11017. Specifies the seek point in seconds. The frames will be output
  11018. starting from this seek point. The parameter is evaluated with
  11019. @code{av_strtod}, so the numerical value may be suffixed by an IS
  11020. postfix. The default value is "0".
  11021. @item streams, s
  11022. Specifies the streams to read. Several streams can be specified,
  11023. separated by "+". The source will then have as many outputs, in the
  11024. same order. The syntax is explained in the ``Stream specifiers''
  11025. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  11026. respectively the default (best suited) video and audio stream. Default
  11027. is "dv", or "da" if the filter is called as "amovie".
  11028. @item stream_index, si
  11029. Specifies the index of the video stream to read. If the value is -1,
  11030. the most suitable video stream will be automatically selected. The default
  11031. value is "-1". Deprecated. If the filter is called "amovie", it will select
  11032. audio instead of video.
  11033. @item loop
  11034. Specifies how many times to read the stream in sequence.
  11035. If the value is less than 1, the stream will be read again and again.
  11036. Default value is "1".
  11037. Note that when the movie is looped the source timestamps are not
  11038. changed, so it will generate non monotonically increasing timestamps.
  11039. @end table
  11040. It allows overlaying a second video on top of the main input of
  11041. a filtergraph, as shown in this graph:
  11042. @example
  11043. input -----------> deltapts0 --> overlay --> output
  11044. ^
  11045. |
  11046. movie --> scale--> deltapts1 -------+
  11047. @end example
  11048. @subsection Examples
  11049. @itemize
  11050. @item
  11051. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  11052. on top of the input labelled "in":
  11053. @example
  11054. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11055. [in] setpts=PTS-STARTPTS [main];
  11056. [main][over] overlay=16:16 [out]
  11057. @end example
  11058. @item
  11059. Read from a video4linux2 device, and overlay it on top of the input
  11060. labelled "in":
  11061. @example
  11062. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11063. [in] setpts=PTS-STARTPTS [main];
  11064. [main][over] overlay=16:16 [out]
  11065. @end example
  11066. @item
  11067. Read the first video stream and the audio stream with id 0x81 from
  11068. dvd.vob; the video is connected to the pad named "video" and the audio is
  11069. connected to the pad named "audio":
  11070. @example
  11071. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  11072. @end example
  11073. @end itemize
  11074. @c man end MULTIMEDIA SOURCES