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.

14640 lines
401KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program.
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section adelay
  353. Delay one or more audio channels.
  354. Samples in delayed channel are filled with silence.
  355. The filter accepts the following option:
  356. @table @option
  357. @item delays
  358. Set list of delays in milliseconds for each channel separated by '|'.
  359. At least one delay greater than 0 should be provided.
  360. Unused delays will be silently ignored. If number of given delays is
  361. smaller than number of channels all remaining channels will not be delayed.
  362. @end table
  363. @subsection Examples
  364. @itemize
  365. @item
  366. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  367. the second channel (and any other channels that may be present) unchanged.
  368. @example
  369. adelay=1500|0|500
  370. @end example
  371. @end itemize
  372. @section aecho
  373. Apply echoing to the input audio.
  374. Echoes are reflected sound and can occur naturally amongst mountains
  375. (and sometimes large buildings) when talking or shouting; digital echo
  376. effects emulate this behaviour and are often used to help fill out the
  377. sound of a single instrument or vocal. The time difference between the
  378. original signal and the reflection is the @code{delay}, and the
  379. loudness of the reflected signal is the @code{decay}.
  380. Multiple echoes can have different delays and decays.
  381. A description of the accepted parameters follows.
  382. @table @option
  383. @item in_gain
  384. Set input gain of reflected signal. Default is @code{0.6}.
  385. @item out_gain
  386. Set output gain of reflected signal. Default is @code{0.3}.
  387. @item delays
  388. Set list of time intervals in milliseconds between original signal and reflections
  389. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  390. Default is @code{1000}.
  391. @item decays
  392. Set list of loudnesses of reflected signals separated by '|'.
  393. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  394. Default is @code{0.5}.
  395. @end table
  396. @subsection Examples
  397. @itemize
  398. @item
  399. Make it sound as if there are twice as many instruments as are actually playing:
  400. @example
  401. aecho=0.8:0.88:60:0.4
  402. @end example
  403. @item
  404. If delay is very short, then it sound like a (metallic) robot playing music:
  405. @example
  406. aecho=0.8:0.88:6:0.4
  407. @end example
  408. @item
  409. A longer delay will sound like an open air concert in the mountains:
  410. @example
  411. aecho=0.8:0.9:1000:0.3
  412. @end example
  413. @item
  414. Same as above but with one more mountain:
  415. @example
  416. aecho=0.8:0.9:1000|1800:0.3|0.25
  417. @end example
  418. @end itemize
  419. @section aeval
  420. Modify an audio signal according to the specified expressions.
  421. This filter accepts one or more expressions (one for each channel),
  422. which are evaluated and used to modify a corresponding audio signal.
  423. It accepts the following parameters:
  424. @table @option
  425. @item exprs
  426. Set the '|'-separated expressions list for each separate channel. If
  427. the number of input channels is greater than the number of
  428. expressions, the last specified expression is used for the remaining
  429. output channels.
  430. @item channel_layout, c
  431. Set output channel layout. If not specified, the channel layout is
  432. specified by the number of expressions. If set to @samp{same}, it will
  433. use by default the same input channel layout.
  434. @end table
  435. Each expression in @var{exprs} can contain the following constants and functions:
  436. @table @option
  437. @item ch
  438. channel number of the current expression
  439. @item n
  440. number of the evaluated sample, starting from 0
  441. @item s
  442. sample rate
  443. @item t
  444. time of the evaluated sample expressed in seconds
  445. @item nb_in_channels
  446. @item nb_out_channels
  447. input and output number of channels
  448. @item val(CH)
  449. the value of input channel with number @var{CH}
  450. @end table
  451. Note: this filter is slow. For faster processing you should use a
  452. dedicated filter.
  453. @subsection Examples
  454. @itemize
  455. @item
  456. Half volume:
  457. @example
  458. aeval=val(ch)/2:c=same
  459. @end example
  460. @item
  461. Invert phase of the second channel:
  462. @example
  463. aeval=val(0)|-val(1)
  464. @end example
  465. @end itemize
  466. @anchor{afade}
  467. @section afade
  468. Apply fade-in/out effect to input audio.
  469. A description of the accepted parameters follows.
  470. @table @option
  471. @item type, t
  472. Specify the effect type, can be either @code{in} for fade-in, or
  473. @code{out} for a fade-out effect. Default is @code{in}.
  474. @item start_sample, ss
  475. Specify the number of the start sample for starting to apply the fade
  476. effect. Default is 0.
  477. @item nb_samples, ns
  478. Specify the number of samples for which the fade effect has to last. At
  479. the end of the fade-in effect the output audio will have the same
  480. volume as the input audio, at the end of the fade-out transition
  481. the output audio will be silence. Default is 44100.
  482. @item start_time, st
  483. Specify the start time of the fade effect. Default is 0.
  484. The value must be specified as a time duration; see
  485. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  486. for the accepted syntax.
  487. If set this option is used instead of @var{start_sample}.
  488. @item duration, d
  489. Specify the duration of the fade effect. See
  490. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  491. for the accepted syntax.
  492. At the end of the fade-in effect the output audio will have the same
  493. volume as the input audio, at the end of the fade-out transition
  494. the output audio will be silence.
  495. By default the duration is determined by @var{nb_samples}.
  496. If set this option is used instead of @var{nb_samples}.
  497. @item curve
  498. Set curve for fade transition.
  499. It accepts the following values:
  500. @table @option
  501. @item tri
  502. select triangular, linear slope (default)
  503. @item qsin
  504. select quarter of sine wave
  505. @item hsin
  506. select half of sine wave
  507. @item esin
  508. select exponential sine wave
  509. @item log
  510. select logarithmic
  511. @item ipar
  512. select inverted parabola
  513. @item qua
  514. select quadratic
  515. @item cub
  516. select cubic
  517. @item squ
  518. select square root
  519. @item cbr
  520. select cubic root
  521. @item par
  522. select parabola
  523. @item exp
  524. select exponential
  525. @item iqsin
  526. select inverted quarter of sine wave
  527. @item ihsin
  528. select inverted half of sine wave
  529. @item dese
  530. select double-exponential seat
  531. @item desi
  532. select double-exponential sigmoid
  533. @end table
  534. @end table
  535. @subsection Examples
  536. @itemize
  537. @item
  538. Fade in first 15 seconds of audio:
  539. @example
  540. afade=t=in:ss=0:d=15
  541. @end example
  542. @item
  543. Fade out last 25 seconds of a 900 seconds audio:
  544. @example
  545. afade=t=out:st=875:d=25
  546. @end example
  547. @end itemize
  548. @anchor{aformat}
  549. @section aformat
  550. Set output format constraints for the input audio. The framework will
  551. negotiate the most appropriate format to minimize conversions.
  552. It accepts the following parameters:
  553. @table @option
  554. @item sample_fmts
  555. A '|'-separated list of requested sample formats.
  556. @item sample_rates
  557. A '|'-separated list of requested sample rates.
  558. @item channel_layouts
  559. A '|'-separated list of requested channel layouts.
  560. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  561. for the required syntax.
  562. @end table
  563. If a parameter is omitted, all values are allowed.
  564. Force the output to either unsigned 8-bit or signed 16-bit stereo
  565. @example
  566. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  567. @end example
  568. @section agate
  569. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  570. processing reduces disturbing noise between useful signals.
  571. Gating is done by detecting the volume below a chosen level @var{threshold}
  572. and divide it by the factor set with @var{ratio}. The bottom of the noise
  573. floor is set via @var{range}. Because an exact manipulation of the signal
  574. would cause distortion of the waveform the reduction can be levelled over
  575. time. This is done by setting @var{attack} and @var{release}.
  576. @var{attack} determines how long the signal has to fall below the threshold
  577. before any reduction will occur and @var{release} sets the time the signal
  578. has to raise above the threshold to reduce the reduction again.
  579. Shorter signals than the chosen attack time will be left untouched.
  580. @table @option
  581. @item level_in
  582. Set input level before filtering.
  583. Default is 1. Allowed range is from 0.015625 to 64.
  584. @item range
  585. Set the level of gain reduction when the signal is below the threshold.
  586. Default is 0.06125. Allowed range is from 0 to 1.
  587. @item threshold
  588. If a signal rises above this level the gain reduction is released.
  589. Default is 0.125. Allowed range is from 0 to 1.
  590. @item ratio
  591. Set a ratio about which the signal is reduced.
  592. Default is 2. Allowed range is from 1 to 9000.
  593. @item attack
  594. Amount of milliseconds the signal has to rise above the threshold before gain
  595. reduction stops.
  596. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  597. @item release
  598. Amount of milliseconds the signal has to fall below the threshold before the
  599. reduction is increased again. Default is 250 milliseconds.
  600. Allowed range is from 0.01 to 9000.
  601. @item makeup
  602. Set amount of amplification of signal after processing.
  603. Default is 1. Allowed range is from 1 to 64.
  604. @item knee
  605. Curve the sharp knee around the threshold to enter gain reduction more softly.
  606. Default is 2.828427125. Allowed range is from 1 to 8.
  607. @item detection
  608. Choose if exact signal should be taken for detection or an RMS like one.
  609. Default is peak. Can be peak or rms.
  610. @item link
  611. Choose if the average level between all channels or the louder channel affects
  612. the reduction.
  613. Default is average. Can be average or maximum.
  614. @end table
  615. @section alimiter
  616. The limiter prevents input signal from raising over a desired threshold.
  617. This limiter uses lookahead technology to prevent your signal from distorting.
  618. It means that there is a small delay after signal is processed. Keep in mind
  619. that the delay it produces is the attack time you set.
  620. The filter accepts the following options:
  621. @table @option
  622. @item limit
  623. Don't let signals above this level pass the limiter. The removed amplitude is
  624. added automatically. Default is 1.
  625. @item attack
  626. The limiter will reach its attenuation level in this amount of time in
  627. milliseconds. Default is 5 milliseconds.
  628. @item release
  629. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  630. Default is 50 milliseconds.
  631. @item asc
  632. When gain reduction is always needed ASC takes care of releasing to an
  633. average reduction level rather than reaching a reduction of 0 in the release
  634. time.
  635. @item asc_level
  636. Select how much the release time is affected by ASC, 0 means nearly no changes
  637. in release time while 1 produces higher release times.
  638. @end table
  639. Depending on picked setting it is recommended to upsample input 2x or 4x times
  640. with @ref{aresample} before applying this filter.
  641. @section allpass
  642. Apply a two-pole all-pass filter with central frequency (in Hz)
  643. @var{frequency}, and filter-width @var{width}.
  644. An all-pass filter changes the audio's frequency to phase relationship
  645. without changing its frequency to amplitude relationship.
  646. The filter accepts the following options:
  647. @table @option
  648. @item frequency, f
  649. Set frequency in Hz.
  650. @item width_type
  651. Set method to specify band-width of filter.
  652. @table @option
  653. @item h
  654. Hz
  655. @item q
  656. Q-Factor
  657. @item o
  658. octave
  659. @item s
  660. slope
  661. @end table
  662. @item width, w
  663. Specify the band-width of a filter in width_type units.
  664. @end table
  665. @anchor{amerge}
  666. @section amerge
  667. Merge two or more audio streams into a single multi-channel stream.
  668. The filter accepts the following options:
  669. @table @option
  670. @item inputs
  671. Set the number of inputs. Default is 2.
  672. @end table
  673. If the channel layouts of the inputs are disjoint, and therefore compatible,
  674. the channel layout of the output will be set accordingly and the channels
  675. will be reordered as necessary. If the channel layouts of the inputs are not
  676. disjoint, the output will have all the channels of the first input then all
  677. the channels of the second input, in that order, and the channel layout of
  678. the output will be the default value corresponding to the total number of
  679. channels.
  680. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  681. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  682. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  683. first input, b1 is the first channel of the second input).
  684. On the other hand, if both input are in stereo, the output channels will be
  685. in the default order: a1, a2, b1, b2, and the channel layout will be
  686. arbitrarily set to 4.0, which may or may not be the expected value.
  687. All inputs must have the same sample rate, and format.
  688. If inputs do not have the same duration, the output will stop with the
  689. shortest.
  690. @subsection Examples
  691. @itemize
  692. @item
  693. Merge two mono files into a stereo stream:
  694. @example
  695. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  696. @end example
  697. @item
  698. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  699. @example
  700. 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
  701. @end example
  702. @end itemize
  703. @section amix
  704. Mixes multiple audio inputs into a single output.
  705. Note that this filter only supports float samples (the @var{amerge}
  706. and @var{pan} audio filters support many formats). If the @var{amix}
  707. input has integer samples then @ref{aresample} will be automatically
  708. inserted to perform the conversion to float samples.
  709. For example
  710. @example
  711. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  712. @end example
  713. will mix 3 input audio streams to a single output with the same duration as the
  714. first input and a dropout transition time of 3 seconds.
  715. It accepts the following parameters:
  716. @table @option
  717. @item inputs
  718. The number of inputs. If unspecified, it defaults to 2.
  719. @item duration
  720. How to determine the end-of-stream.
  721. @table @option
  722. @item longest
  723. The duration of the longest input. (default)
  724. @item shortest
  725. The duration of the shortest input.
  726. @item first
  727. The duration of the first input.
  728. @end table
  729. @item dropout_transition
  730. The transition time, in seconds, for volume renormalization when an input
  731. stream ends. The default value is 2 seconds.
  732. @end table
  733. @section anull
  734. Pass the audio source unchanged to the output.
  735. @section apad
  736. Pad the end of an audio stream with silence.
  737. This can be used together with @command{ffmpeg} @option{-shortest} to
  738. extend audio streams to the same length as the video stream.
  739. A description of the accepted options follows.
  740. @table @option
  741. @item packet_size
  742. Set silence packet size. Default value is 4096.
  743. @item pad_len
  744. Set the number of samples of silence to add to the end. After the
  745. value is reached, the stream is terminated. This option is mutually
  746. exclusive with @option{whole_len}.
  747. @item whole_len
  748. Set the minimum total number of samples in the output audio stream. If
  749. the value is longer than the input audio length, silence is added to
  750. the end, until the value is reached. This option is mutually exclusive
  751. with @option{pad_len}.
  752. @end table
  753. If neither the @option{pad_len} nor the @option{whole_len} option is
  754. set, the filter will add silence to the end of the input stream
  755. indefinitely.
  756. @subsection Examples
  757. @itemize
  758. @item
  759. Add 1024 samples of silence to the end of the input:
  760. @example
  761. apad=pad_len=1024
  762. @end example
  763. @item
  764. Make sure the audio output will contain at least 10000 samples, pad
  765. the input with silence if required:
  766. @example
  767. apad=whole_len=10000
  768. @end example
  769. @item
  770. Use @command{ffmpeg} to pad the audio input with silence, so that the
  771. video stream will always result the shortest and will be converted
  772. until the end in the output file when using the @option{shortest}
  773. option:
  774. @example
  775. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  776. @end example
  777. @end itemize
  778. @section aphaser
  779. Add a phasing effect to the input audio.
  780. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  781. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  782. A description of the accepted parameters follows.
  783. @table @option
  784. @item in_gain
  785. Set input gain. Default is 0.4.
  786. @item out_gain
  787. Set output gain. Default is 0.74
  788. @item delay
  789. Set delay in milliseconds. Default is 3.0.
  790. @item decay
  791. Set decay. Default is 0.4.
  792. @item speed
  793. Set modulation speed in Hz. Default is 0.5.
  794. @item type
  795. Set modulation type. Default is triangular.
  796. It accepts the following values:
  797. @table @samp
  798. @item triangular, t
  799. @item sinusoidal, s
  800. @end table
  801. @end table
  802. @anchor{aresample}
  803. @section aresample
  804. Resample the input audio to the specified parameters, using the
  805. libswresample library. If none are specified then the filter will
  806. automatically convert between its input and output.
  807. This filter is also able to stretch/squeeze the audio data to make it match
  808. the timestamps or to inject silence / cut out audio to make it match the
  809. timestamps, do a combination of both or do neither.
  810. The filter accepts the syntax
  811. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  812. expresses a sample rate and @var{resampler_options} is a list of
  813. @var{key}=@var{value} pairs, separated by ":". See the
  814. ffmpeg-resampler manual for the complete list of supported options.
  815. @subsection Examples
  816. @itemize
  817. @item
  818. Resample the input audio to 44100Hz:
  819. @example
  820. aresample=44100
  821. @end example
  822. @item
  823. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  824. samples per second compensation:
  825. @example
  826. aresample=async=1000
  827. @end example
  828. @end itemize
  829. @section asetnsamples
  830. Set the number of samples per each output audio frame.
  831. The last output packet may contain a different number of samples, as
  832. the filter will flush all the remaining samples when the input audio
  833. signal its end.
  834. The filter accepts the following options:
  835. @table @option
  836. @item nb_out_samples, n
  837. Set the number of frames per each output audio frame. The number is
  838. intended as the number of samples @emph{per each channel}.
  839. Default value is 1024.
  840. @item pad, p
  841. If set to 1, the filter will pad the last audio frame with zeroes, so
  842. that the last frame will contain the same number of samples as the
  843. previous ones. Default value is 1.
  844. @end table
  845. For example, to set the number of per-frame samples to 1234 and
  846. disable padding for the last frame, use:
  847. @example
  848. asetnsamples=n=1234:p=0
  849. @end example
  850. @section asetrate
  851. Set the sample rate without altering the PCM data.
  852. This will result in a change of speed and pitch.
  853. The filter accepts the following options:
  854. @table @option
  855. @item sample_rate, r
  856. Set the output sample rate. Default is 44100 Hz.
  857. @end table
  858. @section ashowinfo
  859. Show a line containing various information for each input audio frame.
  860. The input audio is not modified.
  861. The shown line contains a sequence of key/value pairs of the form
  862. @var{key}:@var{value}.
  863. The following values are shown in the output:
  864. @table @option
  865. @item n
  866. The (sequential) number of the input frame, starting from 0.
  867. @item pts
  868. The presentation timestamp of the input frame, in time base units; the time base
  869. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  870. @item pts_time
  871. The presentation timestamp of the input frame in seconds.
  872. @item pos
  873. position of the frame in the input stream, -1 if this information in
  874. unavailable and/or meaningless (for example in case of synthetic audio)
  875. @item fmt
  876. The sample format.
  877. @item chlayout
  878. The channel layout.
  879. @item rate
  880. The sample rate for the audio frame.
  881. @item nb_samples
  882. The number of samples (per channel) in the frame.
  883. @item checksum
  884. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  885. audio, the data is treated as if all the planes were concatenated.
  886. @item plane_checksums
  887. A list of Adler-32 checksums for each data plane.
  888. @end table
  889. @anchor{astats}
  890. @section astats
  891. Display time domain statistical information about the audio channels.
  892. Statistics are calculated and displayed for each audio channel and,
  893. where applicable, an overall figure is also given.
  894. It accepts the following option:
  895. @table @option
  896. @item length
  897. Short window length in seconds, used for peak and trough RMS measurement.
  898. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  899. @item metadata
  900. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  901. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  902. disabled.
  903. Available keys for each channel are:
  904. DC_offset
  905. Min_level
  906. Max_level
  907. Min_difference
  908. Max_difference
  909. Mean_difference
  910. Peak_level
  911. RMS_peak
  912. RMS_trough
  913. Crest_factor
  914. Flat_factor
  915. Peak_count
  916. Bit_depth
  917. and for Overall:
  918. DC_offset
  919. Min_level
  920. Max_level
  921. Min_difference
  922. Max_difference
  923. Mean_difference
  924. Peak_level
  925. RMS_level
  926. RMS_peak
  927. RMS_trough
  928. Flat_factor
  929. Peak_count
  930. Bit_depth
  931. Number_of_samples
  932. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  933. this @code{lavfi.astats.Overall.Peak_count}.
  934. For description what each key means read below.
  935. @item reset
  936. Set number of frame after which stats are going to be recalculated.
  937. Default is disabled.
  938. @end table
  939. A description of each shown parameter follows:
  940. @table @option
  941. @item DC offset
  942. Mean amplitude displacement from zero.
  943. @item Min level
  944. Minimal sample level.
  945. @item Max level
  946. Maximal sample level.
  947. @item Min difference
  948. Minimal difference between two consecutive samples.
  949. @item Max difference
  950. Maximal difference between two consecutive samples.
  951. @item Mean difference
  952. Mean difference between two consecutive samples.
  953. The average of each difference between two consecutive samples.
  954. @item Peak level dB
  955. @item RMS level dB
  956. Standard peak and RMS level measured in dBFS.
  957. @item RMS peak dB
  958. @item RMS trough dB
  959. Peak and trough values for RMS level measured over a short window.
  960. @item Crest factor
  961. Standard ratio of peak to RMS level (note: not in dB).
  962. @item Flat factor
  963. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  964. (i.e. either @var{Min level} or @var{Max level}).
  965. @item Peak count
  966. Number of occasions (not the number of samples) that the signal attained either
  967. @var{Min level} or @var{Max level}.
  968. @item Bit depth
  969. Overall bit depth of audio. Number of bits used for each sample.
  970. @end table
  971. @section asyncts
  972. Synchronize audio data with timestamps by squeezing/stretching it and/or
  973. dropping samples/adding silence when needed.
  974. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  975. It accepts the following parameters:
  976. @table @option
  977. @item compensate
  978. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  979. by default. When disabled, time gaps are covered with silence.
  980. @item min_delta
  981. The minimum difference between timestamps and audio data (in seconds) to trigger
  982. adding/dropping samples. The default value is 0.1. If you get an imperfect
  983. sync with this filter, try setting this parameter to 0.
  984. @item max_comp
  985. The maximum compensation in samples per second. Only relevant with compensate=1.
  986. The default value is 500.
  987. @item first_pts
  988. Assume that the first PTS should be this value. The time base is 1 / sample
  989. rate. This allows for padding/trimming at the start of the stream. By default,
  990. no assumption is made about the first frame's expected PTS, so no padding or
  991. trimming is done. For example, this could be set to 0 to pad the beginning with
  992. silence if an audio stream starts after the video stream or to trim any samples
  993. with a negative PTS due to encoder delay.
  994. @end table
  995. @section atempo
  996. Adjust audio tempo.
  997. The filter accepts exactly one parameter, the audio tempo. If not
  998. specified then the filter will assume nominal 1.0 tempo. Tempo must
  999. be in the [0.5, 2.0] range.
  1000. @subsection Examples
  1001. @itemize
  1002. @item
  1003. Slow down audio to 80% tempo:
  1004. @example
  1005. atempo=0.8
  1006. @end example
  1007. @item
  1008. To speed up audio to 125% tempo:
  1009. @example
  1010. atempo=1.25
  1011. @end example
  1012. @end itemize
  1013. @section atrim
  1014. Trim the input so that the output contains one continuous subpart of the input.
  1015. It accepts the following parameters:
  1016. @table @option
  1017. @item start
  1018. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1019. sample with the timestamp @var{start} will be the first sample in the output.
  1020. @item end
  1021. Specify time of the first audio sample that will be dropped, i.e. the
  1022. audio sample immediately preceding the one with the timestamp @var{end} will be
  1023. the last sample in the output.
  1024. @item start_pts
  1025. Same as @var{start}, except this option sets the start timestamp in samples
  1026. instead of seconds.
  1027. @item end_pts
  1028. Same as @var{end}, except this option sets the end timestamp in samples instead
  1029. of seconds.
  1030. @item duration
  1031. The maximum duration of the output in seconds.
  1032. @item start_sample
  1033. The number of the first sample that should be output.
  1034. @item end_sample
  1035. The number of the first sample that should be dropped.
  1036. @end table
  1037. @option{start}, @option{end}, and @option{duration} are expressed as time
  1038. duration specifications; see
  1039. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1040. Note that the first two sets of the start/end options and the @option{duration}
  1041. option look at the frame timestamp, while the _sample options simply count the
  1042. samples that pass through the filter. So start/end_pts and start/end_sample will
  1043. give different results when the timestamps are wrong, inexact or do not start at
  1044. zero. Also note that this filter does not modify the timestamps. If you wish
  1045. to have the output timestamps start at zero, insert the asetpts filter after the
  1046. atrim filter.
  1047. If multiple start or end options are set, this filter tries to be greedy and
  1048. keep all samples that match at least one of the specified constraints. To keep
  1049. only the part that matches all the constraints at once, chain multiple atrim
  1050. filters.
  1051. The defaults are such that all the input is kept. So it is possible to set e.g.
  1052. just the end values to keep everything before the specified time.
  1053. Examples:
  1054. @itemize
  1055. @item
  1056. Drop everything except the second minute of input:
  1057. @example
  1058. ffmpeg -i INPUT -af atrim=60:120
  1059. @end example
  1060. @item
  1061. Keep only the first 1000 samples:
  1062. @example
  1063. ffmpeg -i INPUT -af atrim=end_sample=1000
  1064. @end example
  1065. @end itemize
  1066. @section bandpass
  1067. Apply a two-pole Butterworth band-pass filter with central
  1068. frequency @var{frequency}, and (3dB-point) band-width width.
  1069. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1070. instead of the default: constant 0dB peak gain.
  1071. The filter roll off at 6dB per octave (20dB per decade).
  1072. The filter accepts the following options:
  1073. @table @option
  1074. @item frequency, f
  1075. Set the filter's central frequency. Default is @code{3000}.
  1076. @item csg
  1077. Constant skirt gain if set to 1. Defaults to 0.
  1078. @item width_type
  1079. Set method to specify band-width of filter.
  1080. @table @option
  1081. @item h
  1082. Hz
  1083. @item q
  1084. Q-Factor
  1085. @item o
  1086. octave
  1087. @item s
  1088. slope
  1089. @end table
  1090. @item width, w
  1091. Specify the band-width of a filter in width_type units.
  1092. @end table
  1093. @section bandreject
  1094. Apply a two-pole Butterworth band-reject filter with central
  1095. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1096. The filter roll off at 6dB per octave (20dB per decade).
  1097. The filter accepts the following options:
  1098. @table @option
  1099. @item frequency, f
  1100. Set the filter's central frequency. Default is @code{3000}.
  1101. @item width_type
  1102. Set method to specify band-width of filter.
  1103. @table @option
  1104. @item h
  1105. Hz
  1106. @item q
  1107. Q-Factor
  1108. @item o
  1109. octave
  1110. @item s
  1111. slope
  1112. @end table
  1113. @item width, w
  1114. Specify the band-width of a filter in width_type units.
  1115. @end table
  1116. @section bass
  1117. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1118. shelving filter with a response similar to that of a standard
  1119. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1120. The filter accepts the following options:
  1121. @table @option
  1122. @item gain, g
  1123. Give the gain at 0 Hz. Its useful range is about -20
  1124. (for a large cut) to +20 (for a large boost).
  1125. Beware of clipping when using a positive gain.
  1126. @item frequency, f
  1127. Set the filter's central frequency and so can be used
  1128. to extend or reduce the frequency range to be boosted or cut.
  1129. The default value is @code{100} Hz.
  1130. @item width_type
  1131. Set method to specify band-width of filter.
  1132. @table @option
  1133. @item h
  1134. Hz
  1135. @item q
  1136. Q-Factor
  1137. @item o
  1138. octave
  1139. @item s
  1140. slope
  1141. @end table
  1142. @item width, w
  1143. Determine how steep is the filter's shelf transition.
  1144. @end table
  1145. @section biquad
  1146. Apply a biquad IIR filter with the given coefficients.
  1147. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1148. are the numerator and denominator coefficients respectively.
  1149. @section bs2b
  1150. Bauer stereo to binaural transformation, which improves headphone listening of
  1151. stereo audio records.
  1152. It accepts the following parameters:
  1153. @table @option
  1154. @item profile
  1155. Pre-defined crossfeed level.
  1156. @table @option
  1157. @item default
  1158. Default level (fcut=700, feed=50).
  1159. @item cmoy
  1160. Chu Moy circuit (fcut=700, feed=60).
  1161. @item jmeier
  1162. Jan Meier circuit (fcut=650, feed=95).
  1163. @end table
  1164. @item fcut
  1165. Cut frequency (in Hz).
  1166. @item feed
  1167. Feed level (in Hz).
  1168. @end table
  1169. @section channelmap
  1170. Remap input channels to new locations.
  1171. It accepts the following parameters:
  1172. @table @option
  1173. @item channel_layout
  1174. The channel layout of the output stream.
  1175. @item map
  1176. Map channels from input to output. The argument is a '|'-separated list of
  1177. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1178. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1179. channel (e.g. FL for front left) or its index in the input channel layout.
  1180. @var{out_channel} is the name of the output channel or its index in the output
  1181. channel layout. If @var{out_channel} is not given then it is implicitly an
  1182. index, starting with zero and increasing by one for each mapping.
  1183. @end table
  1184. If no mapping is present, the filter will implicitly map input channels to
  1185. output channels, preserving indices.
  1186. For example, assuming a 5.1+downmix input MOV file,
  1187. @example
  1188. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1189. @end example
  1190. will create an output WAV file tagged as stereo from the downmix channels of
  1191. the input.
  1192. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1193. @example
  1194. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1195. @end example
  1196. @section channelsplit
  1197. Split each channel from an input audio stream into a separate output stream.
  1198. It accepts the following parameters:
  1199. @table @option
  1200. @item channel_layout
  1201. The channel layout of the input stream. The default is "stereo".
  1202. @end table
  1203. For example, assuming a stereo input MP3 file,
  1204. @example
  1205. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1206. @end example
  1207. will create an output Matroska file with two audio streams, one containing only
  1208. the left channel and the other the right channel.
  1209. Split a 5.1 WAV file into per-channel files:
  1210. @example
  1211. ffmpeg -i in.wav -filter_complex
  1212. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1213. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1214. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1215. side_right.wav
  1216. @end example
  1217. @section chorus
  1218. Add a chorus effect to the audio.
  1219. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1220. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1221. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1222. The modulation depth defines the range the modulated delay is played before or after
  1223. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1224. sound tuned around the original one, like in a chorus where some vocals are slightly
  1225. off key.
  1226. It accepts the following parameters:
  1227. @table @option
  1228. @item in_gain
  1229. Set input gain. Default is 0.4.
  1230. @item out_gain
  1231. Set output gain. Default is 0.4.
  1232. @item delays
  1233. Set delays. A typical delay is around 40ms to 60ms.
  1234. @item decays
  1235. Set decays.
  1236. @item speeds
  1237. Set speeds.
  1238. @item depths
  1239. Set depths.
  1240. @end table
  1241. @subsection Examples
  1242. @itemize
  1243. @item
  1244. A single delay:
  1245. @example
  1246. chorus=0.7:0.9:55:0.4:0.25:2
  1247. @end example
  1248. @item
  1249. Two delays:
  1250. @example
  1251. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1252. @end example
  1253. @item
  1254. Fuller sounding chorus with three delays:
  1255. @example
  1256. 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
  1257. @end example
  1258. @end itemize
  1259. @section compand
  1260. Compress or expand the audio's dynamic range.
  1261. It accepts the following parameters:
  1262. @table @option
  1263. @item attacks
  1264. @item decays
  1265. A list of times in seconds for each channel over which the instantaneous level
  1266. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1267. increase of volume and @var{decays} refers to decrease of volume. For most
  1268. situations, the attack time (response to the audio getting louder) should be
  1269. shorter than the decay time, because the human ear is more sensitive to sudden
  1270. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1271. a typical value for decay is 0.8 seconds.
  1272. If specified number of attacks & decays is lower than number of channels, the last
  1273. set attack/decay will be used for all remaining channels.
  1274. @item points
  1275. A list of points for the transfer function, specified in dB relative to the
  1276. maximum possible signal amplitude. Each key points list must be defined using
  1277. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1278. @code{x0/y0 x1/y1 x2/y2 ....}
  1279. The input values must be in strictly increasing order but the transfer function
  1280. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1281. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1282. function are @code{-70/-70|-60/-20}.
  1283. @item soft-knee
  1284. Set the curve radius in dB for all joints. It defaults to 0.01.
  1285. @item gain
  1286. Set the additional gain in dB to be applied at all points on the transfer
  1287. function. This allows for easy adjustment of the overall gain.
  1288. It defaults to 0.
  1289. @item volume
  1290. Set an initial volume, in dB, to be assumed for each channel when filtering
  1291. starts. This permits the user to supply a nominal level initially, so that, for
  1292. example, a very large gain is not applied to initial signal levels before the
  1293. companding has begun to operate. A typical value for audio which is initially
  1294. quiet is -90 dB. It defaults to 0.
  1295. @item delay
  1296. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1297. delayed before being fed to the volume adjuster. Specifying a delay
  1298. approximately equal to the attack/decay times allows the filter to effectively
  1299. operate in predictive rather than reactive mode. It defaults to 0.
  1300. @end table
  1301. @subsection Examples
  1302. @itemize
  1303. @item
  1304. Make music with both quiet and loud passages suitable for listening to in a
  1305. noisy environment:
  1306. @example
  1307. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1308. @end example
  1309. Another example for audio with whisper and explosion parts:
  1310. @example
  1311. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1312. @end example
  1313. @item
  1314. A noise gate for when the noise is at a lower level than the signal:
  1315. @example
  1316. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1317. @end example
  1318. @item
  1319. Here is another noise gate, this time for when the noise is at a higher level
  1320. than the signal (making it, in some ways, similar to squelch):
  1321. @example
  1322. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1323. @end example
  1324. @end itemize
  1325. @section compensationdelay
  1326. Compensation Delay Line is a metric based delay to compensate differing
  1327. positions of microphones or speakers.
  1328. For example, you have recorded guitar with two microphones placed in
  1329. different location. Because the front of sound wave has fixed speed in
  1330. normal conditions, the phasing of microphones can vary and depends on
  1331. their location and interposition. The best sound mix can be achieved when
  1332. these microphones are in phase (synchronized). Note that distance of
  1333. ~30 cm between microphones makes one microphone to capture signal in
  1334. antiphase to another microphone. That makes the final mix sounding moody.
  1335. This filter helps to solve phasing problems by adding different delays
  1336. to each microphone track and make them synchronized.
  1337. The best result can be reached when you take one track as base and
  1338. synchronize other tracks one by one with it.
  1339. Remember that synchronization/delay tolerance depends on sample rate, too.
  1340. Higher sample rates will give more tolerance.
  1341. It accepts the following parameters:
  1342. @table @option
  1343. @item mm
  1344. Set millimeters distance. This is compensation distance for fine tuning.
  1345. Default is 0.
  1346. @item cm
  1347. Set cm distance. This is compensation distance for tightening distance setup.
  1348. Default is 0.
  1349. @item m
  1350. Set meters distance. This is compensation distance for hard distance setup.
  1351. Default is 0.
  1352. @item dry
  1353. Set dry amount. Amount of unprocessed (dry) signal.
  1354. Default is 0.
  1355. @item wet
  1356. Set wet amount. Amount of processed (wet) signal.
  1357. Default is 1.
  1358. @item temp
  1359. Set temperature degree in Celsius. This is the temperature of the environment.
  1360. Default is 20.
  1361. @end table
  1362. @section dcshift
  1363. Apply a DC shift to the audio.
  1364. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1365. in the recording chain) from the audio. The effect of a DC offset is reduced
  1366. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1367. a signal has a DC offset.
  1368. @table @option
  1369. @item shift
  1370. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1371. the audio.
  1372. @item limitergain
  1373. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1374. used to prevent clipping.
  1375. @end table
  1376. @section dynaudnorm
  1377. Dynamic Audio Normalizer.
  1378. This filter applies a certain amount of gain to the input audio in order
  1379. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1380. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1381. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1382. This allows for applying extra gain to the "quiet" sections of the audio
  1383. while avoiding distortions or clipping the "loud" sections. In other words:
  1384. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1385. sections, in the sense that the volume of each section is brought to the
  1386. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1387. this goal *without* applying "dynamic range compressing". It will retain 100%
  1388. of the dynamic range *within* each section of the audio file.
  1389. @table @option
  1390. @item f
  1391. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1392. Default is 500 milliseconds.
  1393. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1394. referred to as frames. This is required, because a peak magnitude has no
  1395. meaning for just a single sample value. Instead, we need to determine the
  1396. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1397. normalizer would simply use the peak magnitude of the complete file, the
  1398. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1399. frame. The length of a frame is specified in milliseconds. By default, the
  1400. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1401. been found to give good results with most files.
  1402. Note that the exact frame length, in number of samples, will be determined
  1403. automatically, based on the sampling rate of the individual input audio file.
  1404. @item g
  1405. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1406. number. Default is 31.
  1407. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1408. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1409. is specified in frames, centered around the current frame. For the sake of
  1410. simplicity, this must be an odd number. Consequently, the default value of 31
  1411. takes into account the current frame, as well as the 15 preceding frames and
  1412. the 15 subsequent frames. Using a larger window results in a stronger
  1413. smoothing effect and thus in less gain variation, i.e. slower gain
  1414. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1415. effect and thus in more gain variation, i.e. faster gain adaptation.
  1416. In other words, the more you increase this value, the more the Dynamic Audio
  1417. Normalizer will behave like a "traditional" normalization filter. On the
  1418. contrary, the more you decrease this value, the more the Dynamic Audio
  1419. Normalizer will behave like a dynamic range compressor.
  1420. @item p
  1421. Set the target peak value. This specifies the highest permissible magnitude
  1422. level for the normalized audio input. This filter will try to approach the
  1423. target peak magnitude as closely as possible, but at the same time it also
  1424. makes sure that the normalized signal will never exceed the peak magnitude.
  1425. A frame's maximum local gain factor is imposed directly by the target peak
  1426. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1427. It is not recommended to go above this value.
  1428. @item m
  1429. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1430. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1431. factor for each input frame, i.e. the maximum gain factor that does not
  1432. result in clipping or distortion. The maximum gain factor is determined by
  1433. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1434. additionally bounds the frame's maximum gain factor by a predetermined
  1435. (global) maximum gain factor. This is done in order to avoid excessive gain
  1436. factors in "silent" or almost silent frames. By default, the maximum gain
  1437. factor is 10.0, For most inputs the default value should be sufficient and
  1438. it usually is not recommended to increase this value. Though, for input
  1439. with an extremely low overall volume level, it may be necessary to allow even
  1440. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1441. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1442. Instead, a "sigmoid" threshold function will be applied. This way, the
  1443. gain factors will smoothly approach the threshold value, but never exceed that
  1444. value.
  1445. @item r
  1446. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1447. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1448. This means that the maximum local gain factor for each frame is defined
  1449. (only) by the frame's highest magnitude sample. This way, the samples can
  1450. be amplified as much as possible without exceeding the maximum signal
  1451. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1452. Normalizer can also take into account the frame's root mean square,
  1453. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1454. determine the power of a time-varying signal. It is therefore considered
  1455. that the RMS is a better approximation of the "perceived loudness" than
  1456. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1457. frames to a constant RMS value, a uniform "perceived loudness" can be
  1458. established. If a target RMS value has been specified, a frame's local gain
  1459. factor is defined as the factor that would result in exactly that RMS value.
  1460. Note, however, that the maximum local gain factor is still restricted by the
  1461. frame's highest magnitude sample, in order to prevent clipping.
  1462. @item n
  1463. Enable channels coupling. By default is enabled.
  1464. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1465. amount. This means the same gain factor will be applied to all channels, i.e.
  1466. the maximum possible gain factor is determined by the "loudest" channel.
  1467. However, in some recordings, it may happen that the volume of the different
  1468. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1469. In this case, this option can be used to disable the channel coupling. This way,
  1470. the gain factor will be determined independently for each channel, depending
  1471. only on the individual channel's highest magnitude sample. This allows for
  1472. harmonizing the volume of the different channels.
  1473. @item c
  1474. Enable DC bias correction. By default is disabled.
  1475. An audio signal (in the time domain) is a sequence of sample values.
  1476. In the Dynamic Audio Normalizer these sample values are represented in the
  1477. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1478. audio signal, or "waveform", should be centered around the zero point.
  1479. That means if we calculate the mean value of all samples in a file, or in a
  1480. single frame, then the result should be 0.0 or at least very close to that
  1481. value. If, however, there is a significant deviation of the mean value from
  1482. 0.0, in either positive or negative direction, this is referred to as a
  1483. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1484. Audio Normalizer provides optional DC bias correction.
  1485. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1486. the mean value, or "DC correction" offset, of each input frame and subtract
  1487. that value from all of the frame's sample values which ensures those samples
  1488. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1489. boundaries, the DC correction offset values will be interpolated smoothly
  1490. between neighbouring frames.
  1491. @item b
  1492. Enable alternative boundary mode. By default is disabled.
  1493. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1494. around each frame. This includes the preceding frames as well as the
  1495. subsequent frames. However, for the "boundary" frames, located at the very
  1496. beginning and at the very end of the audio file, not all neighbouring
  1497. frames are available. In particular, for the first few frames in the audio
  1498. file, the preceding frames are not known. And, similarly, for the last few
  1499. frames in the audio file, the subsequent frames are not known. Thus, the
  1500. question arises which gain factors should be assumed for the missing frames
  1501. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1502. to deal with this situation. The default boundary mode assumes a gain factor
  1503. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1504. "fade out" at the beginning and at the end of the input, respectively.
  1505. @item s
  1506. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1507. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1508. compression. This means that signal peaks will not be pruned and thus the
  1509. full dynamic range will be retained within each local neighbourhood. However,
  1510. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1511. normalization algorithm with a more "traditional" compression.
  1512. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1513. (thresholding) function. If (and only if) the compression feature is enabled,
  1514. all input frames will be processed by a soft knee thresholding function prior
  1515. to the actual normalization process. Put simply, the thresholding function is
  1516. going to prune all samples whose magnitude exceeds a certain threshold value.
  1517. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1518. value. Instead, the threshold value will be adjusted for each individual
  1519. frame.
  1520. In general, smaller parameters result in stronger compression, and vice versa.
  1521. Values below 3.0 are not recommended, because audible distortion may appear.
  1522. @end table
  1523. @section earwax
  1524. Make audio easier to listen to on headphones.
  1525. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1526. so that when listened to on headphones the stereo image is moved from
  1527. inside your head (standard for headphones) to outside and in front of
  1528. the listener (standard for speakers).
  1529. Ported from SoX.
  1530. @section equalizer
  1531. Apply a two-pole peaking equalisation (EQ) filter. With this
  1532. filter, the signal-level at and around a selected frequency can
  1533. be increased or decreased, whilst (unlike bandpass and bandreject
  1534. filters) that at all other frequencies is unchanged.
  1535. In order to produce complex equalisation curves, this filter can
  1536. be given several times, each with a different central frequency.
  1537. The filter accepts the following options:
  1538. @table @option
  1539. @item frequency, f
  1540. Set the filter's central frequency in Hz.
  1541. @item width_type
  1542. Set method to specify band-width of filter.
  1543. @table @option
  1544. @item h
  1545. Hz
  1546. @item q
  1547. Q-Factor
  1548. @item o
  1549. octave
  1550. @item s
  1551. slope
  1552. @end table
  1553. @item width, w
  1554. Specify the band-width of a filter in width_type units.
  1555. @item gain, g
  1556. Set the required gain or attenuation in dB.
  1557. Beware of clipping when using a positive gain.
  1558. @end table
  1559. @subsection Examples
  1560. @itemize
  1561. @item
  1562. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1563. @example
  1564. equalizer=f=1000:width_type=h:width=200:g=-10
  1565. @end example
  1566. @item
  1567. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1568. @example
  1569. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1570. @end example
  1571. @end itemize
  1572. @section extrastereo
  1573. Linearly increases the difference between left and right channels which
  1574. adds some sort of "live" effect to playback.
  1575. The filter accepts the following option:
  1576. @table @option
  1577. @item m
  1578. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1579. (average of both channels), with 1.0 sound will be unchanged, with
  1580. -1.0 left and right channels will be swapped.
  1581. @item c
  1582. Enable clipping. By default is enabled.
  1583. @end table
  1584. @section flanger
  1585. Apply a flanging effect to the audio.
  1586. The filter accepts the following options:
  1587. @table @option
  1588. @item delay
  1589. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1590. @item depth
  1591. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1592. @item regen
  1593. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1594. Default value is 0.
  1595. @item width
  1596. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1597. Default value is 71.
  1598. @item speed
  1599. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1600. @item shape
  1601. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1602. Default value is @var{sinusoidal}.
  1603. @item phase
  1604. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1605. Default value is 25.
  1606. @item interp
  1607. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1608. Default is @var{linear}.
  1609. @end table
  1610. @section highpass
  1611. Apply a high-pass filter with 3dB point frequency.
  1612. The filter can be either single-pole, or double-pole (the default).
  1613. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1614. The filter accepts the following options:
  1615. @table @option
  1616. @item frequency, f
  1617. Set frequency in Hz. Default is 3000.
  1618. @item poles, p
  1619. Set number of poles. Default is 2.
  1620. @item width_type
  1621. Set method to specify band-width of filter.
  1622. @table @option
  1623. @item h
  1624. Hz
  1625. @item q
  1626. Q-Factor
  1627. @item o
  1628. octave
  1629. @item s
  1630. slope
  1631. @end table
  1632. @item width, w
  1633. Specify the band-width of a filter in width_type units.
  1634. Applies only to double-pole filter.
  1635. The default is 0.707q and gives a Butterworth response.
  1636. @end table
  1637. @section join
  1638. Join multiple input streams into one multi-channel stream.
  1639. It accepts the following parameters:
  1640. @table @option
  1641. @item inputs
  1642. The number of input streams. It defaults to 2.
  1643. @item channel_layout
  1644. The desired output channel layout. It defaults to stereo.
  1645. @item map
  1646. Map channels from inputs to output. The argument is a '|'-separated list of
  1647. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  1648. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  1649. can be either the name of the input channel (e.g. FL for front left) or its
  1650. index in the specified input stream. @var{out_channel} is the name of the output
  1651. channel.
  1652. @end table
  1653. The filter will attempt to guess the mappings when they are not specified
  1654. explicitly. It does so by first trying to find an unused matching input channel
  1655. and if that fails it picks the first unused input channel.
  1656. Join 3 inputs (with properly set channel layouts):
  1657. @example
  1658. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1659. @end example
  1660. Build a 5.1 output from 6 single-channel streams:
  1661. @example
  1662. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1663. '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'
  1664. out
  1665. @end example
  1666. @section ladspa
  1667. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  1668. To enable compilation of this filter you need to configure FFmpeg with
  1669. @code{--enable-ladspa}.
  1670. @table @option
  1671. @item file, f
  1672. Specifies the name of LADSPA plugin library to load. If the environment
  1673. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  1674. each one of the directories specified by the colon separated list in
  1675. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  1676. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  1677. @file{/usr/lib/ladspa/}.
  1678. @item plugin, p
  1679. Specifies the plugin within the library. Some libraries contain only
  1680. one plugin, but others contain many of them. If this is not set filter
  1681. will list all available plugins within the specified library.
  1682. @item controls, c
  1683. Set the '|' separated list of controls which are zero or more floating point
  1684. values that determine the behavior of the loaded plugin (for example delay,
  1685. threshold or gain).
  1686. Controls need to be defined using the following syntax:
  1687. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  1688. @var{valuei} is the value set on the @var{i}-th control.
  1689. Alternatively they can be also defined using the following syntax:
  1690. @var{value0}|@var{value1}|@var{value2}|..., where
  1691. @var{valuei} is the value set on the @var{i}-th control.
  1692. If @option{controls} is set to @code{help}, all available controls and
  1693. their valid ranges are printed.
  1694. @item sample_rate, s
  1695. Specify the sample rate, default to 44100. Only used if plugin have
  1696. zero inputs.
  1697. @item nb_samples, n
  1698. Set the number of samples per channel per each output frame, default
  1699. is 1024. Only used if plugin have zero inputs.
  1700. @item duration, d
  1701. Set the minimum duration of the sourced audio. See
  1702. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1703. for the accepted syntax.
  1704. Note that the resulting duration may be greater than the specified duration,
  1705. as the generated audio is always cut at the end of a complete frame.
  1706. If not specified, or the expressed duration is negative, the audio is
  1707. supposed to be generated forever.
  1708. Only used if plugin have zero inputs.
  1709. @end table
  1710. @subsection Examples
  1711. @itemize
  1712. @item
  1713. List all available plugins within amp (LADSPA example plugin) library:
  1714. @example
  1715. ladspa=file=amp
  1716. @end example
  1717. @item
  1718. List all available controls and their valid ranges for @code{vcf_notch}
  1719. plugin from @code{VCF} library:
  1720. @example
  1721. ladspa=f=vcf:p=vcf_notch:c=help
  1722. @end example
  1723. @item
  1724. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  1725. plugin library:
  1726. @example
  1727. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  1728. @end example
  1729. @item
  1730. Add reverberation to the audio using TAP-plugins
  1731. (Tom's Audio Processing plugins):
  1732. @example
  1733. ladspa=file=tap_reverb:tap_reverb
  1734. @end example
  1735. @item
  1736. Generate white noise, with 0.2 amplitude:
  1737. @example
  1738. ladspa=file=cmt:noise_source_white:c=c0=.2
  1739. @end example
  1740. @item
  1741. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  1742. @code{C* Audio Plugin Suite} (CAPS) library:
  1743. @example
  1744. ladspa=file=caps:Click:c=c1=20'
  1745. @end example
  1746. @item
  1747. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  1748. @example
  1749. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  1750. @end example
  1751. @item
  1752. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  1753. @code{SWH Plugins} collection:
  1754. @example
  1755. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  1756. @end example
  1757. @item
  1758. Attenuate low frequencies using Multiband EQ from Steve Harris
  1759. @code{SWH Plugins} collection:
  1760. @example
  1761. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  1762. @end example
  1763. @end itemize
  1764. @subsection Commands
  1765. This filter supports the following commands:
  1766. @table @option
  1767. @item cN
  1768. Modify the @var{N}-th control value.
  1769. If the specified value is not valid, it is ignored and prior one is kept.
  1770. @end table
  1771. @section lowpass
  1772. Apply a low-pass filter with 3dB point frequency.
  1773. The filter can be either single-pole or double-pole (the default).
  1774. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1775. The filter accepts the following options:
  1776. @table @option
  1777. @item frequency, f
  1778. Set frequency in Hz. Default is 500.
  1779. @item poles, p
  1780. Set number of poles. Default is 2.
  1781. @item width_type
  1782. Set method to specify band-width of filter.
  1783. @table @option
  1784. @item h
  1785. Hz
  1786. @item q
  1787. Q-Factor
  1788. @item o
  1789. octave
  1790. @item s
  1791. slope
  1792. @end table
  1793. @item width, w
  1794. Specify the band-width of a filter in width_type units.
  1795. Applies only to double-pole filter.
  1796. The default is 0.707q and gives a Butterworth response.
  1797. @end table
  1798. @anchor{pan}
  1799. @section pan
  1800. Mix channels with specific gain levels. The filter accepts the output
  1801. channel layout followed by a set of channels definitions.
  1802. This filter is also designed to efficiently remap the channels of an audio
  1803. stream.
  1804. The filter accepts parameters of the form:
  1805. "@var{l}|@var{outdef}|@var{outdef}|..."
  1806. @table @option
  1807. @item l
  1808. output channel layout or number of channels
  1809. @item outdef
  1810. output channel specification, of the form:
  1811. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  1812. @item out_name
  1813. output channel to define, either a channel name (FL, FR, etc.) or a channel
  1814. number (c0, c1, etc.)
  1815. @item gain
  1816. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  1817. @item in_name
  1818. input channel to use, see out_name for details; it is not possible to mix
  1819. named and numbered input channels
  1820. @end table
  1821. If the `=' in a channel specification is replaced by `<', then the gains for
  1822. that specification will be renormalized so that the total is 1, thus
  1823. avoiding clipping noise.
  1824. @subsection Mixing examples
  1825. For example, if you want to down-mix from stereo to mono, but with a bigger
  1826. factor for the left channel:
  1827. @example
  1828. pan=1c|c0=0.9*c0+0.1*c1
  1829. @end example
  1830. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  1831. 7-channels surround:
  1832. @example
  1833. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  1834. @end example
  1835. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  1836. that should be preferred (see "-ac" option) unless you have very specific
  1837. needs.
  1838. @subsection Remapping examples
  1839. The channel remapping will be effective if, and only if:
  1840. @itemize
  1841. @item gain coefficients are zeroes or ones,
  1842. @item only one input per channel output,
  1843. @end itemize
  1844. If all these conditions are satisfied, the filter will notify the user ("Pure
  1845. channel mapping detected"), and use an optimized and lossless method to do the
  1846. remapping.
  1847. For example, if you have a 5.1 source and want a stereo audio stream by
  1848. dropping the extra channels:
  1849. @example
  1850. pan="stereo| c0=FL | c1=FR"
  1851. @end example
  1852. Given the same source, you can also switch front left and front right channels
  1853. and keep the input channel layout:
  1854. @example
  1855. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  1856. @end example
  1857. If the input is a stereo audio stream, you can mute the front left channel (and
  1858. still keep the stereo channel layout) with:
  1859. @example
  1860. pan="stereo|c1=c1"
  1861. @end example
  1862. Still with a stereo audio stream input, you can copy the right channel in both
  1863. front left and right:
  1864. @example
  1865. pan="stereo| c0=FR | c1=FR"
  1866. @end example
  1867. @section replaygain
  1868. ReplayGain scanner filter. This filter takes an audio stream as an input and
  1869. outputs it unchanged.
  1870. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  1871. @section resample
  1872. Convert the audio sample format, sample rate and channel layout. It is
  1873. not meant to be used directly.
  1874. @section rubberband
  1875. Apply time-stretching and pitch-shifting with librubberband.
  1876. The filter accepts the following options:
  1877. @table @option
  1878. @item tempo
  1879. Set tempo scale factor.
  1880. @item pitch
  1881. Set pitch scale factor.
  1882. @item transients
  1883. Set transients detector.
  1884. Possible values are:
  1885. @table @var
  1886. @item crisp
  1887. @item mixed
  1888. @item smooth
  1889. @end table
  1890. @item detector
  1891. Set detector.
  1892. Possible values are:
  1893. @table @var
  1894. @item compound
  1895. @item percussive
  1896. @item soft
  1897. @end table
  1898. @item phase
  1899. Set phase.
  1900. Possible values are:
  1901. @table @var
  1902. @item laminar
  1903. @item independent
  1904. @end table
  1905. @item window
  1906. Set processing window size.
  1907. Possible values are:
  1908. @table @var
  1909. @item standard
  1910. @item short
  1911. @item long
  1912. @end table
  1913. @item smoothing
  1914. Set smoothing.
  1915. Possible values are:
  1916. @table @var
  1917. @item off
  1918. @item on
  1919. @end table
  1920. @item formant
  1921. Enable formant preservation when shift pitching.
  1922. Possible values are:
  1923. @table @var
  1924. @item shifted
  1925. @item preserved
  1926. @end table
  1927. @item pitchq
  1928. Set pitch quality.
  1929. Possible values are:
  1930. @table @var
  1931. @item quality
  1932. @item speed
  1933. @item consistency
  1934. @end table
  1935. @item channels
  1936. Set channels.
  1937. Possible values are:
  1938. @table @var
  1939. @item apart
  1940. @item together
  1941. @end table
  1942. @end table
  1943. @section sidechaincompress
  1944. This filter acts like normal compressor but has the ability to compress
  1945. detected signal using second input signal.
  1946. It needs two input streams and returns one output stream.
  1947. First input stream will be processed depending on second stream signal.
  1948. The filtered signal then can be filtered with other filters in later stages of
  1949. processing. See @ref{pan} and @ref{amerge} filter.
  1950. The filter accepts the following options:
  1951. @table @option
  1952. @item level_in
  1953. Set input gain. Default is 1. Range is between 0.015625 and 64.
  1954. @item threshold
  1955. If a signal of second stream raises above this level it will affect the gain
  1956. reduction of first stream.
  1957. By default is 0.125. Range is between 0.00097563 and 1.
  1958. @item ratio
  1959. Set a ratio about which the signal is reduced. 1:2 means that if the level
  1960. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  1961. Default is 2. Range is between 1 and 20.
  1962. @item attack
  1963. Amount of milliseconds the signal has to rise above the threshold before gain
  1964. reduction starts. Default is 20. Range is between 0.01 and 2000.
  1965. @item release
  1966. Amount of milliseconds the signal has to fall below the threshold before
  1967. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  1968. @item makeup
  1969. Set the amount by how much signal will be amplified after processing.
  1970. Default is 2. Range is from 1 and 64.
  1971. @item knee
  1972. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1973. Default is 2.82843. Range is between 1 and 8.
  1974. @item link
  1975. Choose if the @code{average} level between all channels of side-chain stream
  1976. or the louder(@code{maximum}) channel of side-chain stream affects the
  1977. reduction. Default is @code{average}.
  1978. @item detection
  1979. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  1980. of @code{rms}. Default is @code{rms} which is mainly smoother.
  1981. @item level_sc
  1982. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  1983. @item mix
  1984. How much to use compressed signal in output. Default is 1.
  1985. Range is between 0 and 1.
  1986. @end table
  1987. @subsection Examples
  1988. @itemize
  1989. @item
  1990. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  1991. depending on the signal of 2nd input and later compressed signal to be
  1992. merged with 2nd input:
  1993. @example
  1994. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  1995. @end example
  1996. @end itemize
  1997. @section silencedetect
  1998. Detect silence in an audio stream.
  1999. This filter logs a message when it detects that the input audio volume is less
  2000. or equal to a noise tolerance value for a duration greater or equal to the
  2001. minimum detected noise duration.
  2002. The printed times and duration are expressed in seconds.
  2003. The filter accepts the following options:
  2004. @table @option
  2005. @item duration, d
  2006. Set silence duration until notification (default is 2 seconds).
  2007. @item noise, n
  2008. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2009. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2010. @end table
  2011. @subsection Examples
  2012. @itemize
  2013. @item
  2014. Detect 5 seconds of silence with -50dB noise tolerance:
  2015. @example
  2016. silencedetect=n=-50dB:d=5
  2017. @end example
  2018. @item
  2019. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2020. tolerance in @file{silence.mp3}:
  2021. @example
  2022. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2023. @end example
  2024. @end itemize
  2025. @section silenceremove
  2026. Remove silence from the beginning, middle or end of the audio.
  2027. The filter accepts the following options:
  2028. @table @option
  2029. @item start_periods
  2030. This value is used to indicate if audio should be trimmed at beginning of
  2031. the audio. A value of zero indicates no silence should be trimmed from the
  2032. beginning. When specifying a non-zero value, it trims audio up until it
  2033. finds non-silence. Normally, when trimming silence from beginning of audio
  2034. the @var{start_periods} will be @code{1} but it can be increased to higher
  2035. values to trim all audio up to specific count of non-silence periods.
  2036. Default value is @code{0}.
  2037. @item start_duration
  2038. Specify the amount of time that non-silence must be detected before it stops
  2039. trimming audio. By increasing the duration, bursts of noises can be treated
  2040. as silence and trimmed off. Default value is @code{0}.
  2041. @item start_threshold
  2042. This indicates what sample value should be treated as silence. For digital
  2043. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2044. you may wish to increase the value to account for background noise.
  2045. Can be specified in dB (in case "dB" is appended to the specified value)
  2046. or amplitude ratio. Default value is @code{0}.
  2047. @item stop_periods
  2048. Set the count for trimming silence from the end of audio.
  2049. To remove silence from the middle of a file, specify a @var{stop_periods}
  2050. that is negative. This value is then treated as a positive value and is
  2051. used to indicate the effect should restart processing as specified by
  2052. @var{start_periods}, making it suitable for removing periods of silence
  2053. in the middle of the audio.
  2054. Default value is @code{0}.
  2055. @item stop_duration
  2056. Specify a duration of silence that must exist before audio is not copied any
  2057. more. By specifying a higher duration, silence that is wanted can be left in
  2058. the audio.
  2059. Default value is @code{0}.
  2060. @item stop_threshold
  2061. This is the same as @option{start_threshold} but for trimming silence from
  2062. the end of audio.
  2063. Can be specified in dB (in case "dB" is appended to the specified value)
  2064. or amplitude ratio. Default value is @code{0}.
  2065. @item leave_silence
  2066. This indicate that @var{stop_duration} length of audio should be left intact
  2067. at the beginning of each period of silence.
  2068. For example, if you want to remove long pauses between words but do not want
  2069. to remove the pauses completely. Default value is @code{0}.
  2070. @end table
  2071. @subsection Examples
  2072. @itemize
  2073. @item
  2074. The following example shows how this filter can be used to start a recording
  2075. that does not contain the delay at the start which usually occurs between
  2076. pressing the record button and the start of the performance:
  2077. @example
  2078. silenceremove=1:5:0.02
  2079. @end example
  2080. @end itemize
  2081. @section stereotools
  2082. This filter has some handy utilities to manage stereo signals, for converting
  2083. M/S stereo recordings to L/R signal while having control over the parameters
  2084. or spreading the stereo image of master track.
  2085. The filter accepts the following options:
  2086. @table @option
  2087. @item level_in
  2088. Set input level before filtering for both channels. Defaults is 1.
  2089. Allowed range is from 0.015625 to 64.
  2090. @item level_out
  2091. Set output level after filtering for both channels. Defaults is 1.
  2092. Allowed range is from 0.015625 to 64.
  2093. @item balance_in
  2094. Set input balance between both channels. Default is 0.
  2095. Allowed range is from -1 to 1.
  2096. @item balance_out
  2097. Set output balance between both channels. Default is 0.
  2098. Allowed range is from -1 to 1.
  2099. @item softclip
  2100. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2101. clipping. Disabled by default.
  2102. @item mutel
  2103. Mute the left channel. Disabled by default.
  2104. @item muter
  2105. Mute the right channel. Disabled by default.
  2106. @item phasel
  2107. Change the phase of the left channel. Disabled by default.
  2108. @item phaser
  2109. Change the phase of the right channel. Disabled by default.
  2110. @item mode
  2111. Set stereo mode. Available values are:
  2112. @table @samp
  2113. @item lr>lr
  2114. Left/Right to Left/Right, this is default.
  2115. @item lr>ms
  2116. Left/Right to Mid/Side.
  2117. @item ms>lr
  2118. Mid/Side to Left/Right.
  2119. @item lr>ll
  2120. Left/Right to Left/Left.
  2121. @item lr>rr
  2122. Left/Right to Right/Right.
  2123. @item lr>l+r
  2124. Left/Right to Left + Right.
  2125. @item lr>rl
  2126. Left/Right to Right/Left.
  2127. @end table
  2128. @item slev
  2129. Set level of side signal. Default is 1.
  2130. Allowed range is from 0.015625 to 64.
  2131. @item sbal
  2132. Set balance of side signal. Default is 0.
  2133. Allowed range is from -1 to 1.
  2134. @item mlev
  2135. Set level of the middle signal. Default is 1.
  2136. Allowed range is from 0.015625 to 64.
  2137. @item mpan
  2138. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2139. @item base
  2140. Set stereo base between mono and inversed channels. Default is 0.
  2141. Allowed range is from -1 to 1.
  2142. @item delay
  2143. Set delay in milliseconds how much to delay left from right channel and
  2144. vice versa. Default is 0. Allowed range is from -20 to 20.
  2145. @item sclevel
  2146. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2147. @item phase
  2148. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2149. @end table
  2150. @section stereowiden
  2151. This filter enhance the stereo effect by suppressing signal common to both
  2152. channels and by delaying the signal of left into right and vice versa,
  2153. thereby widening the stereo effect.
  2154. The filter accepts the following options:
  2155. @table @option
  2156. @item delay
  2157. Time in milliseconds of the delay of left signal into right and vice versa.
  2158. Default is 20 milliseconds.
  2159. @item feedback
  2160. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2161. effect of left signal in right output and vice versa which gives widening
  2162. effect. Default is 0.3.
  2163. @item crossfeed
  2164. Cross feed of left into right with inverted phase. This helps in suppressing
  2165. the mono. If the value is 1 it will cancel all the signal common to both
  2166. channels. Default is 0.3.
  2167. @item drymix
  2168. Set level of input signal of original channel. Default is 0.8.
  2169. @end table
  2170. @section treble
  2171. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2172. shelving filter with a response similar to that of a standard
  2173. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2174. The filter accepts the following options:
  2175. @table @option
  2176. @item gain, g
  2177. Give the gain at whichever is the lower of ~22 kHz and the
  2178. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2179. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2180. @item frequency, f
  2181. Set the filter's central frequency and so can be used
  2182. to extend or reduce the frequency range to be boosted or cut.
  2183. The default value is @code{3000} Hz.
  2184. @item width_type
  2185. Set method to specify band-width of filter.
  2186. @table @option
  2187. @item h
  2188. Hz
  2189. @item q
  2190. Q-Factor
  2191. @item o
  2192. octave
  2193. @item s
  2194. slope
  2195. @end table
  2196. @item width, w
  2197. Determine how steep is the filter's shelf transition.
  2198. @end table
  2199. @section tremolo
  2200. Sinusoidal amplitude modulation.
  2201. The filter accepts the following options:
  2202. @table @option
  2203. @item f
  2204. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2205. (20 Hz or lower) will result in a tremolo effect.
  2206. This filter may also be used as a ring modulator by specifying
  2207. a modulation frequency higher than 20 Hz.
  2208. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2209. @item d
  2210. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2211. Default value is 0.5.
  2212. @end table
  2213. @section vibrato
  2214. Sinusoidal phase modulation.
  2215. The filter accepts the following options:
  2216. @table @option
  2217. @item f
  2218. Modulation frequency in Hertz.
  2219. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2220. @item d
  2221. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2222. Default value is 0.5.
  2223. @end table
  2224. @section volume
  2225. Adjust the input audio volume.
  2226. It accepts the following parameters:
  2227. @table @option
  2228. @item volume
  2229. Set audio volume expression.
  2230. Output values are clipped to the maximum value.
  2231. The output audio volume is given by the relation:
  2232. @example
  2233. @var{output_volume} = @var{volume} * @var{input_volume}
  2234. @end example
  2235. The default value for @var{volume} is "1.0".
  2236. @item precision
  2237. This parameter represents the mathematical precision.
  2238. It determines which input sample formats will be allowed, which affects the
  2239. precision of the volume scaling.
  2240. @table @option
  2241. @item fixed
  2242. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2243. @item float
  2244. 32-bit floating-point; this limits input sample format to FLT. (default)
  2245. @item double
  2246. 64-bit floating-point; this limits input sample format to DBL.
  2247. @end table
  2248. @item replaygain
  2249. Choose the behaviour on encountering ReplayGain side data in input frames.
  2250. @table @option
  2251. @item drop
  2252. Remove ReplayGain side data, ignoring its contents (the default).
  2253. @item ignore
  2254. Ignore ReplayGain side data, but leave it in the frame.
  2255. @item track
  2256. Prefer the track gain, if present.
  2257. @item album
  2258. Prefer the album gain, if present.
  2259. @end table
  2260. @item replaygain_preamp
  2261. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2262. Default value for @var{replaygain_preamp} is 0.0.
  2263. @item eval
  2264. Set when the volume expression is evaluated.
  2265. It accepts the following values:
  2266. @table @samp
  2267. @item once
  2268. only evaluate expression once during the filter initialization, or
  2269. when the @samp{volume} command is sent
  2270. @item frame
  2271. evaluate expression for each incoming frame
  2272. @end table
  2273. Default value is @samp{once}.
  2274. @end table
  2275. The volume expression can contain the following parameters.
  2276. @table @option
  2277. @item n
  2278. frame number (starting at zero)
  2279. @item nb_channels
  2280. number of channels
  2281. @item nb_consumed_samples
  2282. number of samples consumed by the filter
  2283. @item nb_samples
  2284. number of samples in the current frame
  2285. @item pos
  2286. original frame position in the file
  2287. @item pts
  2288. frame PTS
  2289. @item sample_rate
  2290. sample rate
  2291. @item startpts
  2292. PTS at start of stream
  2293. @item startt
  2294. time at start of stream
  2295. @item t
  2296. frame time
  2297. @item tb
  2298. timestamp timebase
  2299. @item volume
  2300. last set volume value
  2301. @end table
  2302. Note that when @option{eval} is set to @samp{once} only the
  2303. @var{sample_rate} and @var{tb} variables are available, all other
  2304. variables will evaluate to NAN.
  2305. @subsection Commands
  2306. This filter supports the following commands:
  2307. @table @option
  2308. @item volume
  2309. Modify the volume expression.
  2310. The command accepts the same syntax of the corresponding option.
  2311. If the specified expression is not valid, it is kept at its current
  2312. value.
  2313. @item replaygain_noclip
  2314. Prevent clipping by limiting the gain applied.
  2315. Default value for @var{replaygain_noclip} is 1.
  2316. @end table
  2317. @subsection Examples
  2318. @itemize
  2319. @item
  2320. Halve the input audio volume:
  2321. @example
  2322. volume=volume=0.5
  2323. volume=volume=1/2
  2324. volume=volume=-6.0206dB
  2325. @end example
  2326. In all the above example the named key for @option{volume} can be
  2327. omitted, for example like in:
  2328. @example
  2329. volume=0.5
  2330. @end example
  2331. @item
  2332. Increase input audio power by 6 decibels using fixed-point precision:
  2333. @example
  2334. volume=volume=6dB:precision=fixed
  2335. @end example
  2336. @item
  2337. Fade volume after time 10 with an annihilation period of 5 seconds:
  2338. @example
  2339. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2340. @end example
  2341. @end itemize
  2342. @section volumedetect
  2343. Detect the volume of the input video.
  2344. The filter has no parameters. The input is not modified. Statistics about
  2345. the volume will be printed in the log when the input stream end is reached.
  2346. In particular it will show the mean volume (root mean square), maximum
  2347. volume (on a per-sample basis), and the beginning of a histogram of the
  2348. registered volume values (from the maximum value to a cumulated 1/1000 of
  2349. the samples).
  2350. All volumes are in decibels relative to the maximum PCM value.
  2351. @subsection Examples
  2352. Here is an excerpt of the output:
  2353. @example
  2354. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2355. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2356. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2357. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2358. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2359. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2360. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2361. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2362. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2363. @end example
  2364. It means that:
  2365. @itemize
  2366. @item
  2367. The mean square energy is approximately -27 dB, or 10^-2.7.
  2368. @item
  2369. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2370. @item
  2371. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2372. @end itemize
  2373. In other words, raising the volume by +4 dB does not cause any clipping,
  2374. raising it by +5 dB causes clipping for 6 samples, etc.
  2375. @c man end AUDIO FILTERS
  2376. @chapter Audio Sources
  2377. @c man begin AUDIO SOURCES
  2378. Below is a description of the currently available audio sources.
  2379. @section abuffer
  2380. Buffer audio frames, and make them available to the filter chain.
  2381. This source is mainly intended for a programmatic use, in particular
  2382. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2383. It accepts the following parameters:
  2384. @table @option
  2385. @item time_base
  2386. The timebase which will be used for timestamps of submitted frames. It must be
  2387. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2388. @item sample_rate
  2389. The sample rate of the incoming audio buffers.
  2390. @item sample_fmt
  2391. The sample format of the incoming audio buffers.
  2392. Either a sample format name or its corresponding integer representation from
  2393. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2394. @item channel_layout
  2395. The channel layout of the incoming audio buffers.
  2396. Either a channel layout name from channel_layout_map in
  2397. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2398. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2399. @item channels
  2400. The number of channels of the incoming audio buffers.
  2401. If both @var{channels} and @var{channel_layout} are specified, then they
  2402. must be consistent.
  2403. @end table
  2404. @subsection Examples
  2405. @example
  2406. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2407. @end example
  2408. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2409. Since the sample format with name "s16p" corresponds to the number
  2410. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2411. equivalent to:
  2412. @example
  2413. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2414. @end example
  2415. @section aevalsrc
  2416. Generate an audio signal specified by an expression.
  2417. This source accepts in input one or more expressions (one for each
  2418. channel), which are evaluated and used to generate a corresponding
  2419. audio signal.
  2420. This source accepts the following options:
  2421. @table @option
  2422. @item exprs
  2423. Set the '|'-separated expressions list for each separate channel. In case the
  2424. @option{channel_layout} option is not specified, the selected channel layout
  2425. depends on the number of provided expressions. Otherwise the last
  2426. specified expression is applied to the remaining output channels.
  2427. @item channel_layout, c
  2428. Set the channel layout. The number of channels in the specified layout
  2429. must be equal to the number of specified expressions.
  2430. @item duration, d
  2431. Set the minimum duration of the sourced audio. See
  2432. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2433. for the accepted syntax.
  2434. Note that the resulting duration may be greater than the specified
  2435. duration, as the generated audio is always cut at the end of a
  2436. complete frame.
  2437. If not specified, or the expressed duration is negative, the audio is
  2438. supposed to be generated forever.
  2439. @item nb_samples, n
  2440. Set the number of samples per channel per each output frame,
  2441. default to 1024.
  2442. @item sample_rate, s
  2443. Specify the sample rate, default to 44100.
  2444. @end table
  2445. Each expression in @var{exprs} can contain the following constants:
  2446. @table @option
  2447. @item n
  2448. number of the evaluated sample, starting from 0
  2449. @item t
  2450. time of the evaluated sample expressed in seconds, starting from 0
  2451. @item s
  2452. sample rate
  2453. @end table
  2454. @subsection Examples
  2455. @itemize
  2456. @item
  2457. Generate silence:
  2458. @example
  2459. aevalsrc=0
  2460. @end example
  2461. @item
  2462. Generate a sin signal with frequency of 440 Hz, set sample rate to
  2463. 8000 Hz:
  2464. @example
  2465. aevalsrc="sin(440*2*PI*t):s=8000"
  2466. @end example
  2467. @item
  2468. Generate a two channels signal, specify the channel layout (Front
  2469. Center + Back Center) explicitly:
  2470. @example
  2471. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  2472. @end example
  2473. @item
  2474. Generate white noise:
  2475. @example
  2476. aevalsrc="-2+random(0)"
  2477. @end example
  2478. @item
  2479. Generate an amplitude modulated signal:
  2480. @example
  2481. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  2482. @end example
  2483. @item
  2484. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  2485. @example
  2486. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  2487. @end example
  2488. @end itemize
  2489. @section anullsrc
  2490. The null audio source, return unprocessed audio frames. It is mainly useful
  2491. as a template and to be employed in analysis / debugging tools, or as
  2492. the source for filters which ignore the input data (for example the sox
  2493. synth filter).
  2494. This source accepts the following options:
  2495. @table @option
  2496. @item channel_layout, cl
  2497. Specifies the channel layout, and can be either an integer or a string
  2498. representing a channel layout. The default value of @var{channel_layout}
  2499. is "stereo".
  2500. Check the channel_layout_map definition in
  2501. @file{libavutil/channel_layout.c} for the mapping between strings and
  2502. channel layout values.
  2503. @item sample_rate, r
  2504. Specifies the sample rate, and defaults to 44100.
  2505. @item nb_samples, n
  2506. Set the number of samples per requested frames.
  2507. @end table
  2508. @subsection Examples
  2509. @itemize
  2510. @item
  2511. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  2512. @example
  2513. anullsrc=r=48000:cl=4
  2514. @end example
  2515. @item
  2516. Do the same operation with a more obvious syntax:
  2517. @example
  2518. anullsrc=r=48000:cl=mono
  2519. @end example
  2520. @end itemize
  2521. All the parameters need to be explicitly defined.
  2522. @section flite
  2523. Synthesize a voice utterance using the libflite library.
  2524. To enable compilation of this filter you need to configure FFmpeg with
  2525. @code{--enable-libflite}.
  2526. Note that the flite library is not thread-safe.
  2527. The filter accepts the following options:
  2528. @table @option
  2529. @item list_voices
  2530. If set to 1, list the names of the available voices and exit
  2531. immediately. Default value is 0.
  2532. @item nb_samples, n
  2533. Set the maximum number of samples per frame. Default value is 512.
  2534. @item textfile
  2535. Set the filename containing the text to speak.
  2536. @item text
  2537. Set the text to speak.
  2538. @item voice, v
  2539. Set the voice to use for the speech synthesis. Default value is
  2540. @code{kal}. See also the @var{list_voices} option.
  2541. @end table
  2542. @subsection Examples
  2543. @itemize
  2544. @item
  2545. Read from file @file{speech.txt}, and synthesize the text using the
  2546. standard flite voice:
  2547. @example
  2548. flite=textfile=speech.txt
  2549. @end example
  2550. @item
  2551. Read the specified text selecting the @code{slt} voice:
  2552. @example
  2553. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2554. @end example
  2555. @item
  2556. Input text to ffmpeg:
  2557. @example
  2558. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2559. @end example
  2560. @item
  2561. Make @file{ffplay} speak the specified text, using @code{flite} and
  2562. the @code{lavfi} device:
  2563. @example
  2564. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  2565. @end example
  2566. @end itemize
  2567. For more information about libflite, check:
  2568. @url{http://www.speech.cs.cmu.edu/flite/}
  2569. @section anoisesrc
  2570. Generate a noise audio signal.
  2571. The filter accepts the following options:
  2572. @table @option
  2573. @item sample_rate, r
  2574. Specify the sample rate. Default value is 48000 Hz.
  2575. @item amplitude, a
  2576. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  2577. is 1.0.
  2578. @item duration, d
  2579. Specify the duration of the generated audio stream. Not specifying this option
  2580. results in noise with an infinite length.
  2581. @item color, colour, c
  2582. Specify the color of noise. Available noise colors are white, pink, and brown.
  2583. Default color is white.
  2584. @item seed, s
  2585. Specify a value used to seed the PRNG.
  2586. @item nb_samples, n
  2587. Set the number of samples per each output frame, default is 1024.
  2588. @end table
  2589. @subsection Examples
  2590. @itemize
  2591. @item
  2592. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  2593. @example
  2594. anoisesrc=d=60:c=pink:r=44100:a=0.5
  2595. @end example
  2596. @end itemize
  2597. @section sine
  2598. Generate an audio signal made of a sine wave with amplitude 1/8.
  2599. The audio signal is bit-exact.
  2600. The filter accepts the following options:
  2601. @table @option
  2602. @item frequency, f
  2603. Set the carrier frequency. Default is 440 Hz.
  2604. @item beep_factor, b
  2605. Enable a periodic beep every second with frequency @var{beep_factor} times
  2606. the carrier frequency. Default is 0, meaning the beep is disabled.
  2607. @item sample_rate, r
  2608. Specify the sample rate, default is 44100.
  2609. @item duration, d
  2610. Specify the duration of the generated audio stream.
  2611. @item samples_per_frame
  2612. Set the number of samples per output frame.
  2613. The expression can contain the following constants:
  2614. @table @option
  2615. @item n
  2616. The (sequential) number of the output audio frame, starting from 0.
  2617. @item pts
  2618. The PTS (Presentation TimeStamp) of the output audio frame,
  2619. expressed in @var{TB} units.
  2620. @item t
  2621. The PTS of the output audio frame, expressed in seconds.
  2622. @item TB
  2623. The timebase of the output audio frames.
  2624. @end table
  2625. Default is @code{1024}.
  2626. @end table
  2627. @subsection Examples
  2628. @itemize
  2629. @item
  2630. Generate a simple 440 Hz sine wave:
  2631. @example
  2632. sine
  2633. @end example
  2634. @item
  2635. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  2636. @example
  2637. sine=220:4:d=5
  2638. sine=f=220:b=4:d=5
  2639. sine=frequency=220:beep_factor=4:duration=5
  2640. @end example
  2641. @item
  2642. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  2643. pattern:
  2644. @example
  2645. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  2646. @end example
  2647. @end itemize
  2648. @c man end AUDIO SOURCES
  2649. @chapter Audio Sinks
  2650. @c man begin AUDIO SINKS
  2651. Below is a description of the currently available audio sinks.
  2652. @section abuffersink
  2653. Buffer audio frames, and make them available to the end of filter chain.
  2654. This sink is mainly intended for programmatic use, in particular
  2655. through the interface defined in @file{libavfilter/buffersink.h}
  2656. or the options system.
  2657. It accepts a pointer to an AVABufferSinkContext structure, which
  2658. defines the incoming buffers' formats, to be passed as the opaque
  2659. parameter to @code{avfilter_init_filter} for initialization.
  2660. @section anullsink
  2661. Null audio sink; do absolutely nothing with the input audio. It is
  2662. mainly useful as a template and for use in analysis / debugging
  2663. tools.
  2664. @c man end AUDIO SINKS
  2665. @chapter Video Filters
  2666. @c man begin VIDEO FILTERS
  2667. When you configure your FFmpeg build, you can disable any of the
  2668. existing filters using @code{--disable-filters}.
  2669. The configure output will show the video filters included in your
  2670. build.
  2671. Below is a description of the currently available video filters.
  2672. @section alphaextract
  2673. Extract the alpha component from the input as a grayscale video. This
  2674. is especially useful with the @var{alphamerge} filter.
  2675. @section alphamerge
  2676. Add or replace the alpha component of the primary input with the
  2677. grayscale value of a second input. This is intended for use with
  2678. @var{alphaextract} to allow the transmission or storage of frame
  2679. sequences that have alpha in a format that doesn't support an alpha
  2680. channel.
  2681. For example, to reconstruct full frames from a normal YUV-encoded video
  2682. and a separate video created with @var{alphaextract}, you might use:
  2683. @example
  2684. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  2685. @end example
  2686. Since this filter is designed for reconstruction, it operates on frame
  2687. sequences without considering timestamps, and terminates when either
  2688. input reaches end of stream. This will cause problems if your encoding
  2689. pipeline drops frames. If you're trying to apply an image as an
  2690. overlay to a video stream, consider the @var{overlay} filter instead.
  2691. @section ass
  2692. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  2693. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  2694. Substation Alpha) subtitles files.
  2695. This filter accepts the following option in addition to the common options from
  2696. the @ref{subtitles} filter:
  2697. @table @option
  2698. @item shaping
  2699. Set the shaping engine
  2700. Available values are:
  2701. @table @samp
  2702. @item auto
  2703. The default libass shaping engine, which is the best available.
  2704. @item simple
  2705. Fast, font-agnostic shaper that can do only substitutions
  2706. @item complex
  2707. Slower shaper using OpenType for substitutions and positioning
  2708. @end table
  2709. The default is @code{auto}.
  2710. @end table
  2711. @section atadenoise
  2712. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  2713. The filter accepts the following options:
  2714. @table @option
  2715. @item 0a
  2716. Set threshold A for 1st plane. Default is 0.02.
  2717. Valid range is 0 to 0.3.
  2718. @item 0b
  2719. Set threshold B for 1st plane. Default is 0.04.
  2720. Valid range is 0 to 5.
  2721. @item 1a
  2722. Set threshold A for 2nd plane. Default is 0.02.
  2723. Valid range is 0 to 0.3.
  2724. @item 1b
  2725. Set threshold B for 2nd plane. Default is 0.04.
  2726. Valid range is 0 to 5.
  2727. @item 2a
  2728. Set threshold A for 3rd plane. Default is 0.02.
  2729. Valid range is 0 to 0.3.
  2730. @item 2b
  2731. Set threshold B for 3rd plane. Default is 0.04.
  2732. Valid range is 0 to 5.
  2733. Threshold A is designed to react on abrupt changes in the input signal and
  2734. threshold B is designed to react on continuous changes in the input signal.
  2735. @item s
  2736. Set number of frames filter will use for averaging. Default is 33. Must be odd
  2737. number in range [5, 129].
  2738. @end table
  2739. @section bbox
  2740. Compute the bounding box for the non-black pixels in the input frame
  2741. luminance plane.
  2742. This filter computes the bounding box containing all the pixels with a
  2743. luminance value greater than the minimum allowed value.
  2744. The parameters describing the bounding box are printed on the filter
  2745. log.
  2746. The filter accepts the following option:
  2747. @table @option
  2748. @item min_val
  2749. Set the minimal luminance value. Default is @code{16}.
  2750. @end table
  2751. @section blackdetect
  2752. Detect video intervals that are (almost) completely black. Can be
  2753. useful to detect chapter transitions, commercials, or invalid
  2754. recordings. Output lines contains the time for the start, end and
  2755. duration of the detected black interval expressed in seconds.
  2756. In order to display the output lines, you need to set the loglevel at
  2757. least to the AV_LOG_INFO value.
  2758. The filter accepts the following options:
  2759. @table @option
  2760. @item black_min_duration, d
  2761. Set the minimum detected black duration expressed in seconds. It must
  2762. be a non-negative floating point number.
  2763. Default value is 2.0.
  2764. @item picture_black_ratio_th, pic_th
  2765. Set the threshold for considering a picture "black".
  2766. Express the minimum value for the ratio:
  2767. @example
  2768. @var{nb_black_pixels} / @var{nb_pixels}
  2769. @end example
  2770. for which a picture is considered black.
  2771. Default value is 0.98.
  2772. @item pixel_black_th, pix_th
  2773. Set the threshold for considering a pixel "black".
  2774. The threshold expresses the maximum pixel luminance value for which a
  2775. pixel is considered "black". The provided value is scaled according to
  2776. the following equation:
  2777. @example
  2778. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  2779. @end example
  2780. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  2781. the input video format, the range is [0-255] for YUV full-range
  2782. formats and [16-235] for YUV non full-range formats.
  2783. Default value is 0.10.
  2784. @end table
  2785. The following example sets the maximum pixel threshold to the minimum
  2786. value, and detects only black intervals of 2 or more seconds:
  2787. @example
  2788. blackdetect=d=2:pix_th=0.00
  2789. @end example
  2790. @section blackframe
  2791. Detect frames that are (almost) completely black. Can be useful to
  2792. detect chapter transitions or commercials. Output lines consist of
  2793. the frame number of the detected frame, the percentage of blackness,
  2794. the position in the file if known or -1 and the timestamp in seconds.
  2795. In order to display the output lines, you need to set the loglevel at
  2796. least to the AV_LOG_INFO value.
  2797. It accepts the following parameters:
  2798. @table @option
  2799. @item amount
  2800. The percentage of the pixels that have to be below the threshold; it defaults to
  2801. @code{98}.
  2802. @item threshold, thresh
  2803. The threshold below which a pixel value is considered black; it defaults to
  2804. @code{32}.
  2805. @end table
  2806. @section blend, tblend
  2807. Blend two video frames into each other.
  2808. The @code{blend} filter takes two input streams and outputs one
  2809. stream, the first input is the "top" layer and second input is
  2810. "bottom" layer. Output terminates when shortest input terminates.
  2811. The @code{tblend} (time blend) filter takes two consecutive frames
  2812. from one single stream, and outputs the result obtained by blending
  2813. the new frame on top of the old frame.
  2814. A description of the accepted options follows.
  2815. @table @option
  2816. @item c0_mode
  2817. @item c1_mode
  2818. @item c2_mode
  2819. @item c3_mode
  2820. @item all_mode
  2821. Set blend mode for specific pixel component or all pixel components in case
  2822. of @var{all_mode}. Default value is @code{normal}.
  2823. Available values for component modes are:
  2824. @table @samp
  2825. @item addition
  2826. @item addition128
  2827. @item and
  2828. @item average
  2829. @item burn
  2830. @item darken
  2831. @item difference
  2832. @item difference128
  2833. @item divide
  2834. @item dodge
  2835. @item exclusion
  2836. @item glow
  2837. @item hardlight
  2838. @item hardmix
  2839. @item lighten
  2840. @item linearlight
  2841. @item multiply
  2842. @item negation
  2843. @item normal
  2844. @item or
  2845. @item overlay
  2846. @item phoenix
  2847. @item pinlight
  2848. @item reflect
  2849. @item screen
  2850. @item softlight
  2851. @item subtract
  2852. @item vividlight
  2853. @item xor
  2854. @end table
  2855. @item c0_opacity
  2856. @item c1_opacity
  2857. @item c2_opacity
  2858. @item c3_opacity
  2859. @item all_opacity
  2860. Set blend opacity for specific pixel component or all pixel components in case
  2861. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  2862. @item c0_expr
  2863. @item c1_expr
  2864. @item c2_expr
  2865. @item c3_expr
  2866. @item all_expr
  2867. Set blend expression for specific pixel component or all pixel components in case
  2868. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  2869. The expressions can use the following variables:
  2870. @table @option
  2871. @item N
  2872. The sequential number of the filtered frame, starting from @code{0}.
  2873. @item X
  2874. @item Y
  2875. the coordinates of the current sample
  2876. @item W
  2877. @item H
  2878. the width and height of currently filtered plane
  2879. @item SW
  2880. @item SH
  2881. Width and height scale depending on the currently filtered plane. It is the
  2882. ratio between the corresponding luma plane number of pixels and the current
  2883. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  2884. @code{0.5,0.5} for chroma planes.
  2885. @item T
  2886. Time of the current frame, expressed in seconds.
  2887. @item TOP, A
  2888. Value of pixel component at current location for first video frame (top layer).
  2889. @item BOTTOM, B
  2890. Value of pixel component at current location for second video frame (bottom layer).
  2891. @end table
  2892. @item shortest
  2893. Force termination when the shortest input terminates. Default is
  2894. @code{0}. This option is only defined for the @code{blend} filter.
  2895. @item repeatlast
  2896. Continue applying the last bottom frame after the end of the stream. A value of
  2897. @code{0} disable the filter after the last frame of the bottom layer is reached.
  2898. Default is @code{1}. This option is only defined for the @code{blend} filter.
  2899. @end table
  2900. @subsection Examples
  2901. @itemize
  2902. @item
  2903. Apply transition from bottom layer to top layer in first 10 seconds:
  2904. @example
  2905. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  2906. @end example
  2907. @item
  2908. Apply 1x1 checkerboard effect:
  2909. @example
  2910. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  2911. @end example
  2912. @item
  2913. Apply uncover left effect:
  2914. @example
  2915. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  2916. @end example
  2917. @item
  2918. Apply uncover down effect:
  2919. @example
  2920. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  2921. @end example
  2922. @item
  2923. Apply uncover up-left effect:
  2924. @example
  2925. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  2926. @end example
  2927. @item
  2928. Display differences between the current and the previous frame:
  2929. @example
  2930. tblend=all_mode=difference128
  2931. @end example
  2932. @end itemize
  2933. @section boxblur
  2934. Apply a boxblur algorithm to the input video.
  2935. It accepts the following parameters:
  2936. @table @option
  2937. @item luma_radius, lr
  2938. @item luma_power, lp
  2939. @item chroma_radius, cr
  2940. @item chroma_power, cp
  2941. @item alpha_radius, ar
  2942. @item alpha_power, ap
  2943. @end table
  2944. A description of the accepted options follows.
  2945. @table @option
  2946. @item luma_radius, lr
  2947. @item chroma_radius, cr
  2948. @item alpha_radius, ar
  2949. Set an expression for the box radius in pixels used for blurring the
  2950. corresponding input plane.
  2951. The radius value must be a non-negative number, and must not be
  2952. greater than the value of the expression @code{min(w,h)/2} for the
  2953. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  2954. planes.
  2955. Default value for @option{luma_radius} is "2". If not specified,
  2956. @option{chroma_radius} and @option{alpha_radius} default to the
  2957. corresponding value set for @option{luma_radius}.
  2958. The expressions can contain the following constants:
  2959. @table @option
  2960. @item w
  2961. @item h
  2962. The input width and height in pixels.
  2963. @item cw
  2964. @item ch
  2965. The input chroma image width and height in pixels.
  2966. @item hsub
  2967. @item vsub
  2968. The horizontal and vertical chroma subsample values. For example, for the
  2969. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  2970. @end table
  2971. @item luma_power, lp
  2972. @item chroma_power, cp
  2973. @item alpha_power, ap
  2974. Specify how many times the boxblur filter is applied to the
  2975. corresponding plane.
  2976. Default value for @option{luma_power} is 2. If not specified,
  2977. @option{chroma_power} and @option{alpha_power} default to the
  2978. corresponding value set for @option{luma_power}.
  2979. A value of 0 will disable the effect.
  2980. @end table
  2981. @subsection Examples
  2982. @itemize
  2983. @item
  2984. Apply a boxblur filter with the luma, chroma, and alpha radii
  2985. set to 2:
  2986. @example
  2987. boxblur=luma_radius=2:luma_power=1
  2988. boxblur=2:1
  2989. @end example
  2990. @item
  2991. Set the luma radius to 2, and alpha and chroma radius to 0:
  2992. @example
  2993. boxblur=2:1:cr=0:ar=0
  2994. @end example
  2995. @item
  2996. Set the luma and chroma radii to a fraction of the video dimension:
  2997. @example
  2998. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  2999. @end example
  3000. @end itemize
  3001. @section chromakey
  3002. YUV colorspace color/chroma keying.
  3003. The filter accepts the following options:
  3004. @table @option
  3005. @item color
  3006. The color which will be replaced with transparency.
  3007. @item similarity
  3008. Similarity percentage with the key color.
  3009. 0.01 matches only the exact key color, while 1.0 matches everything.
  3010. @item blend
  3011. Blend percentage.
  3012. 0.0 makes pixels either fully transparent, or not transparent at all.
  3013. Higher values result in semi-transparent pixels, with a higher transparency
  3014. the more similar the pixels color is to the key color.
  3015. @item yuv
  3016. Signals that the color passed is already in YUV instead of RGB.
  3017. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3018. This can be used to pass exact YUV values as hexadecimal numbers.
  3019. @end table
  3020. @subsection Examples
  3021. @itemize
  3022. @item
  3023. Make every green pixel in the input image transparent:
  3024. @example
  3025. ffmpeg -i input.png -vf chromakey=green out.png
  3026. @end example
  3027. @item
  3028. Overlay a greenscreen-video on top of a static black background.
  3029. @example
  3030. 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
  3031. @end example
  3032. @end itemize
  3033. @section codecview
  3034. Visualize information exported by some codecs.
  3035. Some codecs can export information through frames using side-data or other
  3036. means. For example, some MPEG based codecs export motion vectors through the
  3037. @var{export_mvs} flag in the codec @option{flags2} option.
  3038. The filter accepts the following option:
  3039. @table @option
  3040. @item mv
  3041. Set motion vectors to visualize.
  3042. Available flags for @var{mv} are:
  3043. @table @samp
  3044. @item pf
  3045. forward predicted MVs of P-frames
  3046. @item bf
  3047. forward predicted MVs of B-frames
  3048. @item bb
  3049. backward predicted MVs of B-frames
  3050. @end table
  3051. @end table
  3052. @subsection Examples
  3053. @itemize
  3054. @item
  3055. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  3056. @example
  3057. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  3058. @end example
  3059. @end itemize
  3060. @section colorbalance
  3061. Modify intensity of primary colors (red, green and blue) of input frames.
  3062. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3063. regions for the red-cyan, green-magenta or blue-yellow balance.
  3064. A positive adjustment value shifts the balance towards the primary color, a negative
  3065. value towards the complementary color.
  3066. The filter accepts the following options:
  3067. @table @option
  3068. @item rs
  3069. @item gs
  3070. @item bs
  3071. Adjust red, green and blue shadows (darkest pixels).
  3072. @item rm
  3073. @item gm
  3074. @item bm
  3075. Adjust red, green and blue midtones (medium pixels).
  3076. @item rh
  3077. @item gh
  3078. @item bh
  3079. Adjust red, green and blue highlights (brightest pixels).
  3080. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3081. @end table
  3082. @subsection Examples
  3083. @itemize
  3084. @item
  3085. Add red color cast to shadows:
  3086. @example
  3087. colorbalance=rs=.3
  3088. @end example
  3089. @end itemize
  3090. @section colorkey
  3091. RGB colorspace color keying.
  3092. The filter accepts the following options:
  3093. @table @option
  3094. @item color
  3095. The color which will be replaced with transparency.
  3096. @item similarity
  3097. Similarity percentage with the key color.
  3098. 0.01 matches only the exact key color, while 1.0 matches everything.
  3099. @item blend
  3100. Blend percentage.
  3101. 0.0 makes pixels either fully transparent, or not transparent at all.
  3102. Higher values result in semi-transparent pixels, with a higher transparency
  3103. the more similar the pixels color is to the key color.
  3104. @end table
  3105. @subsection Examples
  3106. @itemize
  3107. @item
  3108. Make every green pixel in the input image transparent:
  3109. @example
  3110. ffmpeg -i input.png -vf colorkey=green out.png
  3111. @end example
  3112. @item
  3113. Overlay a greenscreen-video on top of a static background image.
  3114. @example
  3115. 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
  3116. @end example
  3117. @end itemize
  3118. @section colorlevels
  3119. Adjust video input frames using levels.
  3120. The filter accepts the following options:
  3121. @table @option
  3122. @item rimin
  3123. @item gimin
  3124. @item bimin
  3125. @item aimin
  3126. Adjust red, green, blue and alpha input black point.
  3127. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3128. @item rimax
  3129. @item gimax
  3130. @item bimax
  3131. @item aimax
  3132. Adjust red, green, blue and alpha input white point.
  3133. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3134. Input levels are used to lighten highlights (bright tones), darken shadows
  3135. (dark tones), change the balance of bright and dark tones.
  3136. @item romin
  3137. @item gomin
  3138. @item bomin
  3139. @item aomin
  3140. Adjust red, green, blue and alpha output black point.
  3141. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3142. @item romax
  3143. @item gomax
  3144. @item bomax
  3145. @item aomax
  3146. Adjust red, green, blue and alpha output white point.
  3147. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3148. Output levels allows manual selection of a constrained output level range.
  3149. @end table
  3150. @subsection Examples
  3151. @itemize
  3152. @item
  3153. Make video output darker:
  3154. @example
  3155. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3156. @end example
  3157. @item
  3158. Increase contrast:
  3159. @example
  3160. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3161. @end example
  3162. @item
  3163. Make video output lighter:
  3164. @example
  3165. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3166. @end example
  3167. @item
  3168. Increase brightness:
  3169. @example
  3170. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3171. @end example
  3172. @end itemize
  3173. @section colorchannelmixer
  3174. Adjust video input frames by re-mixing color channels.
  3175. This filter modifies a color channel by adding the values associated to
  3176. the other channels of the same pixels. For example if the value to
  3177. modify is red, the output value will be:
  3178. @example
  3179. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3180. @end example
  3181. The filter accepts the following options:
  3182. @table @option
  3183. @item rr
  3184. @item rg
  3185. @item rb
  3186. @item ra
  3187. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3188. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3189. @item gr
  3190. @item gg
  3191. @item gb
  3192. @item ga
  3193. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3194. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3195. @item br
  3196. @item bg
  3197. @item bb
  3198. @item ba
  3199. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3200. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3201. @item ar
  3202. @item ag
  3203. @item ab
  3204. @item aa
  3205. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3206. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3207. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3208. @end table
  3209. @subsection Examples
  3210. @itemize
  3211. @item
  3212. Convert source to grayscale:
  3213. @example
  3214. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3215. @end example
  3216. @item
  3217. Simulate sepia tones:
  3218. @example
  3219. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3220. @end example
  3221. @end itemize
  3222. @section colormatrix
  3223. Convert color matrix.
  3224. The filter accepts the following options:
  3225. @table @option
  3226. @item src
  3227. @item dst
  3228. Specify the source and destination color matrix. Both values must be
  3229. specified.
  3230. The accepted values are:
  3231. @table @samp
  3232. @item bt709
  3233. BT.709
  3234. @item bt601
  3235. BT.601
  3236. @item smpte240m
  3237. SMPTE-240M
  3238. @item fcc
  3239. FCC
  3240. @end table
  3241. @end table
  3242. For example to convert from BT.601 to SMPTE-240M, use the command:
  3243. @example
  3244. colormatrix=bt601:smpte240m
  3245. @end example
  3246. @section copy
  3247. Copy the input source unchanged to the output. This is mainly useful for
  3248. testing purposes.
  3249. @section crop
  3250. Crop the input video to given dimensions.
  3251. It accepts the following parameters:
  3252. @table @option
  3253. @item w, out_w
  3254. The width of the output video. It defaults to @code{iw}.
  3255. This expression is evaluated only once during the filter
  3256. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  3257. @item h, out_h
  3258. The height of the output video. It defaults to @code{ih}.
  3259. This expression is evaluated only once during the filter
  3260. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  3261. @item x
  3262. The horizontal position, in the input video, of the left edge of the output
  3263. video. It defaults to @code{(in_w-out_w)/2}.
  3264. This expression is evaluated per-frame.
  3265. @item y
  3266. The vertical position, in the input video, of the top edge of the output video.
  3267. It defaults to @code{(in_h-out_h)/2}.
  3268. This expression is evaluated per-frame.
  3269. @item keep_aspect
  3270. If set to 1 will force the output display aspect ratio
  3271. to be the same of the input, by changing the output sample aspect
  3272. ratio. It defaults to 0.
  3273. @end table
  3274. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  3275. expressions containing the following constants:
  3276. @table @option
  3277. @item x
  3278. @item y
  3279. The computed values for @var{x} and @var{y}. They are evaluated for
  3280. each new frame.
  3281. @item in_w
  3282. @item in_h
  3283. The input width and height.
  3284. @item iw
  3285. @item ih
  3286. These are the same as @var{in_w} and @var{in_h}.
  3287. @item out_w
  3288. @item out_h
  3289. The output (cropped) width and height.
  3290. @item ow
  3291. @item oh
  3292. These are the same as @var{out_w} and @var{out_h}.
  3293. @item a
  3294. same as @var{iw} / @var{ih}
  3295. @item sar
  3296. input sample aspect ratio
  3297. @item dar
  3298. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  3299. @item hsub
  3300. @item vsub
  3301. horizontal and vertical chroma subsample values. For example for the
  3302. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3303. @item n
  3304. The number of the input frame, starting from 0.
  3305. @item pos
  3306. the position in the file of the input frame, NAN if unknown
  3307. @item t
  3308. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  3309. @end table
  3310. The expression for @var{out_w} may depend on the value of @var{out_h},
  3311. and the expression for @var{out_h} may depend on @var{out_w}, but they
  3312. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  3313. evaluated after @var{out_w} and @var{out_h}.
  3314. The @var{x} and @var{y} parameters specify the expressions for the
  3315. position of the top-left corner of the output (non-cropped) area. They
  3316. are evaluated for each frame. If the evaluated value is not valid, it
  3317. is approximated to the nearest valid value.
  3318. The expression for @var{x} may depend on @var{y}, and the expression
  3319. for @var{y} may depend on @var{x}.
  3320. @subsection Examples
  3321. @itemize
  3322. @item
  3323. Crop area with size 100x100 at position (12,34).
  3324. @example
  3325. crop=100:100:12:34
  3326. @end example
  3327. Using named options, the example above becomes:
  3328. @example
  3329. crop=w=100:h=100:x=12:y=34
  3330. @end example
  3331. @item
  3332. Crop the central input area with size 100x100:
  3333. @example
  3334. crop=100:100
  3335. @end example
  3336. @item
  3337. Crop the central input area with size 2/3 of the input video:
  3338. @example
  3339. crop=2/3*in_w:2/3*in_h
  3340. @end example
  3341. @item
  3342. Crop the input video central square:
  3343. @example
  3344. crop=out_w=in_h
  3345. crop=in_h
  3346. @end example
  3347. @item
  3348. Delimit the rectangle with the top-left corner placed at position
  3349. 100:100 and the right-bottom corner corresponding to the right-bottom
  3350. corner of the input image.
  3351. @example
  3352. crop=in_w-100:in_h-100:100:100
  3353. @end example
  3354. @item
  3355. Crop 10 pixels from the left and right borders, and 20 pixels from
  3356. the top and bottom borders
  3357. @example
  3358. crop=in_w-2*10:in_h-2*20
  3359. @end example
  3360. @item
  3361. Keep only the bottom right quarter of the input image:
  3362. @example
  3363. crop=in_w/2:in_h/2:in_w/2:in_h/2
  3364. @end example
  3365. @item
  3366. Crop height for getting Greek harmony:
  3367. @example
  3368. crop=in_w:1/PHI*in_w
  3369. @end example
  3370. @item
  3371. Apply trembling effect:
  3372. @example
  3373. 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)
  3374. @end example
  3375. @item
  3376. Apply erratic camera effect depending on timestamp:
  3377. @example
  3378. 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)"
  3379. @end example
  3380. @item
  3381. Set x depending on the value of y:
  3382. @example
  3383. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  3384. @end example
  3385. @end itemize
  3386. @subsection Commands
  3387. This filter supports the following commands:
  3388. @table @option
  3389. @item w, out_w
  3390. @item h, out_h
  3391. @item x
  3392. @item y
  3393. Set width/height of the output video and the horizontal/vertical position
  3394. in the input video.
  3395. The command accepts the same syntax of the corresponding option.
  3396. If the specified expression is not valid, it is kept at its current
  3397. value.
  3398. @end table
  3399. @section cropdetect
  3400. Auto-detect the crop size.
  3401. It calculates the necessary cropping parameters and prints the
  3402. recommended parameters via the logging system. The detected dimensions
  3403. correspond to the non-black area of the input video.
  3404. It accepts the following parameters:
  3405. @table @option
  3406. @item limit
  3407. Set higher black value threshold, which can be optionally specified
  3408. from nothing (0) to everything (255 for 8bit based formats). An intensity
  3409. value greater to the set value is considered non-black. It defaults to 24.
  3410. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  3411. on the bitdepth of the pixel format.
  3412. @item round
  3413. The value which the width/height should be divisible by. It defaults to
  3414. 16. The offset is automatically adjusted to center the video. Use 2 to
  3415. get only even dimensions (needed for 4:2:2 video). 16 is best when
  3416. encoding to most video codecs.
  3417. @item reset_count, reset
  3418. Set the counter that determines after how many frames cropdetect will
  3419. reset the previously detected largest video area and start over to
  3420. detect the current optimal crop area. Default value is 0.
  3421. This can be useful when channel logos distort the video area. 0
  3422. indicates 'never reset', and returns the largest area encountered during
  3423. playback.
  3424. @end table
  3425. @anchor{curves}
  3426. @section curves
  3427. Apply color adjustments using curves.
  3428. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  3429. component (red, green and blue) has its values defined by @var{N} key points
  3430. tied from each other using a smooth curve. The x-axis represents the pixel
  3431. values from the input frame, and the y-axis the new pixel values to be set for
  3432. the output frame.
  3433. By default, a component curve is defined by the two points @var{(0;0)} and
  3434. @var{(1;1)}. This creates a straight line where each original pixel value is
  3435. "adjusted" to its own value, which means no change to the image.
  3436. The filter allows you to redefine these two points and add some more. A new
  3437. curve (using a natural cubic spline interpolation) will be define to pass
  3438. smoothly through all these new coordinates. The new defined points needs to be
  3439. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  3440. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  3441. the vector spaces, the values will be clipped accordingly.
  3442. If there is no key point defined in @code{x=0}, the filter will automatically
  3443. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  3444. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  3445. The filter accepts the following options:
  3446. @table @option
  3447. @item preset
  3448. Select one of the available color presets. This option can be used in addition
  3449. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  3450. options takes priority on the preset values.
  3451. Available presets are:
  3452. @table @samp
  3453. @item none
  3454. @item color_negative
  3455. @item cross_process
  3456. @item darker
  3457. @item increase_contrast
  3458. @item lighter
  3459. @item linear_contrast
  3460. @item medium_contrast
  3461. @item negative
  3462. @item strong_contrast
  3463. @item vintage
  3464. @end table
  3465. Default is @code{none}.
  3466. @item master, m
  3467. Set the master key points. These points will define a second pass mapping. It
  3468. is sometimes called a "luminance" or "value" mapping. It can be used with
  3469. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  3470. post-processing LUT.
  3471. @item red, r
  3472. Set the key points for the red component.
  3473. @item green, g
  3474. Set the key points for the green component.
  3475. @item blue, b
  3476. Set the key points for the blue component.
  3477. @item all
  3478. Set the key points for all components (not including master).
  3479. Can be used in addition to the other key points component
  3480. options. In this case, the unset component(s) will fallback on this
  3481. @option{all} setting.
  3482. @item psfile
  3483. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  3484. @end table
  3485. To avoid some filtergraph syntax conflicts, each key points list need to be
  3486. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  3487. @subsection Examples
  3488. @itemize
  3489. @item
  3490. Increase slightly the middle level of blue:
  3491. @example
  3492. curves=blue='0.5/0.58'
  3493. @end example
  3494. @item
  3495. Vintage effect:
  3496. @example
  3497. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  3498. @end example
  3499. Here we obtain the following coordinates for each components:
  3500. @table @var
  3501. @item red
  3502. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  3503. @item green
  3504. @code{(0;0) (0.50;0.48) (1;1)}
  3505. @item blue
  3506. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  3507. @end table
  3508. @item
  3509. The previous example can also be achieved with the associated built-in preset:
  3510. @example
  3511. curves=preset=vintage
  3512. @end example
  3513. @item
  3514. Or simply:
  3515. @example
  3516. curves=vintage
  3517. @end example
  3518. @item
  3519. Use a Photoshop preset and redefine the points of the green component:
  3520. @example
  3521. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  3522. @end example
  3523. @end itemize
  3524. @section dctdnoiz
  3525. Denoise frames using 2D DCT (frequency domain filtering).
  3526. This filter is not designed for real time.
  3527. The filter accepts the following options:
  3528. @table @option
  3529. @item sigma, s
  3530. Set the noise sigma constant.
  3531. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  3532. coefficient (absolute value) below this threshold with be dropped.
  3533. If you need a more advanced filtering, see @option{expr}.
  3534. Default is @code{0}.
  3535. @item overlap
  3536. Set number overlapping pixels for each block. Since the filter can be slow, you
  3537. may want to reduce this value, at the cost of a less effective filter and the
  3538. risk of various artefacts.
  3539. If the overlapping value doesn't permit processing the whole input width or
  3540. height, a warning will be displayed and according borders won't be denoised.
  3541. Default value is @var{blocksize}-1, which is the best possible setting.
  3542. @item expr, e
  3543. Set the coefficient factor expression.
  3544. For each coefficient of a DCT block, this expression will be evaluated as a
  3545. multiplier value for the coefficient.
  3546. If this is option is set, the @option{sigma} option will be ignored.
  3547. The absolute value of the coefficient can be accessed through the @var{c}
  3548. variable.
  3549. @item n
  3550. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  3551. @var{blocksize}, which is the width and height of the processed blocks.
  3552. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  3553. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  3554. on the speed processing. Also, a larger block size does not necessarily means a
  3555. better de-noising.
  3556. @end table
  3557. @subsection Examples
  3558. Apply a denoise with a @option{sigma} of @code{4.5}:
  3559. @example
  3560. dctdnoiz=4.5
  3561. @end example
  3562. The same operation can be achieved using the expression system:
  3563. @example
  3564. dctdnoiz=e='gte(c, 4.5*3)'
  3565. @end example
  3566. Violent denoise using a block size of @code{16x16}:
  3567. @example
  3568. dctdnoiz=15:n=4
  3569. @end example
  3570. @section deband
  3571. Remove banding artifacts from input video.
  3572. It works by replacing banded pixels with average value of referenced pixels.
  3573. The filter accepts the following options:
  3574. @table @option
  3575. @item 1thr
  3576. @item 2thr
  3577. @item 3thr
  3578. @item 4thr
  3579. Set banding detection threshold for each plane. Default is 0.02.
  3580. Valid range is 0.00003 to 0.5.
  3581. If difference between current pixel and reference pixel is less than threshold,
  3582. it will be considered as banded.
  3583. @item range, r
  3584. Banding detection range in pixels. Default is 16. If positive, random number
  3585. in range 0 to set value will be used. If negative, exact absolute value
  3586. will be used.
  3587. The range defines square of four pixels around current pixel.
  3588. @item direction, d
  3589. Set direction in radians from which four pixel will be compared. If positive,
  3590. random direction from 0 to set direction will be picked. If negative, exact of
  3591. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  3592. will pick only pixels on same row and -PI/2 will pick only pixels on same
  3593. column.
  3594. @item blur
  3595. If enabled, current pixel is compared with average value of all four
  3596. surrounding pixels. The default is enabled. If disabled current pixel is
  3597. compared with all four surrounding pixels. The pixel is considered banded
  3598. if only all four differences with surrounding pixels are less than threshold.
  3599. @end table
  3600. @anchor{decimate}
  3601. @section decimate
  3602. Drop duplicated frames at regular intervals.
  3603. The filter accepts the following options:
  3604. @table @option
  3605. @item cycle
  3606. Set the number of frames from which one will be dropped. Setting this to
  3607. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  3608. Default is @code{5}.
  3609. @item dupthresh
  3610. Set the threshold for duplicate detection. If the difference metric for a frame
  3611. is less than or equal to this value, then it is declared as duplicate. Default
  3612. is @code{1.1}
  3613. @item scthresh
  3614. Set scene change threshold. Default is @code{15}.
  3615. @item blockx
  3616. @item blocky
  3617. Set the size of the x and y-axis blocks used during metric calculations.
  3618. Larger blocks give better noise suppression, but also give worse detection of
  3619. small movements. Must be a power of two. Default is @code{32}.
  3620. @item ppsrc
  3621. Mark main input as a pre-processed input and activate clean source input
  3622. stream. This allows the input to be pre-processed with various filters to help
  3623. the metrics calculation while keeping the frame selection lossless. When set to
  3624. @code{1}, the first stream is for the pre-processed input, and the second
  3625. stream is the clean source from where the kept frames are chosen. Default is
  3626. @code{0}.
  3627. @item chroma
  3628. Set whether or not chroma is considered in the metric calculations. Default is
  3629. @code{1}.
  3630. @end table
  3631. @section deflate
  3632. Apply deflate effect to the video.
  3633. This filter replaces the pixel by the local(3x3) average by taking into account
  3634. only values lower than the pixel.
  3635. It accepts the following options:
  3636. @table @option
  3637. @item threshold0
  3638. @item threshold1
  3639. @item threshold2
  3640. @item threshold3
  3641. Limit the maximum change for each plane, default is 65535.
  3642. If 0, plane will remain unchanged.
  3643. @end table
  3644. @section dejudder
  3645. Remove judder produced by partially interlaced telecined content.
  3646. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  3647. source was partially telecined content then the output of @code{pullup,dejudder}
  3648. will have a variable frame rate. May change the recorded frame rate of the
  3649. container. Aside from that change, this filter will not affect constant frame
  3650. rate video.
  3651. The option available in this filter is:
  3652. @table @option
  3653. @item cycle
  3654. Specify the length of the window over which the judder repeats.
  3655. Accepts any integer greater than 1. Useful values are:
  3656. @table @samp
  3657. @item 4
  3658. If the original was telecined from 24 to 30 fps (Film to NTSC).
  3659. @item 5
  3660. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  3661. @item 20
  3662. If a mixture of the two.
  3663. @end table
  3664. The default is @samp{4}.
  3665. @end table
  3666. @section delogo
  3667. Suppress a TV station logo by a simple interpolation of the surrounding
  3668. pixels. Just set a rectangle covering the logo and watch it disappear
  3669. (and sometimes something even uglier appear - your mileage may vary).
  3670. It accepts the following parameters:
  3671. @table @option
  3672. @item x
  3673. @item y
  3674. Specify the top left corner coordinates of the logo. They must be
  3675. specified.
  3676. @item w
  3677. @item h
  3678. Specify the width and height of the logo to clear. They must be
  3679. specified.
  3680. @item band, t
  3681. Specify the thickness of the fuzzy edge of the rectangle (added to
  3682. @var{w} and @var{h}). The default value is 1. This option is
  3683. deprecated, setting higher values should no longer be necessary and
  3684. is not recommended.
  3685. @item show
  3686. When set to 1, a green rectangle is drawn on the screen to simplify
  3687. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  3688. The default value is 0.
  3689. The rectangle is drawn on the outermost pixels which will be (partly)
  3690. replaced with interpolated values. The values of the next pixels
  3691. immediately outside this rectangle in each direction will be used to
  3692. compute the interpolated pixel values inside the rectangle.
  3693. @end table
  3694. @subsection Examples
  3695. @itemize
  3696. @item
  3697. Set a rectangle covering the area with top left corner coordinates 0,0
  3698. and size 100x77, and a band of size 10:
  3699. @example
  3700. delogo=x=0:y=0:w=100:h=77:band=10
  3701. @end example
  3702. @end itemize
  3703. @section deshake
  3704. Attempt to fix small changes in horizontal and/or vertical shift. This
  3705. filter helps remove camera shake from hand-holding a camera, bumping a
  3706. tripod, moving on a vehicle, etc.
  3707. The filter accepts the following options:
  3708. @table @option
  3709. @item x
  3710. @item y
  3711. @item w
  3712. @item h
  3713. Specify a rectangular area where to limit the search for motion
  3714. vectors.
  3715. If desired the search for motion vectors can be limited to a
  3716. rectangular area of the frame defined by its top left corner, width
  3717. and height. These parameters have the same meaning as the drawbox
  3718. filter which can be used to visualise the position of the bounding
  3719. box.
  3720. This is useful when simultaneous movement of subjects within the frame
  3721. might be confused for camera motion by the motion vector search.
  3722. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  3723. then the full frame is used. This allows later options to be set
  3724. without specifying the bounding box for the motion vector search.
  3725. Default - search the whole frame.
  3726. @item rx
  3727. @item ry
  3728. Specify the maximum extent of movement in x and y directions in the
  3729. range 0-64 pixels. Default 16.
  3730. @item edge
  3731. Specify how to generate pixels to fill blanks at the edge of the
  3732. frame. Available values are:
  3733. @table @samp
  3734. @item blank, 0
  3735. Fill zeroes at blank locations
  3736. @item original, 1
  3737. Original image at blank locations
  3738. @item clamp, 2
  3739. Extruded edge value at blank locations
  3740. @item mirror, 3
  3741. Mirrored edge at blank locations
  3742. @end table
  3743. Default value is @samp{mirror}.
  3744. @item blocksize
  3745. Specify the blocksize to use for motion search. Range 4-128 pixels,
  3746. default 8.
  3747. @item contrast
  3748. Specify the contrast threshold for blocks. Only blocks with more than
  3749. the specified contrast (difference between darkest and lightest
  3750. pixels) will be considered. Range 1-255, default 125.
  3751. @item search
  3752. Specify the search strategy. Available values are:
  3753. @table @samp
  3754. @item exhaustive, 0
  3755. Set exhaustive search
  3756. @item less, 1
  3757. Set less exhaustive search.
  3758. @end table
  3759. Default value is @samp{exhaustive}.
  3760. @item filename
  3761. If set then a detailed log of the motion search is written to the
  3762. specified file.
  3763. @item opencl
  3764. If set to 1, specify using OpenCL capabilities, only available if
  3765. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  3766. @end table
  3767. @section detelecine
  3768. Apply an exact inverse of the telecine operation. It requires a predefined
  3769. pattern specified using the pattern option which must be the same as that passed
  3770. to the telecine filter.
  3771. This filter accepts the following options:
  3772. @table @option
  3773. @item first_field
  3774. @table @samp
  3775. @item top, t
  3776. top field first
  3777. @item bottom, b
  3778. bottom field first
  3779. The default value is @code{top}.
  3780. @end table
  3781. @item pattern
  3782. A string of numbers representing the pulldown pattern you wish to apply.
  3783. The default value is @code{23}.
  3784. @item start_frame
  3785. A number representing position of the first frame with respect to the telecine
  3786. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  3787. @end table
  3788. @section dilation
  3789. Apply dilation effect to the video.
  3790. This filter replaces the pixel by the local(3x3) maximum.
  3791. It accepts the following options:
  3792. @table @option
  3793. @item threshold0
  3794. @item threshold1
  3795. @item threshold2
  3796. @item threshold3
  3797. Limit the maximum change for each plane, default is 65535.
  3798. If 0, plane will remain unchanged.
  3799. @item coordinates
  3800. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  3801. pixels are used.
  3802. Flags to local 3x3 coordinates maps like this:
  3803. 1 2 3
  3804. 4 5
  3805. 6 7 8
  3806. @end table
  3807. @section displace
  3808. Displace pixels as indicated by second and third input stream.
  3809. It takes three input streams and outputs one stream, the first input is the
  3810. source, and second and third input are displacement maps.
  3811. The second input specifies how much to displace pixels along the
  3812. x-axis, while the third input specifies how much to displace pixels
  3813. along the y-axis.
  3814. If one of displacement map streams terminates, last frame from that
  3815. displacement map will be used.
  3816. Note that once generated, displacements maps can be reused over and over again.
  3817. A description of the accepted options follows.
  3818. @table @option
  3819. @item edge
  3820. Set displace behavior for pixels that are out of range.
  3821. Available values are:
  3822. @table @samp
  3823. @item blank
  3824. Missing pixels are replaced by black pixels.
  3825. @item smear
  3826. Adjacent pixels will spread out to replace missing pixels.
  3827. @item wrap
  3828. Out of range pixels are wrapped so they point to pixels of other side.
  3829. @end table
  3830. Default is @samp{smear}.
  3831. @end table
  3832. @subsection Examples
  3833. @itemize
  3834. @item
  3835. Add ripple effect to rgb input of video size hd720:
  3836. @example
  3837. 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
  3838. @end example
  3839. @item
  3840. Add wave effect to rgb input of video size hd720:
  3841. @example
  3842. 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
  3843. @end example
  3844. @end itemize
  3845. @section drawbox
  3846. Draw a colored box on the input image.
  3847. It accepts the following parameters:
  3848. @table @option
  3849. @item x
  3850. @item y
  3851. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  3852. @item width, w
  3853. @item height, h
  3854. The expressions which specify the width and height of the box; if 0 they are interpreted as
  3855. the input width and height. It defaults to 0.
  3856. @item color, c
  3857. Specify the color of the box to write. For the general syntax of this option,
  3858. check the "Color" section in the ffmpeg-utils manual. If the special
  3859. value @code{invert} is used, the box edge color is the same as the
  3860. video with inverted luma.
  3861. @item thickness, t
  3862. The expression which sets the thickness of the box edge. Default value is @code{3}.
  3863. See below for the list of accepted constants.
  3864. @end table
  3865. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  3866. following constants:
  3867. @table @option
  3868. @item dar
  3869. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  3870. @item hsub
  3871. @item vsub
  3872. horizontal and vertical chroma subsample values. For example for the
  3873. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3874. @item in_h, ih
  3875. @item in_w, iw
  3876. The input width and height.
  3877. @item sar
  3878. The input sample aspect ratio.
  3879. @item x
  3880. @item y
  3881. The x and y offset coordinates where the box is drawn.
  3882. @item w
  3883. @item h
  3884. The width and height of the drawn box.
  3885. @item t
  3886. The thickness of the drawn box.
  3887. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  3888. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  3889. @end table
  3890. @subsection Examples
  3891. @itemize
  3892. @item
  3893. Draw a black box around the edge of the input image:
  3894. @example
  3895. drawbox
  3896. @end example
  3897. @item
  3898. Draw a box with color red and an opacity of 50%:
  3899. @example
  3900. drawbox=10:20:200:60:red@@0.5
  3901. @end example
  3902. The previous example can be specified as:
  3903. @example
  3904. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  3905. @end example
  3906. @item
  3907. Fill the box with pink color:
  3908. @example
  3909. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  3910. @end example
  3911. @item
  3912. Draw a 2-pixel red 2.40:1 mask:
  3913. @example
  3914. 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
  3915. @end example
  3916. @end itemize
  3917. @section drawgraph, adrawgraph
  3918. Draw a graph using input video or audio metadata.
  3919. It accepts the following parameters:
  3920. @table @option
  3921. @item m1
  3922. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  3923. @item fg1
  3924. Set 1st foreground color expression.
  3925. @item m2
  3926. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  3927. @item fg2
  3928. Set 2nd foreground color expression.
  3929. @item m3
  3930. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  3931. @item fg3
  3932. Set 3rd foreground color expression.
  3933. @item m4
  3934. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  3935. @item fg4
  3936. Set 4th foreground color expression.
  3937. @item min
  3938. Set minimal value of metadata value.
  3939. @item max
  3940. Set maximal value of metadata value.
  3941. @item bg
  3942. Set graph background color. Default is white.
  3943. @item mode
  3944. Set graph mode.
  3945. Available values for mode is:
  3946. @table @samp
  3947. @item bar
  3948. @item dot
  3949. @item line
  3950. @end table
  3951. Default is @code{line}.
  3952. @item slide
  3953. Set slide mode.
  3954. Available values for slide is:
  3955. @table @samp
  3956. @item frame
  3957. Draw new frame when right border is reached.
  3958. @item replace
  3959. Replace old columns with new ones.
  3960. @item scroll
  3961. Scroll from right to left.
  3962. @item rscroll
  3963. Scroll from left to right.
  3964. @end table
  3965. Default is @code{frame}.
  3966. @item size
  3967. Set size of graph video. For the syntax of this option, check the
  3968. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  3969. The default value is @code{900x256}.
  3970. The foreground color expressions can use the following variables:
  3971. @table @option
  3972. @item MIN
  3973. Minimal value of metadata value.
  3974. @item MAX
  3975. Maximal value of metadata value.
  3976. @item VAL
  3977. Current metadata key value.
  3978. @end table
  3979. The color is defined as 0xAABBGGRR.
  3980. @end table
  3981. Example using metadata from @ref{signalstats} filter:
  3982. @example
  3983. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  3984. @end example
  3985. Example using metadata from @ref{ebur128} filter:
  3986. @example
  3987. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  3988. @end example
  3989. @section drawgrid
  3990. Draw a grid on the input image.
  3991. It accepts the following parameters:
  3992. @table @option
  3993. @item x
  3994. @item y
  3995. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  3996. @item width, w
  3997. @item height, h
  3998. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  3999. input width and height, respectively, minus @code{thickness}, so image gets
  4000. framed. Default to 0.
  4001. @item color, c
  4002. Specify the color of the grid. For the general syntax of this option,
  4003. check the "Color" section in the ffmpeg-utils manual. If the special
  4004. value @code{invert} is used, the grid color is the same as the
  4005. video with inverted luma.
  4006. @item thickness, t
  4007. The expression which sets the thickness of the grid line. Default value is @code{1}.
  4008. See below for the list of accepted constants.
  4009. @end table
  4010. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4011. following constants:
  4012. @table @option
  4013. @item dar
  4014. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4015. @item hsub
  4016. @item vsub
  4017. horizontal and vertical chroma subsample values. For example for the
  4018. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4019. @item in_h, ih
  4020. @item in_w, iw
  4021. The input grid cell width and height.
  4022. @item sar
  4023. The input sample aspect ratio.
  4024. @item x
  4025. @item y
  4026. The x and y coordinates of some point of grid intersection (meant to configure offset).
  4027. @item w
  4028. @item h
  4029. The width and height of the drawn cell.
  4030. @item t
  4031. The thickness of the drawn cell.
  4032. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4033. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4034. @end table
  4035. @subsection Examples
  4036. @itemize
  4037. @item
  4038. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  4039. @example
  4040. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  4041. @end example
  4042. @item
  4043. Draw a white 3x3 grid with an opacity of 50%:
  4044. @example
  4045. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  4046. @end example
  4047. @end itemize
  4048. @anchor{drawtext}
  4049. @section drawtext
  4050. Draw a text string or text from a specified file on top of a video, using the
  4051. libfreetype library.
  4052. To enable compilation of this filter, you need to configure FFmpeg with
  4053. @code{--enable-libfreetype}.
  4054. To enable default font fallback and the @var{font} option you need to
  4055. configure FFmpeg with @code{--enable-libfontconfig}.
  4056. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  4057. @code{--enable-libfribidi}.
  4058. @subsection Syntax
  4059. It accepts the following parameters:
  4060. @table @option
  4061. @item box
  4062. Used to draw a box around text using the background color.
  4063. The value must be either 1 (enable) or 0 (disable).
  4064. The default value of @var{box} is 0.
  4065. @item boxborderw
  4066. Set the width of the border to be drawn around the box using @var{boxcolor}.
  4067. The default value of @var{boxborderw} is 0.
  4068. @item boxcolor
  4069. The color to be used for drawing box around text. For the syntax of this
  4070. option, check the "Color" section in the ffmpeg-utils manual.
  4071. The default value of @var{boxcolor} is "white".
  4072. @item borderw
  4073. Set the width of the border to be drawn around the text using @var{bordercolor}.
  4074. The default value of @var{borderw} is 0.
  4075. @item bordercolor
  4076. Set the color to be used for drawing border around text. For the syntax of this
  4077. option, check the "Color" section in the ffmpeg-utils manual.
  4078. The default value of @var{bordercolor} is "black".
  4079. @item expansion
  4080. Select how the @var{text} is expanded. Can be either @code{none},
  4081. @code{strftime} (deprecated) or
  4082. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  4083. below for details.
  4084. @item fix_bounds
  4085. If true, check and fix text coords to avoid clipping.
  4086. @item fontcolor
  4087. The color to be used for drawing fonts. For the syntax of this option, check
  4088. the "Color" section in the ffmpeg-utils manual.
  4089. The default value of @var{fontcolor} is "black".
  4090. @item fontcolor_expr
  4091. String which is expanded the same way as @var{text} to obtain dynamic
  4092. @var{fontcolor} value. By default this option has empty value and is not
  4093. processed. When this option is set, it overrides @var{fontcolor} option.
  4094. @item font
  4095. The font family to be used for drawing text. By default Sans.
  4096. @item fontfile
  4097. The font file to be used for drawing text. The path must be included.
  4098. This parameter is mandatory if the fontconfig support is disabled.
  4099. @item draw
  4100. This option does not exist, please see the timeline system
  4101. @item alpha
  4102. Draw the text applying alpha blending. The value can
  4103. be either a number between 0.0 and 1.0
  4104. The expression accepts the same variables @var{x, y} do.
  4105. The default value is 1.
  4106. Please see fontcolor_expr
  4107. @item fontsize
  4108. The font size to be used for drawing text.
  4109. The default value of @var{fontsize} is 16.
  4110. @item text_shaping
  4111. If set to 1, attempt to shape the text (for example, reverse the order of
  4112. right-to-left text and join Arabic characters) before drawing it.
  4113. Otherwise, just draw the text exactly as given.
  4114. By default 1 (if supported).
  4115. @item ft_load_flags
  4116. The flags to be used for loading the fonts.
  4117. The flags map the corresponding flags supported by libfreetype, and are
  4118. a combination of the following values:
  4119. @table @var
  4120. @item default
  4121. @item no_scale
  4122. @item no_hinting
  4123. @item render
  4124. @item no_bitmap
  4125. @item vertical_layout
  4126. @item force_autohint
  4127. @item crop_bitmap
  4128. @item pedantic
  4129. @item ignore_global_advance_width
  4130. @item no_recurse
  4131. @item ignore_transform
  4132. @item monochrome
  4133. @item linear_design
  4134. @item no_autohint
  4135. @end table
  4136. Default value is "default".
  4137. For more information consult the documentation for the FT_LOAD_*
  4138. libfreetype flags.
  4139. @item shadowcolor
  4140. The color to be used for drawing a shadow behind the drawn text. For the
  4141. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  4142. The default value of @var{shadowcolor} is "black".
  4143. @item shadowx
  4144. @item shadowy
  4145. The x and y offsets for the text shadow position with respect to the
  4146. position of the text. They can be either positive or negative
  4147. values. The default value for both is "0".
  4148. @item start_number
  4149. The starting frame number for the n/frame_num variable. The default value
  4150. is "0".
  4151. @item tabsize
  4152. The size in number of spaces to use for rendering the tab.
  4153. Default value is 4.
  4154. @item timecode
  4155. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  4156. format. It can be used with or without text parameter. @var{timecode_rate}
  4157. option must be specified.
  4158. @item timecode_rate, rate, r
  4159. Set the timecode frame rate (timecode only).
  4160. @item text
  4161. The text string to be drawn. The text must be a sequence of UTF-8
  4162. encoded characters.
  4163. This parameter is mandatory if no file is specified with the parameter
  4164. @var{textfile}.
  4165. @item textfile
  4166. A text file containing text to be drawn. The text must be a sequence
  4167. of UTF-8 encoded characters.
  4168. This parameter is mandatory if no text string is specified with the
  4169. parameter @var{text}.
  4170. If both @var{text} and @var{textfile} are specified, an error is thrown.
  4171. @item reload
  4172. If set to 1, the @var{textfile} will be reloaded before each frame.
  4173. Be sure to update it atomically, or it may be read partially, or even fail.
  4174. @item x
  4175. @item y
  4176. The expressions which specify the offsets where text will be drawn
  4177. within the video frame. They are relative to the top/left border of the
  4178. output image.
  4179. The default value of @var{x} and @var{y} is "0".
  4180. See below for the list of accepted constants and functions.
  4181. @end table
  4182. The parameters for @var{x} and @var{y} are expressions containing the
  4183. following constants and functions:
  4184. @table @option
  4185. @item dar
  4186. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  4187. @item hsub
  4188. @item vsub
  4189. horizontal and vertical chroma subsample values. For example for the
  4190. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4191. @item line_h, lh
  4192. the height of each text line
  4193. @item main_h, h, H
  4194. the input height
  4195. @item main_w, w, W
  4196. the input width
  4197. @item max_glyph_a, ascent
  4198. the maximum distance from the baseline to the highest/upper grid
  4199. coordinate used to place a glyph outline point, for all the rendered
  4200. glyphs.
  4201. It is a positive value, due to the grid's orientation with the Y axis
  4202. upwards.
  4203. @item max_glyph_d, descent
  4204. the maximum distance from the baseline to the lowest grid coordinate
  4205. used to place a glyph outline point, for all the rendered glyphs.
  4206. This is a negative value, due to the grid's orientation, with the Y axis
  4207. upwards.
  4208. @item max_glyph_h
  4209. maximum glyph height, that is the maximum height for all the glyphs
  4210. contained in the rendered text, it is equivalent to @var{ascent} -
  4211. @var{descent}.
  4212. @item max_glyph_w
  4213. maximum glyph width, that is the maximum width for all the glyphs
  4214. contained in the rendered text
  4215. @item n
  4216. the number of input frame, starting from 0
  4217. @item rand(min, max)
  4218. return a random number included between @var{min} and @var{max}
  4219. @item sar
  4220. The input sample aspect ratio.
  4221. @item t
  4222. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4223. @item text_h, th
  4224. the height of the rendered text
  4225. @item text_w, tw
  4226. the width of the rendered text
  4227. @item x
  4228. @item y
  4229. the x and y offset coordinates where the text is drawn.
  4230. These parameters allow the @var{x} and @var{y} expressions to refer
  4231. each other, so you can for example specify @code{y=x/dar}.
  4232. @end table
  4233. @anchor{drawtext_expansion}
  4234. @subsection Text expansion
  4235. If @option{expansion} is set to @code{strftime},
  4236. the filter recognizes strftime() sequences in the provided text and
  4237. expands them accordingly. Check the documentation of strftime(). This
  4238. feature is deprecated.
  4239. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  4240. If @option{expansion} is set to @code{normal} (which is the default),
  4241. the following expansion mechanism is used.
  4242. The backslash character @samp{\}, followed by any character, always expands to
  4243. the second character.
  4244. Sequence of the form @code{%@{...@}} are expanded. The text between the
  4245. braces is a function name, possibly followed by arguments separated by ':'.
  4246. If the arguments contain special characters or delimiters (':' or '@}'),
  4247. they should be escaped.
  4248. Note that they probably must also be escaped as the value for the
  4249. @option{text} option in the filter argument string and as the filter
  4250. argument in the filtergraph description, and possibly also for the shell,
  4251. that makes up to four levels of escaping; using a text file avoids these
  4252. problems.
  4253. The following functions are available:
  4254. @table @command
  4255. @item expr, e
  4256. The expression evaluation result.
  4257. It must take one argument specifying the expression to be evaluated,
  4258. which accepts the same constants and functions as the @var{x} and
  4259. @var{y} values. Note that not all constants should be used, for
  4260. example the text size is not known when evaluating the expression, so
  4261. the constants @var{text_w} and @var{text_h} will have an undefined
  4262. value.
  4263. @item expr_int_format, eif
  4264. Evaluate the expression's value and output as formatted integer.
  4265. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  4266. The second argument specifies the output format. Allowed values are @samp{x},
  4267. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  4268. @code{printf} function.
  4269. The third parameter is optional and sets the number of positions taken by the output.
  4270. It can be used to add padding with zeros from the left.
  4271. @item gmtime
  4272. The time at which the filter is running, expressed in UTC.
  4273. It can accept an argument: a strftime() format string.
  4274. @item localtime
  4275. The time at which the filter is running, expressed in the local time zone.
  4276. It can accept an argument: a strftime() format string.
  4277. @item metadata
  4278. Frame metadata. It must take one argument specifying metadata key.
  4279. @item n, frame_num
  4280. The frame number, starting from 0.
  4281. @item pict_type
  4282. A 1 character description of the current picture type.
  4283. @item pts
  4284. The timestamp of the current frame.
  4285. It can take up to three arguments.
  4286. The first argument is the format of the timestamp; it defaults to @code{flt}
  4287. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  4288. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  4289. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  4290. @code{localtime} stands for the timestamp of the frame formatted as
  4291. local time zone time.
  4292. The second argument is an offset added to the timestamp.
  4293. If the format is set to @code{localtime} or @code{gmtime},
  4294. a third argument may be supplied: a strftime() format string.
  4295. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  4296. @end table
  4297. @subsection Examples
  4298. @itemize
  4299. @item
  4300. Draw "Test Text" with font FreeSerif, using the default values for the
  4301. optional parameters.
  4302. @example
  4303. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  4304. @end example
  4305. @item
  4306. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  4307. and y=50 (counting from the top-left corner of the screen), text is
  4308. yellow with a red box around it. Both the text and the box have an
  4309. opacity of 20%.
  4310. @example
  4311. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  4312. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  4313. @end example
  4314. Note that the double quotes are not necessary if spaces are not used
  4315. within the parameter list.
  4316. @item
  4317. Show the text at the center of the video frame:
  4318. @example
  4319. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
  4320. @end example
  4321. @item
  4322. Show a text line sliding from right to left in the last row of the video
  4323. frame. The file @file{LONG_LINE} is assumed to contain a single line
  4324. with no newlines.
  4325. @example
  4326. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  4327. @end example
  4328. @item
  4329. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  4330. @example
  4331. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  4332. @end example
  4333. @item
  4334. Draw a single green letter "g", at the center of the input video.
  4335. The glyph baseline is placed at half screen height.
  4336. @example
  4337. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  4338. @end example
  4339. @item
  4340. Show text for 1 second every 3 seconds:
  4341. @example
  4342. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  4343. @end example
  4344. @item
  4345. Use fontconfig to set the font. Note that the colons need to be escaped.
  4346. @example
  4347. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  4348. @end example
  4349. @item
  4350. Print the date of a real-time encoding (see strftime(3)):
  4351. @example
  4352. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  4353. @end example
  4354. @item
  4355. Show text fading in and out (appearing/disappearing):
  4356. @example
  4357. #!/bin/sh
  4358. DS=1.0 # display start
  4359. DE=10.0 # display end
  4360. FID=1.5 # fade in duration
  4361. FOD=5 # fade out duration
  4362. 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 @}"
  4363. @end example
  4364. @end itemize
  4365. For more information about libfreetype, check:
  4366. @url{http://www.freetype.org/}.
  4367. For more information about fontconfig, check:
  4368. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  4369. For more information about libfribidi, check:
  4370. @url{http://fribidi.org/}.
  4371. @section edgedetect
  4372. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  4373. The filter accepts the following options:
  4374. @table @option
  4375. @item low
  4376. @item high
  4377. Set low and high threshold values used by the Canny thresholding
  4378. algorithm.
  4379. The high threshold selects the "strong" edge pixels, which are then
  4380. connected through 8-connectivity with the "weak" edge pixels selected
  4381. by the low threshold.
  4382. @var{low} and @var{high} threshold values must be chosen in the range
  4383. [0,1], and @var{low} should be lesser or equal to @var{high}.
  4384. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  4385. is @code{50/255}.
  4386. @item mode
  4387. Define the drawing mode.
  4388. @table @samp
  4389. @item wires
  4390. Draw white/gray wires on black background.
  4391. @item colormix
  4392. Mix the colors to create a paint/cartoon effect.
  4393. @end table
  4394. Default value is @var{wires}.
  4395. @end table
  4396. @subsection Examples
  4397. @itemize
  4398. @item
  4399. Standard edge detection with custom values for the hysteresis thresholding:
  4400. @example
  4401. edgedetect=low=0.1:high=0.4
  4402. @end example
  4403. @item
  4404. Painting effect without thresholding:
  4405. @example
  4406. edgedetect=mode=colormix:high=0
  4407. @end example
  4408. @end itemize
  4409. @section eq
  4410. Set brightness, contrast, saturation and approximate gamma adjustment.
  4411. The filter accepts the following options:
  4412. @table @option
  4413. @item contrast
  4414. Set the contrast expression. The value must be a float value in range
  4415. @code{-2.0} to @code{2.0}. The default value is "1".
  4416. @item brightness
  4417. Set the brightness expression. The value must be a float value in
  4418. range @code{-1.0} to @code{1.0}. The default value is "0".
  4419. @item saturation
  4420. Set the saturation expression. The value must be a float in
  4421. range @code{0.0} to @code{3.0}. The default value is "1".
  4422. @item gamma
  4423. Set the gamma expression. The value must be a float in range
  4424. @code{0.1} to @code{10.0}. The default value is "1".
  4425. @item gamma_r
  4426. Set the gamma expression for red. The value must be a float in
  4427. range @code{0.1} to @code{10.0}. The default value is "1".
  4428. @item gamma_g
  4429. Set the gamma expression for green. The value must be a float in range
  4430. @code{0.1} to @code{10.0}. The default value is "1".
  4431. @item gamma_b
  4432. Set the gamma expression for blue. The value must be a float in range
  4433. @code{0.1} to @code{10.0}. The default value is "1".
  4434. @item gamma_weight
  4435. Set the gamma weight expression. It can be used to reduce the effect
  4436. of a high gamma value on bright image areas, e.g. keep them from
  4437. getting overamplified and just plain white. The value must be a float
  4438. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  4439. gamma correction all the way down while @code{1.0} leaves it at its
  4440. full strength. Default is "1".
  4441. @item eval
  4442. Set when the expressions for brightness, contrast, saturation and
  4443. gamma expressions are evaluated.
  4444. It accepts the following values:
  4445. @table @samp
  4446. @item init
  4447. only evaluate expressions once during the filter initialization or
  4448. when a command is processed
  4449. @item frame
  4450. evaluate expressions for each incoming frame
  4451. @end table
  4452. Default value is @samp{init}.
  4453. @end table
  4454. The expressions accept the following parameters:
  4455. @table @option
  4456. @item n
  4457. frame count of the input frame starting from 0
  4458. @item pos
  4459. byte position of the corresponding packet in the input file, NAN if
  4460. unspecified
  4461. @item r
  4462. frame rate of the input video, NAN if the input frame rate is unknown
  4463. @item t
  4464. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4465. @end table
  4466. @subsection Commands
  4467. The filter supports the following commands:
  4468. @table @option
  4469. @item contrast
  4470. Set the contrast expression.
  4471. @item brightness
  4472. Set the brightness expression.
  4473. @item saturation
  4474. Set the saturation expression.
  4475. @item gamma
  4476. Set the gamma expression.
  4477. @item gamma_r
  4478. Set the gamma_r expression.
  4479. @item gamma_g
  4480. Set gamma_g expression.
  4481. @item gamma_b
  4482. Set gamma_b expression.
  4483. @item gamma_weight
  4484. Set gamma_weight expression.
  4485. The command accepts the same syntax of the corresponding option.
  4486. If the specified expression is not valid, it is kept at its current
  4487. value.
  4488. @end table
  4489. @section erosion
  4490. Apply erosion effect to the video.
  4491. This filter replaces the pixel by the local(3x3) minimum.
  4492. It accepts the following options:
  4493. @table @option
  4494. @item threshold0
  4495. @item threshold1
  4496. @item threshold2
  4497. @item threshold3
  4498. Limit the maximum change for each plane, default is 65535.
  4499. If 0, plane will remain unchanged.
  4500. @item coordinates
  4501. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4502. pixels are used.
  4503. Flags to local 3x3 coordinates maps like this:
  4504. 1 2 3
  4505. 4 5
  4506. 6 7 8
  4507. @end table
  4508. @section extractplanes
  4509. Extract color channel components from input video stream into
  4510. separate grayscale video streams.
  4511. The filter accepts the following option:
  4512. @table @option
  4513. @item planes
  4514. Set plane(s) to extract.
  4515. Available values for planes are:
  4516. @table @samp
  4517. @item y
  4518. @item u
  4519. @item v
  4520. @item a
  4521. @item r
  4522. @item g
  4523. @item b
  4524. @end table
  4525. Choosing planes not available in the input will result in an error.
  4526. That means you cannot select @code{r}, @code{g}, @code{b} planes
  4527. with @code{y}, @code{u}, @code{v} planes at same time.
  4528. @end table
  4529. @subsection Examples
  4530. @itemize
  4531. @item
  4532. Extract luma, u and v color channel component from input video frame
  4533. into 3 grayscale outputs:
  4534. @example
  4535. 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
  4536. @end example
  4537. @end itemize
  4538. @section elbg
  4539. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  4540. For each input image, the filter will compute the optimal mapping from
  4541. the input to the output given the codebook length, that is the number
  4542. of distinct output colors.
  4543. This filter accepts the following options.
  4544. @table @option
  4545. @item codebook_length, l
  4546. Set codebook length. The value must be a positive integer, and
  4547. represents the number of distinct output colors. Default value is 256.
  4548. @item nb_steps, n
  4549. Set the maximum number of iterations to apply for computing the optimal
  4550. mapping. The higher the value the better the result and the higher the
  4551. computation time. Default value is 1.
  4552. @item seed, s
  4553. Set a random seed, must be an integer included between 0 and
  4554. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  4555. will try to use a good random seed on a best effort basis.
  4556. @item pal8
  4557. Set pal8 output pixel format. This option does not work with codebook
  4558. length greater than 256.
  4559. @end table
  4560. @section fade
  4561. Apply a fade-in/out effect to the input video.
  4562. It accepts the following parameters:
  4563. @table @option
  4564. @item type, t
  4565. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  4566. effect.
  4567. Default is @code{in}.
  4568. @item start_frame, s
  4569. Specify the number of the frame to start applying the fade
  4570. effect at. Default is 0.
  4571. @item nb_frames, n
  4572. The number of frames that the fade effect lasts. At the end of the
  4573. fade-in effect, the output video will have the same intensity as the input video.
  4574. At the end of the fade-out transition, the output video will be filled with the
  4575. selected @option{color}.
  4576. Default is 25.
  4577. @item alpha
  4578. If set to 1, fade only alpha channel, if one exists on the input.
  4579. Default value is 0.
  4580. @item start_time, st
  4581. Specify the timestamp (in seconds) of the frame to start to apply the fade
  4582. effect. If both start_frame and start_time are specified, the fade will start at
  4583. whichever comes last. Default is 0.
  4584. @item duration, d
  4585. The number of seconds for which the fade effect has to last. At the end of the
  4586. fade-in effect the output video will have the same intensity as the input video,
  4587. at the end of the fade-out transition the output video will be filled with the
  4588. selected @option{color}.
  4589. If both duration and nb_frames are specified, duration is used. Default is 0
  4590. (nb_frames is used by default).
  4591. @item color, c
  4592. Specify the color of the fade. Default is "black".
  4593. @end table
  4594. @subsection Examples
  4595. @itemize
  4596. @item
  4597. Fade in the first 30 frames of video:
  4598. @example
  4599. fade=in:0:30
  4600. @end example
  4601. The command above is equivalent to:
  4602. @example
  4603. fade=t=in:s=0:n=30
  4604. @end example
  4605. @item
  4606. Fade out the last 45 frames of a 200-frame video:
  4607. @example
  4608. fade=out:155:45
  4609. fade=type=out:start_frame=155:nb_frames=45
  4610. @end example
  4611. @item
  4612. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  4613. @example
  4614. fade=in:0:25, fade=out:975:25
  4615. @end example
  4616. @item
  4617. Make the first 5 frames yellow, then fade in from frame 5-24:
  4618. @example
  4619. fade=in:5:20:color=yellow
  4620. @end example
  4621. @item
  4622. Fade in alpha over first 25 frames of video:
  4623. @example
  4624. fade=in:0:25:alpha=1
  4625. @end example
  4626. @item
  4627. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  4628. @example
  4629. fade=t=in:st=5.5:d=0.5
  4630. @end example
  4631. @end itemize
  4632. @section fftfilt
  4633. Apply arbitrary expressions to samples in frequency domain
  4634. @table @option
  4635. @item dc_Y
  4636. Adjust the dc value (gain) of the luma plane of the image. The filter
  4637. accepts an integer value in range @code{0} to @code{1000}. The default
  4638. value is set to @code{0}.
  4639. @item dc_U
  4640. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  4641. filter accepts an integer value in range @code{0} to @code{1000}. The
  4642. default value is set to @code{0}.
  4643. @item dc_V
  4644. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  4645. filter accepts an integer value in range @code{0} to @code{1000}. The
  4646. default value is set to @code{0}.
  4647. @item weight_Y
  4648. Set the frequency domain weight expression for the luma plane.
  4649. @item weight_U
  4650. Set the frequency domain weight expression for the 1st chroma plane.
  4651. @item weight_V
  4652. Set the frequency domain weight expression for the 2nd chroma plane.
  4653. The filter accepts the following variables:
  4654. @item X
  4655. @item Y
  4656. The coordinates of the current sample.
  4657. @item W
  4658. @item H
  4659. The width and height of the image.
  4660. @end table
  4661. @subsection Examples
  4662. @itemize
  4663. @item
  4664. High-pass:
  4665. @example
  4666. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  4667. @end example
  4668. @item
  4669. Low-pass:
  4670. @example
  4671. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  4672. @end example
  4673. @item
  4674. Sharpen:
  4675. @example
  4676. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  4677. @end example
  4678. @end itemize
  4679. @section field
  4680. Extract a single field from an interlaced image using stride
  4681. arithmetic to avoid wasting CPU time. The output frames are marked as
  4682. non-interlaced.
  4683. The filter accepts the following options:
  4684. @table @option
  4685. @item type
  4686. Specify whether to extract the top (if the value is @code{0} or
  4687. @code{top}) or the bottom field (if the value is @code{1} or
  4688. @code{bottom}).
  4689. @end table
  4690. @section fieldmatch
  4691. Field matching filter for inverse telecine. It is meant to reconstruct the
  4692. progressive frames from a telecined stream. The filter does not drop duplicated
  4693. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  4694. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  4695. The separation of the field matching and the decimation is notably motivated by
  4696. the possibility of inserting a de-interlacing filter fallback between the two.
  4697. If the source has mixed telecined and real interlaced content,
  4698. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  4699. But these remaining combed frames will be marked as interlaced, and thus can be
  4700. de-interlaced by a later filter such as @ref{yadif} before decimation.
  4701. In addition to the various configuration options, @code{fieldmatch} can take an
  4702. optional second stream, activated through the @option{ppsrc} option. If
  4703. enabled, the frames reconstruction will be based on the fields and frames from
  4704. this second stream. This allows the first input to be pre-processed in order to
  4705. help the various algorithms of the filter, while keeping the output lossless
  4706. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  4707. or brightness/contrast adjustments can help.
  4708. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  4709. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  4710. which @code{fieldmatch} is based on. While the semantic and usage are very
  4711. close, some behaviour and options names can differ.
  4712. The @ref{decimate} filter currently only works for constant frame rate input.
  4713. If your input has mixed telecined (30fps) and progressive content with a lower
  4714. framerate like 24fps use the following filterchain to produce the necessary cfr
  4715. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  4716. The filter accepts the following options:
  4717. @table @option
  4718. @item order
  4719. Specify the assumed field order of the input stream. Available values are:
  4720. @table @samp
  4721. @item auto
  4722. Auto detect parity (use FFmpeg's internal parity value).
  4723. @item bff
  4724. Assume bottom field first.
  4725. @item tff
  4726. Assume top field first.
  4727. @end table
  4728. Note that it is sometimes recommended not to trust the parity announced by the
  4729. stream.
  4730. Default value is @var{auto}.
  4731. @item mode
  4732. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  4733. sense that it won't risk creating jerkiness due to duplicate frames when
  4734. possible, but if there are bad edits or blended fields it will end up
  4735. outputting combed frames when a good match might actually exist. On the other
  4736. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  4737. but will almost always find a good frame if there is one. The other values are
  4738. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  4739. jerkiness and creating duplicate frames versus finding good matches in sections
  4740. with bad edits, orphaned fields, blended fields, etc.
  4741. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  4742. Available values are:
  4743. @table @samp
  4744. @item pc
  4745. 2-way matching (p/c)
  4746. @item pc_n
  4747. 2-way matching, and trying 3rd match if still combed (p/c + n)
  4748. @item pc_u
  4749. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  4750. @item pc_n_ub
  4751. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  4752. still combed (p/c + n + u/b)
  4753. @item pcn
  4754. 3-way matching (p/c/n)
  4755. @item pcn_ub
  4756. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  4757. detected as combed (p/c/n + u/b)
  4758. @end table
  4759. The parenthesis at the end indicate the matches that would be used for that
  4760. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  4761. @var{top}).
  4762. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  4763. the slowest.
  4764. Default value is @var{pc_n}.
  4765. @item ppsrc
  4766. Mark the main input stream as a pre-processed input, and enable the secondary
  4767. input stream as the clean source to pick the fields from. See the filter
  4768. introduction for more details. It is similar to the @option{clip2} feature from
  4769. VFM/TFM.
  4770. Default value is @code{0} (disabled).
  4771. @item field
  4772. Set the field to match from. It is recommended to set this to the same value as
  4773. @option{order} unless you experience matching failures with that setting. In
  4774. certain circumstances changing the field that is used to match from can have a
  4775. large impact on matching performance. Available values are:
  4776. @table @samp
  4777. @item auto
  4778. Automatic (same value as @option{order}).
  4779. @item bottom
  4780. Match from the bottom field.
  4781. @item top
  4782. Match from the top field.
  4783. @end table
  4784. Default value is @var{auto}.
  4785. @item mchroma
  4786. Set whether or not chroma is included during the match comparisons. In most
  4787. cases it is recommended to leave this enabled. You should set this to @code{0}
  4788. only if your clip has bad chroma problems such as heavy rainbowing or other
  4789. artifacts. Setting this to @code{0} could also be used to speed things up at
  4790. the cost of some accuracy.
  4791. Default value is @code{1}.
  4792. @item y0
  4793. @item y1
  4794. These define an exclusion band which excludes the lines between @option{y0} and
  4795. @option{y1} from being included in the field matching decision. An exclusion
  4796. band can be used to ignore subtitles, a logo, or other things that may
  4797. interfere with the matching. @option{y0} sets the starting scan line and
  4798. @option{y1} sets the ending line; all lines in between @option{y0} and
  4799. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  4800. @option{y0} and @option{y1} to the same value will disable the feature.
  4801. @option{y0} and @option{y1} defaults to @code{0}.
  4802. @item scthresh
  4803. Set the scene change detection threshold as a percentage of maximum change on
  4804. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  4805. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  4806. @option{scthresh} is @code{[0.0, 100.0]}.
  4807. Default value is @code{12.0}.
  4808. @item combmatch
  4809. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  4810. account the combed scores of matches when deciding what match to use as the
  4811. final match. Available values are:
  4812. @table @samp
  4813. @item none
  4814. No final matching based on combed scores.
  4815. @item sc
  4816. Combed scores are only used when a scene change is detected.
  4817. @item full
  4818. Use combed scores all the time.
  4819. @end table
  4820. Default is @var{sc}.
  4821. @item combdbg
  4822. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  4823. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  4824. Available values are:
  4825. @table @samp
  4826. @item none
  4827. No forced calculation.
  4828. @item pcn
  4829. Force p/c/n calculations.
  4830. @item pcnub
  4831. Force p/c/n/u/b calculations.
  4832. @end table
  4833. Default value is @var{none}.
  4834. @item cthresh
  4835. This is the area combing threshold used for combed frame detection. This
  4836. essentially controls how "strong" or "visible" combing must be to be detected.
  4837. Larger values mean combing must be more visible and smaller values mean combing
  4838. can be less visible or strong and still be detected. Valid settings are from
  4839. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  4840. be detected as combed). This is basically a pixel difference value. A good
  4841. range is @code{[8, 12]}.
  4842. Default value is @code{9}.
  4843. @item chroma
  4844. Sets whether or not chroma is considered in the combed frame decision. Only
  4845. disable this if your source has chroma problems (rainbowing, etc.) that are
  4846. causing problems for the combed frame detection with chroma enabled. Actually,
  4847. using @option{chroma}=@var{0} is usually more reliable, except for the case
  4848. where there is chroma only combing in the source.
  4849. Default value is @code{0}.
  4850. @item blockx
  4851. @item blocky
  4852. Respectively set the x-axis and y-axis size of the window used during combed
  4853. frame detection. This has to do with the size of the area in which
  4854. @option{combpel} pixels are required to be detected as combed for a frame to be
  4855. declared combed. See the @option{combpel} parameter description for more info.
  4856. Possible values are any number that is a power of 2 starting at 4 and going up
  4857. to 512.
  4858. Default value is @code{16}.
  4859. @item combpel
  4860. The number of combed pixels inside any of the @option{blocky} by
  4861. @option{blockx} size blocks on the frame for the frame to be detected as
  4862. combed. While @option{cthresh} controls how "visible" the combing must be, this
  4863. setting controls "how much" combing there must be in any localized area (a
  4864. window defined by the @option{blockx} and @option{blocky} settings) on the
  4865. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  4866. which point no frames will ever be detected as combed). This setting is known
  4867. as @option{MI} in TFM/VFM vocabulary.
  4868. Default value is @code{80}.
  4869. @end table
  4870. @anchor{p/c/n/u/b meaning}
  4871. @subsection p/c/n/u/b meaning
  4872. @subsubsection p/c/n
  4873. We assume the following telecined stream:
  4874. @example
  4875. Top fields: 1 2 2 3 4
  4876. Bottom fields: 1 2 3 4 4
  4877. @end example
  4878. The numbers correspond to the progressive frame the fields relate to. Here, the
  4879. first two frames are progressive, the 3rd and 4th are combed, and so on.
  4880. When @code{fieldmatch} is configured to run a matching from bottom
  4881. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  4882. @example
  4883. Input stream:
  4884. T 1 2 2 3 4
  4885. B 1 2 3 4 4 <-- matching reference
  4886. Matches: c c n n c
  4887. Output stream:
  4888. T 1 2 3 4 4
  4889. B 1 2 3 4 4
  4890. @end example
  4891. As a result of the field matching, we can see that some frames get duplicated.
  4892. To perform a complete inverse telecine, you need to rely on a decimation filter
  4893. after this operation. See for instance the @ref{decimate} filter.
  4894. The same operation now matching from top fields (@option{field}=@var{top})
  4895. looks like this:
  4896. @example
  4897. Input stream:
  4898. T 1 2 2 3 4 <-- matching reference
  4899. B 1 2 3 4 4
  4900. Matches: c c p p c
  4901. Output stream:
  4902. T 1 2 2 3 4
  4903. B 1 2 2 3 4
  4904. @end example
  4905. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  4906. basically, they refer to the frame and field of the opposite parity:
  4907. @itemize
  4908. @item @var{p} matches the field of the opposite parity in the previous frame
  4909. @item @var{c} matches the field of the opposite parity in the current frame
  4910. @item @var{n} matches the field of the opposite parity in the next frame
  4911. @end itemize
  4912. @subsubsection u/b
  4913. The @var{u} and @var{b} matching are a bit special in the sense that they match
  4914. from the opposite parity flag. In the following examples, we assume that we are
  4915. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  4916. 'x' is placed above and below each matched fields.
  4917. With bottom matching (@option{field}=@var{bottom}):
  4918. @example
  4919. Match: c p n b u
  4920. x x x x x
  4921. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  4922. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  4923. x x x x x
  4924. Output frames:
  4925. 2 1 2 2 2
  4926. 2 2 2 1 3
  4927. @end example
  4928. With top matching (@option{field}=@var{top}):
  4929. @example
  4930. Match: c p n b u
  4931. x x x x x
  4932. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  4933. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  4934. x x x x x
  4935. Output frames:
  4936. 2 2 2 1 2
  4937. 2 1 3 2 2
  4938. @end example
  4939. @subsection Examples
  4940. Simple IVTC of a top field first telecined stream:
  4941. @example
  4942. fieldmatch=order=tff:combmatch=none, decimate
  4943. @end example
  4944. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  4945. @example
  4946. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  4947. @end example
  4948. @section fieldorder
  4949. Transform the field order of the input video.
  4950. It accepts the following parameters:
  4951. @table @option
  4952. @item order
  4953. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  4954. for bottom field first.
  4955. @end table
  4956. The default value is @samp{tff}.
  4957. The transformation is done by shifting the picture content up or down
  4958. by one line, and filling the remaining line with appropriate picture content.
  4959. This method is consistent with most broadcast field order converters.
  4960. If the input video is not flagged as being interlaced, or it is already
  4961. flagged as being of the required output field order, then this filter does
  4962. not alter the incoming video.
  4963. It is very useful when converting to or from PAL DV material,
  4964. which is bottom field first.
  4965. For example:
  4966. @example
  4967. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  4968. @end example
  4969. @section fifo, afifo
  4970. Buffer input images and send them when they are requested.
  4971. It is mainly useful when auto-inserted by the libavfilter
  4972. framework.
  4973. It does not take parameters.
  4974. @section find_rect
  4975. Find a rectangular object
  4976. It accepts the following options:
  4977. @table @option
  4978. @item object
  4979. Filepath of the object image, needs to be in gray8.
  4980. @item threshold
  4981. Detection threshold, default is 0.5.
  4982. @item mipmaps
  4983. Number of mipmaps, default is 3.
  4984. @item xmin, ymin, xmax, ymax
  4985. Specifies the rectangle in which to search.
  4986. @end table
  4987. @subsection Examples
  4988. @itemize
  4989. @item
  4990. Generate a representative palette of a given video using @command{ffmpeg}:
  4991. @example
  4992. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  4993. @end example
  4994. @end itemize
  4995. @section cover_rect
  4996. Cover a rectangular object
  4997. It accepts the following options:
  4998. @table @option
  4999. @item cover
  5000. Filepath of the optional cover image, needs to be in yuv420.
  5001. @item mode
  5002. Set covering mode.
  5003. It accepts the following values:
  5004. @table @samp
  5005. @item cover
  5006. cover it by the supplied image
  5007. @item blur
  5008. cover it by interpolating the surrounding pixels
  5009. @end table
  5010. Default value is @var{blur}.
  5011. @end table
  5012. @subsection Examples
  5013. @itemize
  5014. @item
  5015. Generate a representative palette of a given video using @command{ffmpeg}:
  5016. @example
  5017. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5018. @end example
  5019. @end itemize
  5020. @anchor{format}
  5021. @section format
  5022. Convert the input video to one of the specified pixel formats.
  5023. Libavfilter will try to pick one that is suitable as input to
  5024. the next filter.
  5025. It accepts the following parameters:
  5026. @table @option
  5027. @item pix_fmts
  5028. A '|'-separated list of pixel format names, such as
  5029. "pix_fmts=yuv420p|monow|rgb24".
  5030. @end table
  5031. @subsection Examples
  5032. @itemize
  5033. @item
  5034. Convert the input video to the @var{yuv420p} format
  5035. @example
  5036. format=pix_fmts=yuv420p
  5037. @end example
  5038. Convert the input video to any of the formats in the list
  5039. @example
  5040. format=pix_fmts=yuv420p|yuv444p|yuv410p
  5041. @end example
  5042. @end itemize
  5043. @anchor{fps}
  5044. @section fps
  5045. Convert the video to specified constant frame rate by duplicating or dropping
  5046. frames as necessary.
  5047. It accepts the following parameters:
  5048. @table @option
  5049. @item fps
  5050. The desired output frame rate. The default is @code{25}.
  5051. @item round
  5052. Rounding method.
  5053. Possible values are:
  5054. @table @option
  5055. @item zero
  5056. zero round towards 0
  5057. @item inf
  5058. round away from 0
  5059. @item down
  5060. round towards -infinity
  5061. @item up
  5062. round towards +infinity
  5063. @item near
  5064. round to nearest
  5065. @end table
  5066. The default is @code{near}.
  5067. @item start_time
  5068. Assume the first PTS should be the given value, in seconds. This allows for
  5069. padding/trimming at the start of stream. By default, no assumption is made
  5070. about the first frame's expected PTS, so no padding or trimming is done.
  5071. For example, this could be set to 0 to pad the beginning with duplicates of
  5072. the first frame if a video stream starts after the audio stream or to trim any
  5073. frames with a negative PTS.
  5074. @end table
  5075. Alternatively, the options can be specified as a flat string:
  5076. @var{fps}[:@var{round}].
  5077. See also the @ref{setpts} filter.
  5078. @subsection Examples
  5079. @itemize
  5080. @item
  5081. A typical usage in order to set the fps to 25:
  5082. @example
  5083. fps=fps=25
  5084. @end example
  5085. @item
  5086. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  5087. @example
  5088. fps=fps=film:round=near
  5089. @end example
  5090. @end itemize
  5091. @section framepack
  5092. Pack two different video streams into a stereoscopic video, setting proper
  5093. metadata on supported codecs. The two views should have the same size and
  5094. framerate and processing will stop when the shorter video ends. Please note
  5095. that you may conveniently adjust view properties with the @ref{scale} and
  5096. @ref{fps} filters.
  5097. It accepts the following parameters:
  5098. @table @option
  5099. @item format
  5100. The desired packing format. Supported values are:
  5101. @table @option
  5102. @item sbs
  5103. The views are next to each other (default).
  5104. @item tab
  5105. The views are on top of each other.
  5106. @item lines
  5107. The views are packed by line.
  5108. @item columns
  5109. The views are packed by column.
  5110. @item frameseq
  5111. The views are temporally interleaved.
  5112. @end table
  5113. @end table
  5114. Some examples:
  5115. @example
  5116. # Convert left and right views into a frame-sequential video
  5117. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  5118. # Convert views into a side-by-side video with the same output resolution as the input
  5119. 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
  5120. @end example
  5121. @section framerate
  5122. Change the frame rate by interpolating new video output frames from the source
  5123. frames.
  5124. This filter is not designed to function correctly with interlaced media. If
  5125. you wish to change the frame rate of interlaced media then you are required
  5126. to deinterlace before this filter and re-interlace after this filter.
  5127. A description of the accepted options follows.
  5128. @table @option
  5129. @item fps
  5130. Specify the output frames per second. This option can also be specified
  5131. as a value alone. The default is @code{50}.
  5132. @item interp_start
  5133. Specify the start of a range where the output frame will be created as a
  5134. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5135. the default is @code{15}.
  5136. @item interp_end
  5137. Specify the end of a range where the output frame will be created as a
  5138. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5139. the default is @code{240}.
  5140. @item scene
  5141. Specify the level at which a scene change is detected as a value between
  5142. 0 and 100 to indicate a new scene; a low value reflects a low
  5143. probability for the current frame to introduce a new scene, while a higher
  5144. value means the current frame is more likely to be one.
  5145. The default is @code{7}.
  5146. @item flags
  5147. Specify flags influencing the filter process.
  5148. Available value for @var{flags} is:
  5149. @table @option
  5150. @item scene_change_detect, scd
  5151. Enable scene change detection using the value of the option @var{scene}.
  5152. This flag is enabled by default.
  5153. @end table
  5154. @end table
  5155. @section framestep
  5156. Select one frame every N-th frame.
  5157. This filter accepts the following option:
  5158. @table @option
  5159. @item step
  5160. Select frame after every @code{step} frames.
  5161. Allowed values are positive integers higher than 0. Default value is @code{1}.
  5162. @end table
  5163. @anchor{frei0r}
  5164. @section frei0r
  5165. Apply a frei0r effect to the input video.
  5166. To enable the compilation of this filter, you need to install the frei0r
  5167. header and configure FFmpeg with @code{--enable-frei0r}.
  5168. It accepts the following parameters:
  5169. @table @option
  5170. @item filter_name
  5171. The name of the frei0r effect to load. If the environment variable
  5172. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  5173. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  5174. Otherwise, the standard frei0r paths are searched, in this order:
  5175. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  5176. @file{/usr/lib/frei0r-1/}.
  5177. @item filter_params
  5178. A '|'-separated list of parameters to pass to the frei0r effect.
  5179. @end table
  5180. A frei0r effect parameter can be a boolean (its value is either
  5181. "y" or "n"), a double, a color (specified as
  5182. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  5183. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  5184. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  5185. @var{X} and @var{Y} are floating point numbers) and/or a string.
  5186. The number and types of parameters depend on the loaded effect. If an
  5187. effect parameter is not specified, the default value is set.
  5188. @subsection Examples
  5189. @itemize
  5190. @item
  5191. Apply the distort0r effect, setting the first two double parameters:
  5192. @example
  5193. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  5194. @end example
  5195. @item
  5196. Apply the colordistance effect, taking a color as the first parameter:
  5197. @example
  5198. frei0r=colordistance:0.2/0.3/0.4
  5199. frei0r=colordistance:violet
  5200. frei0r=colordistance:0x112233
  5201. @end example
  5202. @item
  5203. Apply the perspective effect, specifying the top left and top right image
  5204. positions:
  5205. @example
  5206. frei0r=perspective:0.2/0.2|0.8/0.2
  5207. @end example
  5208. @end itemize
  5209. For more information, see
  5210. @url{http://frei0r.dyne.org}
  5211. @section fspp
  5212. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  5213. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  5214. processing filter, one of them is performed once per block, not per pixel.
  5215. This allows for much higher speed.
  5216. The filter accepts the following options:
  5217. @table @option
  5218. @item quality
  5219. Set quality. This option defines the number of levels for averaging. It accepts
  5220. an integer in the range 4-5. Default value is @code{4}.
  5221. @item qp
  5222. Force a constant quantization parameter. It accepts an integer in range 0-63.
  5223. If not set, the filter will use the QP from the video stream (if available).
  5224. @item strength
  5225. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  5226. more details but also more artifacts, while higher values make the image smoother
  5227. but also blurrier. Default value is @code{0} − PSNR optimal.
  5228. @item use_bframe_qp
  5229. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5230. option may cause flicker since the B-Frames have often larger QP. Default is
  5231. @code{0} (not enabled).
  5232. @end table
  5233. @section geq
  5234. The filter accepts the following options:
  5235. @table @option
  5236. @item lum_expr, lum
  5237. Set the luminance expression.
  5238. @item cb_expr, cb
  5239. Set the chrominance blue expression.
  5240. @item cr_expr, cr
  5241. Set the chrominance red expression.
  5242. @item alpha_expr, a
  5243. Set the alpha expression.
  5244. @item red_expr, r
  5245. Set the red expression.
  5246. @item green_expr, g
  5247. Set the green expression.
  5248. @item blue_expr, b
  5249. Set the blue expression.
  5250. @end table
  5251. The colorspace is selected according to the specified options. If one
  5252. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  5253. options is specified, the filter will automatically select a YCbCr
  5254. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  5255. @option{blue_expr} options is specified, it will select an RGB
  5256. colorspace.
  5257. If one of the chrominance expression is not defined, it falls back on the other
  5258. one. If no alpha expression is specified it will evaluate to opaque value.
  5259. If none of chrominance expressions are specified, they will evaluate
  5260. to the luminance expression.
  5261. The expressions can use the following variables and functions:
  5262. @table @option
  5263. @item N
  5264. The sequential number of the filtered frame, starting from @code{0}.
  5265. @item X
  5266. @item Y
  5267. The coordinates of the current sample.
  5268. @item W
  5269. @item H
  5270. The width and height of the image.
  5271. @item SW
  5272. @item SH
  5273. Width and height scale depending on the currently filtered plane. It is the
  5274. ratio between the corresponding luma plane number of pixels and the current
  5275. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  5276. @code{0.5,0.5} for chroma planes.
  5277. @item T
  5278. Time of the current frame, expressed in seconds.
  5279. @item p(x, y)
  5280. Return the value of the pixel at location (@var{x},@var{y}) of the current
  5281. plane.
  5282. @item lum(x, y)
  5283. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  5284. plane.
  5285. @item cb(x, y)
  5286. Return the value of the pixel at location (@var{x},@var{y}) of the
  5287. blue-difference chroma plane. Return 0 if there is no such plane.
  5288. @item cr(x, y)
  5289. Return the value of the pixel at location (@var{x},@var{y}) of the
  5290. red-difference chroma plane. Return 0 if there is no such plane.
  5291. @item r(x, y)
  5292. @item g(x, y)
  5293. @item b(x, y)
  5294. Return the value of the pixel at location (@var{x},@var{y}) of the
  5295. red/green/blue component. Return 0 if there is no such component.
  5296. @item alpha(x, y)
  5297. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  5298. plane. Return 0 if there is no such plane.
  5299. @end table
  5300. For functions, if @var{x} and @var{y} are outside the area, the value will be
  5301. automatically clipped to the closer edge.
  5302. @subsection Examples
  5303. @itemize
  5304. @item
  5305. Flip the image horizontally:
  5306. @example
  5307. geq=p(W-X\,Y)
  5308. @end example
  5309. @item
  5310. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  5311. wavelength of 100 pixels:
  5312. @example
  5313. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  5314. @end example
  5315. @item
  5316. Generate a fancy enigmatic moving light:
  5317. @example
  5318. 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
  5319. @end example
  5320. @item
  5321. Generate a quick emboss effect:
  5322. @example
  5323. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  5324. @end example
  5325. @item
  5326. Modify RGB components depending on pixel position:
  5327. @example
  5328. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  5329. @end example
  5330. @item
  5331. Create a radial gradient that is the same size as the input (also see
  5332. the @ref{vignette} filter):
  5333. @example
  5334. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  5335. @end example
  5336. @item
  5337. Create a linear gradient to use as a mask for another filter, then
  5338. compose with @ref{overlay}. In this example the video will gradually
  5339. become more blurry from the top to the bottom of the y-axis as defined
  5340. by the linear gradient:
  5341. @example
  5342. 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
  5343. @end example
  5344. @end itemize
  5345. @section gradfun
  5346. Fix the banding artifacts that are sometimes introduced into nearly flat
  5347. regions by truncation to 8bit color depth.
  5348. Interpolate the gradients that should go where the bands are, and
  5349. dither them.
  5350. It is designed for playback only. Do not use it prior to
  5351. lossy compression, because compression tends to lose the dither and
  5352. bring back the bands.
  5353. It accepts the following parameters:
  5354. @table @option
  5355. @item strength
  5356. The maximum amount by which the filter will change any one pixel. This is also
  5357. the threshold for detecting nearly flat regions. Acceptable values range from
  5358. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  5359. valid range.
  5360. @item radius
  5361. The neighborhood to fit the gradient to. A larger radius makes for smoother
  5362. gradients, but also prevents the filter from modifying the pixels near detailed
  5363. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  5364. values will be clipped to the valid range.
  5365. @end table
  5366. Alternatively, the options can be specified as a flat string:
  5367. @var{strength}[:@var{radius}]
  5368. @subsection Examples
  5369. @itemize
  5370. @item
  5371. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  5372. @example
  5373. gradfun=3.5:8
  5374. @end example
  5375. @item
  5376. Specify radius, omitting the strength (which will fall-back to the default
  5377. value):
  5378. @example
  5379. gradfun=radius=8
  5380. @end example
  5381. @end itemize
  5382. @anchor{haldclut}
  5383. @section haldclut
  5384. Apply a Hald CLUT to a video stream.
  5385. First input is the video stream to process, and second one is the Hald CLUT.
  5386. The Hald CLUT input can be a simple picture or a complete video stream.
  5387. The filter accepts the following options:
  5388. @table @option
  5389. @item shortest
  5390. Force termination when the shortest input terminates. Default is @code{0}.
  5391. @item repeatlast
  5392. Continue applying the last CLUT after the end of the stream. A value of
  5393. @code{0} disable the filter after the last frame of the CLUT is reached.
  5394. Default is @code{1}.
  5395. @end table
  5396. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  5397. filters share the same internals).
  5398. More information about the Hald CLUT can be found on Eskil Steenberg's website
  5399. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  5400. @subsection Workflow examples
  5401. @subsubsection Hald CLUT video stream
  5402. Generate an identity Hald CLUT stream altered with various effects:
  5403. @example
  5404. 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
  5405. @end example
  5406. Note: make sure you use a lossless codec.
  5407. Then use it with @code{haldclut} to apply it on some random stream:
  5408. @example
  5409. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  5410. @end example
  5411. The Hald CLUT will be applied to the 10 first seconds (duration of
  5412. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  5413. to the remaining frames of the @code{mandelbrot} stream.
  5414. @subsubsection Hald CLUT with preview
  5415. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  5416. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  5417. biggest possible square starting at the top left of the picture. The remaining
  5418. padding pixels (bottom or right) will be ignored. This area can be used to add
  5419. a preview of the Hald CLUT.
  5420. Typically, the following generated Hald CLUT will be supported by the
  5421. @code{haldclut} filter:
  5422. @example
  5423. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  5424. pad=iw+320 [padded_clut];
  5425. smptebars=s=320x256, split [a][b];
  5426. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  5427. [main][b] overlay=W-320" -frames:v 1 clut.png
  5428. @end example
  5429. It contains the original and a preview of the effect of the CLUT: SMPTE color
  5430. bars are displayed on the right-top, and below the same color bars processed by
  5431. the color changes.
  5432. Then, the effect of this Hald CLUT can be visualized with:
  5433. @example
  5434. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  5435. @end example
  5436. @section hflip
  5437. Flip the input video horizontally.
  5438. For example, to horizontally flip the input video with @command{ffmpeg}:
  5439. @example
  5440. ffmpeg -i in.avi -vf "hflip" out.avi
  5441. @end example
  5442. @section histeq
  5443. This filter applies a global color histogram equalization on a
  5444. per-frame basis.
  5445. It can be used to correct video that has a compressed range of pixel
  5446. intensities. The filter redistributes the pixel intensities to
  5447. equalize their distribution across the intensity range. It may be
  5448. viewed as an "automatically adjusting contrast filter". This filter is
  5449. useful only for correcting degraded or poorly captured source
  5450. video.
  5451. The filter accepts the following options:
  5452. @table @option
  5453. @item strength
  5454. Determine the amount of equalization to be applied. As the strength
  5455. is reduced, the distribution of pixel intensities more-and-more
  5456. approaches that of the input frame. The value must be a float number
  5457. in the range [0,1] and defaults to 0.200.
  5458. @item intensity
  5459. Set the maximum intensity that can generated and scale the output
  5460. values appropriately. The strength should be set as desired and then
  5461. the intensity can be limited if needed to avoid washing-out. The value
  5462. must be a float number in the range [0,1] and defaults to 0.210.
  5463. @item antibanding
  5464. Set the antibanding level. If enabled the filter will randomly vary
  5465. the luminance of output pixels by a small amount to avoid banding of
  5466. the histogram. Possible values are @code{none}, @code{weak} or
  5467. @code{strong}. It defaults to @code{none}.
  5468. @end table
  5469. @section histogram
  5470. Compute and draw a color distribution histogram for the input video.
  5471. The computed histogram is a representation of the color component
  5472. distribution in an image.
  5473. The filter accepts the following options:
  5474. @table @option
  5475. @item mode
  5476. Set histogram mode.
  5477. It accepts the following values:
  5478. @table @samp
  5479. @item levels
  5480. Standard histogram that displays the color components distribution in an
  5481. image. Displays color graph for each color component. Shows distribution of
  5482. the Y, U, V, A or R, G, B components, depending on input format, in the
  5483. current frame. Below each graph a color component scale meter is shown.
  5484. @item color
  5485. Displays chroma values (U/V color placement) in a two dimensional
  5486. graph (which is called a vectorscope). The brighter a pixel in the
  5487. vectorscope, the more pixels of the input frame correspond to that pixel
  5488. (i.e., more pixels have this chroma value). The V component is displayed on
  5489. the horizontal (X) axis, with the leftmost side being V = 0 and the rightmost
  5490. side being V = 255. The U component is displayed on the vertical (Y) axis,
  5491. with the top representing U = 0 and the bottom representing U = 255.
  5492. The position of a white pixel in the graph corresponds to the chroma value of
  5493. a pixel of the input clip. The graph can therefore be used to read the hue
  5494. (color flavor) and the saturation (the dominance of the hue in the color). As
  5495. the hue of a color changes, it moves around the square. At the center of the
  5496. square the saturation is zero, which means that the corresponding pixel has no
  5497. color. If the amount of a specific color is increased (while leaving the other
  5498. colors unchanged) the saturation increases, and the indicator moves towards
  5499. the edge of the square.
  5500. @item color2
  5501. Chroma values in vectorscope, similar as @code{color} but actual chroma values
  5502. are displayed.
  5503. @item waveform
  5504. Per row/column color component graph. In row mode, the graph on the left side
  5505. represents color component value 0 and the right side represents value = 255.
  5506. In column mode, the top side represents color component value = 0 and bottom
  5507. side represents value = 255.
  5508. @end table
  5509. Default value is @code{levels}.
  5510. @item level_height
  5511. Set height of level in @code{levels}. Default value is @code{200}.
  5512. Allowed range is [50, 2048].
  5513. @item scale_height
  5514. Set height of color scale in @code{levels}. Default value is @code{12}.
  5515. Allowed range is [0, 40].
  5516. @item step
  5517. Set step for @code{waveform} mode. Smaller values are useful to find out how
  5518. many values of the same luminance are distributed across input rows/columns.
  5519. Default value is @code{10}. Allowed range is [1, 255].
  5520. @item waveform_mode
  5521. Set mode for @code{waveform}. Can be either @code{row}, or @code{column}.
  5522. Default is @code{row}.
  5523. @item waveform_mirror
  5524. Set mirroring mode for @code{waveform}. @code{0} means unmirrored, @code{1}
  5525. means mirrored. In mirrored mode, higher values will be represented on the left
  5526. side for @code{row} mode and at the top for @code{column} mode. Default is
  5527. @code{0} (unmirrored).
  5528. @item display_mode
  5529. Set display mode for @code{waveform} and @code{levels}.
  5530. It accepts the following values:
  5531. @table @samp
  5532. @item parade
  5533. Display separate graph for the color components side by side in
  5534. @code{row} waveform mode or one below the other in @code{column} waveform mode
  5535. for @code{waveform} histogram mode. For @code{levels} histogram mode,
  5536. per color component graphs are placed below each other.
  5537. Using this display mode in @code{waveform} histogram mode makes it easy to
  5538. spot color casts in the highlights and shadows of an image, by comparing the
  5539. contours of the top and the bottom graphs of each waveform. Since whites,
  5540. grays, and blacks are characterized by exactly equal amounts of red, green,
  5541. and blue, neutral areas of the picture should display three waveforms of
  5542. roughly equal width/height. If not, the correction is easy to perform by
  5543. making level adjustments the three waveforms.
  5544. @item overlay
  5545. Presents information identical to that in the @code{parade}, except
  5546. that the graphs representing color components are superimposed directly
  5547. over one another.
  5548. This display mode in @code{waveform} histogram mode makes it easier to spot
  5549. relative differences or similarities in overlapping areas of the color
  5550. components that are supposed to be identical, such as neutral whites, grays,
  5551. or blacks.
  5552. @end table
  5553. Default is @code{parade}.
  5554. @item levels_mode
  5555. Set mode for @code{levels}. Can be either @code{linear}, or @code{logarithmic}.
  5556. Default is @code{linear}.
  5557. @item components
  5558. Set what color components to display for mode @code{levels}.
  5559. Default is @code{7}.
  5560. @end table
  5561. @subsection Examples
  5562. @itemize
  5563. @item
  5564. Calculate and draw histogram:
  5565. @example
  5566. ffplay -i input -vf histogram
  5567. @end example
  5568. @end itemize
  5569. @anchor{hqdn3d}
  5570. @section hqdn3d
  5571. This is a high precision/quality 3d denoise filter. It aims to reduce
  5572. image noise, producing smooth images and making still images really
  5573. still. It should enhance compressibility.
  5574. It accepts the following optional parameters:
  5575. @table @option
  5576. @item luma_spatial
  5577. A non-negative floating point number which specifies spatial luma strength.
  5578. It defaults to 4.0.
  5579. @item chroma_spatial
  5580. A non-negative floating point number which specifies spatial chroma strength.
  5581. It defaults to 3.0*@var{luma_spatial}/4.0.
  5582. @item luma_tmp
  5583. A floating point number which specifies luma temporal strength. It defaults to
  5584. 6.0*@var{luma_spatial}/4.0.
  5585. @item chroma_tmp
  5586. A floating point number which specifies chroma temporal strength. It defaults to
  5587. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  5588. @end table
  5589. @section hqx
  5590. Apply a high-quality magnification filter designed for pixel art. This filter
  5591. was originally created by Maxim Stepin.
  5592. It accepts the following option:
  5593. @table @option
  5594. @item n
  5595. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  5596. @code{hq3x} and @code{4} for @code{hq4x}.
  5597. Default is @code{3}.
  5598. @end table
  5599. @section hstack
  5600. Stack input videos horizontally.
  5601. All streams must be of same pixel format and of same height.
  5602. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  5603. to create same output.
  5604. The filter accept the following option:
  5605. @table @option
  5606. @item inputs
  5607. Set number of input streams. Default is 2.
  5608. @item shortest
  5609. If set to 1, force the output to terminate when the shortest input
  5610. terminates. Default value is 0.
  5611. @end table
  5612. @section hue
  5613. Modify the hue and/or the saturation of the input.
  5614. It accepts the following parameters:
  5615. @table @option
  5616. @item h
  5617. Specify the hue angle as a number of degrees. It accepts an expression,
  5618. and defaults to "0".
  5619. @item s
  5620. Specify the saturation in the [-10,10] range. It accepts an expression and
  5621. defaults to "1".
  5622. @item H
  5623. Specify the hue angle as a number of radians. It accepts an
  5624. expression, and defaults to "0".
  5625. @item b
  5626. Specify the brightness in the [-10,10] range. It accepts an expression and
  5627. defaults to "0".
  5628. @end table
  5629. @option{h} and @option{H} are mutually exclusive, and can't be
  5630. specified at the same time.
  5631. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  5632. expressions containing the following constants:
  5633. @table @option
  5634. @item n
  5635. frame count of the input frame starting from 0
  5636. @item pts
  5637. presentation timestamp of the input frame expressed in time base units
  5638. @item r
  5639. frame rate of the input video, NAN if the input frame rate is unknown
  5640. @item t
  5641. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5642. @item tb
  5643. time base of the input video
  5644. @end table
  5645. @subsection Examples
  5646. @itemize
  5647. @item
  5648. Set the hue to 90 degrees and the saturation to 1.0:
  5649. @example
  5650. hue=h=90:s=1
  5651. @end example
  5652. @item
  5653. Same command but expressing the hue in radians:
  5654. @example
  5655. hue=H=PI/2:s=1
  5656. @end example
  5657. @item
  5658. Rotate hue and make the saturation swing between 0
  5659. and 2 over a period of 1 second:
  5660. @example
  5661. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  5662. @end example
  5663. @item
  5664. Apply a 3 seconds saturation fade-in effect starting at 0:
  5665. @example
  5666. hue="s=min(t/3\,1)"
  5667. @end example
  5668. The general fade-in expression can be written as:
  5669. @example
  5670. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  5671. @end example
  5672. @item
  5673. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  5674. @example
  5675. hue="s=max(0\, min(1\, (8-t)/3))"
  5676. @end example
  5677. The general fade-out expression can be written as:
  5678. @example
  5679. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  5680. @end example
  5681. @end itemize
  5682. @subsection Commands
  5683. This filter supports the following commands:
  5684. @table @option
  5685. @item b
  5686. @item s
  5687. @item h
  5688. @item H
  5689. Modify the hue and/or the saturation and/or brightness of the input video.
  5690. The command accepts the same syntax of the corresponding option.
  5691. If the specified expression is not valid, it is kept at its current
  5692. value.
  5693. @end table
  5694. @section idet
  5695. Detect video interlacing type.
  5696. This filter tries to detect if the input frames as interlaced, progressive,
  5697. top or bottom field first. It will also try and detect fields that are
  5698. repeated between adjacent frames (a sign of telecine).
  5699. Single frame detection considers only immediately adjacent frames when classifying each frame.
  5700. Multiple frame detection incorporates the classification history of previous frames.
  5701. The filter will log these metadata values:
  5702. @table @option
  5703. @item single.current_frame
  5704. Detected type of current frame using single-frame detection. One of:
  5705. ``tff'' (top field first), ``bff'' (bottom field first),
  5706. ``progressive'', or ``undetermined''
  5707. @item single.tff
  5708. Cumulative number of frames detected as top field first using single-frame detection.
  5709. @item multiple.tff
  5710. Cumulative number of frames detected as top field first using multiple-frame detection.
  5711. @item single.bff
  5712. Cumulative number of frames detected as bottom field first using single-frame detection.
  5713. @item multiple.current_frame
  5714. Detected type of current frame using multiple-frame detection. One of:
  5715. ``tff'' (top field first), ``bff'' (bottom field first),
  5716. ``progressive'', or ``undetermined''
  5717. @item multiple.bff
  5718. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  5719. @item single.progressive
  5720. Cumulative number of frames detected as progressive using single-frame detection.
  5721. @item multiple.progressive
  5722. Cumulative number of frames detected as progressive using multiple-frame detection.
  5723. @item single.undetermined
  5724. Cumulative number of frames that could not be classified using single-frame detection.
  5725. @item multiple.undetermined
  5726. Cumulative number of frames that could not be classified using multiple-frame detection.
  5727. @item repeated.current_frame
  5728. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  5729. @item repeated.neither
  5730. Cumulative number of frames with no repeated field.
  5731. @item repeated.top
  5732. Cumulative number of frames with the top field repeated from the previous frame's top field.
  5733. @item repeated.bottom
  5734. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  5735. @end table
  5736. The filter accepts the following options:
  5737. @table @option
  5738. @item intl_thres
  5739. Set interlacing threshold.
  5740. @item prog_thres
  5741. Set progressive threshold.
  5742. @item repeat_thres
  5743. Threshold for repeated field detection.
  5744. @item half_life
  5745. Number of frames after which a given frame's contribution to the
  5746. statistics is halved (i.e., it contributes only 0.5 to it's
  5747. classification). The default of 0 means that all frames seen are given
  5748. full weight of 1.0 forever.
  5749. @item analyze_interlaced_flag
  5750. When this is not 0 then idet will use the specified number of frames to determine
  5751. if the interlaced flag is accurate, it will not count undetermined frames.
  5752. If the flag is found to be accurate it will be used without any further
  5753. computations, if it is found to be inaccurate it will be cleared without any
  5754. further computations. This allows inserting the idet filter as a low computational
  5755. method to clean up the interlaced flag
  5756. @end table
  5757. @section il
  5758. Deinterleave or interleave fields.
  5759. This filter allows one to process interlaced images fields without
  5760. deinterlacing them. Deinterleaving splits the input frame into 2
  5761. fields (so called half pictures). Odd lines are moved to the top
  5762. half of the output image, even lines to the bottom half.
  5763. You can process (filter) them independently and then re-interleave them.
  5764. The filter accepts the following options:
  5765. @table @option
  5766. @item luma_mode, l
  5767. @item chroma_mode, c
  5768. @item alpha_mode, a
  5769. Available values for @var{luma_mode}, @var{chroma_mode} and
  5770. @var{alpha_mode} are:
  5771. @table @samp
  5772. @item none
  5773. Do nothing.
  5774. @item deinterleave, d
  5775. Deinterleave fields, placing one above the other.
  5776. @item interleave, i
  5777. Interleave fields. Reverse the effect of deinterleaving.
  5778. @end table
  5779. Default value is @code{none}.
  5780. @item luma_swap, ls
  5781. @item chroma_swap, cs
  5782. @item alpha_swap, as
  5783. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  5784. @end table
  5785. @section inflate
  5786. Apply inflate effect to the video.
  5787. This filter replaces the pixel by the local(3x3) average by taking into account
  5788. only values higher than the pixel.
  5789. It accepts the following options:
  5790. @table @option
  5791. @item threshold0
  5792. @item threshold1
  5793. @item threshold2
  5794. @item threshold3
  5795. Limit the maximum change for each plane, default is 65535.
  5796. If 0, plane will remain unchanged.
  5797. @end table
  5798. @section interlace
  5799. Simple interlacing filter from progressive contents. This interleaves upper (or
  5800. lower) lines from odd frames with lower (or upper) lines from even frames,
  5801. halving the frame rate and preserving image height.
  5802. @example
  5803. Original Original New Frame
  5804. Frame 'j' Frame 'j+1' (tff)
  5805. ========== =========== ==================
  5806. Line 0 --------------------> Frame 'j' Line 0
  5807. Line 1 Line 1 ----> Frame 'j+1' Line 1
  5808. Line 2 ---------------------> Frame 'j' Line 2
  5809. Line 3 Line 3 ----> Frame 'j+1' Line 3
  5810. ... ... ...
  5811. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  5812. @end example
  5813. It accepts the following optional parameters:
  5814. @table @option
  5815. @item scan
  5816. This determines whether the interlaced frame is taken from the even
  5817. (tff - default) or odd (bff) lines of the progressive frame.
  5818. @item lowpass
  5819. Enable (default) or disable the vertical lowpass filter to avoid twitter
  5820. interlacing and reduce moire patterns.
  5821. @end table
  5822. @section kerndeint
  5823. Deinterlace input video by applying Donald Graft's adaptive kernel
  5824. deinterling. Work on interlaced parts of a video to produce
  5825. progressive frames.
  5826. The description of the accepted parameters follows.
  5827. @table @option
  5828. @item thresh
  5829. Set the threshold which affects the filter's tolerance when
  5830. determining if a pixel line must be processed. It must be an integer
  5831. in the range [0,255] and defaults to 10. A value of 0 will result in
  5832. applying the process on every pixels.
  5833. @item map
  5834. Paint pixels exceeding the threshold value to white if set to 1.
  5835. Default is 0.
  5836. @item order
  5837. Set the fields order. Swap fields if set to 1, leave fields alone if
  5838. 0. Default is 0.
  5839. @item sharp
  5840. Enable additional sharpening if set to 1. Default is 0.
  5841. @item twoway
  5842. Enable twoway sharpening if set to 1. Default is 0.
  5843. @end table
  5844. @subsection Examples
  5845. @itemize
  5846. @item
  5847. Apply default values:
  5848. @example
  5849. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  5850. @end example
  5851. @item
  5852. Enable additional sharpening:
  5853. @example
  5854. kerndeint=sharp=1
  5855. @end example
  5856. @item
  5857. Paint processed pixels in white:
  5858. @example
  5859. kerndeint=map=1
  5860. @end example
  5861. @end itemize
  5862. @section lenscorrection
  5863. Correct radial lens distortion
  5864. This filter can be used to correct for radial distortion as can result from the use
  5865. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  5866. one can use tools available for example as part of opencv or simply trial-and-error.
  5867. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  5868. and extract the k1 and k2 coefficients from the resulting matrix.
  5869. Note that effectively the same filter is available in the open-source tools Krita and
  5870. Digikam from the KDE project.
  5871. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  5872. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  5873. brightness distribution, so you may want to use both filters together in certain
  5874. cases, though you will have to take care of ordering, i.e. whether vignetting should
  5875. be applied before or after lens correction.
  5876. @subsection Options
  5877. The filter accepts the following options:
  5878. @table @option
  5879. @item cx
  5880. Relative x-coordinate of the focal point of the image, and thereby the center of the
  5881. distortion. This value has a range [0,1] and is expressed as fractions of the image
  5882. width.
  5883. @item cy
  5884. Relative y-coordinate of the focal point of the image, and thereby the center of the
  5885. distortion. This value has a range [0,1] and is expressed as fractions of the image
  5886. height.
  5887. @item k1
  5888. Coefficient of the quadratic correction term. 0.5 means no correction.
  5889. @item k2
  5890. Coefficient of the double quadratic correction term. 0.5 means no correction.
  5891. @end table
  5892. The formula that generates the correction is:
  5893. @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)
  5894. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  5895. distances from the focal point in the source and target images, respectively.
  5896. @anchor{lut3d}
  5897. @section lut3d
  5898. Apply a 3D LUT to an input video.
  5899. The filter accepts the following options:
  5900. @table @option
  5901. @item file
  5902. Set the 3D LUT file name.
  5903. Currently supported formats:
  5904. @table @samp
  5905. @item 3dl
  5906. AfterEffects
  5907. @item cube
  5908. Iridas
  5909. @item dat
  5910. DaVinci
  5911. @item m3d
  5912. Pandora
  5913. @end table
  5914. @item interp
  5915. Select interpolation mode.
  5916. Available values are:
  5917. @table @samp
  5918. @item nearest
  5919. Use values from the nearest defined point.
  5920. @item trilinear
  5921. Interpolate values using the 8 points defining a cube.
  5922. @item tetrahedral
  5923. Interpolate values using a tetrahedron.
  5924. @end table
  5925. @end table
  5926. @section lut, lutrgb, lutyuv
  5927. Compute a look-up table for binding each pixel component input value
  5928. to an output value, and apply it to the input video.
  5929. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  5930. to an RGB input video.
  5931. These filters accept the following parameters:
  5932. @table @option
  5933. @item c0
  5934. set first pixel component expression
  5935. @item c1
  5936. set second pixel component expression
  5937. @item c2
  5938. set third pixel component expression
  5939. @item c3
  5940. set fourth pixel component expression, corresponds to the alpha component
  5941. @item r
  5942. set red component expression
  5943. @item g
  5944. set green component expression
  5945. @item b
  5946. set blue component expression
  5947. @item a
  5948. alpha component expression
  5949. @item y
  5950. set Y/luminance component expression
  5951. @item u
  5952. set U/Cb component expression
  5953. @item v
  5954. set V/Cr component expression
  5955. @end table
  5956. Each of them specifies the expression to use for computing the lookup table for
  5957. the corresponding pixel component values.
  5958. The exact component associated to each of the @var{c*} options depends on the
  5959. format in input.
  5960. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  5961. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  5962. The expressions can contain the following constants and functions:
  5963. @table @option
  5964. @item w
  5965. @item h
  5966. The input width and height.
  5967. @item val
  5968. The input value for the pixel component.
  5969. @item clipval
  5970. The input value, clipped to the @var{minval}-@var{maxval} range.
  5971. @item maxval
  5972. The maximum value for the pixel component.
  5973. @item minval
  5974. The minimum value for the pixel component.
  5975. @item negval
  5976. The negated value for the pixel component value, clipped to the
  5977. @var{minval}-@var{maxval} range; it corresponds to the expression
  5978. "maxval-clipval+minval".
  5979. @item clip(val)
  5980. The computed value in @var{val}, clipped to the
  5981. @var{minval}-@var{maxval} range.
  5982. @item gammaval(gamma)
  5983. The computed gamma correction value of the pixel component value,
  5984. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  5985. expression
  5986. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  5987. @end table
  5988. All expressions default to "val".
  5989. @subsection Examples
  5990. @itemize
  5991. @item
  5992. Negate input video:
  5993. @example
  5994. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  5995. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  5996. @end example
  5997. The above is the same as:
  5998. @example
  5999. lutrgb="r=negval:g=negval:b=negval"
  6000. lutyuv="y=negval:u=negval:v=negval"
  6001. @end example
  6002. @item
  6003. Negate luminance:
  6004. @example
  6005. lutyuv=y=negval
  6006. @end example
  6007. @item
  6008. Remove chroma components, turning the video into a graytone image:
  6009. @example
  6010. lutyuv="u=128:v=128"
  6011. @end example
  6012. @item
  6013. Apply a luma burning effect:
  6014. @example
  6015. lutyuv="y=2*val"
  6016. @end example
  6017. @item
  6018. Remove green and blue components:
  6019. @example
  6020. lutrgb="g=0:b=0"
  6021. @end example
  6022. @item
  6023. Set a constant alpha channel value on input:
  6024. @example
  6025. format=rgba,lutrgb=a="maxval-minval/2"
  6026. @end example
  6027. @item
  6028. Correct luminance gamma by a factor of 0.5:
  6029. @example
  6030. lutyuv=y=gammaval(0.5)
  6031. @end example
  6032. @item
  6033. Discard least significant bits of luma:
  6034. @example
  6035. lutyuv=y='bitand(val, 128+64+32)'
  6036. @end example
  6037. @end itemize
  6038. @section maskedmerge
  6039. Merge the first input stream with the second input stream using per pixel
  6040. weights in the third input stream.
  6041. A value of 0 in the third stream pixel component means that pixel component
  6042. from first stream is returned unchanged, while maximum value (eg. 255 for
  6043. 8-bit videos) means that pixel component from second stream is returned
  6044. unchanged. Intermediate values define the amount of merging between both
  6045. input stream's pixel components.
  6046. This filter accepts the following options:
  6047. @table @option
  6048. @item planes
  6049. Set which planes will be processed as bitmap, unprocessed planes will be
  6050. copied from first stream.
  6051. By default value 0xf, all planes will be processed.
  6052. @end table
  6053. @section mcdeint
  6054. Apply motion-compensation deinterlacing.
  6055. It needs one field per frame as input and must thus be used together
  6056. with yadif=1/3 or equivalent.
  6057. This filter accepts the following options:
  6058. @table @option
  6059. @item mode
  6060. Set the deinterlacing mode.
  6061. It accepts one of the following values:
  6062. @table @samp
  6063. @item fast
  6064. @item medium
  6065. @item slow
  6066. use iterative motion estimation
  6067. @item extra_slow
  6068. like @samp{slow}, but use multiple reference frames.
  6069. @end table
  6070. Default value is @samp{fast}.
  6071. @item parity
  6072. Set the picture field parity assumed for the input video. It must be
  6073. one of the following values:
  6074. @table @samp
  6075. @item 0, tff
  6076. assume top field first
  6077. @item 1, bff
  6078. assume bottom field first
  6079. @end table
  6080. Default value is @samp{bff}.
  6081. @item qp
  6082. Set per-block quantization parameter (QP) used by the internal
  6083. encoder.
  6084. Higher values should result in a smoother motion vector field but less
  6085. optimal individual vectors. Default value is 1.
  6086. @end table
  6087. @section mergeplanes
  6088. Merge color channel components from several video streams.
  6089. The filter accepts up to 4 input streams, and merge selected input
  6090. planes to the output video.
  6091. This filter accepts the following options:
  6092. @table @option
  6093. @item mapping
  6094. Set input to output plane mapping. Default is @code{0}.
  6095. The mappings is specified as a bitmap. It should be specified as a
  6096. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  6097. mapping for the first plane of the output stream. 'A' sets the number of
  6098. the input stream to use (from 0 to 3), and 'a' the plane number of the
  6099. corresponding input to use (from 0 to 3). The rest of the mappings is
  6100. similar, 'Bb' describes the mapping for the output stream second
  6101. plane, 'Cc' describes the mapping for the output stream third plane and
  6102. 'Dd' describes the mapping for the output stream fourth plane.
  6103. @item format
  6104. Set output pixel format. Default is @code{yuva444p}.
  6105. @end table
  6106. @subsection Examples
  6107. @itemize
  6108. @item
  6109. Merge three gray video streams of same width and height into single video stream:
  6110. @example
  6111. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  6112. @end example
  6113. @item
  6114. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  6115. @example
  6116. [a0][a1]mergeplanes=0x00010210:yuva444p
  6117. @end example
  6118. @item
  6119. Swap Y and A plane in yuva444p stream:
  6120. @example
  6121. format=yuva444p,mergeplanes=0x03010200:yuva444p
  6122. @end example
  6123. @item
  6124. Swap U and V plane in yuv420p stream:
  6125. @example
  6126. format=yuv420p,mergeplanes=0x000201:yuv420p
  6127. @end example
  6128. @item
  6129. Cast a rgb24 clip to yuv444p:
  6130. @example
  6131. format=rgb24,mergeplanes=0x000102:yuv444p
  6132. @end example
  6133. @end itemize
  6134. @section mpdecimate
  6135. Drop frames that do not differ greatly from the previous frame in
  6136. order to reduce frame rate.
  6137. The main use of this filter is for very-low-bitrate encoding
  6138. (e.g. streaming over dialup modem), but it could in theory be used for
  6139. fixing movies that were inverse-telecined incorrectly.
  6140. A description of the accepted options follows.
  6141. @table @option
  6142. @item max
  6143. Set the maximum number of consecutive frames which can be dropped (if
  6144. positive), or the minimum interval between dropped frames (if
  6145. negative). If the value is 0, the frame is dropped unregarding the
  6146. number of previous sequentially dropped frames.
  6147. Default value is 0.
  6148. @item hi
  6149. @item lo
  6150. @item frac
  6151. Set the dropping threshold values.
  6152. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  6153. represent actual pixel value differences, so a threshold of 64
  6154. corresponds to 1 unit of difference for each pixel, or the same spread
  6155. out differently over the block.
  6156. A frame is a candidate for dropping if no 8x8 blocks differ by more
  6157. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  6158. meaning the whole image) differ by more than a threshold of @option{lo}.
  6159. Default value for @option{hi} is 64*12, default value for @option{lo} is
  6160. 64*5, and default value for @option{frac} is 0.33.
  6161. @end table
  6162. @section negate
  6163. Negate input video.
  6164. It accepts an integer in input; if non-zero it negates the
  6165. alpha component (if available). The default value in input is 0.
  6166. @section noformat
  6167. Force libavfilter not to use any of the specified pixel formats for the
  6168. input to the next filter.
  6169. It accepts the following parameters:
  6170. @table @option
  6171. @item pix_fmts
  6172. A '|'-separated list of pixel format names, such as
  6173. apix_fmts=yuv420p|monow|rgb24".
  6174. @end table
  6175. @subsection Examples
  6176. @itemize
  6177. @item
  6178. Force libavfilter to use a format different from @var{yuv420p} for the
  6179. input to the vflip filter:
  6180. @example
  6181. noformat=pix_fmts=yuv420p,vflip
  6182. @end example
  6183. @item
  6184. Convert the input video to any of the formats not contained in the list:
  6185. @example
  6186. noformat=yuv420p|yuv444p|yuv410p
  6187. @end example
  6188. @end itemize
  6189. @section noise
  6190. Add noise on video input frame.
  6191. The filter accepts the following options:
  6192. @table @option
  6193. @item all_seed
  6194. @item c0_seed
  6195. @item c1_seed
  6196. @item c2_seed
  6197. @item c3_seed
  6198. Set noise seed for specific pixel component or all pixel components in case
  6199. of @var{all_seed}. Default value is @code{123457}.
  6200. @item all_strength, alls
  6201. @item c0_strength, c0s
  6202. @item c1_strength, c1s
  6203. @item c2_strength, c2s
  6204. @item c3_strength, c3s
  6205. Set noise strength for specific pixel component or all pixel components in case
  6206. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  6207. @item all_flags, allf
  6208. @item c0_flags, c0f
  6209. @item c1_flags, c1f
  6210. @item c2_flags, c2f
  6211. @item c3_flags, c3f
  6212. Set pixel component flags or set flags for all components if @var{all_flags}.
  6213. Available values for component flags are:
  6214. @table @samp
  6215. @item a
  6216. averaged temporal noise (smoother)
  6217. @item p
  6218. mix random noise with a (semi)regular pattern
  6219. @item t
  6220. temporal noise (noise pattern changes between frames)
  6221. @item u
  6222. uniform noise (gaussian otherwise)
  6223. @end table
  6224. @end table
  6225. @subsection Examples
  6226. Add temporal and uniform noise to input video:
  6227. @example
  6228. noise=alls=20:allf=t+u
  6229. @end example
  6230. @section null
  6231. Pass the video source unchanged to the output.
  6232. @section ocr
  6233. Optical Character Recognition
  6234. This filter uses Tesseract for optical character recognition.
  6235. It accepts the following options:
  6236. @table @option
  6237. @item datapath
  6238. Set datapath to tesseract data. Default is to use whatever was
  6239. set at installation.
  6240. @item language
  6241. Set language, default is "eng".
  6242. @item whitelist
  6243. Set character whitelist.
  6244. @item blacklist
  6245. Set character blacklist.
  6246. @end table
  6247. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  6248. @section ocv
  6249. Apply a video transform using libopencv.
  6250. To enable this filter, install the libopencv library and headers and
  6251. configure FFmpeg with @code{--enable-libopencv}.
  6252. It accepts the following parameters:
  6253. @table @option
  6254. @item filter_name
  6255. The name of the libopencv filter to apply.
  6256. @item filter_params
  6257. The parameters to pass to the libopencv filter. If not specified, the default
  6258. values are assumed.
  6259. @end table
  6260. Refer to the official libopencv documentation for more precise
  6261. information:
  6262. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  6263. Several libopencv filters are supported; see the following subsections.
  6264. @anchor{dilate}
  6265. @subsection dilate
  6266. Dilate an image by using a specific structuring element.
  6267. It corresponds to the libopencv function @code{cvDilate}.
  6268. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  6269. @var{struct_el} represents a structuring element, and has the syntax:
  6270. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  6271. @var{cols} and @var{rows} represent the number of columns and rows of
  6272. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  6273. point, and @var{shape} the shape for the structuring element. @var{shape}
  6274. must be "rect", "cross", "ellipse", or "custom".
  6275. If the value for @var{shape} is "custom", it must be followed by a
  6276. string of the form "=@var{filename}". The file with name
  6277. @var{filename} is assumed to represent a binary image, with each
  6278. printable character corresponding to a bright pixel. When a custom
  6279. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  6280. or columns and rows of the read file are assumed instead.
  6281. The default value for @var{struct_el} is "3x3+0x0/rect".
  6282. @var{nb_iterations} specifies the number of times the transform is
  6283. applied to the image, and defaults to 1.
  6284. Some examples:
  6285. @example
  6286. # Use the default values
  6287. ocv=dilate
  6288. # Dilate using a structuring element with a 5x5 cross, iterating two times
  6289. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  6290. # Read the shape from the file diamond.shape, iterating two times.
  6291. # The file diamond.shape may contain a pattern of characters like this
  6292. # *
  6293. # ***
  6294. # *****
  6295. # ***
  6296. # *
  6297. # The specified columns and rows are ignored
  6298. # but the anchor point coordinates are not
  6299. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  6300. @end example
  6301. @subsection erode
  6302. Erode an image by using a specific structuring element.
  6303. It corresponds to the libopencv function @code{cvErode}.
  6304. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  6305. with the same syntax and semantics as the @ref{dilate} filter.
  6306. @subsection smooth
  6307. Smooth the input video.
  6308. The filter takes the following parameters:
  6309. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  6310. @var{type} is the type of smooth filter to apply, and must be one of
  6311. the following values: "blur", "blur_no_scale", "median", "gaussian",
  6312. or "bilateral". The default value is "gaussian".
  6313. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  6314. depend on the smooth type. @var{param1} and
  6315. @var{param2} accept integer positive values or 0. @var{param3} and
  6316. @var{param4} accept floating point values.
  6317. The default value for @var{param1} is 3. The default value for the
  6318. other parameters is 0.
  6319. These parameters correspond to the parameters assigned to the
  6320. libopencv function @code{cvSmooth}.
  6321. @anchor{overlay}
  6322. @section overlay
  6323. Overlay one video on top of another.
  6324. It takes two inputs and has one output. The first input is the "main"
  6325. video on which the second input is overlaid.
  6326. It accepts the following parameters:
  6327. A description of the accepted options follows.
  6328. @table @option
  6329. @item x
  6330. @item y
  6331. Set the expression for the x and y coordinates of the overlaid video
  6332. on the main video. Default value is "0" for both expressions. In case
  6333. the expression is invalid, it is set to a huge value (meaning that the
  6334. overlay will not be displayed within the output visible area).
  6335. @item eof_action
  6336. The action to take when EOF is encountered on the secondary input; it accepts
  6337. one of the following values:
  6338. @table @option
  6339. @item repeat
  6340. Repeat the last frame (the default).
  6341. @item endall
  6342. End both streams.
  6343. @item pass
  6344. Pass the main input through.
  6345. @end table
  6346. @item eval
  6347. Set when the expressions for @option{x}, and @option{y} are evaluated.
  6348. It accepts the following values:
  6349. @table @samp
  6350. @item init
  6351. only evaluate expressions once during the filter initialization or
  6352. when a command is processed
  6353. @item frame
  6354. evaluate expressions for each incoming frame
  6355. @end table
  6356. Default value is @samp{frame}.
  6357. @item shortest
  6358. If set to 1, force the output to terminate when the shortest input
  6359. terminates. Default value is 0.
  6360. @item format
  6361. Set the format for the output video.
  6362. It accepts the following values:
  6363. @table @samp
  6364. @item yuv420
  6365. force YUV420 output
  6366. @item yuv422
  6367. force YUV422 output
  6368. @item yuv444
  6369. force YUV444 output
  6370. @item rgb
  6371. force RGB output
  6372. @end table
  6373. Default value is @samp{yuv420}.
  6374. @item rgb @emph{(deprecated)}
  6375. If set to 1, force the filter to accept inputs in the RGB
  6376. color space. Default value is 0. This option is deprecated, use
  6377. @option{format} instead.
  6378. @item repeatlast
  6379. If set to 1, force the filter to draw the last overlay frame over the
  6380. main input until the end of the stream. A value of 0 disables this
  6381. behavior. Default value is 1.
  6382. @end table
  6383. The @option{x}, and @option{y} expressions can contain the following
  6384. parameters.
  6385. @table @option
  6386. @item main_w, W
  6387. @item main_h, H
  6388. The main input width and height.
  6389. @item overlay_w, w
  6390. @item overlay_h, h
  6391. The overlay input width and height.
  6392. @item x
  6393. @item y
  6394. The computed values for @var{x} and @var{y}. They are evaluated for
  6395. each new frame.
  6396. @item hsub
  6397. @item vsub
  6398. horizontal and vertical chroma subsample values of the output
  6399. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  6400. @var{vsub} is 1.
  6401. @item n
  6402. the number of input frame, starting from 0
  6403. @item pos
  6404. the position in the file of the input frame, NAN if unknown
  6405. @item t
  6406. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  6407. @end table
  6408. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  6409. when evaluation is done @emph{per frame}, and will evaluate to NAN
  6410. when @option{eval} is set to @samp{init}.
  6411. Be aware that frames are taken from each input video in timestamp
  6412. order, hence, if their initial timestamps differ, it is a good idea
  6413. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  6414. have them begin in the same zero timestamp, as the example for
  6415. the @var{movie} filter does.
  6416. You can chain together more overlays but you should test the
  6417. efficiency of such approach.
  6418. @subsection Commands
  6419. This filter supports the following commands:
  6420. @table @option
  6421. @item x
  6422. @item y
  6423. Modify the x and y of the overlay input.
  6424. The command accepts the same syntax of the corresponding option.
  6425. If the specified expression is not valid, it is kept at its current
  6426. value.
  6427. @end table
  6428. @subsection Examples
  6429. @itemize
  6430. @item
  6431. Draw the overlay at 10 pixels from the bottom right corner of the main
  6432. video:
  6433. @example
  6434. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  6435. @end example
  6436. Using named options the example above becomes:
  6437. @example
  6438. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  6439. @end example
  6440. @item
  6441. Insert a transparent PNG logo in the bottom left corner of the input,
  6442. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  6443. @example
  6444. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  6445. @end example
  6446. @item
  6447. Insert 2 different transparent PNG logos (second logo on bottom
  6448. right corner) using the @command{ffmpeg} tool:
  6449. @example
  6450. 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
  6451. @end example
  6452. @item
  6453. Add a transparent color layer on top of the main video; @code{WxH}
  6454. must specify the size of the main input to the overlay filter:
  6455. @example
  6456. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  6457. @end example
  6458. @item
  6459. Play an original video and a filtered version (here with the deshake
  6460. filter) side by side using the @command{ffplay} tool:
  6461. @example
  6462. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  6463. @end example
  6464. The above command is the same as:
  6465. @example
  6466. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  6467. @end example
  6468. @item
  6469. Make a sliding overlay appearing from the left to the right top part of the
  6470. screen starting since time 2:
  6471. @example
  6472. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  6473. @end example
  6474. @item
  6475. Compose output by putting two input videos side to side:
  6476. @example
  6477. ffmpeg -i left.avi -i right.avi -filter_complex "
  6478. nullsrc=size=200x100 [background];
  6479. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  6480. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  6481. [background][left] overlay=shortest=1 [background+left];
  6482. [background+left][right] overlay=shortest=1:x=100 [left+right]
  6483. "
  6484. @end example
  6485. @item
  6486. Mask 10-20 seconds of a video by applying the delogo filter to a section
  6487. @example
  6488. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  6489. -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]'
  6490. masked.avi
  6491. @end example
  6492. @item
  6493. Chain several overlays in cascade:
  6494. @example
  6495. nullsrc=s=200x200 [bg];
  6496. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  6497. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  6498. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  6499. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  6500. [in3] null, [mid2] overlay=100:100 [out0]
  6501. @end example
  6502. @end itemize
  6503. @section owdenoise
  6504. Apply Overcomplete Wavelet denoiser.
  6505. The filter accepts the following options:
  6506. @table @option
  6507. @item depth
  6508. Set depth.
  6509. Larger depth values will denoise lower frequency components more, but
  6510. slow down filtering.
  6511. Must be an int in the range 8-16, default is @code{8}.
  6512. @item luma_strength, ls
  6513. Set luma strength.
  6514. Must be a double value in the range 0-1000, default is @code{1.0}.
  6515. @item chroma_strength, cs
  6516. Set chroma strength.
  6517. Must be a double value in the range 0-1000, default is @code{1.0}.
  6518. @end table
  6519. @anchor{pad}
  6520. @section pad
  6521. Add paddings to the input image, and place the original input at the
  6522. provided @var{x}, @var{y} coordinates.
  6523. It accepts the following parameters:
  6524. @table @option
  6525. @item width, w
  6526. @item height, h
  6527. Specify an expression for the size of the output image with the
  6528. paddings added. If the value for @var{width} or @var{height} is 0, the
  6529. corresponding input size is used for the output.
  6530. The @var{width} expression can reference the value set by the
  6531. @var{height} expression, and vice versa.
  6532. The default value of @var{width} and @var{height} is 0.
  6533. @item x
  6534. @item y
  6535. Specify the offsets to place the input image at within the padded area,
  6536. with respect to the top/left border of the output image.
  6537. The @var{x} expression can reference the value set by the @var{y}
  6538. expression, and vice versa.
  6539. The default value of @var{x} and @var{y} is 0.
  6540. @item color
  6541. Specify the color of the padded area. For the syntax of this option,
  6542. check the "Color" section in the ffmpeg-utils manual.
  6543. The default value of @var{color} is "black".
  6544. @end table
  6545. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  6546. options are expressions containing the following constants:
  6547. @table @option
  6548. @item in_w
  6549. @item in_h
  6550. The input video width and height.
  6551. @item iw
  6552. @item ih
  6553. These are the same as @var{in_w} and @var{in_h}.
  6554. @item out_w
  6555. @item out_h
  6556. The output width and height (the size of the padded area), as
  6557. specified by the @var{width} and @var{height} expressions.
  6558. @item ow
  6559. @item oh
  6560. These are the same as @var{out_w} and @var{out_h}.
  6561. @item x
  6562. @item y
  6563. The x and y offsets as specified by the @var{x} and @var{y}
  6564. expressions, or NAN if not yet specified.
  6565. @item a
  6566. same as @var{iw} / @var{ih}
  6567. @item sar
  6568. input sample aspect ratio
  6569. @item dar
  6570. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6571. @item hsub
  6572. @item vsub
  6573. The horizontal and vertical chroma subsample values. For example for the
  6574. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6575. @end table
  6576. @subsection Examples
  6577. @itemize
  6578. @item
  6579. Add paddings with the color "violet" to the input video. The output video
  6580. size is 640x480, and the top-left corner of the input video is placed at
  6581. column 0, row 40
  6582. @example
  6583. pad=640:480:0:40:violet
  6584. @end example
  6585. The example above is equivalent to the following command:
  6586. @example
  6587. pad=width=640:height=480:x=0:y=40:color=violet
  6588. @end example
  6589. @item
  6590. Pad the input to get an output with dimensions increased by 3/2,
  6591. and put the input video at the center of the padded area:
  6592. @example
  6593. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  6594. @end example
  6595. @item
  6596. Pad the input to get a squared output with size equal to the maximum
  6597. value between the input width and height, and put the input video at
  6598. the center of the padded area:
  6599. @example
  6600. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  6601. @end example
  6602. @item
  6603. Pad the input to get a final w/h ratio of 16:9:
  6604. @example
  6605. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  6606. @end example
  6607. @item
  6608. In case of anamorphic video, in order to set the output display aspect
  6609. correctly, it is necessary to use @var{sar} in the expression,
  6610. according to the relation:
  6611. @example
  6612. (ih * X / ih) * sar = output_dar
  6613. X = output_dar / sar
  6614. @end example
  6615. Thus the previous example needs to be modified to:
  6616. @example
  6617. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  6618. @end example
  6619. @item
  6620. Double the output size and put the input video in the bottom-right
  6621. corner of the output padded area:
  6622. @example
  6623. pad="2*iw:2*ih:ow-iw:oh-ih"
  6624. @end example
  6625. @end itemize
  6626. @anchor{palettegen}
  6627. @section palettegen
  6628. Generate one palette for a whole video stream.
  6629. It accepts the following options:
  6630. @table @option
  6631. @item max_colors
  6632. Set the maximum number of colors to quantize in the palette.
  6633. Note: the palette will still contain 256 colors; the unused palette entries
  6634. will be black.
  6635. @item reserve_transparent
  6636. Create a palette of 255 colors maximum and reserve the last one for
  6637. transparency. Reserving the transparency color is useful for GIF optimization.
  6638. If not set, the maximum of colors in the palette will be 256. You probably want
  6639. to disable this option for a standalone image.
  6640. Set by default.
  6641. @item stats_mode
  6642. Set statistics mode.
  6643. It accepts the following values:
  6644. @table @samp
  6645. @item full
  6646. Compute full frame histograms.
  6647. @item diff
  6648. Compute histograms only for the part that differs from previous frame. This
  6649. might be relevant to give more importance to the moving part of your input if
  6650. the background is static.
  6651. @end table
  6652. Default value is @var{full}.
  6653. @end table
  6654. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  6655. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  6656. color quantization of the palette. This information is also visible at
  6657. @var{info} logging level.
  6658. @subsection Examples
  6659. @itemize
  6660. @item
  6661. Generate a representative palette of a given video using @command{ffmpeg}:
  6662. @example
  6663. ffmpeg -i input.mkv -vf palettegen palette.png
  6664. @end example
  6665. @end itemize
  6666. @section paletteuse
  6667. Use a palette to downsample an input video stream.
  6668. The filter takes two inputs: one video stream and a palette. The palette must
  6669. be a 256 pixels image.
  6670. It accepts the following options:
  6671. @table @option
  6672. @item dither
  6673. Select dithering mode. Available algorithms are:
  6674. @table @samp
  6675. @item bayer
  6676. Ordered 8x8 bayer dithering (deterministic)
  6677. @item heckbert
  6678. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  6679. Note: this dithering is sometimes considered "wrong" and is included as a
  6680. reference.
  6681. @item floyd_steinberg
  6682. Floyd and Steingberg dithering (error diffusion)
  6683. @item sierra2
  6684. Frankie Sierra dithering v2 (error diffusion)
  6685. @item sierra2_4a
  6686. Frankie Sierra dithering v2 "Lite" (error diffusion)
  6687. @end table
  6688. Default is @var{sierra2_4a}.
  6689. @item bayer_scale
  6690. When @var{bayer} dithering is selected, this option defines the scale of the
  6691. pattern (how much the crosshatch pattern is visible). A low value means more
  6692. visible pattern for less banding, and higher value means less visible pattern
  6693. at the cost of more banding.
  6694. The option must be an integer value in the range [0,5]. Default is @var{2}.
  6695. @item diff_mode
  6696. If set, define the zone to process
  6697. @table @samp
  6698. @item rectangle
  6699. Only the changing rectangle will be reprocessed. This is similar to GIF
  6700. cropping/offsetting compression mechanism. This option can be useful for speed
  6701. if only a part of the image is changing, and has use cases such as limiting the
  6702. scope of the error diffusal @option{dither} to the rectangle that bounds the
  6703. moving scene (it leads to more deterministic output if the scene doesn't change
  6704. much, and as a result less moving noise and better GIF compression).
  6705. @end table
  6706. Default is @var{none}.
  6707. @end table
  6708. @subsection Examples
  6709. @itemize
  6710. @item
  6711. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  6712. using @command{ffmpeg}:
  6713. @example
  6714. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  6715. @end example
  6716. @end itemize
  6717. @section perspective
  6718. Correct perspective of video not recorded perpendicular to the screen.
  6719. A description of the accepted parameters follows.
  6720. @table @option
  6721. @item x0
  6722. @item y0
  6723. @item x1
  6724. @item y1
  6725. @item x2
  6726. @item y2
  6727. @item x3
  6728. @item y3
  6729. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  6730. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  6731. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  6732. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  6733. then the corners of the source will be sent to the specified coordinates.
  6734. The expressions can use the following variables:
  6735. @table @option
  6736. @item W
  6737. @item H
  6738. the width and height of video frame.
  6739. @end table
  6740. @item interpolation
  6741. Set interpolation for perspective correction.
  6742. It accepts the following values:
  6743. @table @samp
  6744. @item linear
  6745. @item cubic
  6746. @end table
  6747. Default value is @samp{linear}.
  6748. @item sense
  6749. Set interpretation of coordinate options.
  6750. It accepts the following values:
  6751. @table @samp
  6752. @item 0, source
  6753. Send point in the source specified by the given coordinates to
  6754. the corners of the destination.
  6755. @item 1, destination
  6756. Send the corners of the source to the point in the destination specified
  6757. by the given coordinates.
  6758. Default value is @samp{source}.
  6759. @end table
  6760. @end table
  6761. @section phase
  6762. Delay interlaced video by one field time so that the field order changes.
  6763. The intended use is to fix PAL movies that have been captured with the
  6764. opposite field order to the film-to-video transfer.
  6765. A description of the accepted parameters follows.
  6766. @table @option
  6767. @item mode
  6768. Set phase mode.
  6769. It accepts the following values:
  6770. @table @samp
  6771. @item t
  6772. Capture field order top-first, transfer bottom-first.
  6773. Filter will delay the bottom field.
  6774. @item b
  6775. Capture field order bottom-first, transfer top-first.
  6776. Filter will delay the top field.
  6777. @item p
  6778. Capture and transfer with the same field order. This mode only exists
  6779. for the documentation of the other options to refer to, but if you
  6780. actually select it, the filter will faithfully do nothing.
  6781. @item a
  6782. Capture field order determined automatically by field flags, transfer
  6783. opposite.
  6784. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  6785. basis using field flags. If no field information is available,
  6786. then this works just like @samp{u}.
  6787. @item u
  6788. Capture unknown or varying, transfer opposite.
  6789. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  6790. analyzing the images and selecting the alternative that produces best
  6791. match between the fields.
  6792. @item T
  6793. Capture top-first, transfer unknown or varying.
  6794. Filter selects among @samp{t} and @samp{p} using image analysis.
  6795. @item B
  6796. Capture bottom-first, transfer unknown or varying.
  6797. Filter selects among @samp{b} and @samp{p} using image analysis.
  6798. @item A
  6799. Capture determined by field flags, transfer unknown or varying.
  6800. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  6801. image analysis. If no field information is available, then this works just
  6802. like @samp{U}. This is the default mode.
  6803. @item U
  6804. Both capture and transfer unknown or varying.
  6805. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  6806. @end table
  6807. @end table
  6808. @section pixdesctest
  6809. Pixel format descriptor test filter, mainly useful for internal
  6810. testing. The output video should be equal to the input video.
  6811. For example:
  6812. @example
  6813. format=monow, pixdesctest
  6814. @end example
  6815. can be used to test the monowhite pixel format descriptor definition.
  6816. @section pp
  6817. Enable the specified chain of postprocessing subfilters using libpostproc. This
  6818. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  6819. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  6820. Each subfilter and some options have a short and a long name that can be used
  6821. interchangeably, i.e. dr/dering are the same.
  6822. The filters accept the following options:
  6823. @table @option
  6824. @item subfilters
  6825. Set postprocessing subfilters string.
  6826. @end table
  6827. All subfilters share common options to determine their scope:
  6828. @table @option
  6829. @item a/autoq
  6830. Honor the quality commands for this subfilter.
  6831. @item c/chrom
  6832. Do chrominance filtering, too (default).
  6833. @item y/nochrom
  6834. Do luminance filtering only (no chrominance).
  6835. @item n/noluma
  6836. Do chrominance filtering only (no luminance).
  6837. @end table
  6838. These options can be appended after the subfilter name, separated by a '|'.
  6839. Available subfilters are:
  6840. @table @option
  6841. @item hb/hdeblock[|difference[|flatness]]
  6842. Horizontal deblocking filter
  6843. @table @option
  6844. @item difference
  6845. Difference factor where higher values mean more deblocking (default: @code{32}).
  6846. @item flatness
  6847. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6848. @end table
  6849. @item vb/vdeblock[|difference[|flatness]]
  6850. Vertical deblocking filter
  6851. @table @option
  6852. @item difference
  6853. Difference factor where higher values mean more deblocking (default: @code{32}).
  6854. @item flatness
  6855. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6856. @end table
  6857. @item ha/hadeblock[|difference[|flatness]]
  6858. Accurate horizontal deblocking filter
  6859. @table @option
  6860. @item difference
  6861. Difference factor where higher values mean more deblocking (default: @code{32}).
  6862. @item flatness
  6863. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6864. @end table
  6865. @item va/vadeblock[|difference[|flatness]]
  6866. Accurate vertical deblocking filter
  6867. @table @option
  6868. @item difference
  6869. Difference factor where higher values mean more deblocking (default: @code{32}).
  6870. @item flatness
  6871. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6872. @end table
  6873. @end table
  6874. The horizontal and vertical deblocking filters share the difference and
  6875. flatness values so you cannot set different horizontal and vertical
  6876. thresholds.
  6877. @table @option
  6878. @item h1/x1hdeblock
  6879. Experimental horizontal deblocking filter
  6880. @item v1/x1vdeblock
  6881. Experimental vertical deblocking filter
  6882. @item dr/dering
  6883. Deringing filter
  6884. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  6885. @table @option
  6886. @item threshold1
  6887. larger -> stronger filtering
  6888. @item threshold2
  6889. larger -> stronger filtering
  6890. @item threshold3
  6891. larger -> stronger filtering
  6892. @end table
  6893. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  6894. @table @option
  6895. @item f/fullyrange
  6896. Stretch luminance to @code{0-255}.
  6897. @end table
  6898. @item lb/linblenddeint
  6899. Linear blend deinterlacing filter that deinterlaces the given block by
  6900. filtering all lines with a @code{(1 2 1)} filter.
  6901. @item li/linipoldeint
  6902. Linear interpolating deinterlacing filter that deinterlaces the given block by
  6903. linearly interpolating every second line.
  6904. @item ci/cubicipoldeint
  6905. Cubic interpolating deinterlacing filter deinterlaces the given block by
  6906. cubically interpolating every second line.
  6907. @item md/mediandeint
  6908. Median deinterlacing filter that deinterlaces the given block by applying a
  6909. median filter to every second line.
  6910. @item fd/ffmpegdeint
  6911. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  6912. second line with a @code{(-1 4 2 4 -1)} filter.
  6913. @item l5/lowpass5
  6914. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  6915. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  6916. @item fq/forceQuant[|quantizer]
  6917. Overrides the quantizer table from the input with the constant quantizer you
  6918. specify.
  6919. @table @option
  6920. @item quantizer
  6921. Quantizer to use
  6922. @end table
  6923. @item de/default
  6924. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  6925. @item fa/fast
  6926. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  6927. @item ac
  6928. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  6929. @end table
  6930. @subsection Examples
  6931. @itemize
  6932. @item
  6933. Apply horizontal and vertical deblocking, deringing and automatic
  6934. brightness/contrast:
  6935. @example
  6936. pp=hb/vb/dr/al
  6937. @end example
  6938. @item
  6939. Apply default filters without brightness/contrast correction:
  6940. @example
  6941. pp=de/-al
  6942. @end example
  6943. @item
  6944. Apply default filters and temporal denoiser:
  6945. @example
  6946. pp=default/tmpnoise|1|2|3
  6947. @end example
  6948. @item
  6949. Apply deblocking on luminance only, and switch vertical deblocking on or off
  6950. automatically depending on available CPU time:
  6951. @example
  6952. pp=hb|y/vb|a
  6953. @end example
  6954. @end itemize
  6955. @section pp7
  6956. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  6957. similar to spp = 6 with 7 point DCT, where only the center sample is
  6958. used after IDCT.
  6959. The filter accepts the following options:
  6960. @table @option
  6961. @item qp
  6962. Force a constant quantization parameter. It accepts an integer in range
  6963. 0 to 63. If not set, the filter will use the QP from the video stream
  6964. (if available).
  6965. @item mode
  6966. Set thresholding mode. Available modes are:
  6967. @table @samp
  6968. @item hard
  6969. Set hard thresholding.
  6970. @item soft
  6971. Set soft thresholding (better de-ringing effect, but likely blurrier).
  6972. @item medium
  6973. Set medium thresholding (good results, default).
  6974. @end table
  6975. @end table
  6976. @section psnr
  6977. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  6978. Ratio) between two input videos.
  6979. This filter takes in input two input videos, the first input is
  6980. considered the "main" source and is passed unchanged to the
  6981. output. The second input is used as a "reference" video for computing
  6982. the PSNR.
  6983. Both video inputs must have the same resolution and pixel format for
  6984. this filter to work correctly. Also it assumes that both inputs
  6985. have the same number of frames, which are compared one by one.
  6986. The obtained average PSNR is printed through the logging system.
  6987. The filter stores the accumulated MSE (mean squared error) of each
  6988. frame, and at the end of the processing it is averaged across all frames
  6989. equally, and the following formula is applied to obtain the PSNR:
  6990. @example
  6991. PSNR = 10*log10(MAX^2/MSE)
  6992. @end example
  6993. Where MAX is the average of the maximum values of each component of the
  6994. image.
  6995. The description of the accepted parameters follows.
  6996. @table @option
  6997. @item stats_file, f
  6998. If specified the filter will use the named file to save the PSNR of
  6999. each individual frame. When filename equals "-" the data is sent to
  7000. standard output.
  7001. @end table
  7002. The file printed if @var{stats_file} is selected, contains a sequence of
  7003. key/value pairs of the form @var{key}:@var{value} for each compared
  7004. couple of frames.
  7005. A description of each shown parameter follows:
  7006. @table @option
  7007. @item n
  7008. sequential number of the input frame, starting from 1
  7009. @item mse_avg
  7010. Mean Square Error pixel-by-pixel average difference of the compared
  7011. frames, averaged over all the image components.
  7012. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  7013. Mean Square Error pixel-by-pixel average difference of the compared
  7014. frames for the component specified by the suffix.
  7015. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  7016. Peak Signal to Noise ratio of the compared frames for the component
  7017. specified by the suffix.
  7018. @end table
  7019. For example:
  7020. @example
  7021. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7022. [main][ref] psnr="stats_file=stats.log" [out]
  7023. @end example
  7024. On this example the input file being processed is compared with the
  7025. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  7026. is stored in @file{stats.log}.
  7027. @anchor{pullup}
  7028. @section pullup
  7029. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  7030. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  7031. content.
  7032. The pullup filter is designed to take advantage of future context in making
  7033. its decisions. This filter is stateless in the sense that it does not lock
  7034. onto a pattern to follow, but it instead looks forward to the following
  7035. fields in order to identify matches and rebuild progressive frames.
  7036. To produce content with an even framerate, insert the fps filter after
  7037. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  7038. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  7039. The filter accepts the following options:
  7040. @table @option
  7041. @item jl
  7042. @item jr
  7043. @item jt
  7044. @item jb
  7045. These options set the amount of "junk" to ignore at the left, right, top, and
  7046. bottom of the image, respectively. Left and right are in units of 8 pixels,
  7047. while top and bottom are in units of 2 lines.
  7048. The default is 8 pixels on each side.
  7049. @item sb
  7050. Set the strict breaks. Setting this option to 1 will reduce the chances of
  7051. filter generating an occasional mismatched frame, but it may also cause an
  7052. excessive number of frames to be dropped during high motion sequences.
  7053. Conversely, setting it to -1 will make filter match fields more easily.
  7054. This may help processing of video where there is slight blurring between
  7055. the fields, but may also cause there to be interlaced frames in the output.
  7056. Default value is @code{0}.
  7057. @item mp
  7058. Set the metric plane to use. It accepts the following values:
  7059. @table @samp
  7060. @item l
  7061. Use luma plane.
  7062. @item u
  7063. Use chroma blue plane.
  7064. @item v
  7065. Use chroma red plane.
  7066. @end table
  7067. This option may be set to use chroma plane instead of the default luma plane
  7068. for doing filter's computations. This may improve accuracy on very clean
  7069. source material, but more likely will decrease accuracy, especially if there
  7070. is chroma noise (rainbow effect) or any grayscale video.
  7071. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  7072. load and make pullup usable in realtime on slow machines.
  7073. @end table
  7074. For best results (without duplicated frames in the output file) it is
  7075. necessary to change the output frame rate. For example, to inverse
  7076. telecine NTSC input:
  7077. @example
  7078. ffmpeg -i input -vf pullup -r 24000/1001 ...
  7079. @end example
  7080. @section qp
  7081. Change video quantization parameters (QP).
  7082. The filter accepts the following option:
  7083. @table @option
  7084. @item qp
  7085. Set expression for quantization parameter.
  7086. @end table
  7087. The expression is evaluated through the eval API and can contain, among others,
  7088. the following constants:
  7089. @table @var
  7090. @item known
  7091. 1 if index is not 129, 0 otherwise.
  7092. @item qp
  7093. Sequentional index starting from -129 to 128.
  7094. @end table
  7095. @subsection Examples
  7096. @itemize
  7097. @item
  7098. Some equation like:
  7099. @example
  7100. qp=2+2*sin(PI*qp)
  7101. @end example
  7102. @end itemize
  7103. @section random
  7104. Flush video frames from internal cache of frames into a random order.
  7105. No frame is discarded.
  7106. Inspired by @ref{frei0r} nervous filter.
  7107. @table @option
  7108. @item frames
  7109. Set size in number of frames of internal cache, in range from @code{2} to
  7110. @code{512}. Default is @code{30}.
  7111. @item seed
  7112. Set seed for random number generator, must be an integer included between
  7113. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  7114. less than @code{0}, the filter will try to use a good random seed on a
  7115. best effort basis.
  7116. @end table
  7117. @section removegrain
  7118. The removegrain filter is a spatial denoiser for progressive video.
  7119. @table @option
  7120. @item m0
  7121. Set mode for the first plane.
  7122. @item m1
  7123. Set mode for the second plane.
  7124. @item m2
  7125. Set mode for the third plane.
  7126. @item m3
  7127. Set mode for the fourth plane.
  7128. @end table
  7129. Range of mode is from 0 to 24. Description of each mode follows:
  7130. @table @var
  7131. @item 0
  7132. Leave input plane unchanged. Default.
  7133. @item 1
  7134. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  7135. @item 2
  7136. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  7137. @item 3
  7138. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  7139. @item 4
  7140. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  7141. This is equivalent to a median filter.
  7142. @item 5
  7143. Line-sensitive clipping giving the minimal change.
  7144. @item 6
  7145. Line-sensitive clipping, intermediate.
  7146. @item 7
  7147. Line-sensitive clipping, intermediate.
  7148. @item 8
  7149. Line-sensitive clipping, intermediate.
  7150. @item 9
  7151. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  7152. @item 10
  7153. Replaces the target pixel with the closest neighbour.
  7154. @item 11
  7155. [1 2 1] horizontal and vertical kernel blur.
  7156. @item 12
  7157. Same as mode 11.
  7158. @item 13
  7159. Bob mode, interpolates top field from the line where the neighbours
  7160. pixels are the closest.
  7161. @item 14
  7162. Bob mode, interpolates bottom field from the line where the neighbours
  7163. pixels are the closest.
  7164. @item 15
  7165. Bob mode, interpolates top field. Same as 13 but with a more complicated
  7166. interpolation formula.
  7167. @item 16
  7168. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  7169. interpolation formula.
  7170. @item 17
  7171. Clips the pixel with the minimum and maximum of respectively the maximum and
  7172. minimum of each pair of opposite neighbour pixels.
  7173. @item 18
  7174. Line-sensitive clipping using opposite neighbours whose greatest distance from
  7175. the current pixel is minimal.
  7176. @item 19
  7177. Replaces the pixel with the average of its 8 neighbours.
  7178. @item 20
  7179. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  7180. @item 21
  7181. Clips pixels using the averages of opposite neighbour.
  7182. @item 22
  7183. Same as mode 21 but simpler and faster.
  7184. @item 23
  7185. Small edge and halo removal, but reputed useless.
  7186. @item 24
  7187. Similar as 23.
  7188. @end table
  7189. @section removelogo
  7190. Suppress a TV station logo, using an image file to determine which
  7191. pixels comprise the logo. It works by filling in the pixels that
  7192. comprise the logo with neighboring pixels.
  7193. The filter accepts the following options:
  7194. @table @option
  7195. @item filename, f
  7196. Set the filter bitmap file, which can be any image format supported by
  7197. libavformat. The width and height of the image file must match those of the
  7198. video stream being processed.
  7199. @end table
  7200. Pixels in the provided bitmap image with a value of zero are not
  7201. considered part of the logo, non-zero pixels are considered part of
  7202. the logo. If you use white (255) for the logo and black (0) for the
  7203. rest, you will be safe. For making the filter bitmap, it is
  7204. recommended to take a screen capture of a black frame with the logo
  7205. visible, and then using a threshold filter followed by the erode
  7206. filter once or twice.
  7207. If needed, little splotches can be fixed manually. Remember that if
  7208. logo pixels are not covered, the filter quality will be much
  7209. reduced. Marking too many pixels as part of the logo does not hurt as
  7210. much, but it will increase the amount of blurring needed to cover over
  7211. the image and will destroy more information than necessary, and extra
  7212. pixels will slow things down on a large logo.
  7213. @section repeatfields
  7214. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  7215. fields based on its value.
  7216. @section reverse, areverse
  7217. Reverse a clip.
  7218. Warning: This filter requires memory to buffer the entire clip, so trimming
  7219. is suggested.
  7220. @subsection Examples
  7221. @itemize
  7222. @item
  7223. Take the first 5 seconds of a clip, and reverse it.
  7224. @example
  7225. trim=end=5,reverse
  7226. @end example
  7227. @end itemize
  7228. @section rotate
  7229. Rotate video by an arbitrary angle expressed in radians.
  7230. The filter accepts the following options:
  7231. A description of the optional parameters follows.
  7232. @table @option
  7233. @item angle, a
  7234. Set an expression for the angle by which to rotate the input video
  7235. clockwise, expressed as a number of radians. A negative value will
  7236. result in a counter-clockwise rotation. By default it is set to "0".
  7237. This expression is evaluated for each frame.
  7238. @item out_w, ow
  7239. Set the output width expression, default value is "iw".
  7240. This expression is evaluated just once during configuration.
  7241. @item out_h, oh
  7242. Set the output height expression, default value is "ih".
  7243. This expression is evaluated just once during configuration.
  7244. @item bilinear
  7245. Enable bilinear interpolation if set to 1, a value of 0 disables
  7246. it. Default value is 1.
  7247. @item fillcolor, c
  7248. Set the color used to fill the output area not covered by the rotated
  7249. image. For the general syntax of this option, check the "Color" section in the
  7250. ffmpeg-utils manual. If the special value "none" is selected then no
  7251. background is printed (useful for example if the background is never shown).
  7252. Default value is "black".
  7253. @end table
  7254. The expressions for the angle and the output size can contain the
  7255. following constants and functions:
  7256. @table @option
  7257. @item n
  7258. sequential number of the input frame, starting from 0. It is always NAN
  7259. before the first frame is filtered.
  7260. @item t
  7261. time in seconds of the input frame, it is set to 0 when the filter is
  7262. configured. It is always NAN before the first frame is filtered.
  7263. @item hsub
  7264. @item vsub
  7265. horizontal and vertical chroma subsample values. For example for the
  7266. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7267. @item in_w, iw
  7268. @item in_h, ih
  7269. the input video width and height
  7270. @item out_w, ow
  7271. @item out_h, oh
  7272. the output width and height, that is the size of the padded area as
  7273. specified by the @var{width} and @var{height} expressions
  7274. @item rotw(a)
  7275. @item roth(a)
  7276. the minimal width/height required for completely containing the input
  7277. video rotated by @var{a} radians.
  7278. These are only available when computing the @option{out_w} and
  7279. @option{out_h} expressions.
  7280. @end table
  7281. @subsection Examples
  7282. @itemize
  7283. @item
  7284. Rotate the input by PI/6 radians clockwise:
  7285. @example
  7286. rotate=PI/6
  7287. @end example
  7288. @item
  7289. Rotate the input by PI/6 radians counter-clockwise:
  7290. @example
  7291. rotate=-PI/6
  7292. @end example
  7293. @item
  7294. Rotate the input by 45 degrees clockwise:
  7295. @example
  7296. rotate=45*PI/180
  7297. @end example
  7298. @item
  7299. Apply a constant rotation with period T, starting from an angle of PI/3:
  7300. @example
  7301. rotate=PI/3+2*PI*t/T
  7302. @end example
  7303. @item
  7304. Make the input video rotation oscillating with a period of T
  7305. seconds and an amplitude of A radians:
  7306. @example
  7307. rotate=A*sin(2*PI/T*t)
  7308. @end example
  7309. @item
  7310. Rotate the video, output size is chosen so that the whole rotating
  7311. input video is always completely contained in the output:
  7312. @example
  7313. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  7314. @end example
  7315. @item
  7316. Rotate the video, reduce the output size so that no background is ever
  7317. shown:
  7318. @example
  7319. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  7320. @end example
  7321. @end itemize
  7322. @subsection Commands
  7323. The filter supports the following commands:
  7324. @table @option
  7325. @item a, angle
  7326. Set the angle expression.
  7327. The command accepts the same syntax of the corresponding option.
  7328. If the specified expression is not valid, it is kept at its current
  7329. value.
  7330. @end table
  7331. @section sab
  7332. Apply Shape Adaptive Blur.
  7333. The filter accepts the following options:
  7334. @table @option
  7335. @item luma_radius, lr
  7336. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  7337. value is 1.0. A greater value will result in a more blurred image, and
  7338. in slower processing.
  7339. @item luma_pre_filter_radius, lpfr
  7340. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  7341. value is 1.0.
  7342. @item luma_strength, ls
  7343. Set luma maximum difference between pixels to still be considered, must
  7344. be a value in the 0.1-100.0 range, default value is 1.0.
  7345. @item chroma_radius, cr
  7346. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  7347. greater value will result in a more blurred image, and in slower
  7348. processing.
  7349. @item chroma_pre_filter_radius, cpfr
  7350. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  7351. @item chroma_strength, cs
  7352. Set chroma maximum difference between pixels to still be considered,
  7353. must be a value in the 0.1-100.0 range.
  7354. @end table
  7355. Each chroma option value, if not explicitly specified, is set to the
  7356. corresponding luma option value.
  7357. @anchor{scale}
  7358. @section scale
  7359. Scale (resize) the input video, using the libswscale library.
  7360. The scale filter forces the output display aspect ratio to be the same
  7361. of the input, by changing the output sample aspect ratio.
  7362. If the input image format is different from the format requested by
  7363. the next filter, the scale filter will convert the input to the
  7364. requested format.
  7365. @subsection Options
  7366. The filter accepts the following options, or any of the options
  7367. supported by the libswscale scaler.
  7368. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  7369. the complete list of scaler options.
  7370. @table @option
  7371. @item width, w
  7372. @item height, h
  7373. Set the output video dimension expression. Default value is the input
  7374. dimension.
  7375. If the value is 0, the input width is used for the output.
  7376. If one of the values is -1, the scale filter will use a value that
  7377. maintains the aspect ratio of the input image, calculated from the
  7378. other specified dimension. If both of them are -1, the input size is
  7379. used
  7380. If one of the values is -n with n > 1, the scale filter will also use a value
  7381. that maintains the aspect ratio of the input image, calculated from the other
  7382. specified dimension. After that it will, however, make sure that the calculated
  7383. dimension is divisible by n and adjust the value if necessary.
  7384. See below for the list of accepted constants for use in the dimension
  7385. expression.
  7386. @item interl
  7387. Set the interlacing mode. It accepts the following values:
  7388. @table @samp
  7389. @item 1
  7390. Force interlaced aware scaling.
  7391. @item 0
  7392. Do not apply interlaced scaling.
  7393. @item -1
  7394. Select interlaced aware scaling depending on whether the source frames
  7395. are flagged as interlaced or not.
  7396. @end table
  7397. Default value is @samp{0}.
  7398. @item flags
  7399. Set libswscale scaling flags. See
  7400. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  7401. complete list of values. If not explicitly specified the filter applies
  7402. the default flags.
  7403. @item size, s
  7404. Set the video size. For the syntax of this option, check the
  7405. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7406. @item in_color_matrix
  7407. @item out_color_matrix
  7408. Set in/output YCbCr color space type.
  7409. This allows the autodetected value to be overridden as well as allows forcing
  7410. a specific value used for the output and encoder.
  7411. If not specified, the color space type depends on the pixel format.
  7412. Possible values:
  7413. @table @samp
  7414. @item auto
  7415. Choose automatically.
  7416. @item bt709
  7417. Format conforming to International Telecommunication Union (ITU)
  7418. Recommendation BT.709.
  7419. @item fcc
  7420. Set color space conforming to the United States Federal Communications
  7421. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  7422. @item bt601
  7423. Set color space conforming to:
  7424. @itemize
  7425. @item
  7426. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  7427. @item
  7428. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  7429. @item
  7430. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  7431. @end itemize
  7432. @item smpte240m
  7433. Set color space conforming to SMPTE ST 240:1999.
  7434. @end table
  7435. @item in_range
  7436. @item out_range
  7437. Set in/output YCbCr sample range.
  7438. This allows the autodetected value to be overridden as well as allows forcing
  7439. a specific value used for the output and encoder. If not specified, the
  7440. range depends on the pixel format. Possible values:
  7441. @table @samp
  7442. @item auto
  7443. Choose automatically.
  7444. @item jpeg/full/pc
  7445. Set full range (0-255 in case of 8-bit luma).
  7446. @item mpeg/tv
  7447. Set "MPEG" range (16-235 in case of 8-bit luma).
  7448. @end table
  7449. @item force_original_aspect_ratio
  7450. Enable decreasing or increasing output video width or height if necessary to
  7451. keep the original aspect ratio. Possible values:
  7452. @table @samp
  7453. @item disable
  7454. Scale the video as specified and disable this feature.
  7455. @item decrease
  7456. The output video dimensions will automatically be decreased if needed.
  7457. @item increase
  7458. The output video dimensions will automatically be increased if needed.
  7459. @end table
  7460. One useful instance of this option is that when you know a specific device's
  7461. maximum allowed resolution, you can use this to limit the output video to
  7462. that, while retaining the aspect ratio. For example, device A allows
  7463. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  7464. decrease) and specifying 1280x720 to the command line makes the output
  7465. 1280x533.
  7466. Please note that this is a different thing than specifying -1 for @option{w}
  7467. or @option{h}, you still need to specify the output resolution for this option
  7468. to work.
  7469. @end table
  7470. The values of the @option{w} and @option{h} options are expressions
  7471. containing the following constants:
  7472. @table @var
  7473. @item in_w
  7474. @item in_h
  7475. The input width and height
  7476. @item iw
  7477. @item ih
  7478. These are the same as @var{in_w} and @var{in_h}.
  7479. @item out_w
  7480. @item out_h
  7481. The output (scaled) width and height
  7482. @item ow
  7483. @item oh
  7484. These are the same as @var{out_w} and @var{out_h}
  7485. @item a
  7486. The same as @var{iw} / @var{ih}
  7487. @item sar
  7488. input sample aspect ratio
  7489. @item dar
  7490. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  7491. @item hsub
  7492. @item vsub
  7493. horizontal and vertical input chroma subsample values. For example for the
  7494. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7495. @item ohsub
  7496. @item ovsub
  7497. horizontal and vertical output chroma subsample values. For example for the
  7498. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7499. @end table
  7500. @subsection Examples
  7501. @itemize
  7502. @item
  7503. Scale the input video to a size of 200x100
  7504. @example
  7505. scale=w=200:h=100
  7506. @end example
  7507. This is equivalent to:
  7508. @example
  7509. scale=200:100
  7510. @end example
  7511. or:
  7512. @example
  7513. scale=200x100
  7514. @end example
  7515. @item
  7516. Specify a size abbreviation for the output size:
  7517. @example
  7518. scale=qcif
  7519. @end example
  7520. which can also be written as:
  7521. @example
  7522. scale=size=qcif
  7523. @end example
  7524. @item
  7525. Scale the input to 2x:
  7526. @example
  7527. scale=w=2*iw:h=2*ih
  7528. @end example
  7529. @item
  7530. The above is the same as:
  7531. @example
  7532. scale=2*in_w:2*in_h
  7533. @end example
  7534. @item
  7535. Scale the input to 2x with forced interlaced scaling:
  7536. @example
  7537. scale=2*iw:2*ih:interl=1
  7538. @end example
  7539. @item
  7540. Scale the input to half size:
  7541. @example
  7542. scale=w=iw/2:h=ih/2
  7543. @end example
  7544. @item
  7545. Increase the width, and set the height to the same size:
  7546. @example
  7547. scale=3/2*iw:ow
  7548. @end example
  7549. @item
  7550. Seek Greek harmony:
  7551. @example
  7552. scale=iw:1/PHI*iw
  7553. scale=ih*PHI:ih
  7554. @end example
  7555. @item
  7556. Increase the height, and set the width to 3/2 of the height:
  7557. @example
  7558. scale=w=3/2*oh:h=3/5*ih
  7559. @end example
  7560. @item
  7561. Increase the size, making the size a multiple of the chroma
  7562. subsample values:
  7563. @example
  7564. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  7565. @end example
  7566. @item
  7567. Increase the width to a maximum of 500 pixels,
  7568. keeping the same aspect ratio as the input:
  7569. @example
  7570. scale=w='min(500\, iw*3/2):h=-1'
  7571. @end example
  7572. @end itemize
  7573. @subsection Commands
  7574. This filter supports the following commands:
  7575. @table @option
  7576. @item width, w
  7577. @item height, h
  7578. Set the output video dimension expression.
  7579. The command accepts the same syntax of the corresponding option.
  7580. If the specified expression is not valid, it is kept at its current
  7581. value.
  7582. @end table
  7583. @section scale2ref
  7584. Scale (resize) the input video, based on a reference video.
  7585. See the scale filter for available options, scale2ref supports the same but
  7586. uses the reference video instead of the main input as basis.
  7587. @subsection Examples
  7588. @itemize
  7589. @item
  7590. Scale a subtitle stream to match the main video in size before overlaying
  7591. @example
  7592. 'scale2ref[b][a];[a][b]overlay'
  7593. @end example
  7594. @end itemize
  7595. @section separatefields
  7596. The @code{separatefields} takes a frame-based video input and splits
  7597. each frame into its components fields, producing a new half height clip
  7598. with twice the frame rate and twice the frame count.
  7599. This filter use field-dominance information in frame to decide which
  7600. of each pair of fields to place first in the output.
  7601. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  7602. @section setdar, setsar
  7603. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  7604. output video.
  7605. This is done by changing the specified Sample (aka Pixel) Aspect
  7606. Ratio, according to the following equation:
  7607. @example
  7608. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  7609. @end example
  7610. Keep in mind that the @code{setdar} filter does not modify the pixel
  7611. dimensions of the video frame. Also, the display aspect ratio set by
  7612. this filter may be changed by later filters in the filterchain,
  7613. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  7614. applied.
  7615. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  7616. the filter output video.
  7617. Note that as a consequence of the application of this filter, the
  7618. output display aspect ratio will change according to the equation
  7619. above.
  7620. Keep in mind that the sample aspect ratio set by the @code{setsar}
  7621. filter may be changed by later filters in the filterchain, e.g. if
  7622. another "setsar" or a "setdar" filter is applied.
  7623. It accepts the following parameters:
  7624. @table @option
  7625. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  7626. Set the aspect ratio used by the filter.
  7627. The parameter can be a floating point number string, an expression, or
  7628. a string of the form @var{num}:@var{den}, where @var{num} and
  7629. @var{den} are the numerator and denominator of the aspect ratio. If
  7630. the parameter is not specified, it is assumed the value "0".
  7631. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  7632. should be escaped.
  7633. @item max
  7634. Set the maximum integer value to use for expressing numerator and
  7635. denominator when reducing the expressed aspect ratio to a rational.
  7636. Default value is @code{100}.
  7637. @end table
  7638. The parameter @var{sar} is an expression containing
  7639. the following constants:
  7640. @table @option
  7641. @item E, PI, PHI
  7642. These are approximated values for the mathematical constants e
  7643. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  7644. @item w, h
  7645. The input width and height.
  7646. @item a
  7647. These are the same as @var{w} / @var{h}.
  7648. @item sar
  7649. The input sample aspect ratio.
  7650. @item dar
  7651. The input display aspect ratio. It is the same as
  7652. (@var{w} / @var{h}) * @var{sar}.
  7653. @item hsub, vsub
  7654. Horizontal and vertical chroma subsample values. For example, for the
  7655. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7656. @end table
  7657. @subsection Examples
  7658. @itemize
  7659. @item
  7660. To change the display aspect ratio to 16:9, specify one of the following:
  7661. @example
  7662. setdar=dar=1.77777
  7663. setdar=dar=16/9
  7664. setdar=dar=1.77777
  7665. @end example
  7666. @item
  7667. To change the sample aspect ratio to 10:11, specify:
  7668. @example
  7669. setsar=sar=10/11
  7670. @end example
  7671. @item
  7672. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  7673. 1000 in the aspect ratio reduction, use the command:
  7674. @example
  7675. setdar=ratio=16/9:max=1000
  7676. @end example
  7677. @end itemize
  7678. @anchor{setfield}
  7679. @section setfield
  7680. Force field for the output video frame.
  7681. The @code{setfield} filter marks the interlace type field for the
  7682. output frames. It does not change the input frame, but only sets the
  7683. corresponding property, which affects how the frame is treated by
  7684. following filters (e.g. @code{fieldorder} or @code{yadif}).
  7685. The filter accepts the following options:
  7686. @table @option
  7687. @item mode
  7688. Available values are:
  7689. @table @samp
  7690. @item auto
  7691. Keep the same field property.
  7692. @item bff
  7693. Mark the frame as bottom-field-first.
  7694. @item tff
  7695. Mark the frame as top-field-first.
  7696. @item prog
  7697. Mark the frame as progressive.
  7698. @end table
  7699. @end table
  7700. @section showinfo
  7701. Show a line containing various information for each input video frame.
  7702. The input video is not modified.
  7703. The shown line contains a sequence of key/value pairs of the form
  7704. @var{key}:@var{value}.
  7705. The following values are shown in the output:
  7706. @table @option
  7707. @item n
  7708. The (sequential) number of the input frame, starting from 0.
  7709. @item pts
  7710. The Presentation TimeStamp of the input frame, expressed as a number of
  7711. time base units. The time base unit depends on the filter input pad.
  7712. @item pts_time
  7713. The Presentation TimeStamp of the input frame, expressed as a number of
  7714. seconds.
  7715. @item pos
  7716. The position of the frame in the input stream, or -1 if this information is
  7717. unavailable and/or meaningless (for example in case of synthetic video).
  7718. @item fmt
  7719. The pixel format name.
  7720. @item sar
  7721. The sample aspect ratio of the input frame, expressed in the form
  7722. @var{num}/@var{den}.
  7723. @item s
  7724. The size of the input frame. For the syntax of this option, check the
  7725. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7726. @item i
  7727. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  7728. for bottom field first).
  7729. @item iskey
  7730. This is 1 if the frame is a key frame, 0 otherwise.
  7731. @item type
  7732. The picture type of the input frame ("I" for an I-frame, "P" for a
  7733. P-frame, "B" for a B-frame, or "?" for an unknown type).
  7734. Also refer to the documentation of the @code{AVPictureType} enum and of
  7735. the @code{av_get_picture_type_char} function defined in
  7736. @file{libavutil/avutil.h}.
  7737. @item checksum
  7738. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  7739. @item plane_checksum
  7740. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  7741. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  7742. @end table
  7743. @section showpalette
  7744. Displays the 256 colors palette of each frame. This filter is only relevant for
  7745. @var{pal8} pixel format frames.
  7746. It accepts the following option:
  7747. @table @option
  7748. @item s
  7749. Set the size of the box used to represent one palette color entry. Default is
  7750. @code{30} (for a @code{30x30} pixel box).
  7751. @end table
  7752. @section shuffleframes
  7753. Reorder and/or duplicate video frames.
  7754. It accepts the following parameters:
  7755. @table @option
  7756. @item mapping
  7757. Set the destination indexes of input frames.
  7758. This is space or '|' separated list of indexes that maps input frames to output
  7759. frames. Number of indexes also sets maximal value that each index may have.
  7760. @end table
  7761. The first frame has the index 0. The default is to keep the input unchanged.
  7762. Swap second and third frame of every three frames of the input:
  7763. @example
  7764. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  7765. @end example
  7766. @section shuffleplanes
  7767. Reorder and/or duplicate video planes.
  7768. It accepts the following parameters:
  7769. @table @option
  7770. @item map0
  7771. The index of the input plane to be used as the first output plane.
  7772. @item map1
  7773. The index of the input plane to be used as the second output plane.
  7774. @item map2
  7775. The index of the input plane to be used as the third output plane.
  7776. @item map3
  7777. The index of the input plane to be used as the fourth output plane.
  7778. @end table
  7779. The first plane has the index 0. The default is to keep the input unchanged.
  7780. Swap the second and third planes of the input:
  7781. @example
  7782. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  7783. @end example
  7784. @anchor{signalstats}
  7785. @section signalstats
  7786. Evaluate various visual metrics that assist in determining issues associated
  7787. with the digitization of analog video media.
  7788. By default the filter will log these metadata values:
  7789. @table @option
  7790. @item YMIN
  7791. Display the minimal Y value contained within the input frame. Expressed in
  7792. range of [0-255].
  7793. @item YLOW
  7794. Display the Y value at the 10% percentile within the input frame. Expressed in
  7795. range of [0-255].
  7796. @item YAVG
  7797. Display the average Y value within the input frame. Expressed in range of
  7798. [0-255].
  7799. @item YHIGH
  7800. Display the Y value at the 90% percentile within the input frame. Expressed in
  7801. range of [0-255].
  7802. @item YMAX
  7803. Display the maximum Y value contained within the input frame. Expressed in
  7804. range of [0-255].
  7805. @item UMIN
  7806. Display the minimal U value contained within the input frame. Expressed in
  7807. range of [0-255].
  7808. @item ULOW
  7809. Display the U value at the 10% percentile within the input frame. Expressed in
  7810. range of [0-255].
  7811. @item UAVG
  7812. Display the average U value within the input frame. Expressed in range of
  7813. [0-255].
  7814. @item UHIGH
  7815. Display the U value at the 90% percentile within the input frame. Expressed in
  7816. range of [0-255].
  7817. @item UMAX
  7818. Display the maximum U value contained within the input frame. Expressed in
  7819. range of [0-255].
  7820. @item VMIN
  7821. Display the minimal V value contained within the input frame. Expressed in
  7822. range of [0-255].
  7823. @item VLOW
  7824. Display the V value at the 10% percentile within the input frame. Expressed in
  7825. range of [0-255].
  7826. @item VAVG
  7827. Display the average V value within the input frame. Expressed in range of
  7828. [0-255].
  7829. @item VHIGH
  7830. Display the V value at the 90% percentile within the input frame. Expressed in
  7831. range of [0-255].
  7832. @item VMAX
  7833. Display the maximum V value contained within the input frame. Expressed in
  7834. range of [0-255].
  7835. @item SATMIN
  7836. Display the minimal saturation value contained within the input frame.
  7837. Expressed in range of [0-~181.02].
  7838. @item SATLOW
  7839. Display the saturation value at the 10% percentile within the input frame.
  7840. Expressed in range of [0-~181.02].
  7841. @item SATAVG
  7842. Display the average saturation value within the input frame. Expressed in range
  7843. of [0-~181.02].
  7844. @item SATHIGH
  7845. Display the saturation value at the 90% percentile within the input frame.
  7846. Expressed in range of [0-~181.02].
  7847. @item SATMAX
  7848. Display the maximum saturation value contained within the input frame.
  7849. Expressed in range of [0-~181.02].
  7850. @item HUEMED
  7851. Display the median value for hue within the input frame. Expressed in range of
  7852. [0-360].
  7853. @item HUEAVG
  7854. Display the average value for hue within the input frame. Expressed in range of
  7855. [0-360].
  7856. @item YDIF
  7857. Display the average of sample value difference between all values of the Y
  7858. plane in the current frame and corresponding values of the previous input frame.
  7859. Expressed in range of [0-255].
  7860. @item UDIF
  7861. Display the average of sample value difference between all values of the U
  7862. plane in the current frame and corresponding values of the previous input frame.
  7863. Expressed in range of [0-255].
  7864. @item VDIF
  7865. Display the average of sample value difference between all values of the V
  7866. plane in the current frame and corresponding values of the previous input frame.
  7867. Expressed in range of [0-255].
  7868. @end table
  7869. The filter accepts the following options:
  7870. @table @option
  7871. @item stat
  7872. @item out
  7873. @option{stat} specify an additional form of image analysis.
  7874. @option{out} output video with the specified type of pixel highlighted.
  7875. Both options accept the following values:
  7876. @table @samp
  7877. @item tout
  7878. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  7879. unlike the neighboring pixels of the same field. Examples of temporal outliers
  7880. include the results of video dropouts, head clogs, or tape tracking issues.
  7881. @item vrep
  7882. Identify @var{vertical line repetition}. Vertical line repetition includes
  7883. similar rows of pixels within a frame. In born-digital video vertical line
  7884. repetition is common, but this pattern is uncommon in video digitized from an
  7885. analog source. When it occurs in video that results from the digitization of an
  7886. analog source it can indicate concealment from a dropout compensator.
  7887. @item brng
  7888. Identify pixels that fall outside of legal broadcast range.
  7889. @end table
  7890. @item color, c
  7891. Set the highlight color for the @option{out} option. The default color is
  7892. yellow.
  7893. @end table
  7894. @subsection Examples
  7895. @itemize
  7896. @item
  7897. Output data of various video metrics:
  7898. @example
  7899. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  7900. @end example
  7901. @item
  7902. Output specific data about the minimum and maximum values of the Y plane per frame:
  7903. @example
  7904. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  7905. @end example
  7906. @item
  7907. Playback video while highlighting pixels that are outside of broadcast range in red.
  7908. @example
  7909. ffplay example.mov -vf signalstats="out=brng:color=red"
  7910. @end example
  7911. @item
  7912. Playback video with signalstats metadata drawn over the frame.
  7913. @example
  7914. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  7915. @end example
  7916. The contents of signalstat_drawtext.txt used in the command are:
  7917. @example
  7918. time %@{pts:hms@}
  7919. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  7920. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  7921. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  7922. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  7923. @end example
  7924. @end itemize
  7925. @anchor{smartblur}
  7926. @section smartblur
  7927. Blur the input video without impacting the outlines.
  7928. It accepts the following options:
  7929. @table @option
  7930. @item luma_radius, lr
  7931. Set the luma radius. The option value must be a float number in
  7932. the range [0.1,5.0] that specifies the variance of the gaussian filter
  7933. used to blur the image (slower if larger). Default value is 1.0.
  7934. @item luma_strength, ls
  7935. Set the luma strength. The option value must be a float number
  7936. in the range [-1.0,1.0] that configures the blurring. A value included
  7937. in [0.0,1.0] will blur the image whereas a value included in
  7938. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  7939. @item luma_threshold, lt
  7940. Set the luma threshold used as a coefficient to determine
  7941. whether a pixel should be blurred or not. The option value must be an
  7942. integer in the range [-30,30]. A value of 0 will filter all the image,
  7943. a value included in [0,30] will filter flat areas and a value included
  7944. in [-30,0] will filter edges. Default value is 0.
  7945. @item chroma_radius, cr
  7946. Set the chroma radius. The option value must be a float number in
  7947. the range [0.1,5.0] that specifies the variance of the gaussian filter
  7948. used to blur the image (slower if larger). Default value is 1.0.
  7949. @item chroma_strength, cs
  7950. Set the chroma strength. The option value must be a float number
  7951. in the range [-1.0,1.0] that configures the blurring. A value included
  7952. in [0.0,1.0] will blur the image whereas a value included in
  7953. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  7954. @item chroma_threshold, ct
  7955. Set the chroma threshold used as a coefficient to determine
  7956. whether a pixel should be blurred or not. The option value must be an
  7957. integer in the range [-30,30]. A value of 0 will filter all the image,
  7958. a value included in [0,30] will filter flat areas and a value included
  7959. in [-30,0] will filter edges. Default value is 0.
  7960. @end table
  7961. If a chroma option is not explicitly set, the corresponding luma value
  7962. is set.
  7963. @section ssim
  7964. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  7965. This filter takes in input two input videos, the first input is
  7966. considered the "main" source and is passed unchanged to the
  7967. output. The second input is used as a "reference" video for computing
  7968. the SSIM.
  7969. Both video inputs must have the same resolution and pixel format for
  7970. this filter to work correctly. Also it assumes that both inputs
  7971. have the same number of frames, which are compared one by one.
  7972. The filter stores the calculated SSIM of each frame.
  7973. The description of the accepted parameters follows.
  7974. @table @option
  7975. @item stats_file, f
  7976. If specified the filter will use the named file to save the SSIM of
  7977. each individual frame. When filename equals "-" the data is sent to
  7978. standard output.
  7979. @end table
  7980. The file printed if @var{stats_file} is selected, contains a sequence of
  7981. key/value pairs of the form @var{key}:@var{value} for each compared
  7982. couple of frames.
  7983. A description of each shown parameter follows:
  7984. @table @option
  7985. @item n
  7986. sequential number of the input frame, starting from 1
  7987. @item Y, U, V, R, G, B
  7988. SSIM of the compared frames for the component specified by the suffix.
  7989. @item All
  7990. SSIM of the compared frames for the whole frame.
  7991. @item dB
  7992. Same as above but in dB representation.
  7993. @end table
  7994. For example:
  7995. @example
  7996. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7997. [main][ref] ssim="stats_file=stats.log" [out]
  7998. @end example
  7999. On this example the input file being processed is compared with the
  8000. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  8001. is stored in @file{stats.log}.
  8002. Another example with both psnr and ssim at same time:
  8003. @example
  8004. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  8005. @end example
  8006. @section stereo3d
  8007. Convert between different stereoscopic image formats.
  8008. The filters accept the following options:
  8009. @table @option
  8010. @item in
  8011. Set stereoscopic image format of input.
  8012. Available values for input image formats are:
  8013. @table @samp
  8014. @item sbsl
  8015. side by side parallel (left eye left, right eye right)
  8016. @item sbsr
  8017. side by side crosseye (right eye left, left eye right)
  8018. @item sbs2l
  8019. side by side parallel with half width resolution
  8020. (left eye left, right eye right)
  8021. @item sbs2r
  8022. side by side crosseye with half width resolution
  8023. (right eye left, left eye right)
  8024. @item abl
  8025. above-below (left eye above, right eye below)
  8026. @item abr
  8027. above-below (right eye above, left eye below)
  8028. @item ab2l
  8029. above-below with half height resolution
  8030. (left eye above, right eye below)
  8031. @item ab2r
  8032. above-below with half height resolution
  8033. (right eye above, left eye below)
  8034. @item al
  8035. alternating frames (left eye first, right eye second)
  8036. @item ar
  8037. alternating frames (right eye first, left eye second)
  8038. @item irl
  8039. interleaved rows (left eye has top row, right eye starts on next row)
  8040. @item irr
  8041. interleaved rows (right eye has top row, left eye starts on next row)
  8042. Default value is @samp{sbsl}.
  8043. @end table
  8044. @item out
  8045. Set stereoscopic image format of output.
  8046. Available values for output image formats are all the input formats as well as:
  8047. @table @samp
  8048. @item arbg
  8049. anaglyph red/blue gray
  8050. (red filter on left eye, blue filter on right eye)
  8051. @item argg
  8052. anaglyph red/green gray
  8053. (red filter on left eye, green filter on right eye)
  8054. @item arcg
  8055. anaglyph red/cyan gray
  8056. (red filter on left eye, cyan filter on right eye)
  8057. @item arch
  8058. anaglyph red/cyan half colored
  8059. (red filter on left eye, cyan filter on right eye)
  8060. @item arcc
  8061. anaglyph red/cyan color
  8062. (red filter on left eye, cyan filter on right eye)
  8063. @item arcd
  8064. anaglyph red/cyan color optimized with the least squares projection of dubois
  8065. (red filter on left eye, cyan filter on right eye)
  8066. @item agmg
  8067. anaglyph green/magenta gray
  8068. (green filter on left eye, magenta filter on right eye)
  8069. @item agmh
  8070. anaglyph green/magenta half colored
  8071. (green filter on left eye, magenta filter on right eye)
  8072. @item agmc
  8073. anaglyph green/magenta colored
  8074. (green filter on left eye, magenta filter on right eye)
  8075. @item agmd
  8076. anaglyph green/magenta color optimized with the least squares projection of dubois
  8077. (green filter on left eye, magenta filter on right eye)
  8078. @item aybg
  8079. anaglyph yellow/blue gray
  8080. (yellow filter on left eye, blue filter on right eye)
  8081. @item aybh
  8082. anaglyph yellow/blue half colored
  8083. (yellow filter on left eye, blue filter on right eye)
  8084. @item aybc
  8085. anaglyph yellow/blue colored
  8086. (yellow filter on left eye, blue filter on right eye)
  8087. @item aybd
  8088. anaglyph yellow/blue color optimized with the least squares projection of dubois
  8089. (yellow filter on left eye, blue filter on right eye)
  8090. @item ml
  8091. mono output (left eye only)
  8092. @item mr
  8093. mono output (right eye only)
  8094. @item chl
  8095. checkerboard, left eye first
  8096. @item chr
  8097. checkerboard, right eye first
  8098. @item icl
  8099. interleaved columns, left eye first
  8100. @item icr
  8101. interleaved columns, right eye first
  8102. @end table
  8103. Default value is @samp{arcd}.
  8104. @end table
  8105. @subsection Examples
  8106. @itemize
  8107. @item
  8108. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  8109. @example
  8110. stereo3d=sbsl:aybd
  8111. @end example
  8112. @item
  8113. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  8114. @example
  8115. stereo3d=abl:sbsr
  8116. @end example
  8117. @end itemize
  8118. @anchor{spp}
  8119. @section spp
  8120. Apply a simple postprocessing filter that compresses and decompresses the image
  8121. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  8122. and average the results.
  8123. The filter accepts the following options:
  8124. @table @option
  8125. @item quality
  8126. Set quality. This option defines the number of levels for averaging. It accepts
  8127. an integer in the range 0-6. If set to @code{0}, the filter will have no
  8128. effect. A value of @code{6} means the higher quality. For each increment of
  8129. that value the speed drops by a factor of approximately 2. Default value is
  8130. @code{3}.
  8131. @item qp
  8132. Force a constant quantization parameter. If not set, the filter will use the QP
  8133. from the video stream (if available).
  8134. @item mode
  8135. Set thresholding mode. Available modes are:
  8136. @table @samp
  8137. @item hard
  8138. Set hard thresholding (default).
  8139. @item soft
  8140. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8141. @end table
  8142. @item use_bframe_qp
  8143. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8144. option may cause flicker since the B-Frames have often larger QP. Default is
  8145. @code{0} (not enabled).
  8146. @end table
  8147. @anchor{subtitles}
  8148. @section subtitles
  8149. Draw subtitles on top of input video using the libass library.
  8150. To enable compilation of this filter you need to configure FFmpeg with
  8151. @code{--enable-libass}. This filter also requires a build with libavcodec and
  8152. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  8153. Alpha) subtitles format.
  8154. The filter accepts the following options:
  8155. @table @option
  8156. @item filename, f
  8157. Set the filename of the subtitle file to read. It must be specified.
  8158. @item original_size
  8159. Specify the size of the original video, the video for which the ASS file
  8160. was composed. For the syntax of this option, check the
  8161. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8162. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  8163. correctly scale the fonts if the aspect ratio has been changed.
  8164. @item fontsdir
  8165. Set a directory path containing fonts that can be used by the filter.
  8166. These fonts will be used in addition to whatever the font provider uses.
  8167. @item charenc
  8168. Set subtitles input character encoding. @code{subtitles} filter only. Only
  8169. useful if not UTF-8.
  8170. @item stream_index, si
  8171. Set subtitles stream index. @code{subtitles} filter only.
  8172. @item force_style
  8173. Override default style or script info parameters of the subtitles. It accepts a
  8174. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  8175. @end table
  8176. If the first key is not specified, it is assumed that the first value
  8177. specifies the @option{filename}.
  8178. For example, to render the file @file{sub.srt} on top of the input
  8179. video, use the command:
  8180. @example
  8181. subtitles=sub.srt
  8182. @end example
  8183. which is equivalent to:
  8184. @example
  8185. subtitles=filename=sub.srt
  8186. @end example
  8187. To render the default subtitles stream from file @file{video.mkv}, use:
  8188. @example
  8189. subtitles=video.mkv
  8190. @end example
  8191. To render the second subtitles stream from that file, use:
  8192. @example
  8193. subtitles=video.mkv:si=1
  8194. @end example
  8195. To make the subtitles stream from @file{sub.srt} appear in transparent green
  8196. @code{DejaVu Serif}, use:
  8197. @example
  8198. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  8199. @end example
  8200. @section super2xsai
  8201. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  8202. Interpolate) pixel art scaling algorithm.
  8203. Useful for enlarging pixel art images without reducing sharpness.
  8204. @section swapuv
  8205. Swap U & V plane.
  8206. @section telecine
  8207. Apply telecine process to the video.
  8208. This filter accepts the following options:
  8209. @table @option
  8210. @item first_field
  8211. @table @samp
  8212. @item top, t
  8213. top field first
  8214. @item bottom, b
  8215. bottom field first
  8216. The default value is @code{top}.
  8217. @end table
  8218. @item pattern
  8219. A string of numbers representing the pulldown pattern you wish to apply.
  8220. The default value is @code{23}.
  8221. @end table
  8222. @example
  8223. Some typical patterns:
  8224. NTSC output (30i):
  8225. 27.5p: 32222
  8226. 24p: 23 (classic)
  8227. 24p: 2332 (preferred)
  8228. 20p: 33
  8229. 18p: 334
  8230. 16p: 3444
  8231. PAL output (25i):
  8232. 27.5p: 12222
  8233. 24p: 222222222223 ("Euro pulldown")
  8234. 16.67p: 33
  8235. 16p: 33333334
  8236. @end example
  8237. @section thumbnail
  8238. Select the most representative frame in a given sequence of consecutive frames.
  8239. The filter accepts the following options:
  8240. @table @option
  8241. @item n
  8242. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  8243. will pick one of them, and then handle the next batch of @var{n} frames until
  8244. the end. Default is @code{100}.
  8245. @end table
  8246. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  8247. value will result in a higher memory usage, so a high value is not recommended.
  8248. @subsection Examples
  8249. @itemize
  8250. @item
  8251. Extract one picture each 50 frames:
  8252. @example
  8253. thumbnail=50
  8254. @end example
  8255. @item
  8256. Complete example of a thumbnail creation with @command{ffmpeg}:
  8257. @example
  8258. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  8259. @end example
  8260. @end itemize
  8261. @section tile
  8262. Tile several successive frames together.
  8263. The filter accepts the following options:
  8264. @table @option
  8265. @item layout
  8266. Set the grid size (i.e. the number of lines and columns). For the syntax of
  8267. this option, check the
  8268. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8269. @item nb_frames
  8270. Set the maximum number of frames to render in the given area. It must be less
  8271. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  8272. the area will be used.
  8273. @item margin
  8274. Set the outer border margin in pixels.
  8275. @item padding
  8276. Set the inner border thickness (i.e. the number of pixels between frames). For
  8277. more advanced padding options (such as having different values for the edges),
  8278. refer to the pad video filter.
  8279. @item color
  8280. Specify the color of the unused area. For the syntax of this option, check the
  8281. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  8282. is "black".
  8283. @end table
  8284. @subsection Examples
  8285. @itemize
  8286. @item
  8287. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  8288. @example
  8289. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  8290. @end example
  8291. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  8292. duplicating each output frame to accommodate the originally detected frame
  8293. rate.
  8294. @item
  8295. Display @code{5} pictures in an area of @code{3x2} frames,
  8296. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  8297. mixed flat and named options:
  8298. @example
  8299. tile=3x2:nb_frames=5:padding=7:margin=2
  8300. @end example
  8301. @end itemize
  8302. @section tinterlace
  8303. Perform various types of temporal field interlacing.
  8304. Frames are counted starting from 1, so the first input frame is
  8305. considered odd.
  8306. The filter accepts the following options:
  8307. @table @option
  8308. @item mode
  8309. Specify the mode of the interlacing. This option can also be specified
  8310. as a value alone. See below for a list of values for this option.
  8311. Available values are:
  8312. @table @samp
  8313. @item merge, 0
  8314. Move odd frames into the upper field, even into the lower field,
  8315. generating a double height frame at half frame rate.
  8316. @example
  8317. ------> time
  8318. Input:
  8319. Frame 1 Frame 2 Frame 3 Frame 4
  8320. 11111 22222 33333 44444
  8321. 11111 22222 33333 44444
  8322. 11111 22222 33333 44444
  8323. 11111 22222 33333 44444
  8324. Output:
  8325. 11111 33333
  8326. 22222 44444
  8327. 11111 33333
  8328. 22222 44444
  8329. 11111 33333
  8330. 22222 44444
  8331. 11111 33333
  8332. 22222 44444
  8333. @end example
  8334. @item drop_odd, 1
  8335. Only output even frames, odd frames are dropped, generating a frame with
  8336. unchanged height at half frame rate.
  8337. @example
  8338. ------> time
  8339. Input:
  8340. Frame 1 Frame 2 Frame 3 Frame 4
  8341. 11111 22222 33333 44444
  8342. 11111 22222 33333 44444
  8343. 11111 22222 33333 44444
  8344. 11111 22222 33333 44444
  8345. Output:
  8346. 22222 44444
  8347. 22222 44444
  8348. 22222 44444
  8349. 22222 44444
  8350. @end example
  8351. @item drop_even, 2
  8352. Only output odd frames, even frames are dropped, generating a frame with
  8353. unchanged height at half frame rate.
  8354. @example
  8355. ------> time
  8356. Input:
  8357. Frame 1 Frame 2 Frame 3 Frame 4
  8358. 11111 22222 33333 44444
  8359. 11111 22222 33333 44444
  8360. 11111 22222 33333 44444
  8361. 11111 22222 33333 44444
  8362. Output:
  8363. 11111 33333
  8364. 11111 33333
  8365. 11111 33333
  8366. 11111 33333
  8367. @end example
  8368. @item pad, 3
  8369. Expand each frame to full height, but pad alternate lines with black,
  8370. generating a frame with double height at the same input frame rate.
  8371. @example
  8372. ------> time
  8373. Input:
  8374. Frame 1 Frame 2 Frame 3 Frame 4
  8375. 11111 22222 33333 44444
  8376. 11111 22222 33333 44444
  8377. 11111 22222 33333 44444
  8378. 11111 22222 33333 44444
  8379. Output:
  8380. 11111 ..... 33333 .....
  8381. ..... 22222 ..... 44444
  8382. 11111 ..... 33333 .....
  8383. ..... 22222 ..... 44444
  8384. 11111 ..... 33333 .....
  8385. ..... 22222 ..... 44444
  8386. 11111 ..... 33333 .....
  8387. ..... 22222 ..... 44444
  8388. @end example
  8389. @item interleave_top, 4
  8390. Interleave the upper field from odd frames with the lower field from
  8391. even frames, generating a frame with unchanged height at half frame rate.
  8392. @example
  8393. ------> time
  8394. Input:
  8395. Frame 1 Frame 2 Frame 3 Frame 4
  8396. 11111<- 22222 33333<- 44444
  8397. 11111 22222<- 33333 44444<-
  8398. 11111<- 22222 33333<- 44444
  8399. 11111 22222<- 33333 44444<-
  8400. Output:
  8401. 11111 33333
  8402. 22222 44444
  8403. 11111 33333
  8404. 22222 44444
  8405. @end example
  8406. @item interleave_bottom, 5
  8407. Interleave the lower field from odd frames with the upper field from
  8408. even frames, generating a frame with unchanged height at half frame rate.
  8409. @example
  8410. ------> time
  8411. Input:
  8412. Frame 1 Frame 2 Frame 3 Frame 4
  8413. 11111 22222<- 33333 44444<-
  8414. 11111<- 22222 33333<- 44444
  8415. 11111 22222<- 33333 44444<-
  8416. 11111<- 22222 33333<- 44444
  8417. Output:
  8418. 22222 44444
  8419. 11111 33333
  8420. 22222 44444
  8421. 11111 33333
  8422. @end example
  8423. @item interlacex2, 6
  8424. Double frame rate with unchanged height. Frames are inserted each
  8425. containing the second temporal field from the previous input frame and
  8426. the first temporal field from the next input frame. This mode relies on
  8427. the top_field_first flag. Useful for interlaced video displays with no
  8428. field synchronisation.
  8429. @example
  8430. ------> time
  8431. Input:
  8432. Frame 1 Frame 2 Frame 3 Frame 4
  8433. 11111 22222 33333 44444
  8434. 11111 22222 33333 44444
  8435. 11111 22222 33333 44444
  8436. 11111 22222 33333 44444
  8437. Output:
  8438. 11111 22222 22222 33333 33333 44444 44444
  8439. 11111 11111 22222 22222 33333 33333 44444
  8440. 11111 22222 22222 33333 33333 44444 44444
  8441. 11111 11111 22222 22222 33333 33333 44444
  8442. @end example
  8443. @item mergex2, 7
  8444. Move odd frames into the upper field, even into the lower field,
  8445. generating a double height frame at same frame rate.
  8446. @example
  8447. ------> time
  8448. Input:
  8449. Frame 1 Frame 2 Frame 3 Frame 4
  8450. 11111 22222 33333 44444
  8451. 11111 22222 33333 44444
  8452. 11111 22222 33333 44444
  8453. 11111 22222 33333 44444
  8454. Output:
  8455. 11111 33333 33333 55555
  8456. 22222 22222 44444 44444
  8457. 11111 33333 33333 55555
  8458. 22222 22222 44444 44444
  8459. 11111 33333 33333 55555
  8460. 22222 22222 44444 44444
  8461. 11111 33333 33333 55555
  8462. 22222 22222 44444 44444
  8463. @end example
  8464. @end table
  8465. Numeric values are deprecated but are accepted for backward
  8466. compatibility reasons.
  8467. Default mode is @code{merge}.
  8468. @item flags
  8469. Specify flags influencing the filter process.
  8470. Available value for @var{flags} is:
  8471. @table @option
  8472. @item low_pass_filter, vlfp
  8473. Enable vertical low-pass filtering in the filter.
  8474. Vertical low-pass filtering is required when creating an interlaced
  8475. destination from a progressive source which contains high-frequency
  8476. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  8477. patterning.
  8478. Vertical low-pass filtering can only be enabled for @option{mode}
  8479. @var{interleave_top} and @var{interleave_bottom}.
  8480. @end table
  8481. @end table
  8482. @section transpose
  8483. Transpose rows with columns in the input video and optionally flip it.
  8484. It accepts the following parameters:
  8485. @table @option
  8486. @item dir
  8487. Specify the transposition direction.
  8488. Can assume the following values:
  8489. @table @samp
  8490. @item 0, 4, cclock_flip
  8491. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  8492. @example
  8493. L.R L.l
  8494. . . -> . .
  8495. l.r R.r
  8496. @end example
  8497. @item 1, 5, clock
  8498. Rotate by 90 degrees clockwise, that is:
  8499. @example
  8500. L.R l.L
  8501. . . -> . .
  8502. l.r r.R
  8503. @end example
  8504. @item 2, 6, cclock
  8505. Rotate by 90 degrees counterclockwise, that is:
  8506. @example
  8507. L.R R.r
  8508. . . -> . .
  8509. l.r L.l
  8510. @end example
  8511. @item 3, 7, clock_flip
  8512. Rotate by 90 degrees clockwise and vertically flip, that is:
  8513. @example
  8514. L.R r.R
  8515. . . -> . .
  8516. l.r l.L
  8517. @end example
  8518. @end table
  8519. For values between 4-7, the transposition is only done if the input
  8520. video geometry is portrait and not landscape. These values are
  8521. deprecated, the @code{passthrough} option should be used instead.
  8522. Numerical values are deprecated, and should be dropped in favor of
  8523. symbolic constants.
  8524. @item passthrough
  8525. Do not apply the transposition if the input geometry matches the one
  8526. specified by the specified value. It accepts the following values:
  8527. @table @samp
  8528. @item none
  8529. Always apply transposition.
  8530. @item portrait
  8531. Preserve portrait geometry (when @var{height} >= @var{width}).
  8532. @item landscape
  8533. Preserve landscape geometry (when @var{width} >= @var{height}).
  8534. @end table
  8535. Default value is @code{none}.
  8536. @end table
  8537. For example to rotate by 90 degrees clockwise and preserve portrait
  8538. layout:
  8539. @example
  8540. transpose=dir=1:passthrough=portrait
  8541. @end example
  8542. The command above can also be specified as:
  8543. @example
  8544. transpose=1:portrait
  8545. @end example
  8546. @section trim
  8547. Trim the input so that the output contains one continuous subpart of the input.
  8548. It accepts the following parameters:
  8549. @table @option
  8550. @item start
  8551. Specify the time of the start of the kept section, i.e. the frame with the
  8552. timestamp @var{start} will be the first frame in the output.
  8553. @item end
  8554. Specify the time of the first frame that will be dropped, i.e. the frame
  8555. immediately preceding the one with the timestamp @var{end} will be the last
  8556. frame in the output.
  8557. @item start_pts
  8558. This is the same as @var{start}, except this option sets the start timestamp
  8559. in timebase units instead of seconds.
  8560. @item end_pts
  8561. This is the same as @var{end}, except this option sets the end timestamp
  8562. in timebase units instead of seconds.
  8563. @item duration
  8564. The maximum duration of the output in seconds.
  8565. @item start_frame
  8566. The number of the first frame that should be passed to the output.
  8567. @item end_frame
  8568. The number of the first frame that should be dropped.
  8569. @end table
  8570. @option{start}, @option{end}, and @option{duration} are expressed as time
  8571. duration specifications; see
  8572. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  8573. for the accepted syntax.
  8574. Note that the first two sets of the start/end options and the @option{duration}
  8575. option look at the frame timestamp, while the _frame variants simply count the
  8576. frames that pass through the filter. Also note that this filter does not modify
  8577. the timestamps. If you wish for the output timestamps to start at zero, insert a
  8578. setpts filter after the trim filter.
  8579. If multiple start or end options are set, this filter tries to be greedy and
  8580. keep all the frames that match at least one of the specified constraints. To keep
  8581. only the part that matches all the constraints at once, chain multiple trim
  8582. filters.
  8583. The defaults are such that all the input is kept. So it is possible to set e.g.
  8584. just the end values to keep everything before the specified time.
  8585. Examples:
  8586. @itemize
  8587. @item
  8588. Drop everything except the second minute of input:
  8589. @example
  8590. ffmpeg -i INPUT -vf trim=60:120
  8591. @end example
  8592. @item
  8593. Keep only the first second:
  8594. @example
  8595. ffmpeg -i INPUT -vf trim=duration=1
  8596. @end example
  8597. @end itemize
  8598. @anchor{unsharp}
  8599. @section unsharp
  8600. Sharpen or blur the input video.
  8601. It accepts the following parameters:
  8602. @table @option
  8603. @item luma_msize_x, lx
  8604. Set the luma matrix horizontal size. It must be an odd integer between
  8605. 3 and 63. The default value is 5.
  8606. @item luma_msize_y, ly
  8607. Set the luma matrix vertical size. It must be an odd integer between 3
  8608. and 63. The default value is 5.
  8609. @item luma_amount, la
  8610. Set the luma effect strength. It must be a floating point number, reasonable
  8611. values lay between -1.5 and 1.5.
  8612. Negative values will blur the input video, while positive values will
  8613. sharpen it, a value of zero will disable the effect.
  8614. Default value is 1.0.
  8615. @item chroma_msize_x, cx
  8616. Set the chroma matrix horizontal size. It must be an odd integer
  8617. between 3 and 63. The default value is 5.
  8618. @item chroma_msize_y, cy
  8619. Set the chroma matrix vertical size. It must be an odd integer
  8620. between 3 and 63. The default value is 5.
  8621. @item chroma_amount, ca
  8622. Set the chroma effect strength. It must be a floating point number, reasonable
  8623. values lay between -1.5 and 1.5.
  8624. Negative values will blur the input video, while positive values will
  8625. sharpen it, a value of zero will disable the effect.
  8626. Default value is 0.0.
  8627. @item opencl
  8628. If set to 1, specify using OpenCL capabilities, only available if
  8629. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  8630. @end table
  8631. All parameters are optional and default to the equivalent of the
  8632. string '5:5:1.0:5:5:0.0'.
  8633. @subsection Examples
  8634. @itemize
  8635. @item
  8636. Apply strong luma sharpen effect:
  8637. @example
  8638. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  8639. @end example
  8640. @item
  8641. Apply a strong blur of both luma and chroma parameters:
  8642. @example
  8643. unsharp=7:7:-2:7:7:-2
  8644. @end example
  8645. @end itemize
  8646. @section uspp
  8647. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  8648. the image at several (or - in the case of @option{quality} level @code{8} - all)
  8649. shifts and average the results.
  8650. The way this differs from the behavior of spp is that uspp actually encodes &
  8651. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  8652. DCT similar to MJPEG.
  8653. The filter accepts the following options:
  8654. @table @option
  8655. @item quality
  8656. Set quality. This option defines the number of levels for averaging. It accepts
  8657. an integer in the range 0-8. If set to @code{0}, the filter will have no
  8658. effect. A value of @code{8} means the higher quality. For each increment of
  8659. that value the speed drops by a factor of approximately 2. Default value is
  8660. @code{3}.
  8661. @item qp
  8662. Force a constant quantization parameter. If not set, the filter will use the QP
  8663. from the video stream (if available).
  8664. @end table
  8665. @section vectorscope
  8666. Display 2 color component values in the two dimensional graph (which is called
  8667. a vectorscope).
  8668. This filter accepts the following options:
  8669. @table @option
  8670. @item mode, m
  8671. Set vectorscope mode.
  8672. It accepts the following values:
  8673. @table @samp
  8674. @item gray
  8675. Gray values are displayed on graph, higher brightness means more pixels have
  8676. same component color value on location in graph. This is the default mode.
  8677. @item color
  8678. Gray values are displayed on graph. Surrounding pixels values which are not
  8679. present in video frame are drawn in gradient of 2 color components which are
  8680. set by option @code{x} and @code{y}.
  8681. @item color2
  8682. Actual color components values present in video frame are displayed on graph.
  8683. @item color3
  8684. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  8685. on graph increases value of another color component, which is luminance by
  8686. default values of @code{x} and @code{y}.
  8687. @item color4
  8688. Actual colors present in video frame are displayed on graph. If two different
  8689. colors map to same position on graph then color with higher value of component
  8690. not present in graph is picked.
  8691. @end table
  8692. @item x
  8693. Set which color component will be represented on X-axis. Default is @code{1}.
  8694. @item y
  8695. Set which color component will be represented on Y-axis. Default is @code{2}.
  8696. @item intensity, i
  8697. Set intensity, used by modes: gray, color and color3 for increasing brightness
  8698. of color component which represents frequency of (X, Y) location in graph.
  8699. @item envelope, e
  8700. @table @samp
  8701. @item none
  8702. No envelope, this is default.
  8703. @item instant
  8704. Instant envelope, even darkest single pixel will be clearly highlighted.
  8705. @item peak
  8706. Hold maximum and minimum values presented in graph over time. This way you
  8707. can still spot out of range values without constantly looking at vectorscope.
  8708. @item peak+instant
  8709. Peak and instant envelope combined together.
  8710. @end table
  8711. @end table
  8712. @anchor{vidstabdetect}
  8713. @section vidstabdetect
  8714. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  8715. @ref{vidstabtransform} for pass 2.
  8716. This filter generates a file with relative translation and rotation
  8717. transform information about subsequent frames, which is then used by
  8718. the @ref{vidstabtransform} filter.
  8719. To enable compilation of this filter you need to configure FFmpeg with
  8720. @code{--enable-libvidstab}.
  8721. This filter accepts the following options:
  8722. @table @option
  8723. @item result
  8724. Set the path to the file used to write the transforms information.
  8725. Default value is @file{transforms.trf}.
  8726. @item shakiness
  8727. Set how shaky the video is and how quick the camera is. It accepts an
  8728. integer in the range 1-10, a value of 1 means little shakiness, a
  8729. value of 10 means strong shakiness. Default value is 5.
  8730. @item accuracy
  8731. Set the accuracy of the detection process. It must be a value in the
  8732. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  8733. accuracy. Default value is 15.
  8734. @item stepsize
  8735. Set stepsize of the search process. The region around minimum is
  8736. scanned with 1 pixel resolution. Default value is 6.
  8737. @item mincontrast
  8738. Set minimum contrast. Below this value a local measurement field is
  8739. discarded. Must be a floating point value in the range 0-1. Default
  8740. value is 0.3.
  8741. @item tripod
  8742. Set reference frame number for tripod mode.
  8743. If enabled, the motion of the frames is compared to a reference frame
  8744. in the filtered stream, identified by the specified number. The idea
  8745. is to compensate all movements in a more-or-less static scene and keep
  8746. the camera view absolutely still.
  8747. If set to 0, it is disabled. The frames are counted starting from 1.
  8748. @item show
  8749. Show fields and transforms in the resulting frames. It accepts an
  8750. integer in the range 0-2. Default value is 0, which disables any
  8751. visualization.
  8752. @end table
  8753. @subsection Examples
  8754. @itemize
  8755. @item
  8756. Use default values:
  8757. @example
  8758. vidstabdetect
  8759. @end example
  8760. @item
  8761. Analyze strongly shaky movie and put the results in file
  8762. @file{mytransforms.trf}:
  8763. @example
  8764. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  8765. @end example
  8766. @item
  8767. Visualize the result of internal transformations in the resulting
  8768. video:
  8769. @example
  8770. vidstabdetect=show=1
  8771. @end example
  8772. @item
  8773. Analyze a video with medium shakiness using @command{ffmpeg}:
  8774. @example
  8775. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  8776. @end example
  8777. @end itemize
  8778. @anchor{vidstabtransform}
  8779. @section vidstabtransform
  8780. Video stabilization/deshaking: pass 2 of 2,
  8781. see @ref{vidstabdetect} for pass 1.
  8782. Read a file with transform information for each frame and
  8783. apply/compensate them. Together with the @ref{vidstabdetect}
  8784. filter this can be used to deshake videos. See also
  8785. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  8786. the @ref{unsharp} filter, see below.
  8787. To enable compilation of this filter you need to configure FFmpeg with
  8788. @code{--enable-libvidstab}.
  8789. @subsection Options
  8790. @table @option
  8791. @item input
  8792. Set path to the file used to read the transforms. Default value is
  8793. @file{transforms.trf}.
  8794. @item smoothing
  8795. Set the number of frames (value*2 + 1) used for lowpass filtering the
  8796. camera movements. Default value is 10.
  8797. For example a number of 10 means that 21 frames are used (10 in the
  8798. past and 10 in the future) to smoothen the motion in the video. A
  8799. larger value leads to a smoother video, but limits the acceleration of
  8800. the camera (pan/tilt movements). 0 is a special case where a static
  8801. camera is simulated.
  8802. @item optalgo
  8803. Set the camera path optimization algorithm.
  8804. Accepted values are:
  8805. @table @samp
  8806. @item gauss
  8807. gaussian kernel low-pass filter on camera motion (default)
  8808. @item avg
  8809. averaging on transformations
  8810. @end table
  8811. @item maxshift
  8812. Set maximal number of pixels to translate frames. Default value is -1,
  8813. meaning no limit.
  8814. @item maxangle
  8815. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  8816. value is -1, meaning no limit.
  8817. @item crop
  8818. Specify how to deal with borders that may be visible due to movement
  8819. compensation.
  8820. Available values are:
  8821. @table @samp
  8822. @item keep
  8823. keep image information from previous frame (default)
  8824. @item black
  8825. fill the border black
  8826. @end table
  8827. @item invert
  8828. Invert transforms if set to 1. Default value is 0.
  8829. @item relative
  8830. Consider transforms as relative to previous frame if set to 1,
  8831. absolute if set to 0. Default value is 0.
  8832. @item zoom
  8833. Set percentage to zoom. A positive value will result in a zoom-in
  8834. effect, a negative value in a zoom-out effect. Default value is 0 (no
  8835. zoom).
  8836. @item optzoom
  8837. Set optimal zooming to avoid borders.
  8838. Accepted values are:
  8839. @table @samp
  8840. @item 0
  8841. disabled
  8842. @item 1
  8843. optimal static zoom value is determined (only very strong movements
  8844. will lead to visible borders) (default)
  8845. @item 2
  8846. optimal adaptive zoom value is determined (no borders will be
  8847. visible), see @option{zoomspeed}
  8848. @end table
  8849. Note that the value given at zoom is added to the one calculated here.
  8850. @item zoomspeed
  8851. Set percent to zoom maximally each frame (enabled when
  8852. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  8853. 0.25.
  8854. @item interpol
  8855. Specify type of interpolation.
  8856. Available values are:
  8857. @table @samp
  8858. @item no
  8859. no interpolation
  8860. @item linear
  8861. linear only horizontal
  8862. @item bilinear
  8863. linear in both directions (default)
  8864. @item bicubic
  8865. cubic in both directions (slow)
  8866. @end table
  8867. @item tripod
  8868. Enable virtual tripod mode if set to 1, which is equivalent to
  8869. @code{relative=0:smoothing=0}. Default value is 0.
  8870. Use also @code{tripod} option of @ref{vidstabdetect}.
  8871. @item debug
  8872. Increase log verbosity if set to 1. Also the detected global motions
  8873. are written to the temporary file @file{global_motions.trf}. Default
  8874. value is 0.
  8875. @end table
  8876. @subsection Examples
  8877. @itemize
  8878. @item
  8879. Use @command{ffmpeg} for a typical stabilization with default values:
  8880. @example
  8881. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  8882. @end example
  8883. Note the use of the @ref{unsharp} filter which is always recommended.
  8884. @item
  8885. Zoom in a bit more and load transform data from a given file:
  8886. @example
  8887. vidstabtransform=zoom=5:input="mytransforms.trf"
  8888. @end example
  8889. @item
  8890. Smoothen the video even more:
  8891. @example
  8892. vidstabtransform=smoothing=30
  8893. @end example
  8894. @end itemize
  8895. @section vflip
  8896. Flip the input video vertically.
  8897. For example, to vertically flip a video with @command{ffmpeg}:
  8898. @example
  8899. ffmpeg -i in.avi -vf "vflip" out.avi
  8900. @end example
  8901. @anchor{vignette}
  8902. @section vignette
  8903. Make or reverse a natural vignetting effect.
  8904. The filter accepts the following options:
  8905. @table @option
  8906. @item angle, a
  8907. Set lens angle expression as a number of radians.
  8908. The value is clipped in the @code{[0,PI/2]} range.
  8909. Default value: @code{"PI/5"}
  8910. @item x0
  8911. @item y0
  8912. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  8913. by default.
  8914. @item mode
  8915. Set forward/backward mode.
  8916. Available modes are:
  8917. @table @samp
  8918. @item forward
  8919. The larger the distance from the central point, the darker the image becomes.
  8920. @item backward
  8921. The larger the distance from the central point, the brighter the image becomes.
  8922. This can be used to reverse a vignette effect, though there is no automatic
  8923. detection to extract the lens @option{angle} and other settings (yet). It can
  8924. also be used to create a burning effect.
  8925. @end table
  8926. Default value is @samp{forward}.
  8927. @item eval
  8928. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  8929. It accepts the following values:
  8930. @table @samp
  8931. @item init
  8932. Evaluate expressions only once during the filter initialization.
  8933. @item frame
  8934. Evaluate expressions for each incoming frame. This is way slower than the
  8935. @samp{init} mode since it requires all the scalers to be re-computed, but it
  8936. allows advanced dynamic expressions.
  8937. @end table
  8938. Default value is @samp{init}.
  8939. @item dither
  8940. Set dithering to reduce the circular banding effects. Default is @code{1}
  8941. (enabled).
  8942. @item aspect
  8943. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  8944. Setting this value to the SAR of the input will make a rectangular vignetting
  8945. following the dimensions of the video.
  8946. Default is @code{1/1}.
  8947. @end table
  8948. @subsection Expressions
  8949. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  8950. following parameters.
  8951. @table @option
  8952. @item w
  8953. @item h
  8954. input width and height
  8955. @item n
  8956. the number of input frame, starting from 0
  8957. @item pts
  8958. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  8959. @var{TB} units, NAN if undefined
  8960. @item r
  8961. frame rate of the input video, NAN if the input frame rate is unknown
  8962. @item t
  8963. the PTS (Presentation TimeStamp) of the filtered video frame,
  8964. expressed in seconds, NAN if undefined
  8965. @item tb
  8966. time base of the input video
  8967. @end table
  8968. @subsection Examples
  8969. @itemize
  8970. @item
  8971. Apply simple strong vignetting effect:
  8972. @example
  8973. vignette=PI/4
  8974. @end example
  8975. @item
  8976. Make a flickering vignetting:
  8977. @example
  8978. vignette='PI/4+random(1)*PI/50':eval=frame
  8979. @end example
  8980. @end itemize
  8981. @section vstack
  8982. Stack input videos vertically.
  8983. All streams must be of same pixel format and of same width.
  8984. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8985. to create same output.
  8986. The filter accept the following option:
  8987. @table @option
  8988. @item inputs
  8989. Set number of input streams. Default is 2.
  8990. @item shortest
  8991. If set to 1, force the output to terminate when the shortest input
  8992. terminates. Default value is 0.
  8993. @end table
  8994. @section w3fdif
  8995. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  8996. Deinterlacing Filter").
  8997. Based on the process described by Martin Weston for BBC R&D, and
  8998. implemented based on the de-interlace algorithm written by Jim
  8999. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  9000. uses filter coefficients calculated by BBC R&D.
  9001. There are two sets of filter coefficients, so called "simple":
  9002. and "complex". Which set of filter coefficients is used can
  9003. be set by passing an optional parameter:
  9004. @table @option
  9005. @item filter
  9006. Set the interlacing filter coefficients. Accepts one of the following values:
  9007. @table @samp
  9008. @item simple
  9009. Simple filter coefficient set.
  9010. @item complex
  9011. More-complex filter coefficient set.
  9012. @end table
  9013. Default value is @samp{complex}.
  9014. @item deint
  9015. Specify which frames to deinterlace. Accept one of the following values:
  9016. @table @samp
  9017. @item all
  9018. Deinterlace all frames,
  9019. @item interlaced
  9020. Only deinterlace frames marked as interlaced.
  9021. @end table
  9022. Default value is @samp{all}.
  9023. @end table
  9024. @section waveform
  9025. Video waveform monitor.
  9026. The waveform monitor plots color component intensity. By default luminance
  9027. only. Each column of the waveform corresponds to a column of pixels in the
  9028. source video.
  9029. It accepts the following options:
  9030. @table @option
  9031. @item mode, m
  9032. Can be either @code{row}, or @code{column}. Default is @code{column}.
  9033. In row mode, the graph on the left side represents color component value 0 and
  9034. the right side represents value = 255. In column mode, the top side represents
  9035. color component value = 0 and bottom side represents value = 255.
  9036. @item intensity, i
  9037. Set intensity. Smaller values are useful to find out how many values of the same
  9038. luminance are distributed across input rows/columns.
  9039. Default value is @code{0.04}. Allowed range is [0, 1].
  9040. @item mirror, r
  9041. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  9042. In mirrored mode, higher values will be represented on the left
  9043. side for @code{row} mode and at the top for @code{column} mode. Default is
  9044. @code{1} (mirrored).
  9045. @item display, d
  9046. Set display mode.
  9047. It accepts the following values:
  9048. @table @samp
  9049. @item overlay
  9050. Presents information identical to that in the @code{parade}, except
  9051. that the graphs representing color components are superimposed directly
  9052. over one another.
  9053. This display mode makes it easier to spot relative differences or similarities
  9054. in overlapping areas of the color components that are supposed to be identical,
  9055. such as neutral whites, grays, or blacks.
  9056. @item parade
  9057. Display separate graph for the color components side by side in
  9058. @code{row} mode or one below the other in @code{column} mode.
  9059. Using this display mode makes it easy to spot color casts in the highlights
  9060. and shadows of an image, by comparing the contours of the top and the bottom
  9061. graphs of each waveform. Since whites, grays, and blacks are characterized
  9062. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  9063. should display three waveforms of roughly equal width/height. If not, the
  9064. correction is easy to perform by making level adjustments the three waveforms.
  9065. @end table
  9066. Default is @code{parade}.
  9067. @item components, c
  9068. Set which color components to display. Default is 1, which means only luminance
  9069. or red color component if input is in RGB colorspace. If is set for example to
  9070. 7 it will display all 3 (if) available color components.
  9071. @item envelope, e
  9072. @table @samp
  9073. @item none
  9074. No envelope, this is default.
  9075. @item instant
  9076. Instant envelope, minimum and maximum values presented in graph will be easily
  9077. visible even with small @code{step} value.
  9078. @item peak
  9079. Hold minimum and maximum values presented in graph across time. This way you
  9080. can still spot out of range values without constantly looking at waveforms.
  9081. @item peak+instant
  9082. Peak and instant envelope combined together.
  9083. @end table
  9084. @item filter, f
  9085. @table @samp
  9086. @item lowpass
  9087. No filtering, this is default.
  9088. @item flat
  9089. Luma and chroma combined together.
  9090. @item aflat
  9091. Similar as above, but shows difference between blue and red chroma.
  9092. @item chroma
  9093. Displays only chroma.
  9094. @item achroma
  9095. Similar as above, but shows difference between blue and red chroma.
  9096. @item color
  9097. Displays actual color value on waveform.
  9098. @end table
  9099. @end table
  9100. @section xbr
  9101. Apply the xBR high-quality magnification filter which is designed for pixel
  9102. art. It follows a set of edge-detection rules, see
  9103. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  9104. It accepts the following option:
  9105. @table @option
  9106. @item n
  9107. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  9108. @code{3xBR} and @code{4} for @code{4xBR}.
  9109. Default is @code{3}.
  9110. @end table
  9111. @anchor{yadif}
  9112. @section yadif
  9113. Deinterlace the input video ("yadif" means "yet another deinterlacing
  9114. filter").
  9115. It accepts the following parameters:
  9116. @table @option
  9117. @item mode
  9118. The interlacing mode to adopt. It accepts one of the following values:
  9119. @table @option
  9120. @item 0, send_frame
  9121. Output one frame for each frame.
  9122. @item 1, send_field
  9123. Output one frame for each field.
  9124. @item 2, send_frame_nospatial
  9125. Like @code{send_frame}, but it skips the spatial interlacing check.
  9126. @item 3, send_field_nospatial
  9127. Like @code{send_field}, but it skips the spatial interlacing check.
  9128. @end table
  9129. The default value is @code{send_frame}.
  9130. @item parity
  9131. The picture field parity assumed for the input interlaced video. It accepts one
  9132. of the following values:
  9133. @table @option
  9134. @item 0, tff
  9135. Assume the top field is first.
  9136. @item 1, bff
  9137. Assume the bottom field is first.
  9138. @item -1, auto
  9139. Enable automatic detection of field parity.
  9140. @end table
  9141. The default value is @code{auto}.
  9142. If the interlacing is unknown or the decoder does not export this information,
  9143. top field first will be assumed.
  9144. @item deint
  9145. Specify which frames to deinterlace. Accept one of the following
  9146. values:
  9147. @table @option
  9148. @item 0, all
  9149. Deinterlace all frames.
  9150. @item 1, interlaced
  9151. Only deinterlace frames marked as interlaced.
  9152. @end table
  9153. The default value is @code{all}.
  9154. @end table
  9155. @section zoompan
  9156. Apply Zoom & Pan effect.
  9157. This filter accepts the following options:
  9158. @table @option
  9159. @item zoom, z
  9160. Set the zoom expression. Default is 1.
  9161. @item x
  9162. @item y
  9163. Set the x and y expression. Default is 0.
  9164. @item d
  9165. Set the duration expression in number of frames.
  9166. This sets for how many number of frames effect will last for
  9167. single input image.
  9168. @item s
  9169. Set the output image size, default is 'hd720'.
  9170. @end table
  9171. Each expression can contain the following constants:
  9172. @table @option
  9173. @item in_w, iw
  9174. Input width.
  9175. @item in_h, ih
  9176. Input height.
  9177. @item out_w, ow
  9178. Output width.
  9179. @item out_h, oh
  9180. Output height.
  9181. @item in
  9182. Input frame count.
  9183. @item on
  9184. Output frame count.
  9185. @item x
  9186. @item y
  9187. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  9188. for current input frame.
  9189. @item px
  9190. @item py
  9191. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  9192. not yet such frame (first input frame).
  9193. @item zoom
  9194. Last calculated zoom from 'z' expression for current input frame.
  9195. @item pzoom
  9196. Last calculated zoom of last output frame of previous input frame.
  9197. @item duration
  9198. Number of output frames for current input frame. Calculated from 'd' expression
  9199. for each input frame.
  9200. @item pduration
  9201. number of output frames created for previous input frame
  9202. @item a
  9203. Rational number: input width / input height
  9204. @item sar
  9205. sample aspect ratio
  9206. @item dar
  9207. display aspect ratio
  9208. @end table
  9209. @subsection Examples
  9210. @itemize
  9211. @item
  9212. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  9213. @example
  9214. 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
  9215. @end example
  9216. @item
  9217. Zoom-in up to 1.5 and pan always at center of picture:
  9218. @example
  9219. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  9220. @end example
  9221. @end itemize
  9222. @section zscale
  9223. Scale (resize) the input video, using the z.lib library:
  9224. https://github.com/sekrit-twc/zimg.
  9225. The zscale filter forces the output display aspect ratio to be the same
  9226. as the input, by changing the output sample aspect ratio.
  9227. If the input image format is different from the format requested by
  9228. the next filter, the zscale filter will convert the input to the
  9229. requested format.
  9230. @subsection Options
  9231. The filter accepts the following options.
  9232. @table @option
  9233. @item width, w
  9234. @item height, h
  9235. Set the output video dimension expression. Default value is the input
  9236. dimension.
  9237. If the @var{width} or @var{w} is 0, the input width is used for the output.
  9238. If the @var{height} or @var{h} is 0, the input height is used for the output.
  9239. If one of the values is -1, the zscale filter will use a value that
  9240. maintains the aspect ratio of the input image, calculated from the
  9241. other specified dimension. If both of them are -1, the input size is
  9242. used
  9243. If one of the values is -n with n > 1, the zscale filter will also use a value
  9244. that maintains the aspect ratio of the input image, calculated from the other
  9245. specified dimension. After that it will, however, make sure that the calculated
  9246. dimension is divisible by n and adjust the value if necessary.
  9247. See below for the list of accepted constants for use in the dimension
  9248. expression.
  9249. @item size, s
  9250. Set the video size. For the syntax of this option, check the
  9251. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9252. @item dither, d
  9253. Set the dither type.
  9254. Possible values are:
  9255. @table @var
  9256. @item none
  9257. @item ordered
  9258. @item random
  9259. @item error_diffusion
  9260. @end table
  9261. Default is none.
  9262. @item filter, f
  9263. Set the resize filter type.
  9264. Possible values are:
  9265. @table @var
  9266. @item point
  9267. @item bilinear
  9268. @item bicubic
  9269. @item spline16
  9270. @item spline36
  9271. @item lanczos
  9272. @end table
  9273. Default is bilinear.
  9274. @item range, r
  9275. Set the color range.
  9276. Possible values are:
  9277. @table @var
  9278. @item input
  9279. @item limited
  9280. @item full
  9281. @end table
  9282. Default is same as input.
  9283. @item primaries, p
  9284. Set the color primaries.
  9285. Possible values are:
  9286. @table @var
  9287. @item input
  9288. @item 709
  9289. @item unspecified
  9290. @item 170m
  9291. @item 240m
  9292. @item 2020
  9293. @end table
  9294. Default is same as input.
  9295. @item transfer, t
  9296. Set the transfer characteristics.
  9297. Possible values are:
  9298. @table @var
  9299. @item input
  9300. @item 709
  9301. @item unspecified
  9302. @item 601
  9303. @item linear
  9304. @item 2020_10
  9305. @item 2020_12
  9306. @end table
  9307. Default is same as input.
  9308. @item matrix, m
  9309. Set the colorspace matrix.
  9310. Possible value are:
  9311. @table @var
  9312. @item input
  9313. @item 709
  9314. @item unspecified
  9315. @item 470bg
  9316. @item 170m
  9317. @item 2020_ncl
  9318. @item 2020_cl
  9319. @end table
  9320. Default is same as input.
  9321. @end table
  9322. The values of the @option{w} and @option{h} options are expressions
  9323. containing the following constants:
  9324. @table @var
  9325. @item in_w
  9326. @item in_h
  9327. The input width and height
  9328. @item iw
  9329. @item ih
  9330. These are the same as @var{in_w} and @var{in_h}.
  9331. @item out_w
  9332. @item out_h
  9333. The output (scaled) width and height
  9334. @item ow
  9335. @item oh
  9336. These are the same as @var{out_w} and @var{out_h}
  9337. @item a
  9338. The same as @var{iw} / @var{ih}
  9339. @item sar
  9340. input sample aspect ratio
  9341. @item dar
  9342. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9343. @item hsub
  9344. @item vsub
  9345. horizontal and vertical input chroma subsample values. For example for the
  9346. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9347. @item ohsub
  9348. @item ovsub
  9349. horizontal and vertical output chroma subsample values. For example for the
  9350. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9351. @end table
  9352. @table @option
  9353. @end table
  9354. @c man end VIDEO FILTERS
  9355. @chapter Video Sources
  9356. @c man begin VIDEO SOURCES
  9357. Below is a description of the currently available video sources.
  9358. @section buffer
  9359. Buffer video frames, and make them available to the filter chain.
  9360. This source is mainly intended for a programmatic use, in particular
  9361. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  9362. It accepts the following parameters:
  9363. @table @option
  9364. @item video_size
  9365. Specify the size (width and height) of the buffered video frames. For the
  9366. syntax of this option, check the
  9367. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9368. @item width
  9369. The input video width.
  9370. @item height
  9371. The input video height.
  9372. @item pix_fmt
  9373. A string representing the pixel format of the buffered video frames.
  9374. It may be a number corresponding to a pixel format, or a pixel format
  9375. name.
  9376. @item time_base
  9377. Specify the timebase assumed by the timestamps of the buffered frames.
  9378. @item frame_rate
  9379. Specify the frame rate expected for the video stream.
  9380. @item pixel_aspect, sar
  9381. The sample (pixel) aspect ratio of the input video.
  9382. @item sws_param
  9383. Specify the optional parameters to be used for the scale filter which
  9384. is automatically inserted when an input change is detected in the
  9385. input size or format.
  9386. @end table
  9387. For example:
  9388. @example
  9389. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  9390. @end example
  9391. will instruct the source to accept video frames with size 320x240 and
  9392. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  9393. square pixels (1:1 sample aspect ratio).
  9394. Since the pixel format with name "yuv410p" corresponds to the number 6
  9395. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  9396. this example corresponds to:
  9397. @example
  9398. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  9399. @end example
  9400. Alternatively, the options can be specified as a flat string, but this
  9401. syntax is deprecated:
  9402. @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}]
  9403. @section cellauto
  9404. Create a pattern generated by an elementary cellular automaton.
  9405. The initial state of the cellular automaton can be defined through the
  9406. @option{filename}, and @option{pattern} options. If such options are
  9407. not specified an initial state is created randomly.
  9408. At each new frame a new row in the video is filled with the result of
  9409. the cellular automaton next generation. The behavior when the whole
  9410. frame is filled is defined by the @option{scroll} option.
  9411. This source accepts the following options:
  9412. @table @option
  9413. @item filename, f
  9414. Read the initial cellular automaton state, i.e. the starting row, from
  9415. the specified file.
  9416. In the file, each non-whitespace character is considered an alive
  9417. cell, a newline will terminate the row, and further characters in the
  9418. file will be ignored.
  9419. @item pattern, p
  9420. Read the initial cellular automaton state, i.e. the starting row, from
  9421. the specified string.
  9422. Each non-whitespace character in the string is considered an alive
  9423. cell, a newline will terminate the row, and further characters in the
  9424. string will be ignored.
  9425. @item rate, r
  9426. Set the video rate, that is the number of frames generated per second.
  9427. Default is 25.
  9428. @item random_fill_ratio, ratio
  9429. Set the random fill ratio for the initial cellular automaton row. It
  9430. is a floating point number value ranging from 0 to 1, defaults to
  9431. 1/PHI.
  9432. This option is ignored when a file or a pattern is specified.
  9433. @item random_seed, seed
  9434. Set the seed for filling randomly the initial row, must be an integer
  9435. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9436. set to -1, the filter will try to use a good random seed on a best
  9437. effort basis.
  9438. @item rule
  9439. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  9440. Default value is 110.
  9441. @item size, s
  9442. Set the size of the output video. For the syntax of this option, check the
  9443. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9444. If @option{filename} or @option{pattern} is specified, the size is set
  9445. by default to the width of the specified initial state row, and the
  9446. height is set to @var{width} * PHI.
  9447. If @option{size} is set, it must contain the width of the specified
  9448. pattern string, and the specified pattern will be centered in the
  9449. larger row.
  9450. If a filename or a pattern string is not specified, the size value
  9451. defaults to "320x518" (used for a randomly generated initial state).
  9452. @item scroll
  9453. If set to 1, scroll the output upward when all the rows in the output
  9454. have been already filled. If set to 0, the new generated row will be
  9455. written over the top row just after the bottom row is filled.
  9456. Defaults to 1.
  9457. @item start_full, full
  9458. If set to 1, completely fill the output with generated rows before
  9459. outputting the first frame.
  9460. This is the default behavior, for disabling set the value to 0.
  9461. @item stitch
  9462. If set to 1, stitch the left and right row edges together.
  9463. This is the default behavior, for disabling set the value to 0.
  9464. @end table
  9465. @subsection Examples
  9466. @itemize
  9467. @item
  9468. Read the initial state from @file{pattern}, and specify an output of
  9469. size 200x400.
  9470. @example
  9471. cellauto=f=pattern:s=200x400
  9472. @end example
  9473. @item
  9474. Generate a random initial row with a width of 200 cells, with a fill
  9475. ratio of 2/3:
  9476. @example
  9477. cellauto=ratio=2/3:s=200x200
  9478. @end example
  9479. @item
  9480. Create a pattern generated by rule 18 starting by a single alive cell
  9481. centered on an initial row with width 100:
  9482. @example
  9483. cellauto=p=@@:s=100x400:full=0:rule=18
  9484. @end example
  9485. @item
  9486. Specify a more elaborated initial pattern:
  9487. @example
  9488. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  9489. @end example
  9490. @end itemize
  9491. @section mandelbrot
  9492. Generate a Mandelbrot set fractal, and progressively zoom towards the
  9493. point specified with @var{start_x} and @var{start_y}.
  9494. This source accepts the following options:
  9495. @table @option
  9496. @item end_pts
  9497. Set the terminal pts value. Default value is 400.
  9498. @item end_scale
  9499. Set the terminal scale value.
  9500. Must be a floating point value. Default value is 0.3.
  9501. @item inner
  9502. Set the inner coloring mode, that is the algorithm used to draw the
  9503. Mandelbrot fractal internal region.
  9504. It shall assume one of the following values:
  9505. @table @option
  9506. @item black
  9507. Set black mode.
  9508. @item convergence
  9509. Show time until convergence.
  9510. @item mincol
  9511. Set color based on point closest to the origin of the iterations.
  9512. @item period
  9513. Set period mode.
  9514. @end table
  9515. Default value is @var{mincol}.
  9516. @item bailout
  9517. Set the bailout value. Default value is 10.0.
  9518. @item maxiter
  9519. Set the maximum of iterations performed by the rendering
  9520. algorithm. Default value is 7189.
  9521. @item outer
  9522. Set outer coloring mode.
  9523. It shall assume one of following values:
  9524. @table @option
  9525. @item iteration_count
  9526. Set iteration cound mode.
  9527. @item normalized_iteration_count
  9528. set normalized iteration count mode.
  9529. @end table
  9530. Default value is @var{normalized_iteration_count}.
  9531. @item rate, r
  9532. Set frame rate, expressed as number of frames per second. Default
  9533. value is "25".
  9534. @item size, s
  9535. Set frame size. For the syntax of this option, check the "Video
  9536. size" section in the ffmpeg-utils manual. Default value is "640x480".
  9537. @item start_scale
  9538. Set the initial scale value. Default value is 3.0.
  9539. @item start_x
  9540. Set the initial x position. Must be a floating point value between
  9541. -100 and 100. Default value is -0.743643887037158704752191506114774.
  9542. @item start_y
  9543. Set the initial y position. Must be a floating point value between
  9544. -100 and 100. Default value is -0.131825904205311970493132056385139.
  9545. @end table
  9546. @section mptestsrc
  9547. Generate various test patterns, as generated by the MPlayer test filter.
  9548. The size of the generated video is fixed, and is 256x256.
  9549. This source is useful in particular for testing encoding features.
  9550. This source accepts the following options:
  9551. @table @option
  9552. @item rate, r
  9553. Specify the frame rate of the sourced video, as the number of frames
  9554. generated per second. It has to be a string in the format
  9555. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9556. number or a valid video frame rate abbreviation. The default value is
  9557. "25".
  9558. @item duration, d
  9559. Set the duration of the sourced video. See
  9560. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9561. for the accepted syntax.
  9562. If not specified, or the expressed duration is negative, the video is
  9563. supposed to be generated forever.
  9564. @item test, t
  9565. Set the number or the name of the test to perform. Supported tests are:
  9566. @table @option
  9567. @item dc_luma
  9568. @item dc_chroma
  9569. @item freq_luma
  9570. @item freq_chroma
  9571. @item amp_luma
  9572. @item amp_chroma
  9573. @item cbp
  9574. @item mv
  9575. @item ring1
  9576. @item ring2
  9577. @item all
  9578. @end table
  9579. Default value is "all", which will cycle through the list of all tests.
  9580. @end table
  9581. Some examples:
  9582. @example
  9583. mptestsrc=t=dc_luma
  9584. @end example
  9585. will generate a "dc_luma" test pattern.
  9586. @section frei0r_src
  9587. Provide a frei0r source.
  9588. To enable compilation of this filter you need to install the frei0r
  9589. header and configure FFmpeg with @code{--enable-frei0r}.
  9590. This source accepts the following parameters:
  9591. @table @option
  9592. @item size
  9593. The size of the video to generate. For the syntax of this option, check the
  9594. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9595. @item framerate
  9596. The framerate of the generated video. It may be a string of the form
  9597. @var{num}/@var{den} or a frame rate abbreviation.
  9598. @item filter_name
  9599. The name to the frei0r source to load. For more information regarding frei0r and
  9600. how to set the parameters, read the @ref{frei0r} section in the video filters
  9601. documentation.
  9602. @item filter_params
  9603. A '|'-separated list of parameters to pass to the frei0r source.
  9604. @end table
  9605. For example, to generate a frei0r partik0l source with size 200x200
  9606. and frame rate 10 which is overlaid on the overlay filter main input:
  9607. @example
  9608. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  9609. @end example
  9610. @section life
  9611. Generate a life pattern.
  9612. This source is based on a generalization of John Conway's life game.
  9613. The sourced input represents a life grid, each pixel represents a cell
  9614. which can be in one of two possible states, alive or dead. Every cell
  9615. interacts with its eight neighbours, which are the cells that are
  9616. horizontally, vertically, or diagonally adjacent.
  9617. At each interaction the grid evolves according to the adopted rule,
  9618. which specifies the number of neighbor alive cells which will make a
  9619. cell stay alive or born. The @option{rule} option allows one to specify
  9620. the rule to adopt.
  9621. This source accepts the following options:
  9622. @table @option
  9623. @item filename, f
  9624. Set the file from which to read the initial grid state. In the file,
  9625. each non-whitespace character is considered an alive cell, and newline
  9626. is used to delimit the end of each row.
  9627. If this option is not specified, the initial grid is generated
  9628. randomly.
  9629. @item rate, r
  9630. Set the video rate, that is the number of frames generated per second.
  9631. Default is 25.
  9632. @item random_fill_ratio, ratio
  9633. Set the random fill ratio for the initial random grid. It is a
  9634. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  9635. It is ignored when a file is specified.
  9636. @item random_seed, seed
  9637. Set the seed for filling the initial random grid, must be an integer
  9638. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9639. set to -1, the filter will try to use a good random seed on a best
  9640. effort basis.
  9641. @item rule
  9642. Set the life rule.
  9643. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  9644. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  9645. @var{NS} specifies the number of alive neighbor cells which make a
  9646. live cell stay alive, and @var{NB} the number of alive neighbor cells
  9647. which make a dead cell to become alive (i.e. to "born").
  9648. "s" and "b" can be used in place of "S" and "B", respectively.
  9649. Alternatively a rule can be specified by an 18-bits integer. The 9
  9650. high order bits are used to encode the next cell state if it is alive
  9651. for each number of neighbor alive cells, the low order bits specify
  9652. the rule for "borning" new cells. Higher order bits encode for an
  9653. higher number of neighbor cells.
  9654. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  9655. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  9656. Default value is "S23/B3", which is the original Conway's game of life
  9657. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  9658. cells, and will born a new cell if there are three alive cells around
  9659. a dead cell.
  9660. @item size, s
  9661. Set the size of the output video. For the syntax of this option, check the
  9662. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9663. If @option{filename} is specified, the size is set by default to the
  9664. same size of the input file. If @option{size} is set, it must contain
  9665. the size specified in the input file, and the initial grid defined in
  9666. that file is centered in the larger resulting area.
  9667. If a filename is not specified, the size value defaults to "320x240"
  9668. (used for a randomly generated initial grid).
  9669. @item stitch
  9670. If set to 1, stitch the left and right grid edges together, and the
  9671. top and bottom edges also. Defaults to 1.
  9672. @item mold
  9673. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  9674. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  9675. value from 0 to 255.
  9676. @item life_color
  9677. Set the color of living (or new born) cells.
  9678. @item death_color
  9679. Set the color of dead cells. If @option{mold} is set, this is the first color
  9680. used to represent a dead cell.
  9681. @item mold_color
  9682. Set mold color, for definitely dead and moldy cells.
  9683. For the syntax of these 3 color options, check the "Color" section in the
  9684. ffmpeg-utils manual.
  9685. @end table
  9686. @subsection Examples
  9687. @itemize
  9688. @item
  9689. Read a grid from @file{pattern}, and center it on a grid of size
  9690. 300x300 pixels:
  9691. @example
  9692. life=f=pattern:s=300x300
  9693. @end example
  9694. @item
  9695. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  9696. @example
  9697. life=ratio=2/3:s=200x200
  9698. @end example
  9699. @item
  9700. Specify a custom rule for evolving a randomly generated grid:
  9701. @example
  9702. life=rule=S14/B34
  9703. @end example
  9704. @item
  9705. Full example with slow death effect (mold) using @command{ffplay}:
  9706. @example
  9707. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  9708. @end example
  9709. @end itemize
  9710. @anchor{allrgb}
  9711. @anchor{allyuv}
  9712. @anchor{color}
  9713. @anchor{haldclutsrc}
  9714. @anchor{nullsrc}
  9715. @anchor{rgbtestsrc}
  9716. @anchor{smptebars}
  9717. @anchor{smptehdbars}
  9718. @anchor{testsrc}
  9719. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  9720. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  9721. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  9722. The @code{color} source provides an uniformly colored input.
  9723. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  9724. @ref{haldclut} filter.
  9725. The @code{nullsrc} source returns unprocessed video frames. It is
  9726. mainly useful to be employed in analysis / debugging tools, or as the
  9727. source for filters which ignore the input data.
  9728. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  9729. detecting RGB vs BGR issues. You should see a red, green and blue
  9730. stripe from top to bottom.
  9731. The @code{smptebars} source generates a color bars pattern, based on
  9732. the SMPTE Engineering Guideline EG 1-1990.
  9733. The @code{smptehdbars} source generates a color bars pattern, based on
  9734. the SMPTE RP 219-2002.
  9735. The @code{testsrc} source generates a test video pattern, showing a
  9736. color pattern, a scrolling gradient and a timestamp. This is mainly
  9737. intended for testing purposes.
  9738. The sources accept the following parameters:
  9739. @table @option
  9740. @item color, c
  9741. Specify the color of the source, only available in the @code{color}
  9742. source. For the syntax of this option, check the "Color" section in the
  9743. ffmpeg-utils manual.
  9744. @item level
  9745. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  9746. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  9747. pixels to be used as identity matrix for 3D lookup tables. Each component is
  9748. coded on a @code{1/(N*N)} scale.
  9749. @item size, s
  9750. Specify the size of the sourced video. For the syntax of this option, check the
  9751. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9752. The default value is @code{320x240}.
  9753. This option is not available with the @code{haldclutsrc} filter.
  9754. @item rate, r
  9755. Specify the frame rate of the sourced video, as the number of frames
  9756. generated per second. It has to be a string in the format
  9757. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9758. number or a valid video frame rate abbreviation. The default value is
  9759. "25".
  9760. @item sar
  9761. Set the sample aspect ratio of the sourced video.
  9762. @item duration, d
  9763. Set the duration of the sourced video. See
  9764. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9765. for the accepted syntax.
  9766. If not specified, or the expressed duration is negative, the video is
  9767. supposed to be generated forever.
  9768. @item decimals, n
  9769. Set the number of decimals to show in the timestamp, only available in the
  9770. @code{testsrc} source.
  9771. The displayed timestamp value will correspond to the original
  9772. timestamp value multiplied by the power of 10 of the specified
  9773. value. Default value is 0.
  9774. @end table
  9775. For example the following:
  9776. @example
  9777. testsrc=duration=5.3:size=qcif:rate=10
  9778. @end example
  9779. will generate a video with a duration of 5.3 seconds, with size
  9780. 176x144 and a frame rate of 10 frames per second.
  9781. The following graph description will generate a red source
  9782. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  9783. frames per second.
  9784. @example
  9785. color=c=red@@0.2:s=qcif:r=10
  9786. @end example
  9787. If the input content is to be ignored, @code{nullsrc} can be used. The
  9788. following command generates noise in the luminance plane by employing
  9789. the @code{geq} filter:
  9790. @example
  9791. nullsrc=s=256x256, geq=random(1)*255:128:128
  9792. @end example
  9793. @subsection Commands
  9794. The @code{color} source supports the following commands:
  9795. @table @option
  9796. @item c, color
  9797. Set the color of the created image. Accepts the same syntax of the
  9798. corresponding @option{color} option.
  9799. @end table
  9800. @c man end VIDEO SOURCES
  9801. @chapter Video Sinks
  9802. @c man begin VIDEO SINKS
  9803. Below is a description of the currently available video sinks.
  9804. @section buffersink
  9805. Buffer video frames, and make them available to the end of the filter
  9806. graph.
  9807. This sink is mainly intended for programmatic use, in particular
  9808. through the interface defined in @file{libavfilter/buffersink.h}
  9809. or the options system.
  9810. It accepts a pointer to an AVBufferSinkContext structure, which
  9811. defines the incoming buffers' formats, to be passed as the opaque
  9812. parameter to @code{avfilter_init_filter} for initialization.
  9813. @section nullsink
  9814. Null video sink: do absolutely nothing with the input video. It is
  9815. mainly useful as a template and for use in analysis / debugging
  9816. tools.
  9817. @c man end VIDEO SINKS
  9818. @chapter Multimedia Filters
  9819. @c man begin MULTIMEDIA FILTERS
  9820. Below is a description of the currently available multimedia filters.
  9821. @section aphasemeter
  9822. Convert input audio to a video output, displaying the audio phase.
  9823. The filter accepts the following options:
  9824. @table @option
  9825. @item rate, r
  9826. Set the output frame rate. Default value is @code{25}.
  9827. @item size, s
  9828. Set the video size for the output. For the syntax of this option, check the
  9829. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9830. Default value is @code{800x400}.
  9831. @item rc
  9832. @item gc
  9833. @item bc
  9834. Specify the red, green, blue contrast. Default values are @code{2},
  9835. @code{7} and @code{1}.
  9836. Allowed range is @code{[0, 255]}.
  9837. @item mpc
  9838. Set color which will be used for drawing median phase. If color is
  9839. @code{none} which is default, no median phase value will be drawn.
  9840. @end table
  9841. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  9842. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  9843. The @code{-1} means left and right channels are completely out of phase and
  9844. @code{1} means channels are in phase.
  9845. @section avectorscope
  9846. Convert input audio to a video output, representing the audio vector
  9847. scope.
  9848. The filter is used to measure the difference between channels of stereo
  9849. audio stream. A monoaural signal, consisting of identical left and right
  9850. signal, results in straight vertical line. Any stereo separation is visible
  9851. as a deviation from this line, creating a Lissajous figure.
  9852. If the straight (or deviation from it) but horizontal line appears this
  9853. indicates that the left and right channels are out of phase.
  9854. The filter accepts the following options:
  9855. @table @option
  9856. @item mode, m
  9857. Set the vectorscope mode.
  9858. Available values are:
  9859. @table @samp
  9860. @item lissajous
  9861. Lissajous rotated by 45 degrees.
  9862. @item lissajous_xy
  9863. Same as above but not rotated.
  9864. @item polar
  9865. Shape resembling half of circle.
  9866. @end table
  9867. Default value is @samp{lissajous}.
  9868. @item size, s
  9869. Set the video size for the output. For the syntax of this option, check the
  9870. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9871. Default value is @code{400x400}.
  9872. @item rate, r
  9873. Set the output frame rate. Default value is @code{25}.
  9874. @item rc
  9875. @item gc
  9876. @item bc
  9877. @item ac
  9878. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  9879. @code{160}, @code{80} and @code{255}.
  9880. Allowed range is @code{[0, 255]}.
  9881. @item rf
  9882. @item gf
  9883. @item bf
  9884. @item af
  9885. Specify the red, green, blue and alpha fade. Default values are @code{15},
  9886. @code{10}, @code{5} and @code{5}.
  9887. Allowed range is @code{[0, 255]}.
  9888. @item zoom
  9889. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  9890. @end table
  9891. @subsection Examples
  9892. @itemize
  9893. @item
  9894. Complete example using @command{ffplay}:
  9895. @example
  9896. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  9897. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  9898. @end example
  9899. @end itemize
  9900. @section concat
  9901. Concatenate audio and video streams, joining them together one after the
  9902. other.
  9903. The filter works on segments of synchronized video and audio streams. All
  9904. segments must have the same number of streams of each type, and that will
  9905. also be the number of streams at output.
  9906. The filter accepts the following options:
  9907. @table @option
  9908. @item n
  9909. Set the number of segments. Default is 2.
  9910. @item v
  9911. Set the number of output video streams, that is also the number of video
  9912. streams in each segment. Default is 1.
  9913. @item a
  9914. Set the number of output audio streams, that is also the number of audio
  9915. streams in each segment. Default is 0.
  9916. @item unsafe
  9917. Activate unsafe mode: do not fail if segments have a different format.
  9918. @end table
  9919. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  9920. @var{a} audio outputs.
  9921. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  9922. segment, in the same order as the outputs, then the inputs for the second
  9923. segment, etc.
  9924. Related streams do not always have exactly the same duration, for various
  9925. reasons including codec frame size or sloppy authoring. For that reason,
  9926. related synchronized streams (e.g. a video and its audio track) should be
  9927. concatenated at once. The concat filter will use the duration of the longest
  9928. stream in each segment (except the last one), and if necessary pad shorter
  9929. audio streams with silence.
  9930. For this filter to work correctly, all segments must start at timestamp 0.
  9931. All corresponding streams must have the same parameters in all segments; the
  9932. filtering system will automatically select a common pixel format for video
  9933. streams, and a common sample format, sample rate and channel layout for
  9934. audio streams, but other settings, such as resolution, must be converted
  9935. explicitly by the user.
  9936. Different frame rates are acceptable but will result in variable frame rate
  9937. at output; be sure to configure the output file to handle it.
  9938. @subsection Examples
  9939. @itemize
  9940. @item
  9941. Concatenate an opening, an episode and an ending, all in bilingual version
  9942. (video in stream 0, audio in streams 1 and 2):
  9943. @example
  9944. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  9945. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  9946. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  9947. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  9948. @end example
  9949. @item
  9950. Concatenate two parts, handling audio and video separately, using the
  9951. (a)movie sources, and adjusting the resolution:
  9952. @example
  9953. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  9954. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  9955. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  9956. @end example
  9957. Note that a desync will happen at the stitch if the audio and video streams
  9958. do not have exactly the same duration in the first file.
  9959. @end itemize
  9960. @anchor{ebur128}
  9961. @section ebur128
  9962. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  9963. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  9964. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  9965. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  9966. The filter also has a video output (see the @var{video} option) with a real
  9967. time graph to observe the loudness evolution. The graphic contains the logged
  9968. message mentioned above, so it is not printed anymore when this option is set,
  9969. unless the verbose logging is set. The main graphing area contains the
  9970. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  9971. the momentary loudness (400 milliseconds).
  9972. More information about the Loudness Recommendation EBU R128 on
  9973. @url{http://tech.ebu.ch/loudness}.
  9974. The filter accepts the following options:
  9975. @table @option
  9976. @item video
  9977. Activate the video output. The audio stream is passed unchanged whether this
  9978. option is set or no. The video stream will be the first output stream if
  9979. activated. Default is @code{0}.
  9980. @item size
  9981. Set the video size. This option is for video only. For the syntax of this
  9982. option, check the
  9983. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9984. Default and minimum resolution is @code{640x480}.
  9985. @item meter
  9986. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  9987. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  9988. other integer value between this range is allowed.
  9989. @item metadata
  9990. Set metadata injection. If set to @code{1}, the audio input will be segmented
  9991. into 100ms output frames, each of them containing various loudness information
  9992. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  9993. Default is @code{0}.
  9994. @item framelog
  9995. Force the frame logging level.
  9996. Available values are:
  9997. @table @samp
  9998. @item info
  9999. information logging level
  10000. @item verbose
  10001. verbose logging level
  10002. @end table
  10003. By default, the logging level is set to @var{info}. If the @option{video} or
  10004. the @option{metadata} options are set, it switches to @var{verbose}.
  10005. @item peak
  10006. Set peak mode(s).
  10007. Available modes can be cumulated (the option is a @code{flag} type). Possible
  10008. values are:
  10009. @table @samp
  10010. @item none
  10011. Disable any peak mode (default).
  10012. @item sample
  10013. Enable sample-peak mode.
  10014. Simple peak mode looking for the higher sample value. It logs a message
  10015. for sample-peak (identified by @code{SPK}).
  10016. @item true
  10017. Enable true-peak mode.
  10018. If enabled, the peak lookup is done on an over-sampled version of the input
  10019. stream for better peak accuracy. It logs a message for true-peak.
  10020. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  10021. This mode requires a build with @code{libswresample}.
  10022. @end table
  10023. @item dualmono
  10024. Treat mono input files as "dual mono". If a mono file is intended for playback
  10025. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  10026. If set to @code{true}, this option will compensate for this effect.
  10027. Multi-channel input files are not affected by this option.
  10028. @item panlaw
  10029. Set a specific pan law to be used for the measurement of dual mono files.
  10030. This parameter is optional, and has a default value of -3.01dB.
  10031. @end table
  10032. @subsection Examples
  10033. @itemize
  10034. @item
  10035. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  10036. @example
  10037. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  10038. @end example
  10039. @item
  10040. Run an analysis with @command{ffmpeg}:
  10041. @example
  10042. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  10043. @end example
  10044. @end itemize
  10045. @section interleave, ainterleave
  10046. Temporally interleave frames from several inputs.
  10047. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  10048. These filters read frames from several inputs and send the oldest
  10049. queued frame to the output.
  10050. Input streams must have a well defined, monotonically increasing frame
  10051. timestamp values.
  10052. In order to submit one frame to output, these filters need to enqueue
  10053. at least one frame for each input, so they cannot work in case one
  10054. input is not yet terminated and will not receive incoming frames.
  10055. For example consider the case when one input is a @code{select} filter
  10056. which always drop input frames. The @code{interleave} filter will keep
  10057. reading from that input, but it will never be able to send new frames
  10058. to output until the input will send an end-of-stream signal.
  10059. Also, depending on inputs synchronization, the filters will drop
  10060. frames in case one input receives more frames than the other ones, and
  10061. the queue is already filled.
  10062. These filters accept the following options:
  10063. @table @option
  10064. @item nb_inputs, n
  10065. Set the number of different inputs, it is 2 by default.
  10066. @end table
  10067. @subsection Examples
  10068. @itemize
  10069. @item
  10070. Interleave frames belonging to different streams using @command{ffmpeg}:
  10071. @example
  10072. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  10073. @end example
  10074. @item
  10075. Add flickering blur effect:
  10076. @example
  10077. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  10078. @end example
  10079. @end itemize
  10080. @section perms, aperms
  10081. Set read/write permissions for the output frames.
  10082. These filters are mainly aimed at developers to test direct path in the
  10083. following filter in the filtergraph.
  10084. The filters accept the following options:
  10085. @table @option
  10086. @item mode
  10087. Select the permissions mode.
  10088. It accepts the following values:
  10089. @table @samp
  10090. @item none
  10091. Do nothing. This is the default.
  10092. @item ro
  10093. Set all the output frames read-only.
  10094. @item rw
  10095. Set all the output frames directly writable.
  10096. @item toggle
  10097. Make the frame read-only if writable, and writable if read-only.
  10098. @item random
  10099. Set each output frame read-only or writable randomly.
  10100. @end table
  10101. @item seed
  10102. Set the seed for the @var{random} mode, must be an integer included between
  10103. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10104. @code{-1}, the filter will try to use a good random seed on a best effort
  10105. basis.
  10106. @end table
  10107. Note: in case of auto-inserted filter between the permission filter and the
  10108. following one, the permission might not be received as expected in that
  10109. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  10110. perms/aperms filter can avoid this problem.
  10111. @section realtime, arealtime
  10112. Slow down filtering to match real time approximatively.
  10113. These filters will pause the filtering for a variable amount of time to
  10114. match the output rate with the input timestamps.
  10115. They are similar to the @option{re} option to @code{ffmpeg}.
  10116. They accept the following options:
  10117. @table @option
  10118. @item limit
  10119. Time limit for the pauses. Any pause longer than that will be considered
  10120. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  10121. @end table
  10122. @section select, aselect
  10123. Select frames to pass in output.
  10124. This filter accepts the following options:
  10125. @table @option
  10126. @item expr, e
  10127. Set expression, which is evaluated for each input frame.
  10128. If the expression is evaluated to zero, the frame is discarded.
  10129. If the evaluation result is negative or NaN, the frame is sent to the
  10130. first output; otherwise it is sent to the output with index
  10131. @code{ceil(val)-1}, assuming that the input index starts from 0.
  10132. For example a value of @code{1.2} corresponds to the output with index
  10133. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  10134. @item outputs, n
  10135. Set the number of outputs. The output to which to send the selected
  10136. frame is based on the result of the evaluation. Default value is 1.
  10137. @end table
  10138. The expression can contain the following constants:
  10139. @table @option
  10140. @item n
  10141. The (sequential) number of the filtered frame, starting from 0.
  10142. @item selected_n
  10143. The (sequential) number of the selected frame, starting from 0.
  10144. @item prev_selected_n
  10145. The sequential number of the last selected frame. It's NAN if undefined.
  10146. @item TB
  10147. The timebase of the input timestamps.
  10148. @item pts
  10149. The PTS (Presentation TimeStamp) of the filtered video frame,
  10150. expressed in @var{TB} units. It's NAN if undefined.
  10151. @item t
  10152. The PTS of the filtered video frame,
  10153. expressed in seconds. It's NAN if undefined.
  10154. @item prev_pts
  10155. The PTS of the previously filtered video frame. It's NAN if undefined.
  10156. @item prev_selected_pts
  10157. The PTS of the last previously filtered video frame. It's NAN if undefined.
  10158. @item prev_selected_t
  10159. The PTS of the last previously selected video frame. It's NAN if undefined.
  10160. @item start_pts
  10161. The PTS of the first video frame in the video. It's NAN if undefined.
  10162. @item start_t
  10163. The time of the first video frame in the video. It's NAN if undefined.
  10164. @item pict_type @emph{(video only)}
  10165. The type of the filtered frame. It can assume one of the following
  10166. values:
  10167. @table @option
  10168. @item I
  10169. @item P
  10170. @item B
  10171. @item S
  10172. @item SI
  10173. @item SP
  10174. @item BI
  10175. @end table
  10176. @item interlace_type @emph{(video only)}
  10177. The frame interlace type. It can assume one of the following values:
  10178. @table @option
  10179. @item PROGRESSIVE
  10180. The frame is progressive (not interlaced).
  10181. @item TOPFIRST
  10182. The frame is top-field-first.
  10183. @item BOTTOMFIRST
  10184. The frame is bottom-field-first.
  10185. @end table
  10186. @item consumed_sample_n @emph{(audio only)}
  10187. the number of selected samples before the current frame
  10188. @item samples_n @emph{(audio only)}
  10189. the number of samples in the current frame
  10190. @item sample_rate @emph{(audio only)}
  10191. the input sample rate
  10192. @item key
  10193. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  10194. @item pos
  10195. the position in the file of the filtered frame, -1 if the information
  10196. is not available (e.g. for synthetic video)
  10197. @item scene @emph{(video only)}
  10198. value between 0 and 1 to indicate a new scene; a low value reflects a low
  10199. probability for the current frame to introduce a new scene, while a higher
  10200. value means the current frame is more likely to be one (see the example below)
  10201. @item concatdec_select
  10202. The concat demuxer can select only part of a concat input file by setting an
  10203. inpoint and an outpoint, but the output packets may not be entirely contained
  10204. in the selected interval. By using this variable, it is possible to skip frames
  10205. generated by the concat demuxer which are not exactly contained in the selected
  10206. interval.
  10207. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  10208. and the @var{lavf.concat.duration} packet metadata values which are also
  10209. present in the decoded frames.
  10210. The @var{concatdec_select} variable is -1 if the frame pts is at least
  10211. start_time and either the duration metadata is missing or the frame pts is less
  10212. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  10213. missing.
  10214. That basically means that an input frame is selected if its pts is within the
  10215. interval set by the concat demuxer.
  10216. @end table
  10217. The default value of the select expression is "1".
  10218. @subsection Examples
  10219. @itemize
  10220. @item
  10221. Select all frames in input:
  10222. @example
  10223. select
  10224. @end example
  10225. The example above is the same as:
  10226. @example
  10227. select=1
  10228. @end example
  10229. @item
  10230. Skip all frames:
  10231. @example
  10232. select=0
  10233. @end example
  10234. @item
  10235. Select only I-frames:
  10236. @example
  10237. select='eq(pict_type\,I)'
  10238. @end example
  10239. @item
  10240. Select one frame every 100:
  10241. @example
  10242. select='not(mod(n\,100))'
  10243. @end example
  10244. @item
  10245. Select only frames contained in the 10-20 time interval:
  10246. @example
  10247. select=between(t\,10\,20)
  10248. @end example
  10249. @item
  10250. Select only I frames contained in the 10-20 time interval:
  10251. @example
  10252. select=between(t\,10\,20)*eq(pict_type\,I)
  10253. @end example
  10254. @item
  10255. Select frames with a minimum distance of 10 seconds:
  10256. @example
  10257. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  10258. @end example
  10259. @item
  10260. Use aselect to select only audio frames with samples number > 100:
  10261. @example
  10262. aselect='gt(samples_n\,100)'
  10263. @end example
  10264. @item
  10265. Create a mosaic of the first scenes:
  10266. @example
  10267. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  10268. @end example
  10269. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  10270. choice.
  10271. @item
  10272. Send even and odd frames to separate outputs, and compose them:
  10273. @example
  10274. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  10275. @end example
  10276. @item
  10277. Select useful frames from an ffconcat file which is using inpoints and
  10278. outpoints but where the source files are not intra frame only.
  10279. @example
  10280. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  10281. @end example
  10282. @end itemize
  10283. @section selectivecolor
  10284. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10285. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10286. by the "purity" of the color (that is, how saturated it already is).
  10287. This filter is similar to the Adobe Photoshop Selective Color tool.
  10288. The filter accepts the following options:
  10289. @table @option
  10290. @item correction_method
  10291. Select color correction method.
  10292. Available values are:
  10293. @table @samp
  10294. @item absolute
  10295. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10296. component value).
  10297. @item relative
  10298. Specified adjustments are relative to the original component value.
  10299. @end table
  10300. Default is @code{absolute}.
  10301. @item reds
  10302. Adjustments for red pixels (pixels where the red component is the maximum)
  10303. @item yellows
  10304. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10305. @item greens
  10306. Adjustments for green pixels (pixels where the green component is the maximum)
  10307. @item cyans
  10308. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10309. @item blues
  10310. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10311. @item magentas
  10312. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10313. @item whites
  10314. Adjustments for white pixels (pixels where all components are greater than 128)
  10315. @item neutrals
  10316. Adjustments for all pixels except pure black and pure white
  10317. @item blacks
  10318. Adjustments for black pixels (pixels where all components are lesser than 128)
  10319. @item psfile
  10320. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10321. @end table
  10322. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10323. 4 space separated floating point adjustment values in the [-1,1] range,
  10324. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10325. pixels of its range.
  10326. @subsection Examples
  10327. @itemize
  10328. @item
  10329. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10330. increase magenta by 27% in blue areas:
  10331. @example
  10332. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10333. @end example
  10334. @item
  10335. Use a Photoshop selective color preset:
  10336. @example
  10337. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10338. @end example
  10339. @end itemize
  10340. @section sendcmd, asendcmd
  10341. Send commands to filters in the filtergraph.
  10342. These filters read commands to be sent to other filters in the
  10343. filtergraph.
  10344. @code{sendcmd} must be inserted between two video filters,
  10345. @code{asendcmd} must be inserted between two audio filters, but apart
  10346. from that they act the same way.
  10347. The specification of commands can be provided in the filter arguments
  10348. with the @var{commands} option, or in a file specified by the
  10349. @var{filename} option.
  10350. These filters accept the following options:
  10351. @table @option
  10352. @item commands, c
  10353. Set the commands to be read and sent to the other filters.
  10354. @item filename, f
  10355. Set the filename of the commands to be read and sent to the other
  10356. filters.
  10357. @end table
  10358. @subsection Commands syntax
  10359. A commands description consists of a sequence of interval
  10360. specifications, comprising a list of commands to be executed when a
  10361. particular event related to that interval occurs. The occurring event
  10362. is typically the current frame time entering or leaving a given time
  10363. interval.
  10364. An interval is specified by the following syntax:
  10365. @example
  10366. @var{START}[-@var{END}] @var{COMMANDS};
  10367. @end example
  10368. The time interval is specified by the @var{START} and @var{END} times.
  10369. @var{END} is optional and defaults to the maximum time.
  10370. The current frame time is considered within the specified interval if
  10371. it is included in the interval [@var{START}, @var{END}), that is when
  10372. the time is greater or equal to @var{START} and is lesser than
  10373. @var{END}.
  10374. @var{COMMANDS} consists of a sequence of one or more command
  10375. specifications, separated by ",", relating to that interval. The
  10376. syntax of a command specification is given by:
  10377. @example
  10378. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  10379. @end example
  10380. @var{FLAGS} is optional and specifies the type of events relating to
  10381. the time interval which enable sending the specified command, and must
  10382. be a non-null sequence of identifier flags separated by "+" or "|" and
  10383. enclosed between "[" and "]".
  10384. The following flags are recognized:
  10385. @table @option
  10386. @item enter
  10387. The command is sent when the current frame timestamp enters the
  10388. specified interval. In other words, the command is sent when the
  10389. previous frame timestamp was not in the given interval, and the
  10390. current is.
  10391. @item leave
  10392. The command is sent when the current frame timestamp leaves the
  10393. specified interval. In other words, the command is sent when the
  10394. previous frame timestamp was in the given interval, and the
  10395. current is not.
  10396. @end table
  10397. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  10398. assumed.
  10399. @var{TARGET} specifies the target of the command, usually the name of
  10400. the filter class or a specific filter instance name.
  10401. @var{COMMAND} specifies the name of the command for the target filter.
  10402. @var{ARG} is optional and specifies the optional list of argument for
  10403. the given @var{COMMAND}.
  10404. Between one interval specification and another, whitespaces, or
  10405. sequences of characters starting with @code{#} until the end of line,
  10406. are ignored and can be used to annotate comments.
  10407. A simplified BNF description of the commands specification syntax
  10408. follows:
  10409. @example
  10410. @var{COMMAND_FLAG} ::= "enter" | "leave"
  10411. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  10412. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  10413. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  10414. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  10415. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  10416. @end example
  10417. @subsection Examples
  10418. @itemize
  10419. @item
  10420. Specify audio tempo change at second 4:
  10421. @example
  10422. asendcmd=c='4.0 atempo tempo 1.5',atempo
  10423. @end example
  10424. @item
  10425. Specify a list of drawtext and hue commands in a file.
  10426. @example
  10427. # show text in the interval 5-10
  10428. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  10429. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  10430. # desaturate the image in the interval 15-20
  10431. 15.0-20.0 [enter] hue s 0,
  10432. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  10433. [leave] hue s 1,
  10434. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  10435. # apply an exponential saturation fade-out effect, starting from time 25
  10436. 25 [enter] hue s exp(25-t)
  10437. @end example
  10438. A filtergraph allowing to read and process the above command list
  10439. stored in a file @file{test.cmd}, can be specified with:
  10440. @example
  10441. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  10442. @end example
  10443. @end itemize
  10444. @anchor{setpts}
  10445. @section setpts, asetpts
  10446. Change the PTS (presentation timestamp) of the input frames.
  10447. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  10448. This filter accepts the following options:
  10449. @table @option
  10450. @item expr
  10451. The expression which is evaluated for each frame to construct its timestamp.
  10452. @end table
  10453. The expression is evaluated through the eval API and can contain the following
  10454. constants:
  10455. @table @option
  10456. @item FRAME_RATE
  10457. frame rate, only defined for constant frame-rate video
  10458. @item PTS
  10459. The presentation timestamp in input
  10460. @item N
  10461. The count of the input frame for video or the number of consumed samples,
  10462. not including the current frame for audio, starting from 0.
  10463. @item NB_CONSUMED_SAMPLES
  10464. The number of consumed samples, not including the current frame (only
  10465. audio)
  10466. @item NB_SAMPLES, S
  10467. The number of samples in the current frame (only audio)
  10468. @item SAMPLE_RATE, SR
  10469. The audio sample rate.
  10470. @item STARTPTS
  10471. The PTS of the first frame.
  10472. @item STARTT
  10473. the time in seconds of the first frame
  10474. @item INTERLACED
  10475. State whether the current frame is interlaced.
  10476. @item T
  10477. the time in seconds of the current frame
  10478. @item POS
  10479. original position in the file of the frame, or undefined if undefined
  10480. for the current frame
  10481. @item PREV_INPTS
  10482. The previous input PTS.
  10483. @item PREV_INT
  10484. previous input time in seconds
  10485. @item PREV_OUTPTS
  10486. The previous output PTS.
  10487. @item PREV_OUTT
  10488. previous output time in seconds
  10489. @item RTCTIME
  10490. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  10491. instead.
  10492. @item RTCSTART
  10493. The wallclock (RTC) time at the start of the movie in microseconds.
  10494. @item TB
  10495. The timebase of the input timestamps.
  10496. @end table
  10497. @subsection Examples
  10498. @itemize
  10499. @item
  10500. Start counting PTS from zero
  10501. @example
  10502. setpts=PTS-STARTPTS
  10503. @end example
  10504. @item
  10505. Apply fast motion effect:
  10506. @example
  10507. setpts=0.5*PTS
  10508. @end example
  10509. @item
  10510. Apply slow motion effect:
  10511. @example
  10512. setpts=2.0*PTS
  10513. @end example
  10514. @item
  10515. Set fixed rate of 25 frames per second:
  10516. @example
  10517. setpts=N/(25*TB)
  10518. @end example
  10519. @item
  10520. Set fixed rate 25 fps with some jitter:
  10521. @example
  10522. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  10523. @end example
  10524. @item
  10525. Apply an offset of 10 seconds to the input PTS:
  10526. @example
  10527. setpts=PTS+10/TB
  10528. @end example
  10529. @item
  10530. Generate timestamps from a "live source" and rebase onto the current timebase:
  10531. @example
  10532. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  10533. @end example
  10534. @item
  10535. Generate timestamps by counting samples:
  10536. @example
  10537. asetpts=N/SR/TB
  10538. @end example
  10539. @end itemize
  10540. @section settb, asettb
  10541. Set the timebase to use for the output frames timestamps.
  10542. It is mainly useful for testing timebase configuration.
  10543. It accepts the following parameters:
  10544. @table @option
  10545. @item expr, tb
  10546. The expression which is evaluated into the output timebase.
  10547. @end table
  10548. The value for @option{tb} is an arithmetic expression representing a
  10549. rational. The expression can contain the constants "AVTB" (the default
  10550. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  10551. audio only). Default value is "intb".
  10552. @subsection Examples
  10553. @itemize
  10554. @item
  10555. Set the timebase to 1/25:
  10556. @example
  10557. settb=expr=1/25
  10558. @end example
  10559. @item
  10560. Set the timebase to 1/10:
  10561. @example
  10562. settb=expr=0.1
  10563. @end example
  10564. @item
  10565. Set the timebase to 1001/1000:
  10566. @example
  10567. settb=1+0.001
  10568. @end example
  10569. @item
  10570. Set the timebase to 2*intb:
  10571. @example
  10572. settb=2*intb
  10573. @end example
  10574. @item
  10575. Set the default timebase value:
  10576. @example
  10577. settb=AVTB
  10578. @end example
  10579. @end itemize
  10580. @section showcqt
  10581. Convert input audio to a video output representing frequency spectrum
  10582. logarithmically using Brown-Puckette constant Q transform algorithm with
  10583. direct frequency domain coefficient calculation (but the transform itself
  10584. is not really constant Q, instead the Q factor is actually variable/clamped),
  10585. with musical tone scale, from E0 to D#10.
  10586. The filter accepts the following options:
  10587. @table @option
  10588. @item size, s
  10589. Specify the video size for the output. It must be even. For the syntax of this option,
  10590. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10591. Default value is @code{1920x1080}.
  10592. @item fps, rate, r
  10593. Set the output frame rate. Default value is @code{25}.
  10594. @item bar_h
  10595. Set the bargraph height. It must be even. Default value is @code{-1} which
  10596. computes the bargraph height automatically.
  10597. @item axis_h
  10598. Set the axis height. It must be even. Default value is @code{-1} which computes
  10599. the axis height automatically.
  10600. @item sono_h
  10601. Set the sonogram height. It must be even. Default value is @code{-1} which
  10602. computes the sonogram height automatically.
  10603. @item fullhd
  10604. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  10605. instead. Default value is @code{1}.
  10606. @item sono_v, volume
  10607. Specify the sonogram volume expression. It can contain variables:
  10608. @table @option
  10609. @item bar_v
  10610. the @var{bar_v} evaluated expression
  10611. @item frequency, freq, f
  10612. the frequency where it is evaluated
  10613. @item timeclamp, tc
  10614. the value of @var{timeclamp} option
  10615. @end table
  10616. and functions:
  10617. @table @option
  10618. @item a_weighting(f)
  10619. A-weighting of equal loudness
  10620. @item b_weighting(f)
  10621. B-weighting of equal loudness
  10622. @item c_weighting(f)
  10623. C-weighting of equal loudness.
  10624. @end table
  10625. Default value is @code{16}.
  10626. @item bar_v, volume2
  10627. Specify the bargraph volume expression. It can contain variables:
  10628. @table @option
  10629. @item sono_v
  10630. the @var{sono_v} evaluated expression
  10631. @item frequency, freq, f
  10632. the frequency where it is evaluated
  10633. @item timeclamp, tc
  10634. the value of @var{timeclamp} option
  10635. @end table
  10636. and functions:
  10637. @table @option
  10638. @item a_weighting(f)
  10639. A-weighting of equal loudness
  10640. @item b_weighting(f)
  10641. B-weighting of equal loudness
  10642. @item c_weighting(f)
  10643. C-weighting of equal loudness.
  10644. @end table
  10645. Default value is @code{sono_v}.
  10646. @item sono_g, gamma
  10647. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  10648. higher gamma makes the spectrum having more range. Default value is @code{3}.
  10649. Acceptable range is @code{[1, 7]}.
  10650. @item bar_g, gamma2
  10651. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  10652. @code{[1, 7]}.
  10653. @item timeclamp, tc
  10654. Specify the transform timeclamp. At low frequency, there is trade-off between
  10655. accuracy in time domain and frequency domain. If timeclamp is lower,
  10656. event in time domain is represented more accurately (such as fast bass drum),
  10657. otherwise event in frequency domain is represented more accurately
  10658. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  10659. @item basefreq
  10660. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  10661. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  10662. @item endfreq
  10663. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  10664. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  10665. @item coeffclamp
  10666. This option is deprecated and ignored.
  10667. @item tlength
  10668. Specify the transform length in time domain. Use this option to control accuracy
  10669. trade-off between time domain and frequency domain at every frequency sample.
  10670. It can contain variables:
  10671. @table @option
  10672. @item frequency, freq, f
  10673. the frequency where it is evaluated
  10674. @item timeclamp, tc
  10675. the value of @var{timeclamp} option.
  10676. @end table
  10677. Default value is @code{384*tc/(384+tc*f)}.
  10678. @item count
  10679. Specify the transform count for every video frame. Default value is @code{6}.
  10680. Acceptable range is @code{[1, 30]}.
  10681. @item fcount
  10682. Specify the transform count for every single pixel. Default value is @code{0},
  10683. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  10684. @item fontfile
  10685. Specify font file for use with freetype to draw the axis. If not specified,
  10686. use embedded font. Note that drawing with font file or embedded font is not
  10687. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  10688. option instead.
  10689. @item fontcolor
  10690. Specify font color expression. This is arithmetic expression that should return
  10691. integer value 0xRRGGBB. It can contain variables:
  10692. @table @option
  10693. @item frequency, freq, f
  10694. the frequency where it is evaluated
  10695. @item timeclamp, tc
  10696. the value of @var{timeclamp} option
  10697. @end table
  10698. and functions:
  10699. @table @option
  10700. @item midi(f)
  10701. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  10702. @item r(x), g(x), b(x)
  10703. red, green, and blue value of intensity x.
  10704. @end table
  10705. Default value is @code{st(0, (midi(f)-59.5)/12);
  10706. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  10707. r(1-ld(1)) + b(ld(1))}.
  10708. @item axisfile
  10709. Specify image file to draw the axis. This option override @var{fontfile} and
  10710. @var{fontcolor} option.
  10711. @item axis, text
  10712. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  10713. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  10714. Default value is @code{1}.
  10715. @end table
  10716. @subsection Examples
  10717. @itemize
  10718. @item
  10719. Playing audio while showing the spectrum:
  10720. @example
  10721. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  10722. @end example
  10723. @item
  10724. Same as above, but with frame rate 30 fps:
  10725. @example
  10726. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  10727. @end example
  10728. @item
  10729. Playing at 1280x720:
  10730. @example
  10731. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  10732. @end example
  10733. @item
  10734. Disable sonogram display:
  10735. @example
  10736. sono_h=0
  10737. @end example
  10738. @item
  10739. A1 and its harmonics: A1, A2, (near)E3, A3:
  10740. @example
  10741. 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),
  10742. asplit[a][out1]; [a] showcqt [out0]'
  10743. @end example
  10744. @item
  10745. Same as above, but with more accuracy in frequency domain:
  10746. @example
  10747. 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),
  10748. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  10749. @end example
  10750. @item
  10751. Custom volume:
  10752. @example
  10753. bar_v=10:sono_v=bar_v*a_weighting(f)
  10754. @end example
  10755. @item
  10756. Custom gamma, now spectrum is linear to the amplitude.
  10757. @example
  10758. bar_g=2:sono_g=2
  10759. @end example
  10760. @item
  10761. Custom tlength equation:
  10762. @example
  10763. tc=0.33:tlength='st(0,0.17); 384*tc / (384 / ld(0) + tc*f /(1-ld(0))) + 384*tc / (tc*f / ld(0) + 384 /(1-ld(0)))'
  10764. @end example
  10765. @item
  10766. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  10767. @example
  10768. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  10769. @end example
  10770. @item
  10771. Custom frequency range with custom axis using image file:
  10772. @example
  10773. axisfile=myaxis.png:basefreq=40:endfreq=10000
  10774. @end example
  10775. @end itemize
  10776. @section showfreqs
  10777. Convert input audio to video output representing the audio power spectrum.
  10778. Audio amplitude is on Y-axis while frequency is on X-axis.
  10779. The filter accepts the following options:
  10780. @table @option
  10781. @item size, s
  10782. Specify size of video. For the syntax of this option, check the
  10783. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10784. Default is @code{1024x512}.
  10785. @item mode
  10786. Set display mode.
  10787. This set how each frequency bin will be represented.
  10788. It accepts the following values:
  10789. @table @samp
  10790. @item line
  10791. @item bar
  10792. @item dot
  10793. @end table
  10794. Default is @code{bar}.
  10795. @item ascale
  10796. Set amplitude scale.
  10797. It accepts the following values:
  10798. @table @samp
  10799. @item lin
  10800. Linear scale.
  10801. @item sqrt
  10802. Square root scale.
  10803. @item cbrt
  10804. Cubic root scale.
  10805. @item log
  10806. Logarithmic scale.
  10807. @end table
  10808. Default is @code{log}.
  10809. @item fscale
  10810. Set frequency scale.
  10811. It accepts the following values:
  10812. @table @samp
  10813. @item lin
  10814. Linear scale.
  10815. @item log
  10816. Logarithmic scale.
  10817. @item rlog
  10818. Reverse logarithmic scale.
  10819. @end table
  10820. Default is @code{lin}.
  10821. @item win_size
  10822. Set window size.
  10823. It accepts the following values:
  10824. @table @samp
  10825. @item w16
  10826. @item w32
  10827. @item w64
  10828. @item w128
  10829. @item w256
  10830. @item w512
  10831. @item w1024
  10832. @item w2048
  10833. @item w4096
  10834. @item w8192
  10835. @item w16384
  10836. @item w32768
  10837. @item w65536
  10838. @end table
  10839. Default is @code{w2048}
  10840. @item win_func
  10841. Set windowing function.
  10842. It accepts the following values:
  10843. @table @samp
  10844. @item rect
  10845. @item bartlett
  10846. @item hanning
  10847. @item hamming
  10848. @item blackman
  10849. @item welch
  10850. @item flattop
  10851. @item bharris
  10852. @item bnuttall
  10853. @item bhann
  10854. @item sine
  10855. @item nuttall
  10856. @item lanczos
  10857. @item gauss
  10858. @end table
  10859. Default is @code{hanning}.
  10860. @item overlap
  10861. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  10862. which means optimal overlap for selected window function will be picked.
  10863. @item averaging
  10864. Set time averaging. Setting this to 0 will display current maximal peaks.
  10865. Default is @code{1}, which means time averaging is disabled.
  10866. @item colors
  10867. Specify list of colors separated by space or by '|' which will be used to
  10868. draw channel frequencies. Unrecognized or missing colors will be replaced
  10869. by white color.
  10870. @end table
  10871. @section showspectrum
  10872. Convert input audio to a video output, representing the audio frequency
  10873. spectrum.
  10874. The filter accepts the following options:
  10875. @table @option
  10876. @item size, s
  10877. Specify the video size for the output. For the syntax of this option, check the
  10878. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10879. Default value is @code{640x512}.
  10880. @item slide
  10881. Specify how the spectrum should slide along the window.
  10882. It accepts the following values:
  10883. @table @samp
  10884. @item replace
  10885. the samples start again on the left when they reach the right
  10886. @item scroll
  10887. the samples scroll from right to left
  10888. @item fullframe
  10889. frames are only produced when the samples reach the right
  10890. @end table
  10891. Default value is @code{replace}.
  10892. @item mode
  10893. Specify display mode.
  10894. It accepts the following values:
  10895. @table @samp
  10896. @item combined
  10897. all channels are displayed in the same row
  10898. @item separate
  10899. all channels are displayed in separate rows
  10900. @end table
  10901. Default value is @samp{combined}.
  10902. @item color
  10903. Specify display color mode.
  10904. It accepts the following values:
  10905. @table @samp
  10906. @item channel
  10907. each channel is displayed in a separate color
  10908. @item intensity
  10909. each channel is is displayed using the same color scheme
  10910. @end table
  10911. Default value is @samp{channel}.
  10912. @item scale
  10913. Specify scale used for calculating intensity color values.
  10914. It accepts the following values:
  10915. @table @samp
  10916. @item lin
  10917. linear
  10918. @item sqrt
  10919. square root, default
  10920. @item cbrt
  10921. cubic root
  10922. @item log
  10923. logarithmic
  10924. @end table
  10925. Default value is @samp{sqrt}.
  10926. @item saturation
  10927. Set saturation modifier for displayed colors. Negative values provide
  10928. alternative color scheme. @code{0} is no saturation at all.
  10929. Saturation must be in [-10.0, 10.0] range.
  10930. Default value is @code{1}.
  10931. @item win_func
  10932. Set window function.
  10933. It accepts the following values:
  10934. @table @samp
  10935. @item none
  10936. No samples pre-processing (do not expect this to be faster)
  10937. @item hann
  10938. Hann window
  10939. @item hamming
  10940. Hamming window
  10941. @item blackman
  10942. Blackman window
  10943. @end table
  10944. Default value is @code{hann}.
  10945. @end table
  10946. The usage is very similar to the showwaves filter; see the examples in that
  10947. section.
  10948. @subsection Examples
  10949. @itemize
  10950. @item
  10951. Large window with logarithmic color scaling:
  10952. @example
  10953. showspectrum=s=1280x480:scale=log
  10954. @end example
  10955. @item
  10956. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  10957. @example
  10958. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  10959. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  10960. @end example
  10961. @end itemize
  10962. @section showvolume
  10963. Convert input audio volume to a video output.
  10964. The filter accepts the following options:
  10965. @table @option
  10966. @item rate, r
  10967. Set video rate.
  10968. @item b
  10969. Set border width, allowed range is [0, 5]. Default is 1.
  10970. @item w
  10971. Set channel width, allowed range is [80, 1080]. Default is 400.
  10972. @item h
  10973. Set channel height, allowed range is [1, 100]. Default is 20.
  10974. @item f
  10975. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  10976. @item c
  10977. Set volume color expression.
  10978. The expression can use the following variables:
  10979. @table @option
  10980. @item VOLUME
  10981. Current max volume of channel in dB.
  10982. @item CHANNEL
  10983. Current channel number, starting from 0.
  10984. @end table
  10985. @item t
  10986. If set, displays channel names. Default is enabled.
  10987. @item v
  10988. If set, displays volume values. Default is enabled.
  10989. @end table
  10990. @section showwaves
  10991. Convert input audio to a video output, representing the samples waves.
  10992. The filter accepts the following options:
  10993. @table @option
  10994. @item size, s
  10995. Specify the video size for the output. For the syntax of this option, check the
  10996. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10997. Default value is @code{600x240}.
  10998. @item mode
  10999. Set display mode.
  11000. Available values are:
  11001. @table @samp
  11002. @item point
  11003. Draw a point for each sample.
  11004. @item line
  11005. Draw a vertical line for each sample.
  11006. @item p2p
  11007. Draw a point for each sample and a line between them.
  11008. @item cline
  11009. Draw a centered vertical line for each sample.
  11010. @end table
  11011. Default value is @code{point}.
  11012. @item n
  11013. Set the number of samples which are printed on the same column. A
  11014. larger value will decrease the frame rate. Must be a positive
  11015. integer. This option can be set only if the value for @var{rate}
  11016. is not explicitly specified.
  11017. @item rate, r
  11018. Set the (approximate) output frame rate. This is done by setting the
  11019. option @var{n}. Default value is "25".
  11020. @item split_channels
  11021. Set if channels should be drawn separately or overlap. Default value is 0.
  11022. @end table
  11023. @subsection Examples
  11024. @itemize
  11025. @item
  11026. Output the input file audio and the corresponding video representation
  11027. at the same time:
  11028. @example
  11029. amovie=a.mp3,asplit[out0],showwaves[out1]
  11030. @end example
  11031. @item
  11032. Create a synthetic signal and show it with showwaves, forcing a
  11033. frame rate of 30 frames per second:
  11034. @example
  11035. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  11036. @end example
  11037. @end itemize
  11038. @section showwavespic
  11039. Convert input audio to a single video frame, representing the samples waves.
  11040. The filter accepts the following options:
  11041. @table @option
  11042. @item size, s
  11043. Specify the video size for the output. For the syntax of this option, check the
  11044. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11045. Default value is @code{600x240}.
  11046. @item split_channels
  11047. Set if channels should be drawn separately or overlap. Default value is 0.
  11048. @end table
  11049. @subsection Examples
  11050. @itemize
  11051. @item
  11052. Extract a channel split representation of the wave form of a whole audio track
  11053. in a 1024x800 picture using @command{ffmpeg}:
  11054. @example
  11055. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  11056. @end example
  11057. @end itemize
  11058. @section split, asplit
  11059. Split input into several identical outputs.
  11060. @code{asplit} works with audio input, @code{split} with video.
  11061. The filter accepts a single parameter which specifies the number of outputs. If
  11062. unspecified, it defaults to 2.
  11063. @subsection Examples
  11064. @itemize
  11065. @item
  11066. Create two separate outputs from the same input:
  11067. @example
  11068. [in] split [out0][out1]
  11069. @end example
  11070. @item
  11071. To create 3 or more outputs, you need to specify the number of
  11072. outputs, like in:
  11073. @example
  11074. [in] asplit=3 [out0][out1][out2]
  11075. @end example
  11076. @item
  11077. Create two separate outputs from the same input, one cropped and
  11078. one padded:
  11079. @example
  11080. [in] split [splitout1][splitout2];
  11081. [splitout1] crop=100:100:0:0 [cropout];
  11082. [splitout2] pad=200:200:100:100 [padout];
  11083. @end example
  11084. @item
  11085. Create 5 copies of the input audio with @command{ffmpeg}:
  11086. @example
  11087. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  11088. @end example
  11089. @end itemize
  11090. @section zmq, azmq
  11091. Receive commands sent through a libzmq client, and forward them to
  11092. filters in the filtergraph.
  11093. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  11094. must be inserted between two video filters, @code{azmq} between two
  11095. audio filters.
  11096. To enable these filters you need to install the libzmq library and
  11097. headers and configure FFmpeg with @code{--enable-libzmq}.
  11098. For more information about libzmq see:
  11099. @url{http://www.zeromq.org/}
  11100. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  11101. receives messages sent through a network interface defined by the
  11102. @option{bind_address} option.
  11103. The received message must be in the form:
  11104. @example
  11105. @var{TARGET} @var{COMMAND} [@var{ARG}]
  11106. @end example
  11107. @var{TARGET} specifies the target of the command, usually the name of
  11108. the filter class or a specific filter instance name.
  11109. @var{COMMAND} specifies the name of the command for the target filter.
  11110. @var{ARG} is optional and specifies the optional argument list for the
  11111. given @var{COMMAND}.
  11112. Upon reception, the message is processed and the corresponding command
  11113. is injected into the filtergraph. Depending on the result, the filter
  11114. will send a reply to the client, adopting the format:
  11115. @example
  11116. @var{ERROR_CODE} @var{ERROR_REASON}
  11117. @var{MESSAGE}
  11118. @end example
  11119. @var{MESSAGE} is optional.
  11120. @subsection Examples
  11121. Look at @file{tools/zmqsend} for an example of a zmq client which can
  11122. be used to send commands processed by these filters.
  11123. Consider the following filtergraph generated by @command{ffplay}
  11124. @example
  11125. ffplay -dumpgraph 1 -f lavfi "
  11126. color=s=100x100:c=red [l];
  11127. color=s=100x100:c=blue [r];
  11128. nullsrc=s=200x100, zmq [bg];
  11129. [bg][l] overlay [bg+l];
  11130. [bg+l][r] overlay=x=100 "
  11131. @end example
  11132. To change the color of the left side of the video, the following
  11133. command can be used:
  11134. @example
  11135. echo Parsed_color_0 c yellow | tools/zmqsend
  11136. @end example
  11137. To change the right side:
  11138. @example
  11139. echo Parsed_color_1 c pink | tools/zmqsend
  11140. @end example
  11141. @c man end MULTIMEDIA FILTERS
  11142. @chapter Multimedia Sources
  11143. @c man begin MULTIMEDIA SOURCES
  11144. Below is a description of the currently available multimedia sources.
  11145. @section amovie
  11146. This is the same as @ref{movie} source, except it selects an audio
  11147. stream by default.
  11148. @anchor{movie}
  11149. @section movie
  11150. Read audio and/or video stream(s) from a movie container.
  11151. It accepts the following parameters:
  11152. @table @option
  11153. @item filename
  11154. The name of the resource to read (not necessarily a file; it can also be a
  11155. device or a stream accessed through some protocol).
  11156. @item format_name, f
  11157. Specifies the format assumed for the movie to read, and can be either
  11158. the name of a container or an input device. If not specified, the
  11159. format is guessed from @var{movie_name} or by probing.
  11160. @item seek_point, sp
  11161. Specifies the seek point in seconds. The frames will be output
  11162. starting from this seek point. The parameter is evaluated with
  11163. @code{av_strtod}, so the numerical value may be suffixed by an IS
  11164. postfix. The default value is "0".
  11165. @item streams, s
  11166. Specifies the streams to read. Several streams can be specified,
  11167. separated by "+". The source will then have as many outputs, in the
  11168. same order. The syntax is explained in the ``Stream specifiers''
  11169. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  11170. respectively the default (best suited) video and audio stream. Default
  11171. is "dv", or "da" if the filter is called as "amovie".
  11172. @item stream_index, si
  11173. Specifies the index of the video stream to read. If the value is -1,
  11174. the most suitable video stream will be automatically selected. The default
  11175. value is "-1". Deprecated. If the filter is called "amovie", it will select
  11176. audio instead of video.
  11177. @item loop
  11178. Specifies how many times to read the stream in sequence.
  11179. If the value is less than 1, the stream will be read again and again.
  11180. Default value is "1".
  11181. Note that when the movie is looped the source timestamps are not
  11182. changed, so it will generate non monotonically increasing timestamps.
  11183. @end table
  11184. It allows overlaying a second video on top of the main input of
  11185. a filtergraph, as shown in this graph:
  11186. @example
  11187. input -----------> deltapts0 --> overlay --> output
  11188. ^
  11189. |
  11190. movie --> scale--> deltapts1 -------+
  11191. @end example
  11192. @subsection Examples
  11193. @itemize
  11194. @item
  11195. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  11196. on top of the input labelled "in":
  11197. @example
  11198. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11199. [in] setpts=PTS-STARTPTS [main];
  11200. [main][over] overlay=16:16 [out]
  11201. @end example
  11202. @item
  11203. Read from a video4linux2 device, and overlay it on top of the input
  11204. labelled "in":
  11205. @example
  11206. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11207. [in] setpts=PTS-STARTPTS [main];
  11208. [main][over] overlay=16:16 [out]
  11209. @end example
  11210. @item
  11211. Read the first video stream and the audio stream with id 0x81 from
  11212. dvd.vob; the video is connected to the pad named "video" and the audio is
  11213. connected to the pad named "audio":
  11214. @example
  11215. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  11216. @end example
  11217. @end itemize
  11218. @c man end MULTIMEDIA SOURCES