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.

14081 lines
385KB

  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 bellow.
  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 astreamsync
  901. Forward two audio streams and control the order the buffers are forwarded.
  902. The filter accepts the following options:
  903. @table @option
  904. @item expr, e
  905. Set the expression deciding which stream should be
  906. forwarded next: if the result is negative, the first stream is forwarded; if
  907. the result is positive or zero, the second stream is forwarded. It can use
  908. the following variables:
  909. @table @var
  910. @item b1 b2
  911. number of buffers forwarded so far on each stream
  912. @item s1 s2
  913. number of samples forwarded so far on each stream
  914. @item t1 t2
  915. current timestamp of each stream
  916. @end table
  917. The default value is @code{t1-t2}, which means to always forward the stream
  918. that has a smaller timestamp.
  919. @end table
  920. @subsection Examples
  921. Stress-test @code{amerge} by randomly sending buffers on the wrong
  922. input, while avoiding too much of a desynchronization:
  923. @example
  924. amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
  925. [a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
  926. [a2] [b2] amerge
  927. @end example
  928. @section asyncts
  929. Synchronize audio data with timestamps by squeezing/stretching it and/or
  930. dropping samples/adding silence when needed.
  931. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  932. It accepts the following parameters:
  933. @table @option
  934. @item compensate
  935. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  936. by default. When disabled, time gaps are covered with silence.
  937. @item min_delta
  938. The minimum difference between timestamps and audio data (in seconds) to trigger
  939. adding/dropping samples. The default value is 0.1. If you get an imperfect
  940. sync with this filter, try setting this parameter to 0.
  941. @item max_comp
  942. The maximum compensation in samples per second. Only relevant with compensate=1.
  943. The default value is 500.
  944. @item first_pts
  945. Assume that the first PTS should be this value. The time base is 1 / sample
  946. rate. This allows for padding/trimming at the start of the stream. By default,
  947. no assumption is made about the first frame's expected PTS, so no padding or
  948. trimming is done. For example, this could be set to 0 to pad the beginning with
  949. silence if an audio stream starts after the video stream or to trim any samples
  950. with a negative PTS due to encoder delay.
  951. @end table
  952. @section atempo
  953. Adjust audio tempo.
  954. The filter accepts exactly one parameter, the audio tempo. If not
  955. specified then the filter will assume nominal 1.0 tempo. Tempo must
  956. be in the [0.5, 2.0] range.
  957. @subsection Examples
  958. @itemize
  959. @item
  960. Slow down audio to 80% tempo:
  961. @example
  962. atempo=0.8
  963. @end example
  964. @item
  965. To speed up audio to 125% tempo:
  966. @example
  967. atempo=1.25
  968. @end example
  969. @end itemize
  970. @section atrim
  971. Trim the input so that the output contains one continuous subpart of the input.
  972. It accepts the following parameters:
  973. @table @option
  974. @item start
  975. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  976. sample with the timestamp @var{start} will be the first sample in the output.
  977. @item end
  978. Specify time of the first audio sample that will be dropped, i.e. the
  979. audio sample immediately preceding the one with the timestamp @var{end} will be
  980. the last sample in the output.
  981. @item start_pts
  982. Same as @var{start}, except this option sets the start timestamp in samples
  983. instead of seconds.
  984. @item end_pts
  985. Same as @var{end}, except this option sets the end timestamp in samples instead
  986. of seconds.
  987. @item duration
  988. The maximum duration of the output in seconds.
  989. @item start_sample
  990. The number of the first sample that should be output.
  991. @item end_sample
  992. The number of the first sample that should be dropped.
  993. @end table
  994. @option{start}, @option{end}, and @option{duration} are expressed as time
  995. duration specifications; see
  996. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  997. Note that the first two sets of the start/end options and the @option{duration}
  998. option look at the frame timestamp, while the _sample options simply count the
  999. samples that pass through the filter. So start/end_pts and start/end_sample will
  1000. give different results when the timestamps are wrong, inexact or do not start at
  1001. zero. Also note that this filter does not modify the timestamps. If you wish
  1002. to have the output timestamps start at zero, insert the asetpts filter after the
  1003. atrim filter.
  1004. If multiple start or end options are set, this filter tries to be greedy and
  1005. keep all samples that match at least one of the specified constraints. To keep
  1006. only the part that matches all the constraints at once, chain multiple atrim
  1007. filters.
  1008. The defaults are such that all the input is kept. So it is possible to set e.g.
  1009. just the end values to keep everything before the specified time.
  1010. Examples:
  1011. @itemize
  1012. @item
  1013. Drop everything except the second minute of input:
  1014. @example
  1015. ffmpeg -i INPUT -af atrim=60:120
  1016. @end example
  1017. @item
  1018. Keep only the first 1000 samples:
  1019. @example
  1020. ffmpeg -i INPUT -af atrim=end_sample=1000
  1021. @end example
  1022. @end itemize
  1023. @section bandpass
  1024. Apply a two-pole Butterworth band-pass filter with central
  1025. frequency @var{frequency}, and (3dB-point) band-width width.
  1026. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1027. instead of the default: constant 0dB peak gain.
  1028. The filter roll off at 6dB per octave (20dB per decade).
  1029. The filter accepts the following options:
  1030. @table @option
  1031. @item frequency, f
  1032. Set the filter's central frequency. Default is @code{3000}.
  1033. @item csg
  1034. Constant skirt gain if set to 1. Defaults to 0.
  1035. @item width_type
  1036. Set method to specify band-width of filter.
  1037. @table @option
  1038. @item h
  1039. Hz
  1040. @item q
  1041. Q-Factor
  1042. @item o
  1043. octave
  1044. @item s
  1045. slope
  1046. @end table
  1047. @item width, w
  1048. Specify the band-width of a filter in width_type units.
  1049. @end table
  1050. @section bandreject
  1051. Apply a two-pole Butterworth band-reject filter with central
  1052. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1053. The filter roll off at 6dB per octave (20dB per decade).
  1054. The filter accepts the following options:
  1055. @table @option
  1056. @item frequency, f
  1057. Set the filter's central frequency. Default is @code{3000}.
  1058. @item width_type
  1059. Set method to specify band-width of filter.
  1060. @table @option
  1061. @item h
  1062. Hz
  1063. @item q
  1064. Q-Factor
  1065. @item o
  1066. octave
  1067. @item s
  1068. slope
  1069. @end table
  1070. @item width, w
  1071. Specify the band-width of a filter in width_type units.
  1072. @end table
  1073. @section bass
  1074. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1075. shelving filter with a response similar to that of a standard
  1076. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1077. The filter accepts the following options:
  1078. @table @option
  1079. @item gain, g
  1080. Give the gain at 0 Hz. Its useful range is about -20
  1081. (for a large cut) to +20 (for a large boost).
  1082. Beware of clipping when using a positive gain.
  1083. @item frequency, f
  1084. Set the filter's central frequency and so can be used
  1085. to extend or reduce the frequency range to be boosted or cut.
  1086. The default value is @code{100} Hz.
  1087. @item width_type
  1088. Set method to specify band-width of filter.
  1089. @table @option
  1090. @item h
  1091. Hz
  1092. @item q
  1093. Q-Factor
  1094. @item o
  1095. octave
  1096. @item s
  1097. slope
  1098. @end table
  1099. @item width, w
  1100. Determine how steep is the filter's shelf transition.
  1101. @end table
  1102. @section biquad
  1103. Apply a biquad IIR filter with the given coefficients.
  1104. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1105. are the numerator and denominator coefficients respectively.
  1106. @section bs2b
  1107. Bauer stereo to binaural transformation, which improves headphone listening of
  1108. stereo audio records.
  1109. It accepts the following parameters:
  1110. @table @option
  1111. @item profile
  1112. Pre-defined crossfeed level.
  1113. @table @option
  1114. @item default
  1115. Default level (fcut=700, feed=50).
  1116. @item cmoy
  1117. Chu Moy circuit (fcut=700, feed=60).
  1118. @item jmeier
  1119. Jan Meier circuit (fcut=650, feed=95).
  1120. @end table
  1121. @item fcut
  1122. Cut frequency (in Hz).
  1123. @item feed
  1124. Feed level (in Hz).
  1125. @end table
  1126. @section channelmap
  1127. Remap input channels to new locations.
  1128. It accepts the following parameters:
  1129. @table @option
  1130. @item channel_layout
  1131. The channel layout of the output stream.
  1132. @item map
  1133. Map channels from input to output. The argument is a '|'-separated list of
  1134. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1135. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1136. channel (e.g. FL for front left) or its index in the input channel layout.
  1137. @var{out_channel} is the name of the output channel or its index in the output
  1138. channel layout. If @var{out_channel} is not given then it is implicitly an
  1139. index, starting with zero and increasing by one for each mapping.
  1140. @end table
  1141. If no mapping is present, the filter will implicitly map input channels to
  1142. output channels, preserving indices.
  1143. For example, assuming a 5.1+downmix input MOV file,
  1144. @example
  1145. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1146. @end example
  1147. will create an output WAV file tagged as stereo from the downmix channels of
  1148. the input.
  1149. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1150. @example
  1151. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1152. @end example
  1153. @section channelsplit
  1154. Split each channel from an input audio stream into a separate output stream.
  1155. It accepts the following parameters:
  1156. @table @option
  1157. @item channel_layout
  1158. The channel layout of the input stream. The default is "stereo".
  1159. @end table
  1160. For example, assuming a stereo input MP3 file,
  1161. @example
  1162. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1163. @end example
  1164. will create an output Matroska file with two audio streams, one containing only
  1165. the left channel and the other the right channel.
  1166. Split a 5.1 WAV file into per-channel files:
  1167. @example
  1168. ffmpeg -i in.wav -filter_complex
  1169. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1170. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1171. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1172. side_right.wav
  1173. @end example
  1174. @section chorus
  1175. Add a chorus effect to the audio.
  1176. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1177. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1178. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1179. The modulation depth defines the range the modulated delay is played before or after
  1180. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1181. sound tuned around the original one, like in a chorus where some vocals are slightly
  1182. off key.
  1183. It accepts the following parameters:
  1184. @table @option
  1185. @item in_gain
  1186. Set input gain. Default is 0.4.
  1187. @item out_gain
  1188. Set output gain. Default is 0.4.
  1189. @item delays
  1190. Set delays. A typical delay is around 40ms to 60ms.
  1191. @item decays
  1192. Set decays.
  1193. @item speeds
  1194. Set speeds.
  1195. @item depths
  1196. Set depths.
  1197. @end table
  1198. @subsection Examples
  1199. @itemize
  1200. @item
  1201. A single delay:
  1202. @example
  1203. chorus=0.7:0.9:55:0.4:0.25:2
  1204. @end example
  1205. @item
  1206. Two delays:
  1207. @example
  1208. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1209. @end example
  1210. @item
  1211. Fuller sounding chorus with three delays:
  1212. @example
  1213. 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
  1214. @end example
  1215. @end itemize
  1216. @section compand
  1217. Compress or expand the audio's dynamic range.
  1218. It accepts the following parameters:
  1219. @table @option
  1220. @item attacks
  1221. @item decays
  1222. A list of times in seconds for each channel over which the instantaneous level
  1223. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1224. increase of volume and @var{decays} refers to decrease of volume. For most
  1225. situations, the attack time (response to the audio getting louder) should be
  1226. shorter than the decay time, because the human ear is more sensitive to sudden
  1227. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1228. a typical value for decay is 0.8 seconds.
  1229. If specified number of attacks & decays is lower than number of channels, the last
  1230. set attack/decay will be used for all remaining channels.
  1231. @item points
  1232. A list of points for the transfer function, specified in dB relative to the
  1233. maximum possible signal amplitude. Each key points list must be defined using
  1234. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1235. @code{x0/y0 x1/y1 x2/y2 ....}
  1236. The input values must be in strictly increasing order but the transfer function
  1237. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1238. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1239. function are @code{-70/-70|-60/-20}.
  1240. @item soft-knee
  1241. Set the curve radius in dB for all joints. It defaults to 0.01.
  1242. @item gain
  1243. Set the additional gain in dB to be applied at all points on the transfer
  1244. function. This allows for easy adjustment of the overall gain.
  1245. It defaults to 0.
  1246. @item volume
  1247. Set an initial volume, in dB, to be assumed for each channel when filtering
  1248. starts. This permits the user to supply a nominal level initially, so that, for
  1249. example, a very large gain is not applied to initial signal levels before the
  1250. companding has begun to operate. A typical value for audio which is initially
  1251. quiet is -90 dB. It defaults to 0.
  1252. @item delay
  1253. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1254. delayed before being fed to the volume adjuster. Specifying a delay
  1255. approximately equal to the attack/decay times allows the filter to effectively
  1256. operate in predictive rather than reactive mode. It defaults to 0.
  1257. @end table
  1258. @subsection Examples
  1259. @itemize
  1260. @item
  1261. Make music with both quiet and loud passages suitable for listening to in a
  1262. noisy environment:
  1263. @example
  1264. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1265. @end example
  1266. Another example for audio with whisper and explosion parts:
  1267. @example
  1268. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1269. @end example
  1270. @item
  1271. A noise gate for when the noise is at a lower level than the signal:
  1272. @example
  1273. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1274. @end example
  1275. @item
  1276. Here is another noise gate, this time for when the noise is at a higher level
  1277. than the signal (making it, in some ways, similar to squelch):
  1278. @example
  1279. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1280. @end example
  1281. @end itemize
  1282. @section dcshift
  1283. Apply a DC shift to the audio.
  1284. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1285. in the recording chain) from the audio. The effect of a DC offset is reduced
  1286. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1287. a signal has a DC offset.
  1288. @table @option
  1289. @item shift
  1290. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1291. the audio.
  1292. @item limitergain
  1293. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1294. used to prevent clipping.
  1295. @end table
  1296. @section dynaudnorm
  1297. Dynamic Audio Normalizer.
  1298. This filter applies a certain amount of gain to the input audio in order
  1299. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1300. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1301. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1302. This allows for applying extra gain to the "quiet" sections of the audio
  1303. while avoiding distortions or clipping the "loud" sections. In other words:
  1304. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1305. sections, in the sense that the volume of each section is brought to the
  1306. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1307. this goal *without* applying "dynamic range compressing". It will retain 100%
  1308. of the dynamic range *within* each section of the audio file.
  1309. @table @option
  1310. @item f
  1311. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1312. Default is 500 milliseconds.
  1313. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1314. referred to as frames. This is required, because a peak magnitude has no
  1315. meaning for just a single sample value. Instead, we need to determine the
  1316. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1317. normalizer would simply use the peak magnitude of the complete file, the
  1318. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1319. frame. The length of a frame is specified in milliseconds. By default, the
  1320. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1321. been found to give good results with most files.
  1322. Note that the exact frame length, in number of samples, will be determined
  1323. automatically, based on the sampling rate of the individual input audio file.
  1324. @item g
  1325. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1326. number. Default is 31.
  1327. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1328. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1329. is specified in frames, centered around the current frame. For the sake of
  1330. simplicity, this must be an odd number. Consequently, the default value of 31
  1331. takes into account the current frame, as well as the 15 preceding frames and
  1332. the 15 subsequent frames. Using a larger window results in a stronger
  1333. smoothing effect and thus in less gain variation, i.e. slower gain
  1334. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1335. effect and thus in more gain variation, i.e. faster gain adaptation.
  1336. In other words, the more you increase this value, the more the Dynamic Audio
  1337. Normalizer will behave like a "traditional" normalization filter. On the
  1338. contrary, the more you decrease this value, the more the Dynamic Audio
  1339. Normalizer will behave like a dynamic range compressor.
  1340. @item p
  1341. Set the target peak value. This specifies the highest permissible magnitude
  1342. level for the normalized audio input. This filter will try to approach the
  1343. target peak magnitude as closely as possible, but at the same time it also
  1344. makes sure that the normalized signal will never exceed the peak magnitude.
  1345. A frame's maximum local gain factor is imposed directly by the target peak
  1346. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1347. It is not recommended to go above this value.
  1348. @item m
  1349. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1350. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1351. factor for each input frame, i.e. the maximum gain factor that does not
  1352. result in clipping or distortion. The maximum gain factor is determined by
  1353. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1354. additionally bounds the frame's maximum gain factor by a predetermined
  1355. (global) maximum gain factor. This is done in order to avoid excessive gain
  1356. factors in "silent" or almost silent frames. By default, the maximum gain
  1357. factor is 10.0, For most inputs the default value should be sufficient and
  1358. it usually is not recommended to increase this value. Though, for input
  1359. with an extremely low overall volume level, it may be necessary to allow even
  1360. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1361. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1362. Instead, a "sigmoid" threshold function will be applied. This way, the
  1363. gain factors will smoothly approach the threshold value, but never exceed that
  1364. value.
  1365. @item r
  1366. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1367. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1368. This means that the maximum local gain factor for each frame is defined
  1369. (only) by the frame's highest magnitude sample. This way, the samples can
  1370. be amplified as much as possible without exceeding the maximum signal
  1371. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1372. Normalizer can also take into account the frame's root mean square,
  1373. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1374. determine the power of a time-varying signal. It is therefore considered
  1375. that the RMS is a better approximation of the "perceived loudness" than
  1376. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1377. frames to a constant RMS value, a uniform "perceived loudness" can be
  1378. established. If a target RMS value has been specified, a frame's local gain
  1379. factor is defined as the factor that would result in exactly that RMS value.
  1380. Note, however, that the maximum local gain factor is still restricted by the
  1381. frame's highest magnitude sample, in order to prevent clipping.
  1382. @item n
  1383. Enable channels coupling. By default is enabled.
  1384. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1385. amount. This means the same gain factor will be applied to all channels, i.e.
  1386. the maximum possible gain factor is determined by the "loudest" channel.
  1387. However, in some recordings, it may happen that the volume of the different
  1388. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1389. In this case, this option can be used to disable the channel coupling. This way,
  1390. the gain factor will be determined independently for each channel, depending
  1391. only on the individual channel's highest magnitude sample. This allows for
  1392. harmonizing the volume of the different channels.
  1393. @item c
  1394. Enable DC bias correction. By default is disabled.
  1395. An audio signal (in the time domain) is a sequence of sample values.
  1396. In the Dynamic Audio Normalizer these sample values are represented in the
  1397. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1398. audio signal, or "waveform", should be centered around the zero point.
  1399. That means if we calculate the mean value of all samples in a file, or in a
  1400. single frame, then the result should be 0.0 or at least very close to that
  1401. value. If, however, there is a significant deviation of the mean value from
  1402. 0.0, in either positive or negative direction, this is referred to as a
  1403. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1404. Audio Normalizer provides optional DC bias correction.
  1405. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1406. the mean value, or "DC correction" offset, of each input frame and subtract
  1407. that value from all of the frame's sample values which ensures those samples
  1408. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1409. boundaries, the DC correction offset values will be interpolated smoothly
  1410. between neighbouring frames.
  1411. @item b
  1412. Enable alternative boundary mode. By default is disabled.
  1413. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1414. around each frame. This includes the preceding frames as well as the
  1415. subsequent frames. However, for the "boundary" frames, located at the very
  1416. beginning and at the very end of the audio file, not all neighbouring
  1417. frames are available. In particular, for the first few frames in the audio
  1418. file, the preceding frames are not known. And, similarly, for the last few
  1419. frames in the audio file, the subsequent frames are not known. Thus, the
  1420. question arises which gain factors should be assumed for the missing frames
  1421. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1422. to deal with this situation. The default boundary mode assumes a gain factor
  1423. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1424. "fade out" at the beginning and at the end of the input, respectively.
  1425. @item s
  1426. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1427. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1428. compression. This means that signal peaks will not be pruned and thus the
  1429. full dynamic range will be retained within each local neighbourhood. However,
  1430. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1431. normalization algorithm with a more "traditional" compression.
  1432. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1433. (thresholding) function. If (and only if) the compression feature is enabled,
  1434. all input frames will be processed by a soft knee thresholding function prior
  1435. to the actual normalization process. Put simply, the thresholding function is
  1436. going to prune all samples whose magnitude exceeds a certain threshold value.
  1437. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1438. value. Instead, the threshold value will be adjusted for each individual
  1439. frame.
  1440. In general, smaller parameters result in stronger compression, and vice versa.
  1441. Values below 3.0 are not recommended, because audible distortion may appear.
  1442. @end table
  1443. @section earwax
  1444. Make audio easier to listen to on headphones.
  1445. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1446. so that when listened to on headphones the stereo image is moved from
  1447. inside your head (standard for headphones) to outside and in front of
  1448. the listener (standard for speakers).
  1449. Ported from SoX.
  1450. @section equalizer
  1451. Apply a two-pole peaking equalisation (EQ) filter. With this
  1452. filter, the signal-level at and around a selected frequency can
  1453. be increased or decreased, whilst (unlike bandpass and bandreject
  1454. filters) that at all other frequencies is unchanged.
  1455. In order to produce complex equalisation curves, this filter can
  1456. be given several times, each with a different central frequency.
  1457. The filter accepts the following options:
  1458. @table @option
  1459. @item frequency, f
  1460. Set the filter's central frequency in Hz.
  1461. @item width_type
  1462. Set method to specify band-width of filter.
  1463. @table @option
  1464. @item h
  1465. Hz
  1466. @item q
  1467. Q-Factor
  1468. @item o
  1469. octave
  1470. @item s
  1471. slope
  1472. @end table
  1473. @item width, w
  1474. Specify the band-width of a filter in width_type units.
  1475. @item gain, g
  1476. Set the required gain or attenuation in dB.
  1477. Beware of clipping when using a positive gain.
  1478. @end table
  1479. @subsection Examples
  1480. @itemize
  1481. @item
  1482. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1483. @example
  1484. equalizer=f=1000:width_type=h:width=200:g=-10
  1485. @end example
  1486. @item
  1487. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1488. @example
  1489. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1490. @end example
  1491. @end itemize
  1492. @section extrastereo
  1493. Linearly increases the difference between left and right channels which
  1494. adds some sort of "live" effect to playback.
  1495. The filter accepts the following option:
  1496. @table @option
  1497. @item m
  1498. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1499. (average of both channels), with 1.0 sound will be unchanged, with
  1500. -1.0 left and right channels will be swapped.
  1501. @item c
  1502. Enable clipping. By default is enabled.
  1503. @end table
  1504. @section flanger
  1505. Apply a flanging effect to the audio.
  1506. The filter accepts the following options:
  1507. @table @option
  1508. @item delay
  1509. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1510. @item depth
  1511. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1512. @item regen
  1513. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1514. Default value is 0.
  1515. @item width
  1516. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1517. Default value is 71.
  1518. @item speed
  1519. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1520. @item shape
  1521. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1522. Default value is @var{sinusoidal}.
  1523. @item phase
  1524. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1525. Default value is 25.
  1526. @item interp
  1527. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1528. Default is @var{linear}.
  1529. @end table
  1530. @section highpass
  1531. Apply a high-pass filter with 3dB point frequency.
  1532. The filter can be either single-pole, or double-pole (the default).
  1533. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1534. The filter accepts the following options:
  1535. @table @option
  1536. @item frequency, f
  1537. Set frequency in Hz. Default is 3000.
  1538. @item poles, p
  1539. Set number of poles. Default is 2.
  1540. @item width_type
  1541. Set method to specify band-width of filter.
  1542. @table @option
  1543. @item h
  1544. Hz
  1545. @item q
  1546. Q-Factor
  1547. @item o
  1548. octave
  1549. @item s
  1550. slope
  1551. @end table
  1552. @item width, w
  1553. Specify the band-width of a filter in width_type units.
  1554. Applies only to double-pole filter.
  1555. The default is 0.707q and gives a Butterworth response.
  1556. @end table
  1557. @section join
  1558. Join multiple input streams into one multi-channel stream.
  1559. It accepts the following parameters:
  1560. @table @option
  1561. @item inputs
  1562. The number of input streams. It defaults to 2.
  1563. @item channel_layout
  1564. The desired output channel layout. It defaults to stereo.
  1565. @item map
  1566. Map channels from inputs to output. The argument is a '|'-separated list of
  1567. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  1568. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  1569. can be either the name of the input channel (e.g. FL for front left) or its
  1570. index in the specified input stream. @var{out_channel} is the name of the output
  1571. channel.
  1572. @end table
  1573. The filter will attempt to guess the mappings when they are not specified
  1574. explicitly. It does so by first trying to find an unused matching input channel
  1575. and if that fails it picks the first unused input channel.
  1576. Join 3 inputs (with properly set channel layouts):
  1577. @example
  1578. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1579. @end example
  1580. Build a 5.1 output from 6 single-channel streams:
  1581. @example
  1582. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1583. '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'
  1584. out
  1585. @end example
  1586. @section ladspa
  1587. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  1588. To enable compilation of this filter you need to configure FFmpeg with
  1589. @code{--enable-ladspa}.
  1590. @table @option
  1591. @item file, f
  1592. Specifies the name of LADSPA plugin library to load. If the environment
  1593. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  1594. each one of the directories specified by the colon separated list in
  1595. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  1596. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  1597. @file{/usr/lib/ladspa/}.
  1598. @item plugin, p
  1599. Specifies the plugin within the library. Some libraries contain only
  1600. one plugin, but others contain many of them. If this is not set filter
  1601. will list all available plugins within the specified library.
  1602. @item controls, c
  1603. Set the '|' separated list of controls which are zero or more floating point
  1604. values that determine the behavior of the loaded plugin (for example delay,
  1605. threshold or gain).
  1606. Controls need to be defined using the following syntax:
  1607. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  1608. @var{valuei} is the value set on the @var{i}-th control.
  1609. Alternatively they can be also defined using the following syntax:
  1610. @var{value0}|@var{value1}|@var{value2}|..., where
  1611. @var{valuei} is the value set on the @var{i}-th control.
  1612. If @option{controls} is set to @code{help}, all available controls and
  1613. their valid ranges are printed.
  1614. @item sample_rate, s
  1615. Specify the sample rate, default to 44100. Only used if plugin have
  1616. zero inputs.
  1617. @item nb_samples, n
  1618. Set the number of samples per channel per each output frame, default
  1619. is 1024. Only used if plugin have zero inputs.
  1620. @item duration, d
  1621. Set the minimum duration of the sourced audio. See
  1622. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1623. for the accepted syntax.
  1624. Note that the resulting duration may be greater than the specified duration,
  1625. as the generated audio is always cut at the end of a complete frame.
  1626. If not specified, or the expressed duration is negative, the audio is
  1627. supposed to be generated forever.
  1628. Only used if plugin have zero inputs.
  1629. @end table
  1630. @subsection Examples
  1631. @itemize
  1632. @item
  1633. List all available plugins within amp (LADSPA example plugin) library:
  1634. @example
  1635. ladspa=file=amp
  1636. @end example
  1637. @item
  1638. List all available controls and their valid ranges for @code{vcf_notch}
  1639. plugin from @code{VCF} library:
  1640. @example
  1641. ladspa=f=vcf:p=vcf_notch:c=help
  1642. @end example
  1643. @item
  1644. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  1645. plugin library:
  1646. @example
  1647. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  1648. @end example
  1649. @item
  1650. Add reverberation to the audio using TAP-plugins
  1651. (Tom's Audio Processing plugins):
  1652. @example
  1653. ladspa=file=tap_reverb:tap_reverb
  1654. @end example
  1655. @item
  1656. Generate white noise, with 0.2 amplitude:
  1657. @example
  1658. ladspa=file=cmt:noise_source_white:c=c0=.2
  1659. @end example
  1660. @item
  1661. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  1662. @code{C* Audio Plugin Suite} (CAPS) library:
  1663. @example
  1664. ladspa=file=caps:Click:c=c1=20'
  1665. @end example
  1666. @item
  1667. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  1668. @example
  1669. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  1670. @end example
  1671. @item
  1672. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  1673. @code{SWH Plugins} collection:
  1674. @example
  1675. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  1676. @end example
  1677. @item
  1678. Attenuate low frequencies using Multiband EQ from Steve Harris
  1679. @code{SWH Plugins} collection:
  1680. @example
  1681. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  1682. @end example
  1683. @end itemize
  1684. @subsection Commands
  1685. This filter supports the following commands:
  1686. @table @option
  1687. @item cN
  1688. Modify the @var{N}-th control value.
  1689. If the specified value is not valid, it is ignored and prior one is kept.
  1690. @end table
  1691. @section lowpass
  1692. Apply a low-pass filter with 3dB point frequency.
  1693. The filter can be either single-pole or double-pole (the default).
  1694. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1695. The filter accepts the following options:
  1696. @table @option
  1697. @item frequency, f
  1698. Set frequency in Hz. Default is 500.
  1699. @item poles, p
  1700. Set number of poles. Default is 2.
  1701. @item width_type
  1702. Set method to specify band-width of filter.
  1703. @table @option
  1704. @item h
  1705. Hz
  1706. @item q
  1707. Q-Factor
  1708. @item o
  1709. octave
  1710. @item s
  1711. slope
  1712. @end table
  1713. @item width, w
  1714. Specify the band-width of a filter in width_type units.
  1715. Applies only to double-pole filter.
  1716. The default is 0.707q and gives a Butterworth response.
  1717. @end table
  1718. @anchor{pan}
  1719. @section pan
  1720. Mix channels with specific gain levels. The filter accepts the output
  1721. channel layout followed by a set of channels definitions.
  1722. This filter is also designed to efficiently remap the channels of an audio
  1723. stream.
  1724. The filter accepts parameters of the form:
  1725. "@var{l}|@var{outdef}|@var{outdef}|..."
  1726. @table @option
  1727. @item l
  1728. output channel layout or number of channels
  1729. @item outdef
  1730. output channel specification, of the form:
  1731. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  1732. @item out_name
  1733. output channel to define, either a channel name (FL, FR, etc.) or a channel
  1734. number (c0, c1, etc.)
  1735. @item gain
  1736. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  1737. @item in_name
  1738. input channel to use, see out_name for details; it is not possible to mix
  1739. named and numbered input channels
  1740. @end table
  1741. If the `=' in a channel specification is replaced by `<', then the gains for
  1742. that specification will be renormalized so that the total is 1, thus
  1743. avoiding clipping noise.
  1744. @subsection Mixing examples
  1745. For example, if you want to down-mix from stereo to mono, but with a bigger
  1746. factor for the left channel:
  1747. @example
  1748. pan=1c|c0=0.9*c0+0.1*c1
  1749. @end example
  1750. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  1751. 7-channels surround:
  1752. @example
  1753. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  1754. @end example
  1755. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  1756. that should be preferred (see "-ac" option) unless you have very specific
  1757. needs.
  1758. @subsection Remapping examples
  1759. The channel remapping will be effective if, and only if:
  1760. @itemize
  1761. @item gain coefficients are zeroes or ones,
  1762. @item only one input per channel output,
  1763. @end itemize
  1764. If all these conditions are satisfied, the filter will notify the user ("Pure
  1765. channel mapping detected"), and use an optimized and lossless method to do the
  1766. remapping.
  1767. For example, if you have a 5.1 source and want a stereo audio stream by
  1768. dropping the extra channels:
  1769. @example
  1770. pan="stereo| c0=FL | c1=FR"
  1771. @end example
  1772. Given the same source, you can also switch front left and front right channels
  1773. and keep the input channel layout:
  1774. @example
  1775. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  1776. @end example
  1777. If the input is a stereo audio stream, you can mute the front left channel (and
  1778. still keep the stereo channel layout) with:
  1779. @example
  1780. pan="stereo|c1=c1"
  1781. @end example
  1782. Still with a stereo audio stream input, you can copy the right channel in both
  1783. front left and right:
  1784. @example
  1785. pan="stereo| c0=FR | c1=FR"
  1786. @end example
  1787. @section replaygain
  1788. ReplayGain scanner filter. This filter takes an audio stream as an input and
  1789. outputs it unchanged.
  1790. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  1791. @section resample
  1792. Convert the audio sample format, sample rate and channel layout. It is
  1793. not meant to be used directly.
  1794. @section rubberband
  1795. Apply time-stretching and pitch-shifting with librubberband.
  1796. The filter accepts the following options:
  1797. @table @option
  1798. @item tempo
  1799. Set tempo scale factor.
  1800. @item pitch
  1801. Set pitch scale factor.
  1802. @item transients
  1803. Set transients detector.
  1804. Possible values are:
  1805. @table @var
  1806. @item crisp
  1807. @item mixed
  1808. @item smooth
  1809. @end table
  1810. @item detector
  1811. Set detector.
  1812. Possible values are:
  1813. @table @var
  1814. @item compound
  1815. @item percussive
  1816. @item soft
  1817. @end table
  1818. @item phase
  1819. Set phase.
  1820. Possible values are:
  1821. @table @var
  1822. @item laminar
  1823. @item independent
  1824. @end table
  1825. @item window
  1826. Set processing window size.
  1827. Possible values are:
  1828. @table @var
  1829. @item standard
  1830. @item short
  1831. @item long
  1832. @end table
  1833. @item smoothing
  1834. Set smoothing.
  1835. Possible values are:
  1836. @table @var
  1837. @item off
  1838. @item on
  1839. @end table
  1840. @item formant
  1841. Enable formant preservation when shift pitching.
  1842. Possible values are:
  1843. @table @var
  1844. @item shifted
  1845. @item preserved
  1846. @end table
  1847. @item pitchq
  1848. Set pitch quality.
  1849. Possible values are:
  1850. @table @var
  1851. @item quality
  1852. @item speed
  1853. @item consistency
  1854. @end table
  1855. @item channels
  1856. Set channels.
  1857. Possible values are:
  1858. @table @var
  1859. @item apart
  1860. @item together
  1861. @end table
  1862. @end table
  1863. @section sidechaincompress
  1864. This filter acts like normal compressor but has the ability to compress
  1865. detected signal using second input signal.
  1866. It needs two input streams and returns one output stream.
  1867. First input stream will be processed depending on second stream signal.
  1868. The filtered signal then can be filtered with other filters in later stages of
  1869. processing. See @ref{pan} and @ref{amerge} filter.
  1870. The filter accepts the following options:
  1871. @table @option
  1872. @item threshold
  1873. If a signal of second stream raises above this level it will affect the gain
  1874. reduction of first stream.
  1875. By default is 0.125. Range is between 0.00097563 and 1.
  1876. @item ratio
  1877. Set a ratio about which the signal is reduced. 1:2 means that if the level
  1878. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  1879. Default is 2. Range is between 1 and 20.
  1880. @item attack
  1881. Amount of milliseconds the signal has to rise above the threshold before gain
  1882. reduction starts. Default is 20. Range is between 0.01 and 2000.
  1883. @item release
  1884. Amount of milliseconds the signal has to fall bellow the threshold before
  1885. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  1886. @item makeup
  1887. Set the amount by how much signal will be amplified after processing.
  1888. Default is 2. Range is from 1 and 64.
  1889. @item knee
  1890. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1891. Default is 2.82843. Range is between 1 and 8.
  1892. @item link
  1893. Choose if the @code{average} level between all channels of side-chain stream
  1894. or the louder(@code{maximum}) channel of side-chain stream affects the
  1895. reduction. Default is @code{average}.
  1896. @item detection
  1897. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  1898. of @code{rms}. Default is @code{rms} which is mainly smoother.
  1899. @end table
  1900. @subsection Examples
  1901. @itemize
  1902. @item
  1903. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  1904. depending on the signal of 2nd input and later compressed signal to be
  1905. merged with 2nd input:
  1906. @example
  1907. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  1908. @end example
  1909. @end itemize
  1910. @section silencedetect
  1911. Detect silence in an audio stream.
  1912. This filter logs a message when it detects that the input audio volume is less
  1913. or equal to a noise tolerance value for a duration greater or equal to the
  1914. minimum detected noise duration.
  1915. The printed times and duration are expressed in seconds.
  1916. The filter accepts the following options:
  1917. @table @option
  1918. @item duration, d
  1919. Set silence duration until notification (default is 2 seconds).
  1920. @item noise, n
  1921. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  1922. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  1923. @end table
  1924. @subsection Examples
  1925. @itemize
  1926. @item
  1927. Detect 5 seconds of silence with -50dB noise tolerance:
  1928. @example
  1929. silencedetect=n=-50dB:d=5
  1930. @end example
  1931. @item
  1932. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  1933. tolerance in @file{silence.mp3}:
  1934. @example
  1935. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  1936. @end example
  1937. @end itemize
  1938. @section silenceremove
  1939. Remove silence from the beginning, middle or end of the audio.
  1940. The filter accepts the following options:
  1941. @table @option
  1942. @item start_periods
  1943. This value is used to indicate if audio should be trimmed at beginning of
  1944. the audio. A value of zero indicates no silence should be trimmed from the
  1945. beginning. When specifying a non-zero value, it trims audio up until it
  1946. finds non-silence. Normally, when trimming silence from beginning of audio
  1947. the @var{start_periods} will be @code{1} but it can be increased to higher
  1948. values to trim all audio up to specific count of non-silence periods.
  1949. Default value is @code{0}.
  1950. @item start_duration
  1951. Specify the amount of time that non-silence must be detected before it stops
  1952. trimming audio. By increasing the duration, bursts of noises can be treated
  1953. as silence and trimmed off. Default value is @code{0}.
  1954. @item start_threshold
  1955. This indicates what sample value should be treated as silence. For digital
  1956. audio, a value of @code{0} may be fine but for audio recorded from analog,
  1957. you may wish to increase the value to account for background noise.
  1958. Can be specified in dB (in case "dB" is appended to the specified value)
  1959. or amplitude ratio. Default value is @code{0}.
  1960. @item stop_periods
  1961. Set the count for trimming silence from the end of audio.
  1962. To remove silence from the middle of a file, specify a @var{stop_periods}
  1963. that is negative. This value is then treated as a positive value and is
  1964. used to indicate the effect should restart processing as specified by
  1965. @var{start_periods}, making it suitable for removing periods of silence
  1966. in the middle of the audio.
  1967. Default value is @code{0}.
  1968. @item stop_duration
  1969. Specify a duration of silence that must exist before audio is not copied any
  1970. more. By specifying a higher duration, silence that is wanted can be left in
  1971. the audio.
  1972. Default value is @code{0}.
  1973. @item stop_threshold
  1974. This is the same as @option{start_threshold} but for trimming silence from
  1975. the end of audio.
  1976. Can be specified in dB (in case "dB" is appended to the specified value)
  1977. or amplitude ratio. Default value is @code{0}.
  1978. @item leave_silence
  1979. This indicate that @var{stop_duration} length of audio should be left intact
  1980. at the beginning of each period of silence.
  1981. For example, if you want to remove long pauses between words but do not want
  1982. to remove the pauses completely. Default value is @code{0}.
  1983. @end table
  1984. @subsection Examples
  1985. @itemize
  1986. @item
  1987. The following example shows how this filter can be used to start a recording
  1988. that does not contain the delay at the start which usually occurs between
  1989. pressing the record button and the start of the performance:
  1990. @example
  1991. silenceremove=1:5:0.02
  1992. @end example
  1993. @end itemize
  1994. @section stereotools
  1995. This filter has some handy utilities to manage stereo signals, for converting
  1996. M/S stereo recordings to L/R signal while having control over the parameters
  1997. or spreading the stereo image of master track.
  1998. The filter accepts the following options:
  1999. @table @option
  2000. @item level_in
  2001. Set input level before filtering for both channels. Defaults is 1.
  2002. Allowed range is from 0.015625 to 64.
  2003. @item level_out
  2004. Set output level after filtering for both channels. Defaults is 1.
  2005. Allowed range is from 0.015625 to 64.
  2006. @item balance_in
  2007. Set input balance between both channels. Default is 0.
  2008. Allowed range is from -1 to 1.
  2009. @item balance_out
  2010. Set output balance between both channels. Default is 0.
  2011. Allowed range is from -1 to 1.
  2012. @item softclip
  2013. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2014. clipping. Disabled by default.
  2015. @item mutel
  2016. Mute the left channel. Disabled by default.
  2017. @item muter
  2018. Mute the right channel. Disabled by default.
  2019. @item phasel
  2020. Change the phase of the left channel. Disabled by default.
  2021. @item phaser
  2022. Change the phase of the right channel. Disabled by default.
  2023. @item mode
  2024. Set stereo mode. Available values are:
  2025. @table @samp
  2026. @item lr>lr
  2027. Left/Right to Left/Right, this is default.
  2028. @item lr>ms
  2029. Left/Right to Mid/Side.
  2030. @item ms>lr
  2031. Mid/Side to Left/Right.
  2032. @item lr>ll
  2033. Left/Right to Left/Left.
  2034. @item lr>rr
  2035. Left/Right to Right/Right.
  2036. @item lr>l+r
  2037. Left/Right to Left + Right.
  2038. @item lr>rl
  2039. Left/Right to Right/Left.
  2040. @end table
  2041. @item slev
  2042. Set level of side signal. Default is 1.
  2043. Allowed range is from 0.015625 to 64.
  2044. @item sbal
  2045. Set balance of side signal. Default is 0.
  2046. Allowed range is from -1 to 1.
  2047. @item mlev
  2048. Set level of the middle signal. Default is 1.
  2049. Allowed range is from 0.015625 to 64.
  2050. @item mpan
  2051. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2052. @item base
  2053. Set stereo base between mono and inversed channels. Default is 0.
  2054. Allowed range is from -1 to 1.
  2055. @item delay
  2056. Set delay in milliseconds how much to delay left from right channel and
  2057. vice versa. Default is 0. Allowed range is from -20 to 20.
  2058. @item sclevel
  2059. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2060. @item phase
  2061. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2062. @end table
  2063. @section stereowiden
  2064. This filter enhance the stereo effect by suppressing signal common to both
  2065. channels and by delaying the signal of left into right and vice versa,
  2066. thereby widening the stereo effect.
  2067. The filter accepts the following options:
  2068. @table @option
  2069. @item delay
  2070. Time in milliseconds of the delay of left signal into right and vice versa.
  2071. Default is 20 milliseconds.
  2072. @item feedback
  2073. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2074. effect of left signal in right output and vice versa which gives widening
  2075. effect. Default is 0.3.
  2076. @item crossfeed
  2077. Cross feed of left into right with inverted phase. This helps in suppressing
  2078. the mono. If the value is 1 it will cancel all the signal common to both
  2079. channels. Default is 0.3.
  2080. @item drymix
  2081. Set level of input signal of original channel. Default is 0.8.
  2082. @end table
  2083. @section treble
  2084. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2085. shelving filter with a response similar to that of a standard
  2086. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2087. The filter accepts the following options:
  2088. @table @option
  2089. @item gain, g
  2090. Give the gain at whichever is the lower of ~22 kHz and the
  2091. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2092. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2093. @item frequency, f
  2094. Set the filter's central frequency and so can be used
  2095. to extend or reduce the frequency range to be boosted or cut.
  2096. The default value is @code{3000} Hz.
  2097. @item width_type
  2098. Set method to specify band-width of filter.
  2099. @table @option
  2100. @item h
  2101. Hz
  2102. @item q
  2103. Q-Factor
  2104. @item o
  2105. octave
  2106. @item s
  2107. slope
  2108. @end table
  2109. @item width, w
  2110. Determine how steep is the filter's shelf transition.
  2111. @end table
  2112. @section tremolo
  2113. Sinusoidal amplitude modulation.
  2114. The filter accepts the following options:
  2115. @table @option
  2116. @item f
  2117. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2118. (20 Hz or lower) will result in a tremolo effect.
  2119. This filter may also be used as a ring modulator by specifying
  2120. a modulation frequency higher than 20 Hz.
  2121. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2122. @item d
  2123. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2124. Default value is 0.5.
  2125. @end table
  2126. @section volume
  2127. Adjust the input audio volume.
  2128. It accepts the following parameters:
  2129. @table @option
  2130. @item volume
  2131. Set audio volume expression.
  2132. Output values are clipped to the maximum value.
  2133. The output audio volume is given by the relation:
  2134. @example
  2135. @var{output_volume} = @var{volume} * @var{input_volume}
  2136. @end example
  2137. The default value for @var{volume} is "1.0".
  2138. @item precision
  2139. This parameter represents the mathematical precision.
  2140. It determines which input sample formats will be allowed, which affects the
  2141. precision of the volume scaling.
  2142. @table @option
  2143. @item fixed
  2144. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2145. @item float
  2146. 32-bit floating-point; this limits input sample format to FLT. (default)
  2147. @item double
  2148. 64-bit floating-point; this limits input sample format to DBL.
  2149. @end table
  2150. @item replaygain
  2151. Choose the behaviour on encountering ReplayGain side data in input frames.
  2152. @table @option
  2153. @item drop
  2154. Remove ReplayGain side data, ignoring its contents (the default).
  2155. @item ignore
  2156. Ignore ReplayGain side data, but leave it in the frame.
  2157. @item track
  2158. Prefer the track gain, if present.
  2159. @item album
  2160. Prefer the album gain, if present.
  2161. @end table
  2162. @item replaygain_preamp
  2163. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2164. Default value for @var{replaygain_preamp} is 0.0.
  2165. @item eval
  2166. Set when the volume expression is evaluated.
  2167. It accepts the following values:
  2168. @table @samp
  2169. @item once
  2170. only evaluate expression once during the filter initialization, or
  2171. when the @samp{volume} command is sent
  2172. @item frame
  2173. evaluate expression for each incoming frame
  2174. @end table
  2175. Default value is @samp{once}.
  2176. @end table
  2177. The volume expression can contain the following parameters.
  2178. @table @option
  2179. @item n
  2180. frame number (starting at zero)
  2181. @item nb_channels
  2182. number of channels
  2183. @item nb_consumed_samples
  2184. number of samples consumed by the filter
  2185. @item nb_samples
  2186. number of samples in the current frame
  2187. @item pos
  2188. original frame position in the file
  2189. @item pts
  2190. frame PTS
  2191. @item sample_rate
  2192. sample rate
  2193. @item startpts
  2194. PTS at start of stream
  2195. @item startt
  2196. time at start of stream
  2197. @item t
  2198. frame time
  2199. @item tb
  2200. timestamp timebase
  2201. @item volume
  2202. last set volume value
  2203. @end table
  2204. Note that when @option{eval} is set to @samp{once} only the
  2205. @var{sample_rate} and @var{tb} variables are available, all other
  2206. variables will evaluate to NAN.
  2207. @subsection Commands
  2208. This filter supports the following commands:
  2209. @table @option
  2210. @item volume
  2211. Modify the volume expression.
  2212. The command accepts the same syntax of the corresponding option.
  2213. If the specified expression is not valid, it is kept at its current
  2214. value.
  2215. @item replaygain_noclip
  2216. Prevent clipping by limiting the gain applied.
  2217. Default value for @var{replaygain_noclip} is 1.
  2218. @end table
  2219. @subsection Examples
  2220. @itemize
  2221. @item
  2222. Halve the input audio volume:
  2223. @example
  2224. volume=volume=0.5
  2225. volume=volume=1/2
  2226. volume=volume=-6.0206dB
  2227. @end example
  2228. In all the above example the named key for @option{volume} can be
  2229. omitted, for example like in:
  2230. @example
  2231. volume=0.5
  2232. @end example
  2233. @item
  2234. Increase input audio power by 6 decibels using fixed-point precision:
  2235. @example
  2236. volume=volume=6dB:precision=fixed
  2237. @end example
  2238. @item
  2239. Fade volume after time 10 with an annihilation period of 5 seconds:
  2240. @example
  2241. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2242. @end example
  2243. @end itemize
  2244. @section volumedetect
  2245. Detect the volume of the input video.
  2246. The filter has no parameters. The input is not modified. Statistics about
  2247. the volume will be printed in the log when the input stream end is reached.
  2248. In particular it will show the mean volume (root mean square), maximum
  2249. volume (on a per-sample basis), and the beginning of a histogram of the
  2250. registered volume values (from the maximum value to a cumulated 1/1000 of
  2251. the samples).
  2252. All volumes are in decibels relative to the maximum PCM value.
  2253. @subsection Examples
  2254. Here is an excerpt of the output:
  2255. @example
  2256. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2257. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2258. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2259. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2260. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2261. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2262. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2263. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2264. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2265. @end example
  2266. It means that:
  2267. @itemize
  2268. @item
  2269. The mean square energy is approximately -27 dB, or 10^-2.7.
  2270. @item
  2271. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2272. @item
  2273. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2274. @end itemize
  2275. In other words, raising the volume by +4 dB does not cause any clipping,
  2276. raising it by +5 dB causes clipping for 6 samples, etc.
  2277. @c man end AUDIO FILTERS
  2278. @chapter Audio Sources
  2279. @c man begin AUDIO SOURCES
  2280. Below is a description of the currently available audio sources.
  2281. @section abuffer
  2282. Buffer audio frames, and make them available to the filter chain.
  2283. This source is mainly intended for a programmatic use, in particular
  2284. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2285. It accepts the following parameters:
  2286. @table @option
  2287. @item time_base
  2288. The timebase which will be used for timestamps of submitted frames. It must be
  2289. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2290. @item sample_rate
  2291. The sample rate of the incoming audio buffers.
  2292. @item sample_fmt
  2293. The sample format of the incoming audio buffers.
  2294. Either a sample format name or its corresponding integer representation from
  2295. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2296. @item channel_layout
  2297. The channel layout of the incoming audio buffers.
  2298. Either a channel layout name from channel_layout_map in
  2299. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2300. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2301. @item channels
  2302. The number of channels of the incoming audio buffers.
  2303. If both @var{channels} and @var{channel_layout} are specified, then they
  2304. must be consistent.
  2305. @end table
  2306. @subsection Examples
  2307. @example
  2308. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2309. @end example
  2310. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2311. Since the sample format with name "s16p" corresponds to the number
  2312. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2313. equivalent to:
  2314. @example
  2315. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2316. @end example
  2317. @section aevalsrc
  2318. Generate an audio signal specified by an expression.
  2319. This source accepts in input one or more expressions (one for each
  2320. channel), which are evaluated and used to generate a corresponding
  2321. audio signal.
  2322. This source accepts the following options:
  2323. @table @option
  2324. @item exprs
  2325. Set the '|'-separated expressions list for each separate channel. In case the
  2326. @option{channel_layout} option is not specified, the selected channel layout
  2327. depends on the number of provided expressions. Otherwise the last
  2328. specified expression is applied to the remaining output channels.
  2329. @item channel_layout, c
  2330. Set the channel layout. The number of channels in the specified layout
  2331. must be equal to the number of specified expressions.
  2332. @item duration, d
  2333. Set the minimum duration of the sourced audio. See
  2334. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2335. for the accepted syntax.
  2336. Note that the resulting duration may be greater than the specified
  2337. duration, as the generated audio is always cut at the end of a
  2338. complete frame.
  2339. If not specified, or the expressed duration is negative, the audio is
  2340. supposed to be generated forever.
  2341. @item nb_samples, n
  2342. Set the number of samples per channel per each output frame,
  2343. default to 1024.
  2344. @item sample_rate, s
  2345. Specify the sample rate, default to 44100.
  2346. @end table
  2347. Each expression in @var{exprs} can contain the following constants:
  2348. @table @option
  2349. @item n
  2350. number of the evaluated sample, starting from 0
  2351. @item t
  2352. time of the evaluated sample expressed in seconds, starting from 0
  2353. @item s
  2354. sample rate
  2355. @end table
  2356. @subsection Examples
  2357. @itemize
  2358. @item
  2359. Generate silence:
  2360. @example
  2361. aevalsrc=0
  2362. @end example
  2363. @item
  2364. Generate a sin signal with frequency of 440 Hz, set sample rate to
  2365. 8000 Hz:
  2366. @example
  2367. aevalsrc="sin(440*2*PI*t):s=8000"
  2368. @end example
  2369. @item
  2370. Generate a two channels signal, specify the channel layout (Front
  2371. Center + Back Center) explicitly:
  2372. @example
  2373. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  2374. @end example
  2375. @item
  2376. Generate white noise:
  2377. @example
  2378. aevalsrc="-2+random(0)"
  2379. @end example
  2380. @item
  2381. Generate an amplitude modulated signal:
  2382. @example
  2383. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  2384. @end example
  2385. @item
  2386. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  2387. @example
  2388. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  2389. @end example
  2390. @end itemize
  2391. @section anullsrc
  2392. The null audio source, return unprocessed audio frames. It is mainly useful
  2393. as a template and to be employed in analysis / debugging tools, or as
  2394. the source for filters which ignore the input data (for example the sox
  2395. synth filter).
  2396. This source accepts the following options:
  2397. @table @option
  2398. @item channel_layout, cl
  2399. Specifies the channel layout, and can be either an integer or a string
  2400. representing a channel layout. The default value of @var{channel_layout}
  2401. is "stereo".
  2402. Check the channel_layout_map definition in
  2403. @file{libavutil/channel_layout.c} for the mapping between strings and
  2404. channel layout values.
  2405. @item sample_rate, r
  2406. Specifies the sample rate, and defaults to 44100.
  2407. @item nb_samples, n
  2408. Set the number of samples per requested frames.
  2409. @end table
  2410. @subsection Examples
  2411. @itemize
  2412. @item
  2413. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  2414. @example
  2415. anullsrc=r=48000:cl=4
  2416. @end example
  2417. @item
  2418. Do the same operation with a more obvious syntax:
  2419. @example
  2420. anullsrc=r=48000:cl=mono
  2421. @end example
  2422. @end itemize
  2423. All the parameters need to be explicitly defined.
  2424. @section flite
  2425. Synthesize a voice utterance using the libflite library.
  2426. To enable compilation of this filter you need to configure FFmpeg with
  2427. @code{--enable-libflite}.
  2428. Note that the flite library is not thread-safe.
  2429. The filter accepts the following options:
  2430. @table @option
  2431. @item list_voices
  2432. If set to 1, list the names of the available voices and exit
  2433. immediately. Default value is 0.
  2434. @item nb_samples, n
  2435. Set the maximum number of samples per frame. Default value is 512.
  2436. @item textfile
  2437. Set the filename containing the text to speak.
  2438. @item text
  2439. Set the text to speak.
  2440. @item voice, v
  2441. Set the voice to use for the speech synthesis. Default value is
  2442. @code{kal}. See also the @var{list_voices} option.
  2443. @end table
  2444. @subsection Examples
  2445. @itemize
  2446. @item
  2447. Read from file @file{speech.txt}, and synthesize the text using the
  2448. standard flite voice:
  2449. @example
  2450. flite=textfile=speech.txt
  2451. @end example
  2452. @item
  2453. Read the specified text selecting the @code{slt} voice:
  2454. @example
  2455. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2456. @end example
  2457. @item
  2458. Input text to ffmpeg:
  2459. @example
  2460. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2461. @end example
  2462. @item
  2463. Make @file{ffplay} speak the specified text, using @code{flite} and
  2464. the @code{lavfi} device:
  2465. @example
  2466. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  2467. @end example
  2468. @end itemize
  2469. For more information about libflite, check:
  2470. @url{http://www.speech.cs.cmu.edu/flite/}
  2471. @section sine
  2472. Generate an audio signal made of a sine wave with amplitude 1/8.
  2473. The audio signal is bit-exact.
  2474. The filter accepts the following options:
  2475. @table @option
  2476. @item frequency, f
  2477. Set the carrier frequency. Default is 440 Hz.
  2478. @item beep_factor, b
  2479. Enable a periodic beep every second with frequency @var{beep_factor} times
  2480. the carrier frequency. Default is 0, meaning the beep is disabled.
  2481. @item sample_rate, r
  2482. Specify the sample rate, default is 44100.
  2483. @item duration, d
  2484. Specify the duration of the generated audio stream.
  2485. @item samples_per_frame
  2486. Set the number of samples per output frame.
  2487. The expression can contain the following constants:
  2488. @table @option
  2489. @item n
  2490. The (sequential) number of the output audio frame, starting from 0.
  2491. @item pts
  2492. The PTS (Presentation TimeStamp) of the output audio frame,
  2493. expressed in @var{TB} units.
  2494. @item t
  2495. The PTS of the output audio frame, expressed in seconds.
  2496. @item TB
  2497. The timebase of the output audio frames.
  2498. @end table
  2499. Default is @code{1024}.
  2500. @end table
  2501. @subsection Examples
  2502. @itemize
  2503. @item
  2504. Generate a simple 440 Hz sine wave:
  2505. @example
  2506. sine
  2507. @end example
  2508. @item
  2509. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  2510. @example
  2511. sine=220:4:d=5
  2512. sine=f=220:b=4:d=5
  2513. sine=frequency=220:beep_factor=4:duration=5
  2514. @end example
  2515. @item
  2516. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  2517. pattern:
  2518. @example
  2519. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  2520. @end example
  2521. @end itemize
  2522. @c man end AUDIO SOURCES
  2523. @chapter Audio Sinks
  2524. @c man begin AUDIO SINKS
  2525. Below is a description of the currently available audio sinks.
  2526. @section abuffersink
  2527. Buffer audio frames, and make them available to the end of filter chain.
  2528. This sink is mainly intended for programmatic use, in particular
  2529. through the interface defined in @file{libavfilter/buffersink.h}
  2530. or the options system.
  2531. It accepts a pointer to an AVABufferSinkContext structure, which
  2532. defines the incoming buffers' formats, to be passed as the opaque
  2533. parameter to @code{avfilter_init_filter} for initialization.
  2534. @section anullsink
  2535. Null audio sink; do absolutely nothing with the input audio. It is
  2536. mainly useful as a template and for use in analysis / debugging
  2537. tools.
  2538. @c man end AUDIO SINKS
  2539. @chapter Video Filters
  2540. @c man begin VIDEO FILTERS
  2541. When you configure your FFmpeg build, you can disable any of the
  2542. existing filters using @code{--disable-filters}.
  2543. The configure output will show the video filters included in your
  2544. build.
  2545. Below is a description of the currently available video filters.
  2546. @section alphaextract
  2547. Extract the alpha component from the input as a grayscale video. This
  2548. is especially useful with the @var{alphamerge} filter.
  2549. @section alphamerge
  2550. Add or replace the alpha component of the primary input with the
  2551. grayscale value of a second input. This is intended for use with
  2552. @var{alphaextract} to allow the transmission or storage of frame
  2553. sequences that have alpha in a format that doesn't support an alpha
  2554. channel.
  2555. For example, to reconstruct full frames from a normal YUV-encoded video
  2556. and a separate video created with @var{alphaextract}, you might use:
  2557. @example
  2558. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  2559. @end example
  2560. Since this filter is designed for reconstruction, it operates on frame
  2561. sequences without considering timestamps, and terminates when either
  2562. input reaches end of stream. This will cause problems if your encoding
  2563. pipeline drops frames. If you're trying to apply an image as an
  2564. overlay to a video stream, consider the @var{overlay} filter instead.
  2565. @section ass
  2566. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  2567. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  2568. Substation Alpha) subtitles files.
  2569. This filter accepts the following option in addition to the common options from
  2570. the @ref{subtitles} filter:
  2571. @table @option
  2572. @item shaping
  2573. Set the shaping engine
  2574. Available values are:
  2575. @table @samp
  2576. @item auto
  2577. The default libass shaping engine, which is the best available.
  2578. @item simple
  2579. Fast, font-agnostic shaper that can do only substitutions
  2580. @item complex
  2581. Slower shaper using OpenType for substitutions and positioning
  2582. @end table
  2583. The default is @code{auto}.
  2584. @end table
  2585. @section atadenoise
  2586. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  2587. The filter accepts the following options:
  2588. @table @option
  2589. @item 0a
  2590. Set threshold A for 1st plane. Default is 0.02.
  2591. Valid range is 0 to 0.3.
  2592. @item 0b
  2593. Set threshold B for 1st plane. Default is 0.04.
  2594. Valid range is 0 to 5.
  2595. @item 1a
  2596. Set threshold A for 2nd plane. Default is 0.02.
  2597. Valid range is 0 to 0.3.
  2598. @item 1b
  2599. Set threshold B for 2nd plane. Default is 0.04.
  2600. Valid range is 0 to 5.
  2601. @item 2a
  2602. Set threshold A for 3rd plane. Default is 0.02.
  2603. Valid range is 0 to 0.3.
  2604. @item 2b
  2605. Set threshold B for 3rd plane. Default is 0.04.
  2606. Valid range is 0 to 5.
  2607. Threshold A is designed to react on abrupt changes in the input signal and
  2608. threshold B is designed to react on continuous changes in the input signal.
  2609. @item s
  2610. Set number of frames filter will use for averaging. Default is 33. Must be odd
  2611. number in range [5, 129].
  2612. @end table
  2613. @section bbox
  2614. Compute the bounding box for the non-black pixels in the input frame
  2615. luminance plane.
  2616. This filter computes the bounding box containing all the pixels with a
  2617. luminance value greater than the minimum allowed value.
  2618. The parameters describing the bounding box are printed on the filter
  2619. log.
  2620. The filter accepts the following option:
  2621. @table @option
  2622. @item min_val
  2623. Set the minimal luminance value. Default is @code{16}.
  2624. @end table
  2625. @section blackdetect
  2626. Detect video intervals that are (almost) completely black. Can be
  2627. useful to detect chapter transitions, commercials, or invalid
  2628. recordings. Output lines contains the time for the start, end and
  2629. duration of the detected black interval expressed in seconds.
  2630. In order to display the output lines, you need to set the loglevel at
  2631. least to the AV_LOG_INFO value.
  2632. The filter accepts the following options:
  2633. @table @option
  2634. @item black_min_duration, d
  2635. Set the minimum detected black duration expressed in seconds. It must
  2636. be a non-negative floating point number.
  2637. Default value is 2.0.
  2638. @item picture_black_ratio_th, pic_th
  2639. Set the threshold for considering a picture "black".
  2640. Express the minimum value for the ratio:
  2641. @example
  2642. @var{nb_black_pixels} / @var{nb_pixels}
  2643. @end example
  2644. for which a picture is considered black.
  2645. Default value is 0.98.
  2646. @item pixel_black_th, pix_th
  2647. Set the threshold for considering a pixel "black".
  2648. The threshold expresses the maximum pixel luminance value for which a
  2649. pixel is considered "black". The provided value is scaled according to
  2650. the following equation:
  2651. @example
  2652. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  2653. @end example
  2654. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  2655. the input video format, the range is [0-255] for YUV full-range
  2656. formats and [16-235] for YUV non full-range formats.
  2657. Default value is 0.10.
  2658. @end table
  2659. The following example sets the maximum pixel threshold to the minimum
  2660. value, and detects only black intervals of 2 or more seconds:
  2661. @example
  2662. blackdetect=d=2:pix_th=0.00
  2663. @end example
  2664. @section blackframe
  2665. Detect frames that are (almost) completely black. Can be useful to
  2666. detect chapter transitions or commercials. Output lines consist of
  2667. the frame number of the detected frame, the percentage of blackness,
  2668. the position in the file if known or -1 and the timestamp in seconds.
  2669. In order to display the output lines, you need to set the loglevel at
  2670. least to the AV_LOG_INFO value.
  2671. It accepts the following parameters:
  2672. @table @option
  2673. @item amount
  2674. The percentage of the pixels that have to be below the threshold; it defaults to
  2675. @code{98}.
  2676. @item threshold, thresh
  2677. The threshold below which a pixel value is considered black; it defaults to
  2678. @code{32}.
  2679. @end table
  2680. @section blend, tblend
  2681. Blend two video frames into each other.
  2682. The @code{blend} filter takes two input streams and outputs one
  2683. stream, the first input is the "top" layer and second input is
  2684. "bottom" layer. Output terminates when shortest input terminates.
  2685. The @code{tblend} (time blend) filter takes two consecutive frames
  2686. from one single stream, and outputs the result obtained by blending
  2687. the new frame on top of the old frame.
  2688. A description of the accepted options follows.
  2689. @table @option
  2690. @item c0_mode
  2691. @item c1_mode
  2692. @item c2_mode
  2693. @item c3_mode
  2694. @item all_mode
  2695. Set blend mode for specific pixel component or all pixel components in case
  2696. of @var{all_mode}. Default value is @code{normal}.
  2697. Available values for component modes are:
  2698. @table @samp
  2699. @item addition
  2700. @item addition128
  2701. @item and
  2702. @item average
  2703. @item burn
  2704. @item darken
  2705. @item difference
  2706. @item difference128
  2707. @item divide
  2708. @item dodge
  2709. @item exclusion
  2710. @item glow
  2711. @item hardlight
  2712. @item hardmix
  2713. @item lighten
  2714. @item linearlight
  2715. @item multiply
  2716. @item negation
  2717. @item normal
  2718. @item or
  2719. @item overlay
  2720. @item phoenix
  2721. @item pinlight
  2722. @item reflect
  2723. @item screen
  2724. @item softlight
  2725. @item subtract
  2726. @item vividlight
  2727. @item xor
  2728. @end table
  2729. @item c0_opacity
  2730. @item c1_opacity
  2731. @item c2_opacity
  2732. @item c3_opacity
  2733. @item all_opacity
  2734. Set blend opacity for specific pixel component or all pixel components in case
  2735. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  2736. @item c0_expr
  2737. @item c1_expr
  2738. @item c2_expr
  2739. @item c3_expr
  2740. @item all_expr
  2741. Set blend expression for specific pixel component or all pixel components in case
  2742. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  2743. The expressions can use the following variables:
  2744. @table @option
  2745. @item N
  2746. The sequential number of the filtered frame, starting from @code{0}.
  2747. @item X
  2748. @item Y
  2749. the coordinates of the current sample
  2750. @item W
  2751. @item H
  2752. the width and height of currently filtered plane
  2753. @item SW
  2754. @item SH
  2755. Width and height scale depending on the currently filtered plane. It is the
  2756. ratio between the corresponding luma plane number of pixels and the current
  2757. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  2758. @code{0.5,0.5} for chroma planes.
  2759. @item T
  2760. Time of the current frame, expressed in seconds.
  2761. @item TOP, A
  2762. Value of pixel component at current location for first video frame (top layer).
  2763. @item BOTTOM, B
  2764. Value of pixel component at current location for second video frame (bottom layer).
  2765. @end table
  2766. @item shortest
  2767. Force termination when the shortest input terminates. Default is
  2768. @code{0}. This option is only defined for the @code{blend} filter.
  2769. @item repeatlast
  2770. Continue applying the last bottom frame after the end of the stream. A value of
  2771. @code{0} disable the filter after the last frame of the bottom layer is reached.
  2772. Default is @code{1}. This option is only defined for the @code{blend} filter.
  2773. @end table
  2774. @subsection Examples
  2775. @itemize
  2776. @item
  2777. Apply transition from bottom layer to top layer in first 10 seconds:
  2778. @example
  2779. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  2780. @end example
  2781. @item
  2782. Apply 1x1 checkerboard effect:
  2783. @example
  2784. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  2785. @end example
  2786. @item
  2787. Apply uncover left effect:
  2788. @example
  2789. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  2790. @end example
  2791. @item
  2792. Apply uncover down effect:
  2793. @example
  2794. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  2795. @end example
  2796. @item
  2797. Apply uncover up-left effect:
  2798. @example
  2799. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  2800. @end example
  2801. @item
  2802. Display differences between the current and the previous frame:
  2803. @example
  2804. tblend=all_mode=difference128
  2805. @end example
  2806. @end itemize
  2807. @section boxblur
  2808. Apply a boxblur algorithm to the input video.
  2809. It accepts the following parameters:
  2810. @table @option
  2811. @item luma_radius, lr
  2812. @item luma_power, lp
  2813. @item chroma_radius, cr
  2814. @item chroma_power, cp
  2815. @item alpha_radius, ar
  2816. @item alpha_power, ap
  2817. @end table
  2818. A description of the accepted options follows.
  2819. @table @option
  2820. @item luma_radius, lr
  2821. @item chroma_radius, cr
  2822. @item alpha_radius, ar
  2823. Set an expression for the box radius in pixels used for blurring the
  2824. corresponding input plane.
  2825. The radius value must be a non-negative number, and must not be
  2826. greater than the value of the expression @code{min(w,h)/2} for the
  2827. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  2828. planes.
  2829. Default value for @option{luma_radius} is "2". If not specified,
  2830. @option{chroma_radius} and @option{alpha_radius} default to the
  2831. corresponding value set for @option{luma_radius}.
  2832. The expressions can contain the following constants:
  2833. @table @option
  2834. @item w
  2835. @item h
  2836. The input width and height in pixels.
  2837. @item cw
  2838. @item ch
  2839. The input chroma image width and height in pixels.
  2840. @item hsub
  2841. @item vsub
  2842. The horizontal and vertical chroma subsample values. For example, for the
  2843. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  2844. @end table
  2845. @item luma_power, lp
  2846. @item chroma_power, cp
  2847. @item alpha_power, ap
  2848. Specify how many times the boxblur filter is applied to the
  2849. corresponding plane.
  2850. Default value for @option{luma_power} is 2. If not specified,
  2851. @option{chroma_power} and @option{alpha_power} default to the
  2852. corresponding value set for @option{luma_power}.
  2853. A value of 0 will disable the effect.
  2854. @end table
  2855. @subsection Examples
  2856. @itemize
  2857. @item
  2858. Apply a boxblur filter with the luma, chroma, and alpha radii
  2859. set to 2:
  2860. @example
  2861. boxblur=luma_radius=2:luma_power=1
  2862. boxblur=2:1
  2863. @end example
  2864. @item
  2865. Set the luma radius to 2, and alpha and chroma radius to 0:
  2866. @example
  2867. boxblur=2:1:cr=0:ar=0
  2868. @end example
  2869. @item
  2870. Set the luma and chroma radii to a fraction of the video dimension:
  2871. @example
  2872. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  2873. @end example
  2874. @end itemize
  2875. @section chromakey
  2876. YUV colorspace color/chroma keying.
  2877. The filter accepts the following options:
  2878. @table @option
  2879. @item color
  2880. The color which will be replaced with transparency.
  2881. @item similarity
  2882. Similarity percentage with the key color.
  2883. 0.01 matches only the exact key color, while 1.0 matches everything.
  2884. @item blend
  2885. Blend percentage.
  2886. 0.0 makes pixels either fully transparent, or not transparent at all.
  2887. Higher values result in semi-transparent pixels, with a higher transparency
  2888. the more similar the pixels color is to the key color.
  2889. @item yuv
  2890. Signals that the color passed is already in YUV instead of RGB.
  2891. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  2892. This can be used to pass exact YUV values as hexadecimal numbers.
  2893. @end table
  2894. @subsection Examples
  2895. @itemize
  2896. @item
  2897. Make every green pixel in the input image transparent:
  2898. @example
  2899. ffmpeg -i input.png -vf chromakey=green out.png
  2900. @end example
  2901. @item
  2902. Overlay a greenscreen-video on top of a static black background.
  2903. @example
  2904. 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
  2905. @end example
  2906. @end itemize
  2907. @section codecview
  2908. Visualize information exported by some codecs.
  2909. Some codecs can export information through frames using side-data or other
  2910. means. For example, some MPEG based codecs export motion vectors through the
  2911. @var{export_mvs} flag in the codec @option{flags2} option.
  2912. The filter accepts the following option:
  2913. @table @option
  2914. @item mv
  2915. Set motion vectors to visualize.
  2916. Available flags for @var{mv} are:
  2917. @table @samp
  2918. @item pf
  2919. forward predicted MVs of P-frames
  2920. @item bf
  2921. forward predicted MVs of B-frames
  2922. @item bb
  2923. backward predicted MVs of B-frames
  2924. @end table
  2925. @end table
  2926. @subsection Examples
  2927. @itemize
  2928. @item
  2929. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  2930. @example
  2931. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  2932. @end example
  2933. @end itemize
  2934. @section colorbalance
  2935. Modify intensity of primary colors (red, green and blue) of input frames.
  2936. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  2937. regions for the red-cyan, green-magenta or blue-yellow balance.
  2938. A positive adjustment value shifts the balance towards the primary color, a negative
  2939. value towards the complementary color.
  2940. The filter accepts the following options:
  2941. @table @option
  2942. @item rs
  2943. @item gs
  2944. @item bs
  2945. Adjust red, green and blue shadows (darkest pixels).
  2946. @item rm
  2947. @item gm
  2948. @item bm
  2949. Adjust red, green and blue midtones (medium pixels).
  2950. @item rh
  2951. @item gh
  2952. @item bh
  2953. Adjust red, green and blue highlights (brightest pixels).
  2954. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  2955. @end table
  2956. @subsection Examples
  2957. @itemize
  2958. @item
  2959. Add red color cast to shadows:
  2960. @example
  2961. colorbalance=rs=.3
  2962. @end example
  2963. @end itemize
  2964. @section colorkey
  2965. RGB colorspace color keying.
  2966. The filter accepts the following options:
  2967. @table @option
  2968. @item color
  2969. The color which will be replaced with transparency.
  2970. @item similarity
  2971. Similarity percentage with the key color.
  2972. 0.01 matches only the exact key color, while 1.0 matches everything.
  2973. @item blend
  2974. Blend percentage.
  2975. 0.0 makes pixels either fully transparent, or not transparent at all.
  2976. Higher values result in semi-transparent pixels, with a higher transparency
  2977. the more similar the pixels color is to the key color.
  2978. @end table
  2979. @subsection Examples
  2980. @itemize
  2981. @item
  2982. Make every green pixel in the input image transparent:
  2983. @example
  2984. ffmpeg -i input.png -vf colorkey=green out.png
  2985. @end example
  2986. @item
  2987. Overlay a greenscreen-video on top of a static background image.
  2988. @example
  2989. 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
  2990. @end example
  2991. @end itemize
  2992. @section colorlevels
  2993. Adjust video input frames using levels.
  2994. The filter accepts the following options:
  2995. @table @option
  2996. @item rimin
  2997. @item gimin
  2998. @item bimin
  2999. @item aimin
  3000. Adjust red, green, blue and alpha input black point.
  3001. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3002. @item rimax
  3003. @item gimax
  3004. @item bimax
  3005. @item aimax
  3006. Adjust red, green, blue and alpha input white point.
  3007. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3008. Input levels are used to lighten highlights (bright tones), darken shadows
  3009. (dark tones), change the balance of bright and dark tones.
  3010. @item romin
  3011. @item gomin
  3012. @item bomin
  3013. @item aomin
  3014. Adjust red, green, blue and alpha output black point.
  3015. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3016. @item romax
  3017. @item gomax
  3018. @item bomax
  3019. @item aomax
  3020. Adjust red, green, blue and alpha output white point.
  3021. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3022. Output levels allows manual selection of a constrained output level range.
  3023. @end table
  3024. @subsection Examples
  3025. @itemize
  3026. @item
  3027. Make video output darker:
  3028. @example
  3029. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3030. @end example
  3031. @item
  3032. Increase contrast:
  3033. @example
  3034. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3035. @end example
  3036. @item
  3037. Make video output lighter:
  3038. @example
  3039. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3040. @end example
  3041. @item
  3042. Increase brightness:
  3043. @example
  3044. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3045. @end example
  3046. @end itemize
  3047. @section colorchannelmixer
  3048. Adjust video input frames by re-mixing color channels.
  3049. This filter modifies a color channel by adding the values associated to
  3050. the other channels of the same pixels. For example if the value to
  3051. modify is red, the output value will be:
  3052. @example
  3053. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3054. @end example
  3055. The filter accepts the following options:
  3056. @table @option
  3057. @item rr
  3058. @item rg
  3059. @item rb
  3060. @item ra
  3061. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3062. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3063. @item gr
  3064. @item gg
  3065. @item gb
  3066. @item ga
  3067. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3068. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3069. @item br
  3070. @item bg
  3071. @item bb
  3072. @item ba
  3073. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3074. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3075. @item ar
  3076. @item ag
  3077. @item ab
  3078. @item aa
  3079. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3080. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3081. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3082. @end table
  3083. @subsection Examples
  3084. @itemize
  3085. @item
  3086. Convert source to grayscale:
  3087. @example
  3088. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3089. @end example
  3090. @item
  3091. Simulate sepia tones:
  3092. @example
  3093. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3094. @end example
  3095. @end itemize
  3096. @section colormatrix
  3097. Convert color matrix.
  3098. The filter accepts the following options:
  3099. @table @option
  3100. @item src
  3101. @item dst
  3102. Specify the source and destination color matrix. Both values must be
  3103. specified.
  3104. The accepted values are:
  3105. @table @samp
  3106. @item bt709
  3107. BT.709
  3108. @item bt601
  3109. BT.601
  3110. @item smpte240m
  3111. SMPTE-240M
  3112. @item fcc
  3113. FCC
  3114. @end table
  3115. @end table
  3116. For example to convert from BT.601 to SMPTE-240M, use the command:
  3117. @example
  3118. colormatrix=bt601:smpte240m
  3119. @end example
  3120. @section copy
  3121. Copy the input source unchanged to the output. This is mainly useful for
  3122. testing purposes.
  3123. @section crop
  3124. Crop the input video to given dimensions.
  3125. It accepts the following parameters:
  3126. @table @option
  3127. @item w, out_w
  3128. The width of the output video. It defaults to @code{iw}.
  3129. This expression is evaluated only once during the filter
  3130. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  3131. @item h, out_h
  3132. The height of the output video. It defaults to @code{ih}.
  3133. This expression is evaluated only once during the filter
  3134. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  3135. @item x
  3136. The horizontal position, in the input video, of the left edge of the output
  3137. video. It defaults to @code{(in_w-out_w)/2}.
  3138. This expression is evaluated per-frame.
  3139. @item y
  3140. The vertical position, in the input video, of the top edge of the output video.
  3141. It defaults to @code{(in_h-out_h)/2}.
  3142. This expression is evaluated per-frame.
  3143. @item keep_aspect
  3144. If set to 1 will force the output display aspect ratio
  3145. to be the same of the input, by changing the output sample aspect
  3146. ratio. It defaults to 0.
  3147. @end table
  3148. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  3149. expressions containing the following constants:
  3150. @table @option
  3151. @item x
  3152. @item y
  3153. The computed values for @var{x} and @var{y}. They are evaluated for
  3154. each new frame.
  3155. @item in_w
  3156. @item in_h
  3157. The input width and height.
  3158. @item iw
  3159. @item ih
  3160. These are the same as @var{in_w} and @var{in_h}.
  3161. @item out_w
  3162. @item out_h
  3163. The output (cropped) width and height.
  3164. @item ow
  3165. @item oh
  3166. These are the same as @var{out_w} and @var{out_h}.
  3167. @item a
  3168. same as @var{iw} / @var{ih}
  3169. @item sar
  3170. input sample aspect ratio
  3171. @item dar
  3172. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  3173. @item hsub
  3174. @item vsub
  3175. horizontal and vertical chroma subsample values. For example for the
  3176. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3177. @item n
  3178. The number of the input frame, starting from 0.
  3179. @item pos
  3180. the position in the file of the input frame, NAN if unknown
  3181. @item t
  3182. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  3183. @end table
  3184. The expression for @var{out_w} may depend on the value of @var{out_h},
  3185. and the expression for @var{out_h} may depend on @var{out_w}, but they
  3186. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  3187. evaluated after @var{out_w} and @var{out_h}.
  3188. The @var{x} and @var{y} parameters specify the expressions for the
  3189. position of the top-left corner of the output (non-cropped) area. They
  3190. are evaluated for each frame. If the evaluated value is not valid, it
  3191. is approximated to the nearest valid value.
  3192. The expression for @var{x} may depend on @var{y}, and the expression
  3193. for @var{y} may depend on @var{x}.
  3194. @subsection Examples
  3195. @itemize
  3196. @item
  3197. Crop area with size 100x100 at position (12,34).
  3198. @example
  3199. crop=100:100:12:34
  3200. @end example
  3201. Using named options, the example above becomes:
  3202. @example
  3203. crop=w=100:h=100:x=12:y=34
  3204. @end example
  3205. @item
  3206. Crop the central input area with size 100x100:
  3207. @example
  3208. crop=100:100
  3209. @end example
  3210. @item
  3211. Crop the central input area with size 2/3 of the input video:
  3212. @example
  3213. crop=2/3*in_w:2/3*in_h
  3214. @end example
  3215. @item
  3216. Crop the input video central square:
  3217. @example
  3218. crop=out_w=in_h
  3219. crop=in_h
  3220. @end example
  3221. @item
  3222. Delimit the rectangle with the top-left corner placed at position
  3223. 100:100 and the right-bottom corner corresponding to the right-bottom
  3224. corner of the input image.
  3225. @example
  3226. crop=in_w-100:in_h-100:100:100
  3227. @end example
  3228. @item
  3229. Crop 10 pixels from the left and right borders, and 20 pixels from
  3230. the top and bottom borders
  3231. @example
  3232. crop=in_w-2*10:in_h-2*20
  3233. @end example
  3234. @item
  3235. Keep only the bottom right quarter of the input image:
  3236. @example
  3237. crop=in_w/2:in_h/2:in_w/2:in_h/2
  3238. @end example
  3239. @item
  3240. Crop height for getting Greek harmony:
  3241. @example
  3242. crop=in_w:1/PHI*in_w
  3243. @end example
  3244. @item
  3245. Apply trembling effect:
  3246. @example
  3247. 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)
  3248. @end example
  3249. @item
  3250. Apply erratic camera effect depending on timestamp:
  3251. @example
  3252. 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)"
  3253. @end example
  3254. @item
  3255. Set x depending on the value of y:
  3256. @example
  3257. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  3258. @end example
  3259. @end itemize
  3260. @subsection Commands
  3261. This filter supports the following commands:
  3262. @table @option
  3263. @item w, out_w
  3264. @item h, out_h
  3265. @item x
  3266. @item y
  3267. Set width/height of the output video and the horizontal/vertical position
  3268. in the input video.
  3269. The command accepts the same syntax of the corresponding option.
  3270. If the specified expression is not valid, it is kept at its current
  3271. value.
  3272. @end table
  3273. @section cropdetect
  3274. Auto-detect the crop size.
  3275. It calculates the necessary cropping parameters and prints the
  3276. recommended parameters via the logging system. The detected dimensions
  3277. correspond to the non-black area of the input video.
  3278. It accepts the following parameters:
  3279. @table @option
  3280. @item limit
  3281. Set higher black value threshold, which can be optionally specified
  3282. from nothing (0) to everything (255 for 8bit based formats). An intensity
  3283. value greater to the set value is considered non-black. It defaults to 24.
  3284. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  3285. on the bitdepth of the pixel format.
  3286. @item round
  3287. The value which the width/height should be divisible by. It defaults to
  3288. 16. The offset is automatically adjusted to center the video. Use 2 to
  3289. get only even dimensions (needed for 4:2:2 video). 16 is best when
  3290. encoding to most video codecs.
  3291. @item reset_count, reset
  3292. Set the counter that determines after how many frames cropdetect will
  3293. reset the previously detected largest video area and start over to
  3294. detect the current optimal crop area. Default value is 0.
  3295. This can be useful when channel logos distort the video area. 0
  3296. indicates 'never reset', and returns the largest area encountered during
  3297. playback.
  3298. @end table
  3299. @anchor{curves}
  3300. @section curves
  3301. Apply color adjustments using curves.
  3302. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  3303. component (red, green and blue) has its values defined by @var{N} key points
  3304. tied from each other using a smooth curve. The x-axis represents the pixel
  3305. values from the input frame, and the y-axis the new pixel values to be set for
  3306. the output frame.
  3307. By default, a component curve is defined by the two points @var{(0;0)} and
  3308. @var{(1;1)}. This creates a straight line where each original pixel value is
  3309. "adjusted" to its own value, which means no change to the image.
  3310. The filter allows you to redefine these two points and add some more. A new
  3311. curve (using a natural cubic spline interpolation) will be define to pass
  3312. smoothly through all these new coordinates. The new defined points needs to be
  3313. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  3314. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  3315. the vector spaces, the values will be clipped accordingly.
  3316. If there is no key point defined in @code{x=0}, the filter will automatically
  3317. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  3318. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  3319. The filter accepts the following options:
  3320. @table @option
  3321. @item preset
  3322. Select one of the available color presets. This option can be used in addition
  3323. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  3324. options takes priority on the preset values.
  3325. Available presets are:
  3326. @table @samp
  3327. @item none
  3328. @item color_negative
  3329. @item cross_process
  3330. @item darker
  3331. @item increase_contrast
  3332. @item lighter
  3333. @item linear_contrast
  3334. @item medium_contrast
  3335. @item negative
  3336. @item strong_contrast
  3337. @item vintage
  3338. @end table
  3339. Default is @code{none}.
  3340. @item master, m
  3341. Set the master key points. These points will define a second pass mapping. It
  3342. is sometimes called a "luminance" or "value" mapping. It can be used with
  3343. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  3344. post-processing LUT.
  3345. @item red, r
  3346. Set the key points for the red component.
  3347. @item green, g
  3348. Set the key points for the green component.
  3349. @item blue, b
  3350. Set the key points for the blue component.
  3351. @item all
  3352. Set the key points for all components (not including master).
  3353. Can be used in addition to the other key points component
  3354. options. In this case, the unset component(s) will fallback on this
  3355. @option{all} setting.
  3356. @item psfile
  3357. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  3358. @end table
  3359. To avoid some filtergraph syntax conflicts, each key points list need to be
  3360. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  3361. @subsection Examples
  3362. @itemize
  3363. @item
  3364. Increase slightly the middle level of blue:
  3365. @example
  3366. curves=blue='0.5/0.58'
  3367. @end example
  3368. @item
  3369. Vintage effect:
  3370. @example
  3371. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  3372. @end example
  3373. Here we obtain the following coordinates for each components:
  3374. @table @var
  3375. @item red
  3376. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  3377. @item green
  3378. @code{(0;0) (0.50;0.48) (1;1)}
  3379. @item blue
  3380. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  3381. @end table
  3382. @item
  3383. The previous example can also be achieved with the associated built-in preset:
  3384. @example
  3385. curves=preset=vintage
  3386. @end example
  3387. @item
  3388. Or simply:
  3389. @example
  3390. curves=vintage
  3391. @end example
  3392. @item
  3393. Use a Photoshop preset and redefine the points of the green component:
  3394. @example
  3395. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  3396. @end example
  3397. @end itemize
  3398. @section dctdnoiz
  3399. Denoise frames using 2D DCT (frequency domain filtering).
  3400. This filter is not designed for real time.
  3401. The filter accepts the following options:
  3402. @table @option
  3403. @item sigma, s
  3404. Set the noise sigma constant.
  3405. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  3406. coefficient (absolute value) below this threshold with be dropped.
  3407. If you need a more advanced filtering, see @option{expr}.
  3408. Default is @code{0}.
  3409. @item overlap
  3410. Set number overlapping pixels for each block. Since the filter can be slow, you
  3411. may want to reduce this value, at the cost of a less effective filter and the
  3412. risk of various artefacts.
  3413. If the overlapping value doesn't permit processing the whole input width or
  3414. height, a warning will be displayed and according borders won't be denoised.
  3415. Default value is @var{blocksize}-1, which is the best possible setting.
  3416. @item expr, e
  3417. Set the coefficient factor expression.
  3418. For each coefficient of a DCT block, this expression will be evaluated as a
  3419. multiplier value for the coefficient.
  3420. If this is option is set, the @option{sigma} option will be ignored.
  3421. The absolute value of the coefficient can be accessed through the @var{c}
  3422. variable.
  3423. @item n
  3424. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  3425. @var{blocksize}, which is the width and height of the processed blocks.
  3426. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  3427. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  3428. on the speed processing. Also, a larger block size does not necessarily means a
  3429. better de-noising.
  3430. @end table
  3431. @subsection Examples
  3432. Apply a denoise with a @option{sigma} of @code{4.5}:
  3433. @example
  3434. dctdnoiz=4.5
  3435. @end example
  3436. The same operation can be achieved using the expression system:
  3437. @example
  3438. dctdnoiz=e='gte(c, 4.5*3)'
  3439. @end example
  3440. Violent denoise using a block size of @code{16x16}:
  3441. @example
  3442. dctdnoiz=15:n=4
  3443. @end example
  3444. @section deband
  3445. Remove banding artifacts from input video.
  3446. It works by replacing banded pixels with average value of referenced pixels.
  3447. The filter accepts the following options:
  3448. @table @option
  3449. @item 1thr
  3450. @item 2thr
  3451. @item 3thr
  3452. @item 4thr
  3453. Set banding detection threshold for each plane. Default is 0.02.
  3454. Valid range is 0.00003 to 0.5.
  3455. If difference between current pixel and reference pixel is less than threshold,
  3456. it will be considered as banded.
  3457. @item range, r
  3458. Banding detection range in pixels. Default is 16. If positive, random number
  3459. in range 0 to set value will be used. If negative, exact absolute value
  3460. will be used.
  3461. The range defines square of four pixels around current pixel.
  3462. @item direction, d
  3463. Set direction in radians from which four pixel will be compared. If positive,
  3464. random direction from 0 to set direction will be picked. If negative, exact of
  3465. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  3466. will pick only pixels on same row and -PI/2 will pick only pixels on same
  3467. column.
  3468. @item blur
  3469. If enabled, current pixel is compared with average value of all four
  3470. surrounding pixels. The default is enabled. If disabled current pixel is
  3471. compared with all four surrounding pixels. The pixel is considered banded
  3472. if only all four differences with surrounding pixels are less than threshold.
  3473. @end table
  3474. @anchor{decimate}
  3475. @section decimate
  3476. Drop duplicated frames at regular intervals.
  3477. The filter accepts the following options:
  3478. @table @option
  3479. @item cycle
  3480. Set the number of frames from which one will be dropped. Setting this to
  3481. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  3482. Default is @code{5}.
  3483. @item dupthresh
  3484. Set the threshold for duplicate detection. If the difference metric for a frame
  3485. is less than or equal to this value, then it is declared as duplicate. Default
  3486. is @code{1.1}
  3487. @item scthresh
  3488. Set scene change threshold. Default is @code{15}.
  3489. @item blockx
  3490. @item blocky
  3491. Set the size of the x and y-axis blocks used during metric calculations.
  3492. Larger blocks give better noise suppression, but also give worse detection of
  3493. small movements. Must be a power of two. Default is @code{32}.
  3494. @item ppsrc
  3495. Mark main input as a pre-processed input and activate clean source input
  3496. stream. This allows the input to be pre-processed with various filters to help
  3497. the metrics calculation while keeping the frame selection lossless. When set to
  3498. @code{1}, the first stream is for the pre-processed input, and the second
  3499. stream is the clean source from where the kept frames are chosen. Default is
  3500. @code{0}.
  3501. @item chroma
  3502. Set whether or not chroma is considered in the metric calculations. Default is
  3503. @code{1}.
  3504. @end table
  3505. @section deflate
  3506. Apply deflate effect to the video.
  3507. This filter replaces the pixel by the local(3x3) average by taking into account
  3508. only values lower than the pixel.
  3509. It accepts the following options:
  3510. @table @option
  3511. @item threshold0
  3512. @item threshold1
  3513. @item threshold2
  3514. @item threshold3
  3515. Allows to limit the maximum change for each plane, default is 65535.
  3516. If 0, plane will remain unchanged.
  3517. @end table
  3518. @section dejudder
  3519. Remove judder produced by partially interlaced telecined content.
  3520. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  3521. source was partially telecined content then the output of @code{pullup,dejudder}
  3522. will have a variable frame rate. May change the recorded frame rate of the
  3523. container. Aside from that change, this filter will not affect constant frame
  3524. rate video.
  3525. The option available in this filter is:
  3526. @table @option
  3527. @item cycle
  3528. Specify the length of the window over which the judder repeats.
  3529. Accepts any integer greater than 1. Useful values are:
  3530. @table @samp
  3531. @item 4
  3532. If the original was telecined from 24 to 30 fps (Film to NTSC).
  3533. @item 5
  3534. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  3535. @item 20
  3536. If a mixture of the two.
  3537. @end table
  3538. The default is @samp{4}.
  3539. @end table
  3540. @section delogo
  3541. Suppress a TV station logo by a simple interpolation of the surrounding
  3542. pixels. Just set a rectangle covering the logo and watch it disappear
  3543. (and sometimes something even uglier appear - your mileage may vary).
  3544. It accepts the following parameters:
  3545. @table @option
  3546. @item x
  3547. @item y
  3548. Specify the top left corner coordinates of the logo. They must be
  3549. specified.
  3550. @item w
  3551. @item h
  3552. Specify the width and height of the logo to clear. They must be
  3553. specified.
  3554. @item band, t
  3555. Specify the thickness of the fuzzy edge of the rectangle (added to
  3556. @var{w} and @var{h}). The default value is 4.
  3557. @item show
  3558. When set to 1, a green rectangle is drawn on the screen to simplify
  3559. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  3560. The default value is 0.
  3561. The rectangle is drawn on the outermost pixels which will be (partly)
  3562. replaced with interpolated values. The values of the next pixels
  3563. immediately outside this rectangle in each direction will be used to
  3564. compute the interpolated pixel values inside the rectangle.
  3565. @end table
  3566. @subsection Examples
  3567. @itemize
  3568. @item
  3569. Set a rectangle covering the area with top left corner coordinates 0,0
  3570. and size 100x77, and a band of size 10:
  3571. @example
  3572. delogo=x=0:y=0:w=100:h=77:band=10
  3573. @end example
  3574. @end itemize
  3575. @section deshake
  3576. Attempt to fix small changes in horizontal and/or vertical shift. This
  3577. filter helps remove camera shake from hand-holding a camera, bumping a
  3578. tripod, moving on a vehicle, etc.
  3579. The filter accepts the following options:
  3580. @table @option
  3581. @item x
  3582. @item y
  3583. @item w
  3584. @item h
  3585. Specify a rectangular area where to limit the search for motion
  3586. vectors.
  3587. If desired the search for motion vectors can be limited to a
  3588. rectangular area of the frame defined by its top left corner, width
  3589. and height. These parameters have the same meaning as the drawbox
  3590. filter which can be used to visualise the position of the bounding
  3591. box.
  3592. This is useful when simultaneous movement of subjects within the frame
  3593. might be confused for camera motion by the motion vector search.
  3594. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  3595. then the full frame is used. This allows later options to be set
  3596. without specifying the bounding box for the motion vector search.
  3597. Default - search the whole frame.
  3598. @item rx
  3599. @item ry
  3600. Specify the maximum extent of movement in x and y directions in the
  3601. range 0-64 pixels. Default 16.
  3602. @item edge
  3603. Specify how to generate pixels to fill blanks at the edge of the
  3604. frame. Available values are:
  3605. @table @samp
  3606. @item blank, 0
  3607. Fill zeroes at blank locations
  3608. @item original, 1
  3609. Original image at blank locations
  3610. @item clamp, 2
  3611. Extruded edge value at blank locations
  3612. @item mirror, 3
  3613. Mirrored edge at blank locations
  3614. @end table
  3615. Default value is @samp{mirror}.
  3616. @item blocksize
  3617. Specify the blocksize to use for motion search. Range 4-128 pixels,
  3618. default 8.
  3619. @item contrast
  3620. Specify the contrast threshold for blocks. Only blocks with more than
  3621. the specified contrast (difference between darkest and lightest
  3622. pixels) will be considered. Range 1-255, default 125.
  3623. @item search
  3624. Specify the search strategy. Available values are:
  3625. @table @samp
  3626. @item exhaustive, 0
  3627. Set exhaustive search
  3628. @item less, 1
  3629. Set less exhaustive search.
  3630. @end table
  3631. Default value is @samp{exhaustive}.
  3632. @item filename
  3633. If set then a detailed log of the motion search is written to the
  3634. specified file.
  3635. @item opencl
  3636. If set to 1, specify using OpenCL capabilities, only available if
  3637. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  3638. @end table
  3639. @section detelecine
  3640. Apply an exact inverse of the telecine operation. It requires a predefined
  3641. pattern specified using the pattern option which must be the same as that passed
  3642. to the telecine filter.
  3643. This filter accepts the following options:
  3644. @table @option
  3645. @item first_field
  3646. @table @samp
  3647. @item top, t
  3648. top field first
  3649. @item bottom, b
  3650. bottom field first
  3651. The default value is @code{top}.
  3652. @end table
  3653. @item pattern
  3654. A string of numbers representing the pulldown pattern you wish to apply.
  3655. The default value is @code{23}.
  3656. @item start_frame
  3657. A number representing position of the first frame with respect to the telecine
  3658. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  3659. @end table
  3660. @section dilation
  3661. Apply dilation effect to the video.
  3662. This filter replaces the pixel by the local(3x3) maximum.
  3663. It accepts the following options:
  3664. @table @option
  3665. @item threshold0
  3666. @item threshold1
  3667. @item threshold2
  3668. @item threshold3
  3669. Allows to limit the maximum change for each plane, default is 65535.
  3670. If 0, plane will remain unchanged.
  3671. @item coordinates
  3672. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  3673. pixels are used.
  3674. Flags to local 3x3 coordinates maps like this:
  3675. 1 2 3
  3676. 4 5
  3677. 6 7 8
  3678. @end table
  3679. @section displace
  3680. Displace pixels as indicated by second and third input stream.
  3681. It takes three input streams and outputs one stream, the first input is the
  3682. source, and second and third input are displacement maps.
  3683. The second input specifies how much to displace pixels along the
  3684. x-axis, while the third input specifies how much to displace pixels
  3685. along the y-axis.
  3686. If one of displacement map streams terminates, last frame from that
  3687. displacement map will be used.
  3688. Note that once generated, displacements maps can be reused over and over again.
  3689. A description of the accepted options follows.
  3690. @table @option
  3691. @item edge
  3692. Set displace behavior for pixels that are out of range.
  3693. Available values are:
  3694. @table @samp
  3695. @item blank
  3696. Missing pixels are replaced by black pixels.
  3697. @item smear
  3698. Adjacent pixels will spread out to replace missing pixels.
  3699. @item wrap
  3700. Out of range pixels are wrapped so they point to pixels of other side.
  3701. @end table
  3702. Default is @samp{smear}.
  3703. @end table
  3704. @subsection Examples
  3705. @itemize
  3706. @item
  3707. Add ripple effect to rgb input of video size hd720:
  3708. @example
  3709. 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
  3710. @end example
  3711. @item
  3712. Add wave effect to rgb input of video size hd720:
  3713. @example
  3714. 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
  3715. @end example
  3716. @end itemize
  3717. @section drawbox
  3718. Draw a colored box on the input image.
  3719. It accepts the following parameters:
  3720. @table @option
  3721. @item x
  3722. @item y
  3723. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  3724. @item width, w
  3725. @item height, h
  3726. The expressions which specify the width and height of the box; if 0 they are interpreted as
  3727. the input width and height. It defaults to 0.
  3728. @item color, c
  3729. Specify the color of the box to write. For the general syntax of this option,
  3730. check the "Color" section in the ffmpeg-utils manual. If the special
  3731. value @code{invert} is used, the box edge color is the same as the
  3732. video with inverted luma.
  3733. @item thickness, t
  3734. The expression which sets the thickness of the box edge. Default value is @code{3}.
  3735. See below for the list of accepted constants.
  3736. @end table
  3737. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  3738. following constants:
  3739. @table @option
  3740. @item dar
  3741. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  3742. @item hsub
  3743. @item vsub
  3744. horizontal and vertical chroma subsample values. For example for the
  3745. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3746. @item in_h, ih
  3747. @item in_w, iw
  3748. The input width and height.
  3749. @item sar
  3750. The input sample aspect ratio.
  3751. @item x
  3752. @item y
  3753. The x and y offset coordinates where the box is drawn.
  3754. @item w
  3755. @item h
  3756. The width and height of the drawn box.
  3757. @item t
  3758. The thickness of the drawn box.
  3759. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  3760. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  3761. @end table
  3762. @subsection Examples
  3763. @itemize
  3764. @item
  3765. Draw a black box around the edge of the input image:
  3766. @example
  3767. drawbox
  3768. @end example
  3769. @item
  3770. Draw a box with color red and an opacity of 50%:
  3771. @example
  3772. drawbox=10:20:200:60:red@@0.5
  3773. @end example
  3774. The previous example can be specified as:
  3775. @example
  3776. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  3777. @end example
  3778. @item
  3779. Fill the box with pink color:
  3780. @example
  3781. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  3782. @end example
  3783. @item
  3784. Draw a 2-pixel red 2.40:1 mask:
  3785. @example
  3786. 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
  3787. @end example
  3788. @end itemize
  3789. @section drawgraph, adrawgraph
  3790. Draw a graph using input video or audio metadata.
  3791. It accepts the following parameters:
  3792. @table @option
  3793. @item m1
  3794. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  3795. @item fg1
  3796. Set 1st foreground color expression.
  3797. @item m2
  3798. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  3799. @item fg2
  3800. Set 2nd foreground color expression.
  3801. @item m3
  3802. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  3803. @item fg3
  3804. Set 3rd foreground color expression.
  3805. @item m4
  3806. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  3807. @item fg4
  3808. Set 4th foreground color expression.
  3809. @item min
  3810. Set minimal value of metadata value.
  3811. @item max
  3812. Set maximal value of metadata value.
  3813. @item bg
  3814. Set graph background color. Default is white.
  3815. @item mode
  3816. Set graph mode.
  3817. Available values for mode is:
  3818. @table @samp
  3819. @item bar
  3820. @item dot
  3821. @item line
  3822. @end table
  3823. Default is @code{line}.
  3824. @item slide
  3825. Set slide mode.
  3826. Available values for slide is:
  3827. @table @samp
  3828. @item frame
  3829. Draw new frame when right border is reached.
  3830. @item replace
  3831. Replace old columns with new ones.
  3832. @item scroll
  3833. Scroll from right to left.
  3834. @item rscroll
  3835. Scroll from left to right.
  3836. @end table
  3837. Default is @code{frame}.
  3838. @item size
  3839. Set size of graph video. For the syntax of this option, check the
  3840. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  3841. The default value is @code{900x256}.
  3842. The foreground color expressions can use the following variables:
  3843. @table @option
  3844. @item MIN
  3845. Minimal value of metadata value.
  3846. @item MAX
  3847. Maximal value of metadata value.
  3848. @item VAL
  3849. Current metadata key value.
  3850. @end table
  3851. The color is defined as 0xAABBGGRR.
  3852. @end table
  3853. Example using metadata from @ref{signalstats} filter:
  3854. @example
  3855. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  3856. @end example
  3857. Example using metadata from @ref{ebur128} filter:
  3858. @example
  3859. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  3860. @end example
  3861. @section drawgrid
  3862. Draw a grid on the input image.
  3863. It accepts the following parameters:
  3864. @table @option
  3865. @item x
  3866. @item y
  3867. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  3868. @item width, w
  3869. @item height, h
  3870. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  3871. input width and height, respectively, minus @code{thickness}, so image gets
  3872. framed. Default to 0.
  3873. @item color, c
  3874. Specify the color of the grid. For the general syntax of this option,
  3875. check the "Color" section in the ffmpeg-utils manual. If the special
  3876. value @code{invert} is used, the grid color is the same as the
  3877. video with inverted luma.
  3878. @item thickness, t
  3879. The expression which sets the thickness of the grid line. Default value is @code{1}.
  3880. See below for the list of accepted constants.
  3881. @end table
  3882. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  3883. following constants:
  3884. @table @option
  3885. @item dar
  3886. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  3887. @item hsub
  3888. @item vsub
  3889. horizontal and vertical chroma subsample values. For example for the
  3890. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3891. @item in_h, ih
  3892. @item in_w, iw
  3893. The input grid cell width and height.
  3894. @item sar
  3895. The input sample aspect ratio.
  3896. @item x
  3897. @item y
  3898. The x and y coordinates of some point of grid intersection (meant to configure offset).
  3899. @item w
  3900. @item h
  3901. The width and height of the drawn cell.
  3902. @item t
  3903. The thickness of the drawn cell.
  3904. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  3905. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  3906. @end table
  3907. @subsection Examples
  3908. @itemize
  3909. @item
  3910. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  3911. @example
  3912. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  3913. @end example
  3914. @item
  3915. Draw a white 3x3 grid with an opacity of 50%:
  3916. @example
  3917. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  3918. @end example
  3919. @end itemize
  3920. @anchor{drawtext}
  3921. @section drawtext
  3922. Draw a text string or text from a specified file on top of a video, using the
  3923. libfreetype library.
  3924. To enable compilation of this filter, you need to configure FFmpeg with
  3925. @code{--enable-libfreetype}.
  3926. To enable default font fallback and the @var{font} option you need to
  3927. configure FFmpeg with @code{--enable-libfontconfig}.
  3928. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  3929. @code{--enable-libfribidi}.
  3930. @subsection Syntax
  3931. It accepts the following parameters:
  3932. @table @option
  3933. @item box
  3934. Used to draw a box around text using the background color.
  3935. The value must be either 1 (enable) or 0 (disable).
  3936. The default value of @var{box} is 0.
  3937. @item boxborderw
  3938. Set the width of the border to be drawn around the box using @var{boxcolor}.
  3939. The default value of @var{boxborderw} is 0.
  3940. @item boxcolor
  3941. The color to be used for drawing box around text. For the syntax of this
  3942. option, check the "Color" section in the ffmpeg-utils manual.
  3943. The default value of @var{boxcolor} is "white".
  3944. @item borderw
  3945. Set the width of the border to be drawn around the text using @var{bordercolor}.
  3946. The default value of @var{borderw} is 0.
  3947. @item bordercolor
  3948. Set the color to be used for drawing border around text. For the syntax of this
  3949. option, check the "Color" section in the ffmpeg-utils manual.
  3950. The default value of @var{bordercolor} is "black".
  3951. @item expansion
  3952. Select how the @var{text} is expanded. Can be either @code{none},
  3953. @code{strftime} (deprecated) or
  3954. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  3955. below for details.
  3956. @item fix_bounds
  3957. If true, check and fix text coords to avoid clipping.
  3958. @item fontcolor
  3959. The color to be used for drawing fonts. For the syntax of this option, check
  3960. the "Color" section in the ffmpeg-utils manual.
  3961. The default value of @var{fontcolor} is "black".
  3962. @item fontcolor_expr
  3963. String which is expanded the same way as @var{text} to obtain dynamic
  3964. @var{fontcolor} value. By default this option has empty value and is not
  3965. processed. When this option is set, it overrides @var{fontcolor} option.
  3966. @item font
  3967. The font family to be used for drawing text. By default Sans.
  3968. @item fontfile
  3969. The font file to be used for drawing text. The path must be included.
  3970. This parameter is mandatory if the fontconfig support is disabled.
  3971. @item draw
  3972. This option does not exist, please see the timeline system
  3973. @item alpha
  3974. Draw the text applying alpha blending. The value can
  3975. be either a number between 0.0 and 1.0
  3976. The expression accepts the same variables @var{x, y} do.
  3977. The default value is 1.
  3978. Please see fontcolor_expr
  3979. @item fontsize
  3980. The font size to be used for drawing text.
  3981. The default value of @var{fontsize} is 16.
  3982. @item text_shaping
  3983. If set to 1, attempt to shape the text (for example, reverse the order of
  3984. right-to-left text and join Arabic characters) before drawing it.
  3985. Otherwise, just draw the text exactly as given.
  3986. By default 1 (if supported).
  3987. @item ft_load_flags
  3988. The flags to be used for loading the fonts.
  3989. The flags map the corresponding flags supported by libfreetype, and are
  3990. a combination of the following values:
  3991. @table @var
  3992. @item default
  3993. @item no_scale
  3994. @item no_hinting
  3995. @item render
  3996. @item no_bitmap
  3997. @item vertical_layout
  3998. @item force_autohint
  3999. @item crop_bitmap
  4000. @item pedantic
  4001. @item ignore_global_advance_width
  4002. @item no_recurse
  4003. @item ignore_transform
  4004. @item monochrome
  4005. @item linear_design
  4006. @item no_autohint
  4007. @end table
  4008. Default value is "default".
  4009. For more information consult the documentation for the FT_LOAD_*
  4010. libfreetype flags.
  4011. @item shadowcolor
  4012. The color to be used for drawing a shadow behind the drawn text. For the
  4013. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  4014. The default value of @var{shadowcolor} is "black".
  4015. @item shadowx
  4016. @item shadowy
  4017. The x and y offsets for the text shadow position with respect to the
  4018. position of the text. They can be either positive or negative
  4019. values. The default value for both is "0".
  4020. @item start_number
  4021. The starting frame number for the n/frame_num variable. The default value
  4022. is "0".
  4023. @item tabsize
  4024. The size in number of spaces to use for rendering the tab.
  4025. Default value is 4.
  4026. @item timecode
  4027. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  4028. format. It can be used with or without text parameter. @var{timecode_rate}
  4029. option must be specified.
  4030. @item timecode_rate, rate, r
  4031. Set the timecode frame rate (timecode only).
  4032. @item text
  4033. The text string to be drawn. The text must be a sequence of UTF-8
  4034. encoded characters.
  4035. This parameter is mandatory if no file is specified with the parameter
  4036. @var{textfile}.
  4037. @item textfile
  4038. A text file containing text to be drawn. The text must be a sequence
  4039. of UTF-8 encoded characters.
  4040. This parameter is mandatory if no text string is specified with the
  4041. parameter @var{text}.
  4042. If both @var{text} and @var{textfile} are specified, an error is thrown.
  4043. @item reload
  4044. If set to 1, the @var{textfile} will be reloaded before each frame.
  4045. Be sure to update it atomically, or it may be read partially, or even fail.
  4046. @item x
  4047. @item y
  4048. The expressions which specify the offsets where text will be drawn
  4049. within the video frame. They are relative to the top/left border of the
  4050. output image.
  4051. The default value of @var{x} and @var{y} is "0".
  4052. See below for the list of accepted constants and functions.
  4053. @end table
  4054. The parameters for @var{x} and @var{y} are expressions containing the
  4055. following constants and functions:
  4056. @table @option
  4057. @item dar
  4058. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  4059. @item hsub
  4060. @item vsub
  4061. horizontal and vertical chroma subsample values. For example for the
  4062. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4063. @item line_h, lh
  4064. the height of each text line
  4065. @item main_h, h, H
  4066. the input height
  4067. @item main_w, w, W
  4068. the input width
  4069. @item max_glyph_a, ascent
  4070. the maximum distance from the baseline to the highest/upper grid
  4071. coordinate used to place a glyph outline point, for all the rendered
  4072. glyphs.
  4073. It is a positive value, due to the grid's orientation with the Y axis
  4074. upwards.
  4075. @item max_glyph_d, descent
  4076. the maximum distance from the baseline to the lowest grid coordinate
  4077. used to place a glyph outline point, for all the rendered glyphs.
  4078. This is a negative value, due to the grid's orientation, with the Y axis
  4079. upwards.
  4080. @item max_glyph_h
  4081. maximum glyph height, that is the maximum height for all the glyphs
  4082. contained in the rendered text, it is equivalent to @var{ascent} -
  4083. @var{descent}.
  4084. @item max_glyph_w
  4085. maximum glyph width, that is the maximum width for all the glyphs
  4086. contained in the rendered text
  4087. @item n
  4088. the number of input frame, starting from 0
  4089. @item rand(min, max)
  4090. return a random number included between @var{min} and @var{max}
  4091. @item sar
  4092. The input sample aspect ratio.
  4093. @item t
  4094. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4095. @item text_h, th
  4096. the height of the rendered text
  4097. @item text_w, tw
  4098. the width of the rendered text
  4099. @item x
  4100. @item y
  4101. the x and y offset coordinates where the text is drawn.
  4102. These parameters allow the @var{x} and @var{y} expressions to refer
  4103. each other, so you can for example specify @code{y=x/dar}.
  4104. @end table
  4105. @anchor{drawtext_expansion}
  4106. @subsection Text expansion
  4107. If @option{expansion} is set to @code{strftime},
  4108. the filter recognizes strftime() sequences in the provided text and
  4109. expands them accordingly. Check the documentation of strftime(). This
  4110. feature is deprecated.
  4111. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  4112. If @option{expansion} is set to @code{normal} (which is the default),
  4113. the following expansion mechanism is used.
  4114. The backslash character @samp{\}, followed by any character, always expands to
  4115. the second character.
  4116. Sequence of the form @code{%@{...@}} are expanded. The text between the
  4117. braces is a function name, possibly followed by arguments separated by ':'.
  4118. If the arguments contain special characters or delimiters (':' or '@}'),
  4119. they should be escaped.
  4120. Note that they probably must also be escaped as the value for the
  4121. @option{text} option in the filter argument string and as the filter
  4122. argument in the filtergraph description, and possibly also for the shell,
  4123. that makes up to four levels of escaping; using a text file avoids these
  4124. problems.
  4125. The following functions are available:
  4126. @table @command
  4127. @item expr, e
  4128. The expression evaluation result.
  4129. It must take one argument specifying the expression to be evaluated,
  4130. which accepts the same constants and functions as the @var{x} and
  4131. @var{y} values. Note that not all constants should be used, for
  4132. example the text size is not known when evaluating the expression, so
  4133. the constants @var{text_w} and @var{text_h} will have an undefined
  4134. value.
  4135. @item expr_int_format, eif
  4136. Evaluate the expression's value and output as formatted integer.
  4137. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  4138. The second argument specifies the output format. Allowed values are @samp{x},
  4139. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  4140. @code{printf} function.
  4141. The third parameter is optional and sets the number of positions taken by the output.
  4142. It can be used to add padding with zeros from the left.
  4143. @item gmtime
  4144. The time at which the filter is running, expressed in UTC.
  4145. It can accept an argument: a strftime() format string.
  4146. @item localtime
  4147. The time at which the filter is running, expressed in the local time zone.
  4148. It can accept an argument: a strftime() format string.
  4149. @item metadata
  4150. Frame metadata. It must take one argument specifying metadata key.
  4151. @item n, frame_num
  4152. The frame number, starting from 0.
  4153. @item pict_type
  4154. A 1 character description of the current picture type.
  4155. @item pts
  4156. The timestamp of the current frame.
  4157. It can take up to two arguments.
  4158. The first argument is the format of the timestamp; it defaults to @code{flt}
  4159. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  4160. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  4161. The second argument is an offset added to the timestamp.
  4162. @end table
  4163. @subsection Examples
  4164. @itemize
  4165. @item
  4166. Draw "Test Text" with font FreeSerif, using the default values for the
  4167. optional parameters.
  4168. @example
  4169. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  4170. @end example
  4171. @item
  4172. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  4173. and y=50 (counting from the top-left corner of the screen), text is
  4174. yellow with a red box around it. Both the text and the box have an
  4175. opacity of 20%.
  4176. @example
  4177. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  4178. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  4179. @end example
  4180. Note that the double quotes are not necessary if spaces are not used
  4181. within the parameter list.
  4182. @item
  4183. Show the text at the center of the video frame:
  4184. @example
  4185. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
  4186. @end example
  4187. @item
  4188. Show a text line sliding from right to left in the last row of the video
  4189. frame. The file @file{LONG_LINE} is assumed to contain a single line
  4190. with no newlines.
  4191. @example
  4192. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  4193. @end example
  4194. @item
  4195. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  4196. @example
  4197. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  4198. @end example
  4199. @item
  4200. Draw a single green letter "g", at the center of the input video.
  4201. The glyph baseline is placed at half screen height.
  4202. @example
  4203. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  4204. @end example
  4205. @item
  4206. Show text for 1 second every 3 seconds:
  4207. @example
  4208. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  4209. @end example
  4210. @item
  4211. Use fontconfig to set the font. Note that the colons need to be escaped.
  4212. @example
  4213. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  4214. @end example
  4215. @item
  4216. Print the date of a real-time encoding (see strftime(3)):
  4217. @example
  4218. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  4219. @end example
  4220. @item
  4221. Show text fading in and out (appearing/disappearing):
  4222. @example
  4223. #!/bin/sh
  4224. DS=1.0 # display start
  4225. DE=10.0 # display end
  4226. FID=1.5 # fade in duration
  4227. FOD=5 # fade out duration
  4228. 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 @}"
  4229. @end example
  4230. @end itemize
  4231. For more information about libfreetype, check:
  4232. @url{http://www.freetype.org/}.
  4233. For more information about fontconfig, check:
  4234. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  4235. For more information about libfribidi, check:
  4236. @url{http://fribidi.org/}.
  4237. @section edgedetect
  4238. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  4239. The filter accepts the following options:
  4240. @table @option
  4241. @item low
  4242. @item high
  4243. Set low and high threshold values used by the Canny thresholding
  4244. algorithm.
  4245. The high threshold selects the "strong" edge pixels, which are then
  4246. connected through 8-connectivity with the "weak" edge pixels selected
  4247. by the low threshold.
  4248. @var{low} and @var{high} threshold values must be chosen in the range
  4249. [0,1], and @var{low} should be lesser or equal to @var{high}.
  4250. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  4251. is @code{50/255}.
  4252. @item mode
  4253. Define the drawing mode.
  4254. @table @samp
  4255. @item wires
  4256. Draw white/gray wires on black background.
  4257. @item colormix
  4258. Mix the colors to create a paint/cartoon effect.
  4259. @end table
  4260. Default value is @var{wires}.
  4261. @end table
  4262. @subsection Examples
  4263. @itemize
  4264. @item
  4265. Standard edge detection with custom values for the hysteresis thresholding:
  4266. @example
  4267. edgedetect=low=0.1:high=0.4
  4268. @end example
  4269. @item
  4270. Painting effect without thresholding:
  4271. @example
  4272. edgedetect=mode=colormix:high=0
  4273. @end example
  4274. @end itemize
  4275. @section eq
  4276. Set brightness, contrast, saturation and approximate gamma adjustment.
  4277. The filter accepts the following options:
  4278. @table @option
  4279. @item contrast
  4280. Set the contrast expression. The value must be a float value in range
  4281. @code{-2.0} to @code{2.0}. The default value is "1".
  4282. @item brightness
  4283. Set the brightness expression. The value must be a float value in
  4284. range @code{-1.0} to @code{1.0}. The default value is "0".
  4285. @item saturation
  4286. Set the saturation expression. The value must be a float in
  4287. range @code{0.0} to @code{3.0}. The default value is "1".
  4288. @item gamma
  4289. Set the gamma expression. The value must be a float in range
  4290. @code{0.1} to @code{10.0}. The default value is "1".
  4291. @item gamma_r
  4292. Set the gamma expression for red. The value must be a float in
  4293. range @code{0.1} to @code{10.0}. The default value is "1".
  4294. @item gamma_g
  4295. Set the gamma expression for green. The value must be a float in range
  4296. @code{0.1} to @code{10.0}. The default value is "1".
  4297. @item gamma_b
  4298. Set the gamma expression for blue. The value must be a float in range
  4299. @code{0.1} to @code{10.0}. The default value is "1".
  4300. @item gamma_weight
  4301. Set the gamma weight expression. It can be used to reduce the effect
  4302. of a high gamma value on bright image areas, e.g. keep them from
  4303. getting overamplified and just plain white. The value must be a float
  4304. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  4305. gamma correction all the way down while @code{1.0} leaves it at its
  4306. full strength. Default is "1".
  4307. @item eval
  4308. Set when the expressions for brightness, contrast, saturation and
  4309. gamma expressions are evaluated.
  4310. It accepts the following values:
  4311. @table @samp
  4312. @item init
  4313. only evaluate expressions once during the filter initialization or
  4314. when a command is processed
  4315. @item frame
  4316. evaluate expressions for each incoming frame
  4317. @end table
  4318. Default value is @samp{init}.
  4319. @end table
  4320. The expressions accept the following parameters:
  4321. @table @option
  4322. @item n
  4323. frame count of the input frame starting from 0
  4324. @item pos
  4325. byte position of the corresponding packet in the input file, NAN if
  4326. unspecified
  4327. @item r
  4328. frame rate of the input video, NAN if the input frame rate is unknown
  4329. @item t
  4330. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4331. @end table
  4332. @subsection Commands
  4333. The filter supports the following commands:
  4334. @table @option
  4335. @item contrast
  4336. Set the contrast expression.
  4337. @item brightness
  4338. Set the brightness expression.
  4339. @item saturation
  4340. Set the saturation expression.
  4341. @item gamma
  4342. Set the gamma expression.
  4343. @item gamma_r
  4344. Set the gamma_r expression.
  4345. @item gamma_g
  4346. Set gamma_g expression.
  4347. @item gamma_b
  4348. Set gamma_b expression.
  4349. @item gamma_weight
  4350. Set gamma_weight expression.
  4351. The command accepts the same syntax of the corresponding option.
  4352. If the specified expression is not valid, it is kept at its current
  4353. value.
  4354. @end table
  4355. @section erosion
  4356. Apply erosion effect to the video.
  4357. This filter replaces the pixel by the local(3x3) minimum.
  4358. It accepts the following options:
  4359. @table @option
  4360. @item threshold0
  4361. @item threshold1
  4362. @item threshold2
  4363. @item threshold3
  4364. Allows to limit the maximum change for each plane, default is 65535.
  4365. If 0, plane will remain unchanged.
  4366. @item coordinates
  4367. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4368. pixels are used.
  4369. Flags to local 3x3 coordinates maps like this:
  4370. 1 2 3
  4371. 4 5
  4372. 6 7 8
  4373. @end table
  4374. @section extractplanes
  4375. Extract color channel components from input video stream into
  4376. separate grayscale video streams.
  4377. The filter accepts the following option:
  4378. @table @option
  4379. @item planes
  4380. Set plane(s) to extract.
  4381. Available values for planes are:
  4382. @table @samp
  4383. @item y
  4384. @item u
  4385. @item v
  4386. @item a
  4387. @item r
  4388. @item g
  4389. @item b
  4390. @end table
  4391. Choosing planes not available in the input will result in an error.
  4392. That means you cannot select @code{r}, @code{g}, @code{b} planes
  4393. with @code{y}, @code{u}, @code{v} planes at same time.
  4394. @end table
  4395. @subsection Examples
  4396. @itemize
  4397. @item
  4398. Extract luma, u and v color channel component from input video frame
  4399. into 3 grayscale outputs:
  4400. @example
  4401. 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
  4402. @end example
  4403. @end itemize
  4404. @section elbg
  4405. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  4406. For each input image, the filter will compute the optimal mapping from
  4407. the input to the output given the codebook length, that is the number
  4408. of distinct output colors.
  4409. This filter accepts the following options.
  4410. @table @option
  4411. @item codebook_length, l
  4412. Set codebook length. The value must be a positive integer, and
  4413. represents the number of distinct output colors. Default value is 256.
  4414. @item nb_steps, n
  4415. Set the maximum number of iterations to apply for computing the optimal
  4416. mapping. The higher the value the better the result and the higher the
  4417. computation time. Default value is 1.
  4418. @item seed, s
  4419. Set a random seed, must be an integer included between 0 and
  4420. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  4421. will try to use a good random seed on a best effort basis.
  4422. @item pal8
  4423. Set pal8 output pixel format. This option does not work with codebook
  4424. length greater than 256.
  4425. @end table
  4426. @section fade
  4427. Apply a fade-in/out effect to the input video.
  4428. It accepts the following parameters:
  4429. @table @option
  4430. @item type, t
  4431. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  4432. effect.
  4433. Default is @code{in}.
  4434. @item start_frame, s
  4435. Specify the number of the frame to start applying the fade
  4436. effect at. Default is 0.
  4437. @item nb_frames, n
  4438. The number of frames that the fade effect lasts. At the end of the
  4439. fade-in effect, the output video will have the same intensity as the input video.
  4440. At the end of the fade-out transition, the output video will be filled with the
  4441. selected @option{color}.
  4442. Default is 25.
  4443. @item alpha
  4444. If set to 1, fade only alpha channel, if one exists on the input.
  4445. Default value is 0.
  4446. @item start_time, st
  4447. Specify the timestamp (in seconds) of the frame to start to apply the fade
  4448. effect. If both start_frame and start_time are specified, the fade will start at
  4449. whichever comes last. Default is 0.
  4450. @item duration, d
  4451. The number of seconds for which the fade effect has to last. At the end of the
  4452. fade-in effect the output video will have the same intensity as the input video,
  4453. at the end of the fade-out transition the output video will be filled with the
  4454. selected @option{color}.
  4455. If both duration and nb_frames are specified, duration is used. Default is 0
  4456. (nb_frames is used by default).
  4457. @item color, c
  4458. Specify the color of the fade. Default is "black".
  4459. @end table
  4460. @subsection Examples
  4461. @itemize
  4462. @item
  4463. Fade in the first 30 frames of video:
  4464. @example
  4465. fade=in:0:30
  4466. @end example
  4467. The command above is equivalent to:
  4468. @example
  4469. fade=t=in:s=0:n=30
  4470. @end example
  4471. @item
  4472. Fade out the last 45 frames of a 200-frame video:
  4473. @example
  4474. fade=out:155:45
  4475. fade=type=out:start_frame=155:nb_frames=45
  4476. @end example
  4477. @item
  4478. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  4479. @example
  4480. fade=in:0:25, fade=out:975:25
  4481. @end example
  4482. @item
  4483. Make the first 5 frames yellow, then fade in from frame 5-24:
  4484. @example
  4485. fade=in:5:20:color=yellow
  4486. @end example
  4487. @item
  4488. Fade in alpha over first 25 frames of video:
  4489. @example
  4490. fade=in:0:25:alpha=1
  4491. @end example
  4492. @item
  4493. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  4494. @example
  4495. fade=t=in:st=5.5:d=0.5
  4496. @end example
  4497. @end itemize
  4498. @section fftfilt
  4499. Apply arbitrary expressions to samples in frequency domain
  4500. @table @option
  4501. @item dc_Y
  4502. Adjust the dc value (gain) of the luma plane of the image. The filter
  4503. accepts an integer value in range @code{0} to @code{1000}. The default
  4504. value is set to @code{0}.
  4505. @item dc_U
  4506. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  4507. filter accepts an integer value in range @code{0} to @code{1000}. The
  4508. default value is set to @code{0}.
  4509. @item dc_V
  4510. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  4511. filter accepts an integer value in range @code{0} to @code{1000}. The
  4512. default value is set to @code{0}.
  4513. @item weight_Y
  4514. Set the frequency domain weight expression for the luma plane.
  4515. @item weight_U
  4516. Set the frequency domain weight expression for the 1st chroma plane.
  4517. @item weight_V
  4518. Set the frequency domain weight expression for the 2nd chroma plane.
  4519. The filter accepts the following variables:
  4520. @item X
  4521. @item Y
  4522. The coordinates of the current sample.
  4523. @item W
  4524. @item H
  4525. The width and height of the image.
  4526. @end table
  4527. @subsection Examples
  4528. @itemize
  4529. @item
  4530. High-pass:
  4531. @example
  4532. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  4533. @end example
  4534. @item
  4535. Low-pass:
  4536. @example
  4537. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  4538. @end example
  4539. @item
  4540. Sharpen:
  4541. @example
  4542. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  4543. @end example
  4544. @end itemize
  4545. @section field
  4546. Extract a single field from an interlaced image using stride
  4547. arithmetic to avoid wasting CPU time. The output frames are marked as
  4548. non-interlaced.
  4549. The filter accepts the following options:
  4550. @table @option
  4551. @item type
  4552. Specify whether to extract the top (if the value is @code{0} or
  4553. @code{top}) or the bottom field (if the value is @code{1} or
  4554. @code{bottom}).
  4555. @end table
  4556. @section fieldmatch
  4557. Field matching filter for inverse telecine. It is meant to reconstruct the
  4558. progressive frames from a telecined stream. The filter does not drop duplicated
  4559. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  4560. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  4561. The separation of the field matching and the decimation is notably motivated by
  4562. the possibility of inserting a de-interlacing filter fallback between the two.
  4563. If the source has mixed telecined and real interlaced content,
  4564. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  4565. But these remaining combed frames will be marked as interlaced, and thus can be
  4566. de-interlaced by a later filter such as @ref{yadif} before decimation.
  4567. In addition to the various configuration options, @code{fieldmatch} can take an
  4568. optional second stream, activated through the @option{ppsrc} option. If
  4569. enabled, the frames reconstruction will be based on the fields and frames from
  4570. this second stream. This allows the first input to be pre-processed in order to
  4571. help the various algorithms of the filter, while keeping the output lossless
  4572. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  4573. or brightness/contrast adjustments can help.
  4574. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  4575. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  4576. which @code{fieldmatch} is based on. While the semantic and usage are very
  4577. close, some behaviour and options names can differ.
  4578. The @ref{decimate} filter currently only works for constant frame rate input.
  4579. If your input has mixed telecined (30fps) and progressive content with a lower
  4580. framerate like 24fps use the following filterchain to produce the necessary cfr
  4581. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  4582. The filter accepts the following options:
  4583. @table @option
  4584. @item order
  4585. Specify the assumed field order of the input stream. Available values are:
  4586. @table @samp
  4587. @item auto
  4588. Auto detect parity (use FFmpeg's internal parity value).
  4589. @item bff
  4590. Assume bottom field first.
  4591. @item tff
  4592. Assume top field first.
  4593. @end table
  4594. Note that it is sometimes recommended not to trust the parity announced by the
  4595. stream.
  4596. Default value is @var{auto}.
  4597. @item mode
  4598. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  4599. sense that it won't risk creating jerkiness due to duplicate frames when
  4600. possible, but if there are bad edits or blended fields it will end up
  4601. outputting combed frames when a good match might actually exist. On the other
  4602. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  4603. but will almost always find a good frame if there is one. The other values are
  4604. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  4605. jerkiness and creating duplicate frames versus finding good matches in sections
  4606. with bad edits, orphaned fields, blended fields, etc.
  4607. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  4608. Available values are:
  4609. @table @samp
  4610. @item pc
  4611. 2-way matching (p/c)
  4612. @item pc_n
  4613. 2-way matching, and trying 3rd match if still combed (p/c + n)
  4614. @item pc_u
  4615. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  4616. @item pc_n_ub
  4617. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  4618. still combed (p/c + n + u/b)
  4619. @item pcn
  4620. 3-way matching (p/c/n)
  4621. @item pcn_ub
  4622. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  4623. detected as combed (p/c/n + u/b)
  4624. @end table
  4625. The parenthesis at the end indicate the matches that would be used for that
  4626. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  4627. @var{top}).
  4628. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  4629. the slowest.
  4630. Default value is @var{pc_n}.
  4631. @item ppsrc
  4632. Mark the main input stream as a pre-processed input, and enable the secondary
  4633. input stream as the clean source to pick the fields from. See the filter
  4634. introduction for more details. It is similar to the @option{clip2} feature from
  4635. VFM/TFM.
  4636. Default value is @code{0} (disabled).
  4637. @item field
  4638. Set the field to match from. It is recommended to set this to the same value as
  4639. @option{order} unless you experience matching failures with that setting. In
  4640. certain circumstances changing the field that is used to match from can have a
  4641. large impact on matching performance. Available values are:
  4642. @table @samp
  4643. @item auto
  4644. Automatic (same value as @option{order}).
  4645. @item bottom
  4646. Match from the bottom field.
  4647. @item top
  4648. Match from the top field.
  4649. @end table
  4650. Default value is @var{auto}.
  4651. @item mchroma
  4652. Set whether or not chroma is included during the match comparisons. In most
  4653. cases it is recommended to leave this enabled. You should set this to @code{0}
  4654. only if your clip has bad chroma problems such as heavy rainbowing or other
  4655. artifacts. Setting this to @code{0} could also be used to speed things up at
  4656. the cost of some accuracy.
  4657. Default value is @code{1}.
  4658. @item y0
  4659. @item y1
  4660. These define an exclusion band which excludes the lines between @option{y0} and
  4661. @option{y1} from being included in the field matching decision. An exclusion
  4662. band can be used to ignore subtitles, a logo, or other things that may
  4663. interfere with the matching. @option{y0} sets the starting scan line and
  4664. @option{y1} sets the ending line; all lines in between @option{y0} and
  4665. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  4666. @option{y0} and @option{y1} to the same value will disable the feature.
  4667. @option{y0} and @option{y1} defaults to @code{0}.
  4668. @item scthresh
  4669. Set the scene change detection threshold as a percentage of maximum change on
  4670. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  4671. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  4672. @option{scthresh} is @code{[0.0, 100.0]}.
  4673. Default value is @code{12.0}.
  4674. @item combmatch
  4675. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  4676. account the combed scores of matches when deciding what match to use as the
  4677. final match. Available values are:
  4678. @table @samp
  4679. @item none
  4680. No final matching based on combed scores.
  4681. @item sc
  4682. Combed scores are only used when a scene change is detected.
  4683. @item full
  4684. Use combed scores all the time.
  4685. @end table
  4686. Default is @var{sc}.
  4687. @item combdbg
  4688. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  4689. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  4690. Available values are:
  4691. @table @samp
  4692. @item none
  4693. No forced calculation.
  4694. @item pcn
  4695. Force p/c/n calculations.
  4696. @item pcnub
  4697. Force p/c/n/u/b calculations.
  4698. @end table
  4699. Default value is @var{none}.
  4700. @item cthresh
  4701. This is the area combing threshold used for combed frame detection. This
  4702. essentially controls how "strong" or "visible" combing must be to be detected.
  4703. Larger values mean combing must be more visible and smaller values mean combing
  4704. can be less visible or strong and still be detected. Valid settings are from
  4705. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  4706. be detected as combed). This is basically a pixel difference value. A good
  4707. range is @code{[8, 12]}.
  4708. Default value is @code{9}.
  4709. @item chroma
  4710. Sets whether or not chroma is considered in the combed frame decision. Only
  4711. disable this if your source has chroma problems (rainbowing, etc.) that are
  4712. causing problems for the combed frame detection with chroma enabled. Actually,
  4713. using @option{chroma}=@var{0} is usually more reliable, except for the case
  4714. where there is chroma only combing in the source.
  4715. Default value is @code{0}.
  4716. @item blockx
  4717. @item blocky
  4718. Respectively set the x-axis and y-axis size of the window used during combed
  4719. frame detection. This has to do with the size of the area in which
  4720. @option{combpel} pixels are required to be detected as combed for a frame to be
  4721. declared combed. See the @option{combpel} parameter description for more info.
  4722. Possible values are any number that is a power of 2 starting at 4 and going up
  4723. to 512.
  4724. Default value is @code{16}.
  4725. @item combpel
  4726. The number of combed pixels inside any of the @option{blocky} by
  4727. @option{blockx} size blocks on the frame for the frame to be detected as
  4728. combed. While @option{cthresh} controls how "visible" the combing must be, this
  4729. setting controls "how much" combing there must be in any localized area (a
  4730. window defined by the @option{blockx} and @option{blocky} settings) on the
  4731. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  4732. which point no frames will ever be detected as combed). This setting is known
  4733. as @option{MI} in TFM/VFM vocabulary.
  4734. Default value is @code{80}.
  4735. @end table
  4736. @anchor{p/c/n/u/b meaning}
  4737. @subsection p/c/n/u/b meaning
  4738. @subsubsection p/c/n
  4739. We assume the following telecined stream:
  4740. @example
  4741. Top fields: 1 2 2 3 4
  4742. Bottom fields: 1 2 3 4 4
  4743. @end example
  4744. The numbers correspond to the progressive frame the fields relate to. Here, the
  4745. first two frames are progressive, the 3rd and 4th are combed, and so on.
  4746. When @code{fieldmatch} is configured to run a matching from bottom
  4747. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  4748. @example
  4749. Input stream:
  4750. T 1 2 2 3 4
  4751. B 1 2 3 4 4 <-- matching reference
  4752. Matches: c c n n c
  4753. Output stream:
  4754. T 1 2 3 4 4
  4755. B 1 2 3 4 4
  4756. @end example
  4757. As a result of the field matching, we can see that some frames get duplicated.
  4758. To perform a complete inverse telecine, you need to rely on a decimation filter
  4759. after this operation. See for instance the @ref{decimate} filter.
  4760. The same operation now matching from top fields (@option{field}=@var{top})
  4761. looks like this:
  4762. @example
  4763. Input stream:
  4764. T 1 2 2 3 4 <-- matching reference
  4765. B 1 2 3 4 4
  4766. Matches: c c p p c
  4767. Output stream:
  4768. T 1 2 2 3 4
  4769. B 1 2 2 3 4
  4770. @end example
  4771. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  4772. basically, they refer to the frame and field of the opposite parity:
  4773. @itemize
  4774. @item @var{p} matches the field of the opposite parity in the previous frame
  4775. @item @var{c} matches the field of the opposite parity in the current frame
  4776. @item @var{n} matches the field of the opposite parity in the next frame
  4777. @end itemize
  4778. @subsubsection u/b
  4779. The @var{u} and @var{b} matching are a bit special in the sense that they match
  4780. from the opposite parity flag. In the following examples, we assume that we are
  4781. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  4782. 'x' is placed above and below each matched fields.
  4783. With bottom matching (@option{field}=@var{bottom}):
  4784. @example
  4785. Match: c p n b u
  4786. x x x x x
  4787. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  4788. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  4789. x x x x x
  4790. Output frames:
  4791. 2 1 2 2 2
  4792. 2 2 2 1 3
  4793. @end example
  4794. With top matching (@option{field}=@var{top}):
  4795. @example
  4796. Match: c p n b u
  4797. x x x x x
  4798. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  4799. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  4800. x x x x x
  4801. Output frames:
  4802. 2 2 2 1 2
  4803. 2 1 3 2 2
  4804. @end example
  4805. @subsection Examples
  4806. Simple IVTC of a top field first telecined stream:
  4807. @example
  4808. fieldmatch=order=tff:combmatch=none, decimate
  4809. @end example
  4810. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  4811. @example
  4812. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  4813. @end example
  4814. @section fieldorder
  4815. Transform the field order of the input video.
  4816. It accepts the following parameters:
  4817. @table @option
  4818. @item order
  4819. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  4820. for bottom field first.
  4821. @end table
  4822. The default value is @samp{tff}.
  4823. The transformation is done by shifting the picture content up or down
  4824. by one line, and filling the remaining line with appropriate picture content.
  4825. This method is consistent with most broadcast field order converters.
  4826. If the input video is not flagged as being interlaced, or it is already
  4827. flagged as being of the required output field order, then this filter does
  4828. not alter the incoming video.
  4829. It is very useful when converting to or from PAL DV material,
  4830. which is bottom field first.
  4831. For example:
  4832. @example
  4833. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  4834. @end example
  4835. @section fifo
  4836. Buffer input images and send them when they are requested.
  4837. It is mainly useful when auto-inserted by the libavfilter
  4838. framework.
  4839. It does not take parameters.
  4840. @section find_rect
  4841. Find a rectangular object
  4842. It accepts the following options:
  4843. @table @option
  4844. @item object
  4845. Filepath of the object image, needs to be in gray8.
  4846. @item threshold
  4847. Detection threshold, default is 0.5.
  4848. @item mipmaps
  4849. Number of mipmaps, default is 3.
  4850. @item xmin, ymin, xmax, ymax
  4851. Specifies the rectangle in which to search.
  4852. @end table
  4853. @subsection Examples
  4854. @itemize
  4855. @item
  4856. Generate a representative palette of a given video using @command{ffmpeg}:
  4857. @example
  4858. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  4859. @end example
  4860. @end itemize
  4861. @section cover_rect
  4862. Cover a rectangular object
  4863. It accepts the following options:
  4864. @table @option
  4865. @item cover
  4866. Filepath of the optional cover image, needs to be in yuv420.
  4867. @item mode
  4868. Set covering mode.
  4869. It accepts the following values:
  4870. @table @samp
  4871. @item cover
  4872. cover it by the supplied image
  4873. @item blur
  4874. cover it by interpolating the surrounding pixels
  4875. @end table
  4876. Default value is @var{blur}.
  4877. @end table
  4878. @subsection Examples
  4879. @itemize
  4880. @item
  4881. Generate a representative palette of a given video using @command{ffmpeg}:
  4882. @example
  4883. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  4884. @end example
  4885. @end itemize
  4886. @anchor{format}
  4887. @section format
  4888. Convert the input video to one of the specified pixel formats.
  4889. Libavfilter will try to pick one that is suitable as input to
  4890. the next filter.
  4891. It accepts the following parameters:
  4892. @table @option
  4893. @item pix_fmts
  4894. A '|'-separated list of pixel format names, such as
  4895. "pix_fmts=yuv420p|monow|rgb24".
  4896. @end table
  4897. @subsection Examples
  4898. @itemize
  4899. @item
  4900. Convert the input video to the @var{yuv420p} format
  4901. @example
  4902. format=pix_fmts=yuv420p
  4903. @end example
  4904. Convert the input video to any of the formats in the list
  4905. @example
  4906. format=pix_fmts=yuv420p|yuv444p|yuv410p
  4907. @end example
  4908. @end itemize
  4909. @anchor{fps}
  4910. @section fps
  4911. Convert the video to specified constant frame rate by duplicating or dropping
  4912. frames as necessary.
  4913. It accepts the following parameters:
  4914. @table @option
  4915. @item fps
  4916. The desired output frame rate. The default is @code{25}.
  4917. @item round
  4918. Rounding method.
  4919. Possible values are:
  4920. @table @option
  4921. @item zero
  4922. zero round towards 0
  4923. @item inf
  4924. round away from 0
  4925. @item down
  4926. round towards -infinity
  4927. @item up
  4928. round towards +infinity
  4929. @item near
  4930. round to nearest
  4931. @end table
  4932. The default is @code{near}.
  4933. @item start_time
  4934. Assume the first PTS should be the given value, in seconds. This allows for
  4935. padding/trimming at the start of stream. By default, no assumption is made
  4936. about the first frame's expected PTS, so no padding or trimming is done.
  4937. For example, this could be set to 0 to pad the beginning with duplicates of
  4938. the first frame if a video stream starts after the audio stream or to trim any
  4939. frames with a negative PTS.
  4940. @end table
  4941. Alternatively, the options can be specified as a flat string:
  4942. @var{fps}[:@var{round}].
  4943. See also the @ref{setpts} filter.
  4944. @subsection Examples
  4945. @itemize
  4946. @item
  4947. A typical usage in order to set the fps to 25:
  4948. @example
  4949. fps=fps=25
  4950. @end example
  4951. @item
  4952. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  4953. @example
  4954. fps=fps=film:round=near
  4955. @end example
  4956. @end itemize
  4957. @section framepack
  4958. Pack two different video streams into a stereoscopic video, setting proper
  4959. metadata on supported codecs. The two views should have the same size and
  4960. framerate and processing will stop when the shorter video ends. Please note
  4961. that you may conveniently adjust view properties with the @ref{scale} and
  4962. @ref{fps} filters.
  4963. It accepts the following parameters:
  4964. @table @option
  4965. @item format
  4966. The desired packing format. Supported values are:
  4967. @table @option
  4968. @item sbs
  4969. The views are next to each other (default).
  4970. @item tab
  4971. The views are on top of each other.
  4972. @item lines
  4973. The views are packed by line.
  4974. @item columns
  4975. The views are packed by column.
  4976. @item frameseq
  4977. The views are temporally interleaved.
  4978. @end table
  4979. @end table
  4980. Some examples:
  4981. @example
  4982. # Convert left and right views into a frame-sequential video
  4983. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  4984. # Convert views into a side-by-side video with the same output resolution as the input
  4985. 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
  4986. @end example
  4987. @section framerate
  4988. Change the frame rate by interpolating new video output frames from the source
  4989. frames.
  4990. This filter is not designed to function correctly with interlaced media. If
  4991. you wish to change the frame rate of interlaced media then you are required
  4992. to deinterlace before this filter and re-interlace after this filter.
  4993. A description of the accepted options follows.
  4994. @table @option
  4995. @item fps
  4996. Specify the output frames per second. This option can also be specified
  4997. as a value alone. The default is @code{50}.
  4998. @item interp_start
  4999. Specify the start of a range where the output frame will be created as a
  5000. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5001. the default is @code{15}.
  5002. @item interp_end
  5003. Specify the end of a range where the output frame will be created as a
  5004. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5005. the default is @code{240}.
  5006. @item scene
  5007. Specify the level at which a scene change is detected as a value between
  5008. 0 and 100 to indicate a new scene; a low value reflects a low
  5009. probability for the current frame to introduce a new scene, while a higher
  5010. value means the current frame is more likely to be one.
  5011. The default is @code{7}.
  5012. @item flags
  5013. Specify flags influencing the filter process.
  5014. Available value for @var{flags} is:
  5015. @table @option
  5016. @item scene_change_detect, scd
  5017. Enable scene change detection using the value of the option @var{scene}.
  5018. This flag is enabled by default.
  5019. @end table
  5020. @end table
  5021. @section framestep
  5022. Select one frame every N-th frame.
  5023. This filter accepts the following option:
  5024. @table @option
  5025. @item step
  5026. Select frame after every @code{step} frames.
  5027. Allowed values are positive integers higher than 0. Default value is @code{1}.
  5028. @end table
  5029. @anchor{frei0r}
  5030. @section frei0r
  5031. Apply a frei0r effect to the input video.
  5032. To enable the compilation of this filter, you need to install the frei0r
  5033. header and configure FFmpeg with @code{--enable-frei0r}.
  5034. It accepts the following parameters:
  5035. @table @option
  5036. @item filter_name
  5037. The name of the frei0r effect to load. If the environment variable
  5038. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  5039. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  5040. Otherwise, the standard frei0r paths are searched, in this order:
  5041. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  5042. @file{/usr/lib/frei0r-1/}.
  5043. @item filter_params
  5044. A '|'-separated list of parameters to pass to the frei0r effect.
  5045. @end table
  5046. A frei0r effect parameter can be a boolean (its value is either
  5047. "y" or "n"), a double, a color (specified as
  5048. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  5049. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  5050. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  5051. @var{X} and @var{Y} are floating point numbers) and/or a string.
  5052. The number and types of parameters depend on the loaded effect. If an
  5053. effect parameter is not specified, the default value is set.
  5054. @subsection Examples
  5055. @itemize
  5056. @item
  5057. Apply the distort0r effect, setting the first two double parameters:
  5058. @example
  5059. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  5060. @end example
  5061. @item
  5062. Apply the colordistance effect, taking a color as the first parameter:
  5063. @example
  5064. frei0r=colordistance:0.2/0.3/0.4
  5065. frei0r=colordistance:violet
  5066. frei0r=colordistance:0x112233
  5067. @end example
  5068. @item
  5069. Apply the perspective effect, specifying the top left and top right image
  5070. positions:
  5071. @example
  5072. frei0r=perspective:0.2/0.2|0.8/0.2
  5073. @end example
  5074. @end itemize
  5075. For more information, see
  5076. @url{http://frei0r.dyne.org}
  5077. @section fspp
  5078. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  5079. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  5080. processing filter, one of them is performed once per block, not per pixel.
  5081. This allows for much higher speed.
  5082. The filter accepts the following options:
  5083. @table @option
  5084. @item quality
  5085. Set quality. This option defines the number of levels for averaging. It accepts
  5086. an integer in the range 4-5. Default value is @code{4}.
  5087. @item qp
  5088. Force a constant quantization parameter. It accepts an integer in range 0-63.
  5089. If not set, the filter will use the QP from the video stream (if available).
  5090. @item strength
  5091. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  5092. more details but also more artifacts, while higher values make the image smoother
  5093. but also blurrier. Default value is @code{0} − PSNR optimal.
  5094. @item use_bframe_qp
  5095. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5096. option may cause flicker since the B-Frames have often larger QP. Default is
  5097. @code{0} (not enabled).
  5098. @end table
  5099. @section geq
  5100. The filter accepts the following options:
  5101. @table @option
  5102. @item lum_expr, lum
  5103. Set the luminance expression.
  5104. @item cb_expr, cb
  5105. Set the chrominance blue expression.
  5106. @item cr_expr, cr
  5107. Set the chrominance red expression.
  5108. @item alpha_expr, a
  5109. Set the alpha expression.
  5110. @item red_expr, r
  5111. Set the red expression.
  5112. @item green_expr, g
  5113. Set the green expression.
  5114. @item blue_expr, b
  5115. Set the blue expression.
  5116. @end table
  5117. The colorspace is selected according to the specified options. If one
  5118. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  5119. options is specified, the filter will automatically select a YCbCr
  5120. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  5121. @option{blue_expr} options is specified, it will select an RGB
  5122. colorspace.
  5123. If one of the chrominance expression is not defined, it falls back on the other
  5124. one. If no alpha expression is specified it will evaluate to opaque value.
  5125. If none of chrominance expressions are specified, they will evaluate
  5126. to the luminance expression.
  5127. The expressions can use the following variables and functions:
  5128. @table @option
  5129. @item N
  5130. The sequential number of the filtered frame, starting from @code{0}.
  5131. @item X
  5132. @item Y
  5133. The coordinates of the current sample.
  5134. @item W
  5135. @item H
  5136. The width and height of the image.
  5137. @item SW
  5138. @item SH
  5139. Width and height scale depending on the currently filtered plane. It is the
  5140. ratio between the corresponding luma plane number of pixels and the current
  5141. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  5142. @code{0.5,0.5} for chroma planes.
  5143. @item T
  5144. Time of the current frame, expressed in seconds.
  5145. @item p(x, y)
  5146. Return the value of the pixel at location (@var{x},@var{y}) of the current
  5147. plane.
  5148. @item lum(x, y)
  5149. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  5150. plane.
  5151. @item cb(x, y)
  5152. Return the value of the pixel at location (@var{x},@var{y}) of the
  5153. blue-difference chroma plane. Return 0 if there is no such plane.
  5154. @item cr(x, y)
  5155. Return the value of the pixel at location (@var{x},@var{y}) of the
  5156. red-difference chroma plane. Return 0 if there is no such plane.
  5157. @item r(x, y)
  5158. @item g(x, y)
  5159. @item b(x, y)
  5160. Return the value of the pixel at location (@var{x},@var{y}) of the
  5161. red/green/blue component. Return 0 if there is no such component.
  5162. @item alpha(x, y)
  5163. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  5164. plane. Return 0 if there is no such plane.
  5165. @end table
  5166. For functions, if @var{x} and @var{y} are outside the area, the value will be
  5167. automatically clipped to the closer edge.
  5168. @subsection Examples
  5169. @itemize
  5170. @item
  5171. Flip the image horizontally:
  5172. @example
  5173. geq=p(W-X\,Y)
  5174. @end example
  5175. @item
  5176. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  5177. wavelength of 100 pixels:
  5178. @example
  5179. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  5180. @end example
  5181. @item
  5182. Generate a fancy enigmatic moving light:
  5183. @example
  5184. 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
  5185. @end example
  5186. @item
  5187. Generate a quick emboss effect:
  5188. @example
  5189. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  5190. @end example
  5191. @item
  5192. Modify RGB components depending on pixel position:
  5193. @example
  5194. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  5195. @end example
  5196. @item
  5197. Create a radial gradient that is the same size as the input (also see
  5198. the @ref{vignette} filter):
  5199. @example
  5200. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  5201. @end example
  5202. @item
  5203. Create a linear gradient to use as a mask for another filter, then
  5204. compose with @ref{overlay}. In this example the video will gradually
  5205. become more blurry from the top to the bottom of the y-axis as defined
  5206. by the linear gradient:
  5207. @example
  5208. 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
  5209. @end example
  5210. @end itemize
  5211. @section gradfun
  5212. Fix the banding artifacts that are sometimes introduced into nearly flat
  5213. regions by truncation to 8bit color depth.
  5214. Interpolate the gradients that should go where the bands are, and
  5215. dither them.
  5216. It is designed for playback only. Do not use it prior to
  5217. lossy compression, because compression tends to lose the dither and
  5218. bring back the bands.
  5219. It accepts the following parameters:
  5220. @table @option
  5221. @item strength
  5222. The maximum amount by which the filter will change any one pixel. This is also
  5223. the threshold for detecting nearly flat regions. Acceptable values range from
  5224. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  5225. valid range.
  5226. @item radius
  5227. The neighborhood to fit the gradient to. A larger radius makes for smoother
  5228. gradients, but also prevents the filter from modifying the pixels near detailed
  5229. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  5230. values will be clipped to the valid range.
  5231. @end table
  5232. Alternatively, the options can be specified as a flat string:
  5233. @var{strength}[:@var{radius}]
  5234. @subsection Examples
  5235. @itemize
  5236. @item
  5237. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  5238. @example
  5239. gradfun=3.5:8
  5240. @end example
  5241. @item
  5242. Specify radius, omitting the strength (which will fall-back to the default
  5243. value):
  5244. @example
  5245. gradfun=radius=8
  5246. @end example
  5247. @end itemize
  5248. @anchor{haldclut}
  5249. @section haldclut
  5250. Apply a Hald CLUT to a video stream.
  5251. First input is the video stream to process, and second one is the Hald CLUT.
  5252. The Hald CLUT input can be a simple picture or a complete video stream.
  5253. The filter accepts the following options:
  5254. @table @option
  5255. @item shortest
  5256. Force termination when the shortest input terminates. Default is @code{0}.
  5257. @item repeatlast
  5258. Continue applying the last CLUT after the end of the stream. A value of
  5259. @code{0} disable the filter after the last frame of the CLUT is reached.
  5260. Default is @code{1}.
  5261. @end table
  5262. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  5263. filters share the same internals).
  5264. More information about the Hald CLUT can be found on Eskil Steenberg's website
  5265. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  5266. @subsection Workflow examples
  5267. @subsubsection Hald CLUT video stream
  5268. Generate an identity Hald CLUT stream altered with various effects:
  5269. @example
  5270. 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
  5271. @end example
  5272. Note: make sure you use a lossless codec.
  5273. Then use it with @code{haldclut} to apply it on some random stream:
  5274. @example
  5275. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  5276. @end example
  5277. The Hald CLUT will be applied to the 10 first seconds (duration of
  5278. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  5279. to the remaining frames of the @code{mandelbrot} stream.
  5280. @subsubsection Hald CLUT with preview
  5281. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  5282. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  5283. biggest possible square starting at the top left of the picture. The remaining
  5284. padding pixels (bottom or right) will be ignored. This area can be used to add
  5285. a preview of the Hald CLUT.
  5286. Typically, the following generated Hald CLUT will be supported by the
  5287. @code{haldclut} filter:
  5288. @example
  5289. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  5290. pad=iw+320 [padded_clut];
  5291. smptebars=s=320x256, split [a][b];
  5292. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  5293. [main][b] overlay=W-320" -frames:v 1 clut.png
  5294. @end example
  5295. It contains the original and a preview of the effect of the CLUT: SMPTE color
  5296. bars are displayed on the right-top, and below the same color bars processed by
  5297. the color changes.
  5298. Then, the effect of this Hald CLUT can be visualized with:
  5299. @example
  5300. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  5301. @end example
  5302. @section hflip
  5303. Flip the input video horizontally.
  5304. For example, to horizontally flip the input video with @command{ffmpeg}:
  5305. @example
  5306. ffmpeg -i in.avi -vf "hflip" out.avi
  5307. @end example
  5308. @section histeq
  5309. This filter applies a global color histogram equalization on a
  5310. per-frame basis.
  5311. It can be used to correct video that has a compressed range of pixel
  5312. intensities. The filter redistributes the pixel intensities to
  5313. equalize their distribution across the intensity range. It may be
  5314. viewed as an "automatically adjusting contrast filter". This filter is
  5315. useful only for correcting degraded or poorly captured source
  5316. video.
  5317. The filter accepts the following options:
  5318. @table @option
  5319. @item strength
  5320. Determine the amount of equalization to be applied. As the strength
  5321. is reduced, the distribution of pixel intensities more-and-more
  5322. approaches that of the input frame. The value must be a float number
  5323. in the range [0,1] and defaults to 0.200.
  5324. @item intensity
  5325. Set the maximum intensity that can generated and scale the output
  5326. values appropriately. The strength should be set as desired and then
  5327. the intensity can be limited if needed to avoid washing-out. The value
  5328. must be a float number in the range [0,1] and defaults to 0.210.
  5329. @item antibanding
  5330. Set the antibanding level. If enabled the filter will randomly vary
  5331. the luminance of output pixels by a small amount to avoid banding of
  5332. the histogram. Possible values are @code{none}, @code{weak} or
  5333. @code{strong}. It defaults to @code{none}.
  5334. @end table
  5335. @section histogram
  5336. Compute and draw a color distribution histogram for the input video.
  5337. The computed histogram is a representation of the color component
  5338. distribution in an image.
  5339. The filter accepts the following options:
  5340. @table @option
  5341. @item mode
  5342. Set histogram mode.
  5343. It accepts the following values:
  5344. @table @samp
  5345. @item levels
  5346. Standard histogram that displays the color components distribution in an
  5347. image. Displays color graph for each color component. Shows distribution of
  5348. the Y, U, V, A or R, G, B components, depending on input format, in the
  5349. current frame. Below each graph a color component scale meter is shown.
  5350. @item color
  5351. Displays chroma values (U/V color placement) in a two dimensional
  5352. graph (which is called a vectorscope). The brighter a pixel in the
  5353. vectorscope, the more pixels of the input frame correspond to that pixel
  5354. (i.e., more pixels have this chroma value). The V component is displayed on
  5355. the horizontal (X) axis, with the leftmost side being V = 0 and the rightmost
  5356. side being V = 255. The U component is displayed on the vertical (Y) axis,
  5357. with the top representing U = 0 and the bottom representing U = 255.
  5358. The position of a white pixel in the graph corresponds to the chroma value of
  5359. a pixel of the input clip. The graph can therefore be used to read the hue
  5360. (color flavor) and the saturation (the dominance of the hue in the color). As
  5361. the hue of a color changes, it moves around the square. At the center of the
  5362. square the saturation is zero, which means that the corresponding pixel has no
  5363. color. If the amount of a specific color is increased (while leaving the other
  5364. colors unchanged) the saturation increases, and the indicator moves towards
  5365. the edge of the square.
  5366. @item color2
  5367. Chroma values in vectorscope, similar as @code{color} but actual chroma values
  5368. are displayed.
  5369. @item waveform
  5370. Per row/column color component graph. In row mode, the graph on the left side
  5371. represents color component value 0 and the right side represents value = 255.
  5372. In column mode, the top side represents color component value = 0 and bottom
  5373. side represents value = 255.
  5374. @end table
  5375. Default value is @code{levels}.
  5376. @item level_height
  5377. Set height of level in @code{levels}. Default value is @code{200}.
  5378. Allowed range is [50, 2048].
  5379. @item scale_height
  5380. Set height of color scale in @code{levels}. Default value is @code{12}.
  5381. Allowed range is [0, 40].
  5382. @item step
  5383. Set step for @code{waveform} mode. Smaller values are useful to find out how
  5384. many values of the same luminance are distributed across input rows/columns.
  5385. Default value is @code{10}. Allowed range is [1, 255].
  5386. @item waveform_mode
  5387. Set mode for @code{waveform}. Can be either @code{row}, or @code{column}.
  5388. Default is @code{row}.
  5389. @item waveform_mirror
  5390. Set mirroring mode for @code{waveform}. @code{0} means unmirrored, @code{1}
  5391. means mirrored. In mirrored mode, higher values will be represented on the left
  5392. side for @code{row} mode and at the top for @code{column} mode. Default is
  5393. @code{0} (unmirrored).
  5394. @item display_mode
  5395. Set display mode for @code{waveform} and @code{levels}.
  5396. It accepts the following values:
  5397. @table @samp
  5398. @item parade
  5399. Display separate graph for the color components side by side in
  5400. @code{row} waveform mode or one below the other in @code{column} waveform mode
  5401. for @code{waveform} histogram mode. For @code{levels} histogram mode,
  5402. per color component graphs are placed below each other.
  5403. Using this display mode in @code{waveform} histogram mode makes it easy to
  5404. spot color casts in the highlights and shadows of an image, by comparing the
  5405. contours of the top and the bottom graphs of each waveform. Since whites,
  5406. grays, and blacks are characterized by exactly equal amounts of red, green,
  5407. and blue, neutral areas of the picture should display three waveforms of
  5408. roughly equal width/height. If not, the correction is easy to perform by
  5409. making level adjustments the three waveforms.
  5410. @item overlay
  5411. Presents information identical to that in the @code{parade}, except
  5412. that the graphs representing color components are superimposed directly
  5413. over one another.
  5414. This display mode in @code{waveform} histogram mode makes it easier to spot
  5415. relative differences or similarities in overlapping areas of the color
  5416. components that are supposed to be identical, such as neutral whites, grays,
  5417. or blacks.
  5418. @end table
  5419. Default is @code{parade}.
  5420. @item levels_mode
  5421. Set mode for @code{levels}. Can be either @code{linear}, or @code{logarithmic}.
  5422. Default is @code{linear}.
  5423. @item components
  5424. Set what color components to display for mode @code{levels}.
  5425. Default is @code{7}.
  5426. @end table
  5427. @subsection Examples
  5428. @itemize
  5429. @item
  5430. Calculate and draw histogram:
  5431. @example
  5432. ffplay -i input -vf histogram
  5433. @end example
  5434. @end itemize
  5435. @anchor{hqdn3d}
  5436. @section hqdn3d
  5437. This is a high precision/quality 3d denoise filter. It aims to reduce
  5438. image noise, producing smooth images and making still images really
  5439. still. It should enhance compressibility.
  5440. It accepts the following optional parameters:
  5441. @table @option
  5442. @item luma_spatial
  5443. A non-negative floating point number which specifies spatial luma strength.
  5444. It defaults to 4.0.
  5445. @item chroma_spatial
  5446. A non-negative floating point number which specifies spatial chroma strength.
  5447. It defaults to 3.0*@var{luma_spatial}/4.0.
  5448. @item luma_tmp
  5449. A floating point number which specifies luma temporal strength. It defaults to
  5450. 6.0*@var{luma_spatial}/4.0.
  5451. @item chroma_tmp
  5452. A floating point number which specifies chroma temporal strength. It defaults to
  5453. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  5454. @end table
  5455. @section hqx
  5456. Apply a high-quality magnification filter designed for pixel art. This filter
  5457. was originally created by Maxim Stepin.
  5458. It accepts the following option:
  5459. @table @option
  5460. @item n
  5461. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  5462. @code{hq3x} and @code{4} for @code{hq4x}.
  5463. Default is @code{3}.
  5464. @end table
  5465. @section hstack
  5466. Stack input videos horizontally.
  5467. All streams must be of same pixel format and of same height.
  5468. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  5469. to create same output.
  5470. The filter accept the following option:
  5471. @table @option
  5472. @item nb_inputs
  5473. Set number of input streams. Default is 2.
  5474. @end table
  5475. @section hue
  5476. Modify the hue and/or the saturation of the input.
  5477. It accepts the following parameters:
  5478. @table @option
  5479. @item h
  5480. Specify the hue angle as a number of degrees. It accepts an expression,
  5481. and defaults to "0".
  5482. @item s
  5483. Specify the saturation in the [-10,10] range. It accepts an expression and
  5484. defaults to "1".
  5485. @item H
  5486. Specify the hue angle as a number of radians. It accepts an
  5487. expression, and defaults to "0".
  5488. @item b
  5489. Specify the brightness in the [-10,10] range. It accepts an expression and
  5490. defaults to "0".
  5491. @end table
  5492. @option{h} and @option{H} are mutually exclusive, and can't be
  5493. specified at the same time.
  5494. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  5495. expressions containing the following constants:
  5496. @table @option
  5497. @item n
  5498. frame count of the input frame starting from 0
  5499. @item pts
  5500. presentation timestamp of the input frame expressed in time base units
  5501. @item r
  5502. frame rate of the input video, NAN if the input frame rate is unknown
  5503. @item t
  5504. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5505. @item tb
  5506. time base of the input video
  5507. @end table
  5508. @subsection Examples
  5509. @itemize
  5510. @item
  5511. Set the hue to 90 degrees and the saturation to 1.0:
  5512. @example
  5513. hue=h=90:s=1
  5514. @end example
  5515. @item
  5516. Same command but expressing the hue in radians:
  5517. @example
  5518. hue=H=PI/2:s=1
  5519. @end example
  5520. @item
  5521. Rotate hue and make the saturation swing between 0
  5522. and 2 over a period of 1 second:
  5523. @example
  5524. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  5525. @end example
  5526. @item
  5527. Apply a 3 seconds saturation fade-in effect starting at 0:
  5528. @example
  5529. hue="s=min(t/3\,1)"
  5530. @end example
  5531. The general fade-in expression can be written as:
  5532. @example
  5533. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  5534. @end example
  5535. @item
  5536. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  5537. @example
  5538. hue="s=max(0\, min(1\, (8-t)/3))"
  5539. @end example
  5540. The general fade-out expression can be written as:
  5541. @example
  5542. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  5543. @end example
  5544. @end itemize
  5545. @subsection Commands
  5546. This filter supports the following commands:
  5547. @table @option
  5548. @item b
  5549. @item s
  5550. @item h
  5551. @item H
  5552. Modify the hue and/or the saturation and/or brightness of the input video.
  5553. The command accepts the same syntax of the corresponding option.
  5554. If the specified expression is not valid, it is kept at its current
  5555. value.
  5556. @end table
  5557. @section idet
  5558. Detect video interlacing type.
  5559. This filter tries to detect if the input frames as interlaced, progressive,
  5560. top or bottom field first. It will also try and detect fields that are
  5561. repeated between adjacent frames (a sign of telecine).
  5562. Single frame detection considers only immediately adjacent frames when classifying each frame.
  5563. Multiple frame detection incorporates the classification history of previous frames.
  5564. The filter will log these metadata values:
  5565. @table @option
  5566. @item single.current_frame
  5567. Detected type of current frame using single-frame detection. One of:
  5568. ``tff'' (top field first), ``bff'' (bottom field first),
  5569. ``progressive'', or ``undetermined''
  5570. @item single.tff
  5571. Cumulative number of frames detected as top field first using single-frame detection.
  5572. @item multiple.tff
  5573. Cumulative number of frames detected as top field first using multiple-frame detection.
  5574. @item single.bff
  5575. Cumulative number of frames detected as bottom field first using single-frame detection.
  5576. @item multiple.current_frame
  5577. Detected type of current frame using multiple-frame detection. One of:
  5578. ``tff'' (top field first), ``bff'' (bottom field first),
  5579. ``progressive'', or ``undetermined''
  5580. @item multiple.bff
  5581. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  5582. @item single.progressive
  5583. Cumulative number of frames detected as progressive using single-frame detection.
  5584. @item multiple.progressive
  5585. Cumulative number of frames detected as progressive using multiple-frame detection.
  5586. @item single.undetermined
  5587. Cumulative number of frames that could not be classified using single-frame detection.
  5588. @item multiple.undetermined
  5589. Cumulative number of frames that could not be classified using multiple-frame detection.
  5590. @item repeated.current_frame
  5591. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  5592. @item repeated.neither
  5593. Cumulative number of frames with no repeated field.
  5594. @item repeated.top
  5595. Cumulative number of frames with the top field repeated from the previous frame's top field.
  5596. @item repeated.bottom
  5597. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  5598. @end table
  5599. The filter accepts the following options:
  5600. @table @option
  5601. @item intl_thres
  5602. Set interlacing threshold.
  5603. @item prog_thres
  5604. Set progressive threshold.
  5605. @item repeat_thres
  5606. Threshold for repeated field detection.
  5607. @item half_life
  5608. Number of frames after which a given frame's contribution to the
  5609. statistics is halved (i.e., it contributes only 0.5 to it's
  5610. classification). The default of 0 means that all frames seen are given
  5611. full weight of 1.0 forever.
  5612. @item analyze_interlaced_flag
  5613. When this is not 0 then idet will use the specified number of frames to determine
  5614. if the interlaced flag is accurate, it will not count undetermined frames.
  5615. If the flag is found to be accurate it will be used without any further
  5616. computations, if it is found to be inaccurate it will be cleared without any
  5617. further computations. This allows inserting the idet filter as a low computational
  5618. method to clean up the interlaced flag
  5619. @end table
  5620. @section il
  5621. Deinterleave or interleave fields.
  5622. This filter allows one to process interlaced images fields without
  5623. deinterlacing them. Deinterleaving splits the input frame into 2
  5624. fields (so called half pictures). Odd lines are moved to the top
  5625. half of the output image, even lines to the bottom half.
  5626. You can process (filter) them independently and then re-interleave them.
  5627. The filter accepts the following options:
  5628. @table @option
  5629. @item luma_mode, l
  5630. @item chroma_mode, c
  5631. @item alpha_mode, a
  5632. Available values for @var{luma_mode}, @var{chroma_mode} and
  5633. @var{alpha_mode} are:
  5634. @table @samp
  5635. @item none
  5636. Do nothing.
  5637. @item deinterleave, d
  5638. Deinterleave fields, placing one above the other.
  5639. @item interleave, i
  5640. Interleave fields. Reverse the effect of deinterleaving.
  5641. @end table
  5642. Default value is @code{none}.
  5643. @item luma_swap, ls
  5644. @item chroma_swap, cs
  5645. @item alpha_swap, as
  5646. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  5647. @end table
  5648. @section inflate
  5649. Apply inflate effect to the video.
  5650. This filter replaces the pixel by the local(3x3) average by taking into account
  5651. only values higher than the pixel.
  5652. It accepts the following options:
  5653. @table @option
  5654. @item threshold0
  5655. @item threshold1
  5656. @item threshold2
  5657. @item threshold3
  5658. Allows to limit the maximum change for each plane, default is 65535.
  5659. If 0, plane will remain unchanged.
  5660. @end table
  5661. @section interlace
  5662. Simple interlacing filter from progressive contents. This interleaves upper (or
  5663. lower) lines from odd frames with lower (or upper) lines from even frames,
  5664. halving the frame rate and preserving image height.
  5665. @example
  5666. Original Original New Frame
  5667. Frame 'j' Frame 'j+1' (tff)
  5668. ========== =========== ==================
  5669. Line 0 --------------------> Frame 'j' Line 0
  5670. Line 1 Line 1 ----> Frame 'j+1' Line 1
  5671. Line 2 ---------------------> Frame 'j' Line 2
  5672. Line 3 Line 3 ----> Frame 'j+1' Line 3
  5673. ... ... ...
  5674. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  5675. @end example
  5676. It accepts the following optional parameters:
  5677. @table @option
  5678. @item scan
  5679. This determines whether the interlaced frame is taken from the even
  5680. (tff - default) or odd (bff) lines of the progressive frame.
  5681. @item lowpass
  5682. Enable (default) or disable the vertical lowpass filter to avoid twitter
  5683. interlacing and reduce moire patterns.
  5684. @end table
  5685. @section kerndeint
  5686. Deinterlace input video by applying Donald Graft's adaptive kernel
  5687. deinterling. Work on interlaced parts of a video to produce
  5688. progressive frames.
  5689. The description of the accepted parameters follows.
  5690. @table @option
  5691. @item thresh
  5692. Set the threshold which affects the filter's tolerance when
  5693. determining if a pixel line must be processed. It must be an integer
  5694. in the range [0,255] and defaults to 10. A value of 0 will result in
  5695. applying the process on every pixels.
  5696. @item map
  5697. Paint pixels exceeding the threshold value to white if set to 1.
  5698. Default is 0.
  5699. @item order
  5700. Set the fields order. Swap fields if set to 1, leave fields alone if
  5701. 0. Default is 0.
  5702. @item sharp
  5703. Enable additional sharpening if set to 1. Default is 0.
  5704. @item twoway
  5705. Enable twoway sharpening if set to 1. Default is 0.
  5706. @end table
  5707. @subsection Examples
  5708. @itemize
  5709. @item
  5710. Apply default values:
  5711. @example
  5712. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  5713. @end example
  5714. @item
  5715. Enable additional sharpening:
  5716. @example
  5717. kerndeint=sharp=1
  5718. @end example
  5719. @item
  5720. Paint processed pixels in white:
  5721. @example
  5722. kerndeint=map=1
  5723. @end example
  5724. @end itemize
  5725. @section lenscorrection
  5726. Correct radial lens distortion
  5727. This filter can be used to correct for radial distortion as can result from the use
  5728. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  5729. one can use tools available for example as part of opencv or simply trial-and-error.
  5730. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  5731. and extract the k1 and k2 coefficients from the resulting matrix.
  5732. Note that effectively the same filter is available in the open-source tools Krita and
  5733. Digikam from the KDE project.
  5734. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  5735. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  5736. brightness distribution, so you may want to use both filters together in certain
  5737. cases, though you will have to take care of ordering, i.e. whether vignetting should
  5738. be applied before or after lens correction.
  5739. @subsection Options
  5740. The filter accepts the following options:
  5741. @table @option
  5742. @item cx
  5743. Relative x-coordinate of the focal point of the image, and thereby the center of the
  5744. distortion. This value has a range [0,1] and is expressed as fractions of the image
  5745. width.
  5746. @item cy
  5747. Relative y-coordinate of the focal point of the image, and thereby the center of the
  5748. distortion. This value has a range [0,1] and is expressed as fractions of the image
  5749. height.
  5750. @item k1
  5751. Coefficient of the quadratic correction term. 0.5 means no correction.
  5752. @item k2
  5753. Coefficient of the double quadratic correction term. 0.5 means no correction.
  5754. @end table
  5755. The formula that generates the correction is:
  5756. @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)
  5757. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  5758. distances from the focal point in the source and target images, respectively.
  5759. @anchor{lut3d}
  5760. @section lut3d
  5761. Apply a 3D LUT to an input video.
  5762. The filter accepts the following options:
  5763. @table @option
  5764. @item file
  5765. Set the 3D LUT file name.
  5766. Currently supported formats:
  5767. @table @samp
  5768. @item 3dl
  5769. AfterEffects
  5770. @item cube
  5771. Iridas
  5772. @item dat
  5773. DaVinci
  5774. @item m3d
  5775. Pandora
  5776. @end table
  5777. @item interp
  5778. Select interpolation mode.
  5779. Available values are:
  5780. @table @samp
  5781. @item nearest
  5782. Use values from the nearest defined point.
  5783. @item trilinear
  5784. Interpolate values using the 8 points defining a cube.
  5785. @item tetrahedral
  5786. Interpolate values using a tetrahedron.
  5787. @end table
  5788. @end table
  5789. @section lut, lutrgb, lutyuv
  5790. Compute a look-up table for binding each pixel component input value
  5791. to an output value, and apply it to the input video.
  5792. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  5793. to an RGB input video.
  5794. These filters accept the following parameters:
  5795. @table @option
  5796. @item c0
  5797. set first pixel component expression
  5798. @item c1
  5799. set second pixel component expression
  5800. @item c2
  5801. set third pixel component expression
  5802. @item c3
  5803. set fourth pixel component expression, corresponds to the alpha component
  5804. @item r
  5805. set red component expression
  5806. @item g
  5807. set green component expression
  5808. @item b
  5809. set blue component expression
  5810. @item a
  5811. alpha component expression
  5812. @item y
  5813. set Y/luminance component expression
  5814. @item u
  5815. set U/Cb component expression
  5816. @item v
  5817. set V/Cr component expression
  5818. @end table
  5819. Each of them specifies the expression to use for computing the lookup table for
  5820. the corresponding pixel component values.
  5821. The exact component associated to each of the @var{c*} options depends on the
  5822. format in input.
  5823. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  5824. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  5825. The expressions can contain the following constants and functions:
  5826. @table @option
  5827. @item w
  5828. @item h
  5829. The input width and height.
  5830. @item val
  5831. The input value for the pixel component.
  5832. @item clipval
  5833. The input value, clipped to the @var{minval}-@var{maxval} range.
  5834. @item maxval
  5835. The maximum value for the pixel component.
  5836. @item minval
  5837. The minimum value for the pixel component.
  5838. @item negval
  5839. The negated value for the pixel component value, clipped to the
  5840. @var{minval}-@var{maxval} range; it corresponds to the expression
  5841. "maxval-clipval+minval".
  5842. @item clip(val)
  5843. The computed value in @var{val}, clipped to the
  5844. @var{minval}-@var{maxval} range.
  5845. @item gammaval(gamma)
  5846. The computed gamma correction value of the pixel component value,
  5847. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  5848. expression
  5849. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  5850. @end table
  5851. All expressions default to "val".
  5852. @subsection Examples
  5853. @itemize
  5854. @item
  5855. Negate input video:
  5856. @example
  5857. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  5858. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  5859. @end example
  5860. The above is the same as:
  5861. @example
  5862. lutrgb="r=negval:g=negval:b=negval"
  5863. lutyuv="y=negval:u=negval:v=negval"
  5864. @end example
  5865. @item
  5866. Negate luminance:
  5867. @example
  5868. lutyuv=y=negval
  5869. @end example
  5870. @item
  5871. Remove chroma components, turning the video into a graytone image:
  5872. @example
  5873. lutyuv="u=128:v=128"
  5874. @end example
  5875. @item
  5876. Apply a luma burning effect:
  5877. @example
  5878. lutyuv="y=2*val"
  5879. @end example
  5880. @item
  5881. Remove green and blue components:
  5882. @example
  5883. lutrgb="g=0:b=0"
  5884. @end example
  5885. @item
  5886. Set a constant alpha channel value on input:
  5887. @example
  5888. format=rgba,lutrgb=a="maxval-minval/2"
  5889. @end example
  5890. @item
  5891. Correct luminance gamma by a factor of 0.5:
  5892. @example
  5893. lutyuv=y=gammaval(0.5)
  5894. @end example
  5895. @item
  5896. Discard least significant bits of luma:
  5897. @example
  5898. lutyuv=y='bitand(val, 128+64+32)'
  5899. @end example
  5900. @end itemize
  5901. @section maskedmerge
  5902. Merge the first input stream with the second input stream using per pixel
  5903. weights in the third input stream.
  5904. A value of 0 in the third stream pixel component means that pixel component
  5905. from first stream is returned unchanged, while maximum value (eg. 255 for
  5906. 8-bit videos) means that pixel component from second stream is returned
  5907. unchanged. Intermediate values define the amount of merging between both
  5908. input stream's pixel components.
  5909. This filter accepts the following options:
  5910. @table @option
  5911. @item planes
  5912. Set which planes will be processed as bitmap, unprocessed planes will be
  5913. copied from first stream.
  5914. By default value 0xf, all planes will be processed.
  5915. @end table
  5916. @section mcdeint
  5917. Apply motion-compensation deinterlacing.
  5918. It needs one field per frame as input and must thus be used together
  5919. with yadif=1/3 or equivalent.
  5920. This filter accepts the following options:
  5921. @table @option
  5922. @item mode
  5923. Set the deinterlacing mode.
  5924. It accepts one of the following values:
  5925. @table @samp
  5926. @item fast
  5927. @item medium
  5928. @item slow
  5929. use iterative motion estimation
  5930. @item extra_slow
  5931. like @samp{slow}, but use multiple reference frames.
  5932. @end table
  5933. Default value is @samp{fast}.
  5934. @item parity
  5935. Set the picture field parity assumed for the input video. It must be
  5936. one of the following values:
  5937. @table @samp
  5938. @item 0, tff
  5939. assume top field first
  5940. @item 1, bff
  5941. assume bottom field first
  5942. @end table
  5943. Default value is @samp{bff}.
  5944. @item qp
  5945. Set per-block quantization parameter (QP) used by the internal
  5946. encoder.
  5947. Higher values should result in a smoother motion vector field but less
  5948. optimal individual vectors. Default value is 1.
  5949. @end table
  5950. @section mergeplanes
  5951. Merge color channel components from several video streams.
  5952. The filter accepts up to 4 input streams, and merge selected input
  5953. planes to the output video.
  5954. This filter accepts the following options:
  5955. @table @option
  5956. @item mapping
  5957. Set input to output plane mapping. Default is @code{0}.
  5958. The mappings is specified as a bitmap. It should be specified as a
  5959. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  5960. mapping for the first plane of the output stream. 'A' sets the number of
  5961. the input stream to use (from 0 to 3), and 'a' the plane number of the
  5962. corresponding input to use (from 0 to 3). The rest of the mappings is
  5963. similar, 'Bb' describes the mapping for the output stream second
  5964. plane, 'Cc' describes the mapping for the output stream third plane and
  5965. 'Dd' describes the mapping for the output stream fourth plane.
  5966. @item format
  5967. Set output pixel format. Default is @code{yuva444p}.
  5968. @end table
  5969. @subsection Examples
  5970. @itemize
  5971. @item
  5972. Merge three gray video streams of same width and height into single video stream:
  5973. @example
  5974. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  5975. @end example
  5976. @item
  5977. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  5978. @example
  5979. [a0][a1]mergeplanes=0x00010210:yuva444p
  5980. @end example
  5981. @item
  5982. Swap Y and A plane in yuva444p stream:
  5983. @example
  5984. format=yuva444p,mergeplanes=0x03010200:yuva444p
  5985. @end example
  5986. @item
  5987. Swap U and V plane in yuv420p stream:
  5988. @example
  5989. format=yuv420p,mergeplanes=0x000201:yuv420p
  5990. @end example
  5991. @item
  5992. Cast a rgb24 clip to yuv444p:
  5993. @example
  5994. format=rgb24,mergeplanes=0x000102:yuv444p
  5995. @end example
  5996. @end itemize
  5997. @section mpdecimate
  5998. Drop frames that do not differ greatly from the previous frame in
  5999. order to reduce frame rate.
  6000. The main use of this filter is for very-low-bitrate encoding
  6001. (e.g. streaming over dialup modem), but it could in theory be used for
  6002. fixing movies that were inverse-telecined incorrectly.
  6003. A description of the accepted options follows.
  6004. @table @option
  6005. @item max
  6006. Set the maximum number of consecutive frames which can be dropped (if
  6007. positive), or the minimum interval between dropped frames (if
  6008. negative). If the value is 0, the frame is dropped unregarding the
  6009. number of previous sequentially dropped frames.
  6010. Default value is 0.
  6011. @item hi
  6012. @item lo
  6013. @item frac
  6014. Set the dropping threshold values.
  6015. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  6016. represent actual pixel value differences, so a threshold of 64
  6017. corresponds to 1 unit of difference for each pixel, or the same spread
  6018. out differently over the block.
  6019. A frame is a candidate for dropping if no 8x8 blocks differ by more
  6020. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  6021. meaning the whole image) differ by more than a threshold of @option{lo}.
  6022. Default value for @option{hi} is 64*12, default value for @option{lo} is
  6023. 64*5, and default value for @option{frac} is 0.33.
  6024. @end table
  6025. @section negate
  6026. Negate input video.
  6027. It accepts an integer in input; if non-zero it negates the
  6028. alpha component (if available). The default value in input is 0.
  6029. @section noformat
  6030. Force libavfilter not to use any of the specified pixel formats for the
  6031. input to the next filter.
  6032. It accepts the following parameters:
  6033. @table @option
  6034. @item pix_fmts
  6035. A '|'-separated list of pixel format names, such as
  6036. apix_fmts=yuv420p|monow|rgb24".
  6037. @end table
  6038. @subsection Examples
  6039. @itemize
  6040. @item
  6041. Force libavfilter to use a format different from @var{yuv420p} for the
  6042. input to the vflip filter:
  6043. @example
  6044. noformat=pix_fmts=yuv420p,vflip
  6045. @end example
  6046. @item
  6047. Convert the input video to any of the formats not contained in the list:
  6048. @example
  6049. noformat=yuv420p|yuv444p|yuv410p
  6050. @end example
  6051. @end itemize
  6052. @section noise
  6053. Add noise on video input frame.
  6054. The filter accepts the following options:
  6055. @table @option
  6056. @item all_seed
  6057. @item c0_seed
  6058. @item c1_seed
  6059. @item c2_seed
  6060. @item c3_seed
  6061. Set noise seed for specific pixel component or all pixel components in case
  6062. of @var{all_seed}. Default value is @code{123457}.
  6063. @item all_strength, alls
  6064. @item c0_strength, c0s
  6065. @item c1_strength, c1s
  6066. @item c2_strength, c2s
  6067. @item c3_strength, c3s
  6068. Set noise strength for specific pixel component or all pixel components in case
  6069. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  6070. @item all_flags, allf
  6071. @item c0_flags, c0f
  6072. @item c1_flags, c1f
  6073. @item c2_flags, c2f
  6074. @item c3_flags, c3f
  6075. Set pixel component flags or set flags for all components if @var{all_flags}.
  6076. Available values for component flags are:
  6077. @table @samp
  6078. @item a
  6079. averaged temporal noise (smoother)
  6080. @item p
  6081. mix random noise with a (semi)regular pattern
  6082. @item t
  6083. temporal noise (noise pattern changes between frames)
  6084. @item u
  6085. uniform noise (gaussian otherwise)
  6086. @end table
  6087. @end table
  6088. @subsection Examples
  6089. Add temporal and uniform noise to input video:
  6090. @example
  6091. noise=alls=20:allf=t+u
  6092. @end example
  6093. @section null
  6094. Pass the video source unchanged to the output.
  6095. @section ocr
  6096. Optical Character Recognition
  6097. This filter uses Tesseract for optical character recognition.
  6098. It accepts the following options:
  6099. @table @option
  6100. @item datapath
  6101. Set datapath to tesseract data. Default is to use whatever was
  6102. set at installation.
  6103. @item language
  6104. Set language, default is "eng".
  6105. @item whitelist
  6106. Set character whitelist.
  6107. @item blacklist
  6108. Set character blacklist.
  6109. @end table
  6110. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  6111. @section ocv
  6112. Apply a video transform using libopencv.
  6113. To enable this filter, install the libopencv library and headers and
  6114. configure FFmpeg with @code{--enable-libopencv}.
  6115. It accepts the following parameters:
  6116. @table @option
  6117. @item filter_name
  6118. The name of the libopencv filter to apply.
  6119. @item filter_params
  6120. The parameters to pass to the libopencv filter. If not specified, the default
  6121. values are assumed.
  6122. @end table
  6123. Refer to the official libopencv documentation for more precise
  6124. information:
  6125. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  6126. Several libopencv filters are supported; see the following subsections.
  6127. @anchor{dilate}
  6128. @subsection dilate
  6129. Dilate an image by using a specific structuring element.
  6130. It corresponds to the libopencv function @code{cvDilate}.
  6131. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  6132. @var{struct_el} represents a structuring element, and has the syntax:
  6133. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  6134. @var{cols} and @var{rows} represent the number of columns and rows of
  6135. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  6136. point, and @var{shape} the shape for the structuring element. @var{shape}
  6137. must be "rect", "cross", "ellipse", or "custom".
  6138. If the value for @var{shape} is "custom", it must be followed by a
  6139. string of the form "=@var{filename}". The file with name
  6140. @var{filename} is assumed to represent a binary image, with each
  6141. printable character corresponding to a bright pixel. When a custom
  6142. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  6143. or columns and rows of the read file are assumed instead.
  6144. The default value for @var{struct_el} is "3x3+0x0/rect".
  6145. @var{nb_iterations} specifies the number of times the transform is
  6146. applied to the image, and defaults to 1.
  6147. Some examples:
  6148. @example
  6149. # Use the default values
  6150. ocv=dilate
  6151. # Dilate using a structuring element with a 5x5 cross, iterating two times
  6152. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  6153. # Read the shape from the file diamond.shape, iterating two times.
  6154. # The file diamond.shape may contain a pattern of characters like this
  6155. # *
  6156. # ***
  6157. # *****
  6158. # ***
  6159. # *
  6160. # The specified columns and rows are ignored
  6161. # but the anchor point coordinates are not
  6162. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  6163. @end example
  6164. @subsection erode
  6165. Erode an image by using a specific structuring element.
  6166. It corresponds to the libopencv function @code{cvErode}.
  6167. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  6168. with the same syntax and semantics as the @ref{dilate} filter.
  6169. @subsection smooth
  6170. Smooth the input video.
  6171. The filter takes the following parameters:
  6172. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  6173. @var{type} is the type of smooth filter to apply, and must be one of
  6174. the following values: "blur", "blur_no_scale", "median", "gaussian",
  6175. or "bilateral". The default value is "gaussian".
  6176. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  6177. depend on the smooth type. @var{param1} and
  6178. @var{param2} accept integer positive values or 0. @var{param3} and
  6179. @var{param4} accept floating point values.
  6180. The default value for @var{param1} is 3. The default value for the
  6181. other parameters is 0.
  6182. These parameters correspond to the parameters assigned to the
  6183. libopencv function @code{cvSmooth}.
  6184. @anchor{overlay}
  6185. @section overlay
  6186. Overlay one video on top of another.
  6187. It takes two inputs and has one output. The first input is the "main"
  6188. video on which the second input is overlaid.
  6189. It accepts the following parameters:
  6190. A description of the accepted options follows.
  6191. @table @option
  6192. @item x
  6193. @item y
  6194. Set the expression for the x and y coordinates of the overlaid video
  6195. on the main video. Default value is "0" for both expressions. In case
  6196. the expression is invalid, it is set to a huge value (meaning that the
  6197. overlay will not be displayed within the output visible area).
  6198. @item eof_action
  6199. The action to take when EOF is encountered on the secondary input; it accepts
  6200. one of the following values:
  6201. @table @option
  6202. @item repeat
  6203. Repeat the last frame (the default).
  6204. @item endall
  6205. End both streams.
  6206. @item pass
  6207. Pass the main input through.
  6208. @end table
  6209. @item eval
  6210. Set when the expressions for @option{x}, and @option{y} are evaluated.
  6211. It accepts the following values:
  6212. @table @samp
  6213. @item init
  6214. only evaluate expressions once during the filter initialization or
  6215. when a command is processed
  6216. @item frame
  6217. evaluate expressions for each incoming frame
  6218. @end table
  6219. Default value is @samp{frame}.
  6220. @item shortest
  6221. If set to 1, force the output to terminate when the shortest input
  6222. terminates. Default value is 0.
  6223. @item format
  6224. Set the format for the output video.
  6225. It accepts the following values:
  6226. @table @samp
  6227. @item yuv420
  6228. force YUV420 output
  6229. @item yuv422
  6230. force YUV422 output
  6231. @item yuv444
  6232. force YUV444 output
  6233. @item rgb
  6234. force RGB output
  6235. @end table
  6236. Default value is @samp{yuv420}.
  6237. @item rgb @emph{(deprecated)}
  6238. If set to 1, force the filter to accept inputs in the RGB
  6239. color space. Default value is 0. This option is deprecated, use
  6240. @option{format} instead.
  6241. @item repeatlast
  6242. If set to 1, force the filter to draw the last overlay frame over the
  6243. main input until the end of the stream. A value of 0 disables this
  6244. behavior. Default value is 1.
  6245. @end table
  6246. The @option{x}, and @option{y} expressions can contain the following
  6247. parameters.
  6248. @table @option
  6249. @item main_w, W
  6250. @item main_h, H
  6251. The main input width and height.
  6252. @item overlay_w, w
  6253. @item overlay_h, h
  6254. The overlay input width and height.
  6255. @item x
  6256. @item y
  6257. The computed values for @var{x} and @var{y}. They are evaluated for
  6258. each new frame.
  6259. @item hsub
  6260. @item vsub
  6261. horizontal and vertical chroma subsample values of the output
  6262. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  6263. @var{vsub} is 1.
  6264. @item n
  6265. the number of input frame, starting from 0
  6266. @item pos
  6267. the position in the file of the input frame, NAN if unknown
  6268. @item t
  6269. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  6270. @end table
  6271. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  6272. when evaluation is done @emph{per frame}, and will evaluate to NAN
  6273. when @option{eval} is set to @samp{init}.
  6274. Be aware that frames are taken from each input video in timestamp
  6275. order, hence, if their initial timestamps differ, it is a good idea
  6276. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  6277. have them begin in the same zero timestamp, as the example for
  6278. the @var{movie} filter does.
  6279. You can chain together more overlays but you should test the
  6280. efficiency of such approach.
  6281. @subsection Commands
  6282. This filter supports the following commands:
  6283. @table @option
  6284. @item x
  6285. @item y
  6286. Modify the x and y of the overlay input.
  6287. The command accepts the same syntax of the corresponding option.
  6288. If the specified expression is not valid, it is kept at its current
  6289. value.
  6290. @end table
  6291. @subsection Examples
  6292. @itemize
  6293. @item
  6294. Draw the overlay at 10 pixels from the bottom right corner of the main
  6295. video:
  6296. @example
  6297. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  6298. @end example
  6299. Using named options the example above becomes:
  6300. @example
  6301. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  6302. @end example
  6303. @item
  6304. Insert a transparent PNG logo in the bottom left corner of the input,
  6305. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  6306. @example
  6307. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  6308. @end example
  6309. @item
  6310. Insert 2 different transparent PNG logos (second logo on bottom
  6311. right corner) using the @command{ffmpeg} tool:
  6312. @example
  6313. 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
  6314. @end example
  6315. @item
  6316. Add a transparent color layer on top of the main video; @code{WxH}
  6317. must specify the size of the main input to the overlay filter:
  6318. @example
  6319. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  6320. @end example
  6321. @item
  6322. Play an original video and a filtered version (here with the deshake
  6323. filter) side by side using the @command{ffplay} tool:
  6324. @example
  6325. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  6326. @end example
  6327. The above command is the same as:
  6328. @example
  6329. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  6330. @end example
  6331. @item
  6332. Make a sliding overlay appearing from the left to the right top part of the
  6333. screen starting since time 2:
  6334. @example
  6335. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  6336. @end example
  6337. @item
  6338. Compose output by putting two input videos side to side:
  6339. @example
  6340. ffmpeg -i left.avi -i right.avi -filter_complex "
  6341. nullsrc=size=200x100 [background];
  6342. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  6343. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  6344. [background][left] overlay=shortest=1 [background+left];
  6345. [background+left][right] overlay=shortest=1:x=100 [left+right]
  6346. "
  6347. @end example
  6348. @item
  6349. Mask 10-20 seconds of a video by applying the delogo filter to a section
  6350. @example
  6351. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  6352. -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]'
  6353. masked.avi
  6354. @end example
  6355. @item
  6356. Chain several overlays in cascade:
  6357. @example
  6358. nullsrc=s=200x200 [bg];
  6359. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  6360. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  6361. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  6362. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  6363. [in3] null, [mid2] overlay=100:100 [out0]
  6364. @end example
  6365. @end itemize
  6366. @section owdenoise
  6367. Apply Overcomplete Wavelet denoiser.
  6368. The filter accepts the following options:
  6369. @table @option
  6370. @item depth
  6371. Set depth.
  6372. Larger depth values will denoise lower frequency components more, but
  6373. slow down filtering.
  6374. Must be an int in the range 8-16, default is @code{8}.
  6375. @item luma_strength, ls
  6376. Set luma strength.
  6377. Must be a double value in the range 0-1000, default is @code{1.0}.
  6378. @item chroma_strength, cs
  6379. Set chroma strength.
  6380. Must be a double value in the range 0-1000, default is @code{1.0}.
  6381. @end table
  6382. @anchor{pad}
  6383. @section pad
  6384. Add paddings to the input image, and place the original input at the
  6385. provided @var{x}, @var{y} coordinates.
  6386. It accepts the following parameters:
  6387. @table @option
  6388. @item width, w
  6389. @item height, h
  6390. Specify an expression for the size of the output image with the
  6391. paddings added. If the value for @var{width} or @var{height} is 0, the
  6392. corresponding input size is used for the output.
  6393. The @var{width} expression can reference the value set by the
  6394. @var{height} expression, and vice versa.
  6395. The default value of @var{width} and @var{height} is 0.
  6396. @item x
  6397. @item y
  6398. Specify the offsets to place the input image at within the padded area,
  6399. with respect to the top/left border of the output image.
  6400. The @var{x} expression can reference the value set by the @var{y}
  6401. expression, and vice versa.
  6402. The default value of @var{x} and @var{y} is 0.
  6403. @item color
  6404. Specify the color of the padded area. For the syntax of this option,
  6405. check the "Color" section in the ffmpeg-utils manual.
  6406. The default value of @var{color} is "black".
  6407. @end table
  6408. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  6409. options are expressions containing the following constants:
  6410. @table @option
  6411. @item in_w
  6412. @item in_h
  6413. The input video width and height.
  6414. @item iw
  6415. @item ih
  6416. These are the same as @var{in_w} and @var{in_h}.
  6417. @item out_w
  6418. @item out_h
  6419. The output width and height (the size of the padded area), as
  6420. specified by the @var{width} and @var{height} expressions.
  6421. @item ow
  6422. @item oh
  6423. These are the same as @var{out_w} and @var{out_h}.
  6424. @item x
  6425. @item y
  6426. The x and y offsets as specified by the @var{x} and @var{y}
  6427. expressions, or NAN if not yet specified.
  6428. @item a
  6429. same as @var{iw} / @var{ih}
  6430. @item sar
  6431. input sample aspect ratio
  6432. @item dar
  6433. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6434. @item hsub
  6435. @item vsub
  6436. The horizontal and vertical chroma subsample values. For example for the
  6437. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6438. @end table
  6439. @subsection Examples
  6440. @itemize
  6441. @item
  6442. Add paddings with the color "violet" to the input video. The output video
  6443. size is 640x480, and the top-left corner of the input video is placed at
  6444. column 0, row 40
  6445. @example
  6446. pad=640:480:0:40:violet
  6447. @end example
  6448. The example above is equivalent to the following command:
  6449. @example
  6450. pad=width=640:height=480:x=0:y=40:color=violet
  6451. @end example
  6452. @item
  6453. Pad the input to get an output with dimensions increased by 3/2,
  6454. and put the input video at the center of the padded area:
  6455. @example
  6456. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  6457. @end example
  6458. @item
  6459. Pad the input to get a squared output with size equal to the maximum
  6460. value between the input width and height, and put the input video at
  6461. the center of the padded area:
  6462. @example
  6463. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  6464. @end example
  6465. @item
  6466. Pad the input to get a final w/h ratio of 16:9:
  6467. @example
  6468. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  6469. @end example
  6470. @item
  6471. In case of anamorphic video, in order to set the output display aspect
  6472. correctly, it is necessary to use @var{sar} in the expression,
  6473. according to the relation:
  6474. @example
  6475. (ih * X / ih) * sar = output_dar
  6476. X = output_dar / sar
  6477. @end example
  6478. Thus the previous example needs to be modified to:
  6479. @example
  6480. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  6481. @end example
  6482. @item
  6483. Double the output size and put the input video in the bottom-right
  6484. corner of the output padded area:
  6485. @example
  6486. pad="2*iw:2*ih:ow-iw:oh-ih"
  6487. @end example
  6488. @end itemize
  6489. @anchor{palettegen}
  6490. @section palettegen
  6491. Generate one palette for a whole video stream.
  6492. It accepts the following options:
  6493. @table @option
  6494. @item max_colors
  6495. Set the maximum number of colors to quantize in the palette.
  6496. Note: the palette will still contain 256 colors; the unused palette entries
  6497. will be black.
  6498. @item reserve_transparent
  6499. Create a palette of 255 colors maximum and reserve the last one for
  6500. transparency. Reserving the transparency color is useful for GIF optimization.
  6501. If not set, the maximum of colors in the palette will be 256. You probably want
  6502. to disable this option for a standalone image.
  6503. Set by default.
  6504. @item stats_mode
  6505. Set statistics mode.
  6506. It accepts the following values:
  6507. @table @samp
  6508. @item full
  6509. Compute full frame histograms.
  6510. @item diff
  6511. Compute histograms only for the part that differs from previous frame. This
  6512. might be relevant to give more importance to the moving part of your input if
  6513. the background is static.
  6514. @end table
  6515. Default value is @var{full}.
  6516. @end table
  6517. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  6518. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  6519. color quantization of the palette. This information is also visible at
  6520. @var{info} logging level.
  6521. @subsection Examples
  6522. @itemize
  6523. @item
  6524. Generate a representative palette of a given video using @command{ffmpeg}:
  6525. @example
  6526. ffmpeg -i input.mkv -vf palettegen palette.png
  6527. @end example
  6528. @end itemize
  6529. @section paletteuse
  6530. Use a palette to downsample an input video stream.
  6531. The filter takes two inputs: one video stream and a palette. The palette must
  6532. be a 256 pixels image.
  6533. It accepts the following options:
  6534. @table @option
  6535. @item dither
  6536. Select dithering mode. Available algorithms are:
  6537. @table @samp
  6538. @item bayer
  6539. Ordered 8x8 bayer dithering (deterministic)
  6540. @item heckbert
  6541. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  6542. Note: this dithering is sometimes considered "wrong" and is included as a
  6543. reference.
  6544. @item floyd_steinberg
  6545. Floyd and Steingberg dithering (error diffusion)
  6546. @item sierra2
  6547. Frankie Sierra dithering v2 (error diffusion)
  6548. @item sierra2_4a
  6549. Frankie Sierra dithering v2 "Lite" (error diffusion)
  6550. @end table
  6551. Default is @var{sierra2_4a}.
  6552. @item bayer_scale
  6553. When @var{bayer} dithering is selected, this option defines the scale of the
  6554. pattern (how much the crosshatch pattern is visible). A low value means more
  6555. visible pattern for less banding, and higher value means less visible pattern
  6556. at the cost of more banding.
  6557. The option must be an integer value in the range [0,5]. Default is @var{2}.
  6558. @item diff_mode
  6559. If set, define the zone to process
  6560. @table @samp
  6561. @item rectangle
  6562. Only the changing rectangle will be reprocessed. This is similar to GIF
  6563. cropping/offsetting compression mechanism. This option can be useful for speed
  6564. if only a part of the image is changing, and has use cases such as limiting the
  6565. scope of the error diffusal @option{dither} to the rectangle that bounds the
  6566. moving scene (it leads to more deterministic output if the scene doesn't change
  6567. much, and as a result less moving noise and better GIF compression).
  6568. @end table
  6569. Default is @var{none}.
  6570. @end table
  6571. @subsection Examples
  6572. @itemize
  6573. @item
  6574. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  6575. using @command{ffmpeg}:
  6576. @example
  6577. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  6578. @end example
  6579. @end itemize
  6580. @section perspective
  6581. Correct perspective of video not recorded perpendicular to the screen.
  6582. A description of the accepted parameters follows.
  6583. @table @option
  6584. @item x0
  6585. @item y0
  6586. @item x1
  6587. @item y1
  6588. @item x2
  6589. @item y2
  6590. @item x3
  6591. @item y3
  6592. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  6593. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  6594. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  6595. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  6596. then the corners of the source will be sent to the specified coordinates.
  6597. The expressions can use the following variables:
  6598. @table @option
  6599. @item W
  6600. @item H
  6601. the width and height of video frame.
  6602. @end table
  6603. @item interpolation
  6604. Set interpolation for perspective correction.
  6605. It accepts the following values:
  6606. @table @samp
  6607. @item linear
  6608. @item cubic
  6609. @end table
  6610. Default value is @samp{linear}.
  6611. @item sense
  6612. Set interpretation of coordinate options.
  6613. It accepts the following values:
  6614. @table @samp
  6615. @item 0, source
  6616. Send point in the source specified by the given coordinates to
  6617. the corners of the destination.
  6618. @item 1, destination
  6619. Send the corners of the source to the point in the destination specified
  6620. by the given coordinates.
  6621. Default value is @samp{source}.
  6622. @end table
  6623. @end table
  6624. @section phase
  6625. Delay interlaced video by one field time so that the field order changes.
  6626. The intended use is to fix PAL movies that have been captured with the
  6627. opposite field order to the film-to-video transfer.
  6628. A description of the accepted parameters follows.
  6629. @table @option
  6630. @item mode
  6631. Set phase mode.
  6632. It accepts the following values:
  6633. @table @samp
  6634. @item t
  6635. Capture field order top-first, transfer bottom-first.
  6636. Filter will delay the bottom field.
  6637. @item b
  6638. Capture field order bottom-first, transfer top-first.
  6639. Filter will delay the top field.
  6640. @item p
  6641. Capture and transfer with the same field order. This mode only exists
  6642. for the documentation of the other options to refer to, but if you
  6643. actually select it, the filter will faithfully do nothing.
  6644. @item a
  6645. Capture field order determined automatically by field flags, transfer
  6646. opposite.
  6647. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  6648. basis using field flags. If no field information is available,
  6649. then this works just like @samp{u}.
  6650. @item u
  6651. Capture unknown or varying, transfer opposite.
  6652. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  6653. analyzing the images and selecting the alternative that produces best
  6654. match between the fields.
  6655. @item T
  6656. Capture top-first, transfer unknown or varying.
  6657. Filter selects among @samp{t} and @samp{p} using image analysis.
  6658. @item B
  6659. Capture bottom-first, transfer unknown or varying.
  6660. Filter selects among @samp{b} and @samp{p} using image analysis.
  6661. @item A
  6662. Capture determined by field flags, transfer unknown or varying.
  6663. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  6664. image analysis. If no field information is available, then this works just
  6665. like @samp{U}. This is the default mode.
  6666. @item U
  6667. Both capture and transfer unknown or varying.
  6668. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  6669. @end table
  6670. @end table
  6671. @section pixdesctest
  6672. Pixel format descriptor test filter, mainly useful for internal
  6673. testing. The output video should be equal to the input video.
  6674. For example:
  6675. @example
  6676. format=monow, pixdesctest
  6677. @end example
  6678. can be used to test the monowhite pixel format descriptor definition.
  6679. @section pp
  6680. Enable the specified chain of postprocessing subfilters using libpostproc. This
  6681. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  6682. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  6683. Each subfilter and some options have a short and a long name that can be used
  6684. interchangeably, i.e. dr/dering are the same.
  6685. The filters accept the following options:
  6686. @table @option
  6687. @item subfilters
  6688. Set postprocessing subfilters string.
  6689. @end table
  6690. All subfilters share common options to determine their scope:
  6691. @table @option
  6692. @item a/autoq
  6693. Honor the quality commands for this subfilter.
  6694. @item c/chrom
  6695. Do chrominance filtering, too (default).
  6696. @item y/nochrom
  6697. Do luminance filtering only (no chrominance).
  6698. @item n/noluma
  6699. Do chrominance filtering only (no luminance).
  6700. @end table
  6701. These options can be appended after the subfilter name, separated by a '|'.
  6702. Available subfilters are:
  6703. @table @option
  6704. @item hb/hdeblock[|difference[|flatness]]
  6705. Horizontal deblocking filter
  6706. @table @option
  6707. @item difference
  6708. Difference factor where higher values mean more deblocking (default: @code{32}).
  6709. @item flatness
  6710. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6711. @end table
  6712. @item vb/vdeblock[|difference[|flatness]]
  6713. Vertical deblocking filter
  6714. @table @option
  6715. @item difference
  6716. Difference factor where higher values mean more deblocking (default: @code{32}).
  6717. @item flatness
  6718. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6719. @end table
  6720. @item ha/hadeblock[|difference[|flatness]]
  6721. Accurate horizontal deblocking filter
  6722. @table @option
  6723. @item difference
  6724. Difference factor where higher values mean more deblocking (default: @code{32}).
  6725. @item flatness
  6726. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6727. @end table
  6728. @item va/vadeblock[|difference[|flatness]]
  6729. Accurate vertical deblocking filter
  6730. @table @option
  6731. @item difference
  6732. Difference factor where higher values mean more deblocking (default: @code{32}).
  6733. @item flatness
  6734. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6735. @end table
  6736. @end table
  6737. The horizontal and vertical deblocking filters share the difference and
  6738. flatness values so you cannot set different horizontal and vertical
  6739. thresholds.
  6740. @table @option
  6741. @item h1/x1hdeblock
  6742. Experimental horizontal deblocking filter
  6743. @item v1/x1vdeblock
  6744. Experimental vertical deblocking filter
  6745. @item dr/dering
  6746. Deringing filter
  6747. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  6748. @table @option
  6749. @item threshold1
  6750. larger -> stronger filtering
  6751. @item threshold2
  6752. larger -> stronger filtering
  6753. @item threshold3
  6754. larger -> stronger filtering
  6755. @end table
  6756. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  6757. @table @option
  6758. @item f/fullyrange
  6759. Stretch luminance to @code{0-255}.
  6760. @end table
  6761. @item lb/linblenddeint
  6762. Linear blend deinterlacing filter that deinterlaces the given block by
  6763. filtering all lines with a @code{(1 2 1)} filter.
  6764. @item li/linipoldeint
  6765. Linear interpolating deinterlacing filter that deinterlaces the given block by
  6766. linearly interpolating every second line.
  6767. @item ci/cubicipoldeint
  6768. Cubic interpolating deinterlacing filter deinterlaces the given block by
  6769. cubically interpolating every second line.
  6770. @item md/mediandeint
  6771. Median deinterlacing filter that deinterlaces the given block by applying a
  6772. median filter to every second line.
  6773. @item fd/ffmpegdeint
  6774. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  6775. second line with a @code{(-1 4 2 4 -1)} filter.
  6776. @item l5/lowpass5
  6777. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  6778. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  6779. @item fq/forceQuant[|quantizer]
  6780. Overrides the quantizer table from the input with the constant quantizer you
  6781. specify.
  6782. @table @option
  6783. @item quantizer
  6784. Quantizer to use
  6785. @end table
  6786. @item de/default
  6787. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  6788. @item fa/fast
  6789. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  6790. @item ac
  6791. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  6792. @end table
  6793. @subsection Examples
  6794. @itemize
  6795. @item
  6796. Apply horizontal and vertical deblocking, deringing and automatic
  6797. brightness/contrast:
  6798. @example
  6799. pp=hb/vb/dr/al
  6800. @end example
  6801. @item
  6802. Apply default filters without brightness/contrast correction:
  6803. @example
  6804. pp=de/-al
  6805. @end example
  6806. @item
  6807. Apply default filters and temporal denoiser:
  6808. @example
  6809. pp=default/tmpnoise|1|2|3
  6810. @end example
  6811. @item
  6812. Apply deblocking on luminance only, and switch vertical deblocking on or off
  6813. automatically depending on available CPU time:
  6814. @example
  6815. pp=hb|y/vb|a
  6816. @end example
  6817. @end itemize
  6818. @section pp7
  6819. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  6820. similar to spp = 6 with 7 point DCT, where only the center sample is
  6821. used after IDCT.
  6822. The filter accepts the following options:
  6823. @table @option
  6824. @item qp
  6825. Force a constant quantization parameter. It accepts an integer in range
  6826. 0 to 63. If not set, the filter will use the QP from the video stream
  6827. (if available).
  6828. @item mode
  6829. Set thresholding mode. Available modes are:
  6830. @table @samp
  6831. @item hard
  6832. Set hard thresholding.
  6833. @item soft
  6834. Set soft thresholding (better de-ringing effect, but likely blurrier).
  6835. @item medium
  6836. Set medium thresholding (good results, default).
  6837. @end table
  6838. @end table
  6839. @section psnr
  6840. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  6841. Ratio) between two input videos.
  6842. This filter takes in input two input videos, the first input is
  6843. considered the "main" source and is passed unchanged to the
  6844. output. The second input is used as a "reference" video for computing
  6845. the PSNR.
  6846. Both video inputs must have the same resolution and pixel format for
  6847. this filter to work correctly. Also it assumes that both inputs
  6848. have the same number of frames, which are compared one by one.
  6849. The obtained average PSNR is printed through the logging system.
  6850. The filter stores the accumulated MSE (mean squared error) of each
  6851. frame, and at the end of the processing it is averaged across all frames
  6852. equally, and the following formula is applied to obtain the PSNR:
  6853. @example
  6854. PSNR = 10*log10(MAX^2/MSE)
  6855. @end example
  6856. Where MAX is the average of the maximum values of each component of the
  6857. image.
  6858. The description of the accepted parameters follows.
  6859. @table @option
  6860. @item stats_file, f
  6861. If specified the filter will use the named file to save the PSNR of
  6862. each individual frame.
  6863. @end table
  6864. The file printed if @var{stats_file} is selected, contains a sequence of
  6865. key/value pairs of the form @var{key}:@var{value} for each compared
  6866. couple of frames.
  6867. A description of each shown parameter follows:
  6868. @table @option
  6869. @item n
  6870. sequential number of the input frame, starting from 1
  6871. @item mse_avg
  6872. Mean Square Error pixel-by-pixel average difference of the compared
  6873. frames, averaged over all the image components.
  6874. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  6875. Mean Square Error pixel-by-pixel average difference of the compared
  6876. frames for the component specified by the suffix.
  6877. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  6878. Peak Signal to Noise ratio of the compared frames for the component
  6879. specified by the suffix.
  6880. @end table
  6881. For example:
  6882. @example
  6883. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  6884. [main][ref] psnr="stats_file=stats.log" [out]
  6885. @end example
  6886. On this example the input file being processed is compared with the
  6887. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  6888. is stored in @file{stats.log}.
  6889. @anchor{pullup}
  6890. @section pullup
  6891. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  6892. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  6893. content.
  6894. The pullup filter is designed to take advantage of future context in making
  6895. its decisions. This filter is stateless in the sense that it does not lock
  6896. onto a pattern to follow, but it instead looks forward to the following
  6897. fields in order to identify matches and rebuild progressive frames.
  6898. To produce content with an even framerate, insert the fps filter after
  6899. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  6900. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  6901. The filter accepts the following options:
  6902. @table @option
  6903. @item jl
  6904. @item jr
  6905. @item jt
  6906. @item jb
  6907. These options set the amount of "junk" to ignore at the left, right, top, and
  6908. bottom of the image, respectively. Left and right are in units of 8 pixels,
  6909. while top and bottom are in units of 2 lines.
  6910. The default is 8 pixels on each side.
  6911. @item sb
  6912. Set the strict breaks. Setting this option to 1 will reduce the chances of
  6913. filter generating an occasional mismatched frame, but it may also cause an
  6914. excessive number of frames to be dropped during high motion sequences.
  6915. Conversely, setting it to -1 will make filter match fields more easily.
  6916. This may help processing of video where there is slight blurring between
  6917. the fields, but may also cause there to be interlaced frames in the output.
  6918. Default value is @code{0}.
  6919. @item mp
  6920. Set the metric plane to use. It accepts the following values:
  6921. @table @samp
  6922. @item l
  6923. Use luma plane.
  6924. @item u
  6925. Use chroma blue plane.
  6926. @item v
  6927. Use chroma red plane.
  6928. @end table
  6929. This option may be set to use chroma plane instead of the default luma plane
  6930. for doing filter's computations. This may improve accuracy on very clean
  6931. source material, but more likely will decrease accuracy, especially if there
  6932. is chroma noise (rainbow effect) or any grayscale video.
  6933. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  6934. load and make pullup usable in realtime on slow machines.
  6935. @end table
  6936. For best results (without duplicated frames in the output file) it is
  6937. necessary to change the output frame rate. For example, to inverse
  6938. telecine NTSC input:
  6939. @example
  6940. ffmpeg -i input -vf pullup -r 24000/1001 ...
  6941. @end example
  6942. @section qp
  6943. Change video quantization parameters (QP).
  6944. The filter accepts the following option:
  6945. @table @option
  6946. @item qp
  6947. Set expression for quantization parameter.
  6948. @end table
  6949. The expression is evaluated through the eval API and can contain, among others,
  6950. the following constants:
  6951. @table @var
  6952. @item known
  6953. 1 if index is not 129, 0 otherwise.
  6954. @item qp
  6955. Sequentional index starting from -129 to 128.
  6956. @end table
  6957. @subsection Examples
  6958. @itemize
  6959. @item
  6960. Some equation like:
  6961. @example
  6962. qp=2+2*sin(PI*qp)
  6963. @end example
  6964. @end itemize
  6965. @section random
  6966. Flush video frames from internal cache of frames into a random order.
  6967. No frame is discarded.
  6968. Inspired by @ref{frei0r} nervous filter.
  6969. @table @option
  6970. @item frames
  6971. Set size in number of frames of internal cache, in range from @code{2} to
  6972. @code{512}. Default is @code{30}.
  6973. @item seed
  6974. Set seed for random number generator, must be an integer included between
  6975. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  6976. less than @code{0}, the filter will try to use a good random seed on a
  6977. best effort basis.
  6978. @end table
  6979. @section removegrain
  6980. The removegrain filter is a spatial denoiser for progressive video.
  6981. @table @option
  6982. @item m0
  6983. Set mode for the first plane.
  6984. @item m1
  6985. Set mode for the second plane.
  6986. @item m2
  6987. Set mode for the third plane.
  6988. @item m3
  6989. Set mode for the fourth plane.
  6990. @end table
  6991. Range of mode is from 0 to 24. Description of each mode follows:
  6992. @table @var
  6993. @item 0
  6994. Leave input plane unchanged. Default.
  6995. @item 1
  6996. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  6997. @item 2
  6998. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  6999. @item 3
  7000. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  7001. @item 4
  7002. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  7003. This is equivalent to a median filter.
  7004. @item 5
  7005. Line-sensitive clipping giving the minimal change.
  7006. @item 6
  7007. Line-sensitive clipping, intermediate.
  7008. @item 7
  7009. Line-sensitive clipping, intermediate.
  7010. @item 8
  7011. Line-sensitive clipping, intermediate.
  7012. @item 9
  7013. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  7014. @item 10
  7015. Replaces the target pixel with the closest neighbour.
  7016. @item 11
  7017. [1 2 1] horizontal and vertical kernel blur.
  7018. @item 12
  7019. Same as mode 11.
  7020. @item 13
  7021. Bob mode, interpolates top field from the line where the neighbours
  7022. pixels are the closest.
  7023. @item 14
  7024. Bob mode, interpolates bottom field from the line where the neighbours
  7025. pixels are the closest.
  7026. @item 15
  7027. Bob mode, interpolates top field. Same as 13 but with a more complicated
  7028. interpolation formula.
  7029. @item 16
  7030. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  7031. interpolation formula.
  7032. @item 17
  7033. Clips the pixel with the minimum and maximum of respectively the maximum and
  7034. minimum of each pair of opposite neighbour pixels.
  7035. @item 18
  7036. Line-sensitive clipping using opposite neighbours whose greatest distance from
  7037. the current pixel is minimal.
  7038. @item 19
  7039. Replaces the pixel with the average of its 8 neighbours.
  7040. @item 20
  7041. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  7042. @item 21
  7043. Clips pixels using the averages of opposite neighbour.
  7044. @item 22
  7045. Same as mode 21 but simpler and faster.
  7046. @item 23
  7047. Small edge and halo removal, but reputed useless.
  7048. @item 24
  7049. Similar as 23.
  7050. @end table
  7051. @section removelogo
  7052. Suppress a TV station logo, using an image file to determine which
  7053. pixels comprise the logo. It works by filling in the pixels that
  7054. comprise the logo with neighboring pixels.
  7055. The filter accepts the following options:
  7056. @table @option
  7057. @item filename, f
  7058. Set the filter bitmap file, which can be any image format supported by
  7059. libavformat. The width and height of the image file must match those of the
  7060. video stream being processed.
  7061. @end table
  7062. Pixels in the provided bitmap image with a value of zero are not
  7063. considered part of the logo, non-zero pixels are considered part of
  7064. the logo. If you use white (255) for the logo and black (0) for the
  7065. rest, you will be safe. For making the filter bitmap, it is
  7066. recommended to take a screen capture of a black frame with the logo
  7067. visible, and then using a threshold filter followed by the erode
  7068. filter once or twice.
  7069. If needed, little splotches can be fixed manually. Remember that if
  7070. logo pixels are not covered, the filter quality will be much
  7071. reduced. Marking too many pixels as part of the logo does not hurt as
  7072. much, but it will increase the amount of blurring needed to cover over
  7073. the image and will destroy more information than necessary, and extra
  7074. pixels will slow things down on a large logo.
  7075. @section repeatfields
  7076. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  7077. fields based on its value.
  7078. @section reverse, areverse
  7079. Reverse a clip.
  7080. Warning: This filter requires memory to buffer the entire clip, so trimming
  7081. is suggested.
  7082. @subsection Examples
  7083. @itemize
  7084. @item
  7085. Take the first 5 seconds of a clip, and reverse it.
  7086. @example
  7087. trim=end=5,reverse
  7088. @end example
  7089. @end itemize
  7090. @section rotate
  7091. Rotate video by an arbitrary angle expressed in radians.
  7092. The filter accepts the following options:
  7093. A description of the optional parameters follows.
  7094. @table @option
  7095. @item angle, a
  7096. Set an expression for the angle by which to rotate the input video
  7097. clockwise, expressed as a number of radians. A negative value will
  7098. result in a counter-clockwise rotation. By default it is set to "0".
  7099. This expression is evaluated for each frame.
  7100. @item out_w, ow
  7101. Set the output width expression, default value is "iw".
  7102. This expression is evaluated just once during configuration.
  7103. @item out_h, oh
  7104. Set the output height expression, default value is "ih".
  7105. This expression is evaluated just once during configuration.
  7106. @item bilinear
  7107. Enable bilinear interpolation if set to 1, a value of 0 disables
  7108. it. Default value is 1.
  7109. @item fillcolor, c
  7110. Set the color used to fill the output area not covered by the rotated
  7111. image. For the general syntax of this option, check the "Color" section in the
  7112. ffmpeg-utils manual. If the special value "none" is selected then no
  7113. background is printed (useful for example if the background is never shown).
  7114. Default value is "black".
  7115. @end table
  7116. The expressions for the angle and the output size can contain the
  7117. following constants and functions:
  7118. @table @option
  7119. @item n
  7120. sequential number of the input frame, starting from 0. It is always NAN
  7121. before the first frame is filtered.
  7122. @item t
  7123. time in seconds of the input frame, it is set to 0 when the filter is
  7124. configured. It is always NAN before the first frame is filtered.
  7125. @item hsub
  7126. @item vsub
  7127. horizontal and vertical chroma subsample values. For example for the
  7128. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7129. @item in_w, iw
  7130. @item in_h, ih
  7131. the input video width and height
  7132. @item out_w, ow
  7133. @item out_h, oh
  7134. the output width and height, that is the size of the padded area as
  7135. specified by the @var{width} and @var{height} expressions
  7136. @item rotw(a)
  7137. @item roth(a)
  7138. the minimal width/height required for completely containing the input
  7139. video rotated by @var{a} radians.
  7140. These are only available when computing the @option{out_w} and
  7141. @option{out_h} expressions.
  7142. @end table
  7143. @subsection Examples
  7144. @itemize
  7145. @item
  7146. Rotate the input by PI/6 radians clockwise:
  7147. @example
  7148. rotate=PI/6
  7149. @end example
  7150. @item
  7151. Rotate the input by PI/6 radians counter-clockwise:
  7152. @example
  7153. rotate=-PI/6
  7154. @end example
  7155. @item
  7156. Rotate the input by 45 degrees clockwise:
  7157. @example
  7158. rotate=45*PI/180
  7159. @end example
  7160. @item
  7161. Apply a constant rotation with period T, starting from an angle of PI/3:
  7162. @example
  7163. rotate=PI/3+2*PI*t/T
  7164. @end example
  7165. @item
  7166. Make the input video rotation oscillating with a period of T
  7167. seconds and an amplitude of A radians:
  7168. @example
  7169. rotate=A*sin(2*PI/T*t)
  7170. @end example
  7171. @item
  7172. Rotate the video, output size is chosen so that the whole rotating
  7173. input video is always completely contained in the output:
  7174. @example
  7175. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  7176. @end example
  7177. @item
  7178. Rotate the video, reduce the output size so that no background is ever
  7179. shown:
  7180. @example
  7181. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  7182. @end example
  7183. @end itemize
  7184. @subsection Commands
  7185. The filter supports the following commands:
  7186. @table @option
  7187. @item a, angle
  7188. Set the angle expression.
  7189. The command accepts the same syntax of the corresponding option.
  7190. If the specified expression is not valid, it is kept at its current
  7191. value.
  7192. @end table
  7193. @section sab
  7194. Apply Shape Adaptive Blur.
  7195. The filter accepts the following options:
  7196. @table @option
  7197. @item luma_radius, lr
  7198. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  7199. value is 1.0. A greater value will result in a more blurred image, and
  7200. in slower processing.
  7201. @item luma_pre_filter_radius, lpfr
  7202. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  7203. value is 1.0.
  7204. @item luma_strength, ls
  7205. Set luma maximum difference between pixels to still be considered, must
  7206. be a value in the 0.1-100.0 range, default value is 1.0.
  7207. @item chroma_radius, cr
  7208. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  7209. greater value will result in a more blurred image, and in slower
  7210. processing.
  7211. @item chroma_pre_filter_radius, cpfr
  7212. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  7213. @item chroma_strength, cs
  7214. Set chroma maximum difference between pixels to still be considered,
  7215. must be a value in the 0.1-100.0 range.
  7216. @end table
  7217. Each chroma option value, if not explicitly specified, is set to the
  7218. corresponding luma option value.
  7219. @anchor{scale}
  7220. @section scale
  7221. Scale (resize) the input video, using the libswscale library.
  7222. The scale filter forces the output display aspect ratio to be the same
  7223. of the input, by changing the output sample aspect ratio.
  7224. If the input image format is different from the format requested by
  7225. the next filter, the scale filter will convert the input to the
  7226. requested format.
  7227. @subsection Options
  7228. The filter accepts the following options, or any of the options
  7229. supported by the libswscale scaler.
  7230. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  7231. the complete list of scaler options.
  7232. @table @option
  7233. @item width, w
  7234. @item height, h
  7235. Set the output video dimension expression. Default value is the input
  7236. dimension.
  7237. If the value is 0, the input width is used for the output.
  7238. If one of the values is -1, the scale filter will use a value that
  7239. maintains the aspect ratio of the input image, calculated from the
  7240. other specified dimension. If both of them are -1, the input size is
  7241. used
  7242. If one of the values is -n with n > 1, the scale filter will also use a value
  7243. that maintains the aspect ratio of the input image, calculated from the other
  7244. specified dimension. After that it will, however, make sure that the calculated
  7245. dimension is divisible by n and adjust the value if necessary.
  7246. See below for the list of accepted constants for use in the dimension
  7247. expression.
  7248. @item interl
  7249. Set the interlacing mode. It accepts the following values:
  7250. @table @samp
  7251. @item 1
  7252. Force interlaced aware scaling.
  7253. @item 0
  7254. Do not apply interlaced scaling.
  7255. @item -1
  7256. Select interlaced aware scaling depending on whether the source frames
  7257. are flagged as interlaced or not.
  7258. @end table
  7259. Default value is @samp{0}.
  7260. @item flags
  7261. Set libswscale scaling flags. See
  7262. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  7263. complete list of values. If not explicitly specified the filter applies
  7264. the default flags.
  7265. @item size, s
  7266. Set the video size. For the syntax of this option, check the
  7267. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7268. @item in_color_matrix
  7269. @item out_color_matrix
  7270. Set in/output YCbCr color space type.
  7271. This allows the autodetected value to be overridden as well as allows forcing
  7272. a specific value used for the output and encoder.
  7273. If not specified, the color space type depends on the pixel format.
  7274. Possible values:
  7275. @table @samp
  7276. @item auto
  7277. Choose automatically.
  7278. @item bt709
  7279. Format conforming to International Telecommunication Union (ITU)
  7280. Recommendation BT.709.
  7281. @item fcc
  7282. Set color space conforming to the United States Federal Communications
  7283. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  7284. @item bt601
  7285. Set color space conforming to:
  7286. @itemize
  7287. @item
  7288. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  7289. @item
  7290. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  7291. @item
  7292. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  7293. @end itemize
  7294. @item smpte240m
  7295. Set color space conforming to SMPTE ST 240:1999.
  7296. @end table
  7297. @item in_range
  7298. @item out_range
  7299. Set in/output YCbCr sample range.
  7300. This allows the autodetected value to be overridden as well as allows forcing
  7301. a specific value used for the output and encoder. If not specified, the
  7302. range depends on the pixel format. Possible values:
  7303. @table @samp
  7304. @item auto
  7305. Choose automatically.
  7306. @item jpeg/full/pc
  7307. Set full range (0-255 in case of 8-bit luma).
  7308. @item mpeg/tv
  7309. Set "MPEG" range (16-235 in case of 8-bit luma).
  7310. @end table
  7311. @item force_original_aspect_ratio
  7312. Enable decreasing or increasing output video width or height if necessary to
  7313. keep the original aspect ratio. Possible values:
  7314. @table @samp
  7315. @item disable
  7316. Scale the video as specified and disable this feature.
  7317. @item decrease
  7318. The output video dimensions will automatically be decreased if needed.
  7319. @item increase
  7320. The output video dimensions will automatically be increased if needed.
  7321. @end table
  7322. One useful instance of this option is that when you know a specific device's
  7323. maximum allowed resolution, you can use this to limit the output video to
  7324. that, while retaining the aspect ratio. For example, device A allows
  7325. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  7326. decrease) and specifying 1280x720 to the command line makes the output
  7327. 1280x533.
  7328. Please note that this is a different thing than specifying -1 for @option{w}
  7329. or @option{h}, you still need to specify the output resolution for this option
  7330. to work.
  7331. @end table
  7332. The values of the @option{w} and @option{h} options are expressions
  7333. containing the following constants:
  7334. @table @var
  7335. @item in_w
  7336. @item in_h
  7337. The input width and height
  7338. @item iw
  7339. @item ih
  7340. These are the same as @var{in_w} and @var{in_h}.
  7341. @item out_w
  7342. @item out_h
  7343. The output (scaled) width and height
  7344. @item ow
  7345. @item oh
  7346. These are the same as @var{out_w} and @var{out_h}
  7347. @item a
  7348. The same as @var{iw} / @var{ih}
  7349. @item sar
  7350. input sample aspect ratio
  7351. @item dar
  7352. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  7353. @item hsub
  7354. @item vsub
  7355. horizontal and vertical input chroma subsample values. For example for the
  7356. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7357. @item ohsub
  7358. @item ovsub
  7359. horizontal and vertical output chroma subsample values. For example for the
  7360. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7361. @end table
  7362. @subsection Examples
  7363. @itemize
  7364. @item
  7365. Scale the input video to a size of 200x100
  7366. @example
  7367. scale=w=200:h=100
  7368. @end example
  7369. This is equivalent to:
  7370. @example
  7371. scale=200:100
  7372. @end example
  7373. or:
  7374. @example
  7375. scale=200x100
  7376. @end example
  7377. @item
  7378. Specify a size abbreviation for the output size:
  7379. @example
  7380. scale=qcif
  7381. @end example
  7382. which can also be written as:
  7383. @example
  7384. scale=size=qcif
  7385. @end example
  7386. @item
  7387. Scale the input to 2x:
  7388. @example
  7389. scale=w=2*iw:h=2*ih
  7390. @end example
  7391. @item
  7392. The above is the same as:
  7393. @example
  7394. scale=2*in_w:2*in_h
  7395. @end example
  7396. @item
  7397. Scale the input to 2x with forced interlaced scaling:
  7398. @example
  7399. scale=2*iw:2*ih:interl=1
  7400. @end example
  7401. @item
  7402. Scale the input to half size:
  7403. @example
  7404. scale=w=iw/2:h=ih/2
  7405. @end example
  7406. @item
  7407. Increase the width, and set the height to the same size:
  7408. @example
  7409. scale=3/2*iw:ow
  7410. @end example
  7411. @item
  7412. Seek Greek harmony:
  7413. @example
  7414. scale=iw:1/PHI*iw
  7415. scale=ih*PHI:ih
  7416. @end example
  7417. @item
  7418. Increase the height, and set the width to 3/2 of the height:
  7419. @example
  7420. scale=w=3/2*oh:h=3/5*ih
  7421. @end example
  7422. @item
  7423. Increase the size, making the size a multiple of the chroma
  7424. subsample values:
  7425. @example
  7426. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  7427. @end example
  7428. @item
  7429. Increase the width to a maximum of 500 pixels,
  7430. keeping the same aspect ratio as the input:
  7431. @example
  7432. scale=w='min(500\, iw*3/2):h=-1'
  7433. @end example
  7434. @end itemize
  7435. @subsection Commands
  7436. This filter supports the following commands:
  7437. @table @option
  7438. @item width, w
  7439. @item height, h
  7440. Set the output video dimension expression.
  7441. The command accepts the same syntax of the corresponding option.
  7442. If the specified expression is not valid, it is kept at its current
  7443. value.
  7444. @end table
  7445. @section scale2ref
  7446. Scale (resize) the input video, based on a reference video.
  7447. See the scale filter for available options, scale2ref supports the same but
  7448. uses the reference video instead of the main input as basis.
  7449. @subsection Examples
  7450. @itemize
  7451. @item
  7452. Scale a subtitle stream to match the main video in size before overlaying
  7453. @example
  7454. 'scale2ref[b][a];[a][b]overlay'
  7455. @end example
  7456. @end itemize
  7457. @section separatefields
  7458. The @code{separatefields} takes a frame-based video input and splits
  7459. each frame into its components fields, producing a new half height clip
  7460. with twice the frame rate and twice the frame count.
  7461. This filter use field-dominance information in frame to decide which
  7462. of each pair of fields to place first in the output.
  7463. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  7464. @section setdar, setsar
  7465. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  7466. output video.
  7467. This is done by changing the specified Sample (aka Pixel) Aspect
  7468. Ratio, according to the following equation:
  7469. @example
  7470. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  7471. @end example
  7472. Keep in mind that the @code{setdar} filter does not modify the pixel
  7473. dimensions of the video frame. Also, the display aspect ratio set by
  7474. this filter may be changed by later filters in the filterchain,
  7475. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  7476. applied.
  7477. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  7478. the filter output video.
  7479. Note that as a consequence of the application of this filter, the
  7480. output display aspect ratio will change according to the equation
  7481. above.
  7482. Keep in mind that the sample aspect ratio set by the @code{setsar}
  7483. filter may be changed by later filters in the filterchain, e.g. if
  7484. another "setsar" or a "setdar" filter is applied.
  7485. It accepts the following parameters:
  7486. @table @option
  7487. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  7488. Set the aspect ratio used by the filter.
  7489. The parameter can be a floating point number string, an expression, or
  7490. a string of the form @var{num}:@var{den}, where @var{num} and
  7491. @var{den} are the numerator and denominator of the aspect ratio. If
  7492. the parameter is not specified, it is assumed the value "0".
  7493. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  7494. should be escaped.
  7495. @item max
  7496. Set the maximum integer value to use for expressing numerator and
  7497. denominator when reducing the expressed aspect ratio to a rational.
  7498. Default value is @code{100}.
  7499. @end table
  7500. The parameter @var{sar} is an expression containing
  7501. the following constants:
  7502. @table @option
  7503. @item E, PI, PHI
  7504. These are approximated values for the mathematical constants e
  7505. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  7506. @item w, h
  7507. The input width and height.
  7508. @item a
  7509. These are the same as @var{w} / @var{h}.
  7510. @item sar
  7511. The input sample aspect ratio.
  7512. @item dar
  7513. The input display aspect ratio. It is the same as
  7514. (@var{w} / @var{h}) * @var{sar}.
  7515. @item hsub, vsub
  7516. Horizontal and vertical chroma subsample values. For example, for the
  7517. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7518. @end table
  7519. @subsection Examples
  7520. @itemize
  7521. @item
  7522. To change the display aspect ratio to 16:9, specify one of the following:
  7523. @example
  7524. setdar=dar=1.77777
  7525. setdar=dar=16/9
  7526. setdar=dar=1.77777
  7527. @end example
  7528. @item
  7529. To change the sample aspect ratio to 10:11, specify:
  7530. @example
  7531. setsar=sar=10/11
  7532. @end example
  7533. @item
  7534. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  7535. 1000 in the aspect ratio reduction, use the command:
  7536. @example
  7537. setdar=ratio=16/9:max=1000
  7538. @end example
  7539. @end itemize
  7540. @anchor{setfield}
  7541. @section setfield
  7542. Force field for the output video frame.
  7543. The @code{setfield} filter marks the interlace type field for the
  7544. output frames. It does not change the input frame, but only sets the
  7545. corresponding property, which affects how the frame is treated by
  7546. following filters (e.g. @code{fieldorder} or @code{yadif}).
  7547. The filter accepts the following options:
  7548. @table @option
  7549. @item mode
  7550. Available values are:
  7551. @table @samp
  7552. @item auto
  7553. Keep the same field property.
  7554. @item bff
  7555. Mark the frame as bottom-field-first.
  7556. @item tff
  7557. Mark the frame as top-field-first.
  7558. @item prog
  7559. Mark the frame as progressive.
  7560. @end table
  7561. @end table
  7562. @section showinfo
  7563. Show a line containing various information for each input video frame.
  7564. The input video is not modified.
  7565. The shown line contains a sequence of key/value pairs of the form
  7566. @var{key}:@var{value}.
  7567. The following values are shown in the output:
  7568. @table @option
  7569. @item n
  7570. The (sequential) number of the input frame, starting from 0.
  7571. @item pts
  7572. The Presentation TimeStamp of the input frame, expressed as a number of
  7573. time base units. The time base unit depends on the filter input pad.
  7574. @item pts_time
  7575. The Presentation TimeStamp of the input frame, expressed as a number of
  7576. seconds.
  7577. @item pos
  7578. The position of the frame in the input stream, or -1 if this information is
  7579. unavailable and/or meaningless (for example in case of synthetic video).
  7580. @item fmt
  7581. The pixel format name.
  7582. @item sar
  7583. The sample aspect ratio of the input frame, expressed in the form
  7584. @var{num}/@var{den}.
  7585. @item s
  7586. The size of the input frame. For the syntax of this option, check the
  7587. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7588. @item i
  7589. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  7590. for bottom field first).
  7591. @item iskey
  7592. This is 1 if the frame is a key frame, 0 otherwise.
  7593. @item type
  7594. The picture type of the input frame ("I" for an I-frame, "P" for a
  7595. P-frame, "B" for a B-frame, or "?" for an unknown type).
  7596. Also refer to the documentation of the @code{AVPictureType} enum and of
  7597. the @code{av_get_picture_type_char} function defined in
  7598. @file{libavutil/avutil.h}.
  7599. @item checksum
  7600. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  7601. @item plane_checksum
  7602. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  7603. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  7604. @end table
  7605. @section showpalette
  7606. Displays the 256 colors palette of each frame. This filter is only relevant for
  7607. @var{pal8} pixel format frames.
  7608. It accepts the following option:
  7609. @table @option
  7610. @item s
  7611. Set the size of the box used to represent one palette color entry. Default is
  7612. @code{30} (for a @code{30x30} pixel box).
  7613. @end table
  7614. @section shuffleplanes
  7615. Reorder and/or duplicate video planes.
  7616. It accepts the following parameters:
  7617. @table @option
  7618. @item map0
  7619. The index of the input plane to be used as the first output plane.
  7620. @item map1
  7621. The index of the input plane to be used as the second output plane.
  7622. @item map2
  7623. The index of the input plane to be used as the third output plane.
  7624. @item map3
  7625. The index of the input plane to be used as the fourth output plane.
  7626. @end table
  7627. The first plane has the index 0. The default is to keep the input unchanged.
  7628. Swap the second and third planes of the input:
  7629. @example
  7630. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  7631. @end example
  7632. @anchor{signalstats}
  7633. @section signalstats
  7634. Evaluate various visual metrics that assist in determining issues associated
  7635. with the digitization of analog video media.
  7636. By default the filter will log these metadata values:
  7637. @table @option
  7638. @item YMIN
  7639. Display the minimal Y value contained within the input frame. Expressed in
  7640. range of [0-255].
  7641. @item YLOW
  7642. Display the Y value at the 10% percentile within the input frame. Expressed in
  7643. range of [0-255].
  7644. @item YAVG
  7645. Display the average Y value within the input frame. Expressed in range of
  7646. [0-255].
  7647. @item YHIGH
  7648. Display the Y value at the 90% percentile within the input frame. Expressed in
  7649. range of [0-255].
  7650. @item YMAX
  7651. Display the maximum Y value contained within the input frame. Expressed in
  7652. range of [0-255].
  7653. @item UMIN
  7654. Display the minimal U value contained within the input frame. Expressed in
  7655. range of [0-255].
  7656. @item ULOW
  7657. Display the U value at the 10% percentile within the input frame. Expressed in
  7658. range of [0-255].
  7659. @item UAVG
  7660. Display the average U value within the input frame. Expressed in range of
  7661. [0-255].
  7662. @item UHIGH
  7663. Display the U value at the 90% percentile within the input frame. Expressed in
  7664. range of [0-255].
  7665. @item UMAX
  7666. Display the maximum U value contained within the input frame. Expressed in
  7667. range of [0-255].
  7668. @item VMIN
  7669. Display the minimal V value contained within the input frame. Expressed in
  7670. range of [0-255].
  7671. @item VLOW
  7672. Display the V value at the 10% percentile within the input frame. Expressed in
  7673. range of [0-255].
  7674. @item VAVG
  7675. Display the average V value within the input frame. Expressed in range of
  7676. [0-255].
  7677. @item VHIGH
  7678. Display the V value at the 90% percentile within the input frame. Expressed in
  7679. range of [0-255].
  7680. @item VMAX
  7681. Display the maximum V value contained within the input frame. Expressed in
  7682. range of [0-255].
  7683. @item SATMIN
  7684. Display the minimal saturation value contained within the input frame.
  7685. Expressed in range of [0-~181.02].
  7686. @item SATLOW
  7687. Display the saturation value at the 10% percentile within the input frame.
  7688. Expressed in range of [0-~181.02].
  7689. @item SATAVG
  7690. Display the average saturation value within the input frame. Expressed in range
  7691. of [0-~181.02].
  7692. @item SATHIGH
  7693. Display the saturation value at the 90% percentile within the input frame.
  7694. Expressed in range of [0-~181.02].
  7695. @item SATMAX
  7696. Display the maximum saturation value contained within the input frame.
  7697. Expressed in range of [0-~181.02].
  7698. @item HUEMED
  7699. Display the median value for hue within the input frame. Expressed in range of
  7700. [0-360].
  7701. @item HUEAVG
  7702. Display the average value for hue within the input frame. Expressed in range of
  7703. [0-360].
  7704. @item YDIF
  7705. Display the average of sample value difference between all values of the Y
  7706. plane in the current frame and corresponding values of the previous input frame.
  7707. Expressed in range of [0-255].
  7708. @item UDIF
  7709. Display the average of sample value difference between all values of the U
  7710. plane in the current frame and corresponding values of the previous input frame.
  7711. Expressed in range of [0-255].
  7712. @item VDIF
  7713. Display the average of sample value difference between all values of the V
  7714. plane in the current frame and corresponding values of the previous input frame.
  7715. Expressed in range of [0-255].
  7716. @end table
  7717. The filter accepts the following options:
  7718. @table @option
  7719. @item stat
  7720. @item out
  7721. @option{stat} specify an additional form of image analysis.
  7722. @option{out} output video with the specified type of pixel highlighted.
  7723. Both options accept the following values:
  7724. @table @samp
  7725. @item tout
  7726. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  7727. unlike the neighboring pixels of the same field. Examples of temporal outliers
  7728. include the results of video dropouts, head clogs, or tape tracking issues.
  7729. @item vrep
  7730. Identify @var{vertical line repetition}. Vertical line repetition includes
  7731. similar rows of pixels within a frame. In born-digital video vertical line
  7732. repetition is common, but this pattern is uncommon in video digitized from an
  7733. analog source. When it occurs in video that results from the digitization of an
  7734. analog source it can indicate concealment from a dropout compensator.
  7735. @item brng
  7736. Identify pixels that fall outside of legal broadcast range.
  7737. @end table
  7738. @item color, c
  7739. Set the highlight color for the @option{out} option. The default color is
  7740. yellow.
  7741. @end table
  7742. @subsection Examples
  7743. @itemize
  7744. @item
  7745. Output data of various video metrics:
  7746. @example
  7747. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  7748. @end example
  7749. @item
  7750. Output specific data about the minimum and maximum values of the Y plane per frame:
  7751. @example
  7752. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  7753. @end example
  7754. @item
  7755. Playback video while highlighting pixels that are outside of broadcast range in red.
  7756. @example
  7757. ffplay example.mov -vf signalstats="out=brng:color=red"
  7758. @end example
  7759. @item
  7760. Playback video with signalstats metadata drawn over the frame.
  7761. @example
  7762. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  7763. @end example
  7764. The contents of signalstat_drawtext.txt used in the command are:
  7765. @example
  7766. time %@{pts:hms@}
  7767. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  7768. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  7769. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  7770. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  7771. @end example
  7772. @end itemize
  7773. @anchor{smartblur}
  7774. @section smartblur
  7775. Blur the input video without impacting the outlines.
  7776. It accepts the following options:
  7777. @table @option
  7778. @item luma_radius, lr
  7779. Set the luma radius. The option value must be a float number in
  7780. the range [0.1,5.0] that specifies the variance of the gaussian filter
  7781. used to blur the image (slower if larger). Default value is 1.0.
  7782. @item luma_strength, ls
  7783. Set the luma strength. The option value must be a float number
  7784. in the range [-1.0,1.0] that configures the blurring. A value included
  7785. in [0.0,1.0] will blur the image whereas a value included in
  7786. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  7787. @item luma_threshold, lt
  7788. Set the luma threshold used as a coefficient to determine
  7789. whether a pixel should be blurred or not. The option value must be an
  7790. integer in the range [-30,30]. A value of 0 will filter all the image,
  7791. a value included in [0,30] will filter flat areas and a value included
  7792. in [-30,0] will filter edges. Default value is 0.
  7793. @item chroma_radius, cr
  7794. Set the chroma radius. The option value must be a float number in
  7795. the range [0.1,5.0] that specifies the variance of the gaussian filter
  7796. used to blur the image (slower if larger). Default value is 1.0.
  7797. @item chroma_strength, cs
  7798. Set the chroma strength. The option value must be a float number
  7799. in the range [-1.0,1.0] that configures the blurring. A value included
  7800. in [0.0,1.0] will blur the image whereas a value included in
  7801. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  7802. @item chroma_threshold, ct
  7803. Set the chroma threshold used as a coefficient to determine
  7804. whether a pixel should be blurred or not. The option value must be an
  7805. integer in the range [-30,30]. A value of 0 will filter all the image,
  7806. a value included in [0,30] will filter flat areas and a value included
  7807. in [-30,0] will filter edges. Default value is 0.
  7808. @end table
  7809. If a chroma option is not explicitly set, the corresponding luma value
  7810. is set.
  7811. @section ssim
  7812. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  7813. This filter takes in input two input videos, the first input is
  7814. considered the "main" source and is passed unchanged to the
  7815. output. The second input is used as a "reference" video for computing
  7816. the SSIM.
  7817. Both video inputs must have the same resolution and pixel format for
  7818. this filter to work correctly. Also it assumes that both inputs
  7819. have the same number of frames, which are compared one by one.
  7820. The filter stores the calculated SSIM of each frame.
  7821. The description of the accepted parameters follows.
  7822. @table @option
  7823. @item stats_file, f
  7824. If specified the filter will use the named file to save the SSIM of
  7825. each individual frame.
  7826. @end table
  7827. The file printed if @var{stats_file} is selected, contains a sequence of
  7828. key/value pairs of the form @var{key}:@var{value} for each compared
  7829. couple of frames.
  7830. A description of each shown parameter follows:
  7831. @table @option
  7832. @item n
  7833. sequential number of the input frame, starting from 1
  7834. @item Y, U, V, R, G, B
  7835. SSIM of the compared frames for the component specified by the suffix.
  7836. @item All
  7837. SSIM of the compared frames for the whole frame.
  7838. @item dB
  7839. Same as above but in dB representation.
  7840. @end table
  7841. For example:
  7842. @example
  7843. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7844. [main][ref] ssim="stats_file=stats.log" [out]
  7845. @end example
  7846. On this example the input file being processed is compared with the
  7847. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  7848. is stored in @file{stats.log}.
  7849. Another example with both psnr and ssim at same time:
  7850. @example
  7851. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  7852. @end example
  7853. @section stereo3d
  7854. Convert between different stereoscopic image formats.
  7855. The filters accept the following options:
  7856. @table @option
  7857. @item in
  7858. Set stereoscopic image format of input.
  7859. Available values for input image formats are:
  7860. @table @samp
  7861. @item sbsl
  7862. side by side parallel (left eye left, right eye right)
  7863. @item sbsr
  7864. side by side crosseye (right eye left, left eye right)
  7865. @item sbs2l
  7866. side by side parallel with half width resolution
  7867. (left eye left, right eye right)
  7868. @item sbs2r
  7869. side by side crosseye with half width resolution
  7870. (right eye left, left eye right)
  7871. @item abl
  7872. above-below (left eye above, right eye below)
  7873. @item abr
  7874. above-below (right eye above, left eye below)
  7875. @item ab2l
  7876. above-below with half height resolution
  7877. (left eye above, right eye below)
  7878. @item ab2r
  7879. above-below with half height resolution
  7880. (right eye above, left eye below)
  7881. @item al
  7882. alternating frames (left eye first, right eye second)
  7883. @item ar
  7884. alternating frames (right eye first, left eye second)
  7885. @item irl
  7886. interleaved rows (left eye has top row, right eye starts on next row)
  7887. @item irr
  7888. interleaved rows (right eye has top row, left eye starts on next row)
  7889. Default value is @samp{sbsl}.
  7890. @end table
  7891. @item out
  7892. Set stereoscopic image format of output.
  7893. Available values for output image formats are all the input formats as well as:
  7894. @table @samp
  7895. @item arbg
  7896. anaglyph red/blue gray
  7897. (red filter on left eye, blue filter on right eye)
  7898. @item argg
  7899. anaglyph red/green gray
  7900. (red filter on left eye, green filter on right eye)
  7901. @item arcg
  7902. anaglyph red/cyan gray
  7903. (red filter on left eye, cyan filter on right eye)
  7904. @item arch
  7905. anaglyph red/cyan half colored
  7906. (red filter on left eye, cyan filter on right eye)
  7907. @item arcc
  7908. anaglyph red/cyan color
  7909. (red filter on left eye, cyan filter on right eye)
  7910. @item arcd
  7911. anaglyph red/cyan color optimized with the least squares projection of dubois
  7912. (red filter on left eye, cyan filter on right eye)
  7913. @item agmg
  7914. anaglyph green/magenta gray
  7915. (green filter on left eye, magenta filter on right eye)
  7916. @item agmh
  7917. anaglyph green/magenta half colored
  7918. (green filter on left eye, magenta filter on right eye)
  7919. @item agmc
  7920. anaglyph green/magenta colored
  7921. (green filter on left eye, magenta filter on right eye)
  7922. @item agmd
  7923. anaglyph green/magenta color optimized with the least squares projection of dubois
  7924. (green filter on left eye, magenta filter on right eye)
  7925. @item aybg
  7926. anaglyph yellow/blue gray
  7927. (yellow filter on left eye, blue filter on right eye)
  7928. @item aybh
  7929. anaglyph yellow/blue half colored
  7930. (yellow filter on left eye, blue filter on right eye)
  7931. @item aybc
  7932. anaglyph yellow/blue colored
  7933. (yellow filter on left eye, blue filter on right eye)
  7934. @item aybd
  7935. anaglyph yellow/blue color optimized with the least squares projection of dubois
  7936. (yellow filter on left eye, blue filter on right eye)
  7937. @item ml
  7938. mono output (left eye only)
  7939. @item mr
  7940. mono output (right eye only)
  7941. @item chl
  7942. checkerboard, left eye first
  7943. @item chr
  7944. checkerboard, right eye first
  7945. @item icl
  7946. interleaved columns, left eye first
  7947. @item icr
  7948. interleaved columns, right eye first
  7949. @end table
  7950. Default value is @samp{arcd}.
  7951. @end table
  7952. @subsection Examples
  7953. @itemize
  7954. @item
  7955. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  7956. @example
  7957. stereo3d=sbsl:aybd
  7958. @end example
  7959. @item
  7960. Convert input video from above bellow (left eye above, right eye below) to side by side crosseye.
  7961. @example
  7962. stereo3d=abl:sbsr
  7963. @end example
  7964. @end itemize
  7965. @anchor{spp}
  7966. @section spp
  7967. Apply a simple postprocessing filter that compresses and decompresses the image
  7968. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  7969. and average the results.
  7970. The filter accepts the following options:
  7971. @table @option
  7972. @item quality
  7973. Set quality. This option defines the number of levels for averaging. It accepts
  7974. an integer in the range 0-6. If set to @code{0}, the filter will have no
  7975. effect. A value of @code{6} means the higher quality. For each increment of
  7976. that value the speed drops by a factor of approximately 2. Default value is
  7977. @code{3}.
  7978. @item qp
  7979. Force a constant quantization parameter. If not set, the filter will use the QP
  7980. from the video stream (if available).
  7981. @item mode
  7982. Set thresholding mode. Available modes are:
  7983. @table @samp
  7984. @item hard
  7985. Set hard thresholding (default).
  7986. @item soft
  7987. Set soft thresholding (better de-ringing effect, but likely blurrier).
  7988. @end table
  7989. @item use_bframe_qp
  7990. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7991. option may cause flicker since the B-Frames have often larger QP. Default is
  7992. @code{0} (not enabled).
  7993. @end table
  7994. @anchor{subtitles}
  7995. @section subtitles
  7996. Draw subtitles on top of input video using the libass library.
  7997. To enable compilation of this filter you need to configure FFmpeg with
  7998. @code{--enable-libass}. This filter also requires a build with libavcodec and
  7999. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  8000. Alpha) subtitles format.
  8001. The filter accepts the following options:
  8002. @table @option
  8003. @item filename, f
  8004. Set the filename of the subtitle file to read. It must be specified.
  8005. @item original_size
  8006. Specify the size of the original video, the video for which the ASS file
  8007. was composed. For the syntax of this option, check the
  8008. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8009. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  8010. correctly scale the fonts if the aspect ratio has been changed.
  8011. @item fontsdir
  8012. Set a directory path containing fonts that can be used by the filter.
  8013. These fonts will be used in addition to whatever the font provider uses.
  8014. @item charenc
  8015. Set subtitles input character encoding. @code{subtitles} filter only. Only
  8016. useful if not UTF-8.
  8017. @item stream_index, si
  8018. Set subtitles stream index. @code{subtitles} filter only.
  8019. @item force_style
  8020. Override default style or script info parameters of the subtitles. It accepts a
  8021. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  8022. @end table
  8023. If the first key is not specified, it is assumed that the first value
  8024. specifies the @option{filename}.
  8025. For example, to render the file @file{sub.srt} on top of the input
  8026. video, use the command:
  8027. @example
  8028. subtitles=sub.srt
  8029. @end example
  8030. which is equivalent to:
  8031. @example
  8032. subtitles=filename=sub.srt
  8033. @end example
  8034. To render the default subtitles stream from file @file{video.mkv}, use:
  8035. @example
  8036. subtitles=video.mkv
  8037. @end example
  8038. To render the second subtitles stream from that file, use:
  8039. @example
  8040. subtitles=video.mkv:si=1
  8041. @end example
  8042. To make the subtitles stream from @file{sub.srt} appear in transparent green
  8043. @code{DejaVu Serif}, use:
  8044. @example
  8045. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  8046. @end example
  8047. @section super2xsai
  8048. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  8049. Interpolate) pixel art scaling algorithm.
  8050. Useful for enlarging pixel art images without reducing sharpness.
  8051. @section swapuv
  8052. Swap U & V plane.
  8053. @section telecine
  8054. Apply telecine process to the video.
  8055. This filter accepts the following options:
  8056. @table @option
  8057. @item first_field
  8058. @table @samp
  8059. @item top, t
  8060. top field first
  8061. @item bottom, b
  8062. bottom field first
  8063. The default value is @code{top}.
  8064. @end table
  8065. @item pattern
  8066. A string of numbers representing the pulldown pattern you wish to apply.
  8067. The default value is @code{23}.
  8068. @end table
  8069. @example
  8070. Some typical patterns:
  8071. NTSC output (30i):
  8072. 27.5p: 32222
  8073. 24p: 23 (classic)
  8074. 24p: 2332 (preferred)
  8075. 20p: 33
  8076. 18p: 334
  8077. 16p: 3444
  8078. PAL output (25i):
  8079. 27.5p: 12222
  8080. 24p: 222222222223 ("Euro pulldown")
  8081. 16.67p: 33
  8082. 16p: 33333334
  8083. @end example
  8084. @section thumbnail
  8085. Select the most representative frame in a given sequence of consecutive frames.
  8086. The filter accepts the following options:
  8087. @table @option
  8088. @item n
  8089. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  8090. will pick one of them, and then handle the next batch of @var{n} frames until
  8091. the end. Default is @code{100}.
  8092. @end table
  8093. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  8094. value will result in a higher memory usage, so a high value is not recommended.
  8095. @subsection Examples
  8096. @itemize
  8097. @item
  8098. Extract one picture each 50 frames:
  8099. @example
  8100. thumbnail=50
  8101. @end example
  8102. @item
  8103. Complete example of a thumbnail creation with @command{ffmpeg}:
  8104. @example
  8105. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  8106. @end example
  8107. @end itemize
  8108. @section tile
  8109. Tile several successive frames together.
  8110. The filter accepts the following options:
  8111. @table @option
  8112. @item layout
  8113. Set the grid size (i.e. the number of lines and columns). For the syntax of
  8114. this option, check the
  8115. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8116. @item nb_frames
  8117. Set the maximum number of frames to render in the given area. It must be less
  8118. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  8119. the area will be used.
  8120. @item margin
  8121. Set the outer border margin in pixels.
  8122. @item padding
  8123. Set the inner border thickness (i.e. the number of pixels between frames). For
  8124. more advanced padding options (such as having different values for the edges),
  8125. refer to the pad video filter.
  8126. @item color
  8127. Specify the color of the unused area. For the syntax of this option, check the
  8128. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  8129. is "black".
  8130. @end table
  8131. @subsection Examples
  8132. @itemize
  8133. @item
  8134. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  8135. @example
  8136. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  8137. @end example
  8138. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  8139. duplicating each output frame to accommodate the originally detected frame
  8140. rate.
  8141. @item
  8142. Display @code{5} pictures in an area of @code{3x2} frames,
  8143. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  8144. mixed flat and named options:
  8145. @example
  8146. tile=3x2:nb_frames=5:padding=7:margin=2
  8147. @end example
  8148. @end itemize
  8149. @section tinterlace
  8150. Perform various types of temporal field interlacing.
  8151. Frames are counted starting from 1, so the first input frame is
  8152. considered odd.
  8153. The filter accepts the following options:
  8154. @table @option
  8155. @item mode
  8156. Specify the mode of the interlacing. This option can also be specified
  8157. as a value alone. See below for a list of values for this option.
  8158. Available values are:
  8159. @table @samp
  8160. @item merge, 0
  8161. Move odd frames into the upper field, even into the lower field,
  8162. generating a double height frame at half frame rate.
  8163. @example
  8164. ------> time
  8165. Input:
  8166. Frame 1 Frame 2 Frame 3 Frame 4
  8167. 11111 22222 33333 44444
  8168. 11111 22222 33333 44444
  8169. 11111 22222 33333 44444
  8170. 11111 22222 33333 44444
  8171. Output:
  8172. 11111 33333
  8173. 22222 44444
  8174. 11111 33333
  8175. 22222 44444
  8176. 11111 33333
  8177. 22222 44444
  8178. 11111 33333
  8179. 22222 44444
  8180. @end example
  8181. @item drop_odd, 1
  8182. Only output even frames, odd frames are dropped, generating a frame with
  8183. unchanged height at half frame rate.
  8184. @example
  8185. ------> time
  8186. Input:
  8187. Frame 1 Frame 2 Frame 3 Frame 4
  8188. 11111 22222 33333 44444
  8189. 11111 22222 33333 44444
  8190. 11111 22222 33333 44444
  8191. 11111 22222 33333 44444
  8192. Output:
  8193. 22222 44444
  8194. 22222 44444
  8195. 22222 44444
  8196. 22222 44444
  8197. @end example
  8198. @item drop_even, 2
  8199. Only output odd frames, even frames are dropped, generating a frame with
  8200. unchanged height at half frame rate.
  8201. @example
  8202. ------> time
  8203. Input:
  8204. Frame 1 Frame 2 Frame 3 Frame 4
  8205. 11111 22222 33333 44444
  8206. 11111 22222 33333 44444
  8207. 11111 22222 33333 44444
  8208. 11111 22222 33333 44444
  8209. Output:
  8210. 11111 33333
  8211. 11111 33333
  8212. 11111 33333
  8213. 11111 33333
  8214. @end example
  8215. @item pad, 3
  8216. Expand each frame to full height, but pad alternate lines with black,
  8217. generating a frame with double height at the same input frame rate.
  8218. @example
  8219. ------> time
  8220. Input:
  8221. Frame 1 Frame 2 Frame 3 Frame 4
  8222. 11111 22222 33333 44444
  8223. 11111 22222 33333 44444
  8224. 11111 22222 33333 44444
  8225. 11111 22222 33333 44444
  8226. Output:
  8227. 11111 ..... 33333 .....
  8228. ..... 22222 ..... 44444
  8229. 11111 ..... 33333 .....
  8230. ..... 22222 ..... 44444
  8231. 11111 ..... 33333 .....
  8232. ..... 22222 ..... 44444
  8233. 11111 ..... 33333 .....
  8234. ..... 22222 ..... 44444
  8235. @end example
  8236. @item interleave_top, 4
  8237. Interleave the upper field from odd frames with the lower field from
  8238. even frames, generating a frame with unchanged height at half frame rate.
  8239. @example
  8240. ------> time
  8241. Input:
  8242. Frame 1 Frame 2 Frame 3 Frame 4
  8243. 11111<- 22222 33333<- 44444
  8244. 11111 22222<- 33333 44444<-
  8245. 11111<- 22222 33333<- 44444
  8246. 11111 22222<- 33333 44444<-
  8247. Output:
  8248. 11111 33333
  8249. 22222 44444
  8250. 11111 33333
  8251. 22222 44444
  8252. @end example
  8253. @item interleave_bottom, 5
  8254. Interleave the lower field from odd frames with the upper field from
  8255. even frames, generating a frame with unchanged height at half frame rate.
  8256. @example
  8257. ------> time
  8258. Input:
  8259. Frame 1 Frame 2 Frame 3 Frame 4
  8260. 11111 22222<- 33333 44444<-
  8261. 11111<- 22222 33333<- 44444
  8262. 11111 22222<- 33333 44444<-
  8263. 11111<- 22222 33333<- 44444
  8264. Output:
  8265. 22222 44444
  8266. 11111 33333
  8267. 22222 44444
  8268. 11111 33333
  8269. @end example
  8270. @item interlacex2, 6
  8271. Double frame rate with unchanged height. Frames are inserted each
  8272. containing the second temporal field from the previous input frame and
  8273. the first temporal field from the next input frame. This mode relies on
  8274. the top_field_first flag. Useful for interlaced video displays with no
  8275. field synchronisation.
  8276. @example
  8277. ------> time
  8278. Input:
  8279. Frame 1 Frame 2 Frame 3 Frame 4
  8280. 11111 22222 33333 44444
  8281. 11111 22222 33333 44444
  8282. 11111 22222 33333 44444
  8283. 11111 22222 33333 44444
  8284. Output:
  8285. 11111 22222 22222 33333 33333 44444 44444
  8286. 11111 11111 22222 22222 33333 33333 44444
  8287. 11111 22222 22222 33333 33333 44444 44444
  8288. 11111 11111 22222 22222 33333 33333 44444
  8289. @end example
  8290. @item mergex2, 7
  8291. Move odd frames into the upper field, even into the lower field,
  8292. generating a double height frame at same frame rate.
  8293. @example
  8294. ------> time
  8295. Input:
  8296. Frame 1 Frame 2 Frame 3 Frame 4
  8297. 11111 22222 33333 44444
  8298. 11111 22222 33333 44444
  8299. 11111 22222 33333 44444
  8300. 11111 22222 33333 44444
  8301. Output:
  8302. 11111 33333 33333 55555
  8303. 22222 22222 44444 44444
  8304. 11111 33333 33333 55555
  8305. 22222 22222 44444 44444
  8306. 11111 33333 33333 55555
  8307. 22222 22222 44444 44444
  8308. 11111 33333 33333 55555
  8309. 22222 22222 44444 44444
  8310. @end example
  8311. @end table
  8312. Numeric values are deprecated but are accepted for backward
  8313. compatibility reasons.
  8314. Default mode is @code{merge}.
  8315. @item flags
  8316. Specify flags influencing the filter process.
  8317. Available value for @var{flags} is:
  8318. @table @option
  8319. @item low_pass_filter, vlfp
  8320. Enable vertical low-pass filtering in the filter.
  8321. Vertical low-pass filtering is required when creating an interlaced
  8322. destination from a progressive source which contains high-frequency
  8323. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  8324. patterning.
  8325. Vertical low-pass filtering can only be enabled for @option{mode}
  8326. @var{interleave_top} and @var{interleave_bottom}.
  8327. @end table
  8328. @end table
  8329. @section transpose
  8330. Transpose rows with columns in the input video and optionally flip it.
  8331. It accepts the following parameters:
  8332. @table @option
  8333. @item dir
  8334. Specify the transposition direction.
  8335. Can assume the following values:
  8336. @table @samp
  8337. @item 0, 4, cclock_flip
  8338. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  8339. @example
  8340. L.R L.l
  8341. . . -> . .
  8342. l.r R.r
  8343. @end example
  8344. @item 1, 5, clock
  8345. Rotate by 90 degrees clockwise, that is:
  8346. @example
  8347. L.R l.L
  8348. . . -> . .
  8349. l.r r.R
  8350. @end example
  8351. @item 2, 6, cclock
  8352. Rotate by 90 degrees counterclockwise, that is:
  8353. @example
  8354. L.R R.r
  8355. . . -> . .
  8356. l.r L.l
  8357. @end example
  8358. @item 3, 7, clock_flip
  8359. Rotate by 90 degrees clockwise and vertically flip, that is:
  8360. @example
  8361. L.R r.R
  8362. . . -> . .
  8363. l.r l.L
  8364. @end example
  8365. @end table
  8366. For values between 4-7, the transposition is only done if the input
  8367. video geometry is portrait and not landscape. These values are
  8368. deprecated, the @code{passthrough} option should be used instead.
  8369. Numerical values are deprecated, and should be dropped in favor of
  8370. symbolic constants.
  8371. @item passthrough
  8372. Do not apply the transposition if the input geometry matches the one
  8373. specified by the specified value. It accepts the following values:
  8374. @table @samp
  8375. @item none
  8376. Always apply transposition.
  8377. @item portrait
  8378. Preserve portrait geometry (when @var{height} >= @var{width}).
  8379. @item landscape
  8380. Preserve landscape geometry (when @var{width} >= @var{height}).
  8381. @end table
  8382. Default value is @code{none}.
  8383. @end table
  8384. For example to rotate by 90 degrees clockwise and preserve portrait
  8385. layout:
  8386. @example
  8387. transpose=dir=1:passthrough=portrait
  8388. @end example
  8389. The command above can also be specified as:
  8390. @example
  8391. transpose=1:portrait
  8392. @end example
  8393. @section trim
  8394. Trim the input so that the output contains one continuous subpart of the input.
  8395. It accepts the following parameters:
  8396. @table @option
  8397. @item start
  8398. Specify the time of the start of the kept section, i.e. the frame with the
  8399. timestamp @var{start} will be the first frame in the output.
  8400. @item end
  8401. Specify the time of the first frame that will be dropped, i.e. the frame
  8402. immediately preceding the one with the timestamp @var{end} will be the last
  8403. frame in the output.
  8404. @item start_pts
  8405. This is the same as @var{start}, except this option sets the start timestamp
  8406. in timebase units instead of seconds.
  8407. @item end_pts
  8408. This is the same as @var{end}, except this option sets the end timestamp
  8409. in timebase units instead of seconds.
  8410. @item duration
  8411. The maximum duration of the output in seconds.
  8412. @item start_frame
  8413. The number of the first frame that should be passed to the output.
  8414. @item end_frame
  8415. The number of the first frame that should be dropped.
  8416. @end table
  8417. @option{start}, @option{end}, and @option{duration} are expressed as time
  8418. duration specifications; see
  8419. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  8420. for the accepted syntax.
  8421. Note that the first two sets of the start/end options and the @option{duration}
  8422. option look at the frame timestamp, while the _frame variants simply count the
  8423. frames that pass through the filter. Also note that this filter does not modify
  8424. the timestamps. If you wish for the output timestamps to start at zero, insert a
  8425. setpts filter after the trim filter.
  8426. If multiple start or end options are set, this filter tries to be greedy and
  8427. keep all the frames that match at least one of the specified constraints. To keep
  8428. only the part that matches all the constraints at once, chain multiple trim
  8429. filters.
  8430. The defaults are such that all the input is kept. So it is possible to set e.g.
  8431. just the end values to keep everything before the specified time.
  8432. Examples:
  8433. @itemize
  8434. @item
  8435. Drop everything except the second minute of input:
  8436. @example
  8437. ffmpeg -i INPUT -vf trim=60:120
  8438. @end example
  8439. @item
  8440. Keep only the first second:
  8441. @example
  8442. ffmpeg -i INPUT -vf trim=duration=1
  8443. @end example
  8444. @end itemize
  8445. @anchor{unsharp}
  8446. @section unsharp
  8447. Sharpen or blur the input video.
  8448. It accepts the following parameters:
  8449. @table @option
  8450. @item luma_msize_x, lx
  8451. Set the luma matrix horizontal size. It must be an odd integer between
  8452. 3 and 63. The default value is 5.
  8453. @item luma_msize_y, ly
  8454. Set the luma matrix vertical size. It must be an odd integer between 3
  8455. and 63. The default value is 5.
  8456. @item luma_amount, la
  8457. Set the luma effect strength. It must be a floating point number, reasonable
  8458. values lay between -1.5 and 1.5.
  8459. Negative values will blur the input video, while positive values will
  8460. sharpen it, a value of zero will disable the effect.
  8461. Default value is 1.0.
  8462. @item chroma_msize_x, cx
  8463. Set the chroma matrix horizontal size. It must be an odd integer
  8464. between 3 and 63. The default value is 5.
  8465. @item chroma_msize_y, cy
  8466. Set the chroma matrix vertical size. It must be an odd integer
  8467. between 3 and 63. The default value is 5.
  8468. @item chroma_amount, ca
  8469. Set the chroma effect strength. It must be a floating point number, reasonable
  8470. values lay between -1.5 and 1.5.
  8471. Negative values will blur the input video, while positive values will
  8472. sharpen it, a value of zero will disable the effect.
  8473. Default value is 0.0.
  8474. @item opencl
  8475. If set to 1, specify using OpenCL capabilities, only available if
  8476. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  8477. @end table
  8478. All parameters are optional and default to the equivalent of the
  8479. string '5:5:1.0:5:5:0.0'.
  8480. @subsection Examples
  8481. @itemize
  8482. @item
  8483. Apply strong luma sharpen effect:
  8484. @example
  8485. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  8486. @end example
  8487. @item
  8488. Apply a strong blur of both luma and chroma parameters:
  8489. @example
  8490. unsharp=7:7:-2:7:7:-2
  8491. @end example
  8492. @end itemize
  8493. @section uspp
  8494. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  8495. the image at several (or - in the case of @option{quality} level @code{8} - all)
  8496. shifts and average the results.
  8497. The way this differs from the behavior of spp is that uspp actually encodes &
  8498. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  8499. DCT similar to MJPEG.
  8500. The filter accepts the following options:
  8501. @table @option
  8502. @item quality
  8503. Set quality. This option defines the number of levels for averaging. It accepts
  8504. an integer in the range 0-8. If set to @code{0}, the filter will have no
  8505. effect. A value of @code{8} means the higher quality. For each increment of
  8506. that value the speed drops by a factor of approximately 2. Default value is
  8507. @code{3}.
  8508. @item qp
  8509. Force a constant quantization parameter. If not set, the filter will use the QP
  8510. from the video stream (if available).
  8511. @end table
  8512. @section vectorscope
  8513. Display 2 color component values in the two dimensional graph (which is called
  8514. a vectorscope).
  8515. This filter accepts the following options:
  8516. @table @option
  8517. @item mode, m
  8518. Set vectorscope mode.
  8519. It accepts the following values:
  8520. @table @samp
  8521. @item gray
  8522. Gray values are displayed on graph, higher brightness means more pixels have
  8523. same component color value on location in graph. This is the default mode.
  8524. @item color
  8525. Gray values are displayed on graph. Surrounding pixels values which are not
  8526. present in video frame are drawn in gradient of 2 color components which are
  8527. set by option @code{x} and @code{y}.
  8528. @item color2
  8529. Actual color components values present in video frame are displayed on graph.
  8530. @item color3
  8531. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  8532. on graph increases value of another color component, which is luminance by
  8533. default values of @code{x} and @code{y}.
  8534. @item color4
  8535. Actual colors present in video frame are displayed on graph. If two different
  8536. colors map to same position on graph then color with higher value of component
  8537. not present in graph is picked.
  8538. @end table
  8539. @item x
  8540. Set which color component will be represented on X-axis. Default is @code{1}.
  8541. @item y
  8542. Set which color component will be represented on Y-axis. Default is @code{2}.
  8543. @item intensity, i
  8544. Set intensity, used by modes: gray, color and color3 for increasing brightness
  8545. of color component which represents frequency of (X, Y) location in graph.
  8546. @item envelope, e
  8547. @table @samp
  8548. @item none
  8549. No envelope, this is default.
  8550. @item instant
  8551. Instant envelope, even darkest single pixel will be clearly highlighted.
  8552. @item peak
  8553. Hold maximum and minimum values presented in graph over time. This way you
  8554. can still spot out of range values without constantly looking at vectorscope.
  8555. @item peak+instant
  8556. Peak and instant envelope combined together.
  8557. @end table
  8558. @end table
  8559. @anchor{vidstabdetect}
  8560. @section vidstabdetect
  8561. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  8562. @ref{vidstabtransform} for pass 2.
  8563. This filter generates a file with relative translation and rotation
  8564. transform information about subsequent frames, which is then used by
  8565. the @ref{vidstabtransform} filter.
  8566. To enable compilation of this filter you need to configure FFmpeg with
  8567. @code{--enable-libvidstab}.
  8568. This filter accepts the following options:
  8569. @table @option
  8570. @item result
  8571. Set the path to the file used to write the transforms information.
  8572. Default value is @file{transforms.trf}.
  8573. @item shakiness
  8574. Set how shaky the video is and how quick the camera is. It accepts an
  8575. integer in the range 1-10, a value of 1 means little shakiness, a
  8576. value of 10 means strong shakiness. Default value is 5.
  8577. @item accuracy
  8578. Set the accuracy of the detection process. It must be a value in the
  8579. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  8580. accuracy. Default value is 15.
  8581. @item stepsize
  8582. Set stepsize of the search process. The region around minimum is
  8583. scanned with 1 pixel resolution. Default value is 6.
  8584. @item mincontrast
  8585. Set minimum contrast. Below this value a local measurement field is
  8586. discarded. Must be a floating point value in the range 0-1. Default
  8587. value is 0.3.
  8588. @item tripod
  8589. Set reference frame number for tripod mode.
  8590. If enabled, the motion of the frames is compared to a reference frame
  8591. in the filtered stream, identified by the specified number. The idea
  8592. is to compensate all movements in a more-or-less static scene and keep
  8593. the camera view absolutely still.
  8594. If set to 0, it is disabled. The frames are counted starting from 1.
  8595. @item show
  8596. Show fields and transforms in the resulting frames. It accepts an
  8597. integer in the range 0-2. Default value is 0, which disables any
  8598. visualization.
  8599. @end table
  8600. @subsection Examples
  8601. @itemize
  8602. @item
  8603. Use default values:
  8604. @example
  8605. vidstabdetect
  8606. @end example
  8607. @item
  8608. Analyze strongly shaky movie and put the results in file
  8609. @file{mytransforms.trf}:
  8610. @example
  8611. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  8612. @end example
  8613. @item
  8614. Visualize the result of internal transformations in the resulting
  8615. video:
  8616. @example
  8617. vidstabdetect=show=1
  8618. @end example
  8619. @item
  8620. Analyze a video with medium shakiness using @command{ffmpeg}:
  8621. @example
  8622. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  8623. @end example
  8624. @end itemize
  8625. @anchor{vidstabtransform}
  8626. @section vidstabtransform
  8627. Video stabilization/deshaking: pass 2 of 2,
  8628. see @ref{vidstabdetect} for pass 1.
  8629. Read a file with transform information for each frame and
  8630. apply/compensate them. Together with the @ref{vidstabdetect}
  8631. filter this can be used to deshake videos. See also
  8632. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  8633. the @ref{unsharp} filter, see below.
  8634. To enable compilation of this filter you need to configure FFmpeg with
  8635. @code{--enable-libvidstab}.
  8636. @subsection Options
  8637. @table @option
  8638. @item input
  8639. Set path to the file used to read the transforms. Default value is
  8640. @file{transforms.trf}.
  8641. @item smoothing
  8642. Set the number of frames (value*2 + 1) used for lowpass filtering the
  8643. camera movements. Default value is 10.
  8644. For example a number of 10 means that 21 frames are used (10 in the
  8645. past and 10 in the future) to smoothen the motion in the video. A
  8646. larger value leads to a smoother video, but limits the acceleration of
  8647. the camera (pan/tilt movements). 0 is a special case where a static
  8648. camera is simulated.
  8649. @item optalgo
  8650. Set the camera path optimization algorithm.
  8651. Accepted values are:
  8652. @table @samp
  8653. @item gauss
  8654. gaussian kernel low-pass filter on camera motion (default)
  8655. @item avg
  8656. averaging on transformations
  8657. @end table
  8658. @item maxshift
  8659. Set maximal number of pixels to translate frames. Default value is -1,
  8660. meaning no limit.
  8661. @item maxangle
  8662. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  8663. value is -1, meaning no limit.
  8664. @item crop
  8665. Specify how to deal with borders that may be visible due to movement
  8666. compensation.
  8667. Available values are:
  8668. @table @samp
  8669. @item keep
  8670. keep image information from previous frame (default)
  8671. @item black
  8672. fill the border black
  8673. @end table
  8674. @item invert
  8675. Invert transforms if set to 1. Default value is 0.
  8676. @item relative
  8677. Consider transforms as relative to previous frame if set to 1,
  8678. absolute if set to 0. Default value is 0.
  8679. @item zoom
  8680. Set percentage to zoom. A positive value will result in a zoom-in
  8681. effect, a negative value in a zoom-out effect. Default value is 0 (no
  8682. zoom).
  8683. @item optzoom
  8684. Set optimal zooming to avoid borders.
  8685. Accepted values are:
  8686. @table @samp
  8687. @item 0
  8688. disabled
  8689. @item 1
  8690. optimal static zoom value is determined (only very strong movements
  8691. will lead to visible borders) (default)
  8692. @item 2
  8693. optimal adaptive zoom value is determined (no borders will be
  8694. visible), see @option{zoomspeed}
  8695. @end table
  8696. Note that the value given at zoom is added to the one calculated here.
  8697. @item zoomspeed
  8698. Set percent to zoom maximally each frame (enabled when
  8699. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  8700. 0.25.
  8701. @item interpol
  8702. Specify type of interpolation.
  8703. Available values are:
  8704. @table @samp
  8705. @item no
  8706. no interpolation
  8707. @item linear
  8708. linear only horizontal
  8709. @item bilinear
  8710. linear in both directions (default)
  8711. @item bicubic
  8712. cubic in both directions (slow)
  8713. @end table
  8714. @item tripod
  8715. Enable virtual tripod mode if set to 1, which is equivalent to
  8716. @code{relative=0:smoothing=0}. Default value is 0.
  8717. Use also @code{tripod} option of @ref{vidstabdetect}.
  8718. @item debug
  8719. Increase log verbosity if set to 1. Also the detected global motions
  8720. are written to the temporary file @file{global_motions.trf}. Default
  8721. value is 0.
  8722. @end table
  8723. @subsection Examples
  8724. @itemize
  8725. @item
  8726. Use @command{ffmpeg} for a typical stabilization with default values:
  8727. @example
  8728. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  8729. @end example
  8730. Note the use of the @ref{unsharp} filter which is always recommended.
  8731. @item
  8732. Zoom in a bit more and load transform data from a given file:
  8733. @example
  8734. vidstabtransform=zoom=5:input="mytransforms.trf"
  8735. @end example
  8736. @item
  8737. Smoothen the video even more:
  8738. @example
  8739. vidstabtransform=smoothing=30
  8740. @end example
  8741. @end itemize
  8742. @section vflip
  8743. Flip the input video vertically.
  8744. For example, to vertically flip a video with @command{ffmpeg}:
  8745. @example
  8746. ffmpeg -i in.avi -vf "vflip" out.avi
  8747. @end example
  8748. @anchor{vignette}
  8749. @section vignette
  8750. Make or reverse a natural vignetting effect.
  8751. The filter accepts the following options:
  8752. @table @option
  8753. @item angle, a
  8754. Set lens angle expression as a number of radians.
  8755. The value is clipped in the @code{[0,PI/2]} range.
  8756. Default value: @code{"PI/5"}
  8757. @item x0
  8758. @item y0
  8759. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  8760. by default.
  8761. @item mode
  8762. Set forward/backward mode.
  8763. Available modes are:
  8764. @table @samp
  8765. @item forward
  8766. The larger the distance from the central point, the darker the image becomes.
  8767. @item backward
  8768. The larger the distance from the central point, the brighter the image becomes.
  8769. This can be used to reverse a vignette effect, though there is no automatic
  8770. detection to extract the lens @option{angle} and other settings (yet). It can
  8771. also be used to create a burning effect.
  8772. @end table
  8773. Default value is @samp{forward}.
  8774. @item eval
  8775. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  8776. It accepts the following values:
  8777. @table @samp
  8778. @item init
  8779. Evaluate expressions only once during the filter initialization.
  8780. @item frame
  8781. Evaluate expressions for each incoming frame. This is way slower than the
  8782. @samp{init} mode since it requires all the scalers to be re-computed, but it
  8783. allows advanced dynamic expressions.
  8784. @end table
  8785. Default value is @samp{init}.
  8786. @item dither
  8787. Set dithering to reduce the circular banding effects. Default is @code{1}
  8788. (enabled).
  8789. @item aspect
  8790. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  8791. Setting this value to the SAR of the input will make a rectangular vignetting
  8792. following the dimensions of the video.
  8793. Default is @code{1/1}.
  8794. @end table
  8795. @subsection Expressions
  8796. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  8797. following parameters.
  8798. @table @option
  8799. @item w
  8800. @item h
  8801. input width and height
  8802. @item n
  8803. the number of input frame, starting from 0
  8804. @item pts
  8805. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  8806. @var{TB} units, NAN if undefined
  8807. @item r
  8808. frame rate of the input video, NAN if the input frame rate is unknown
  8809. @item t
  8810. the PTS (Presentation TimeStamp) of the filtered video frame,
  8811. expressed in seconds, NAN if undefined
  8812. @item tb
  8813. time base of the input video
  8814. @end table
  8815. @subsection Examples
  8816. @itemize
  8817. @item
  8818. Apply simple strong vignetting effect:
  8819. @example
  8820. vignette=PI/4
  8821. @end example
  8822. @item
  8823. Make a flickering vignetting:
  8824. @example
  8825. vignette='PI/4+random(1)*PI/50':eval=frame
  8826. @end example
  8827. @end itemize
  8828. @section vstack
  8829. Stack input videos vertically.
  8830. All streams must be of same pixel format and of same width.
  8831. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8832. to create same output.
  8833. The filter accept the following option:
  8834. @table @option
  8835. @item nb_inputs
  8836. Set number of input streams. Default is 2.
  8837. @end table
  8838. @section w3fdif
  8839. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  8840. Deinterlacing Filter").
  8841. Based on the process described by Martin Weston for BBC R&D, and
  8842. implemented based on the de-interlace algorithm written by Jim
  8843. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  8844. uses filter coefficients calculated by BBC R&D.
  8845. There are two sets of filter coefficients, so called "simple":
  8846. and "complex". Which set of filter coefficients is used can
  8847. be set by passing an optional parameter:
  8848. @table @option
  8849. @item filter
  8850. Set the interlacing filter coefficients. Accepts one of the following values:
  8851. @table @samp
  8852. @item simple
  8853. Simple filter coefficient set.
  8854. @item complex
  8855. More-complex filter coefficient set.
  8856. @end table
  8857. Default value is @samp{complex}.
  8858. @item deint
  8859. Specify which frames to deinterlace. Accept one of the following values:
  8860. @table @samp
  8861. @item all
  8862. Deinterlace all frames,
  8863. @item interlaced
  8864. Only deinterlace frames marked as interlaced.
  8865. @end table
  8866. Default value is @samp{all}.
  8867. @end table
  8868. @section waveform
  8869. Video waveform monitor.
  8870. The waveform monitor plots color component intensity. By default luminance
  8871. only. Each column of the waveform corresponds to a column of pixels in the
  8872. source video.
  8873. It accepts the following options:
  8874. @table @option
  8875. @item mode, m
  8876. Can be either @code{row}, or @code{column}. Default is @code{column}.
  8877. In row mode, the graph on the left side represents color component value 0 and
  8878. the right side represents value = 255. In column mode, the top side represents
  8879. color component value = 0 and bottom side represents value = 255.
  8880. @item intensity, i
  8881. Set intensity. Smaller values are useful to find out how many values of the same
  8882. luminance are distributed across input rows/columns.
  8883. Default value is @code{0.04}. Allowed range is [0, 1].
  8884. @item mirror, r
  8885. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  8886. In mirrored mode, higher values will be represented on the left
  8887. side for @code{row} mode and at the top for @code{column} mode. Default is
  8888. @code{1} (mirrored).
  8889. @item display, d
  8890. Set display mode.
  8891. It accepts the following values:
  8892. @table @samp
  8893. @item overlay
  8894. Presents information identical to that in the @code{parade}, except
  8895. that the graphs representing color components are superimposed directly
  8896. over one another.
  8897. This display mode makes it easier to spot relative differences or similarities
  8898. in overlapping areas of the color components that are supposed to be identical,
  8899. such as neutral whites, grays, or blacks.
  8900. @item parade
  8901. Display separate graph for the color components side by side in
  8902. @code{row} mode or one below the other in @code{column} mode.
  8903. Using this display mode makes it easy to spot color casts in the highlights
  8904. and shadows of an image, by comparing the contours of the top and the bottom
  8905. graphs of each waveform. Since whites, grays, and blacks are characterized
  8906. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  8907. should display three waveforms of roughly equal width/height. If not, the
  8908. correction is easy to perform by making level adjustments the three waveforms.
  8909. @end table
  8910. Default is @code{parade}.
  8911. @item components, c
  8912. Set which color components to display. Default is 1, which means only luminance
  8913. or red color component if input is in RGB colorspace. If is set for example to
  8914. 7 it will display all 3 (if) available color components.
  8915. @item envelope, e
  8916. @table @samp
  8917. @item none
  8918. No envelope, this is default.
  8919. @item instant
  8920. Instant envelope, minimum and maximum values presented in graph will be easily
  8921. visible even with small @code{step} value.
  8922. @item peak
  8923. Hold minimum and maximum values presented in graph across time. This way you
  8924. can still spot out of range values without constantly looking at waveforms.
  8925. @item peak+instant
  8926. Peak and instant envelope combined together.
  8927. @end table
  8928. @item filter, f
  8929. @table @samp
  8930. @item lowpass
  8931. No filtering, this is default.
  8932. @item flat
  8933. Luma and chroma combined together.
  8934. @item aflat
  8935. Similar as above, but shows difference between blue and red chroma.
  8936. @item chroma
  8937. Displays only chroma.
  8938. @item achroma
  8939. Similar as above, but shows difference between blue and red chroma.
  8940. @item color
  8941. Displays actual color value on waveform.
  8942. @end table
  8943. @end table
  8944. @section xbr
  8945. Apply the xBR high-quality magnification filter which is designed for pixel
  8946. art. It follows a set of edge-detection rules, see
  8947. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  8948. It accepts the following option:
  8949. @table @option
  8950. @item n
  8951. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  8952. @code{3xBR} and @code{4} for @code{4xBR}.
  8953. Default is @code{3}.
  8954. @end table
  8955. @anchor{yadif}
  8956. @section yadif
  8957. Deinterlace the input video ("yadif" means "yet another deinterlacing
  8958. filter").
  8959. It accepts the following parameters:
  8960. @table @option
  8961. @item mode
  8962. The interlacing mode to adopt. It accepts one of the following values:
  8963. @table @option
  8964. @item 0, send_frame
  8965. Output one frame for each frame.
  8966. @item 1, send_field
  8967. Output one frame for each field.
  8968. @item 2, send_frame_nospatial
  8969. Like @code{send_frame}, but it skips the spatial interlacing check.
  8970. @item 3, send_field_nospatial
  8971. Like @code{send_field}, but it skips the spatial interlacing check.
  8972. @end table
  8973. The default value is @code{send_frame}.
  8974. @item parity
  8975. The picture field parity assumed for the input interlaced video. It accepts one
  8976. of the following values:
  8977. @table @option
  8978. @item 0, tff
  8979. Assume the top field is first.
  8980. @item 1, bff
  8981. Assume the bottom field is first.
  8982. @item -1, auto
  8983. Enable automatic detection of field parity.
  8984. @end table
  8985. The default value is @code{auto}.
  8986. If the interlacing is unknown or the decoder does not export this information,
  8987. top field first will be assumed.
  8988. @item deint
  8989. Specify which frames to deinterlace. Accept one of the following
  8990. values:
  8991. @table @option
  8992. @item 0, all
  8993. Deinterlace all frames.
  8994. @item 1, interlaced
  8995. Only deinterlace frames marked as interlaced.
  8996. @end table
  8997. The default value is @code{all}.
  8998. @end table
  8999. @section zoompan
  9000. Apply Zoom & Pan effect.
  9001. This filter accepts the following options:
  9002. @table @option
  9003. @item zoom, z
  9004. Set the zoom expression. Default is 1.
  9005. @item x
  9006. @item y
  9007. Set the x and y expression. Default is 0.
  9008. @item d
  9009. Set the duration expression in number of frames.
  9010. This sets for how many number of frames effect will last for
  9011. single input image.
  9012. @item s
  9013. Set the output image size, default is 'hd720'.
  9014. @end table
  9015. Each expression can contain the following constants:
  9016. @table @option
  9017. @item in_w, iw
  9018. Input width.
  9019. @item in_h, ih
  9020. Input height.
  9021. @item out_w, ow
  9022. Output width.
  9023. @item out_h, oh
  9024. Output height.
  9025. @item in
  9026. Input frame count.
  9027. @item on
  9028. Output frame count.
  9029. @item x
  9030. @item y
  9031. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  9032. for current input frame.
  9033. @item px
  9034. @item py
  9035. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  9036. not yet such frame (first input frame).
  9037. @item zoom
  9038. Last calculated zoom from 'z' expression for current input frame.
  9039. @item pzoom
  9040. Last calculated zoom of last output frame of previous input frame.
  9041. @item duration
  9042. Number of output frames for current input frame. Calculated from 'd' expression
  9043. for each input frame.
  9044. @item pduration
  9045. number of output frames created for previous input frame
  9046. @item a
  9047. Rational number: input width / input height
  9048. @item sar
  9049. sample aspect ratio
  9050. @item dar
  9051. display aspect ratio
  9052. @end table
  9053. @subsection Examples
  9054. @itemize
  9055. @item
  9056. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  9057. @example
  9058. 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
  9059. @end example
  9060. @item
  9061. Zoom-in up to 1.5 and pan always at center of picture:
  9062. @example
  9063. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  9064. @end example
  9065. @end itemize
  9066. @c man end VIDEO FILTERS
  9067. @chapter Video Sources
  9068. @c man begin VIDEO SOURCES
  9069. Below is a description of the currently available video sources.
  9070. @section buffer
  9071. Buffer video frames, and make them available to the filter chain.
  9072. This source is mainly intended for a programmatic use, in particular
  9073. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  9074. It accepts the following parameters:
  9075. @table @option
  9076. @item video_size
  9077. Specify the size (width and height) of the buffered video frames. For the
  9078. syntax of this option, check the
  9079. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9080. @item width
  9081. The input video width.
  9082. @item height
  9083. The input video height.
  9084. @item pix_fmt
  9085. A string representing the pixel format of the buffered video frames.
  9086. It may be a number corresponding to a pixel format, or a pixel format
  9087. name.
  9088. @item time_base
  9089. Specify the timebase assumed by the timestamps of the buffered frames.
  9090. @item frame_rate
  9091. Specify the frame rate expected for the video stream.
  9092. @item pixel_aspect, sar
  9093. The sample (pixel) aspect ratio of the input video.
  9094. @item sws_param
  9095. Specify the optional parameters to be used for the scale filter which
  9096. is automatically inserted when an input change is detected in the
  9097. input size or format.
  9098. @end table
  9099. For example:
  9100. @example
  9101. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  9102. @end example
  9103. will instruct the source to accept video frames with size 320x240 and
  9104. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  9105. square pixels (1:1 sample aspect ratio).
  9106. Since the pixel format with name "yuv410p" corresponds to the number 6
  9107. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  9108. this example corresponds to:
  9109. @example
  9110. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  9111. @end example
  9112. Alternatively, the options can be specified as a flat string, but this
  9113. syntax is deprecated:
  9114. @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}]
  9115. @section cellauto
  9116. Create a pattern generated by an elementary cellular automaton.
  9117. The initial state of the cellular automaton can be defined through the
  9118. @option{filename}, and @option{pattern} options. If such options are
  9119. not specified an initial state is created randomly.
  9120. At each new frame a new row in the video is filled with the result of
  9121. the cellular automaton next generation. The behavior when the whole
  9122. frame is filled is defined by the @option{scroll} option.
  9123. This source accepts the following options:
  9124. @table @option
  9125. @item filename, f
  9126. Read the initial cellular automaton state, i.e. the starting row, from
  9127. the specified file.
  9128. In the file, each non-whitespace character is considered an alive
  9129. cell, a newline will terminate the row, and further characters in the
  9130. file will be ignored.
  9131. @item pattern, p
  9132. Read the initial cellular automaton state, i.e. the starting row, from
  9133. the specified string.
  9134. Each non-whitespace character in the string is considered an alive
  9135. cell, a newline will terminate the row, and further characters in the
  9136. string will be ignored.
  9137. @item rate, r
  9138. Set the video rate, that is the number of frames generated per second.
  9139. Default is 25.
  9140. @item random_fill_ratio, ratio
  9141. Set the random fill ratio for the initial cellular automaton row. It
  9142. is a floating point number value ranging from 0 to 1, defaults to
  9143. 1/PHI.
  9144. This option is ignored when a file or a pattern is specified.
  9145. @item random_seed, seed
  9146. Set the seed for filling randomly the initial row, must be an integer
  9147. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9148. set to -1, the filter will try to use a good random seed on a best
  9149. effort basis.
  9150. @item rule
  9151. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  9152. Default value is 110.
  9153. @item size, s
  9154. Set the size of the output video. For the syntax of this option, check the
  9155. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9156. If @option{filename} or @option{pattern} is specified, the size is set
  9157. by default to the width of the specified initial state row, and the
  9158. height is set to @var{width} * PHI.
  9159. If @option{size} is set, it must contain the width of the specified
  9160. pattern string, and the specified pattern will be centered in the
  9161. larger row.
  9162. If a filename or a pattern string is not specified, the size value
  9163. defaults to "320x518" (used for a randomly generated initial state).
  9164. @item scroll
  9165. If set to 1, scroll the output upward when all the rows in the output
  9166. have been already filled. If set to 0, the new generated row will be
  9167. written over the top row just after the bottom row is filled.
  9168. Defaults to 1.
  9169. @item start_full, full
  9170. If set to 1, completely fill the output with generated rows before
  9171. outputting the first frame.
  9172. This is the default behavior, for disabling set the value to 0.
  9173. @item stitch
  9174. If set to 1, stitch the left and right row edges together.
  9175. This is the default behavior, for disabling set the value to 0.
  9176. @end table
  9177. @subsection Examples
  9178. @itemize
  9179. @item
  9180. Read the initial state from @file{pattern}, and specify an output of
  9181. size 200x400.
  9182. @example
  9183. cellauto=f=pattern:s=200x400
  9184. @end example
  9185. @item
  9186. Generate a random initial row with a width of 200 cells, with a fill
  9187. ratio of 2/3:
  9188. @example
  9189. cellauto=ratio=2/3:s=200x200
  9190. @end example
  9191. @item
  9192. Create a pattern generated by rule 18 starting by a single alive cell
  9193. centered on an initial row with width 100:
  9194. @example
  9195. cellauto=p=@@:s=100x400:full=0:rule=18
  9196. @end example
  9197. @item
  9198. Specify a more elaborated initial pattern:
  9199. @example
  9200. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  9201. @end example
  9202. @end itemize
  9203. @section mandelbrot
  9204. Generate a Mandelbrot set fractal, and progressively zoom towards the
  9205. point specified with @var{start_x} and @var{start_y}.
  9206. This source accepts the following options:
  9207. @table @option
  9208. @item end_pts
  9209. Set the terminal pts value. Default value is 400.
  9210. @item end_scale
  9211. Set the terminal scale value.
  9212. Must be a floating point value. Default value is 0.3.
  9213. @item inner
  9214. Set the inner coloring mode, that is the algorithm used to draw the
  9215. Mandelbrot fractal internal region.
  9216. It shall assume one of the following values:
  9217. @table @option
  9218. @item black
  9219. Set black mode.
  9220. @item convergence
  9221. Show time until convergence.
  9222. @item mincol
  9223. Set color based on point closest to the origin of the iterations.
  9224. @item period
  9225. Set period mode.
  9226. @end table
  9227. Default value is @var{mincol}.
  9228. @item bailout
  9229. Set the bailout value. Default value is 10.0.
  9230. @item maxiter
  9231. Set the maximum of iterations performed by the rendering
  9232. algorithm. Default value is 7189.
  9233. @item outer
  9234. Set outer coloring mode.
  9235. It shall assume one of following values:
  9236. @table @option
  9237. @item iteration_count
  9238. Set iteration cound mode.
  9239. @item normalized_iteration_count
  9240. set normalized iteration count mode.
  9241. @end table
  9242. Default value is @var{normalized_iteration_count}.
  9243. @item rate, r
  9244. Set frame rate, expressed as number of frames per second. Default
  9245. value is "25".
  9246. @item size, s
  9247. Set frame size. For the syntax of this option, check the "Video
  9248. size" section in the ffmpeg-utils manual. Default value is "640x480".
  9249. @item start_scale
  9250. Set the initial scale value. Default value is 3.0.
  9251. @item start_x
  9252. Set the initial x position. Must be a floating point value between
  9253. -100 and 100. Default value is -0.743643887037158704752191506114774.
  9254. @item start_y
  9255. Set the initial y position. Must be a floating point value between
  9256. -100 and 100. Default value is -0.131825904205311970493132056385139.
  9257. @end table
  9258. @section mptestsrc
  9259. Generate various test patterns, as generated by the MPlayer test filter.
  9260. The size of the generated video is fixed, and is 256x256.
  9261. This source is useful in particular for testing encoding features.
  9262. This source accepts the following options:
  9263. @table @option
  9264. @item rate, r
  9265. Specify the frame rate of the sourced video, as the number of frames
  9266. generated per second. It has to be a string in the format
  9267. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9268. number or a valid video frame rate abbreviation. The default value is
  9269. "25".
  9270. @item duration, d
  9271. Set the duration of the sourced video. See
  9272. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9273. for the accepted syntax.
  9274. If not specified, or the expressed duration is negative, the video is
  9275. supposed to be generated forever.
  9276. @item test, t
  9277. Set the number or the name of the test to perform. Supported tests are:
  9278. @table @option
  9279. @item dc_luma
  9280. @item dc_chroma
  9281. @item freq_luma
  9282. @item freq_chroma
  9283. @item amp_luma
  9284. @item amp_chroma
  9285. @item cbp
  9286. @item mv
  9287. @item ring1
  9288. @item ring2
  9289. @item all
  9290. @end table
  9291. Default value is "all", which will cycle through the list of all tests.
  9292. @end table
  9293. Some examples:
  9294. @example
  9295. mptestsrc=t=dc_luma
  9296. @end example
  9297. will generate a "dc_luma" test pattern.
  9298. @section frei0r_src
  9299. Provide a frei0r source.
  9300. To enable compilation of this filter you need to install the frei0r
  9301. header and configure FFmpeg with @code{--enable-frei0r}.
  9302. This source accepts the following parameters:
  9303. @table @option
  9304. @item size
  9305. The size of the video to generate. For the syntax of this option, check the
  9306. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9307. @item framerate
  9308. The framerate of the generated video. It may be a string of the form
  9309. @var{num}/@var{den} or a frame rate abbreviation.
  9310. @item filter_name
  9311. The name to the frei0r source to load. For more information regarding frei0r and
  9312. how to set the parameters, read the @ref{frei0r} section in the video filters
  9313. documentation.
  9314. @item filter_params
  9315. A '|'-separated list of parameters to pass to the frei0r source.
  9316. @end table
  9317. For example, to generate a frei0r partik0l source with size 200x200
  9318. and frame rate 10 which is overlaid on the overlay filter main input:
  9319. @example
  9320. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  9321. @end example
  9322. @section life
  9323. Generate a life pattern.
  9324. This source is based on a generalization of John Conway's life game.
  9325. The sourced input represents a life grid, each pixel represents a cell
  9326. which can be in one of two possible states, alive or dead. Every cell
  9327. interacts with its eight neighbours, which are the cells that are
  9328. horizontally, vertically, or diagonally adjacent.
  9329. At each interaction the grid evolves according to the adopted rule,
  9330. which specifies the number of neighbor alive cells which will make a
  9331. cell stay alive or born. The @option{rule} option allows one to specify
  9332. the rule to adopt.
  9333. This source accepts the following options:
  9334. @table @option
  9335. @item filename, f
  9336. Set the file from which to read the initial grid state. In the file,
  9337. each non-whitespace character is considered an alive cell, and newline
  9338. is used to delimit the end of each row.
  9339. If this option is not specified, the initial grid is generated
  9340. randomly.
  9341. @item rate, r
  9342. Set the video rate, that is the number of frames generated per second.
  9343. Default is 25.
  9344. @item random_fill_ratio, ratio
  9345. Set the random fill ratio for the initial random grid. It is a
  9346. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  9347. It is ignored when a file is specified.
  9348. @item random_seed, seed
  9349. Set the seed for filling the initial random grid, must be an integer
  9350. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9351. set to -1, the filter will try to use a good random seed on a best
  9352. effort basis.
  9353. @item rule
  9354. Set the life rule.
  9355. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  9356. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  9357. @var{NS} specifies the number of alive neighbor cells which make a
  9358. live cell stay alive, and @var{NB} the number of alive neighbor cells
  9359. which make a dead cell to become alive (i.e. to "born").
  9360. "s" and "b" can be used in place of "S" and "B", respectively.
  9361. Alternatively a rule can be specified by an 18-bits integer. The 9
  9362. high order bits are used to encode the next cell state if it is alive
  9363. for each number of neighbor alive cells, the low order bits specify
  9364. the rule for "borning" new cells. Higher order bits encode for an
  9365. higher number of neighbor cells.
  9366. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  9367. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  9368. Default value is "S23/B3", which is the original Conway's game of life
  9369. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  9370. cells, and will born a new cell if there are three alive cells around
  9371. a dead cell.
  9372. @item size, s
  9373. Set the size of the output video. For the syntax of this option, check the
  9374. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9375. If @option{filename} is specified, the size is set by default to the
  9376. same size of the input file. If @option{size} is set, it must contain
  9377. the size specified in the input file, and the initial grid defined in
  9378. that file is centered in the larger resulting area.
  9379. If a filename is not specified, the size value defaults to "320x240"
  9380. (used for a randomly generated initial grid).
  9381. @item stitch
  9382. If set to 1, stitch the left and right grid edges together, and the
  9383. top and bottom edges also. Defaults to 1.
  9384. @item mold
  9385. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  9386. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  9387. value from 0 to 255.
  9388. @item life_color
  9389. Set the color of living (or new born) cells.
  9390. @item death_color
  9391. Set the color of dead cells. If @option{mold} is set, this is the first color
  9392. used to represent a dead cell.
  9393. @item mold_color
  9394. Set mold color, for definitely dead and moldy cells.
  9395. For the syntax of these 3 color options, check the "Color" section in the
  9396. ffmpeg-utils manual.
  9397. @end table
  9398. @subsection Examples
  9399. @itemize
  9400. @item
  9401. Read a grid from @file{pattern}, and center it on a grid of size
  9402. 300x300 pixels:
  9403. @example
  9404. life=f=pattern:s=300x300
  9405. @end example
  9406. @item
  9407. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  9408. @example
  9409. life=ratio=2/3:s=200x200
  9410. @end example
  9411. @item
  9412. Specify a custom rule for evolving a randomly generated grid:
  9413. @example
  9414. life=rule=S14/B34
  9415. @end example
  9416. @item
  9417. Full example with slow death effect (mold) using @command{ffplay}:
  9418. @example
  9419. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  9420. @end example
  9421. @end itemize
  9422. @anchor{allrgb}
  9423. @anchor{allyuv}
  9424. @anchor{color}
  9425. @anchor{haldclutsrc}
  9426. @anchor{nullsrc}
  9427. @anchor{rgbtestsrc}
  9428. @anchor{smptebars}
  9429. @anchor{smptehdbars}
  9430. @anchor{testsrc}
  9431. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  9432. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  9433. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  9434. The @code{color} source provides an uniformly colored input.
  9435. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  9436. @ref{haldclut} filter.
  9437. The @code{nullsrc} source returns unprocessed video frames. It is
  9438. mainly useful to be employed in analysis / debugging tools, or as the
  9439. source for filters which ignore the input data.
  9440. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  9441. detecting RGB vs BGR issues. You should see a red, green and blue
  9442. stripe from top to bottom.
  9443. The @code{smptebars} source generates a color bars pattern, based on
  9444. the SMPTE Engineering Guideline EG 1-1990.
  9445. The @code{smptehdbars} source generates a color bars pattern, based on
  9446. the SMPTE RP 219-2002.
  9447. The @code{testsrc} source generates a test video pattern, showing a
  9448. color pattern, a scrolling gradient and a timestamp. This is mainly
  9449. intended for testing purposes.
  9450. The sources accept the following parameters:
  9451. @table @option
  9452. @item color, c
  9453. Specify the color of the source, only available in the @code{color}
  9454. source. For the syntax of this option, check the "Color" section in the
  9455. ffmpeg-utils manual.
  9456. @item level
  9457. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  9458. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  9459. pixels to be used as identity matrix for 3D lookup tables. Each component is
  9460. coded on a @code{1/(N*N)} scale.
  9461. @item size, s
  9462. Specify the size of the sourced video. For the syntax of this option, check the
  9463. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9464. The default value is @code{320x240}.
  9465. This option is not available with the @code{haldclutsrc} filter.
  9466. @item rate, r
  9467. Specify the frame rate of the sourced video, as the number of frames
  9468. generated per second. It has to be a string in the format
  9469. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9470. number or a valid video frame rate abbreviation. The default value is
  9471. "25".
  9472. @item sar
  9473. Set the sample aspect ratio of the sourced video.
  9474. @item duration, d
  9475. Set the duration of the sourced video. See
  9476. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9477. for the accepted syntax.
  9478. If not specified, or the expressed duration is negative, the video is
  9479. supposed to be generated forever.
  9480. @item decimals, n
  9481. Set the number of decimals to show in the timestamp, only available in the
  9482. @code{testsrc} source.
  9483. The displayed timestamp value will correspond to the original
  9484. timestamp value multiplied by the power of 10 of the specified
  9485. value. Default value is 0.
  9486. @end table
  9487. For example the following:
  9488. @example
  9489. testsrc=duration=5.3:size=qcif:rate=10
  9490. @end example
  9491. will generate a video with a duration of 5.3 seconds, with size
  9492. 176x144 and a frame rate of 10 frames per second.
  9493. The following graph description will generate a red source
  9494. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  9495. frames per second.
  9496. @example
  9497. color=c=red@@0.2:s=qcif:r=10
  9498. @end example
  9499. If the input content is to be ignored, @code{nullsrc} can be used. The
  9500. following command generates noise in the luminance plane by employing
  9501. the @code{geq} filter:
  9502. @example
  9503. nullsrc=s=256x256, geq=random(1)*255:128:128
  9504. @end example
  9505. @subsection Commands
  9506. The @code{color} source supports the following commands:
  9507. @table @option
  9508. @item c, color
  9509. Set the color of the created image. Accepts the same syntax of the
  9510. corresponding @option{color} option.
  9511. @end table
  9512. @c man end VIDEO SOURCES
  9513. @chapter Video Sinks
  9514. @c man begin VIDEO SINKS
  9515. Below is a description of the currently available video sinks.
  9516. @section buffersink
  9517. Buffer video frames, and make them available to the end of the filter
  9518. graph.
  9519. This sink is mainly intended for programmatic use, in particular
  9520. through the interface defined in @file{libavfilter/buffersink.h}
  9521. or the options system.
  9522. It accepts a pointer to an AVBufferSinkContext structure, which
  9523. defines the incoming buffers' formats, to be passed as the opaque
  9524. parameter to @code{avfilter_init_filter} for initialization.
  9525. @section nullsink
  9526. Null video sink: do absolutely nothing with the input video. It is
  9527. mainly useful as a template and for use in analysis / debugging
  9528. tools.
  9529. @c man end VIDEO SINKS
  9530. @chapter Multimedia Filters
  9531. @c man begin MULTIMEDIA FILTERS
  9532. Below is a description of the currently available multimedia filters.
  9533. @section aphasemeter
  9534. Convert input audio to a video output, displaying the audio phase.
  9535. The filter accepts the following options:
  9536. @table @option
  9537. @item rate, r
  9538. Set the output frame rate. Default value is @code{25}.
  9539. @item size, s
  9540. Set the video size for the output. For the syntax of this option, check the
  9541. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9542. Default value is @code{800x400}.
  9543. @item rc
  9544. @item gc
  9545. @item bc
  9546. Specify the red, green, blue contrast. Default values are @code{2},
  9547. @code{7} and @code{1}.
  9548. Allowed range is @code{[0, 255]}.
  9549. @item mpc
  9550. Set color which will be used for drawing median phase. If color is
  9551. @code{none} which is default, no median phase value will be drawn.
  9552. @end table
  9553. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  9554. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  9555. The @code{-1} means left and right channels are completely out of phase and
  9556. @code{1} means channels are in phase.
  9557. @section avectorscope
  9558. Convert input audio to a video output, representing the audio vector
  9559. scope.
  9560. The filter is used to measure the difference between channels of stereo
  9561. audio stream. A monoaural signal, consisting of identical left and right
  9562. signal, results in straight vertical line. Any stereo separation is visible
  9563. as a deviation from this line, creating a Lissajous figure.
  9564. If the straight (or deviation from it) but horizontal line appears this
  9565. indicates that the left and right channels are out of phase.
  9566. The filter accepts the following options:
  9567. @table @option
  9568. @item mode, m
  9569. Set the vectorscope mode.
  9570. Available values are:
  9571. @table @samp
  9572. @item lissajous
  9573. Lissajous rotated by 45 degrees.
  9574. @item lissajous_xy
  9575. Same as above but not rotated.
  9576. @item polar
  9577. Shape resembling half of circle.
  9578. @end table
  9579. Default value is @samp{lissajous}.
  9580. @item size, s
  9581. Set the video size for the output. For the syntax of this option, check the
  9582. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9583. Default value is @code{400x400}.
  9584. @item rate, r
  9585. Set the output frame rate. Default value is @code{25}.
  9586. @item rc
  9587. @item gc
  9588. @item bc
  9589. @item ac
  9590. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  9591. @code{160}, @code{80} and @code{255}.
  9592. Allowed range is @code{[0, 255]}.
  9593. @item rf
  9594. @item gf
  9595. @item bf
  9596. @item af
  9597. Specify the red, green, blue and alpha fade. Default values are @code{15},
  9598. @code{10}, @code{5} and @code{5}.
  9599. Allowed range is @code{[0, 255]}.
  9600. @item zoom
  9601. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  9602. @end table
  9603. @subsection Examples
  9604. @itemize
  9605. @item
  9606. Complete example using @command{ffplay}:
  9607. @example
  9608. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  9609. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  9610. @end example
  9611. @end itemize
  9612. @section concat
  9613. Concatenate audio and video streams, joining them together one after the
  9614. other.
  9615. The filter works on segments of synchronized video and audio streams. All
  9616. segments must have the same number of streams of each type, and that will
  9617. also be the number of streams at output.
  9618. The filter accepts the following options:
  9619. @table @option
  9620. @item n
  9621. Set the number of segments. Default is 2.
  9622. @item v
  9623. Set the number of output video streams, that is also the number of video
  9624. streams in each segment. Default is 1.
  9625. @item a
  9626. Set the number of output audio streams, that is also the number of audio
  9627. streams in each segment. Default is 0.
  9628. @item unsafe
  9629. Activate unsafe mode: do not fail if segments have a different format.
  9630. @end table
  9631. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  9632. @var{a} audio outputs.
  9633. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  9634. segment, in the same order as the outputs, then the inputs for the second
  9635. segment, etc.
  9636. Related streams do not always have exactly the same duration, for various
  9637. reasons including codec frame size or sloppy authoring. For that reason,
  9638. related synchronized streams (e.g. a video and its audio track) should be
  9639. concatenated at once. The concat filter will use the duration of the longest
  9640. stream in each segment (except the last one), and if necessary pad shorter
  9641. audio streams with silence.
  9642. For this filter to work correctly, all segments must start at timestamp 0.
  9643. All corresponding streams must have the same parameters in all segments; the
  9644. filtering system will automatically select a common pixel format for video
  9645. streams, and a common sample format, sample rate and channel layout for
  9646. audio streams, but other settings, such as resolution, must be converted
  9647. explicitly by the user.
  9648. Different frame rates are acceptable but will result in variable frame rate
  9649. at output; be sure to configure the output file to handle it.
  9650. @subsection Examples
  9651. @itemize
  9652. @item
  9653. Concatenate an opening, an episode and an ending, all in bilingual version
  9654. (video in stream 0, audio in streams 1 and 2):
  9655. @example
  9656. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  9657. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  9658. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  9659. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  9660. @end example
  9661. @item
  9662. Concatenate two parts, handling audio and video separately, using the
  9663. (a)movie sources, and adjusting the resolution:
  9664. @example
  9665. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  9666. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  9667. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  9668. @end example
  9669. Note that a desync will happen at the stitch if the audio and video streams
  9670. do not have exactly the same duration in the first file.
  9671. @end itemize
  9672. @anchor{ebur128}
  9673. @section ebur128
  9674. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  9675. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  9676. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  9677. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  9678. The filter also has a video output (see the @var{video} option) with a real
  9679. time graph to observe the loudness evolution. The graphic contains the logged
  9680. message mentioned above, so it is not printed anymore when this option is set,
  9681. unless the verbose logging is set. The main graphing area contains the
  9682. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  9683. the momentary loudness (400 milliseconds).
  9684. More information about the Loudness Recommendation EBU R128 on
  9685. @url{http://tech.ebu.ch/loudness}.
  9686. The filter accepts the following options:
  9687. @table @option
  9688. @item video
  9689. Activate the video output. The audio stream is passed unchanged whether this
  9690. option is set or no. The video stream will be the first output stream if
  9691. activated. Default is @code{0}.
  9692. @item size
  9693. Set the video size. This option is for video only. For the syntax of this
  9694. option, check the
  9695. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9696. Default and minimum resolution is @code{640x480}.
  9697. @item meter
  9698. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  9699. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  9700. other integer value between this range is allowed.
  9701. @item metadata
  9702. Set metadata injection. If set to @code{1}, the audio input will be segmented
  9703. into 100ms output frames, each of them containing various loudness information
  9704. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  9705. Default is @code{0}.
  9706. @item framelog
  9707. Force the frame logging level.
  9708. Available values are:
  9709. @table @samp
  9710. @item info
  9711. information logging level
  9712. @item verbose
  9713. verbose logging level
  9714. @end table
  9715. By default, the logging level is set to @var{info}. If the @option{video} or
  9716. the @option{metadata} options are set, it switches to @var{verbose}.
  9717. @item peak
  9718. Set peak mode(s).
  9719. Available modes can be cumulated (the option is a @code{flag} type). Possible
  9720. values are:
  9721. @table @samp
  9722. @item none
  9723. Disable any peak mode (default).
  9724. @item sample
  9725. Enable sample-peak mode.
  9726. Simple peak mode looking for the higher sample value. It logs a message
  9727. for sample-peak (identified by @code{SPK}).
  9728. @item true
  9729. Enable true-peak mode.
  9730. If enabled, the peak lookup is done on an over-sampled version of the input
  9731. stream for better peak accuracy. It logs a message for true-peak.
  9732. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  9733. This mode requires a build with @code{libswresample}.
  9734. @end table
  9735. @item dualmono
  9736. Treat mono input files as "dual mono". If a mono file is intended for playback
  9737. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  9738. If set to @code{true}, this option will compensate for this effect.
  9739. Multi-channel input files are not effected by this option.
  9740. @item panlaw
  9741. Set a specific pan law to be used for the measurement of dual mono files.
  9742. This parameter is optional, and has a default value of -3.01dB.
  9743. @end table
  9744. @subsection Examples
  9745. @itemize
  9746. @item
  9747. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  9748. @example
  9749. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  9750. @end example
  9751. @item
  9752. Run an analysis with @command{ffmpeg}:
  9753. @example
  9754. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  9755. @end example
  9756. @end itemize
  9757. @section interleave, ainterleave
  9758. Temporally interleave frames from several inputs.
  9759. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  9760. These filters read frames from several inputs and send the oldest
  9761. queued frame to the output.
  9762. Input streams must have a well defined, monotonically increasing frame
  9763. timestamp values.
  9764. In order to submit one frame to output, these filters need to enqueue
  9765. at least one frame for each input, so they cannot work in case one
  9766. input is not yet terminated and will not receive incoming frames.
  9767. For example consider the case when one input is a @code{select} filter
  9768. which always drop input frames. The @code{interleave} filter will keep
  9769. reading from that input, but it will never be able to send new frames
  9770. to output until the input will send an end-of-stream signal.
  9771. Also, depending on inputs synchronization, the filters will drop
  9772. frames in case one input receives more frames than the other ones, and
  9773. the queue is already filled.
  9774. These filters accept the following options:
  9775. @table @option
  9776. @item nb_inputs, n
  9777. Set the number of different inputs, it is 2 by default.
  9778. @end table
  9779. @subsection Examples
  9780. @itemize
  9781. @item
  9782. Interleave frames belonging to different streams using @command{ffmpeg}:
  9783. @example
  9784. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  9785. @end example
  9786. @item
  9787. Add flickering blur effect:
  9788. @example
  9789. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  9790. @end example
  9791. @end itemize
  9792. @section perms, aperms
  9793. Set read/write permissions for the output frames.
  9794. These filters are mainly aimed at developers to test direct path in the
  9795. following filter in the filtergraph.
  9796. The filters accept the following options:
  9797. @table @option
  9798. @item mode
  9799. Select the permissions mode.
  9800. It accepts the following values:
  9801. @table @samp
  9802. @item none
  9803. Do nothing. This is the default.
  9804. @item ro
  9805. Set all the output frames read-only.
  9806. @item rw
  9807. Set all the output frames directly writable.
  9808. @item toggle
  9809. Make the frame read-only if writable, and writable if read-only.
  9810. @item random
  9811. Set each output frame read-only or writable randomly.
  9812. @end table
  9813. @item seed
  9814. Set the seed for the @var{random} mode, must be an integer included between
  9815. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9816. @code{-1}, the filter will try to use a good random seed on a best effort
  9817. basis.
  9818. @end table
  9819. Note: in case of auto-inserted filter between the permission filter and the
  9820. following one, the permission might not be received as expected in that
  9821. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  9822. perms/aperms filter can avoid this problem.
  9823. @section select, aselect
  9824. Select frames to pass in output.
  9825. This filter accepts the following options:
  9826. @table @option
  9827. @item expr, e
  9828. Set expression, which is evaluated for each input frame.
  9829. If the expression is evaluated to zero, the frame is discarded.
  9830. If the evaluation result is negative or NaN, the frame is sent to the
  9831. first output; otherwise it is sent to the output with index
  9832. @code{ceil(val)-1}, assuming that the input index starts from 0.
  9833. For example a value of @code{1.2} corresponds to the output with index
  9834. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  9835. @item outputs, n
  9836. Set the number of outputs. The output to which to send the selected
  9837. frame is based on the result of the evaluation. Default value is 1.
  9838. @end table
  9839. The expression can contain the following constants:
  9840. @table @option
  9841. @item n
  9842. The (sequential) number of the filtered frame, starting from 0.
  9843. @item selected_n
  9844. The (sequential) number of the selected frame, starting from 0.
  9845. @item prev_selected_n
  9846. The sequential number of the last selected frame. It's NAN if undefined.
  9847. @item TB
  9848. The timebase of the input timestamps.
  9849. @item pts
  9850. The PTS (Presentation TimeStamp) of the filtered video frame,
  9851. expressed in @var{TB} units. It's NAN if undefined.
  9852. @item t
  9853. The PTS of the filtered video frame,
  9854. expressed in seconds. It's NAN if undefined.
  9855. @item prev_pts
  9856. The PTS of the previously filtered video frame. It's NAN if undefined.
  9857. @item prev_selected_pts
  9858. The PTS of the last previously filtered video frame. It's NAN if undefined.
  9859. @item prev_selected_t
  9860. The PTS of the last previously selected video frame. It's NAN if undefined.
  9861. @item start_pts
  9862. The PTS of the first video frame in the video. It's NAN if undefined.
  9863. @item start_t
  9864. The time of the first video frame in the video. It's NAN if undefined.
  9865. @item pict_type @emph{(video only)}
  9866. The type of the filtered frame. It can assume one of the following
  9867. values:
  9868. @table @option
  9869. @item I
  9870. @item P
  9871. @item B
  9872. @item S
  9873. @item SI
  9874. @item SP
  9875. @item BI
  9876. @end table
  9877. @item interlace_type @emph{(video only)}
  9878. The frame interlace type. It can assume one of the following values:
  9879. @table @option
  9880. @item PROGRESSIVE
  9881. The frame is progressive (not interlaced).
  9882. @item TOPFIRST
  9883. The frame is top-field-first.
  9884. @item BOTTOMFIRST
  9885. The frame is bottom-field-first.
  9886. @end table
  9887. @item consumed_sample_n @emph{(audio only)}
  9888. the number of selected samples before the current frame
  9889. @item samples_n @emph{(audio only)}
  9890. the number of samples in the current frame
  9891. @item sample_rate @emph{(audio only)}
  9892. the input sample rate
  9893. @item key
  9894. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  9895. @item pos
  9896. the position in the file of the filtered frame, -1 if the information
  9897. is not available (e.g. for synthetic video)
  9898. @item scene @emph{(video only)}
  9899. value between 0 and 1 to indicate a new scene; a low value reflects a low
  9900. probability for the current frame to introduce a new scene, while a higher
  9901. value means the current frame is more likely to be one (see the example below)
  9902. @end table
  9903. The default value of the select expression is "1".
  9904. @subsection Examples
  9905. @itemize
  9906. @item
  9907. Select all frames in input:
  9908. @example
  9909. select
  9910. @end example
  9911. The example above is the same as:
  9912. @example
  9913. select=1
  9914. @end example
  9915. @item
  9916. Skip all frames:
  9917. @example
  9918. select=0
  9919. @end example
  9920. @item
  9921. Select only I-frames:
  9922. @example
  9923. select='eq(pict_type\,I)'
  9924. @end example
  9925. @item
  9926. Select one frame every 100:
  9927. @example
  9928. select='not(mod(n\,100))'
  9929. @end example
  9930. @item
  9931. Select only frames contained in the 10-20 time interval:
  9932. @example
  9933. select=between(t\,10\,20)
  9934. @end example
  9935. @item
  9936. Select only I frames contained in the 10-20 time interval:
  9937. @example
  9938. select=between(t\,10\,20)*eq(pict_type\,I)
  9939. @end example
  9940. @item
  9941. Select frames with a minimum distance of 10 seconds:
  9942. @example
  9943. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  9944. @end example
  9945. @item
  9946. Use aselect to select only audio frames with samples number > 100:
  9947. @example
  9948. aselect='gt(samples_n\,100)'
  9949. @end example
  9950. @item
  9951. Create a mosaic of the first scenes:
  9952. @example
  9953. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  9954. @end example
  9955. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  9956. choice.
  9957. @item
  9958. Send even and odd frames to separate outputs, and compose them:
  9959. @example
  9960. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  9961. @end example
  9962. @end itemize
  9963. @section sendcmd, asendcmd
  9964. Send commands to filters in the filtergraph.
  9965. These filters read commands to be sent to other filters in the
  9966. filtergraph.
  9967. @code{sendcmd} must be inserted between two video filters,
  9968. @code{asendcmd} must be inserted between two audio filters, but apart
  9969. from that they act the same way.
  9970. The specification of commands can be provided in the filter arguments
  9971. with the @var{commands} option, or in a file specified by the
  9972. @var{filename} option.
  9973. These filters accept the following options:
  9974. @table @option
  9975. @item commands, c
  9976. Set the commands to be read and sent to the other filters.
  9977. @item filename, f
  9978. Set the filename of the commands to be read and sent to the other
  9979. filters.
  9980. @end table
  9981. @subsection Commands syntax
  9982. A commands description consists of a sequence of interval
  9983. specifications, comprising a list of commands to be executed when a
  9984. particular event related to that interval occurs. The occurring event
  9985. is typically the current frame time entering or leaving a given time
  9986. interval.
  9987. An interval is specified by the following syntax:
  9988. @example
  9989. @var{START}[-@var{END}] @var{COMMANDS};
  9990. @end example
  9991. The time interval is specified by the @var{START} and @var{END} times.
  9992. @var{END} is optional and defaults to the maximum time.
  9993. The current frame time is considered within the specified interval if
  9994. it is included in the interval [@var{START}, @var{END}), that is when
  9995. the time is greater or equal to @var{START} and is lesser than
  9996. @var{END}.
  9997. @var{COMMANDS} consists of a sequence of one or more command
  9998. specifications, separated by ",", relating to that interval. The
  9999. syntax of a command specification is given by:
  10000. @example
  10001. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  10002. @end example
  10003. @var{FLAGS} is optional and specifies the type of events relating to
  10004. the time interval which enable sending the specified command, and must
  10005. be a non-null sequence of identifier flags separated by "+" or "|" and
  10006. enclosed between "[" and "]".
  10007. The following flags are recognized:
  10008. @table @option
  10009. @item enter
  10010. The command is sent when the current frame timestamp enters the
  10011. specified interval. In other words, the command is sent when the
  10012. previous frame timestamp was not in the given interval, and the
  10013. current is.
  10014. @item leave
  10015. The command is sent when the current frame timestamp leaves the
  10016. specified interval. In other words, the command is sent when the
  10017. previous frame timestamp was in the given interval, and the
  10018. current is not.
  10019. @end table
  10020. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  10021. assumed.
  10022. @var{TARGET} specifies the target of the command, usually the name of
  10023. the filter class or a specific filter instance name.
  10024. @var{COMMAND} specifies the name of the command for the target filter.
  10025. @var{ARG} is optional and specifies the optional list of argument for
  10026. the given @var{COMMAND}.
  10027. Between one interval specification and another, whitespaces, or
  10028. sequences of characters starting with @code{#} until the end of line,
  10029. are ignored and can be used to annotate comments.
  10030. A simplified BNF description of the commands specification syntax
  10031. follows:
  10032. @example
  10033. @var{COMMAND_FLAG} ::= "enter" | "leave"
  10034. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  10035. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  10036. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  10037. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  10038. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  10039. @end example
  10040. @subsection Examples
  10041. @itemize
  10042. @item
  10043. Specify audio tempo change at second 4:
  10044. @example
  10045. asendcmd=c='4.0 atempo tempo 1.5',atempo
  10046. @end example
  10047. @item
  10048. Specify a list of drawtext and hue commands in a file.
  10049. @example
  10050. # show text in the interval 5-10
  10051. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  10052. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  10053. # desaturate the image in the interval 15-20
  10054. 15.0-20.0 [enter] hue s 0,
  10055. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  10056. [leave] hue s 1,
  10057. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  10058. # apply an exponential saturation fade-out effect, starting from time 25
  10059. 25 [enter] hue s exp(25-t)
  10060. @end example
  10061. A filtergraph allowing to read and process the above command list
  10062. stored in a file @file{test.cmd}, can be specified with:
  10063. @example
  10064. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  10065. @end example
  10066. @end itemize
  10067. @anchor{setpts}
  10068. @section setpts, asetpts
  10069. Change the PTS (presentation timestamp) of the input frames.
  10070. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  10071. This filter accepts the following options:
  10072. @table @option
  10073. @item expr
  10074. The expression which is evaluated for each frame to construct its timestamp.
  10075. @end table
  10076. The expression is evaluated through the eval API and can contain the following
  10077. constants:
  10078. @table @option
  10079. @item FRAME_RATE
  10080. frame rate, only defined for constant frame-rate video
  10081. @item PTS
  10082. The presentation timestamp in input
  10083. @item N
  10084. The count of the input frame for video or the number of consumed samples,
  10085. not including the current frame for audio, starting from 0.
  10086. @item NB_CONSUMED_SAMPLES
  10087. The number of consumed samples, not including the current frame (only
  10088. audio)
  10089. @item NB_SAMPLES, S
  10090. The number of samples in the current frame (only audio)
  10091. @item SAMPLE_RATE, SR
  10092. The audio sample rate.
  10093. @item STARTPTS
  10094. The PTS of the first frame.
  10095. @item STARTT
  10096. the time in seconds of the first frame
  10097. @item INTERLACED
  10098. State whether the current frame is interlaced.
  10099. @item T
  10100. the time in seconds of the current frame
  10101. @item POS
  10102. original position in the file of the frame, or undefined if undefined
  10103. for the current frame
  10104. @item PREV_INPTS
  10105. The previous input PTS.
  10106. @item PREV_INT
  10107. previous input time in seconds
  10108. @item PREV_OUTPTS
  10109. The previous output PTS.
  10110. @item PREV_OUTT
  10111. previous output time in seconds
  10112. @item RTCTIME
  10113. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  10114. instead.
  10115. @item RTCSTART
  10116. The wallclock (RTC) time at the start of the movie in microseconds.
  10117. @item TB
  10118. The timebase of the input timestamps.
  10119. @end table
  10120. @subsection Examples
  10121. @itemize
  10122. @item
  10123. Start counting PTS from zero
  10124. @example
  10125. setpts=PTS-STARTPTS
  10126. @end example
  10127. @item
  10128. Apply fast motion effect:
  10129. @example
  10130. setpts=0.5*PTS
  10131. @end example
  10132. @item
  10133. Apply slow motion effect:
  10134. @example
  10135. setpts=2.0*PTS
  10136. @end example
  10137. @item
  10138. Set fixed rate of 25 frames per second:
  10139. @example
  10140. setpts=N/(25*TB)
  10141. @end example
  10142. @item
  10143. Set fixed rate 25 fps with some jitter:
  10144. @example
  10145. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  10146. @end example
  10147. @item
  10148. Apply an offset of 10 seconds to the input PTS:
  10149. @example
  10150. setpts=PTS+10/TB
  10151. @end example
  10152. @item
  10153. Generate timestamps from a "live source" and rebase onto the current timebase:
  10154. @example
  10155. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  10156. @end example
  10157. @item
  10158. Generate timestamps by counting samples:
  10159. @example
  10160. asetpts=N/SR/TB
  10161. @end example
  10162. @end itemize
  10163. @section settb, asettb
  10164. Set the timebase to use for the output frames timestamps.
  10165. It is mainly useful for testing timebase configuration.
  10166. It accepts the following parameters:
  10167. @table @option
  10168. @item expr, tb
  10169. The expression which is evaluated into the output timebase.
  10170. @end table
  10171. The value for @option{tb} is an arithmetic expression representing a
  10172. rational. The expression can contain the constants "AVTB" (the default
  10173. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  10174. audio only). Default value is "intb".
  10175. @subsection Examples
  10176. @itemize
  10177. @item
  10178. Set the timebase to 1/25:
  10179. @example
  10180. settb=expr=1/25
  10181. @end example
  10182. @item
  10183. Set the timebase to 1/10:
  10184. @example
  10185. settb=expr=0.1
  10186. @end example
  10187. @item
  10188. Set the timebase to 1001/1000:
  10189. @example
  10190. settb=1+0.001
  10191. @end example
  10192. @item
  10193. Set the timebase to 2*intb:
  10194. @example
  10195. settb=2*intb
  10196. @end example
  10197. @item
  10198. Set the default timebase value:
  10199. @example
  10200. settb=AVTB
  10201. @end example
  10202. @end itemize
  10203. @section showcqt
  10204. Convert input audio to a video output representing
  10205. frequency spectrum logarithmically (using constant Q transform with
  10206. Brown-Puckette algorithm), with musical tone scale, from E0 to D#10 (10 octaves).
  10207. The filter accepts the following options:
  10208. @table @option
  10209. @item volume
  10210. Specify transform volume (multiplier) expression. The expression can contain
  10211. variables:
  10212. @table @option
  10213. @item frequency, freq, f
  10214. the frequency where transform is evaluated
  10215. @item timeclamp, tc
  10216. value of timeclamp option
  10217. @end table
  10218. and functions:
  10219. @table @option
  10220. @item a_weighting(f)
  10221. A-weighting of equal loudness
  10222. @item b_weighting(f)
  10223. B-weighting of equal loudness
  10224. @item c_weighting(f)
  10225. C-weighting of equal loudness
  10226. @end table
  10227. Default value is @code{16}.
  10228. @item tlength
  10229. Specify transform length expression. The expression can contain variables:
  10230. @table @option
  10231. @item frequency, freq, f
  10232. the frequency where transform is evaluated
  10233. @item timeclamp, tc
  10234. value of timeclamp option
  10235. @end table
  10236. Default value is @code{384/f*tc/(384/f+tc)}.
  10237. @item timeclamp
  10238. Specify the transform timeclamp. At low frequency, there is trade-off between
  10239. accuracy in time domain and frequency domain. If timeclamp is lower,
  10240. event in time domain is represented more accurately (such as fast bass drum),
  10241. otherwise event in frequency domain is represented more accurately
  10242. (such as bass guitar). Acceptable value is [0.1, 1.0]. Default value is @code{0.17}.
  10243. @item coeffclamp
  10244. Specify the transform coeffclamp. If coeffclamp is lower, transform is
  10245. more accurate, otherwise transform is faster. Acceptable value is [0.1, 10.0].
  10246. Default value is @code{1.0}.
  10247. @item gamma
  10248. Specify gamma. Lower gamma makes the spectrum more contrast, higher gamma
  10249. makes the spectrum having more range. Acceptable value is [1.0, 7.0].
  10250. Default value is @code{3.0}.
  10251. @item gamma2
  10252. Specify gamma of bargraph. Acceptable value is [1.0, 7.0].
  10253. Default value is @code{1.0}.
  10254. @item fontfile
  10255. Specify font file for use with freetype. If not specified, use embedded font.
  10256. @item fontcolor
  10257. Specify font color expression. This is arithmetic expression that should return
  10258. integer value 0xRRGGBB. The expression can contain variables:
  10259. @table @option
  10260. @item frequency, freq, f
  10261. the frequency where transform is evaluated
  10262. @item timeclamp, tc
  10263. value of timeclamp option
  10264. @end table
  10265. and functions:
  10266. @table @option
  10267. @item midi(f)
  10268. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  10269. @item r(x), g(x), b(x)
  10270. red, green, and blue value of intensity x
  10271. @end table
  10272. Default value is @code{st(0, (midi(f)-59.5)/12);
  10273. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  10274. r(1-ld(1)) + b(ld(1))}
  10275. @item fullhd
  10276. If set to 1 (the default), the video size is 1920x1080 (full HD),
  10277. if set to 0, the video size is 960x540. Use this option to make CPU usage lower.
  10278. @item fps
  10279. Specify video fps. Default value is @code{25}.
  10280. @item count
  10281. Specify number of transform per frame, so there are fps*count transforms
  10282. per second. Note that audio data rate must be divisible by fps*count.
  10283. Default value is @code{6}.
  10284. @end table
  10285. @subsection Examples
  10286. @itemize
  10287. @item
  10288. Playing audio while showing the spectrum:
  10289. @example
  10290. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  10291. @end example
  10292. @item
  10293. Same as above, but with frame rate 30 fps:
  10294. @example
  10295. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  10296. @end example
  10297. @item
  10298. Playing at 960x540 and lower CPU usage:
  10299. @example
  10300. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fullhd=0:count=3 [out0]'
  10301. @end example
  10302. @item
  10303. A1 and its harmonics: A1, A2, (near)E3, A3:
  10304. @example
  10305. 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),
  10306. asplit[a][out1]; [a] showcqt [out0]'
  10307. @end example
  10308. @item
  10309. Same as above, but with more accuracy in frequency domain (and slower):
  10310. @example
  10311. 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),
  10312. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  10313. @end example
  10314. @item
  10315. B-weighting of equal loudness
  10316. @example
  10317. volume=16*b_weighting(f)
  10318. @end example
  10319. @item
  10320. Lower Q factor
  10321. @example
  10322. tlength=100/f*tc/(100/f+tc)
  10323. @end example
  10324. @item
  10325. Custom fontcolor, C-note is colored green, others are colored blue
  10326. @example
  10327. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))'
  10328. @end example
  10329. @item
  10330. Custom gamma, now spectrum is linear to the amplitude.
  10331. @example
  10332. gamma=2:gamma2=2
  10333. @end example
  10334. @end itemize
  10335. @section showfreqs
  10336. Convert input audio to video output representing the audio power spectrum.
  10337. Audio amplitude is on Y-axis while frequency is on X-axis.
  10338. The filter accepts the following options:
  10339. @table @option
  10340. @item size, s
  10341. Specify size of video. For the syntax of this option, check the
  10342. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10343. Default is @code{1024x512}.
  10344. @item mode
  10345. Set display mode.
  10346. This set how each frequency bin will be represented.
  10347. It accepts the following values:
  10348. @table @samp
  10349. @item line
  10350. @item bar
  10351. @item dot
  10352. @end table
  10353. Default is @code{bar}.
  10354. @item ascale
  10355. Set amplitude scale.
  10356. It accepts the following values:
  10357. @table @samp
  10358. @item lin
  10359. Linear scale.
  10360. @item sqrt
  10361. Square root scale.
  10362. @item cbrt
  10363. Cubic root scale.
  10364. @item log
  10365. Logarithmic scale.
  10366. @end table
  10367. Default is @code{log}.
  10368. @item fscale
  10369. Set frequency scale.
  10370. It accepts the following values:
  10371. @table @samp
  10372. @item lin
  10373. Linear scale.
  10374. @item log
  10375. Logarithmic scale.
  10376. @item rlog
  10377. Reverse logarithmic scale.
  10378. @end table
  10379. Default is @code{lin}.
  10380. @item win_size
  10381. Set window size.
  10382. It accepts the following values:
  10383. @table @samp
  10384. @item w16
  10385. @item w32
  10386. @item w64
  10387. @item w128
  10388. @item w256
  10389. @item w512
  10390. @item w1024
  10391. @item w2048
  10392. @item w4096
  10393. @item w8192
  10394. @item w16384
  10395. @item w32768
  10396. @item w65536
  10397. @end table
  10398. Default is @code{w2048}
  10399. @item win_func
  10400. Set windowing function.
  10401. It accepts the following values:
  10402. @table @samp
  10403. @item rect
  10404. @item bartlett
  10405. @item hanning
  10406. @item hamming
  10407. @item blackman
  10408. @item welch
  10409. @item flattop
  10410. @item bharris
  10411. @item bnuttall
  10412. @item bhann
  10413. @item sine
  10414. @item nuttall
  10415. @item lanczos
  10416. @item gauss
  10417. @end table
  10418. Default is @code{hanning}.
  10419. @item overlap
  10420. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  10421. which means optimal overlap for selected window function will be picked.
  10422. @item averaging
  10423. Set time averaging. Setting this to 0 will display current maximal peaks.
  10424. Default is @code{1}, which means time averaging is disabled.
  10425. @item colors
  10426. Specify list of colors separated by space or by '|' which will be used to
  10427. draw channel frequencies. Unrecognized or missing colors will be replaced
  10428. by white color.
  10429. @end table
  10430. @section showspectrum
  10431. Convert input audio to a video output, representing the audio frequency
  10432. spectrum.
  10433. The filter accepts the following options:
  10434. @table @option
  10435. @item size, s
  10436. Specify the video size for the output. For the syntax of this option, check the
  10437. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10438. Default value is @code{640x512}.
  10439. @item slide
  10440. Specify how the spectrum should slide along the window.
  10441. It accepts the following values:
  10442. @table @samp
  10443. @item replace
  10444. the samples start again on the left when they reach the right
  10445. @item scroll
  10446. the samples scroll from right to left
  10447. @item fullframe
  10448. frames are only produced when the samples reach the right
  10449. @end table
  10450. Default value is @code{replace}.
  10451. @item mode
  10452. Specify display mode.
  10453. It accepts the following values:
  10454. @table @samp
  10455. @item combined
  10456. all channels are displayed in the same row
  10457. @item separate
  10458. all channels are displayed in separate rows
  10459. @end table
  10460. Default value is @samp{combined}.
  10461. @item color
  10462. Specify display color mode.
  10463. It accepts the following values:
  10464. @table @samp
  10465. @item channel
  10466. each channel is displayed in a separate color
  10467. @item intensity
  10468. each channel is is displayed using the same color scheme
  10469. @end table
  10470. Default value is @samp{channel}.
  10471. @item scale
  10472. Specify scale used for calculating intensity color values.
  10473. It accepts the following values:
  10474. @table @samp
  10475. @item lin
  10476. linear
  10477. @item sqrt
  10478. square root, default
  10479. @item cbrt
  10480. cubic root
  10481. @item log
  10482. logarithmic
  10483. @end table
  10484. Default value is @samp{sqrt}.
  10485. @item saturation
  10486. Set saturation modifier for displayed colors. Negative values provide
  10487. alternative color scheme. @code{0} is no saturation at all.
  10488. Saturation must be in [-10.0, 10.0] range.
  10489. Default value is @code{1}.
  10490. @item win_func
  10491. Set window function.
  10492. It accepts the following values:
  10493. @table @samp
  10494. @item none
  10495. No samples pre-processing (do not expect this to be faster)
  10496. @item hann
  10497. Hann window
  10498. @item hamming
  10499. Hamming window
  10500. @item blackman
  10501. Blackman window
  10502. @end table
  10503. Default value is @code{hann}.
  10504. @end table
  10505. The usage is very similar to the showwaves filter; see the examples in that
  10506. section.
  10507. @subsection Examples
  10508. @itemize
  10509. @item
  10510. Large window with logarithmic color scaling:
  10511. @example
  10512. showspectrum=s=1280x480:scale=log
  10513. @end example
  10514. @item
  10515. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  10516. @example
  10517. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  10518. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  10519. @end example
  10520. @end itemize
  10521. @section showvolume
  10522. Convert input audio volume to a video output.
  10523. The filter accepts the following options:
  10524. @table @option
  10525. @item rate, r
  10526. Set video rate.
  10527. @item b
  10528. Set border width, allowed range is [0, 5]. Default is 1.
  10529. @item w
  10530. Set channel width, allowed range is [40, 1080]. Default is 400.
  10531. @item h
  10532. Set channel height, allowed range is [1, 100]. Default is 20.
  10533. @item f
  10534. Set fade, allowed range is [1, 255]. Default is 20.
  10535. @item c
  10536. Set volume color expression.
  10537. The expression can use the following variables:
  10538. @table @option
  10539. @item VOLUME
  10540. Current max volume of channel in dB.
  10541. @item CHANNEL
  10542. Current channel number, starting from 0.
  10543. @end table
  10544. @item t
  10545. If set, displays channel names. Default is enabled.
  10546. @end table
  10547. @section showwaves
  10548. Convert input audio to a video output, representing the samples waves.
  10549. The filter accepts the following options:
  10550. @table @option
  10551. @item size, s
  10552. Specify the video size for the output. For the syntax of this option, check the
  10553. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10554. Default value is @code{600x240}.
  10555. @item mode
  10556. Set display mode.
  10557. Available values are:
  10558. @table @samp
  10559. @item point
  10560. Draw a point for each sample.
  10561. @item line
  10562. Draw a vertical line for each sample.
  10563. @item p2p
  10564. Draw a point for each sample and a line between them.
  10565. @item cline
  10566. Draw a centered vertical line for each sample.
  10567. @end table
  10568. Default value is @code{point}.
  10569. @item n
  10570. Set the number of samples which are printed on the same column. A
  10571. larger value will decrease the frame rate. Must be a positive
  10572. integer. This option can be set only if the value for @var{rate}
  10573. is not explicitly specified.
  10574. @item rate, r
  10575. Set the (approximate) output frame rate. This is done by setting the
  10576. option @var{n}. Default value is "25".
  10577. @item split_channels
  10578. Set if channels should be drawn separately or overlap. Default value is 0.
  10579. @end table
  10580. @subsection Examples
  10581. @itemize
  10582. @item
  10583. Output the input file audio and the corresponding video representation
  10584. at the same time:
  10585. @example
  10586. amovie=a.mp3,asplit[out0],showwaves[out1]
  10587. @end example
  10588. @item
  10589. Create a synthetic signal and show it with showwaves, forcing a
  10590. frame rate of 30 frames per second:
  10591. @example
  10592. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  10593. @end example
  10594. @end itemize
  10595. @section showwavespic
  10596. Convert input audio to a single video frame, representing the samples waves.
  10597. The filter accepts the following options:
  10598. @table @option
  10599. @item size, s
  10600. Specify the video size for the output. For the syntax of this option, check the
  10601. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10602. Default value is @code{600x240}.
  10603. @item split_channels
  10604. Set if channels should be drawn separately or overlap. Default value is 0.
  10605. @end table
  10606. @subsection Examples
  10607. @itemize
  10608. @item
  10609. Extract a channel split representation of the wave form of a whole audio track
  10610. in a 1024x800 picture using @command{ffmpeg}:
  10611. @example
  10612. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  10613. @end example
  10614. @end itemize
  10615. @section split, asplit
  10616. Split input into several identical outputs.
  10617. @code{asplit} works with audio input, @code{split} with video.
  10618. The filter accepts a single parameter which specifies the number of outputs. If
  10619. unspecified, it defaults to 2.
  10620. @subsection Examples
  10621. @itemize
  10622. @item
  10623. Create two separate outputs from the same input:
  10624. @example
  10625. [in] split [out0][out1]
  10626. @end example
  10627. @item
  10628. To create 3 or more outputs, you need to specify the number of
  10629. outputs, like in:
  10630. @example
  10631. [in] asplit=3 [out0][out1][out2]
  10632. @end example
  10633. @item
  10634. Create two separate outputs from the same input, one cropped and
  10635. one padded:
  10636. @example
  10637. [in] split [splitout1][splitout2];
  10638. [splitout1] crop=100:100:0:0 [cropout];
  10639. [splitout2] pad=200:200:100:100 [padout];
  10640. @end example
  10641. @item
  10642. Create 5 copies of the input audio with @command{ffmpeg}:
  10643. @example
  10644. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  10645. @end example
  10646. @end itemize
  10647. @section zmq, azmq
  10648. Receive commands sent through a libzmq client, and forward them to
  10649. filters in the filtergraph.
  10650. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  10651. must be inserted between two video filters, @code{azmq} between two
  10652. audio filters.
  10653. To enable these filters you need to install the libzmq library and
  10654. headers and configure FFmpeg with @code{--enable-libzmq}.
  10655. For more information about libzmq see:
  10656. @url{http://www.zeromq.org/}
  10657. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  10658. receives messages sent through a network interface defined by the
  10659. @option{bind_address} option.
  10660. The received message must be in the form:
  10661. @example
  10662. @var{TARGET} @var{COMMAND} [@var{ARG}]
  10663. @end example
  10664. @var{TARGET} specifies the target of the command, usually the name of
  10665. the filter class or a specific filter instance name.
  10666. @var{COMMAND} specifies the name of the command for the target filter.
  10667. @var{ARG} is optional and specifies the optional argument list for the
  10668. given @var{COMMAND}.
  10669. Upon reception, the message is processed and the corresponding command
  10670. is injected into the filtergraph. Depending on the result, the filter
  10671. will send a reply to the client, adopting the format:
  10672. @example
  10673. @var{ERROR_CODE} @var{ERROR_REASON}
  10674. @var{MESSAGE}
  10675. @end example
  10676. @var{MESSAGE} is optional.
  10677. @subsection Examples
  10678. Look at @file{tools/zmqsend} for an example of a zmq client which can
  10679. be used to send commands processed by these filters.
  10680. Consider the following filtergraph generated by @command{ffplay}
  10681. @example
  10682. ffplay -dumpgraph 1 -f lavfi "
  10683. color=s=100x100:c=red [l];
  10684. color=s=100x100:c=blue [r];
  10685. nullsrc=s=200x100, zmq [bg];
  10686. [bg][l] overlay [bg+l];
  10687. [bg+l][r] overlay=x=100 "
  10688. @end example
  10689. To change the color of the left side of the video, the following
  10690. command can be used:
  10691. @example
  10692. echo Parsed_color_0 c yellow | tools/zmqsend
  10693. @end example
  10694. To change the right side:
  10695. @example
  10696. echo Parsed_color_1 c pink | tools/zmqsend
  10697. @end example
  10698. @c man end MULTIMEDIA FILTERS
  10699. @chapter Multimedia Sources
  10700. @c man begin MULTIMEDIA SOURCES
  10701. Below is a description of the currently available multimedia sources.
  10702. @section amovie
  10703. This is the same as @ref{movie} source, except it selects an audio
  10704. stream by default.
  10705. @anchor{movie}
  10706. @section movie
  10707. Read audio and/or video stream(s) from a movie container.
  10708. It accepts the following parameters:
  10709. @table @option
  10710. @item filename
  10711. The name of the resource to read (not necessarily a file; it can also be a
  10712. device or a stream accessed through some protocol).
  10713. @item format_name, f
  10714. Specifies the format assumed for the movie to read, and can be either
  10715. the name of a container or an input device. If not specified, the
  10716. format is guessed from @var{movie_name} or by probing.
  10717. @item seek_point, sp
  10718. Specifies the seek point in seconds. The frames will be output
  10719. starting from this seek point. The parameter is evaluated with
  10720. @code{av_strtod}, so the numerical value may be suffixed by an IS
  10721. postfix. The default value is "0".
  10722. @item streams, s
  10723. Specifies the streams to read. Several streams can be specified,
  10724. separated by "+". The source will then have as many outputs, in the
  10725. same order. The syntax is explained in the ``Stream specifiers''
  10726. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  10727. respectively the default (best suited) video and audio stream. Default
  10728. is "dv", or "da" if the filter is called as "amovie".
  10729. @item stream_index, si
  10730. Specifies the index of the video stream to read. If the value is -1,
  10731. the most suitable video stream will be automatically selected. The default
  10732. value is "-1". Deprecated. If the filter is called "amovie", it will select
  10733. audio instead of video.
  10734. @item loop
  10735. Specifies how many times to read the stream in sequence.
  10736. If the value is less than 1, the stream will be read again and again.
  10737. Default value is "1".
  10738. Note that when the movie is looped the source timestamps are not
  10739. changed, so it will generate non monotonically increasing timestamps.
  10740. @end table
  10741. It allows overlaying a second video on top of the main input of
  10742. a filtergraph, as shown in this graph:
  10743. @example
  10744. input -----------> deltapts0 --> overlay --> output
  10745. ^
  10746. |
  10747. movie --> scale--> deltapts1 -------+
  10748. @end example
  10749. @subsection Examples
  10750. @itemize
  10751. @item
  10752. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  10753. on top of the input labelled "in":
  10754. @example
  10755. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  10756. [in] setpts=PTS-STARTPTS [main];
  10757. [main][over] overlay=16:16 [out]
  10758. @end example
  10759. @item
  10760. Read from a video4linux2 device, and overlay it on top of the input
  10761. labelled "in":
  10762. @example
  10763. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  10764. [in] setpts=PTS-STARTPTS [main];
  10765. [main][over] overlay=16:16 [out]
  10766. @end example
  10767. @item
  10768. Read the first video stream and the audio stream with id 0x81 from
  10769. dvd.vob; the video is connected to the pad named "video" and the audio is
  10770. connected to the pad named "audio":
  10771. @example
  10772. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  10773. @end example
  10774. @end itemize
  10775. @c man end MULTIMEDIA SOURCES