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.

14752 lines
404KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program.
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section adelay
  353. Delay one or more audio channels.
  354. Samples in delayed channel are filled with silence.
  355. The filter accepts the following option:
  356. @table @option
  357. @item delays
  358. Set list of delays in milliseconds for each channel separated by '|'.
  359. At least one delay greater than 0 should be provided.
  360. Unused delays will be silently ignored. If number of given delays is
  361. smaller than number of channels all remaining channels will not be delayed.
  362. @end table
  363. @subsection Examples
  364. @itemize
  365. @item
  366. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  367. the second channel (and any other channels that may be present) unchanged.
  368. @example
  369. adelay=1500|0|500
  370. @end example
  371. @end itemize
  372. @section aecho
  373. Apply echoing to the input audio.
  374. Echoes are reflected sound and can occur naturally amongst mountains
  375. (and sometimes large buildings) when talking or shouting; digital echo
  376. effects emulate this behaviour and are often used to help fill out the
  377. sound of a single instrument or vocal. The time difference between the
  378. original signal and the reflection is the @code{delay}, and the
  379. loudness of the reflected signal is the @code{decay}.
  380. Multiple echoes can have different delays and decays.
  381. A description of the accepted parameters follows.
  382. @table @option
  383. @item in_gain
  384. Set input gain of reflected signal. Default is @code{0.6}.
  385. @item out_gain
  386. Set output gain of reflected signal. Default is @code{0.3}.
  387. @item delays
  388. Set list of time intervals in milliseconds between original signal and reflections
  389. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  390. Default is @code{1000}.
  391. @item decays
  392. Set list of loudnesses of reflected signals separated by '|'.
  393. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  394. Default is @code{0.5}.
  395. @end table
  396. @subsection Examples
  397. @itemize
  398. @item
  399. Make it sound as if there are twice as many instruments as are actually playing:
  400. @example
  401. aecho=0.8:0.88:60:0.4
  402. @end example
  403. @item
  404. If delay is very short, then it sound like a (metallic) robot playing music:
  405. @example
  406. aecho=0.8:0.88:6:0.4
  407. @end example
  408. @item
  409. A longer delay will sound like an open air concert in the mountains:
  410. @example
  411. aecho=0.8:0.9:1000:0.3
  412. @end example
  413. @item
  414. Same as above but with one more mountain:
  415. @example
  416. aecho=0.8:0.9:1000|1800:0.3|0.25
  417. @end example
  418. @end itemize
  419. @section aemphasis
  420. Audio emphasis filter creates or restores material directly taken from LPs or
  421. emphased CDs with different filter curves. E.g. to store music on vinyl the
  422. signal has to be altered by a filter first to even out the disadvantages of
  423. this recording medium.
  424. Once the material is played back the inverse filter has to be applied to
  425. restore the distortion of the frequency response.
  426. The filter accepts the following options:
  427. @table @option
  428. @item level_in
  429. Set input gain.
  430. @item level_out
  431. Set output gain.
  432. @item mode
  433. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  434. use @code{production} mode. Default is @code{reproduction} mode.
  435. @item type
  436. Set filter type. Selects medium. Can be one of the following:
  437. @table @option
  438. @item col
  439. select Columbia.
  440. @item emi
  441. select EMI.
  442. @item bsi
  443. select BSI (78RPM).
  444. @item riaa
  445. select RIAA.
  446. @item cd
  447. select Compact Disc (CD).
  448. @item 50fm
  449. select 50µs (FM).
  450. @item 75fm
  451. select 75µs (FM).
  452. @item 50kf
  453. select 50µs (FM-KF).
  454. @item 75kf
  455. select 75µs (FM-KF).
  456. @end table
  457. @end table
  458. @section aeval
  459. Modify an audio signal according to the specified expressions.
  460. This filter accepts one or more expressions (one for each channel),
  461. which are evaluated and used to modify a corresponding audio signal.
  462. It accepts the following parameters:
  463. @table @option
  464. @item exprs
  465. Set the '|'-separated expressions list for each separate channel. If
  466. the number of input channels is greater than the number of
  467. expressions, the last specified expression is used for the remaining
  468. output channels.
  469. @item channel_layout, c
  470. Set output channel layout. If not specified, the channel layout is
  471. specified by the number of expressions. If set to @samp{same}, it will
  472. use by default the same input channel layout.
  473. @end table
  474. Each expression in @var{exprs} can contain the following constants and functions:
  475. @table @option
  476. @item ch
  477. channel number of the current expression
  478. @item n
  479. number of the evaluated sample, starting from 0
  480. @item s
  481. sample rate
  482. @item t
  483. time of the evaluated sample expressed in seconds
  484. @item nb_in_channels
  485. @item nb_out_channels
  486. input and output number of channels
  487. @item val(CH)
  488. the value of input channel with number @var{CH}
  489. @end table
  490. Note: this filter is slow. For faster processing you should use a
  491. dedicated filter.
  492. @subsection Examples
  493. @itemize
  494. @item
  495. Half volume:
  496. @example
  497. aeval=val(ch)/2:c=same
  498. @end example
  499. @item
  500. Invert phase of the second channel:
  501. @example
  502. aeval=val(0)|-val(1)
  503. @end example
  504. @end itemize
  505. @anchor{afade}
  506. @section afade
  507. Apply fade-in/out effect to input audio.
  508. A description of the accepted parameters follows.
  509. @table @option
  510. @item type, t
  511. Specify the effect type, can be either @code{in} for fade-in, or
  512. @code{out} for a fade-out effect. Default is @code{in}.
  513. @item start_sample, ss
  514. Specify the number of the start sample for starting to apply the fade
  515. effect. Default is 0.
  516. @item nb_samples, ns
  517. Specify the number of samples for which the fade effect has to last. At
  518. the end of the fade-in effect the output audio will have the same
  519. volume as the input audio, at the end of the fade-out transition
  520. the output audio will be silence. Default is 44100.
  521. @item start_time, st
  522. Specify the start time of the fade effect. Default is 0.
  523. The value must be specified as a time duration; see
  524. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  525. for the accepted syntax.
  526. If set this option is used instead of @var{start_sample}.
  527. @item duration, d
  528. Specify the duration of the fade effect. See
  529. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  530. for the accepted syntax.
  531. At the end of the fade-in effect the output audio will have the same
  532. volume as the input audio, at the end of the fade-out transition
  533. the output audio will be silence.
  534. By default the duration is determined by @var{nb_samples}.
  535. If set this option is used instead of @var{nb_samples}.
  536. @item curve
  537. Set curve for fade transition.
  538. It accepts the following values:
  539. @table @option
  540. @item tri
  541. select triangular, linear slope (default)
  542. @item qsin
  543. select quarter of sine wave
  544. @item hsin
  545. select half of sine wave
  546. @item esin
  547. select exponential sine wave
  548. @item log
  549. select logarithmic
  550. @item ipar
  551. select inverted parabola
  552. @item qua
  553. select quadratic
  554. @item cub
  555. select cubic
  556. @item squ
  557. select square root
  558. @item cbr
  559. select cubic root
  560. @item par
  561. select parabola
  562. @item exp
  563. select exponential
  564. @item iqsin
  565. select inverted quarter of sine wave
  566. @item ihsin
  567. select inverted half of sine wave
  568. @item dese
  569. select double-exponential seat
  570. @item desi
  571. select double-exponential sigmoid
  572. @end table
  573. @end table
  574. @subsection Examples
  575. @itemize
  576. @item
  577. Fade in first 15 seconds of audio:
  578. @example
  579. afade=t=in:ss=0:d=15
  580. @end example
  581. @item
  582. Fade out last 25 seconds of a 900 seconds audio:
  583. @example
  584. afade=t=out:st=875:d=25
  585. @end example
  586. @end itemize
  587. @anchor{aformat}
  588. @section aformat
  589. Set output format constraints for the input audio. The framework will
  590. negotiate the most appropriate format to minimize conversions.
  591. It accepts the following parameters:
  592. @table @option
  593. @item sample_fmts
  594. A '|'-separated list of requested sample formats.
  595. @item sample_rates
  596. A '|'-separated list of requested sample rates.
  597. @item channel_layouts
  598. A '|'-separated list of requested channel layouts.
  599. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  600. for the required syntax.
  601. @end table
  602. If a parameter is omitted, all values are allowed.
  603. Force the output to either unsigned 8-bit or signed 16-bit stereo
  604. @example
  605. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  606. @end example
  607. @section agate
  608. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  609. processing reduces disturbing noise between useful signals.
  610. Gating is done by detecting the volume below a chosen level @var{threshold}
  611. and divide it by the factor set with @var{ratio}. The bottom of the noise
  612. floor is set via @var{range}. Because an exact manipulation of the signal
  613. would cause distortion of the waveform the reduction can be levelled over
  614. time. This is done by setting @var{attack} and @var{release}.
  615. @var{attack} determines how long the signal has to fall below the threshold
  616. before any reduction will occur and @var{release} sets the time the signal
  617. has to raise above the threshold to reduce the reduction again.
  618. Shorter signals than the chosen attack time will be left untouched.
  619. @table @option
  620. @item level_in
  621. Set input level before filtering.
  622. Default is 1. Allowed range is from 0.015625 to 64.
  623. @item range
  624. Set the level of gain reduction when the signal is below the threshold.
  625. Default is 0.06125. Allowed range is from 0 to 1.
  626. @item threshold
  627. If a signal rises above this level the gain reduction is released.
  628. Default is 0.125. Allowed range is from 0 to 1.
  629. @item ratio
  630. Set a ratio about which the signal is reduced.
  631. Default is 2. Allowed range is from 1 to 9000.
  632. @item attack
  633. Amount of milliseconds the signal has to rise above the threshold before gain
  634. reduction stops.
  635. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  636. @item release
  637. Amount of milliseconds the signal has to fall below the threshold before the
  638. reduction is increased again. Default is 250 milliseconds.
  639. Allowed range is from 0.01 to 9000.
  640. @item makeup
  641. Set amount of amplification of signal after processing.
  642. Default is 1. Allowed range is from 1 to 64.
  643. @item knee
  644. Curve the sharp knee around the threshold to enter gain reduction more softly.
  645. Default is 2.828427125. Allowed range is from 1 to 8.
  646. @item detection
  647. Choose if exact signal should be taken for detection or an RMS like one.
  648. Default is rms. Can be peak or rms.
  649. @item link
  650. Choose if the average level between all channels or the louder channel affects
  651. the reduction.
  652. Default is average. Can be average or maximum.
  653. @end table
  654. @section alimiter
  655. The limiter prevents input signal from raising over a desired threshold.
  656. This limiter uses lookahead technology to prevent your signal from distorting.
  657. It means that there is a small delay after signal is processed. Keep in mind
  658. that the delay it produces is the attack time you set.
  659. The filter accepts the following options:
  660. @table @option
  661. @item level_in
  662. Set input gain. Default is 1.
  663. @item level_out
  664. Set output gain. Default is 1.
  665. @item limit
  666. Don't let signals above this level pass the limiter. Default is 1.
  667. @item attack
  668. The limiter will reach its attenuation level in this amount of time in
  669. milliseconds. Default is 5 milliseconds.
  670. @item release
  671. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  672. Default is 50 milliseconds.
  673. @item asc
  674. When gain reduction is always needed ASC takes care of releasing to an
  675. average reduction level rather than reaching a reduction of 0 in the release
  676. time.
  677. @item asc_level
  678. Select how much the release time is affected by ASC, 0 means nearly no changes
  679. in release time while 1 produces higher release times.
  680. @item level
  681. Auto level output signal. Default is enabled.
  682. This normalizes audio back to 0dB if enabled.
  683. @end table
  684. Depending on picked setting it is recommended to upsample input 2x or 4x times
  685. with @ref{aresample} before applying this filter.
  686. @section allpass
  687. Apply a two-pole all-pass filter with central frequency (in Hz)
  688. @var{frequency}, and filter-width @var{width}.
  689. An all-pass filter changes the audio's frequency to phase relationship
  690. without changing its frequency to amplitude relationship.
  691. The filter accepts the following options:
  692. @table @option
  693. @item frequency, f
  694. Set frequency in Hz.
  695. @item width_type
  696. Set method to specify band-width of filter.
  697. @table @option
  698. @item h
  699. Hz
  700. @item q
  701. Q-Factor
  702. @item o
  703. octave
  704. @item s
  705. slope
  706. @end table
  707. @item width, w
  708. Specify the band-width of a filter in width_type units.
  709. @end table
  710. @anchor{amerge}
  711. @section amerge
  712. Merge two or more audio streams into a single multi-channel stream.
  713. The filter accepts the following options:
  714. @table @option
  715. @item inputs
  716. Set the number of inputs. Default is 2.
  717. @end table
  718. If the channel layouts of the inputs are disjoint, and therefore compatible,
  719. the channel layout of the output will be set accordingly and the channels
  720. will be reordered as necessary. If the channel layouts of the inputs are not
  721. disjoint, the output will have all the channels of the first input then all
  722. the channels of the second input, in that order, and the channel layout of
  723. the output will be the default value corresponding to the total number of
  724. channels.
  725. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  726. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  727. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  728. first input, b1 is the first channel of the second input).
  729. On the other hand, if both input are in stereo, the output channels will be
  730. in the default order: a1, a2, b1, b2, and the channel layout will be
  731. arbitrarily set to 4.0, which may or may not be the expected value.
  732. All inputs must have the same sample rate, and format.
  733. If inputs do not have the same duration, the output will stop with the
  734. shortest.
  735. @subsection Examples
  736. @itemize
  737. @item
  738. Merge two mono files into a stereo stream:
  739. @example
  740. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  741. @end example
  742. @item
  743. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  744. @example
  745. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  746. @end example
  747. @end itemize
  748. @section amix
  749. Mixes multiple audio inputs into a single output.
  750. Note that this filter only supports float samples (the @var{amerge}
  751. and @var{pan} audio filters support many formats). If the @var{amix}
  752. input has integer samples then @ref{aresample} will be automatically
  753. inserted to perform the conversion to float samples.
  754. For example
  755. @example
  756. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  757. @end example
  758. will mix 3 input audio streams to a single output with the same duration as the
  759. first input and a dropout transition time of 3 seconds.
  760. It accepts the following parameters:
  761. @table @option
  762. @item inputs
  763. The number of inputs. If unspecified, it defaults to 2.
  764. @item duration
  765. How to determine the end-of-stream.
  766. @table @option
  767. @item longest
  768. The duration of the longest input. (default)
  769. @item shortest
  770. The duration of the shortest input.
  771. @item first
  772. The duration of the first input.
  773. @end table
  774. @item dropout_transition
  775. The transition time, in seconds, for volume renormalization when an input
  776. stream ends. The default value is 2 seconds.
  777. @end table
  778. @section anull
  779. Pass the audio source unchanged to the output.
  780. @section apad
  781. Pad the end of an audio stream with silence.
  782. This can be used together with @command{ffmpeg} @option{-shortest} to
  783. extend audio streams to the same length as the video stream.
  784. A description of the accepted options follows.
  785. @table @option
  786. @item packet_size
  787. Set silence packet size. Default value is 4096.
  788. @item pad_len
  789. Set the number of samples of silence to add to the end. After the
  790. value is reached, the stream is terminated. This option is mutually
  791. exclusive with @option{whole_len}.
  792. @item whole_len
  793. Set the minimum total number of samples in the output audio stream. If
  794. the value is longer than the input audio length, silence is added to
  795. the end, until the value is reached. This option is mutually exclusive
  796. with @option{pad_len}.
  797. @end table
  798. If neither the @option{pad_len} nor the @option{whole_len} option is
  799. set, the filter will add silence to the end of the input stream
  800. indefinitely.
  801. @subsection Examples
  802. @itemize
  803. @item
  804. Add 1024 samples of silence to the end of the input:
  805. @example
  806. apad=pad_len=1024
  807. @end example
  808. @item
  809. Make sure the audio output will contain at least 10000 samples, pad
  810. the input with silence if required:
  811. @example
  812. apad=whole_len=10000
  813. @end example
  814. @item
  815. Use @command{ffmpeg} to pad the audio input with silence, so that the
  816. video stream will always result the shortest and will be converted
  817. until the end in the output file when using the @option{shortest}
  818. option:
  819. @example
  820. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  821. @end example
  822. @end itemize
  823. @section aphaser
  824. Add a phasing effect to the input audio.
  825. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  826. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  827. A description of the accepted parameters follows.
  828. @table @option
  829. @item in_gain
  830. Set input gain. Default is 0.4.
  831. @item out_gain
  832. Set output gain. Default is 0.74
  833. @item delay
  834. Set delay in milliseconds. Default is 3.0.
  835. @item decay
  836. Set decay. Default is 0.4.
  837. @item speed
  838. Set modulation speed in Hz. Default is 0.5.
  839. @item type
  840. Set modulation type. Default is triangular.
  841. It accepts the following values:
  842. @table @samp
  843. @item triangular, t
  844. @item sinusoidal, s
  845. @end table
  846. @end table
  847. @section apulsator
  848. Audio pulsator is something between an autopanner and a tremolo.
  849. But it can produce funny stereo effects as well. Pulsator changes the volume
  850. of the left and right channel based on a LFO (low frequency oscillator) with
  851. different waveforms and shifted phases.
  852. This filter have the ability to define an offset between left and right
  853. channel. An offset of 0 means that both LFO shapes match each other.
  854. The left and right channel are altered equally - a conventional tremolo.
  855. An offset of 50% means that the shape of the right channel is exactly shifted
  856. in phase (or moved backwards about half of the frequency) - pulsator acts as
  857. an autopanner. At 1 both curves match again. Every setting in between moves the
  858. phase shift gapless between all stages and produces some "bypassing" sounds with
  859. sine and triangle waveforms. The more you set the offset near 1 (starting from
  860. the 0.5) the faster the signal passes from the left to the right speaker.
  861. The filter accepts the following options:
  862. @table @option
  863. @item level_in
  864. Set input gain. By default it is 1. Range is [0.015625 - 64].
  865. @item level_out
  866. Set output gain. By default it is 1. Range is [0.015625 - 64].
  867. @item mode
  868. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  869. sawup or sawdown. Default is sine.
  870. @item amount
  871. Set modulation. Define how much of original signal is affected by the LFO.
  872. @item offset_l
  873. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  874. @item offset_r
  875. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  876. @item width
  877. Set pulse width. Default is 1. Allowed range is [0 - 2].
  878. @item timing
  879. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  880. @item bpm
  881. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  882. is set to bpm.
  883. @item ms
  884. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  885. is set to ms.
  886. @item hz
  887. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  888. if timing is set to hz.
  889. @end table
  890. @anchor{aresample}
  891. @section aresample
  892. Resample the input audio to the specified parameters, using the
  893. libswresample library. If none are specified then the filter will
  894. automatically convert between its input and output.
  895. This filter is also able to stretch/squeeze the audio data to make it match
  896. the timestamps or to inject silence / cut out audio to make it match the
  897. timestamps, do a combination of both or do neither.
  898. The filter accepts the syntax
  899. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  900. expresses a sample rate and @var{resampler_options} is a list of
  901. @var{key}=@var{value} pairs, separated by ":". See the
  902. ffmpeg-resampler manual for the complete list of supported options.
  903. @subsection Examples
  904. @itemize
  905. @item
  906. Resample the input audio to 44100Hz:
  907. @example
  908. aresample=44100
  909. @end example
  910. @item
  911. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  912. samples per second compensation:
  913. @example
  914. aresample=async=1000
  915. @end example
  916. @end itemize
  917. @section asetnsamples
  918. Set the number of samples per each output audio frame.
  919. The last output packet may contain a different number of samples, as
  920. the filter will flush all the remaining samples when the input audio
  921. signal its end.
  922. The filter accepts the following options:
  923. @table @option
  924. @item nb_out_samples, n
  925. Set the number of frames per each output audio frame. The number is
  926. intended as the number of samples @emph{per each channel}.
  927. Default value is 1024.
  928. @item pad, p
  929. If set to 1, the filter will pad the last audio frame with zeroes, so
  930. that the last frame will contain the same number of samples as the
  931. previous ones. Default value is 1.
  932. @end table
  933. For example, to set the number of per-frame samples to 1234 and
  934. disable padding for the last frame, use:
  935. @example
  936. asetnsamples=n=1234:p=0
  937. @end example
  938. @section asetrate
  939. Set the sample rate without altering the PCM data.
  940. This will result in a change of speed and pitch.
  941. The filter accepts the following options:
  942. @table @option
  943. @item sample_rate, r
  944. Set the output sample rate. Default is 44100 Hz.
  945. @end table
  946. @section ashowinfo
  947. Show a line containing various information for each input audio frame.
  948. The input audio is not modified.
  949. The shown line contains a sequence of key/value pairs of the form
  950. @var{key}:@var{value}.
  951. The following values are shown in the output:
  952. @table @option
  953. @item n
  954. The (sequential) number of the input frame, starting from 0.
  955. @item pts
  956. The presentation timestamp of the input frame, in time base units; the time base
  957. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  958. @item pts_time
  959. The presentation timestamp of the input frame in seconds.
  960. @item pos
  961. position of the frame in the input stream, -1 if this information in
  962. unavailable and/or meaningless (for example in case of synthetic audio)
  963. @item fmt
  964. The sample format.
  965. @item chlayout
  966. The channel layout.
  967. @item rate
  968. The sample rate for the audio frame.
  969. @item nb_samples
  970. The number of samples (per channel) in the frame.
  971. @item checksum
  972. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  973. audio, the data is treated as if all the planes were concatenated.
  974. @item plane_checksums
  975. A list of Adler-32 checksums for each data plane.
  976. @end table
  977. @anchor{astats}
  978. @section astats
  979. Display time domain statistical information about the audio channels.
  980. Statistics are calculated and displayed for each audio channel and,
  981. where applicable, an overall figure is also given.
  982. It accepts the following option:
  983. @table @option
  984. @item length
  985. Short window length in seconds, used for peak and trough RMS measurement.
  986. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  987. @item metadata
  988. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  989. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  990. disabled.
  991. Available keys for each channel are:
  992. DC_offset
  993. Min_level
  994. Max_level
  995. Min_difference
  996. Max_difference
  997. Mean_difference
  998. Peak_level
  999. RMS_peak
  1000. RMS_trough
  1001. Crest_factor
  1002. Flat_factor
  1003. Peak_count
  1004. Bit_depth
  1005. and for Overall:
  1006. DC_offset
  1007. Min_level
  1008. Max_level
  1009. Min_difference
  1010. Max_difference
  1011. Mean_difference
  1012. Peak_level
  1013. RMS_level
  1014. RMS_peak
  1015. RMS_trough
  1016. Flat_factor
  1017. Peak_count
  1018. Bit_depth
  1019. Number_of_samples
  1020. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1021. this @code{lavfi.astats.Overall.Peak_count}.
  1022. For description what each key means read below.
  1023. @item reset
  1024. Set number of frame after which stats are going to be recalculated.
  1025. Default is disabled.
  1026. @end table
  1027. A description of each shown parameter follows:
  1028. @table @option
  1029. @item DC offset
  1030. Mean amplitude displacement from zero.
  1031. @item Min level
  1032. Minimal sample level.
  1033. @item Max level
  1034. Maximal sample level.
  1035. @item Min difference
  1036. Minimal difference between two consecutive samples.
  1037. @item Max difference
  1038. Maximal difference between two consecutive samples.
  1039. @item Mean difference
  1040. Mean difference between two consecutive samples.
  1041. The average of each difference between two consecutive samples.
  1042. @item Peak level dB
  1043. @item RMS level dB
  1044. Standard peak and RMS level measured in dBFS.
  1045. @item RMS peak dB
  1046. @item RMS trough dB
  1047. Peak and trough values for RMS level measured over a short window.
  1048. @item Crest factor
  1049. Standard ratio of peak to RMS level (note: not in dB).
  1050. @item Flat factor
  1051. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1052. (i.e. either @var{Min level} or @var{Max level}).
  1053. @item Peak count
  1054. Number of occasions (not the number of samples) that the signal attained either
  1055. @var{Min level} or @var{Max level}.
  1056. @item Bit depth
  1057. Overall bit depth of audio. Number of bits used for each sample.
  1058. @end table
  1059. @section asyncts
  1060. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1061. dropping samples/adding silence when needed.
  1062. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1063. It accepts the following parameters:
  1064. @table @option
  1065. @item compensate
  1066. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1067. by default. When disabled, time gaps are covered with silence.
  1068. @item min_delta
  1069. The minimum difference between timestamps and audio data (in seconds) to trigger
  1070. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1071. sync with this filter, try setting this parameter to 0.
  1072. @item max_comp
  1073. The maximum compensation in samples per second. Only relevant with compensate=1.
  1074. The default value is 500.
  1075. @item first_pts
  1076. Assume that the first PTS should be this value. The time base is 1 / sample
  1077. rate. This allows for padding/trimming at the start of the stream. By default,
  1078. no assumption is made about the first frame's expected PTS, so no padding or
  1079. trimming is done. For example, this could be set to 0 to pad the beginning with
  1080. silence if an audio stream starts after the video stream or to trim any samples
  1081. with a negative PTS due to encoder delay.
  1082. @end table
  1083. @section atempo
  1084. Adjust audio tempo.
  1085. The filter accepts exactly one parameter, the audio tempo. If not
  1086. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1087. be in the [0.5, 2.0] range.
  1088. @subsection Examples
  1089. @itemize
  1090. @item
  1091. Slow down audio to 80% tempo:
  1092. @example
  1093. atempo=0.8
  1094. @end example
  1095. @item
  1096. To speed up audio to 125% tempo:
  1097. @example
  1098. atempo=1.25
  1099. @end example
  1100. @end itemize
  1101. @section atrim
  1102. Trim the input so that the output contains one continuous subpart of the input.
  1103. It accepts the following parameters:
  1104. @table @option
  1105. @item start
  1106. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1107. sample with the timestamp @var{start} will be the first sample in the output.
  1108. @item end
  1109. Specify time of the first audio sample that will be dropped, i.e. the
  1110. audio sample immediately preceding the one with the timestamp @var{end} will be
  1111. the last sample in the output.
  1112. @item start_pts
  1113. Same as @var{start}, except this option sets the start timestamp in samples
  1114. instead of seconds.
  1115. @item end_pts
  1116. Same as @var{end}, except this option sets the end timestamp in samples instead
  1117. of seconds.
  1118. @item duration
  1119. The maximum duration of the output in seconds.
  1120. @item start_sample
  1121. The number of the first sample that should be output.
  1122. @item end_sample
  1123. The number of the first sample that should be dropped.
  1124. @end table
  1125. @option{start}, @option{end}, and @option{duration} are expressed as time
  1126. duration specifications; see
  1127. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1128. Note that the first two sets of the start/end options and the @option{duration}
  1129. option look at the frame timestamp, while the _sample options simply count the
  1130. samples that pass through the filter. So start/end_pts and start/end_sample will
  1131. give different results when the timestamps are wrong, inexact or do not start at
  1132. zero. Also note that this filter does not modify the timestamps. If you wish
  1133. to have the output timestamps start at zero, insert the asetpts filter after the
  1134. atrim filter.
  1135. If multiple start or end options are set, this filter tries to be greedy and
  1136. keep all samples that match at least one of the specified constraints. To keep
  1137. only the part that matches all the constraints at once, chain multiple atrim
  1138. filters.
  1139. The defaults are such that all the input is kept. So it is possible to set e.g.
  1140. just the end values to keep everything before the specified time.
  1141. Examples:
  1142. @itemize
  1143. @item
  1144. Drop everything except the second minute of input:
  1145. @example
  1146. ffmpeg -i INPUT -af atrim=60:120
  1147. @end example
  1148. @item
  1149. Keep only the first 1000 samples:
  1150. @example
  1151. ffmpeg -i INPUT -af atrim=end_sample=1000
  1152. @end example
  1153. @end itemize
  1154. @section bandpass
  1155. Apply a two-pole Butterworth band-pass filter with central
  1156. frequency @var{frequency}, and (3dB-point) band-width width.
  1157. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1158. instead of the default: constant 0dB peak gain.
  1159. The filter roll off at 6dB per octave (20dB per decade).
  1160. The filter accepts the following options:
  1161. @table @option
  1162. @item frequency, f
  1163. Set the filter's central frequency. Default is @code{3000}.
  1164. @item csg
  1165. Constant skirt gain if set to 1. Defaults to 0.
  1166. @item width_type
  1167. Set method to specify band-width of filter.
  1168. @table @option
  1169. @item h
  1170. Hz
  1171. @item q
  1172. Q-Factor
  1173. @item o
  1174. octave
  1175. @item s
  1176. slope
  1177. @end table
  1178. @item width, w
  1179. Specify the band-width of a filter in width_type units.
  1180. @end table
  1181. @section bandreject
  1182. Apply a two-pole Butterworth band-reject filter with central
  1183. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1184. The filter roll off at 6dB per octave (20dB per decade).
  1185. The filter accepts the following options:
  1186. @table @option
  1187. @item frequency, f
  1188. Set the filter's central frequency. Default is @code{3000}.
  1189. @item width_type
  1190. Set method to specify band-width of filter.
  1191. @table @option
  1192. @item h
  1193. Hz
  1194. @item q
  1195. Q-Factor
  1196. @item o
  1197. octave
  1198. @item s
  1199. slope
  1200. @end table
  1201. @item width, w
  1202. Specify the band-width of a filter in width_type units.
  1203. @end table
  1204. @section bass
  1205. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1206. shelving filter with a response similar to that of a standard
  1207. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1208. The filter accepts the following options:
  1209. @table @option
  1210. @item gain, g
  1211. Give the gain at 0 Hz. Its useful range is about -20
  1212. (for a large cut) to +20 (for a large boost).
  1213. Beware of clipping when using a positive gain.
  1214. @item frequency, f
  1215. Set the filter's central frequency and so can be used
  1216. to extend or reduce the frequency range to be boosted or cut.
  1217. The default value is @code{100} Hz.
  1218. @item width_type
  1219. Set method to specify band-width of filter.
  1220. @table @option
  1221. @item h
  1222. Hz
  1223. @item q
  1224. Q-Factor
  1225. @item o
  1226. octave
  1227. @item s
  1228. slope
  1229. @end table
  1230. @item width, w
  1231. Determine how steep is the filter's shelf transition.
  1232. @end table
  1233. @section biquad
  1234. Apply a biquad IIR filter with the given coefficients.
  1235. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1236. are the numerator and denominator coefficients respectively.
  1237. @section bs2b
  1238. Bauer stereo to binaural transformation, which improves headphone listening of
  1239. stereo audio records.
  1240. It accepts the following parameters:
  1241. @table @option
  1242. @item profile
  1243. Pre-defined crossfeed level.
  1244. @table @option
  1245. @item default
  1246. Default level (fcut=700, feed=50).
  1247. @item cmoy
  1248. Chu Moy circuit (fcut=700, feed=60).
  1249. @item jmeier
  1250. Jan Meier circuit (fcut=650, feed=95).
  1251. @end table
  1252. @item fcut
  1253. Cut frequency (in Hz).
  1254. @item feed
  1255. Feed level (in Hz).
  1256. @end table
  1257. @section channelmap
  1258. Remap input channels to new locations.
  1259. It accepts the following parameters:
  1260. @table @option
  1261. @item channel_layout
  1262. The channel layout of the output stream.
  1263. @item map
  1264. Map channels from input to output. The argument is a '|'-separated list of
  1265. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1266. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1267. channel (e.g. FL for front left) or its index in the input channel layout.
  1268. @var{out_channel} is the name of the output channel or its index in the output
  1269. channel layout. If @var{out_channel} is not given then it is implicitly an
  1270. index, starting with zero and increasing by one for each mapping.
  1271. @end table
  1272. If no mapping is present, the filter will implicitly map input channels to
  1273. output channels, preserving indices.
  1274. For example, assuming a 5.1+downmix input MOV file,
  1275. @example
  1276. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1277. @end example
  1278. will create an output WAV file tagged as stereo from the downmix channels of
  1279. the input.
  1280. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1281. @example
  1282. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1283. @end example
  1284. @section channelsplit
  1285. Split each channel from an input audio stream into a separate output stream.
  1286. It accepts the following parameters:
  1287. @table @option
  1288. @item channel_layout
  1289. The channel layout of the input stream. The default is "stereo".
  1290. @end table
  1291. For example, assuming a stereo input MP3 file,
  1292. @example
  1293. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1294. @end example
  1295. will create an output Matroska file with two audio streams, one containing only
  1296. the left channel and the other the right channel.
  1297. Split a 5.1 WAV file into per-channel files:
  1298. @example
  1299. ffmpeg -i in.wav -filter_complex
  1300. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1301. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1302. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1303. side_right.wav
  1304. @end example
  1305. @section chorus
  1306. Add a chorus effect to the audio.
  1307. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1308. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1309. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1310. The modulation depth defines the range the modulated delay is played before or after
  1311. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1312. sound tuned around the original one, like in a chorus where some vocals are slightly
  1313. off key.
  1314. It accepts the following parameters:
  1315. @table @option
  1316. @item in_gain
  1317. Set input gain. Default is 0.4.
  1318. @item out_gain
  1319. Set output gain. Default is 0.4.
  1320. @item delays
  1321. Set delays. A typical delay is around 40ms to 60ms.
  1322. @item decays
  1323. Set decays.
  1324. @item speeds
  1325. Set speeds.
  1326. @item depths
  1327. Set depths.
  1328. @end table
  1329. @subsection Examples
  1330. @itemize
  1331. @item
  1332. A single delay:
  1333. @example
  1334. chorus=0.7:0.9:55:0.4:0.25:2
  1335. @end example
  1336. @item
  1337. Two delays:
  1338. @example
  1339. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1340. @end example
  1341. @item
  1342. Fuller sounding chorus with three delays:
  1343. @example
  1344. 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
  1345. @end example
  1346. @end itemize
  1347. @section compand
  1348. Compress or expand the audio's dynamic range.
  1349. It accepts the following parameters:
  1350. @table @option
  1351. @item attacks
  1352. @item decays
  1353. A list of times in seconds for each channel over which the instantaneous level
  1354. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1355. increase of volume and @var{decays} refers to decrease of volume. For most
  1356. situations, the attack time (response to the audio getting louder) should be
  1357. shorter than the decay time, because the human ear is more sensitive to sudden
  1358. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1359. a typical value for decay is 0.8 seconds.
  1360. If specified number of attacks & decays is lower than number of channels, the last
  1361. set attack/decay will be used for all remaining channels.
  1362. @item points
  1363. A list of points for the transfer function, specified in dB relative to the
  1364. maximum possible signal amplitude. Each key points list must be defined using
  1365. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1366. @code{x0/y0 x1/y1 x2/y2 ....}
  1367. The input values must be in strictly increasing order but the transfer function
  1368. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1369. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1370. function are @code{-70/-70|-60/-20}.
  1371. @item soft-knee
  1372. Set the curve radius in dB for all joints. It defaults to 0.01.
  1373. @item gain
  1374. Set the additional gain in dB to be applied at all points on the transfer
  1375. function. This allows for easy adjustment of the overall gain.
  1376. It defaults to 0.
  1377. @item volume
  1378. Set an initial volume, in dB, to be assumed for each channel when filtering
  1379. starts. This permits the user to supply a nominal level initially, so that, for
  1380. example, a very large gain is not applied to initial signal levels before the
  1381. companding has begun to operate. A typical value for audio which is initially
  1382. quiet is -90 dB. It defaults to 0.
  1383. @item delay
  1384. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1385. delayed before being fed to the volume adjuster. Specifying a delay
  1386. approximately equal to the attack/decay times allows the filter to effectively
  1387. operate in predictive rather than reactive mode. It defaults to 0.
  1388. @end table
  1389. @subsection Examples
  1390. @itemize
  1391. @item
  1392. Make music with both quiet and loud passages suitable for listening to in a
  1393. noisy environment:
  1394. @example
  1395. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1396. @end example
  1397. Another example for audio with whisper and explosion parts:
  1398. @example
  1399. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1400. @end example
  1401. @item
  1402. A noise gate for when the noise is at a lower level than the signal:
  1403. @example
  1404. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1405. @end example
  1406. @item
  1407. Here is another noise gate, this time for when the noise is at a higher level
  1408. than the signal (making it, in some ways, similar to squelch):
  1409. @example
  1410. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1411. @end example
  1412. @end itemize
  1413. @section compensationdelay
  1414. Compensation Delay Line is a metric based delay to compensate differing
  1415. positions of microphones or speakers.
  1416. For example, you have recorded guitar with two microphones placed in
  1417. different location. Because the front of sound wave has fixed speed in
  1418. normal conditions, the phasing of microphones can vary and depends on
  1419. their location and interposition. The best sound mix can be achieved when
  1420. these microphones are in phase (synchronized). Note that distance of
  1421. ~30 cm between microphones makes one microphone to capture signal in
  1422. antiphase to another microphone. That makes the final mix sounding moody.
  1423. This filter helps to solve phasing problems by adding different delays
  1424. to each microphone track and make them synchronized.
  1425. The best result can be reached when you take one track as base and
  1426. synchronize other tracks one by one with it.
  1427. Remember that synchronization/delay tolerance depends on sample rate, too.
  1428. Higher sample rates will give more tolerance.
  1429. It accepts the following parameters:
  1430. @table @option
  1431. @item mm
  1432. Set millimeters distance. This is compensation distance for fine tuning.
  1433. Default is 0.
  1434. @item cm
  1435. Set cm distance. This is compensation distance for tightening distance setup.
  1436. Default is 0.
  1437. @item m
  1438. Set meters distance. This is compensation distance for hard distance setup.
  1439. Default is 0.
  1440. @item dry
  1441. Set dry amount. Amount of unprocessed (dry) signal.
  1442. Default is 0.
  1443. @item wet
  1444. Set wet amount. Amount of processed (wet) signal.
  1445. Default is 1.
  1446. @item temp
  1447. Set temperature degree in Celsius. This is the temperature of the environment.
  1448. Default is 20.
  1449. @end table
  1450. @section dcshift
  1451. Apply a DC shift to the audio.
  1452. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1453. in the recording chain) from the audio. The effect of a DC offset is reduced
  1454. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1455. a signal has a DC offset.
  1456. @table @option
  1457. @item shift
  1458. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1459. the audio.
  1460. @item limitergain
  1461. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1462. used to prevent clipping.
  1463. @end table
  1464. @section dynaudnorm
  1465. Dynamic Audio Normalizer.
  1466. This filter applies a certain amount of gain to the input audio in order
  1467. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1468. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1469. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1470. This allows for applying extra gain to the "quiet" sections of the audio
  1471. while avoiding distortions or clipping the "loud" sections. In other words:
  1472. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1473. sections, in the sense that the volume of each section is brought to the
  1474. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1475. this goal *without* applying "dynamic range compressing". It will retain 100%
  1476. of the dynamic range *within* each section of the audio file.
  1477. @table @option
  1478. @item f
  1479. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1480. Default is 500 milliseconds.
  1481. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1482. referred to as frames. This is required, because a peak magnitude has no
  1483. meaning for just a single sample value. Instead, we need to determine the
  1484. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1485. normalizer would simply use the peak magnitude of the complete file, the
  1486. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1487. frame. The length of a frame is specified in milliseconds. By default, the
  1488. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1489. been found to give good results with most files.
  1490. Note that the exact frame length, in number of samples, will be determined
  1491. automatically, based on the sampling rate of the individual input audio file.
  1492. @item g
  1493. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1494. number. Default is 31.
  1495. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1496. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1497. is specified in frames, centered around the current frame. For the sake of
  1498. simplicity, this must be an odd number. Consequently, the default value of 31
  1499. takes into account the current frame, as well as the 15 preceding frames and
  1500. the 15 subsequent frames. Using a larger window results in a stronger
  1501. smoothing effect and thus in less gain variation, i.e. slower gain
  1502. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1503. effect and thus in more gain variation, i.e. faster gain adaptation.
  1504. In other words, the more you increase this value, the more the Dynamic Audio
  1505. Normalizer will behave like a "traditional" normalization filter. On the
  1506. contrary, the more you decrease this value, the more the Dynamic Audio
  1507. Normalizer will behave like a dynamic range compressor.
  1508. @item p
  1509. Set the target peak value. This specifies the highest permissible magnitude
  1510. level for the normalized audio input. This filter will try to approach the
  1511. target peak magnitude as closely as possible, but at the same time it also
  1512. makes sure that the normalized signal will never exceed the peak magnitude.
  1513. A frame's maximum local gain factor is imposed directly by the target peak
  1514. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1515. It is not recommended to go above this value.
  1516. @item m
  1517. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1518. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1519. factor for each input frame, i.e. the maximum gain factor that does not
  1520. result in clipping or distortion. The maximum gain factor is determined by
  1521. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1522. additionally bounds the frame's maximum gain factor by a predetermined
  1523. (global) maximum gain factor. This is done in order to avoid excessive gain
  1524. factors in "silent" or almost silent frames. By default, the maximum gain
  1525. factor is 10.0, For most inputs the default value should be sufficient and
  1526. it usually is not recommended to increase this value. Though, for input
  1527. with an extremely low overall volume level, it may be necessary to allow even
  1528. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1529. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1530. Instead, a "sigmoid" threshold function will be applied. This way, the
  1531. gain factors will smoothly approach the threshold value, but never exceed that
  1532. value.
  1533. @item r
  1534. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1535. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1536. This means that the maximum local gain factor for each frame is defined
  1537. (only) by the frame's highest magnitude sample. This way, the samples can
  1538. be amplified as much as possible without exceeding the maximum signal
  1539. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1540. Normalizer can also take into account the frame's root mean square,
  1541. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1542. determine the power of a time-varying signal. It is therefore considered
  1543. that the RMS is a better approximation of the "perceived loudness" than
  1544. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1545. frames to a constant RMS value, a uniform "perceived loudness" can be
  1546. established. If a target RMS value has been specified, a frame's local gain
  1547. factor is defined as the factor that would result in exactly that RMS value.
  1548. Note, however, that the maximum local gain factor is still restricted by the
  1549. frame's highest magnitude sample, in order to prevent clipping.
  1550. @item n
  1551. Enable channels coupling. By default is enabled.
  1552. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1553. amount. This means the same gain factor will be applied to all channels, i.e.
  1554. the maximum possible gain factor is determined by the "loudest" channel.
  1555. However, in some recordings, it may happen that the volume of the different
  1556. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1557. In this case, this option can be used to disable the channel coupling. This way,
  1558. the gain factor will be determined independently for each channel, depending
  1559. only on the individual channel's highest magnitude sample. This allows for
  1560. harmonizing the volume of the different channels.
  1561. @item c
  1562. Enable DC bias correction. By default is disabled.
  1563. An audio signal (in the time domain) is a sequence of sample values.
  1564. In the Dynamic Audio Normalizer these sample values are represented in the
  1565. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1566. audio signal, or "waveform", should be centered around the zero point.
  1567. That means if we calculate the mean value of all samples in a file, or in a
  1568. single frame, then the result should be 0.0 or at least very close to that
  1569. value. If, however, there is a significant deviation of the mean value from
  1570. 0.0, in either positive or negative direction, this is referred to as a
  1571. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1572. Audio Normalizer provides optional DC bias correction.
  1573. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1574. the mean value, or "DC correction" offset, of each input frame and subtract
  1575. that value from all of the frame's sample values which ensures those samples
  1576. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1577. boundaries, the DC correction offset values will be interpolated smoothly
  1578. between neighbouring frames.
  1579. @item b
  1580. Enable alternative boundary mode. By default is disabled.
  1581. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1582. around each frame. This includes the preceding frames as well as the
  1583. subsequent frames. However, for the "boundary" frames, located at the very
  1584. beginning and at the very end of the audio file, not all neighbouring
  1585. frames are available. In particular, for the first few frames in the audio
  1586. file, the preceding frames are not known. And, similarly, for the last few
  1587. frames in the audio file, the subsequent frames are not known. Thus, the
  1588. question arises which gain factors should be assumed for the missing frames
  1589. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1590. to deal with this situation. The default boundary mode assumes a gain factor
  1591. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1592. "fade out" at the beginning and at the end of the input, respectively.
  1593. @item s
  1594. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1595. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1596. compression. This means that signal peaks will not be pruned and thus the
  1597. full dynamic range will be retained within each local neighbourhood. However,
  1598. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1599. normalization algorithm with a more "traditional" compression.
  1600. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1601. (thresholding) function. If (and only if) the compression feature is enabled,
  1602. all input frames will be processed by a soft knee thresholding function prior
  1603. to the actual normalization process. Put simply, the thresholding function is
  1604. going to prune all samples whose magnitude exceeds a certain threshold value.
  1605. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1606. value. Instead, the threshold value will be adjusted for each individual
  1607. frame.
  1608. In general, smaller parameters result in stronger compression, and vice versa.
  1609. Values below 3.0 are not recommended, because audible distortion may appear.
  1610. @end table
  1611. @section earwax
  1612. Make audio easier to listen to on headphones.
  1613. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1614. so that when listened to on headphones the stereo image is moved from
  1615. inside your head (standard for headphones) to outside and in front of
  1616. the listener (standard for speakers).
  1617. Ported from SoX.
  1618. @section equalizer
  1619. Apply a two-pole peaking equalisation (EQ) filter. With this
  1620. filter, the signal-level at and around a selected frequency can
  1621. be increased or decreased, whilst (unlike bandpass and bandreject
  1622. filters) that at all other frequencies is unchanged.
  1623. In order to produce complex equalisation curves, this filter can
  1624. be given several times, each with a different central frequency.
  1625. The filter accepts the following options:
  1626. @table @option
  1627. @item frequency, f
  1628. Set the filter's central frequency in Hz.
  1629. @item width_type
  1630. Set method to specify band-width of filter.
  1631. @table @option
  1632. @item h
  1633. Hz
  1634. @item q
  1635. Q-Factor
  1636. @item o
  1637. octave
  1638. @item s
  1639. slope
  1640. @end table
  1641. @item width, w
  1642. Specify the band-width of a filter in width_type units.
  1643. @item gain, g
  1644. Set the required gain or attenuation in dB.
  1645. Beware of clipping when using a positive gain.
  1646. @end table
  1647. @subsection Examples
  1648. @itemize
  1649. @item
  1650. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1651. @example
  1652. equalizer=f=1000:width_type=h:width=200:g=-10
  1653. @end example
  1654. @item
  1655. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1656. @example
  1657. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1658. @end example
  1659. @end itemize
  1660. @section extrastereo
  1661. Linearly increases the difference between left and right channels which
  1662. adds some sort of "live" effect to playback.
  1663. The filter accepts the following option:
  1664. @table @option
  1665. @item m
  1666. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1667. (average of both channels), with 1.0 sound will be unchanged, with
  1668. -1.0 left and right channels will be swapped.
  1669. @item c
  1670. Enable clipping. By default is enabled.
  1671. @end table
  1672. @section flanger
  1673. Apply a flanging effect to the audio.
  1674. The filter accepts the following options:
  1675. @table @option
  1676. @item delay
  1677. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1678. @item depth
  1679. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1680. @item regen
  1681. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1682. Default value is 0.
  1683. @item width
  1684. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1685. Default value is 71.
  1686. @item speed
  1687. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1688. @item shape
  1689. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1690. Default value is @var{sinusoidal}.
  1691. @item phase
  1692. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1693. Default value is 25.
  1694. @item interp
  1695. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1696. Default is @var{linear}.
  1697. @end table
  1698. @section highpass
  1699. Apply a high-pass filter with 3dB point frequency.
  1700. The filter can be either single-pole, or double-pole (the default).
  1701. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1702. The filter accepts the following options:
  1703. @table @option
  1704. @item frequency, f
  1705. Set frequency in Hz. Default is 3000.
  1706. @item poles, p
  1707. Set number of poles. Default is 2.
  1708. @item width_type
  1709. Set method to specify band-width of filter.
  1710. @table @option
  1711. @item h
  1712. Hz
  1713. @item q
  1714. Q-Factor
  1715. @item o
  1716. octave
  1717. @item s
  1718. slope
  1719. @end table
  1720. @item width, w
  1721. Specify the band-width of a filter in width_type units.
  1722. Applies only to double-pole filter.
  1723. The default is 0.707q and gives a Butterworth response.
  1724. @end table
  1725. @section join
  1726. Join multiple input streams into one multi-channel stream.
  1727. It accepts the following parameters:
  1728. @table @option
  1729. @item inputs
  1730. The number of input streams. It defaults to 2.
  1731. @item channel_layout
  1732. The desired output channel layout. It defaults to stereo.
  1733. @item map
  1734. Map channels from inputs to output. The argument is a '|'-separated list of
  1735. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  1736. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  1737. can be either the name of the input channel (e.g. FL for front left) or its
  1738. index in the specified input stream. @var{out_channel} is the name of the output
  1739. channel.
  1740. @end table
  1741. The filter will attempt to guess the mappings when they are not specified
  1742. explicitly. It does so by first trying to find an unused matching input channel
  1743. and if that fails it picks the first unused input channel.
  1744. Join 3 inputs (with properly set channel layouts):
  1745. @example
  1746. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1747. @end example
  1748. Build a 5.1 output from 6 single-channel streams:
  1749. @example
  1750. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1751. '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'
  1752. out
  1753. @end example
  1754. @section ladspa
  1755. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  1756. To enable compilation of this filter you need to configure FFmpeg with
  1757. @code{--enable-ladspa}.
  1758. @table @option
  1759. @item file, f
  1760. Specifies the name of LADSPA plugin library to load. If the environment
  1761. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  1762. each one of the directories specified by the colon separated list in
  1763. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  1764. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  1765. @file{/usr/lib/ladspa/}.
  1766. @item plugin, p
  1767. Specifies the plugin within the library. Some libraries contain only
  1768. one plugin, but others contain many of them. If this is not set filter
  1769. will list all available plugins within the specified library.
  1770. @item controls, c
  1771. Set the '|' separated list of controls which are zero or more floating point
  1772. values that determine the behavior of the loaded plugin (for example delay,
  1773. threshold or gain).
  1774. Controls need to be defined using the following syntax:
  1775. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  1776. @var{valuei} is the value set on the @var{i}-th control.
  1777. Alternatively they can be also defined using the following syntax:
  1778. @var{value0}|@var{value1}|@var{value2}|..., where
  1779. @var{valuei} is the value set on the @var{i}-th control.
  1780. If @option{controls} is set to @code{help}, all available controls and
  1781. their valid ranges are printed.
  1782. @item sample_rate, s
  1783. Specify the sample rate, default to 44100. Only used if plugin have
  1784. zero inputs.
  1785. @item nb_samples, n
  1786. Set the number of samples per channel per each output frame, default
  1787. is 1024. Only used if plugin have zero inputs.
  1788. @item duration, d
  1789. Set the minimum duration of the sourced audio. See
  1790. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1791. for the accepted syntax.
  1792. Note that the resulting duration may be greater than the specified duration,
  1793. as the generated audio is always cut at the end of a complete frame.
  1794. If not specified, or the expressed duration is negative, the audio is
  1795. supposed to be generated forever.
  1796. Only used if plugin have zero inputs.
  1797. @end table
  1798. @subsection Examples
  1799. @itemize
  1800. @item
  1801. List all available plugins within amp (LADSPA example plugin) library:
  1802. @example
  1803. ladspa=file=amp
  1804. @end example
  1805. @item
  1806. List all available controls and their valid ranges for @code{vcf_notch}
  1807. plugin from @code{VCF} library:
  1808. @example
  1809. ladspa=f=vcf:p=vcf_notch:c=help
  1810. @end example
  1811. @item
  1812. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  1813. plugin library:
  1814. @example
  1815. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  1816. @end example
  1817. @item
  1818. Add reverberation to the audio using TAP-plugins
  1819. (Tom's Audio Processing plugins):
  1820. @example
  1821. ladspa=file=tap_reverb:tap_reverb
  1822. @end example
  1823. @item
  1824. Generate white noise, with 0.2 amplitude:
  1825. @example
  1826. ladspa=file=cmt:noise_source_white:c=c0=.2
  1827. @end example
  1828. @item
  1829. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  1830. @code{C* Audio Plugin Suite} (CAPS) library:
  1831. @example
  1832. ladspa=file=caps:Click:c=c1=20'
  1833. @end example
  1834. @item
  1835. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  1836. @example
  1837. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  1838. @end example
  1839. @item
  1840. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  1841. @code{SWH Plugins} collection:
  1842. @example
  1843. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  1844. @end example
  1845. @item
  1846. Attenuate low frequencies using Multiband EQ from Steve Harris
  1847. @code{SWH Plugins} collection:
  1848. @example
  1849. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  1850. @end example
  1851. @end itemize
  1852. @subsection Commands
  1853. This filter supports the following commands:
  1854. @table @option
  1855. @item cN
  1856. Modify the @var{N}-th control value.
  1857. If the specified value is not valid, it is ignored and prior one is kept.
  1858. @end table
  1859. @section lowpass
  1860. Apply a low-pass filter with 3dB point frequency.
  1861. The filter can be either single-pole or double-pole (the default).
  1862. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1863. The filter accepts the following options:
  1864. @table @option
  1865. @item frequency, f
  1866. Set frequency in Hz. Default is 500.
  1867. @item poles, p
  1868. Set number of poles. Default is 2.
  1869. @item width_type
  1870. Set method to specify band-width of filter.
  1871. @table @option
  1872. @item h
  1873. Hz
  1874. @item q
  1875. Q-Factor
  1876. @item o
  1877. octave
  1878. @item s
  1879. slope
  1880. @end table
  1881. @item width, w
  1882. Specify the band-width of a filter in width_type units.
  1883. Applies only to double-pole filter.
  1884. The default is 0.707q and gives a Butterworth response.
  1885. @end table
  1886. @anchor{pan}
  1887. @section pan
  1888. Mix channels with specific gain levels. The filter accepts the output
  1889. channel layout followed by a set of channels definitions.
  1890. This filter is also designed to efficiently remap the channels of an audio
  1891. stream.
  1892. The filter accepts parameters of the form:
  1893. "@var{l}|@var{outdef}|@var{outdef}|..."
  1894. @table @option
  1895. @item l
  1896. output channel layout or number of channels
  1897. @item outdef
  1898. output channel specification, of the form:
  1899. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  1900. @item out_name
  1901. output channel to define, either a channel name (FL, FR, etc.) or a channel
  1902. number (c0, c1, etc.)
  1903. @item gain
  1904. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  1905. @item in_name
  1906. input channel to use, see out_name for details; it is not possible to mix
  1907. named and numbered input channels
  1908. @end table
  1909. If the `=' in a channel specification is replaced by `<', then the gains for
  1910. that specification will be renormalized so that the total is 1, thus
  1911. avoiding clipping noise.
  1912. @subsection Mixing examples
  1913. For example, if you want to down-mix from stereo to mono, but with a bigger
  1914. factor for the left channel:
  1915. @example
  1916. pan=1c|c0=0.9*c0+0.1*c1
  1917. @end example
  1918. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  1919. 7-channels surround:
  1920. @example
  1921. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  1922. @end example
  1923. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  1924. that should be preferred (see "-ac" option) unless you have very specific
  1925. needs.
  1926. @subsection Remapping examples
  1927. The channel remapping will be effective if, and only if:
  1928. @itemize
  1929. @item gain coefficients are zeroes or ones,
  1930. @item only one input per channel output,
  1931. @end itemize
  1932. If all these conditions are satisfied, the filter will notify the user ("Pure
  1933. channel mapping detected"), and use an optimized and lossless method to do the
  1934. remapping.
  1935. For example, if you have a 5.1 source and want a stereo audio stream by
  1936. dropping the extra channels:
  1937. @example
  1938. pan="stereo| c0=FL | c1=FR"
  1939. @end example
  1940. Given the same source, you can also switch front left and front right channels
  1941. and keep the input channel layout:
  1942. @example
  1943. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  1944. @end example
  1945. If the input is a stereo audio stream, you can mute the front left channel (and
  1946. still keep the stereo channel layout) with:
  1947. @example
  1948. pan="stereo|c1=c1"
  1949. @end example
  1950. Still with a stereo audio stream input, you can copy the right channel in both
  1951. front left and right:
  1952. @example
  1953. pan="stereo| c0=FR | c1=FR"
  1954. @end example
  1955. @section replaygain
  1956. ReplayGain scanner filter. This filter takes an audio stream as an input and
  1957. outputs it unchanged.
  1958. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  1959. @section resample
  1960. Convert the audio sample format, sample rate and channel layout. It is
  1961. not meant to be used directly.
  1962. @section rubberband
  1963. Apply time-stretching and pitch-shifting with librubberband.
  1964. The filter accepts the following options:
  1965. @table @option
  1966. @item tempo
  1967. Set tempo scale factor.
  1968. @item pitch
  1969. Set pitch scale factor.
  1970. @item transients
  1971. Set transients detector.
  1972. Possible values are:
  1973. @table @var
  1974. @item crisp
  1975. @item mixed
  1976. @item smooth
  1977. @end table
  1978. @item detector
  1979. Set detector.
  1980. Possible values are:
  1981. @table @var
  1982. @item compound
  1983. @item percussive
  1984. @item soft
  1985. @end table
  1986. @item phase
  1987. Set phase.
  1988. Possible values are:
  1989. @table @var
  1990. @item laminar
  1991. @item independent
  1992. @end table
  1993. @item window
  1994. Set processing window size.
  1995. Possible values are:
  1996. @table @var
  1997. @item standard
  1998. @item short
  1999. @item long
  2000. @end table
  2001. @item smoothing
  2002. Set smoothing.
  2003. Possible values are:
  2004. @table @var
  2005. @item off
  2006. @item on
  2007. @end table
  2008. @item formant
  2009. Enable formant preservation when shift pitching.
  2010. Possible values are:
  2011. @table @var
  2012. @item shifted
  2013. @item preserved
  2014. @end table
  2015. @item pitchq
  2016. Set pitch quality.
  2017. Possible values are:
  2018. @table @var
  2019. @item quality
  2020. @item speed
  2021. @item consistency
  2022. @end table
  2023. @item channels
  2024. Set channels.
  2025. Possible values are:
  2026. @table @var
  2027. @item apart
  2028. @item together
  2029. @end table
  2030. @end table
  2031. @section sidechaincompress
  2032. This filter acts like normal compressor but has the ability to compress
  2033. detected signal using second input signal.
  2034. It needs two input streams and returns one output stream.
  2035. First input stream will be processed depending on second stream signal.
  2036. The filtered signal then can be filtered with other filters in later stages of
  2037. processing. See @ref{pan} and @ref{amerge} filter.
  2038. The filter accepts the following options:
  2039. @table @option
  2040. @item level_in
  2041. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2042. @item threshold
  2043. If a signal of second stream raises above this level it will affect the gain
  2044. reduction of first stream.
  2045. By default is 0.125. Range is between 0.00097563 and 1.
  2046. @item ratio
  2047. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2048. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2049. Default is 2. Range is between 1 and 20.
  2050. @item attack
  2051. Amount of milliseconds the signal has to rise above the threshold before gain
  2052. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2053. @item release
  2054. Amount of milliseconds the signal has to fall below the threshold before
  2055. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2056. @item makeup
  2057. Set the amount by how much signal will be amplified after processing.
  2058. Default is 2. Range is from 1 and 64.
  2059. @item knee
  2060. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2061. Default is 2.82843. Range is between 1 and 8.
  2062. @item link
  2063. Choose if the @code{average} level between all channels of side-chain stream
  2064. or the louder(@code{maximum}) channel of side-chain stream affects the
  2065. reduction. Default is @code{average}.
  2066. @item detection
  2067. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2068. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2069. @item level_sc
  2070. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2071. @item mix
  2072. How much to use compressed signal in output. Default is 1.
  2073. Range is between 0 and 1.
  2074. @end table
  2075. @subsection Examples
  2076. @itemize
  2077. @item
  2078. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2079. depending on the signal of 2nd input and later compressed signal to be
  2080. merged with 2nd input:
  2081. @example
  2082. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2083. @end example
  2084. @end itemize
  2085. @section sidechaingate
  2086. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2087. filter the detected signal before sending it to the gain reduction stage.
  2088. Normally a gate uses the full range signal to detect a level above the
  2089. threshold.
  2090. For example: If you cut all lower frequencies from your sidechain signal
  2091. the gate will decrease the volume of your track only if not enough highs
  2092. appear. With this technique you are able to reduce the resonation of a
  2093. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2094. guitar.
  2095. It needs two input streams and returns one output stream.
  2096. First input stream will be processed depending on second stream signal.
  2097. The filter accepts the following options:
  2098. @table @option
  2099. @item level_in
  2100. Set input level before filtering.
  2101. Default is 1. Allowed range is from 0.015625 to 64.
  2102. @item range
  2103. Set the level of gain reduction when the signal is below the threshold.
  2104. Default is 0.06125. Allowed range is from 0 to 1.
  2105. @item threshold
  2106. If a signal rises above this level the gain reduction is released.
  2107. Default is 0.125. Allowed range is from 0 to 1.
  2108. @item ratio
  2109. Set a ratio about which the signal is reduced.
  2110. Default is 2. Allowed range is from 1 to 9000.
  2111. @item attack
  2112. Amount of milliseconds the signal has to rise above the threshold before gain
  2113. reduction stops.
  2114. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2115. @item release
  2116. Amount of milliseconds the signal has to fall below the threshold before the
  2117. reduction is increased again. Default is 250 milliseconds.
  2118. Allowed range is from 0.01 to 9000.
  2119. @item makeup
  2120. Set amount of amplification of signal after processing.
  2121. Default is 1. Allowed range is from 1 to 64.
  2122. @item knee
  2123. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2124. Default is 2.828427125. Allowed range is from 1 to 8.
  2125. @item detection
  2126. Choose if exact signal should be taken for detection or an RMS like one.
  2127. Default is rms. Can be peak or rms.
  2128. @item link
  2129. Choose if the average level between all channels or the louder channel affects
  2130. the reduction.
  2131. Default is average. Can be average or maximum.
  2132. @item level_sc
  2133. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2134. @end table
  2135. @section silencedetect
  2136. Detect silence in an audio stream.
  2137. This filter logs a message when it detects that the input audio volume is less
  2138. or equal to a noise tolerance value for a duration greater or equal to the
  2139. minimum detected noise duration.
  2140. The printed times and duration are expressed in seconds.
  2141. The filter accepts the following options:
  2142. @table @option
  2143. @item duration, d
  2144. Set silence duration until notification (default is 2 seconds).
  2145. @item noise, n
  2146. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2147. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2148. @end table
  2149. @subsection Examples
  2150. @itemize
  2151. @item
  2152. Detect 5 seconds of silence with -50dB noise tolerance:
  2153. @example
  2154. silencedetect=n=-50dB:d=5
  2155. @end example
  2156. @item
  2157. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2158. tolerance in @file{silence.mp3}:
  2159. @example
  2160. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2161. @end example
  2162. @end itemize
  2163. @section silenceremove
  2164. Remove silence from the beginning, middle or end of the audio.
  2165. The filter accepts the following options:
  2166. @table @option
  2167. @item start_periods
  2168. This value is used to indicate if audio should be trimmed at beginning of
  2169. the audio. A value of zero indicates no silence should be trimmed from the
  2170. beginning. When specifying a non-zero value, it trims audio up until it
  2171. finds non-silence. Normally, when trimming silence from beginning of audio
  2172. the @var{start_periods} will be @code{1} but it can be increased to higher
  2173. values to trim all audio up to specific count of non-silence periods.
  2174. Default value is @code{0}.
  2175. @item start_duration
  2176. Specify the amount of time that non-silence must be detected before it stops
  2177. trimming audio. By increasing the duration, bursts of noises can be treated
  2178. as silence and trimmed off. Default value is @code{0}.
  2179. @item start_threshold
  2180. This indicates what sample value should be treated as silence. For digital
  2181. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2182. you may wish to increase the value to account for background noise.
  2183. Can be specified in dB (in case "dB" is appended to the specified value)
  2184. or amplitude ratio. Default value is @code{0}.
  2185. @item stop_periods
  2186. Set the count for trimming silence from the end of audio.
  2187. To remove silence from the middle of a file, specify a @var{stop_periods}
  2188. that is negative. This value is then treated as a positive value and is
  2189. used to indicate the effect should restart processing as specified by
  2190. @var{start_periods}, making it suitable for removing periods of silence
  2191. in the middle of the audio.
  2192. Default value is @code{0}.
  2193. @item stop_duration
  2194. Specify a duration of silence that must exist before audio is not copied any
  2195. more. By specifying a higher duration, silence that is wanted can be left in
  2196. the audio.
  2197. Default value is @code{0}.
  2198. @item stop_threshold
  2199. This is the same as @option{start_threshold} but for trimming silence from
  2200. the end of audio.
  2201. Can be specified in dB (in case "dB" is appended to the specified value)
  2202. or amplitude ratio. Default value is @code{0}.
  2203. @item leave_silence
  2204. This indicate that @var{stop_duration} length of audio should be left intact
  2205. at the beginning of each period of silence.
  2206. For example, if you want to remove long pauses between words but do not want
  2207. to remove the pauses completely. Default value is @code{0}.
  2208. @end table
  2209. @subsection Examples
  2210. @itemize
  2211. @item
  2212. The following example shows how this filter can be used to start a recording
  2213. that does not contain the delay at the start which usually occurs between
  2214. pressing the record button and the start of the performance:
  2215. @example
  2216. silenceremove=1:5:0.02
  2217. @end example
  2218. @end itemize
  2219. @section stereotools
  2220. This filter has some handy utilities to manage stereo signals, for converting
  2221. M/S stereo recordings to L/R signal while having control over the parameters
  2222. or spreading the stereo image of master track.
  2223. The filter accepts the following options:
  2224. @table @option
  2225. @item level_in
  2226. Set input level before filtering for both channels. Defaults is 1.
  2227. Allowed range is from 0.015625 to 64.
  2228. @item level_out
  2229. Set output level after filtering for both channels. Defaults is 1.
  2230. Allowed range is from 0.015625 to 64.
  2231. @item balance_in
  2232. Set input balance between both channels. Default is 0.
  2233. Allowed range is from -1 to 1.
  2234. @item balance_out
  2235. Set output balance between both channels. Default is 0.
  2236. Allowed range is from -1 to 1.
  2237. @item softclip
  2238. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2239. clipping. Disabled by default.
  2240. @item mutel
  2241. Mute the left channel. Disabled by default.
  2242. @item muter
  2243. Mute the right channel. Disabled by default.
  2244. @item phasel
  2245. Change the phase of the left channel. Disabled by default.
  2246. @item phaser
  2247. Change the phase of the right channel. Disabled by default.
  2248. @item mode
  2249. Set stereo mode. Available values are:
  2250. @table @samp
  2251. @item lr>lr
  2252. Left/Right to Left/Right, this is default.
  2253. @item lr>ms
  2254. Left/Right to Mid/Side.
  2255. @item ms>lr
  2256. Mid/Side to Left/Right.
  2257. @item lr>ll
  2258. Left/Right to Left/Left.
  2259. @item lr>rr
  2260. Left/Right to Right/Right.
  2261. @item lr>l+r
  2262. Left/Right to Left + Right.
  2263. @item lr>rl
  2264. Left/Right to Right/Left.
  2265. @end table
  2266. @item slev
  2267. Set level of side signal. Default is 1.
  2268. Allowed range is from 0.015625 to 64.
  2269. @item sbal
  2270. Set balance of side signal. Default is 0.
  2271. Allowed range is from -1 to 1.
  2272. @item mlev
  2273. Set level of the middle signal. Default is 1.
  2274. Allowed range is from 0.015625 to 64.
  2275. @item mpan
  2276. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2277. @item base
  2278. Set stereo base between mono and inversed channels. Default is 0.
  2279. Allowed range is from -1 to 1.
  2280. @item delay
  2281. Set delay in milliseconds how much to delay left from right channel and
  2282. vice versa. Default is 0. Allowed range is from -20 to 20.
  2283. @item sclevel
  2284. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2285. @item phase
  2286. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2287. @end table
  2288. @section stereowiden
  2289. This filter enhance the stereo effect by suppressing signal common to both
  2290. channels and by delaying the signal of left into right and vice versa,
  2291. thereby widening the stereo effect.
  2292. The filter accepts the following options:
  2293. @table @option
  2294. @item delay
  2295. Time in milliseconds of the delay of left signal into right and vice versa.
  2296. Default is 20 milliseconds.
  2297. @item feedback
  2298. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2299. effect of left signal in right output and vice versa which gives widening
  2300. effect. Default is 0.3.
  2301. @item crossfeed
  2302. Cross feed of left into right with inverted phase. This helps in suppressing
  2303. the mono. If the value is 1 it will cancel all the signal common to both
  2304. channels. Default is 0.3.
  2305. @item drymix
  2306. Set level of input signal of original channel. Default is 0.8.
  2307. @end table
  2308. @section treble
  2309. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2310. shelving filter with a response similar to that of a standard
  2311. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2312. The filter accepts the following options:
  2313. @table @option
  2314. @item gain, g
  2315. Give the gain at whichever is the lower of ~22 kHz and the
  2316. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2317. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2318. @item frequency, f
  2319. Set the filter's central frequency and so can be used
  2320. to extend or reduce the frequency range to be boosted or cut.
  2321. The default value is @code{3000} Hz.
  2322. @item width_type
  2323. Set method to specify band-width of filter.
  2324. @table @option
  2325. @item h
  2326. Hz
  2327. @item q
  2328. Q-Factor
  2329. @item o
  2330. octave
  2331. @item s
  2332. slope
  2333. @end table
  2334. @item width, w
  2335. Determine how steep is the filter's shelf transition.
  2336. @end table
  2337. @section tremolo
  2338. Sinusoidal amplitude modulation.
  2339. The filter accepts the following options:
  2340. @table @option
  2341. @item f
  2342. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2343. (20 Hz or lower) will result in a tremolo effect.
  2344. This filter may also be used as a ring modulator by specifying
  2345. a modulation frequency higher than 20 Hz.
  2346. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2347. @item d
  2348. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2349. Default value is 0.5.
  2350. @end table
  2351. @section vibrato
  2352. Sinusoidal phase modulation.
  2353. The filter accepts the following options:
  2354. @table @option
  2355. @item f
  2356. Modulation frequency in Hertz.
  2357. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2358. @item d
  2359. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2360. Default value is 0.5.
  2361. @end table
  2362. @section volume
  2363. Adjust the input audio volume.
  2364. It accepts the following parameters:
  2365. @table @option
  2366. @item volume
  2367. Set audio volume expression.
  2368. Output values are clipped to the maximum value.
  2369. The output audio volume is given by the relation:
  2370. @example
  2371. @var{output_volume} = @var{volume} * @var{input_volume}
  2372. @end example
  2373. The default value for @var{volume} is "1.0".
  2374. @item precision
  2375. This parameter represents the mathematical precision.
  2376. It determines which input sample formats will be allowed, which affects the
  2377. precision of the volume scaling.
  2378. @table @option
  2379. @item fixed
  2380. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2381. @item float
  2382. 32-bit floating-point; this limits input sample format to FLT. (default)
  2383. @item double
  2384. 64-bit floating-point; this limits input sample format to DBL.
  2385. @end table
  2386. @item replaygain
  2387. Choose the behaviour on encountering ReplayGain side data in input frames.
  2388. @table @option
  2389. @item drop
  2390. Remove ReplayGain side data, ignoring its contents (the default).
  2391. @item ignore
  2392. Ignore ReplayGain side data, but leave it in the frame.
  2393. @item track
  2394. Prefer the track gain, if present.
  2395. @item album
  2396. Prefer the album gain, if present.
  2397. @end table
  2398. @item replaygain_preamp
  2399. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2400. Default value for @var{replaygain_preamp} is 0.0.
  2401. @item eval
  2402. Set when the volume expression is evaluated.
  2403. It accepts the following values:
  2404. @table @samp
  2405. @item once
  2406. only evaluate expression once during the filter initialization, or
  2407. when the @samp{volume} command is sent
  2408. @item frame
  2409. evaluate expression for each incoming frame
  2410. @end table
  2411. Default value is @samp{once}.
  2412. @end table
  2413. The volume expression can contain the following parameters.
  2414. @table @option
  2415. @item n
  2416. frame number (starting at zero)
  2417. @item nb_channels
  2418. number of channels
  2419. @item nb_consumed_samples
  2420. number of samples consumed by the filter
  2421. @item nb_samples
  2422. number of samples in the current frame
  2423. @item pos
  2424. original frame position in the file
  2425. @item pts
  2426. frame PTS
  2427. @item sample_rate
  2428. sample rate
  2429. @item startpts
  2430. PTS at start of stream
  2431. @item startt
  2432. time at start of stream
  2433. @item t
  2434. frame time
  2435. @item tb
  2436. timestamp timebase
  2437. @item volume
  2438. last set volume value
  2439. @end table
  2440. Note that when @option{eval} is set to @samp{once} only the
  2441. @var{sample_rate} and @var{tb} variables are available, all other
  2442. variables will evaluate to NAN.
  2443. @subsection Commands
  2444. This filter supports the following commands:
  2445. @table @option
  2446. @item volume
  2447. Modify the volume expression.
  2448. The command accepts the same syntax of the corresponding option.
  2449. If the specified expression is not valid, it is kept at its current
  2450. value.
  2451. @item replaygain_noclip
  2452. Prevent clipping by limiting the gain applied.
  2453. Default value for @var{replaygain_noclip} is 1.
  2454. @end table
  2455. @subsection Examples
  2456. @itemize
  2457. @item
  2458. Halve the input audio volume:
  2459. @example
  2460. volume=volume=0.5
  2461. volume=volume=1/2
  2462. volume=volume=-6.0206dB
  2463. @end example
  2464. In all the above example the named key for @option{volume} can be
  2465. omitted, for example like in:
  2466. @example
  2467. volume=0.5
  2468. @end example
  2469. @item
  2470. Increase input audio power by 6 decibels using fixed-point precision:
  2471. @example
  2472. volume=volume=6dB:precision=fixed
  2473. @end example
  2474. @item
  2475. Fade volume after time 10 with an annihilation period of 5 seconds:
  2476. @example
  2477. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2478. @end example
  2479. @end itemize
  2480. @section volumedetect
  2481. Detect the volume of the input video.
  2482. The filter has no parameters. The input is not modified. Statistics about
  2483. the volume will be printed in the log when the input stream end is reached.
  2484. In particular it will show the mean volume (root mean square), maximum
  2485. volume (on a per-sample basis), and the beginning of a histogram of the
  2486. registered volume values (from the maximum value to a cumulated 1/1000 of
  2487. the samples).
  2488. All volumes are in decibels relative to the maximum PCM value.
  2489. @subsection Examples
  2490. Here is an excerpt of the output:
  2491. @example
  2492. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2493. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2494. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2495. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2496. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2497. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2498. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2499. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2500. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2501. @end example
  2502. It means that:
  2503. @itemize
  2504. @item
  2505. The mean square energy is approximately -27 dB, or 10^-2.7.
  2506. @item
  2507. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2508. @item
  2509. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2510. @end itemize
  2511. In other words, raising the volume by +4 dB does not cause any clipping,
  2512. raising it by +5 dB causes clipping for 6 samples, etc.
  2513. @c man end AUDIO FILTERS
  2514. @chapter Audio Sources
  2515. @c man begin AUDIO SOURCES
  2516. Below is a description of the currently available audio sources.
  2517. @section abuffer
  2518. Buffer audio frames, and make them available to the filter chain.
  2519. This source is mainly intended for a programmatic use, in particular
  2520. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2521. It accepts the following parameters:
  2522. @table @option
  2523. @item time_base
  2524. The timebase which will be used for timestamps of submitted frames. It must be
  2525. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2526. @item sample_rate
  2527. The sample rate of the incoming audio buffers.
  2528. @item sample_fmt
  2529. The sample format of the incoming audio buffers.
  2530. Either a sample format name or its corresponding integer representation from
  2531. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2532. @item channel_layout
  2533. The channel layout of the incoming audio buffers.
  2534. Either a channel layout name from channel_layout_map in
  2535. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2536. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2537. @item channels
  2538. The number of channels of the incoming audio buffers.
  2539. If both @var{channels} and @var{channel_layout} are specified, then they
  2540. must be consistent.
  2541. @end table
  2542. @subsection Examples
  2543. @example
  2544. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2545. @end example
  2546. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2547. Since the sample format with name "s16p" corresponds to the number
  2548. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2549. equivalent to:
  2550. @example
  2551. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2552. @end example
  2553. @section aevalsrc
  2554. Generate an audio signal specified by an expression.
  2555. This source accepts in input one or more expressions (one for each
  2556. channel), which are evaluated and used to generate a corresponding
  2557. audio signal.
  2558. This source accepts the following options:
  2559. @table @option
  2560. @item exprs
  2561. Set the '|'-separated expressions list for each separate channel. In case the
  2562. @option{channel_layout} option is not specified, the selected channel layout
  2563. depends on the number of provided expressions. Otherwise the last
  2564. specified expression is applied to the remaining output channels.
  2565. @item channel_layout, c
  2566. Set the channel layout. The number of channels in the specified layout
  2567. must be equal to the number of specified expressions.
  2568. @item duration, d
  2569. Set the minimum duration of the sourced audio. See
  2570. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2571. for the accepted syntax.
  2572. Note that the resulting duration may be greater than the specified
  2573. duration, as the generated audio is always cut at the end of a
  2574. complete frame.
  2575. If not specified, or the expressed duration is negative, the audio is
  2576. supposed to be generated forever.
  2577. @item nb_samples, n
  2578. Set the number of samples per channel per each output frame,
  2579. default to 1024.
  2580. @item sample_rate, s
  2581. Specify the sample rate, default to 44100.
  2582. @end table
  2583. Each expression in @var{exprs} can contain the following constants:
  2584. @table @option
  2585. @item n
  2586. number of the evaluated sample, starting from 0
  2587. @item t
  2588. time of the evaluated sample expressed in seconds, starting from 0
  2589. @item s
  2590. sample rate
  2591. @end table
  2592. @subsection Examples
  2593. @itemize
  2594. @item
  2595. Generate silence:
  2596. @example
  2597. aevalsrc=0
  2598. @end example
  2599. @item
  2600. Generate a sin signal with frequency of 440 Hz, set sample rate to
  2601. 8000 Hz:
  2602. @example
  2603. aevalsrc="sin(440*2*PI*t):s=8000"
  2604. @end example
  2605. @item
  2606. Generate a two channels signal, specify the channel layout (Front
  2607. Center + Back Center) explicitly:
  2608. @example
  2609. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  2610. @end example
  2611. @item
  2612. Generate white noise:
  2613. @example
  2614. aevalsrc="-2+random(0)"
  2615. @end example
  2616. @item
  2617. Generate an amplitude modulated signal:
  2618. @example
  2619. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  2620. @end example
  2621. @item
  2622. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  2623. @example
  2624. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  2625. @end example
  2626. @end itemize
  2627. @section anullsrc
  2628. The null audio source, return unprocessed audio frames. It is mainly useful
  2629. as a template and to be employed in analysis / debugging tools, or as
  2630. the source for filters which ignore the input data (for example the sox
  2631. synth filter).
  2632. This source accepts the following options:
  2633. @table @option
  2634. @item channel_layout, cl
  2635. Specifies the channel layout, and can be either an integer or a string
  2636. representing a channel layout. The default value of @var{channel_layout}
  2637. is "stereo".
  2638. Check the channel_layout_map definition in
  2639. @file{libavutil/channel_layout.c} for the mapping between strings and
  2640. channel layout values.
  2641. @item sample_rate, r
  2642. Specifies the sample rate, and defaults to 44100.
  2643. @item nb_samples, n
  2644. Set the number of samples per requested frames.
  2645. @end table
  2646. @subsection Examples
  2647. @itemize
  2648. @item
  2649. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  2650. @example
  2651. anullsrc=r=48000:cl=4
  2652. @end example
  2653. @item
  2654. Do the same operation with a more obvious syntax:
  2655. @example
  2656. anullsrc=r=48000:cl=mono
  2657. @end example
  2658. @end itemize
  2659. All the parameters need to be explicitly defined.
  2660. @section flite
  2661. Synthesize a voice utterance using the libflite library.
  2662. To enable compilation of this filter you need to configure FFmpeg with
  2663. @code{--enable-libflite}.
  2664. Note that the flite library is not thread-safe.
  2665. The filter accepts the following options:
  2666. @table @option
  2667. @item list_voices
  2668. If set to 1, list the names of the available voices and exit
  2669. immediately. Default value is 0.
  2670. @item nb_samples, n
  2671. Set the maximum number of samples per frame. Default value is 512.
  2672. @item textfile
  2673. Set the filename containing the text to speak.
  2674. @item text
  2675. Set the text to speak.
  2676. @item voice, v
  2677. Set the voice to use for the speech synthesis. Default value is
  2678. @code{kal}. See also the @var{list_voices} option.
  2679. @end table
  2680. @subsection Examples
  2681. @itemize
  2682. @item
  2683. Read from file @file{speech.txt}, and synthesize the text using the
  2684. standard flite voice:
  2685. @example
  2686. flite=textfile=speech.txt
  2687. @end example
  2688. @item
  2689. Read the specified text selecting the @code{slt} voice:
  2690. @example
  2691. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2692. @end example
  2693. @item
  2694. Input text to ffmpeg:
  2695. @example
  2696. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2697. @end example
  2698. @item
  2699. Make @file{ffplay} speak the specified text, using @code{flite} and
  2700. the @code{lavfi} device:
  2701. @example
  2702. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  2703. @end example
  2704. @end itemize
  2705. For more information about libflite, check:
  2706. @url{http://www.speech.cs.cmu.edu/flite/}
  2707. @section anoisesrc
  2708. Generate a noise audio signal.
  2709. The filter accepts the following options:
  2710. @table @option
  2711. @item sample_rate, r
  2712. Specify the sample rate. Default value is 48000 Hz.
  2713. @item amplitude, a
  2714. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  2715. is 1.0.
  2716. @item duration, d
  2717. Specify the duration of the generated audio stream. Not specifying this option
  2718. results in noise with an infinite length.
  2719. @item color, colour, c
  2720. Specify the color of noise. Available noise colors are white, pink, and brown.
  2721. Default color is white.
  2722. @item seed, s
  2723. Specify a value used to seed the PRNG.
  2724. @item nb_samples, n
  2725. Set the number of samples per each output frame, default is 1024.
  2726. @end table
  2727. @subsection Examples
  2728. @itemize
  2729. @item
  2730. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  2731. @example
  2732. anoisesrc=d=60:c=pink:r=44100:a=0.5
  2733. @end example
  2734. @end itemize
  2735. @section sine
  2736. Generate an audio signal made of a sine wave with amplitude 1/8.
  2737. The audio signal is bit-exact.
  2738. The filter accepts the following options:
  2739. @table @option
  2740. @item frequency, f
  2741. Set the carrier frequency. Default is 440 Hz.
  2742. @item beep_factor, b
  2743. Enable a periodic beep every second with frequency @var{beep_factor} times
  2744. the carrier frequency. Default is 0, meaning the beep is disabled.
  2745. @item sample_rate, r
  2746. Specify the sample rate, default is 44100.
  2747. @item duration, d
  2748. Specify the duration of the generated audio stream.
  2749. @item samples_per_frame
  2750. Set the number of samples per output frame.
  2751. The expression can contain the following constants:
  2752. @table @option
  2753. @item n
  2754. The (sequential) number of the output audio frame, starting from 0.
  2755. @item pts
  2756. The PTS (Presentation TimeStamp) of the output audio frame,
  2757. expressed in @var{TB} units.
  2758. @item t
  2759. The PTS of the output audio frame, expressed in seconds.
  2760. @item TB
  2761. The timebase of the output audio frames.
  2762. @end table
  2763. Default is @code{1024}.
  2764. @end table
  2765. @subsection Examples
  2766. @itemize
  2767. @item
  2768. Generate a simple 440 Hz sine wave:
  2769. @example
  2770. sine
  2771. @end example
  2772. @item
  2773. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  2774. @example
  2775. sine=220:4:d=5
  2776. sine=f=220:b=4:d=5
  2777. sine=frequency=220:beep_factor=4:duration=5
  2778. @end example
  2779. @item
  2780. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  2781. pattern:
  2782. @example
  2783. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  2784. @end example
  2785. @end itemize
  2786. @c man end AUDIO SOURCES
  2787. @chapter Audio Sinks
  2788. @c man begin AUDIO SINKS
  2789. Below is a description of the currently available audio sinks.
  2790. @section abuffersink
  2791. Buffer audio frames, and make them available to the end of filter chain.
  2792. This sink is mainly intended for programmatic use, in particular
  2793. through the interface defined in @file{libavfilter/buffersink.h}
  2794. or the options system.
  2795. It accepts a pointer to an AVABufferSinkContext structure, which
  2796. defines the incoming buffers' formats, to be passed as the opaque
  2797. parameter to @code{avfilter_init_filter} for initialization.
  2798. @section anullsink
  2799. Null audio sink; do absolutely nothing with the input audio. It is
  2800. mainly useful as a template and for use in analysis / debugging
  2801. tools.
  2802. @c man end AUDIO SINKS
  2803. @chapter Video Filters
  2804. @c man begin VIDEO FILTERS
  2805. When you configure your FFmpeg build, you can disable any of the
  2806. existing filters using @code{--disable-filters}.
  2807. The configure output will show the video filters included in your
  2808. build.
  2809. Below is a description of the currently available video filters.
  2810. @section alphaextract
  2811. Extract the alpha component from the input as a grayscale video. This
  2812. is especially useful with the @var{alphamerge} filter.
  2813. @section alphamerge
  2814. Add or replace the alpha component of the primary input with the
  2815. grayscale value of a second input. This is intended for use with
  2816. @var{alphaextract} to allow the transmission or storage of frame
  2817. sequences that have alpha in a format that doesn't support an alpha
  2818. channel.
  2819. For example, to reconstruct full frames from a normal YUV-encoded video
  2820. and a separate video created with @var{alphaextract}, you might use:
  2821. @example
  2822. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  2823. @end example
  2824. Since this filter is designed for reconstruction, it operates on frame
  2825. sequences without considering timestamps, and terminates when either
  2826. input reaches end of stream. This will cause problems if your encoding
  2827. pipeline drops frames. If you're trying to apply an image as an
  2828. overlay to a video stream, consider the @var{overlay} filter instead.
  2829. @section ass
  2830. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  2831. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  2832. Substation Alpha) subtitles files.
  2833. This filter accepts the following option in addition to the common options from
  2834. the @ref{subtitles} filter:
  2835. @table @option
  2836. @item shaping
  2837. Set the shaping engine
  2838. Available values are:
  2839. @table @samp
  2840. @item auto
  2841. The default libass shaping engine, which is the best available.
  2842. @item simple
  2843. Fast, font-agnostic shaper that can do only substitutions
  2844. @item complex
  2845. Slower shaper using OpenType for substitutions and positioning
  2846. @end table
  2847. The default is @code{auto}.
  2848. @end table
  2849. @section atadenoise
  2850. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  2851. The filter accepts the following options:
  2852. @table @option
  2853. @item 0a
  2854. Set threshold A for 1st plane. Default is 0.02.
  2855. Valid range is 0 to 0.3.
  2856. @item 0b
  2857. Set threshold B for 1st plane. Default is 0.04.
  2858. Valid range is 0 to 5.
  2859. @item 1a
  2860. Set threshold A for 2nd plane. Default is 0.02.
  2861. Valid range is 0 to 0.3.
  2862. @item 1b
  2863. Set threshold B for 2nd plane. Default is 0.04.
  2864. Valid range is 0 to 5.
  2865. @item 2a
  2866. Set threshold A for 3rd plane. Default is 0.02.
  2867. Valid range is 0 to 0.3.
  2868. @item 2b
  2869. Set threshold B for 3rd plane. Default is 0.04.
  2870. Valid range is 0 to 5.
  2871. Threshold A is designed to react on abrupt changes in the input signal and
  2872. threshold B is designed to react on continuous changes in the input signal.
  2873. @item s
  2874. Set number of frames filter will use for averaging. Default is 33. Must be odd
  2875. number in range [5, 129].
  2876. @end table
  2877. @section bbox
  2878. Compute the bounding box for the non-black pixels in the input frame
  2879. luminance plane.
  2880. This filter computes the bounding box containing all the pixels with a
  2881. luminance value greater than the minimum allowed value.
  2882. The parameters describing the bounding box are printed on the filter
  2883. log.
  2884. The filter accepts the following option:
  2885. @table @option
  2886. @item min_val
  2887. Set the minimal luminance value. Default is @code{16}.
  2888. @end table
  2889. @section blackdetect
  2890. Detect video intervals that are (almost) completely black. Can be
  2891. useful to detect chapter transitions, commercials, or invalid
  2892. recordings. Output lines contains the time for the start, end and
  2893. duration of the detected black interval expressed in seconds.
  2894. In order to display the output lines, you need to set the loglevel at
  2895. least to the AV_LOG_INFO value.
  2896. The filter accepts the following options:
  2897. @table @option
  2898. @item black_min_duration, d
  2899. Set the minimum detected black duration expressed in seconds. It must
  2900. be a non-negative floating point number.
  2901. Default value is 2.0.
  2902. @item picture_black_ratio_th, pic_th
  2903. Set the threshold for considering a picture "black".
  2904. Express the minimum value for the ratio:
  2905. @example
  2906. @var{nb_black_pixels} / @var{nb_pixels}
  2907. @end example
  2908. for which a picture is considered black.
  2909. Default value is 0.98.
  2910. @item pixel_black_th, pix_th
  2911. Set the threshold for considering a pixel "black".
  2912. The threshold expresses the maximum pixel luminance value for which a
  2913. pixel is considered "black". The provided value is scaled according to
  2914. the following equation:
  2915. @example
  2916. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  2917. @end example
  2918. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  2919. the input video format, the range is [0-255] for YUV full-range
  2920. formats and [16-235] for YUV non full-range formats.
  2921. Default value is 0.10.
  2922. @end table
  2923. The following example sets the maximum pixel threshold to the minimum
  2924. value, and detects only black intervals of 2 or more seconds:
  2925. @example
  2926. blackdetect=d=2:pix_th=0.00
  2927. @end example
  2928. @section blackframe
  2929. Detect frames that are (almost) completely black. Can be useful to
  2930. detect chapter transitions or commercials. Output lines consist of
  2931. the frame number of the detected frame, the percentage of blackness,
  2932. the position in the file if known or -1 and the timestamp in seconds.
  2933. In order to display the output lines, you need to set the loglevel at
  2934. least to the AV_LOG_INFO value.
  2935. It accepts the following parameters:
  2936. @table @option
  2937. @item amount
  2938. The percentage of the pixels that have to be below the threshold; it defaults to
  2939. @code{98}.
  2940. @item threshold, thresh
  2941. The threshold below which a pixel value is considered black; it defaults to
  2942. @code{32}.
  2943. @end table
  2944. @section blend, tblend
  2945. Blend two video frames into each other.
  2946. The @code{blend} filter takes two input streams and outputs one
  2947. stream, the first input is the "top" layer and second input is
  2948. "bottom" layer. Output terminates when shortest input terminates.
  2949. The @code{tblend} (time blend) filter takes two consecutive frames
  2950. from one single stream, and outputs the result obtained by blending
  2951. the new frame on top of the old frame.
  2952. A description of the accepted options follows.
  2953. @table @option
  2954. @item c0_mode
  2955. @item c1_mode
  2956. @item c2_mode
  2957. @item c3_mode
  2958. @item all_mode
  2959. Set blend mode for specific pixel component or all pixel components in case
  2960. of @var{all_mode}. Default value is @code{normal}.
  2961. Available values for component modes are:
  2962. @table @samp
  2963. @item addition
  2964. @item addition128
  2965. @item and
  2966. @item average
  2967. @item burn
  2968. @item darken
  2969. @item difference
  2970. @item difference128
  2971. @item divide
  2972. @item dodge
  2973. @item exclusion
  2974. @item glow
  2975. @item hardlight
  2976. @item hardmix
  2977. @item lighten
  2978. @item linearlight
  2979. @item multiply
  2980. @item negation
  2981. @item normal
  2982. @item or
  2983. @item overlay
  2984. @item phoenix
  2985. @item pinlight
  2986. @item reflect
  2987. @item screen
  2988. @item softlight
  2989. @item subtract
  2990. @item vividlight
  2991. @item xor
  2992. @end table
  2993. @item c0_opacity
  2994. @item c1_opacity
  2995. @item c2_opacity
  2996. @item c3_opacity
  2997. @item all_opacity
  2998. Set blend opacity for specific pixel component or all pixel components in case
  2999. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3000. @item c0_expr
  3001. @item c1_expr
  3002. @item c2_expr
  3003. @item c3_expr
  3004. @item all_expr
  3005. Set blend expression for specific pixel component or all pixel components in case
  3006. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3007. The expressions can use the following variables:
  3008. @table @option
  3009. @item N
  3010. The sequential number of the filtered frame, starting from @code{0}.
  3011. @item X
  3012. @item Y
  3013. the coordinates of the current sample
  3014. @item W
  3015. @item H
  3016. the width and height of currently filtered plane
  3017. @item SW
  3018. @item SH
  3019. Width and height scale depending on the currently filtered plane. It is the
  3020. ratio between the corresponding luma plane number of pixels and the current
  3021. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3022. @code{0.5,0.5} for chroma planes.
  3023. @item T
  3024. Time of the current frame, expressed in seconds.
  3025. @item TOP, A
  3026. Value of pixel component at current location for first video frame (top layer).
  3027. @item BOTTOM, B
  3028. Value of pixel component at current location for second video frame (bottom layer).
  3029. @end table
  3030. @item shortest
  3031. Force termination when the shortest input terminates. Default is
  3032. @code{0}. This option is only defined for the @code{blend} filter.
  3033. @item repeatlast
  3034. Continue applying the last bottom frame after the end of the stream. A value of
  3035. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3036. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3037. @end table
  3038. @subsection Examples
  3039. @itemize
  3040. @item
  3041. Apply transition from bottom layer to top layer in first 10 seconds:
  3042. @example
  3043. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3044. @end example
  3045. @item
  3046. Apply 1x1 checkerboard effect:
  3047. @example
  3048. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3049. @end example
  3050. @item
  3051. Apply uncover left effect:
  3052. @example
  3053. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3054. @end example
  3055. @item
  3056. Apply uncover down effect:
  3057. @example
  3058. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3059. @end example
  3060. @item
  3061. Apply uncover up-left effect:
  3062. @example
  3063. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3064. @end example
  3065. @item
  3066. Display differences between the current and the previous frame:
  3067. @example
  3068. tblend=all_mode=difference128
  3069. @end example
  3070. @end itemize
  3071. @section boxblur
  3072. Apply a boxblur algorithm to the input video.
  3073. It accepts the following parameters:
  3074. @table @option
  3075. @item luma_radius, lr
  3076. @item luma_power, lp
  3077. @item chroma_radius, cr
  3078. @item chroma_power, cp
  3079. @item alpha_radius, ar
  3080. @item alpha_power, ap
  3081. @end table
  3082. A description of the accepted options follows.
  3083. @table @option
  3084. @item luma_radius, lr
  3085. @item chroma_radius, cr
  3086. @item alpha_radius, ar
  3087. Set an expression for the box radius in pixels used for blurring the
  3088. corresponding input plane.
  3089. The radius value must be a non-negative number, and must not be
  3090. greater than the value of the expression @code{min(w,h)/2} for the
  3091. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3092. planes.
  3093. Default value for @option{luma_radius} is "2". If not specified,
  3094. @option{chroma_radius} and @option{alpha_radius} default to the
  3095. corresponding value set for @option{luma_radius}.
  3096. The expressions can contain the following constants:
  3097. @table @option
  3098. @item w
  3099. @item h
  3100. The input width and height in pixels.
  3101. @item cw
  3102. @item ch
  3103. The input chroma image width and height in pixels.
  3104. @item hsub
  3105. @item vsub
  3106. The horizontal and vertical chroma subsample values. For example, for the
  3107. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3108. @end table
  3109. @item luma_power, lp
  3110. @item chroma_power, cp
  3111. @item alpha_power, ap
  3112. Specify how many times the boxblur filter is applied to the
  3113. corresponding plane.
  3114. Default value for @option{luma_power} is 2. If not specified,
  3115. @option{chroma_power} and @option{alpha_power} default to the
  3116. corresponding value set for @option{luma_power}.
  3117. A value of 0 will disable the effect.
  3118. @end table
  3119. @subsection Examples
  3120. @itemize
  3121. @item
  3122. Apply a boxblur filter with the luma, chroma, and alpha radii
  3123. set to 2:
  3124. @example
  3125. boxblur=luma_radius=2:luma_power=1
  3126. boxblur=2:1
  3127. @end example
  3128. @item
  3129. Set the luma radius to 2, and alpha and chroma radius to 0:
  3130. @example
  3131. boxblur=2:1:cr=0:ar=0
  3132. @end example
  3133. @item
  3134. Set the luma and chroma radii to a fraction of the video dimension:
  3135. @example
  3136. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3137. @end example
  3138. @end itemize
  3139. @section chromakey
  3140. YUV colorspace color/chroma keying.
  3141. The filter accepts the following options:
  3142. @table @option
  3143. @item color
  3144. The color which will be replaced with transparency.
  3145. @item similarity
  3146. Similarity percentage with the key color.
  3147. 0.01 matches only the exact key color, while 1.0 matches everything.
  3148. @item blend
  3149. Blend percentage.
  3150. 0.0 makes pixels either fully transparent, or not transparent at all.
  3151. Higher values result in semi-transparent pixels, with a higher transparency
  3152. the more similar the pixels color is to the key color.
  3153. @item yuv
  3154. Signals that the color passed is already in YUV instead of RGB.
  3155. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3156. This can be used to pass exact YUV values as hexadecimal numbers.
  3157. @end table
  3158. @subsection Examples
  3159. @itemize
  3160. @item
  3161. Make every green pixel in the input image transparent:
  3162. @example
  3163. ffmpeg -i input.png -vf chromakey=green out.png
  3164. @end example
  3165. @item
  3166. Overlay a greenscreen-video on top of a static black background.
  3167. @example
  3168. 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
  3169. @end example
  3170. @end itemize
  3171. @section codecview
  3172. Visualize information exported by some codecs.
  3173. Some codecs can export information through frames using side-data or other
  3174. means. For example, some MPEG based codecs export motion vectors through the
  3175. @var{export_mvs} flag in the codec @option{flags2} option.
  3176. The filter accepts the following option:
  3177. @table @option
  3178. @item mv
  3179. Set motion vectors to visualize.
  3180. Available flags for @var{mv} are:
  3181. @table @samp
  3182. @item pf
  3183. forward predicted MVs of P-frames
  3184. @item bf
  3185. forward predicted MVs of B-frames
  3186. @item bb
  3187. backward predicted MVs of B-frames
  3188. @end table
  3189. @item qp
  3190. Display quantization parameters using the chroma planes
  3191. @end table
  3192. @subsection Examples
  3193. @itemize
  3194. @item
  3195. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  3196. @example
  3197. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  3198. @end example
  3199. @end itemize
  3200. @section colorbalance
  3201. Modify intensity of primary colors (red, green and blue) of input frames.
  3202. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3203. regions for the red-cyan, green-magenta or blue-yellow balance.
  3204. A positive adjustment value shifts the balance towards the primary color, a negative
  3205. value towards the complementary color.
  3206. The filter accepts the following options:
  3207. @table @option
  3208. @item rs
  3209. @item gs
  3210. @item bs
  3211. Adjust red, green and blue shadows (darkest pixels).
  3212. @item rm
  3213. @item gm
  3214. @item bm
  3215. Adjust red, green and blue midtones (medium pixels).
  3216. @item rh
  3217. @item gh
  3218. @item bh
  3219. Adjust red, green and blue highlights (brightest pixels).
  3220. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3221. @end table
  3222. @subsection Examples
  3223. @itemize
  3224. @item
  3225. Add red color cast to shadows:
  3226. @example
  3227. colorbalance=rs=.3
  3228. @end example
  3229. @end itemize
  3230. @section colorkey
  3231. RGB colorspace color keying.
  3232. The filter accepts the following options:
  3233. @table @option
  3234. @item color
  3235. The color which will be replaced with transparency.
  3236. @item similarity
  3237. Similarity percentage with the key color.
  3238. 0.01 matches only the exact key color, while 1.0 matches everything.
  3239. @item blend
  3240. Blend percentage.
  3241. 0.0 makes pixels either fully transparent, or not transparent at all.
  3242. Higher values result in semi-transparent pixels, with a higher transparency
  3243. the more similar the pixels color is to the key color.
  3244. @end table
  3245. @subsection Examples
  3246. @itemize
  3247. @item
  3248. Make every green pixel in the input image transparent:
  3249. @example
  3250. ffmpeg -i input.png -vf colorkey=green out.png
  3251. @end example
  3252. @item
  3253. Overlay a greenscreen-video on top of a static background image.
  3254. @example
  3255. 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
  3256. @end example
  3257. @end itemize
  3258. @section colorlevels
  3259. Adjust video input frames using levels.
  3260. The filter accepts the following options:
  3261. @table @option
  3262. @item rimin
  3263. @item gimin
  3264. @item bimin
  3265. @item aimin
  3266. Adjust red, green, blue and alpha input black point.
  3267. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3268. @item rimax
  3269. @item gimax
  3270. @item bimax
  3271. @item aimax
  3272. Adjust red, green, blue and alpha input white point.
  3273. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3274. Input levels are used to lighten highlights (bright tones), darken shadows
  3275. (dark tones), change the balance of bright and dark tones.
  3276. @item romin
  3277. @item gomin
  3278. @item bomin
  3279. @item aomin
  3280. Adjust red, green, blue and alpha output black point.
  3281. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3282. @item romax
  3283. @item gomax
  3284. @item bomax
  3285. @item aomax
  3286. Adjust red, green, blue and alpha output white point.
  3287. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3288. Output levels allows manual selection of a constrained output level range.
  3289. @end table
  3290. @subsection Examples
  3291. @itemize
  3292. @item
  3293. Make video output darker:
  3294. @example
  3295. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3296. @end example
  3297. @item
  3298. Increase contrast:
  3299. @example
  3300. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3301. @end example
  3302. @item
  3303. Make video output lighter:
  3304. @example
  3305. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3306. @end example
  3307. @item
  3308. Increase brightness:
  3309. @example
  3310. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3311. @end example
  3312. @end itemize
  3313. @section colorchannelmixer
  3314. Adjust video input frames by re-mixing color channels.
  3315. This filter modifies a color channel by adding the values associated to
  3316. the other channels of the same pixels. For example if the value to
  3317. modify is red, the output value will be:
  3318. @example
  3319. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3320. @end example
  3321. The filter accepts the following options:
  3322. @table @option
  3323. @item rr
  3324. @item rg
  3325. @item rb
  3326. @item ra
  3327. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3328. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3329. @item gr
  3330. @item gg
  3331. @item gb
  3332. @item ga
  3333. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3334. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3335. @item br
  3336. @item bg
  3337. @item bb
  3338. @item ba
  3339. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3340. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3341. @item ar
  3342. @item ag
  3343. @item ab
  3344. @item aa
  3345. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3346. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3347. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3348. @end table
  3349. @subsection Examples
  3350. @itemize
  3351. @item
  3352. Convert source to grayscale:
  3353. @example
  3354. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3355. @end example
  3356. @item
  3357. Simulate sepia tones:
  3358. @example
  3359. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3360. @end example
  3361. @end itemize
  3362. @section colormatrix
  3363. Convert color matrix.
  3364. The filter accepts the following options:
  3365. @table @option
  3366. @item src
  3367. @item dst
  3368. Specify the source and destination color matrix. Both values must be
  3369. specified.
  3370. The accepted values are:
  3371. @table @samp
  3372. @item bt709
  3373. BT.709
  3374. @item bt601
  3375. BT.601
  3376. @item smpte240m
  3377. SMPTE-240M
  3378. @item fcc
  3379. FCC
  3380. @end table
  3381. @end table
  3382. For example to convert from BT.601 to SMPTE-240M, use the command:
  3383. @example
  3384. colormatrix=bt601:smpte240m
  3385. @end example
  3386. @section copy
  3387. Copy the input source unchanged to the output. This is mainly useful for
  3388. testing purposes.
  3389. @section crop
  3390. Crop the input video to given dimensions.
  3391. It accepts the following parameters:
  3392. @table @option
  3393. @item w, out_w
  3394. The width of the output video. It defaults to @code{iw}.
  3395. This expression is evaluated only once during the filter
  3396. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  3397. @item h, out_h
  3398. The height of the output video. It defaults to @code{ih}.
  3399. This expression is evaluated only once during the filter
  3400. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  3401. @item x
  3402. The horizontal position, in the input video, of the left edge of the output
  3403. video. It defaults to @code{(in_w-out_w)/2}.
  3404. This expression is evaluated per-frame.
  3405. @item y
  3406. The vertical position, in the input video, of the top edge of the output video.
  3407. It defaults to @code{(in_h-out_h)/2}.
  3408. This expression is evaluated per-frame.
  3409. @item keep_aspect
  3410. If set to 1 will force the output display aspect ratio
  3411. to be the same of the input, by changing the output sample aspect
  3412. ratio. It defaults to 0.
  3413. @end table
  3414. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  3415. expressions containing the following constants:
  3416. @table @option
  3417. @item x
  3418. @item y
  3419. The computed values for @var{x} and @var{y}. They are evaluated for
  3420. each new frame.
  3421. @item in_w
  3422. @item in_h
  3423. The input width and height.
  3424. @item iw
  3425. @item ih
  3426. These are the same as @var{in_w} and @var{in_h}.
  3427. @item out_w
  3428. @item out_h
  3429. The output (cropped) width and height.
  3430. @item ow
  3431. @item oh
  3432. These are the same as @var{out_w} and @var{out_h}.
  3433. @item a
  3434. same as @var{iw} / @var{ih}
  3435. @item sar
  3436. input sample aspect ratio
  3437. @item dar
  3438. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  3439. @item hsub
  3440. @item vsub
  3441. horizontal and vertical chroma subsample values. For example for the
  3442. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3443. @item n
  3444. The number of the input frame, starting from 0.
  3445. @item pos
  3446. the position in the file of the input frame, NAN if unknown
  3447. @item t
  3448. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  3449. @end table
  3450. The expression for @var{out_w} may depend on the value of @var{out_h},
  3451. and the expression for @var{out_h} may depend on @var{out_w}, but they
  3452. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  3453. evaluated after @var{out_w} and @var{out_h}.
  3454. The @var{x} and @var{y} parameters specify the expressions for the
  3455. position of the top-left corner of the output (non-cropped) area. They
  3456. are evaluated for each frame. If the evaluated value is not valid, it
  3457. is approximated to the nearest valid value.
  3458. The expression for @var{x} may depend on @var{y}, and the expression
  3459. for @var{y} may depend on @var{x}.
  3460. @subsection Examples
  3461. @itemize
  3462. @item
  3463. Crop area with size 100x100 at position (12,34).
  3464. @example
  3465. crop=100:100:12:34
  3466. @end example
  3467. Using named options, the example above becomes:
  3468. @example
  3469. crop=w=100:h=100:x=12:y=34
  3470. @end example
  3471. @item
  3472. Crop the central input area with size 100x100:
  3473. @example
  3474. crop=100:100
  3475. @end example
  3476. @item
  3477. Crop the central input area with size 2/3 of the input video:
  3478. @example
  3479. crop=2/3*in_w:2/3*in_h
  3480. @end example
  3481. @item
  3482. Crop the input video central square:
  3483. @example
  3484. crop=out_w=in_h
  3485. crop=in_h
  3486. @end example
  3487. @item
  3488. Delimit the rectangle with the top-left corner placed at position
  3489. 100:100 and the right-bottom corner corresponding to the right-bottom
  3490. corner of the input image.
  3491. @example
  3492. crop=in_w-100:in_h-100:100:100
  3493. @end example
  3494. @item
  3495. Crop 10 pixels from the left and right borders, and 20 pixels from
  3496. the top and bottom borders
  3497. @example
  3498. crop=in_w-2*10:in_h-2*20
  3499. @end example
  3500. @item
  3501. Keep only the bottom right quarter of the input image:
  3502. @example
  3503. crop=in_w/2:in_h/2:in_w/2:in_h/2
  3504. @end example
  3505. @item
  3506. Crop height for getting Greek harmony:
  3507. @example
  3508. crop=in_w:1/PHI*in_w
  3509. @end example
  3510. @item
  3511. Apply trembling effect:
  3512. @example
  3513. 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)
  3514. @end example
  3515. @item
  3516. Apply erratic camera effect depending on timestamp:
  3517. @example
  3518. 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)"
  3519. @end example
  3520. @item
  3521. Set x depending on the value of y:
  3522. @example
  3523. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  3524. @end example
  3525. @end itemize
  3526. @subsection Commands
  3527. This filter supports the following commands:
  3528. @table @option
  3529. @item w, out_w
  3530. @item h, out_h
  3531. @item x
  3532. @item y
  3533. Set width/height of the output video and the horizontal/vertical position
  3534. in the input video.
  3535. The command accepts the same syntax of the corresponding option.
  3536. If the specified expression is not valid, it is kept at its current
  3537. value.
  3538. @end table
  3539. @section cropdetect
  3540. Auto-detect the crop size.
  3541. It calculates the necessary cropping parameters and prints the
  3542. recommended parameters via the logging system. The detected dimensions
  3543. correspond to the non-black area of the input video.
  3544. It accepts the following parameters:
  3545. @table @option
  3546. @item limit
  3547. Set higher black value threshold, which can be optionally specified
  3548. from nothing (0) to everything (255 for 8bit based formats). An intensity
  3549. value greater to the set value is considered non-black. It defaults to 24.
  3550. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  3551. on the bitdepth of the pixel format.
  3552. @item round
  3553. The value which the width/height should be divisible by. It defaults to
  3554. 16. The offset is automatically adjusted to center the video. Use 2 to
  3555. get only even dimensions (needed for 4:2:2 video). 16 is best when
  3556. encoding to most video codecs.
  3557. @item reset_count, reset
  3558. Set the counter that determines after how many frames cropdetect will
  3559. reset the previously detected largest video area and start over to
  3560. detect the current optimal crop area. Default value is 0.
  3561. This can be useful when channel logos distort the video area. 0
  3562. indicates 'never reset', and returns the largest area encountered during
  3563. playback.
  3564. @end table
  3565. @anchor{curves}
  3566. @section curves
  3567. Apply color adjustments using curves.
  3568. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  3569. component (red, green and blue) has its values defined by @var{N} key points
  3570. tied from each other using a smooth curve. The x-axis represents the pixel
  3571. values from the input frame, and the y-axis the new pixel values to be set for
  3572. the output frame.
  3573. By default, a component curve is defined by the two points @var{(0;0)} and
  3574. @var{(1;1)}. This creates a straight line where each original pixel value is
  3575. "adjusted" to its own value, which means no change to the image.
  3576. The filter allows you to redefine these two points and add some more. A new
  3577. curve (using a natural cubic spline interpolation) will be define to pass
  3578. smoothly through all these new coordinates. The new defined points needs to be
  3579. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  3580. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  3581. the vector spaces, the values will be clipped accordingly.
  3582. If there is no key point defined in @code{x=0}, the filter will automatically
  3583. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  3584. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  3585. The filter accepts the following options:
  3586. @table @option
  3587. @item preset
  3588. Select one of the available color presets. This option can be used in addition
  3589. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  3590. options takes priority on the preset values.
  3591. Available presets are:
  3592. @table @samp
  3593. @item none
  3594. @item color_negative
  3595. @item cross_process
  3596. @item darker
  3597. @item increase_contrast
  3598. @item lighter
  3599. @item linear_contrast
  3600. @item medium_contrast
  3601. @item negative
  3602. @item strong_contrast
  3603. @item vintage
  3604. @end table
  3605. Default is @code{none}.
  3606. @item master, m
  3607. Set the master key points. These points will define a second pass mapping. It
  3608. is sometimes called a "luminance" or "value" mapping. It can be used with
  3609. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  3610. post-processing LUT.
  3611. @item red, r
  3612. Set the key points for the red component.
  3613. @item green, g
  3614. Set the key points for the green component.
  3615. @item blue, b
  3616. Set the key points for the blue component.
  3617. @item all
  3618. Set the key points for all components (not including master).
  3619. Can be used in addition to the other key points component
  3620. options. In this case, the unset component(s) will fallback on this
  3621. @option{all} setting.
  3622. @item psfile
  3623. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  3624. @end table
  3625. To avoid some filtergraph syntax conflicts, each key points list need to be
  3626. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  3627. @subsection Examples
  3628. @itemize
  3629. @item
  3630. Increase slightly the middle level of blue:
  3631. @example
  3632. curves=blue='0.5/0.58'
  3633. @end example
  3634. @item
  3635. Vintage effect:
  3636. @example
  3637. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  3638. @end example
  3639. Here we obtain the following coordinates for each components:
  3640. @table @var
  3641. @item red
  3642. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  3643. @item green
  3644. @code{(0;0) (0.50;0.48) (1;1)}
  3645. @item blue
  3646. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  3647. @end table
  3648. @item
  3649. The previous example can also be achieved with the associated built-in preset:
  3650. @example
  3651. curves=preset=vintage
  3652. @end example
  3653. @item
  3654. Or simply:
  3655. @example
  3656. curves=vintage
  3657. @end example
  3658. @item
  3659. Use a Photoshop preset and redefine the points of the green component:
  3660. @example
  3661. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  3662. @end example
  3663. @end itemize
  3664. @section dctdnoiz
  3665. Denoise frames using 2D DCT (frequency domain filtering).
  3666. This filter is not designed for real time.
  3667. The filter accepts the following options:
  3668. @table @option
  3669. @item sigma, s
  3670. Set the noise sigma constant.
  3671. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  3672. coefficient (absolute value) below this threshold with be dropped.
  3673. If you need a more advanced filtering, see @option{expr}.
  3674. Default is @code{0}.
  3675. @item overlap
  3676. Set number overlapping pixels for each block. Since the filter can be slow, you
  3677. may want to reduce this value, at the cost of a less effective filter and the
  3678. risk of various artefacts.
  3679. If the overlapping value doesn't permit processing the whole input width or
  3680. height, a warning will be displayed and according borders won't be denoised.
  3681. Default value is @var{blocksize}-1, which is the best possible setting.
  3682. @item expr, e
  3683. Set the coefficient factor expression.
  3684. For each coefficient of a DCT block, this expression will be evaluated as a
  3685. multiplier value for the coefficient.
  3686. If this is option is set, the @option{sigma} option will be ignored.
  3687. The absolute value of the coefficient can be accessed through the @var{c}
  3688. variable.
  3689. @item n
  3690. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  3691. @var{blocksize}, which is the width and height of the processed blocks.
  3692. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  3693. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  3694. on the speed processing. Also, a larger block size does not necessarily means a
  3695. better de-noising.
  3696. @end table
  3697. @subsection Examples
  3698. Apply a denoise with a @option{sigma} of @code{4.5}:
  3699. @example
  3700. dctdnoiz=4.5
  3701. @end example
  3702. The same operation can be achieved using the expression system:
  3703. @example
  3704. dctdnoiz=e='gte(c, 4.5*3)'
  3705. @end example
  3706. Violent denoise using a block size of @code{16x16}:
  3707. @example
  3708. dctdnoiz=15:n=4
  3709. @end example
  3710. @section deband
  3711. Remove banding artifacts from input video.
  3712. It works by replacing banded pixels with average value of referenced pixels.
  3713. The filter accepts the following options:
  3714. @table @option
  3715. @item 1thr
  3716. @item 2thr
  3717. @item 3thr
  3718. @item 4thr
  3719. Set banding detection threshold for each plane. Default is 0.02.
  3720. Valid range is 0.00003 to 0.5.
  3721. If difference between current pixel and reference pixel is less than threshold,
  3722. it will be considered as banded.
  3723. @item range, r
  3724. Banding detection range in pixels. Default is 16. If positive, random number
  3725. in range 0 to set value will be used. If negative, exact absolute value
  3726. will be used.
  3727. The range defines square of four pixels around current pixel.
  3728. @item direction, d
  3729. Set direction in radians from which four pixel will be compared. If positive,
  3730. random direction from 0 to set direction will be picked. If negative, exact of
  3731. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  3732. will pick only pixels on same row and -PI/2 will pick only pixels on same
  3733. column.
  3734. @item blur
  3735. If enabled, current pixel is compared with average value of all four
  3736. surrounding pixels. The default is enabled. If disabled current pixel is
  3737. compared with all four surrounding pixels. The pixel is considered banded
  3738. if only all four differences with surrounding pixels are less than threshold.
  3739. @end table
  3740. @anchor{decimate}
  3741. @section decimate
  3742. Drop duplicated frames at regular intervals.
  3743. The filter accepts the following options:
  3744. @table @option
  3745. @item cycle
  3746. Set the number of frames from which one will be dropped. Setting this to
  3747. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  3748. Default is @code{5}.
  3749. @item dupthresh
  3750. Set the threshold for duplicate detection. If the difference metric for a frame
  3751. is less than or equal to this value, then it is declared as duplicate. Default
  3752. is @code{1.1}
  3753. @item scthresh
  3754. Set scene change threshold. Default is @code{15}.
  3755. @item blockx
  3756. @item blocky
  3757. Set the size of the x and y-axis blocks used during metric calculations.
  3758. Larger blocks give better noise suppression, but also give worse detection of
  3759. small movements. Must be a power of two. Default is @code{32}.
  3760. @item ppsrc
  3761. Mark main input as a pre-processed input and activate clean source input
  3762. stream. This allows the input to be pre-processed with various filters to help
  3763. the metrics calculation while keeping the frame selection lossless. When set to
  3764. @code{1}, the first stream is for the pre-processed input, and the second
  3765. stream is the clean source from where the kept frames are chosen. Default is
  3766. @code{0}.
  3767. @item chroma
  3768. Set whether or not chroma is considered in the metric calculations. Default is
  3769. @code{1}.
  3770. @end table
  3771. @section deflate
  3772. Apply deflate effect to the video.
  3773. This filter replaces the pixel by the local(3x3) average by taking into account
  3774. only values lower than the pixel.
  3775. It accepts the following options:
  3776. @table @option
  3777. @item threshold0
  3778. @item threshold1
  3779. @item threshold2
  3780. @item threshold3
  3781. Limit the maximum change for each plane, default is 65535.
  3782. If 0, plane will remain unchanged.
  3783. @end table
  3784. @section dejudder
  3785. Remove judder produced by partially interlaced telecined content.
  3786. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  3787. source was partially telecined content then the output of @code{pullup,dejudder}
  3788. will have a variable frame rate. May change the recorded frame rate of the
  3789. container. Aside from that change, this filter will not affect constant frame
  3790. rate video.
  3791. The option available in this filter is:
  3792. @table @option
  3793. @item cycle
  3794. Specify the length of the window over which the judder repeats.
  3795. Accepts any integer greater than 1. Useful values are:
  3796. @table @samp
  3797. @item 4
  3798. If the original was telecined from 24 to 30 fps (Film to NTSC).
  3799. @item 5
  3800. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  3801. @item 20
  3802. If a mixture of the two.
  3803. @end table
  3804. The default is @samp{4}.
  3805. @end table
  3806. @section delogo
  3807. Suppress a TV station logo by a simple interpolation of the surrounding
  3808. pixels. Just set a rectangle covering the logo and watch it disappear
  3809. (and sometimes something even uglier appear - your mileage may vary).
  3810. It accepts the following parameters:
  3811. @table @option
  3812. @item x
  3813. @item y
  3814. Specify the top left corner coordinates of the logo. They must be
  3815. specified.
  3816. @item w
  3817. @item h
  3818. Specify the width and height of the logo to clear. They must be
  3819. specified.
  3820. @item band, t
  3821. Specify the thickness of the fuzzy edge of the rectangle (added to
  3822. @var{w} and @var{h}). The default value is 1. This option is
  3823. deprecated, setting higher values should no longer be necessary and
  3824. is not recommended.
  3825. @item show
  3826. When set to 1, a green rectangle is drawn on the screen to simplify
  3827. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  3828. The default value is 0.
  3829. The rectangle is drawn on the outermost pixels which will be (partly)
  3830. replaced with interpolated values. The values of the next pixels
  3831. immediately outside this rectangle in each direction will be used to
  3832. compute the interpolated pixel values inside the rectangle.
  3833. @end table
  3834. @subsection Examples
  3835. @itemize
  3836. @item
  3837. Set a rectangle covering the area with top left corner coordinates 0,0
  3838. and size 100x77, and a band of size 10:
  3839. @example
  3840. delogo=x=0:y=0:w=100:h=77:band=10
  3841. @end example
  3842. @end itemize
  3843. @section deshake
  3844. Attempt to fix small changes in horizontal and/or vertical shift. This
  3845. filter helps remove camera shake from hand-holding a camera, bumping a
  3846. tripod, moving on a vehicle, etc.
  3847. The filter accepts the following options:
  3848. @table @option
  3849. @item x
  3850. @item y
  3851. @item w
  3852. @item h
  3853. Specify a rectangular area where to limit the search for motion
  3854. vectors.
  3855. If desired the search for motion vectors can be limited to a
  3856. rectangular area of the frame defined by its top left corner, width
  3857. and height. These parameters have the same meaning as the drawbox
  3858. filter which can be used to visualise the position of the bounding
  3859. box.
  3860. This is useful when simultaneous movement of subjects within the frame
  3861. might be confused for camera motion by the motion vector search.
  3862. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  3863. then the full frame is used. This allows later options to be set
  3864. without specifying the bounding box for the motion vector search.
  3865. Default - search the whole frame.
  3866. @item rx
  3867. @item ry
  3868. Specify the maximum extent of movement in x and y directions in the
  3869. range 0-64 pixels. Default 16.
  3870. @item edge
  3871. Specify how to generate pixels to fill blanks at the edge of the
  3872. frame. Available values are:
  3873. @table @samp
  3874. @item blank, 0
  3875. Fill zeroes at blank locations
  3876. @item original, 1
  3877. Original image at blank locations
  3878. @item clamp, 2
  3879. Extruded edge value at blank locations
  3880. @item mirror, 3
  3881. Mirrored edge at blank locations
  3882. @end table
  3883. Default value is @samp{mirror}.
  3884. @item blocksize
  3885. Specify the blocksize to use for motion search. Range 4-128 pixels,
  3886. default 8.
  3887. @item contrast
  3888. Specify the contrast threshold for blocks. Only blocks with more than
  3889. the specified contrast (difference between darkest and lightest
  3890. pixels) will be considered. Range 1-255, default 125.
  3891. @item search
  3892. Specify the search strategy. Available values are:
  3893. @table @samp
  3894. @item exhaustive, 0
  3895. Set exhaustive search
  3896. @item less, 1
  3897. Set less exhaustive search.
  3898. @end table
  3899. Default value is @samp{exhaustive}.
  3900. @item filename
  3901. If set then a detailed log of the motion search is written to the
  3902. specified file.
  3903. @item opencl
  3904. If set to 1, specify using OpenCL capabilities, only available if
  3905. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  3906. @end table
  3907. @section detelecine
  3908. Apply an exact inverse of the telecine operation. It requires a predefined
  3909. pattern specified using the pattern option which must be the same as that passed
  3910. to the telecine filter.
  3911. This filter accepts the following options:
  3912. @table @option
  3913. @item first_field
  3914. @table @samp
  3915. @item top, t
  3916. top field first
  3917. @item bottom, b
  3918. bottom field first
  3919. The default value is @code{top}.
  3920. @end table
  3921. @item pattern
  3922. A string of numbers representing the pulldown pattern you wish to apply.
  3923. The default value is @code{23}.
  3924. @item start_frame
  3925. A number representing position of the first frame with respect to the telecine
  3926. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  3927. @end table
  3928. @section dilation
  3929. Apply dilation effect to the video.
  3930. This filter replaces the pixel by the local(3x3) maximum.
  3931. It accepts the following options:
  3932. @table @option
  3933. @item threshold0
  3934. @item threshold1
  3935. @item threshold2
  3936. @item threshold3
  3937. Limit the maximum change for each plane, default is 65535.
  3938. If 0, plane will remain unchanged.
  3939. @item coordinates
  3940. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  3941. pixels are used.
  3942. Flags to local 3x3 coordinates maps like this:
  3943. 1 2 3
  3944. 4 5
  3945. 6 7 8
  3946. @end table
  3947. @section displace
  3948. Displace pixels as indicated by second and third input stream.
  3949. It takes three input streams and outputs one stream, the first input is the
  3950. source, and second and third input are displacement maps.
  3951. The second input specifies how much to displace pixels along the
  3952. x-axis, while the third input specifies how much to displace pixels
  3953. along the y-axis.
  3954. If one of displacement map streams terminates, last frame from that
  3955. displacement map will be used.
  3956. Note that once generated, displacements maps can be reused over and over again.
  3957. A description of the accepted options follows.
  3958. @table @option
  3959. @item edge
  3960. Set displace behavior for pixels that are out of range.
  3961. Available values are:
  3962. @table @samp
  3963. @item blank
  3964. Missing pixels are replaced by black pixels.
  3965. @item smear
  3966. Adjacent pixels will spread out to replace missing pixels.
  3967. @item wrap
  3968. Out of range pixels are wrapped so they point to pixels of other side.
  3969. @end table
  3970. Default is @samp{smear}.
  3971. @end table
  3972. @subsection Examples
  3973. @itemize
  3974. @item
  3975. Add ripple effect to rgb input of video size hd720:
  3976. @example
  3977. 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
  3978. @end example
  3979. @item
  3980. Add wave effect to rgb input of video size hd720:
  3981. @example
  3982. 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
  3983. @end example
  3984. @end itemize
  3985. @section drawbox
  3986. Draw a colored box on the input image.
  3987. It accepts the following parameters:
  3988. @table @option
  3989. @item x
  3990. @item y
  3991. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  3992. @item width, w
  3993. @item height, h
  3994. The expressions which specify the width and height of the box; if 0 they are interpreted as
  3995. the input width and height. It defaults to 0.
  3996. @item color, c
  3997. Specify the color of the box to write. For the general syntax of this option,
  3998. check the "Color" section in the ffmpeg-utils manual. If the special
  3999. value @code{invert} is used, the box edge color is the same as the
  4000. video with inverted luma.
  4001. @item thickness, t
  4002. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4003. See below for the list of accepted constants.
  4004. @end table
  4005. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4006. following constants:
  4007. @table @option
  4008. @item dar
  4009. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4010. @item hsub
  4011. @item vsub
  4012. horizontal and vertical chroma subsample values. For example for the
  4013. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4014. @item in_h, ih
  4015. @item in_w, iw
  4016. The input width and height.
  4017. @item sar
  4018. The input sample aspect ratio.
  4019. @item x
  4020. @item y
  4021. The x and y offset coordinates where the box is drawn.
  4022. @item w
  4023. @item h
  4024. The width and height of the drawn box.
  4025. @item t
  4026. The thickness of the drawn box.
  4027. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4028. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4029. @end table
  4030. @subsection Examples
  4031. @itemize
  4032. @item
  4033. Draw a black box around the edge of the input image:
  4034. @example
  4035. drawbox
  4036. @end example
  4037. @item
  4038. Draw a box with color red and an opacity of 50%:
  4039. @example
  4040. drawbox=10:20:200:60:red@@0.5
  4041. @end example
  4042. The previous example can be specified as:
  4043. @example
  4044. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  4045. @end example
  4046. @item
  4047. Fill the box with pink color:
  4048. @example
  4049. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  4050. @end example
  4051. @item
  4052. Draw a 2-pixel red 2.40:1 mask:
  4053. @example
  4054. 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
  4055. @end example
  4056. @end itemize
  4057. @section drawgraph, adrawgraph
  4058. Draw a graph using input video or audio metadata.
  4059. It accepts the following parameters:
  4060. @table @option
  4061. @item m1
  4062. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  4063. @item fg1
  4064. Set 1st foreground color expression.
  4065. @item m2
  4066. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  4067. @item fg2
  4068. Set 2nd foreground color expression.
  4069. @item m3
  4070. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  4071. @item fg3
  4072. Set 3rd foreground color expression.
  4073. @item m4
  4074. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  4075. @item fg4
  4076. Set 4th foreground color expression.
  4077. @item min
  4078. Set minimal value of metadata value.
  4079. @item max
  4080. Set maximal value of metadata value.
  4081. @item bg
  4082. Set graph background color. Default is white.
  4083. @item mode
  4084. Set graph mode.
  4085. Available values for mode is:
  4086. @table @samp
  4087. @item bar
  4088. @item dot
  4089. @item line
  4090. @end table
  4091. Default is @code{line}.
  4092. @item slide
  4093. Set slide mode.
  4094. Available values for slide is:
  4095. @table @samp
  4096. @item frame
  4097. Draw new frame when right border is reached.
  4098. @item replace
  4099. Replace old columns with new ones.
  4100. @item scroll
  4101. Scroll from right to left.
  4102. @item rscroll
  4103. Scroll from left to right.
  4104. @end table
  4105. Default is @code{frame}.
  4106. @item size
  4107. Set size of graph video. For the syntax of this option, check the
  4108. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  4109. The default value is @code{900x256}.
  4110. The foreground color expressions can use the following variables:
  4111. @table @option
  4112. @item MIN
  4113. Minimal value of metadata value.
  4114. @item MAX
  4115. Maximal value of metadata value.
  4116. @item VAL
  4117. Current metadata key value.
  4118. @end table
  4119. The color is defined as 0xAABBGGRR.
  4120. @end table
  4121. Example using metadata from @ref{signalstats} filter:
  4122. @example
  4123. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  4124. @end example
  4125. Example using metadata from @ref{ebur128} filter:
  4126. @example
  4127. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  4128. @end example
  4129. @section drawgrid
  4130. Draw a grid on the input image.
  4131. It accepts the following parameters:
  4132. @table @option
  4133. @item x
  4134. @item y
  4135. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  4136. @item width, w
  4137. @item height, h
  4138. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  4139. input width and height, respectively, minus @code{thickness}, so image gets
  4140. framed. Default to 0.
  4141. @item color, c
  4142. Specify the color of the grid. For the general syntax of this option,
  4143. check the "Color" section in the ffmpeg-utils manual. If the special
  4144. value @code{invert} is used, the grid color is the same as the
  4145. video with inverted luma.
  4146. @item thickness, t
  4147. The expression which sets the thickness of the grid line. Default value is @code{1}.
  4148. See below for the list of accepted constants.
  4149. @end table
  4150. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4151. following constants:
  4152. @table @option
  4153. @item dar
  4154. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4155. @item hsub
  4156. @item vsub
  4157. horizontal and vertical chroma subsample values. For example for the
  4158. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4159. @item in_h, ih
  4160. @item in_w, iw
  4161. The input grid cell width and height.
  4162. @item sar
  4163. The input sample aspect ratio.
  4164. @item x
  4165. @item y
  4166. The x and y coordinates of some point of grid intersection (meant to configure offset).
  4167. @item w
  4168. @item h
  4169. The width and height of the drawn cell.
  4170. @item t
  4171. The thickness of the drawn cell.
  4172. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4173. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4174. @end table
  4175. @subsection Examples
  4176. @itemize
  4177. @item
  4178. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  4179. @example
  4180. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  4181. @end example
  4182. @item
  4183. Draw a white 3x3 grid with an opacity of 50%:
  4184. @example
  4185. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  4186. @end example
  4187. @end itemize
  4188. @anchor{drawtext}
  4189. @section drawtext
  4190. Draw a text string or text from a specified file on top of a video, using the
  4191. libfreetype library.
  4192. To enable compilation of this filter, you need to configure FFmpeg with
  4193. @code{--enable-libfreetype}.
  4194. To enable default font fallback and the @var{font} option you need to
  4195. configure FFmpeg with @code{--enable-libfontconfig}.
  4196. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  4197. @code{--enable-libfribidi}.
  4198. @subsection Syntax
  4199. It accepts the following parameters:
  4200. @table @option
  4201. @item box
  4202. Used to draw a box around text using the background color.
  4203. The value must be either 1 (enable) or 0 (disable).
  4204. The default value of @var{box} is 0.
  4205. @item boxborderw
  4206. Set the width of the border to be drawn around the box using @var{boxcolor}.
  4207. The default value of @var{boxborderw} is 0.
  4208. @item boxcolor
  4209. The color to be used for drawing box around text. For the syntax of this
  4210. option, check the "Color" section in the ffmpeg-utils manual.
  4211. The default value of @var{boxcolor} is "white".
  4212. @item borderw
  4213. Set the width of the border to be drawn around the text using @var{bordercolor}.
  4214. The default value of @var{borderw} is 0.
  4215. @item bordercolor
  4216. Set the color to be used for drawing border around text. For the syntax of this
  4217. option, check the "Color" section in the ffmpeg-utils manual.
  4218. The default value of @var{bordercolor} is "black".
  4219. @item expansion
  4220. Select how the @var{text} is expanded. Can be either @code{none},
  4221. @code{strftime} (deprecated) or
  4222. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  4223. below for details.
  4224. @item fix_bounds
  4225. If true, check and fix text coords to avoid clipping.
  4226. @item fontcolor
  4227. The color to be used for drawing fonts. For the syntax of this option, check
  4228. the "Color" section in the ffmpeg-utils manual.
  4229. The default value of @var{fontcolor} is "black".
  4230. @item fontcolor_expr
  4231. String which is expanded the same way as @var{text} to obtain dynamic
  4232. @var{fontcolor} value. By default this option has empty value and is not
  4233. processed. When this option is set, it overrides @var{fontcolor} option.
  4234. @item font
  4235. The font family to be used for drawing text. By default Sans.
  4236. @item fontfile
  4237. The font file to be used for drawing text. The path must be included.
  4238. This parameter is mandatory if the fontconfig support is disabled.
  4239. @item draw
  4240. This option does not exist, please see the timeline system
  4241. @item alpha
  4242. Draw the text applying alpha blending. The value can
  4243. be either a number between 0.0 and 1.0
  4244. The expression accepts the same variables @var{x, y} do.
  4245. The default value is 1.
  4246. Please see fontcolor_expr
  4247. @item fontsize
  4248. The font size to be used for drawing text.
  4249. The default value of @var{fontsize} is 16.
  4250. @item text_shaping
  4251. If set to 1, attempt to shape the text (for example, reverse the order of
  4252. right-to-left text and join Arabic characters) before drawing it.
  4253. Otherwise, just draw the text exactly as given.
  4254. By default 1 (if supported).
  4255. @item ft_load_flags
  4256. The flags to be used for loading the fonts.
  4257. The flags map the corresponding flags supported by libfreetype, and are
  4258. a combination of the following values:
  4259. @table @var
  4260. @item default
  4261. @item no_scale
  4262. @item no_hinting
  4263. @item render
  4264. @item no_bitmap
  4265. @item vertical_layout
  4266. @item force_autohint
  4267. @item crop_bitmap
  4268. @item pedantic
  4269. @item ignore_global_advance_width
  4270. @item no_recurse
  4271. @item ignore_transform
  4272. @item monochrome
  4273. @item linear_design
  4274. @item no_autohint
  4275. @end table
  4276. Default value is "default".
  4277. For more information consult the documentation for the FT_LOAD_*
  4278. libfreetype flags.
  4279. @item shadowcolor
  4280. The color to be used for drawing a shadow behind the drawn text. For the
  4281. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  4282. The default value of @var{shadowcolor} is "black".
  4283. @item shadowx
  4284. @item shadowy
  4285. The x and y offsets for the text shadow position with respect to the
  4286. position of the text. They can be either positive or negative
  4287. values. The default value for both is "0".
  4288. @item start_number
  4289. The starting frame number for the n/frame_num variable. The default value
  4290. is "0".
  4291. @item tabsize
  4292. The size in number of spaces to use for rendering the tab.
  4293. Default value is 4.
  4294. @item timecode
  4295. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  4296. format. It can be used with or without text parameter. @var{timecode_rate}
  4297. option must be specified.
  4298. @item timecode_rate, rate, r
  4299. Set the timecode frame rate (timecode only).
  4300. @item text
  4301. The text string to be drawn. The text must be a sequence of UTF-8
  4302. encoded characters.
  4303. This parameter is mandatory if no file is specified with the parameter
  4304. @var{textfile}.
  4305. @item textfile
  4306. A text file containing text to be drawn. The text must be a sequence
  4307. of UTF-8 encoded characters.
  4308. This parameter is mandatory if no text string is specified with the
  4309. parameter @var{text}.
  4310. If both @var{text} and @var{textfile} are specified, an error is thrown.
  4311. @item reload
  4312. If set to 1, the @var{textfile} will be reloaded before each frame.
  4313. Be sure to update it atomically, or it may be read partially, or even fail.
  4314. @item x
  4315. @item y
  4316. The expressions which specify the offsets where text will be drawn
  4317. within the video frame. They are relative to the top/left border of the
  4318. output image.
  4319. The default value of @var{x} and @var{y} is "0".
  4320. See below for the list of accepted constants and functions.
  4321. @end table
  4322. The parameters for @var{x} and @var{y} are expressions containing the
  4323. following constants and functions:
  4324. @table @option
  4325. @item dar
  4326. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  4327. @item hsub
  4328. @item vsub
  4329. horizontal and vertical chroma subsample values. For example for the
  4330. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4331. @item line_h, lh
  4332. the height of each text line
  4333. @item main_h, h, H
  4334. the input height
  4335. @item main_w, w, W
  4336. the input width
  4337. @item max_glyph_a, ascent
  4338. the maximum distance from the baseline to the highest/upper grid
  4339. coordinate used to place a glyph outline point, for all the rendered
  4340. glyphs.
  4341. It is a positive value, due to the grid's orientation with the Y axis
  4342. upwards.
  4343. @item max_glyph_d, descent
  4344. the maximum distance from the baseline to the lowest grid coordinate
  4345. used to place a glyph outline point, for all the rendered glyphs.
  4346. This is a negative value, due to the grid's orientation, with the Y axis
  4347. upwards.
  4348. @item max_glyph_h
  4349. maximum glyph height, that is the maximum height for all the glyphs
  4350. contained in the rendered text, it is equivalent to @var{ascent} -
  4351. @var{descent}.
  4352. @item max_glyph_w
  4353. maximum glyph width, that is the maximum width for all the glyphs
  4354. contained in the rendered text
  4355. @item n
  4356. the number of input frame, starting from 0
  4357. @item rand(min, max)
  4358. return a random number included between @var{min} and @var{max}
  4359. @item sar
  4360. The input sample aspect ratio.
  4361. @item t
  4362. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4363. @item text_h, th
  4364. the height of the rendered text
  4365. @item text_w, tw
  4366. the width of the rendered text
  4367. @item x
  4368. @item y
  4369. the x and y offset coordinates where the text is drawn.
  4370. These parameters allow the @var{x} and @var{y} expressions to refer
  4371. each other, so you can for example specify @code{y=x/dar}.
  4372. @end table
  4373. @anchor{drawtext_expansion}
  4374. @subsection Text expansion
  4375. If @option{expansion} is set to @code{strftime},
  4376. the filter recognizes strftime() sequences in the provided text and
  4377. expands them accordingly. Check the documentation of strftime(). This
  4378. feature is deprecated.
  4379. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  4380. If @option{expansion} is set to @code{normal} (which is the default),
  4381. the following expansion mechanism is used.
  4382. The backslash character @samp{\}, followed by any character, always expands to
  4383. the second character.
  4384. Sequence of the form @code{%@{...@}} are expanded. The text between the
  4385. braces is a function name, possibly followed by arguments separated by ':'.
  4386. If the arguments contain special characters or delimiters (':' or '@}'),
  4387. they should be escaped.
  4388. Note that they probably must also be escaped as the value for the
  4389. @option{text} option in the filter argument string and as the filter
  4390. argument in the filtergraph description, and possibly also for the shell,
  4391. that makes up to four levels of escaping; using a text file avoids these
  4392. problems.
  4393. The following functions are available:
  4394. @table @command
  4395. @item expr, e
  4396. The expression evaluation result.
  4397. It must take one argument specifying the expression to be evaluated,
  4398. which accepts the same constants and functions as the @var{x} and
  4399. @var{y} values. Note that not all constants should be used, for
  4400. example the text size is not known when evaluating the expression, so
  4401. the constants @var{text_w} and @var{text_h} will have an undefined
  4402. value.
  4403. @item expr_int_format, eif
  4404. Evaluate the expression's value and output as formatted integer.
  4405. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  4406. The second argument specifies the output format. Allowed values are @samp{x},
  4407. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  4408. @code{printf} function.
  4409. The third parameter is optional and sets the number of positions taken by the output.
  4410. It can be used to add padding with zeros from the left.
  4411. @item gmtime
  4412. The time at which the filter is running, expressed in UTC.
  4413. It can accept an argument: a strftime() format string.
  4414. @item localtime
  4415. The time at which the filter is running, expressed in the local time zone.
  4416. It can accept an argument: a strftime() format string.
  4417. @item metadata
  4418. Frame metadata. It must take one argument specifying metadata key.
  4419. @item n, frame_num
  4420. The frame number, starting from 0.
  4421. @item pict_type
  4422. A 1 character description of the current picture type.
  4423. @item pts
  4424. The timestamp of the current frame.
  4425. It can take up to three arguments.
  4426. The first argument is the format of the timestamp; it defaults to @code{flt}
  4427. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  4428. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  4429. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  4430. @code{localtime} stands for the timestamp of the frame formatted as
  4431. local time zone time.
  4432. The second argument is an offset added to the timestamp.
  4433. If the format is set to @code{localtime} or @code{gmtime},
  4434. a third argument may be supplied: a strftime() format string.
  4435. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  4436. @end table
  4437. @subsection Examples
  4438. @itemize
  4439. @item
  4440. Draw "Test Text" with font FreeSerif, using the default values for the
  4441. optional parameters.
  4442. @example
  4443. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  4444. @end example
  4445. @item
  4446. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  4447. and y=50 (counting from the top-left corner of the screen), text is
  4448. yellow with a red box around it. Both the text and the box have an
  4449. opacity of 20%.
  4450. @example
  4451. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  4452. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  4453. @end example
  4454. Note that the double quotes are not necessary if spaces are not used
  4455. within the parameter list.
  4456. @item
  4457. Show the text at the center of the video frame:
  4458. @example
  4459. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  4460. @end example
  4461. @item
  4462. Show a text line sliding from right to left in the last row of the video
  4463. frame. The file @file{LONG_LINE} is assumed to contain a single line
  4464. with no newlines.
  4465. @example
  4466. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  4467. @end example
  4468. @item
  4469. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  4470. @example
  4471. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  4472. @end example
  4473. @item
  4474. Draw a single green letter "g", at the center of the input video.
  4475. The glyph baseline is placed at half screen height.
  4476. @example
  4477. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  4478. @end example
  4479. @item
  4480. Show text for 1 second every 3 seconds:
  4481. @example
  4482. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  4483. @end example
  4484. @item
  4485. Use fontconfig to set the font. Note that the colons need to be escaped.
  4486. @example
  4487. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  4488. @end example
  4489. @item
  4490. Print the date of a real-time encoding (see strftime(3)):
  4491. @example
  4492. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  4493. @end example
  4494. @item
  4495. Show text fading in and out (appearing/disappearing):
  4496. @example
  4497. #!/bin/sh
  4498. DS=1.0 # display start
  4499. DE=10.0 # display end
  4500. FID=1.5 # fade in duration
  4501. FOD=5 # fade out duration
  4502. 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 @}"
  4503. @end example
  4504. @end itemize
  4505. For more information about libfreetype, check:
  4506. @url{http://www.freetype.org/}.
  4507. For more information about fontconfig, check:
  4508. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  4509. For more information about libfribidi, check:
  4510. @url{http://fribidi.org/}.
  4511. @section edgedetect
  4512. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  4513. The filter accepts the following options:
  4514. @table @option
  4515. @item low
  4516. @item high
  4517. Set low and high threshold values used by the Canny thresholding
  4518. algorithm.
  4519. The high threshold selects the "strong" edge pixels, which are then
  4520. connected through 8-connectivity with the "weak" edge pixels selected
  4521. by the low threshold.
  4522. @var{low} and @var{high} threshold values must be chosen in the range
  4523. [0,1], and @var{low} should be lesser or equal to @var{high}.
  4524. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  4525. is @code{50/255}.
  4526. @item mode
  4527. Define the drawing mode.
  4528. @table @samp
  4529. @item wires
  4530. Draw white/gray wires on black background.
  4531. @item colormix
  4532. Mix the colors to create a paint/cartoon effect.
  4533. @end table
  4534. Default value is @var{wires}.
  4535. @end table
  4536. @subsection Examples
  4537. @itemize
  4538. @item
  4539. Standard edge detection with custom values for the hysteresis thresholding:
  4540. @example
  4541. edgedetect=low=0.1:high=0.4
  4542. @end example
  4543. @item
  4544. Painting effect without thresholding:
  4545. @example
  4546. edgedetect=mode=colormix:high=0
  4547. @end example
  4548. @end itemize
  4549. @section eq
  4550. Set brightness, contrast, saturation and approximate gamma adjustment.
  4551. The filter accepts the following options:
  4552. @table @option
  4553. @item contrast
  4554. Set the contrast expression. The value must be a float value in range
  4555. @code{-2.0} to @code{2.0}. The default value is "1".
  4556. @item brightness
  4557. Set the brightness expression. The value must be a float value in
  4558. range @code{-1.0} to @code{1.0}. The default value is "0".
  4559. @item saturation
  4560. Set the saturation expression. The value must be a float in
  4561. range @code{0.0} to @code{3.0}. The default value is "1".
  4562. @item gamma
  4563. Set the gamma expression. The value must be a float in range
  4564. @code{0.1} to @code{10.0}. The default value is "1".
  4565. @item gamma_r
  4566. Set the gamma expression for red. The value must be a float in
  4567. range @code{0.1} to @code{10.0}. The default value is "1".
  4568. @item gamma_g
  4569. Set the gamma expression for green. The value must be a float in range
  4570. @code{0.1} to @code{10.0}. The default value is "1".
  4571. @item gamma_b
  4572. Set the gamma expression for blue. The value must be a float in range
  4573. @code{0.1} to @code{10.0}. The default value is "1".
  4574. @item gamma_weight
  4575. Set the gamma weight expression. It can be used to reduce the effect
  4576. of a high gamma value on bright image areas, e.g. keep them from
  4577. getting overamplified and just plain white. The value must be a float
  4578. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  4579. gamma correction all the way down while @code{1.0} leaves it at its
  4580. full strength. Default is "1".
  4581. @item eval
  4582. Set when the expressions for brightness, contrast, saturation and
  4583. gamma expressions are evaluated.
  4584. It accepts the following values:
  4585. @table @samp
  4586. @item init
  4587. only evaluate expressions once during the filter initialization or
  4588. when a command is processed
  4589. @item frame
  4590. evaluate expressions for each incoming frame
  4591. @end table
  4592. Default value is @samp{init}.
  4593. @end table
  4594. The expressions accept the following parameters:
  4595. @table @option
  4596. @item n
  4597. frame count of the input frame starting from 0
  4598. @item pos
  4599. byte position of the corresponding packet in the input file, NAN if
  4600. unspecified
  4601. @item r
  4602. frame rate of the input video, NAN if the input frame rate is unknown
  4603. @item t
  4604. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4605. @end table
  4606. @subsection Commands
  4607. The filter supports the following commands:
  4608. @table @option
  4609. @item contrast
  4610. Set the contrast expression.
  4611. @item brightness
  4612. Set the brightness expression.
  4613. @item saturation
  4614. Set the saturation expression.
  4615. @item gamma
  4616. Set the gamma expression.
  4617. @item gamma_r
  4618. Set the gamma_r expression.
  4619. @item gamma_g
  4620. Set gamma_g expression.
  4621. @item gamma_b
  4622. Set gamma_b expression.
  4623. @item gamma_weight
  4624. Set gamma_weight expression.
  4625. The command accepts the same syntax of the corresponding option.
  4626. If the specified expression is not valid, it is kept at its current
  4627. value.
  4628. @end table
  4629. @section erosion
  4630. Apply erosion effect to the video.
  4631. This filter replaces the pixel by the local(3x3) minimum.
  4632. It accepts the following options:
  4633. @table @option
  4634. @item threshold0
  4635. @item threshold1
  4636. @item threshold2
  4637. @item threshold3
  4638. Limit the maximum change for each plane, default is 65535.
  4639. If 0, plane will remain unchanged.
  4640. @item coordinates
  4641. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4642. pixels are used.
  4643. Flags to local 3x3 coordinates maps like this:
  4644. 1 2 3
  4645. 4 5
  4646. 6 7 8
  4647. @end table
  4648. @section extractplanes
  4649. Extract color channel components from input video stream into
  4650. separate grayscale video streams.
  4651. The filter accepts the following option:
  4652. @table @option
  4653. @item planes
  4654. Set plane(s) to extract.
  4655. Available values for planes are:
  4656. @table @samp
  4657. @item y
  4658. @item u
  4659. @item v
  4660. @item a
  4661. @item r
  4662. @item g
  4663. @item b
  4664. @end table
  4665. Choosing planes not available in the input will result in an error.
  4666. That means you cannot select @code{r}, @code{g}, @code{b} planes
  4667. with @code{y}, @code{u}, @code{v} planes at same time.
  4668. @end table
  4669. @subsection Examples
  4670. @itemize
  4671. @item
  4672. Extract luma, u and v color channel component from input video frame
  4673. into 3 grayscale outputs:
  4674. @example
  4675. 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
  4676. @end example
  4677. @end itemize
  4678. @section elbg
  4679. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  4680. For each input image, the filter will compute the optimal mapping from
  4681. the input to the output given the codebook length, that is the number
  4682. of distinct output colors.
  4683. This filter accepts the following options.
  4684. @table @option
  4685. @item codebook_length, l
  4686. Set codebook length. The value must be a positive integer, and
  4687. represents the number of distinct output colors. Default value is 256.
  4688. @item nb_steps, n
  4689. Set the maximum number of iterations to apply for computing the optimal
  4690. mapping. The higher the value the better the result and the higher the
  4691. computation time. Default value is 1.
  4692. @item seed, s
  4693. Set a random seed, must be an integer included between 0 and
  4694. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  4695. will try to use a good random seed on a best effort basis.
  4696. @item pal8
  4697. Set pal8 output pixel format. This option does not work with codebook
  4698. length greater than 256.
  4699. @end table
  4700. @section fade
  4701. Apply a fade-in/out effect to the input video.
  4702. It accepts the following parameters:
  4703. @table @option
  4704. @item type, t
  4705. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  4706. effect.
  4707. Default is @code{in}.
  4708. @item start_frame, s
  4709. Specify the number of the frame to start applying the fade
  4710. effect at. Default is 0.
  4711. @item nb_frames, n
  4712. The number of frames that the fade effect lasts. At the end of the
  4713. fade-in effect, the output video will have the same intensity as the input video.
  4714. At the end of the fade-out transition, the output video will be filled with the
  4715. selected @option{color}.
  4716. Default is 25.
  4717. @item alpha
  4718. If set to 1, fade only alpha channel, if one exists on the input.
  4719. Default value is 0.
  4720. @item start_time, st
  4721. Specify the timestamp (in seconds) of the frame to start to apply the fade
  4722. effect. If both start_frame and start_time are specified, the fade will start at
  4723. whichever comes last. Default is 0.
  4724. @item duration, d
  4725. The number of seconds for which the fade effect has to last. At the end of the
  4726. fade-in effect the output video will have the same intensity as the input video,
  4727. at the end of the fade-out transition the output video will be filled with the
  4728. selected @option{color}.
  4729. If both duration and nb_frames are specified, duration is used. Default is 0
  4730. (nb_frames is used by default).
  4731. @item color, c
  4732. Specify the color of the fade. Default is "black".
  4733. @end table
  4734. @subsection Examples
  4735. @itemize
  4736. @item
  4737. Fade in the first 30 frames of video:
  4738. @example
  4739. fade=in:0:30
  4740. @end example
  4741. The command above is equivalent to:
  4742. @example
  4743. fade=t=in:s=0:n=30
  4744. @end example
  4745. @item
  4746. Fade out the last 45 frames of a 200-frame video:
  4747. @example
  4748. fade=out:155:45
  4749. fade=type=out:start_frame=155:nb_frames=45
  4750. @end example
  4751. @item
  4752. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  4753. @example
  4754. fade=in:0:25, fade=out:975:25
  4755. @end example
  4756. @item
  4757. Make the first 5 frames yellow, then fade in from frame 5-24:
  4758. @example
  4759. fade=in:5:20:color=yellow
  4760. @end example
  4761. @item
  4762. Fade in alpha over first 25 frames of video:
  4763. @example
  4764. fade=in:0:25:alpha=1
  4765. @end example
  4766. @item
  4767. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  4768. @example
  4769. fade=t=in:st=5.5:d=0.5
  4770. @end example
  4771. @end itemize
  4772. @section fftfilt
  4773. Apply arbitrary expressions to samples in frequency domain
  4774. @table @option
  4775. @item dc_Y
  4776. Adjust the dc value (gain) of the luma plane of the image. The filter
  4777. accepts an integer value in range @code{0} to @code{1000}. The default
  4778. value is set to @code{0}.
  4779. @item dc_U
  4780. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  4781. filter accepts an integer value in range @code{0} to @code{1000}. The
  4782. default value is set to @code{0}.
  4783. @item dc_V
  4784. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  4785. filter accepts an integer value in range @code{0} to @code{1000}. The
  4786. default value is set to @code{0}.
  4787. @item weight_Y
  4788. Set the frequency domain weight expression for the luma plane.
  4789. @item weight_U
  4790. Set the frequency domain weight expression for the 1st chroma plane.
  4791. @item weight_V
  4792. Set the frequency domain weight expression for the 2nd chroma plane.
  4793. The filter accepts the following variables:
  4794. @item X
  4795. @item Y
  4796. The coordinates of the current sample.
  4797. @item W
  4798. @item H
  4799. The width and height of the image.
  4800. @end table
  4801. @subsection Examples
  4802. @itemize
  4803. @item
  4804. High-pass:
  4805. @example
  4806. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  4807. @end example
  4808. @item
  4809. Low-pass:
  4810. @example
  4811. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  4812. @end example
  4813. @item
  4814. Sharpen:
  4815. @example
  4816. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  4817. @end example
  4818. @end itemize
  4819. @section field
  4820. Extract a single field from an interlaced image using stride
  4821. arithmetic to avoid wasting CPU time. The output frames are marked as
  4822. non-interlaced.
  4823. The filter accepts the following options:
  4824. @table @option
  4825. @item type
  4826. Specify whether to extract the top (if the value is @code{0} or
  4827. @code{top}) or the bottom field (if the value is @code{1} or
  4828. @code{bottom}).
  4829. @end table
  4830. @section fieldmatch
  4831. Field matching filter for inverse telecine. It is meant to reconstruct the
  4832. progressive frames from a telecined stream. The filter does not drop duplicated
  4833. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  4834. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  4835. The separation of the field matching and the decimation is notably motivated by
  4836. the possibility of inserting a de-interlacing filter fallback between the two.
  4837. If the source has mixed telecined and real interlaced content,
  4838. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  4839. But these remaining combed frames will be marked as interlaced, and thus can be
  4840. de-interlaced by a later filter such as @ref{yadif} before decimation.
  4841. In addition to the various configuration options, @code{fieldmatch} can take an
  4842. optional second stream, activated through the @option{ppsrc} option. If
  4843. enabled, the frames reconstruction will be based on the fields and frames from
  4844. this second stream. This allows the first input to be pre-processed in order to
  4845. help the various algorithms of the filter, while keeping the output lossless
  4846. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  4847. or brightness/contrast adjustments can help.
  4848. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  4849. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  4850. which @code{fieldmatch} is based on. While the semantic and usage are very
  4851. close, some behaviour and options names can differ.
  4852. The @ref{decimate} filter currently only works for constant frame rate input.
  4853. If your input has mixed telecined (30fps) and progressive content with a lower
  4854. framerate like 24fps use the following filterchain to produce the necessary cfr
  4855. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  4856. The filter accepts the following options:
  4857. @table @option
  4858. @item order
  4859. Specify the assumed field order of the input stream. Available values are:
  4860. @table @samp
  4861. @item auto
  4862. Auto detect parity (use FFmpeg's internal parity value).
  4863. @item bff
  4864. Assume bottom field first.
  4865. @item tff
  4866. Assume top field first.
  4867. @end table
  4868. Note that it is sometimes recommended not to trust the parity announced by the
  4869. stream.
  4870. Default value is @var{auto}.
  4871. @item mode
  4872. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  4873. sense that it won't risk creating jerkiness due to duplicate frames when
  4874. possible, but if there are bad edits or blended fields it will end up
  4875. outputting combed frames when a good match might actually exist. On the other
  4876. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  4877. but will almost always find a good frame if there is one. The other values are
  4878. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  4879. jerkiness and creating duplicate frames versus finding good matches in sections
  4880. with bad edits, orphaned fields, blended fields, etc.
  4881. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  4882. Available values are:
  4883. @table @samp
  4884. @item pc
  4885. 2-way matching (p/c)
  4886. @item pc_n
  4887. 2-way matching, and trying 3rd match if still combed (p/c + n)
  4888. @item pc_u
  4889. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  4890. @item pc_n_ub
  4891. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  4892. still combed (p/c + n + u/b)
  4893. @item pcn
  4894. 3-way matching (p/c/n)
  4895. @item pcn_ub
  4896. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  4897. detected as combed (p/c/n + u/b)
  4898. @end table
  4899. The parenthesis at the end indicate the matches that would be used for that
  4900. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  4901. @var{top}).
  4902. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  4903. the slowest.
  4904. Default value is @var{pc_n}.
  4905. @item ppsrc
  4906. Mark the main input stream as a pre-processed input, and enable the secondary
  4907. input stream as the clean source to pick the fields from. See the filter
  4908. introduction for more details. It is similar to the @option{clip2} feature from
  4909. VFM/TFM.
  4910. Default value is @code{0} (disabled).
  4911. @item field
  4912. Set the field to match from. It is recommended to set this to the same value as
  4913. @option{order} unless you experience matching failures with that setting. In
  4914. certain circumstances changing the field that is used to match from can have a
  4915. large impact on matching performance. Available values are:
  4916. @table @samp
  4917. @item auto
  4918. Automatic (same value as @option{order}).
  4919. @item bottom
  4920. Match from the bottom field.
  4921. @item top
  4922. Match from the top field.
  4923. @end table
  4924. Default value is @var{auto}.
  4925. @item mchroma
  4926. Set whether or not chroma is included during the match comparisons. In most
  4927. cases it is recommended to leave this enabled. You should set this to @code{0}
  4928. only if your clip has bad chroma problems such as heavy rainbowing or other
  4929. artifacts. Setting this to @code{0} could also be used to speed things up at
  4930. the cost of some accuracy.
  4931. Default value is @code{1}.
  4932. @item y0
  4933. @item y1
  4934. These define an exclusion band which excludes the lines between @option{y0} and
  4935. @option{y1} from being included in the field matching decision. An exclusion
  4936. band can be used to ignore subtitles, a logo, or other things that may
  4937. interfere with the matching. @option{y0} sets the starting scan line and
  4938. @option{y1} sets the ending line; all lines in between @option{y0} and
  4939. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  4940. @option{y0} and @option{y1} to the same value will disable the feature.
  4941. @option{y0} and @option{y1} defaults to @code{0}.
  4942. @item scthresh
  4943. Set the scene change detection threshold as a percentage of maximum change on
  4944. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  4945. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  4946. @option{scthresh} is @code{[0.0, 100.0]}.
  4947. Default value is @code{12.0}.
  4948. @item combmatch
  4949. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  4950. account the combed scores of matches when deciding what match to use as the
  4951. final match. Available values are:
  4952. @table @samp
  4953. @item none
  4954. No final matching based on combed scores.
  4955. @item sc
  4956. Combed scores are only used when a scene change is detected.
  4957. @item full
  4958. Use combed scores all the time.
  4959. @end table
  4960. Default is @var{sc}.
  4961. @item combdbg
  4962. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  4963. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  4964. Available values are:
  4965. @table @samp
  4966. @item none
  4967. No forced calculation.
  4968. @item pcn
  4969. Force p/c/n calculations.
  4970. @item pcnub
  4971. Force p/c/n/u/b calculations.
  4972. @end table
  4973. Default value is @var{none}.
  4974. @item cthresh
  4975. This is the area combing threshold used for combed frame detection. This
  4976. essentially controls how "strong" or "visible" combing must be to be detected.
  4977. Larger values mean combing must be more visible and smaller values mean combing
  4978. can be less visible or strong and still be detected. Valid settings are from
  4979. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  4980. be detected as combed). This is basically a pixel difference value. A good
  4981. range is @code{[8, 12]}.
  4982. Default value is @code{9}.
  4983. @item chroma
  4984. Sets whether or not chroma is considered in the combed frame decision. Only
  4985. disable this if your source has chroma problems (rainbowing, etc.) that are
  4986. causing problems for the combed frame detection with chroma enabled. Actually,
  4987. using @option{chroma}=@var{0} is usually more reliable, except for the case
  4988. where there is chroma only combing in the source.
  4989. Default value is @code{0}.
  4990. @item blockx
  4991. @item blocky
  4992. Respectively set the x-axis and y-axis size of the window used during combed
  4993. frame detection. This has to do with the size of the area in which
  4994. @option{combpel} pixels are required to be detected as combed for a frame to be
  4995. declared combed. See the @option{combpel} parameter description for more info.
  4996. Possible values are any number that is a power of 2 starting at 4 and going up
  4997. to 512.
  4998. Default value is @code{16}.
  4999. @item combpel
  5000. The number of combed pixels inside any of the @option{blocky} by
  5001. @option{blockx} size blocks on the frame for the frame to be detected as
  5002. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5003. setting controls "how much" combing there must be in any localized area (a
  5004. window defined by the @option{blockx} and @option{blocky} settings) on the
  5005. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5006. which point no frames will ever be detected as combed). This setting is known
  5007. as @option{MI} in TFM/VFM vocabulary.
  5008. Default value is @code{80}.
  5009. @end table
  5010. @anchor{p/c/n/u/b meaning}
  5011. @subsection p/c/n/u/b meaning
  5012. @subsubsection p/c/n
  5013. We assume the following telecined stream:
  5014. @example
  5015. Top fields: 1 2 2 3 4
  5016. Bottom fields: 1 2 3 4 4
  5017. @end example
  5018. The numbers correspond to the progressive frame the fields relate to. Here, the
  5019. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5020. When @code{fieldmatch} is configured to run a matching from bottom
  5021. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5022. @example
  5023. Input stream:
  5024. T 1 2 2 3 4
  5025. B 1 2 3 4 4 <-- matching reference
  5026. Matches: c c n n c
  5027. Output stream:
  5028. T 1 2 3 4 4
  5029. B 1 2 3 4 4
  5030. @end example
  5031. As a result of the field matching, we can see that some frames get duplicated.
  5032. To perform a complete inverse telecine, you need to rely on a decimation filter
  5033. after this operation. See for instance the @ref{decimate} filter.
  5034. The same operation now matching from top fields (@option{field}=@var{top})
  5035. looks like this:
  5036. @example
  5037. Input stream:
  5038. T 1 2 2 3 4 <-- matching reference
  5039. B 1 2 3 4 4
  5040. Matches: c c p p c
  5041. Output stream:
  5042. T 1 2 2 3 4
  5043. B 1 2 2 3 4
  5044. @end example
  5045. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5046. basically, they refer to the frame and field of the opposite parity:
  5047. @itemize
  5048. @item @var{p} matches the field of the opposite parity in the previous frame
  5049. @item @var{c} matches the field of the opposite parity in the current frame
  5050. @item @var{n} matches the field of the opposite parity in the next frame
  5051. @end itemize
  5052. @subsubsection u/b
  5053. The @var{u} and @var{b} matching are a bit special in the sense that they match
  5054. from the opposite parity flag. In the following examples, we assume that we are
  5055. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  5056. 'x' is placed above and below each matched fields.
  5057. With bottom matching (@option{field}=@var{bottom}):
  5058. @example
  5059. Match: c p n b u
  5060. x x x x x
  5061. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5062. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5063. x x x x x
  5064. Output frames:
  5065. 2 1 2 2 2
  5066. 2 2 2 1 3
  5067. @end example
  5068. With top matching (@option{field}=@var{top}):
  5069. @example
  5070. Match: c p n b u
  5071. x x x x x
  5072. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5073. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5074. x x x x x
  5075. Output frames:
  5076. 2 2 2 1 2
  5077. 2 1 3 2 2
  5078. @end example
  5079. @subsection Examples
  5080. Simple IVTC of a top field first telecined stream:
  5081. @example
  5082. fieldmatch=order=tff:combmatch=none, decimate
  5083. @end example
  5084. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  5085. @example
  5086. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  5087. @end example
  5088. @section fieldorder
  5089. Transform the field order of the input video.
  5090. It accepts the following parameters:
  5091. @table @option
  5092. @item order
  5093. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  5094. for bottom field first.
  5095. @end table
  5096. The default value is @samp{tff}.
  5097. The transformation is done by shifting the picture content up or down
  5098. by one line, and filling the remaining line with appropriate picture content.
  5099. This method is consistent with most broadcast field order converters.
  5100. If the input video is not flagged as being interlaced, or it is already
  5101. flagged as being of the required output field order, then this filter does
  5102. not alter the incoming video.
  5103. It is very useful when converting to or from PAL DV material,
  5104. which is bottom field first.
  5105. For example:
  5106. @example
  5107. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  5108. @end example
  5109. @section fifo, afifo
  5110. Buffer input images and send them when they are requested.
  5111. It is mainly useful when auto-inserted by the libavfilter
  5112. framework.
  5113. It does not take parameters.
  5114. @section find_rect
  5115. Find a rectangular object
  5116. It accepts the following options:
  5117. @table @option
  5118. @item object
  5119. Filepath of the object image, needs to be in gray8.
  5120. @item threshold
  5121. Detection threshold, default is 0.5.
  5122. @item mipmaps
  5123. Number of mipmaps, default is 3.
  5124. @item xmin, ymin, xmax, ymax
  5125. Specifies the rectangle in which to search.
  5126. @end table
  5127. @subsection Examples
  5128. @itemize
  5129. @item
  5130. Generate a representative palette of a given video using @command{ffmpeg}:
  5131. @example
  5132. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5133. @end example
  5134. @end itemize
  5135. @section cover_rect
  5136. Cover a rectangular object
  5137. It accepts the following options:
  5138. @table @option
  5139. @item cover
  5140. Filepath of the optional cover image, needs to be in yuv420.
  5141. @item mode
  5142. Set covering mode.
  5143. It accepts the following values:
  5144. @table @samp
  5145. @item cover
  5146. cover it by the supplied image
  5147. @item blur
  5148. cover it by interpolating the surrounding pixels
  5149. @end table
  5150. Default value is @var{blur}.
  5151. @end table
  5152. @subsection Examples
  5153. @itemize
  5154. @item
  5155. Generate a representative palette of a given video using @command{ffmpeg}:
  5156. @example
  5157. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5158. @end example
  5159. @end itemize
  5160. @anchor{format}
  5161. @section format
  5162. Convert the input video to one of the specified pixel formats.
  5163. Libavfilter will try to pick one that is suitable as input to
  5164. the next filter.
  5165. It accepts the following parameters:
  5166. @table @option
  5167. @item pix_fmts
  5168. A '|'-separated list of pixel format names, such as
  5169. "pix_fmts=yuv420p|monow|rgb24".
  5170. @end table
  5171. @subsection Examples
  5172. @itemize
  5173. @item
  5174. Convert the input video to the @var{yuv420p} format
  5175. @example
  5176. format=pix_fmts=yuv420p
  5177. @end example
  5178. Convert the input video to any of the formats in the list
  5179. @example
  5180. format=pix_fmts=yuv420p|yuv444p|yuv410p
  5181. @end example
  5182. @end itemize
  5183. @anchor{fps}
  5184. @section fps
  5185. Convert the video to specified constant frame rate by duplicating or dropping
  5186. frames as necessary.
  5187. It accepts the following parameters:
  5188. @table @option
  5189. @item fps
  5190. The desired output frame rate. The default is @code{25}.
  5191. @item round
  5192. Rounding method.
  5193. Possible values are:
  5194. @table @option
  5195. @item zero
  5196. zero round towards 0
  5197. @item inf
  5198. round away from 0
  5199. @item down
  5200. round towards -infinity
  5201. @item up
  5202. round towards +infinity
  5203. @item near
  5204. round to nearest
  5205. @end table
  5206. The default is @code{near}.
  5207. @item start_time
  5208. Assume the first PTS should be the given value, in seconds. This allows for
  5209. padding/trimming at the start of stream. By default, no assumption is made
  5210. about the first frame's expected PTS, so no padding or trimming is done.
  5211. For example, this could be set to 0 to pad the beginning with duplicates of
  5212. the first frame if a video stream starts after the audio stream or to trim any
  5213. frames with a negative PTS.
  5214. @end table
  5215. Alternatively, the options can be specified as a flat string:
  5216. @var{fps}[:@var{round}].
  5217. See also the @ref{setpts} filter.
  5218. @subsection Examples
  5219. @itemize
  5220. @item
  5221. A typical usage in order to set the fps to 25:
  5222. @example
  5223. fps=fps=25
  5224. @end example
  5225. @item
  5226. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  5227. @example
  5228. fps=fps=film:round=near
  5229. @end example
  5230. @end itemize
  5231. @section framepack
  5232. Pack two different video streams into a stereoscopic video, setting proper
  5233. metadata on supported codecs. The two views should have the same size and
  5234. framerate and processing will stop when the shorter video ends. Please note
  5235. that you may conveniently adjust view properties with the @ref{scale} and
  5236. @ref{fps} filters.
  5237. It accepts the following parameters:
  5238. @table @option
  5239. @item format
  5240. The desired packing format. Supported values are:
  5241. @table @option
  5242. @item sbs
  5243. The views are next to each other (default).
  5244. @item tab
  5245. The views are on top of each other.
  5246. @item lines
  5247. The views are packed by line.
  5248. @item columns
  5249. The views are packed by column.
  5250. @item frameseq
  5251. The views are temporally interleaved.
  5252. @end table
  5253. @end table
  5254. Some examples:
  5255. @example
  5256. # Convert left and right views into a frame-sequential video
  5257. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  5258. # Convert views into a side-by-side video with the same output resolution as the input
  5259. 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
  5260. @end example
  5261. @section framerate
  5262. Change the frame rate by interpolating new video output frames from the source
  5263. frames.
  5264. This filter is not designed to function correctly with interlaced media. If
  5265. you wish to change the frame rate of interlaced media then you are required
  5266. to deinterlace before this filter and re-interlace after this filter.
  5267. A description of the accepted options follows.
  5268. @table @option
  5269. @item fps
  5270. Specify the output frames per second. This option can also be specified
  5271. as a value alone. The default is @code{50}.
  5272. @item interp_start
  5273. Specify the start of a range where the output frame will be created as a
  5274. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5275. the default is @code{15}.
  5276. @item interp_end
  5277. Specify the end of a range where the output frame will be created as a
  5278. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5279. the default is @code{240}.
  5280. @item scene
  5281. Specify the level at which a scene change is detected as a value between
  5282. 0 and 100 to indicate a new scene; a low value reflects a low
  5283. probability for the current frame to introduce a new scene, while a higher
  5284. value means the current frame is more likely to be one.
  5285. The default is @code{7}.
  5286. @item flags
  5287. Specify flags influencing the filter process.
  5288. Available value for @var{flags} is:
  5289. @table @option
  5290. @item scene_change_detect, scd
  5291. Enable scene change detection using the value of the option @var{scene}.
  5292. This flag is enabled by default.
  5293. @end table
  5294. @end table
  5295. @section framestep
  5296. Select one frame every N-th frame.
  5297. This filter accepts the following option:
  5298. @table @option
  5299. @item step
  5300. Select frame after every @code{step} frames.
  5301. Allowed values are positive integers higher than 0. Default value is @code{1}.
  5302. @end table
  5303. @anchor{frei0r}
  5304. @section frei0r
  5305. Apply a frei0r effect to the input video.
  5306. To enable the compilation of this filter, you need to install the frei0r
  5307. header and configure FFmpeg with @code{--enable-frei0r}.
  5308. It accepts the following parameters:
  5309. @table @option
  5310. @item filter_name
  5311. The name of the frei0r effect to load. If the environment variable
  5312. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  5313. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  5314. Otherwise, the standard frei0r paths are searched, in this order:
  5315. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  5316. @file{/usr/lib/frei0r-1/}.
  5317. @item filter_params
  5318. A '|'-separated list of parameters to pass to the frei0r effect.
  5319. @end table
  5320. A frei0r effect parameter can be a boolean (its value is either
  5321. "y" or "n"), a double, a color (specified as
  5322. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  5323. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  5324. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  5325. @var{X} and @var{Y} are floating point numbers) and/or a string.
  5326. The number and types of parameters depend on the loaded effect. If an
  5327. effect parameter is not specified, the default value is set.
  5328. @subsection Examples
  5329. @itemize
  5330. @item
  5331. Apply the distort0r effect, setting the first two double parameters:
  5332. @example
  5333. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  5334. @end example
  5335. @item
  5336. Apply the colordistance effect, taking a color as the first parameter:
  5337. @example
  5338. frei0r=colordistance:0.2/0.3/0.4
  5339. frei0r=colordistance:violet
  5340. frei0r=colordistance:0x112233
  5341. @end example
  5342. @item
  5343. Apply the perspective effect, specifying the top left and top right image
  5344. positions:
  5345. @example
  5346. frei0r=perspective:0.2/0.2|0.8/0.2
  5347. @end example
  5348. @end itemize
  5349. For more information, see
  5350. @url{http://frei0r.dyne.org}
  5351. @section fspp
  5352. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  5353. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  5354. processing filter, one of them is performed once per block, not per pixel.
  5355. This allows for much higher speed.
  5356. The filter accepts the following options:
  5357. @table @option
  5358. @item quality
  5359. Set quality. This option defines the number of levels for averaging. It accepts
  5360. an integer in the range 4-5. Default value is @code{4}.
  5361. @item qp
  5362. Force a constant quantization parameter. It accepts an integer in range 0-63.
  5363. If not set, the filter will use the QP from the video stream (if available).
  5364. @item strength
  5365. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  5366. more details but also more artifacts, while higher values make the image smoother
  5367. but also blurrier. Default value is @code{0} − PSNR optimal.
  5368. @item use_bframe_qp
  5369. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5370. option may cause flicker since the B-Frames have often larger QP. Default is
  5371. @code{0} (not enabled).
  5372. @end table
  5373. @section geq
  5374. The filter accepts the following options:
  5375. @table @option
  5376. @item lum_expr, lum
  5377. Set the luminance expression.
  5378. @item cb_expr, cb
  5379. Set the chrominance blue expression.
  5380. @item cr_expr, cr
  5381. Set the chrominance red expression.
  5382. @item alpha_expr, a
  5383. Set the alpha expression.
  5384. @item red_expr, r
  5385. Set the red expression.
  5386. @item green_expr, g
  5387. Set the green expression.
  5388. @item blue_expr, b
  5389. Set the blue expression.
  5390. @end table
  5391. The colorspace is selected according to the specified options. If one
  5392. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  5393. options is specified, the filter will automatically select a YCbCr
  5394. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  5395. @option{blue_expr} options is specified, it will select an RGB
  5396. colorspace.
  5397. If one of the chrominance expression is not defined, it falls back on the other
  5398. one. If no alpha expression is specified it will evaluate to opaque value.
  5399. If none of chrominance expressions are specified, they will evaluate
  5400. to the luminance expression.
  5401. The expressions can use the following variables and functions:
  5402. @table @option
  5403. @item N
  5404. The sequential number of the filtered frame, starting from @code{0}.
  5405. @item X
  5406. @item Y
  5407. The coordinates of the current sample.
  5408. @item W
  5409. @item H
  5410. The width and height of the image.
  5411. @item SW
  5412. @item SH
  5413. Width and height scale depending on the currently filtered plane. It is the
  5414. ratio between the corresponding luma plane number of pixels and the current
  5415. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  5416. @code{0.5,0.5} for chroma planes.
  5417. @item T
  5418. Time of the current frame, expressed in seconds.
  5419. @item p(x, y)
  5420. Return the value of the pixel at location (@var{x},@var{y}) of the current
  5421. plane.
  5422. @item lum(x, y)
  5423. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  5424. plane.
  5425. @item cb(x, y)
  5426. Return the value of the pixel at location (@var{x},@var{y}) of the
  5427. blue-difference chroma plane. Return 0 if there is no such plane.
  5428. @item cr(x, y)
  5429. Return the value of the pixel at location (@var{x},@var{y}) of the
  5430. red-difference chroma plane. Return 0 if there is no such plane.
  5431. @item r(x, y)
  5432. @item g(x, y)
  5433. @item b(x, y)
  5434. Return the value of the pixel at location (@var{x},@var{y}) of the
  5435. red/green/blue component. Return 0 if there is no such component.
  5436. @item alpha(x, y)
  5437. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  5438. plane. Return 0 if there is no such plane.
  5439. @end table
  5440. For functions, if @var{x} and @var{y} are outside the area, the value will be
  5441. automatically clipped to the closer edge.
  5442. @subsection Examples
  5443. @itemize
  5444. @item
  5445. Flip the image horizontally:
  5446. @example
  5447. geq=p(W-X\,Y)
  5448. @end example
  5449. @item
  5450. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  5451. wavelength of 100 pixels:
  5452. @example
  5453. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  5454. @end example
  5455. @item
  5456. Generate a fancy enigmatic moving light:
  5457. @example
  5458. 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
  5459. @end example
  5460. @item
  5461. Generate a quick emboss effect:
  5462. @example
  5463. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  5464. @end example
  5465. @item
  5466. Modify RGB components depending on pixel position:
  5467. @example
  5468. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  5469. @end example
  5470. @item
  5471. Create a radial gradient that is the same size as the input (also see
  5472. the @ref{vignette} filter):
  5473. @example
  5474. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  5475. @end example
  5476. @item
  5477. Create a linear gradient to use as a mask for another filter, then
  5478. compose with @ref{overlay}. In this example the video will gradually
  5479. become more blurry from the top to the bottom of the y-axis as defined
  5480. by the linear gradient:
  5481. @example
  5482. 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
  5483. @end example
  5484. @end itemize
  5485. @section gradfun
  5486. Fix the banding artifacts that are sometimes introduced into nearly flat
  5487. regions by truncation to 8bit color depth.
  5488. Interpolate the gradients that should go where the bands are, and
  5489. dither them.
  5490. It is designed for playback only. Do not use it prior to
  5491. lossy compression, because compression tends to lose the dither and
  5492. bring back the bands.
  5493. It accepts the following parameters:
  5494. @table @option
  5495. @item strength
  5496. The maximum amount by which the filter will change any one pixel. This is also
  5497. the threshold for detecting nearly flat regions. Acceptable values range from
  5498. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  5499. valid range.
  5500. @item radius
  5501. The neighborhood to fit the gradient to. A larger radius makes for smoother
  5502. gradients, but also prevents the filter from modifying the pixels near detailed
  5503. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  5504. values will be clipped to the valid range.
  5505. @end table
  5506. Alternatively, the options can be specified as a flat string:
  5507. @var{strength}[:@var{radius}]
  5508. @subsection Examples
  5509. @itemize
  5510. @item
  5511. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  5512. @example
  5513. gradfun=3.5:8
  5514. @end example
  5515. @item
  5516. Specify radius, omitting the strength (which will fall-back to the default
  5517. value):
  5518. @example
  5519. gradfun=radius=8
  5520. @end example
  5521. @end itemize
  5522. @anchor{haldclut}
  5523. @section haldclut
  5524. Apply a Hald CLUT to a video stream.
  5525. First input is the video stream to process, and second one is the Hald CLUT.
  5526. The Hald CLUT input can be a simple picture or a complete video stream.
  5527. The filter accepts the following options:
  5528. @table @option
  5529. @item shortest
  5530. Force termination when the shortest input terminates. Default is @code{0}.
  5531. @item repeatlast
  5532. Continue applying the last CLUT after the end of the stream. A value of
  5533. @code{0} disable the filter after the last frame of the CLUT is reached.
  5534. Default is @code{1}.
  5535. @end table
  5536. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  5537. filters share the same internals).
  5538. More information about the Hald CLUT can be found on Eskil Steenberg's website
  5539. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  5540. @subsection Workflow examples
  5541. @subsubsection Hald CLUT video stream
  5542. Generate an identity Hald CLUT stream altered with various effects:
  5543. @example
  5544. 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
  5545. @end example
  5546. Note: make sure you use a lossless codec.
  5547. Then use it with @code{haldclut} to apply it on some random stream:
  5548. @example
  5549. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  5550. @end example
  5551. The Hald CLUT will be applied to the 10 first seconds (duration of
  5552. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  5553. to the remaining frames of the @code{mandelbrot} stream.
  5554. @subsubsection Hald CLUT with preview
  5555. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  5556. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  5557. biggest possible square starting at the top left of the picture. The remaining
  5558. padding pixels (bottom or right) will be ignored. This area can be used to add
  5559. a preview of the Hald CLUT.
  5560. Typically, the following generated Hald CLUT will be supported by the
  5561. @code{haldclut} filter:
  5562. @example
  5563. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  5564. pad=iw+320 [padded_clut];
  5565. smptebars=s=320x256, split [a][b];
  5566. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  5567. [main][b] overlay=W-320" -frames:v 1 clut.png
  5568. @end example
  5569. It contains the original and a preview of the effect of the CLUT: SMPTE color
  5570. bars are displayed on the right-top, and below the same color bars processed by
  5571. the color changes.
  5572. Then, the effect of this Hald CLUT can be visualized with:
  5573. @example
  5574. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  5575. @end example
  5576. @section hflip
  5577. Flip the input video horizontally.
  5578. For example, to horizontally flip the input video with @command{ffmpeg}:
  5579. @example
  5580. ffmpeg -i in.avi -vf "hflip" out.avi
  5581. @end example
  5582. @section histeq
  5583. This filter applies a global color histogram equalization on a
  5584. per-frame basis.
  5585. It can be used to correct video that has a compressed range of pixel
  5586. intensities. The filter redistributes the pixel intensities to
  5587. equalize their distribution across the intensity range. It may be
  5588. viewed as an "automatically adjusting contrast filter". This filter is
  5589. useful only for correcting degraded or poorly captured source
  5590. video.
  5591. The filter accepts the following options:
  5592. @table @option
  5593. @item strength
  5594. Determine the amount of equalization to be applied. As the strength
  5595. is reduced, the distribution of pixel intensities more-and-more
  5596. approaches that of the input frame. The value must be a float number
  5597. in the range [0,1] and defaults to 0.200.
  5598. @item intensity
  5599. Set the maximum intensity that can generated and scale the output
  5600. values appropriately. The strength should be set as desired and then
  5601. the intensity can be limited if needed to avoid washing-out. The value
  5602. must be a float number in the range [0,1] and defaults to 0.210.
  5603. @item antibanding
  5604. Set the antibanding level. If enabled the filter will randomly vary
  5605. the luminance of output pixels by a small amount to avoid banding of
  5606. the histogram. Possible values are @code{none}, @code{weak} or
  5607. @code{strong}. It defaults to @code{none}.
  5608. @end table
  5609. @section histogram
  5610. Compute and draw a color distribution histogram for the input video.
  5611. The computed histogram is a representation of the color component
  5612. distribution in an image.
  5613. Standard histogram displays the color components distribution in an image.
  5614. Displays color graph for each color component. Shows distribution of
  5615. the Y, U, V, A or R, G, B components, depending on input format, in the
  5616. current frame. Below each graph a color component scale meter is shown.
  5617. The filter accepts the following options:
  5618. @table @option
  5619. @item level_height
  5620. Set height of level. Default value is @code{200}.
  5621. Allowed range is [50, 2048].
  5622. @item scale_height
  5623. Set height of color scale. Default value is @code{12}.
  5624. Allowed range is [0, 40].
  5625. @item display_mode
  5626. Set display mode.
  5627. It accepts the following values:
  5628. @table @samp
  5629. @item parade
  5630. Per color component graphs are placed below each other.
  5631. @item overlay
  5632. Presents information identical to that in the @code{parade}, except
  5633. that the graphs representing color components are superimposed directly
  5634. over one another.
  5635. @end table
  5636. Default is @code{parade}.
  5637. @item levels_mode
  5638. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  5639. Default is @code{linear}.
  5640. @item components
  5641. Set what color components to display.
  5642. Default is @code{7}.
  5643. @end table
  5644. @subsection Examples
  5645. @itemize
  5646. @item
  5647. Calculate and draw histogram:
  5648. @example
  5649. ffplay -i input -vf histogram
  5650. @end example
  5651. @end itemize
  5652. @anchor{hqdn3d}
  5653. @section hqdn3d
  5654. This is a high precision/quality 3d denoise filter. It aims to reduce
  5655. image noise, producing smooth images and making still images really
  5656. still. It should enhance compressibility.
  5657. It accepts the following optional parameters:
  5658. @table @option
  5659. @item luma_spatial
  5660. A non-negative floating point number which specifies spatial luma strength.
  5661. It defaults to 4.0.
  5662. @item chroma_spatial
  5663. A non-negative floating point number which specifies spatial chroma strength.
  5664. It defaults to 3.0*@var{luma_spatial}/4.0.
  5665. @item luma_tmp
  5666. A floating point number which specifies luma temporal strength. It defaults to
  5667. 6.0*@var{luma_spatial}/4.0.
  5668. @item chroma_tmp
  5669. A floating point number which specifies chroma temporal strength. It defaults to
  5670. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  5671. @end table
  5672. @section hqx
  5673. Apply a high-quality magnification filter designed for pixel art. This filter
  5674. was originally created by Maxim Stepin.
  5675. It accepts the following option:
  5676. @table @option
  5677. @item n
  5678. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  5679. @code{hq3x} and @code{4} for @code{hq4x}.
  5680. Default is @code{3}.
  5681. @end table
  5682. @section hstack
  5683. Stack input videos horizontally.
  5684. All streams must be of same pixel format and of same height.
  5685. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  5686. to create same output.
  5687. The filter accept the following option:
  5688. @table @option
  5689. @item inputs
  5690. Set number of input streams. Default is 2.
  5691. @item shortest
  5692. If set to 1, force the output to terminate when the shortest input
  5693. terminates. Default value is 0.
  5694. @end table
  5695. @section hue
  5696. Modify the hue and/or the saturation of the input.
  5697. It accepts the following parameters:
  5698. @table @option
  5699. @item h
  5700. Specify the hue angle as a number of degrees. It accepts an expression,
  5701. and defaults to "0".
  5702. @item s
  5703. Specify the saturation in the [-10,10] range. It accepts an expression and
  5704. defaults to "1".
  5705. @item H
  5706. Specify the hue angle as a number of radians. It accepts an
  5707. expression, and defaults to "0".
  5708. @item b
  5709. Specify the brightness in the [-10,10] range. It accepts an expression and
  5710. defaults to "0".
  5711. @end table
  5712. @option{h} and @option{H} are mutually exclusive, and can't be
  5713. specified at the same time.
  5714. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  5715. expressions containing the following constants:
  5716. @table @option
  5717. @item n
  5718. frame count of the input frame starting from 0
  5719. @item pts
  5720. presentation timestamp of the input frame expressed in time base units
  5721. @item r
  5722. frame rate of the input video, NAN if the input frame rate is unknown
  5723. @item t
  5724. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5725. @item tb
  5726. time base of the input video
  5727. @end table
  5728. @subsection Examples
  5729. @itemize
  5730. @item
  5731. Set the hue to 90 degrees and the saturation to 1.0:
  5732. @example
  5733. hue=h=90:s=1
  5734. @end example
  5735. @item
  5736. Same command but expressing the hue in radians:
  5737. @example
  5738. hue=H=PI/2:s=1
  5739. @end example
  5740. @item
  5741. Rotate hue and make the saturation swing between 0
  5742. and 2 over a period of 1 second:
  5743. @example
  5744. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  5745. @end example
  5746. @item
  5747. Apply a 3 seconds saturation fade-in effect starting at 0:
  5748. @example
  5749. hue="s=min(t/3\,1)"
  5750. @end example
  5751. The general fade-in expression can be written as:
  5752. @example
  5753. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  5754. @end example
  5755. @item
  5756. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  5757. @example
  5758. hue="s=max(0\, min(1\, (8-t)/3))"
  5759. @end example
  5760. The general fade-out expression can be written as:
  5761. @example
  5762. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  5763. @end example
  5764. @end itemize
  5765. @subsection Commands
  5766. This filter supports the following commands:
  5767. @table @option
  5768. @item b
  5769. @item s
  5770. @item h
  5771. @item H
  5772. Modify the hue and/or the saturation and/or brightness of the input video.
  5773. The command accepts the same syntax of the corresponding option.
  5774. If the specified expression is not valid, it is kept at its current
  5775. value.
  5776. @end table
  5777. @section idet
  5778. Detect video interlacing type.
  5779. This filter tries to detect if the input frames as interlaced, progressive,
  5780. top or bottom field first. It will also try and detect fields that are
  5781. repeated between adjacent frames (a sign of telecine).
  5782. Single frame detection considers only immediately adjacent frames when classifying each frame.
  5783. Multiple frame detection incorporates the classification history of previous frames.
  5784. The filter will log these metadata values:
  5785. @table @option
  5786. @item single.current_frame
  5787. Detected type of current frame using single-frame detection. One of:
  5788. ``tff'' (top field first), ``bff'' (bottom field first),
  5789. ``progressive'', or ``undetermined''
  5790. @item single.tff
  5791. Cumulative number of frames detected as top field first using single-frame detection.
  5792. @item multiple.tff
  5793. Cumulative number of frames detected as top field first using multiple-frame detection.
  5794. @item single.bff
  5795. Cumulative number of frames detected as bottom field first using single-frame detection.
  5796. @item multiple.current_frame
  5797. Detected type of current frame using multiple-frame detection. One of:
  5798. ``tff'' (top field first), ``bff'' (bottom field first),
  5799. ``progressive'', or ``undetermined''
  5800. @item multiple.bff
  5801. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  5802. @item single.progressive
  5803. Cumulative number of frames detected as progressive using single-frame detection.
  5804. @item multiple.progressive
  5805. Cumulative number of frames detected as progressive using multiple-frame detection.
  5806. @item single.undetermined
  5807. Cumulative number of frames that could not be classified using single-frame detection.
  5808. @item multiple.undetermined
  5809. Cumulative number of frames that could not be classified using multiple-frame detection.
  5810. @item repeated.current_frame
  5811. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  5812. @item repeated.neither
  5813. Cumulative number of frames with no repeated field.
  5814. @item repeated.top
  5815. Cumulative number of frames with the top field repeated from the previous frame's top field.
  5816. @item repeated.bottom
  5817. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  5818. @end table
  5819. The filter accepts the following options:
  5820. @table @option
  5821. @item intl_thres
  5822. Set interlacing threshold.
  5823. @item prog_thres
  5824. Set progressive threshold.
  5825. @item repeat_thres
  5826. Threshold for repeated field detection.
  5827. @item half_life
  5828. Number of frames after which a given frame's contribution to the
  5829. statistics is halved (i.e., it contributes only 0.5 to it's
  5830. classification). The default of 0 means that all frames seen are given
  5831. full weight of 1.0 forever.
  5832. @item analyze_interlaced_flag
  5833. When this is not 0 then idet will use the specified number of frames to determine
  5834. if the interlaced flag is accurate, it will not count undetermined frames.
  5835. If the flag is found to be accurate it will be used without any further
  5836. computations, if it is found to be inaccurate it will be cleared without any
  5837. further computations. This allows inserting the idet filter as a low computational
  5838. method to clean up the interlaced flag
  5839. @end table
  5840. @section il
  5841. Deinterleave or interleave fields.
  5842. This filter allows one to process interlaced images fields without
  5843. deinterlacing them. Deinterleaving splits the input frame into 2
  5844. fields (so called half pictures). Odd lines are moved to the top
  5845. half of the output image, even lines to the bottom half.
  5846. You can process (filter) them independently and then re-interleave them.
  5847. The filter accepts the following options:
  5848. @table @option
  5849. @item luma_mode, l
  5850. @item chroma_mode, c
  5851. @item alpha_mode, a
  5852. Available values for @var{luma_mode}, @var{chroma_mode} and
  5853. @var{alpha_mode} are:
  5854. @table @samp
  5855. @item none
  5856. Do nothing.
  5857. @item deinterleave, d
  5858. Deinterleave fields, placing one above the other.
  5859. @item interleave, i
  5860. Interleave fields. Reverse the effect of deinterleaving.
  5861. @end table
  5862. Default value is @code{none}.
  5863. @item luma_swap, ls
  5864. @item chroma_swap, cs
  5865. @item alpha_swap, as
  5866. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  5867. @end table
  5868. @section inflate
  5869. Apply inflate effect to the video.
  5870. This filter replaces the pixel by the local(3x3) average by taking into account
  5871. only values higher than the pixel.
  5872. It accepts the following options:
  5873. @table @option
  5874. @item threshold0
  5875. @item threshold1
  5876. @item threshold2
  5877. @item threshold3
  5878. Limit the maximum change for each plane, default is 65535.
  5879. If 0, plane will remain unchanged.
  5880. @end table
  5881. @section interlace
  5882. Simple interlacing filter from progressive contents. This interleaves upper (or
  5883. lower) lines from odd frames with lower (or upper) lines from even frames,
  5884. halving the frame rate and preserving image height.
  5885. @example
  5886. Original Original New Frame
  5887. Frame 'j' Frame 'j+1' (tff)
  5888. ========== =========== ==================
  5889. Line 0 --------------------> Frame 'j' Line 0
  5890. Line 1 Line 1 ----> Frame 'j+1' Line 1
  5891. Line 2 ---------------------> Frame 'j' Line 2
  5892. Line 3 Line 3 ----> Frame 'j+1' Line 3
  5893. ... ... ...
  5894. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  5895. @end example
  5896. It accepts the following optional parameters:
  5897. @table @option
  5898. @item scan
  5899. This determines whether the interlaced frame is taken from the even
  5900. (tff - default) or odd (bff) lines of the progressive frame.
  5901. @item lowpass
  5902. Enable (default) or disable the vertical lowpass filter to avoid twitter
  5903. interlacing and reduce moire patterns.
  5904. @end table
  5905. @section kerndeint
  5906. Deinterlace input video by applying Donald Graft's adaptive kernel
  5907. deinterling. Work on interlaced parts of a video to produce
  5908. progressive frames.
  5909. The description of the accepted parameters follows.
  5910. @table @option
  5911. @item thresh
  5912. Set the threshold which affects the filter's tolerance when
  5913. determining if a pixel line must be processed. It must be an integer
  5914. in the range [0,255] and defaults to 10. A value of 0 will result in
  5915. applying the process on every pixels.
  5916. @item map
  5917. Paint pixels exceeding the threshold value to white if set to 1.
  5918. Default is 0.
  5919. @item order
  5920. Set the fields order. Swap fields if set to 1, leave fields alone if
  5921. 0. Default is 0.
  5922. @item sharp
  5923. Enable additional sharpening if set to 1. Default is 0.
  5924. @item twoway
  5925. Enable twoway sharpening if set to 1. Default is 0.
  5926. @end table
  5927. @subsection Examples
  5928. @itemize
  5929. @item
  5930. Apply default values:
  5931. @example
  5932. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  5933. @end example
  5934. @item
  5935. Enable additional sharpening:
  5936. @example
  5937. kerndeint=sharp=1
  5938. @end example
  5939. @item
  5940. Paint processed pixels in white:
  5941. @example
  5942. kerndeint=map=1
  5943. @end example
  5944. @end itemize
  5945. @section lenscorrection
  5946. Correct radial lens distortion
  5947. This filter can be used to correct for radial distortion as can result from the use
  5948. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  5949. one can use tools available for example as part of opencv or simply trial-and-error.
  5950. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  5951. and extract the k1 and k2 coefficients from the resulting matrix.
  5952. Note that effectively the same filter is available in the open-source tools Krita and
  5953. Digikam from the KDE project.
  5954. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  5955. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  5956. brightness distribution, so you may want to use both filters together in certain
  5957. cases, though you will have to take care of ordering, i.e. whether vignetting should
  5958. be applied before or after lens correction.
  5959. @subsection Options
  5960. The filter accepts the following options:
  5961. @table @option
  5962. @item cx
  5963. Relative x-coordinate of the focal point of the image, and thereby the center of the
  5964. distortion. This value has a range [0,1] and is expressed as fractions of the image
  5965. width.
  5966. @item cy
  5967. Relative y-coordinate of the focal point of the image, and thereby the center of the
  5968. distortion. This value has a range [0,1] and is expressed as fractions of the image
  5969. height.
  5970. @item k1
  5971. Coefficient of the quadratic correction term. 0.5 means no correction.
  5972. @item k2
  5973. Coefficient of the double quadratic correction term. 0.5 means no correction.
  5974. @end table
  5975. The formula that generates the correction is:
  5976. @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)
  5977. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  5978. distances from the focal point in the source and target images, respectively.
  5979. @anchor{lut3d}
  5980. @section lut3d
  5981. Apply a 3D LUT to an input video.
  5982. The filter accepts the following options:
  5983. @table @option
  5984. @item file
  5985. Set the 3D LUT file name.
  5986. Currently supported formats:
  5987. @table @samp
  5988. @item 3dl
  5989. AfterEffects
  5990. @item cube
  5991. Iridas
  5992. @item dat
  5993. DaVinci
  5994. @item m3d
  5995. Pandora
  5996. @end table
  5997. @item interp
  5998. Select interpolation mode.
  5999. Available values are:
  6000. @table @samp
  6001. @item nearest
  6002. Use values from the nearest defined point.
  6003. @item trilinear
  6004. Interpolate values using the 8 points defining a cube.
  6005. @item tetrahedral
  6006. Interpolate values using a tetrahedron.
  6007. @end table
  6008. @end table
  6009. @section lut, lutrgb, lutyuv
  6010. Compute a look-up table for binding each pixel component input value
  6011. to an output value, and apply it to the input video.
  6012. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6013. to an RGB input video.
  6014. These filters accept the following parameters:
  6015. @table @option
  6016. @item c0
  6017. set first pixel component expression
  6018. @item c1
  6019. set second pixel component expression
  6020. @item c2
  6021. set third pixel component expression
  6022. @item c3
  6023. set fourth pixel component expression, corresponds to the alpha component
  6024. @item r
  6025. set red component expression
  6026. @item g
  6027. set green component expression
  6028. @item b
  6029. set blue component expression
  6030. @item a
  6031. alpha component expression
  6032. @item y
  6033. set Y/luminance component expression
  6034. @item u
  6035. set U/Cb component expression
  6036. @item v
  6037. set V/Cr component expression
  6038. @end table
  6039. Each of them specifies the expression to use for computing the lookup table for
  6040. the corresponding pixel component values.
  6041. The exact component associated to each of the @var{c*} options depends on the
  6042. format in input.
  6043. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  6044. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  6045. The expressions can contain the following constants and functions:
  6046. @table @option
  6047. @item w
  6048. @item h
  6049. The input width and height.
  6050. @item val
  6051. The input value for the pixel component.
  6052. @item clipval
  6053. The input value, clipped to the @var{minval}-@var{maxval} range.
  6054. @item maxval
  6055. The maximum value for the pixel component.
  6056. @item minval
  6057. The minimum value for the pixel component.
  6058. @item negval
  6059. The negated value for the pixel component value, clipped to the
  6060. @var{minval}-@var{maxval} range; it corresponds to the expression
  6061. "maxval-clipval+minval".
  6062. @item clip(val)
  6063. The computed value in @var{val}, clipped to the
  6064. @var{minval}-@var{maxval} range.
  6065. @item gammaval(gamma)
  6066. The computed gamma correction value of the pixel component value,
  6067. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  6068. expression
  6069. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  6070. @end table
  6071. All expressions default to "val".
  6072. @subsection Examples
  6073. @itemize
  6074. @item
  6075. Negate input video:
  6076. @example
  6077. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  6078. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  6079. @end example
  6080. The above is the same as:
  6081. @example
  6082. lutrgb="r=negval:g=negval:b=negval"
  6083. lutyuv="y=negval:u=negval:v=negval"
  6084. @end example
  6085. @item
  6086. Negate luminance:
  6087. @example
  6088. lutyuv=y=negval
  6089. @end example
  6090. @item
  6091. Remove chroma components, turning the video into a graytone image:
  6092. @example
  6093. lutyuv="u=128:v=128"
  6094. @end example
  6095. @item
  6096. Apply a luma burning effect:
  6097. @example
  6098. lutyuv="y=2*val"
  6099. @end example
  6100. @item
  6101. Remove green and blue components:
  6102. @example
  6103. lutrgb="g=0:b=0"
  6104. @end example
  6105. @item
  6106. Set a constant alpha channel value on input:
  6107. @example
  6108. format=rgba,lutrgb=a="maxval-minval/2"
  6109. @end example
  6110. @item
  6111. Correct luminance gamma by a factor of 0.5:
  6112. @example
  6113. lutyuv=y=gammaval(0.5)
  6114. @end example
  6115. @item
  6116. Discard least significant bits of luma:
  6117. @example
  6118. lutyuv=y='bitand(val, 128+64+32)'
  6119. @end example
  6120. @end itemize
  6121. @section maskedmerge
  6122. Merge the first input stream with the second input stream using per pixel
  6123. weights in the third input stream.
  6124. A value of 0 in the third stream pixel component means that pixel component
  6125. from first stream is returned unchanged, while maximum value (eg. 255 for
  6126. 8-bit videos) means that pixel component from second stream is returned
  6127. unchanged. Intermediate values define the amount of merging between both
  6128. input stream's pixel components.
  6129. This filter accepts the following options:
  6130. @table @option
  6131. @item planes
  6132. Set which planes will be processed as bitmap, unprocessed planes will be
  6133. copied from first stream.
  6134. By default value 0xf, all planes will be processed.
  6135. @end table
  6136. @section mcdeint
  6137. Apply motion-compensation deinterlacing.
  6138. It needs one field per frame as input and must thus be used together
  6139. with yadif=1/3 or equivalent.
  6140. This filter accepts the following options:
  6141. @table @option
  6142. @item mode
  6143. Set the deinterlacing mode.
  6144. It accepts one of the following values:
  6145. @table @samp
  6146. @item fast
  6147. @item medium
  6148. @item slow
  6149. use iterative motion estimation
  6150. @item extra_slow
  6151. like @samp{slow}, but use multiple reference frames.
  6152. @end table
  6153. Default value is @samp{fast}.
  6154. @item parity
  6155. Set the picture field parity assumed for the input video. It must be
  6156. one of the following values:
  6157. @table @samp
  6158. @item 0, tff
  6159. assume top field first
  6160. @item 1, bff
  6161. assume bottom field first
  6162. @end table
  6163. Default value is @samp{bff}.
  6164. @item qp
  6165. Set per-block quantization parameter (QP) used by the internal
  6166. encoder.
  6167. Higher values should result in a smoother motion vector field but less
  6168. optimal individual vectors. Default value is 1.
  6169. @end table
  6170. @section mergeplanes
  6171. Merge color channel components from several video streams.
  6172. The filter accepts up to 4 input streams, and merge selected input
  6173. planes to the output video.
  6174. This filter accepts the following options:
  6175. @table @option
  6176. @item mapping
  6177. Set input to output plane mapping. Default is @code{0}.
  6178. The mappings is specified as a bitmap. It should be specified as a
  6179. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  6180. mapping for the first plane of the output stream. 'A' sets the number of
  6181. the input stream to use (from 0 to 3), and 'a' the plane number of the
  6182. corresponding input to use (from 0 to 3). The rest of the mappings is
  6183. similar, 'Bb' describes the mapping for the output stream second
  6184. plane, 'Cc' describes the mapping for the output stream third plane and
  6185. 'Dd' describes the mapping for the output stream fourth plane.
  6186. @item format
  6187. Set output pixel format. Default is @code{yuva444p}.
  6188. @end table
  6189. @subsection Examples
  6190. @itemize
  6191. @item
  6192. Merge three gray video streams of same width and height into single video stream:
  6193. @example
  6194. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  6195. @end example
  6196. @item
  6197. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  6198. @example
  6199. [a0][a1]mergeplanes=0x00010210:yuva444p
  6200. @end example
  6201. @item
  6202. Swap Y and A plane in yuva444p stream:
  6203. @example
  6204. format=yuva444p,mergeplanes=0x03010200:yuva444p
  6205. @end example
  6206. @item
  6207. Swap U and V plane in yuv420p stream:
  6208. @example
  6209. format=yuv420p,mergeplanes=0x000201:yuv420p
  6210. @end example
  6211. @item
  6212. Cast a rgb24 clip to yuv444p:
  6213. @example
  6214. format=rgb24,mergeplanes=0x000102:yuv444p
  6215. @end example
  6216. @end itemize
  6217. @section mpdecimate
  6218. Drop frames that do not differ greatly from the previous frame in
  6219. order to reduce frame rate.
  6220. The main use of this filter is for very-low-bitrate encoding
  6221. (e.g. streaming over dialup modem), but it could in theory be used for
  6222. fixing movies that were inverse-telecined incorrectly.
  6223. A description of the accepted options follows.
  6224. @table @option
  6225. @item max
  6226. Set the maximum number of consecutive frames which can be dropped (if
  6227. positive), or the minimum interval between dropped frames (if
  6228. negative). If the value is 0, the frame is dropped unregarding the
  6229. number of previous sequentially dropped frames.
  6230. Default value is 0.
  6231. @item hi
  6232. @item lo
  6233. @item frac
  6234. Set the dropping threshold values.
  6235. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  6236. represent actual pixel value differences, so a threshold of 64
  6237. corresponds to 1 unit of difference for each pixel, or the same spread
  6238. out differently over the block.
  6239. A frame is a candidate for dropping if no 8x8 blocks differ by more
  6240. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  6241. meaning the whole image) differ by more than a threshold of @option{lo}.
  6242. Default value for @option{hi} is 64*12, default value for @option{lo} is
  6243. 64*5, and default value for @option{frac} is 0.33.
  6244. @end table
  6245. @section negate
  6246. Negate input video.
  6247. It accepts an integer in input; if non-zero it negates the
  6248. alpha component (if available). The default value in input is 0.
  6249. @section noformat
  6250. Force libavfilter not to use any of the specified pixel formats for the
  6251. input to the next filter.
  6252. It accepts the following parameters:
  6253. @table @option
  6254. @item pix_fmts
  6255. A '|'-separated list of pixel format names, such as
  6256. apix_fmts=yuv420p|monow|rgb24".
  6257. @end table
  6258. @subsection Examples
  6259. @itemize
  6260. @item
  6261. Force libavfilter to use a format different from @var{yuv420p} for the
  6262. input to the vflip filter:
  6263. @example
  6264. noformat=pix_fmts=yuv420p,vflip
  6265. @end example
  6266. @item
  6267. Convert the input video to any of the formats not contained in the list:
  6268. @example
  6269. noformat=yuv420p|yuv444p|yuv410p
  6270. @end example
  6271. @end itemize
  6272. @section noise
  6273. Add noise on video input frame.
  6274. The filter accepts the following options:
  6275. @table @option
  6276. @item all_seed
  6277. @item c0_seed
  6278. @item c1_seed
  6279. @item c2_seed
  6280. @item c3_seed
  6281. Set noise seed for specific pixel component or all pixel components in case
  6282. of @var{all_seed}. Default value is @code{123457}.
  6283. @item all_strength, alls
  6284. @item c0_strength, c0s
  6285. @item c1_strength, c1s
  6286. @item c2_strength, c2s
  6287. @item c3_strength, c3s
  6288. Set noise strength for specific pixel component or all pixel components in case
  6289. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  6290. @item all_flags, allf
  6291. @item c0_flags, c0f
  6292. @item c1_flags, c1f
  6293. @item c2_flags, c2f
  6294. @item c3_flags, c3f
  6295. Set pixel component flags or set flags for all components if @var{all_flags}.
  6296. Available values for component flags are:
  6297. @table @samp
  6298. @item a
  6299. averaged temporal noise (smoother)
  6300. @item p
  6301. mix random noise with a (semi)regular pattern
  6302. @item t
  6303. temporal noise (noise pattern changes between frames)
  6304. @item u
  6305. uniform noise (gaussian otherwise)
  6306. @end table
  6307. @end table
  6308. @subsection Examples
  6309. Add temporal and uniform noise to input video:
  6310. @example
  6311. noise=alls=20:allf=t+u
  6312. @end example
  6313. @section null
  6314. Pass the video source unchanged to the output.
  6315. @section ocr
  6316. Optical Character Recognition
  6317. This filter uses Tesseract for optical character recognition.
  6318. It accepts the following options:
  6319. @table @option
  6320. @item datapath
  6321. Set datapath to tesseract data. Default is to use whatever was
  6322. set at installation.
  6323. @item language
  6324. Set language, default is "eng".
  6325. @item whitelist
  6326. Set character whitelist.
  6327. @item blacklist
  6328. Set character blacklist.
  6329. @end table
  6330. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  6331. @section ocv
  6332. Apply a video transform using libopencv.
  6333. To enable this filter, install the libopencv library and headers and
  6334. configure FFmpeg with @code{--enable-libopencv}.
  6335. It accepts the following parameters:
  6336. @table @option
  6337. @item filter_name
  6338. The name of the libopencv filter to apply.
  6339. @item filter_params
  6340. The parameters to pass to the libopencv filter. If not specified, the default
  6341. values are assumed.
  6342. @end table
  6343. Refer to the official libopencv documentation for more precise
  6344. information:
  6345. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  6346. Several libopencv filters are supported; see the following subsections.
  6347. @anchor{dilate}
  6348. @subsection dilate
  6349. Dilate an image by using a specific structuring element.
  6350. It corresponds to the libopencv function @code{cvDilate}.
  6351. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  6352. @var{struct_el} represents a structuring element, and has the syntax:
  6353. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  6354. @var{cols} and @var{rows} represent the number of columns and rows of
  6355. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  6356. point, and @var{shape} the shape for the structuring element. @var{shape}
  6357. must be "rect", "cross", "ellipse", or "custom".
  6358. If the value for @var{shape} is "custom", it must be followed by a
  6359. string of the form "=@var{filename}". The file with name
  6360. @var{filename} is assumed to represent a binary image, with each
  6361. printable character corresponding to a bright pixel. When a custom
  6362. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  6363. or columns and rows of the read file are assumed instead.
  6364. The default value for @var{struct_el} is "3x3+0x0/rect".
  6365. @var{nb_iterations} specifies the number of times the transform is
  6366. applied to the image, and defaults to 1.
  6367. Some examples:
  6368. @example
  6369. # Use the default values
  6370. ocv=dilate
  6371. # Dilate using a structuring element with a 5x5 cross, iterating two times
  6372. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  6373. # Read the shape from the file diamond.shape, iterating two times.
  6374. # The file diamond.shape may contain a pattern of characters like this
  6375. # *
  6376. # ***
  6377. # *****
  6378. # ***
  6379. # *
  6380. # The specified columns and rows are ignored
  6381. # but the anchor point coordinates are not
  6382. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  6383. @end example
  6384. @subsection erode
  6385. Erode an image by using a specific structuring element.
  6386. It corresponds to the libopencv function @code{cvErode}.
  6387. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  6388. with the same syntax and semantics as the @ref{dilate} filter.
  6389. @subsection smooth
  6390. Smooth the input video.
  6391. The filter takes the following parameters:
  6392. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  6393. @var{type} is the type of smooth filter to apply, and must be one of
  6394. the following values: "blur", "blur_no_scale", "median", "gaussian",
  6395. or "bilateral". The default value is "gaussian".
  6396. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  6397. depend on the smooth type. @var{param1} and
  6398. @var{param2} accept integer positive values or 0. @var{param3} and
  6399. @var{param4} accept floating point values.
  6400. The default value for @var{param1} is 3. The default value for the
  6401. other parameters is 0.
  6402. These parameters correspond to the parameters assigned to the
  6403. libopencv function @code{cvSmooth}.
  6404. @anchor{overlay}
  6405. @section overlay
  6406. Overlay one video on top of another.
  6407. It takes two inputs and has one output. The first input is the "main"
  6408. video on which the second input is overlaid.
  6409. It accepts the following parameters:
  6410. A description of the accepted options follows.
  6411. @table @option
  6412. @item x
  6413. @item y
  6414. Set the expression for the x and y coordinates of the overlaid video
  6415. on the main video. Default value is "0" for both expressions. In case
  6416. the expression is invalid, it is set to a huge value (meaning that the
  6417. overlay will not be displayed within the output visible area).
  6418. @item eof_action
  6419. The action to take when EOF is encountered on the secondary input; it accepts
  6420. one of the following values:
  6421. @table @option
  6422. @item repeat
  6423. Repeat the last frame (the default).
  6424. @item endall
  6425. End both streams.
  6426. @item pass
  6427. Pass the main input through.
  6428. @end table
  6429. @item eval
  6430. Set when the expressions for @option{x}, and @option{y} are evaluated.
  6431. It accepts the following values:
  6432. @table @samp
  6433. @item init
  6434. only evaluate expressions once during the filter initialization or
  6435. when a command is processed
  6436. @item frame
  6437. evaluate expressions for each incoming frame
  6438. @end table
  6439. Default value is @samp{frame}.
  6440. @item shortest
  6441. If set to 1, force the output to terminate when the shortest input
  6442. terminates. Default value is 0.
  6443. @item format
  6444. Set the format for the output video.
  6445. It accepts the following values:
  6446. @table @samp
  6447. @item yuv420
  6448. force YUV420 output
  6449. @item yuv422
  6450. force YUV422 output
  6451. @item yuv444
  6452. force YUV444 output
  6453. @item rgb
  6454. force RGB output
  6455. @end table
  6456. Default value is @samp{yuv420}.
  6457. @item rgb @emph{(deprecated)}
  6458. If set to 1, force the filter to accept inputs in the RGB
  6459. color space. Default value is 0. This option is deprecated, use
  6460. @option{format} instead.
  6461. @item repeatlast
  6462. If set to 1, force the filter to draw the last overlay frame over the
  6463. main input until the end of the stream. A value of 0 disables this
  6464. behavior. Default value is 1.
  6465. @end table
  6466. The @option{x}, and @option{y} expressions can contain the following
  6467. parameters.
  6468. @table @option
  6469. @item main_w, W
  6470. @item main_h, H
  6471. The main input width and height.
  6472. @item overlay_w, w
  6473. @item overlay_h, h
  6474. The overlay input width and height.
  6475. @item x
  6476. @item y
  6477. The computed values for @var{x} and @var{y}. They are evaluated for
  6478. each new frame.
  6479. @item hsub
  6480. @item vsub
  6481. horizontal and vertical chroma subsample values of the output
  6482. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  6483. @var{vsub} is 1.
  6484. @item n
  6485. the number of input frame, starting from 0
  6486. @item pos
  6487. the position in the file of the input frame, NAN if unknown
  6488. @item t
  6489. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  6490. @end table
  6491. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  6492. when evaluation is done @emph{per frame}, and will evaluate to NAN
  6493. when @option{eval} is set to @samp{init}.
  6494. Be aware that frames are taken from each input video in timestamp
  6495. order, hence, if their initial timestamps differ, it is a good idea
  6496. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  6497. have them begin in the same zero timestamp, as the example for
  6498. the @var{movie} filter does.
  6499. You can chain together more overlays but you should test the
  6500. efficiency of such approach.
  6501. @subsection Commands
  6502. This filter supports the following commands:
  6503. @table @option
  6504. @item x
  6505. @item y
  6506. Modify the x and y of the overlay input.
  6507. The command accepts the same syntax of the corresponding option.
  6508. If the specified expression is not valid, it is kept at its current
  6509. value.
  6510. @end table
  6511. @subsection Examples
  6512. @itemize
  6513. @item
  6514. Draw the overlay at 10 pixels from the bottom right corner of the main
  6515. video:
  6516. @example
  6517. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  6518. @end example
  6519. Using named options the example above becomes:
  6520. @example
  6521. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  6522. @end example
  6523. @item
  6524. Insert a transparent PNG logo in the bottom left corner of the input,
  6525. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  6526. @example
  6527. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  6528. @end example
  6529. @item
  6530. Insert 2 different transparent PNG logos (second logo on bottom
  6531. right corner) using the @command{ffmpeg} tool:
  6532. @example
  6533. 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
  6534. @end example
  6535. @item
  6536. Add a transparent color layer on top of the main video; @code{WxH}
  6537. must specify the size of the main input to the overlay filter:
  6538. @example
  6539. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  6540. @end example
  6541. @item
  6542. Play an original video and a filtered version (here with the deshake
  6543. filter) side by side using the @command{ffplay} tool:
  6544. @example
  6545. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  6546. @end example
  6547. The above command is the same as:
  6548. @example
  6549. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  6550. @end example
  6551. @item
  6552. Make a sliding overlay appearing from the left to the right top part of the
  6553. screen starting since time 2:
  6554. @example
  6555. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  6556. @end example
  6557. @item
  6558. Compose output by putting two input videos side to side:
  6559. @example
  6560. ffmpeg -i left.avi -i right.avi -filter_complex "
  6561. nullsrc=size=200x100 [background];
  6562. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  6563. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  6564. [background][left] overlay=shortest=1 [background+left];
  6565. [background+left][right] overlay=shortest=1:x=100 [left+right]
  6566. "
  6567. @end example
  6568. @item
  6569. Mask 10-20 seconds of a video by applying the delogo filter to a section
  6570. @example
  6571. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  6572. -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]'
  6573. masked.avi
  6574. @end example
  6575. @item
  6576. Chain several overlays in cascade:
  6577. @example
  6578. nullsrc=s=200x200 [bg];
  6579. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  6580. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  6581. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  6582. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  6583. [in3] null, [mid2] overlay=100:100 [out0]
  6584. @end example
  6585. @end itemize
  6586. @section owdenoise
  6587. Apply Overcomplete Wavelet denoiser.
  6588. The filter accepts the following options:
  6589. @table @option
  6590. @item depth
  6591. Set depth.
  6592. Larger depth values will denoise lower frequency components more, but
  6593. slow down filtering.
  6594. Must be an int in the range 8-16, default is @code{8}.
  6595. @item luma_strength, ls
  6596. Set luma strength.
  6597. Must be a double value in the range 0-1000, default is @code{1.0}.
  6598. @item chroma_strength, cs
  6599. Set chroma strength.
  6600. Must be a double value in the range 0-1000, default is @code{1.0}.
  6601. @end table
  6602. @anchor{pad}
  6603. @section pad
  6604. Add paddings to the input image, and place the original input at the
  6605. provided @var{x}, @var{y} coordinates.
  6606. It accepts the following parameters:
  6607. @table @option
  6608. @item width, w
  6609. @item height, h
  6610. Specify an expression for the size of the output image with the
  6611. paddings added. If the value for @var{width} or @var{height} is 0, the
  6612. corresponding input size is used for the output.
  6613. The @var{width} expression can reference the value set by the
  6614. @var{height} expression, and vice versa.
  6615. The default value of @var{width} and @var{height} is 0.
  6616. @item x
  6617. @item y
  6618. Specify the offsets to place the input image at within the padded area,
  6619. with respect to the top/left border of the output image.
  6620. The @var{x} expression can reference the value set by the @var{y}
  6621. expression, and vice versa.
  6622. The default value of @var{x} and @var{y} is 0.
  6623. @item color
  6624. Specify the color of the padded area. For the syntax of this option,
  6625. check the "Color" section in the ffmpeg-utils manual.
  6626. The default value of @var{color} is "black".
  6627. @end table
  6628. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  6629. options are expressions containing the following constants:
  6630. @table @option
  6631. @item in_w
  6632. @item in_h
  6633. The input video width and height.
  6634. @item iw
  6635. @item ih
  6636. These are the same as @var{in_w} and @var{in_h}.
  6637. @item out_w
  6638. @item out_h
  6639. The output width and height (the size of the padded area), as
  6640. specified by the @var{width} and @var{height} expressions.
  6641. @item ow
  6642. @item oh
  6643. These are the same as @var{out_w} and @var{out_h}.
  6644. @item x
  6645. @item y
  6646. The x and y offsets as specified by the @var{x} and @var{y}
  6647. expressions, or NAN if not yet specified.
  6648. @item a
  6649. same as @var{iw} / @var{ih}
  6650. @item sar
  6651. input sample aspect ratio
  6652. @item dar
  6653. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6654. @item hsub
  6655. @item vsub
  6656. The horizontal and vertical chroma subsample values. For example for the
  6657. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6658. @end table
  6659. @subsection Examples
  6660. @itemize
  6661. @item
  6662. Add paddings with the color "violet" to the input video. The output video
  6663. size is 640x480, and the top-left corner of the input video is placed at
  6664. column 0, row 40
  6665. @example
  6666. pad=640:480:0:40:violet
  6667. @end example
  6668. The example above is equivalent to the following command:
  6669. @example
  6670. pad=width=640:height=480:x=0:y=40:color=violet
  6671. @end example
  6672. @item
  6673. Pad the input to get an output with dimensions increased by 3/2,
  6674. and put the input video at the center of the padded area:
  6675. @example
  6676. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  6677. @end example
  6678. @item
  6679. Pad the input to get a squared output with size equal to the maximum
  6680. value between the input width and height, and put the input video at
  6681. the center of the padded area:
  6682. @example
  6683. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  6684. @end example
  6685. @item
  6686. Pad the input to get a final w/h ratio of 16:9:
  6687. @example
  6688. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  6689. @end example
  6690. @item
  6691. In case of anamorphic video, in order to set the output display aspect
  6692. correctly, it is necessary to use @var{sar} in the expression,
  6693. according to the relation:
  6694. @example
  6695. (ih * X / ih) * sar = output_dar
  6696. X = output_dar / sar
  6697. @end example
  6698. Thus the previous example needs to be modified to:
  6699. @example
  6700. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  6701. @end example
  6702. @item
  6703. Double the output size and put the input video in the bottom-right
  6704. corner of the output padded area:
  6705. @example
  6706. pad="2*iw:2*ih:ow-iw:oh-ih"
  6707. @end example
  6708. @end itemize
  6709. @anchor{palettegen}
  6710. @section palettegen
  6711. Generate one palette for a whole video stream.
  6712. It accepts the following options:
  6713. @table @option
  6714. @item max_colors
  6715. Set the maximum number of colors to quantize in the palette.
  6716. Note: the palette will still contain 256 colors; the unused palette entries
  6717. will be black.
  6718. @item reserve_transparent
  6719. Create a palette of 255 colors maximum and reserve the last one for
  6720. transparency. Reserving the transparency color is useful for GIF optimization.
  6721. If not set, the maximum of colors in the palette will be 256. You probably want
  6722. to disable this option for a standalone image.
  6723. Set by default.
  6724. @item stats_mode
  6725. Set statistics mode.
  6726. It accepts the following values:
  6727. @table @samp
  6728. @item full
  6729. Compute full frame histograms.
  6730. @item diff
  6731. Compute histograms only for the part that differs from previous frame. This
  6732. might be relevant to give more importance to the moving part of your input if
  6733. the background is static.
  6734. @end table
  6735. Default value is @var{full}.
  6736. @end table
  6737. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  6738. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  6739. color quantization of the palette. This information is also visible at
  6740. @var{info} logging level.
  6741. @subsection Examples
  6742. @itemize
  6743. @item
  6744. Generate a representative palette of a given video using @command{ffmpeg}:
  6745. @example
  6746. ffmpeg -i input.mkv -vf palettegen palette.png
  6747. @end example
  6748. @end itemize
  6749. @section paletteuse
  6750. Use a palette to downsample an input video stream.
  6751. The filter takes two inputs: one video stream and a palette. The palette must
  6752. be a 256 pixels image.
  6753. It accepts the following options:
  6754. @table @option
  6755. @item dither
  6756. Select dithering mode. Available algorithms are:
  6757. @table @samp
  6758. @item bayer
  6759. Ordered 8x8 bayer dithering (deterministic)
  6760. @item heckbert
  6761. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  6762. Note: this dithering is sometimes considered "wrong" and is included as a
  6763. reference.
  6764. @item floyd_steinberg
  6765. Floyd and Steingberg dithering (error diffusion)
  6766. @item sierra2
  6767. Frankie Sierra dithering v2 (error diffusion)
  6768. @item sierra2_4a
  6769. Frankie Sierra dithering v2 "Lite" (error diffusion)
  6770. @end table
  6771. Default is @var{sierra2_4a}.
  6772. @item bayer_scale
  6773. When @var{bayer} dithering is selected, this option defines the scale of the
  6774. pattern (how much the crosshatch pattern is visible). A low value means more
  6775. visible pattern for less banding, and higher value means less visible pattern
  6776. at the cost of more banding.
  6777. The option must be an integer value in the range [0,5]. Default is @var{2}.
  6778. @item diff_mode
  6779. If set, define the zone to process
  6780. @table @samp
  6781. @item rectangle
  6782. Only the changing rectangle will be reprocessed. This is similar to GIF
  6783. cropping/offsetting compression mechanism. This option can be useful for speed
  6784. if only a part of the image is changing, and has use cases such as limiting the
  6785. scope of the error diffusal @option{dither} to the rectangle that bounds the
  6786. moving scene (it leads to more deterministic output if the scene doesn't change
  6787. much, and as a result less moving noise and better GIF compression).
  6788. @end table
  6789. Default is @var{none}.
  6790. @end table
  6791. @subsection Examples
  6792. @itemize
  6793. @item
  6794. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  6795. using @command{ffmpeg}:
  6796. @example
  6797. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  6798. @end example
  6799. @end itemize
  6800. @section perspective
  6801. Correct perspective of video not recorded perpendicular to the screen.
  6802. A description of the accepted parameters follows.
  6803. @table @option
  6804. @item x0
  6805. @item y0
  6806. @item x1
  6807. @item y1
  6808. @item x2
  6809. @item y2
  6810. @item x3
  6811. @item y3
  6812. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  6813. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  6814. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  6815. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  6816. then the corners of the source will be sent to the specified coordinates.
  6817. The expressions can use the following variables:
  6818. @table @option
  6819. @item W
  6820. @item H
  6821. the width and height of video frame.
  6822. @end table
  6823. @item interpolation
  6824. Set interpolation for perspective correction.
  6825. It accepts the following values:
  6826. @table @samp
  6827. @item linear
  6828. @item cubic
  6829. @end table
  6830. Default value is @samp{linear}.
  6831. @item sense
  6832. Set interpretation of coordinate options.
  6833. It accepts the following values:
  6834. @table @samp
  6835. @item 0, source
  6836. Send point in the source specified by the given coordinates to
  6837. the corners of the destination.
  6838. @item 1, destination
  6839. Send the corners of the source to the point in the destination specified
  6840. by the given coordinates.
  6841. Default value is @samp{source}.
  6842. @end table
  6843. @end table
  6844. @section phase
  6845. Delay interlaced video by one field time so that the field order changes.
  6846. The intended use is to fix PAL movies that have been captured with the
  6847. opposite field order to the film-to-video transfer.
  6848. A description of the accepted parameters follows.
  6849. @table @option
  6850. @item mode
  6851. Set phase mode.
  6852. It accepts the following values:
  6853. @table @samp
  6854. @item t
  6855. Capture field order top-first, transfer bottom-first.
  6856. Filter will delay the bottom field.
  6857. @item b
  6858. Capture field order bottom-first, transfer top-first.
  6859. Filter will delay the top field.
  6860. @item p
  6861. Capture and transfer with the same field order. This mode only exists
  6862. for the documentation of the other options to refer to, but if you
  6863. actually select it, the filter will faithfully do nothing.
  6864. @item a
  6865. Capture field order determined automatically by field flags, transfer
  6866. opposite.
  6867. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  6868. basis using field flags. If no field information is available,
  6869. then this works just like @samp{u}.
  6870. @item u
  6871. Capture unknown or varying, transfer opposite.
  6872. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  6873. analyzing the images and selecting the alternative that produces best
  6874. match between the fields.
  6875. @item T
  6876. Capture top-first, transfer unknown or varying.
  6877. Filter selects among @samp{t} and @samp{p} using image analysis.
  6878. @item B
  6879. Capture bottom-first, transfer unknown or varying.
  6880. Filter selects among @samp{b} and @samp{p} using image analysis.
  6881. @item A
  6882. Capture determined by field flags, transfer unknown or varying.
  6883. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  6884. image analysis. If no field information is available, then this works just
  6885. like @samp{U}. This is the default mode.
  6886. @item U
  6887. Both capture and transfer unknown or varying.
  6888. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  6889. @end table
  6890. @end table
  6891. @section pixdesctest
  6892. Pixel format descriptor test filter, mainly useful for internal
  6893. testing. The output video should be equal to the input video.
  6894. For example:
  6895. @example
  6896. format=monow, pixdesctest
  6897. @end example
  6898. can be used to test the monowhite pixel format descriptor definition.
  6899. @section pp
  6900. Enable the specified chain of postprocessing subfilters using libpostproc. This
  6901. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  6902. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  6903. Each subfilter and some options have a short and a long name that can be used
  6904. interchangeably, i.e. dr/dering are the same.
  6905. The filters accept the following options:
  6906. @table @option
  6907. @item subfilters
  6908. Set postprocessing subfilters string.
  6909. @end table
  6910. All subfilters share common options to determine their scope:
  6911. @table @option
  6912. @item a/autoq
  6913. Honor the quality commands for this subfilter.
  6914. @item c/chrom
  6915. Do chrominance filtering, too (default).
  6916. @item y/nochrom
  6917. Do luminance filtering only (no chrominance).
  6918. @item n/noluma
  6919. Do chrominance filtering only (no luminance).
  6920. @end table
  6921. These options can be appended after the subfilter name, separated by a '|'.
  6922. Available subfilters are:
  6923. @table @option
  6924. @item hb/hdeblock[|difference[|flatness]]
  6925. Horizontal deblocking filter
  6926. @table @option
  6927. @item difference
  6928. Difference factor where higher values mean more deblocking (default: @code{32}).
  6929. @item flatness
  6930. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6931. @end table
  6932. @item vb/vdeblock[|difference[|flatness]]
  6933. Vertical deblocking filter
  6934. @table @option
  6935. @item difference
  6936. Difference factor where higher values mean more deblocking (default: @code{32}).
  6937. @item flatness
  6938. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6939. @end table
  6940. @item ha/hadeblock[|difference[|flatness]]
  6941. Accurate horizontal deblocking filter
  6942. @table @option
  6943. @item difference
  6944. Difference factor where higher values mean more deblocking (default: @code{32}).
  6945. @item flatness
  6946. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6947. @end table
  6948. @item va/vadeblock[|difference[|flatness]]
  6949. Accurate vertical deblocking filter
  6950. @table @option
  6951. @item difference
  6952. Difference factor where higher values mean more deblocking (default: @code{32}).
  6953. @item flatness
  6954. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6955. @end table
  6956. @end table
  6957. The horizontal and vertical deblocking filters share the difference and
  6958. flatness values so you cannot set different horizontal and vertical
  6959. thresholds.
  6960. @table @option
  6961. @item h1/x1hdeblock
  6962. Experimental horizontal deblocking filter
  6963. @item v1/x1vdeblock
  6964. Experimental vertical deblocking filter
  6965. @item dr/dering
  6966. Deringing filter
  6967. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  6968. @table @option
  6969. @item threshold1
  6970. larger -> stronger filtering
  6971. @item threshold2
  6972. larger -> stronger filtering
  6973. @item threshold3
  6974. larger -> stronger filtering
  6975. @end table
  6976. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  6977. @table @option
  6978. @item f/fullyrange
  6979. Stretch luminance to @code{0-255}.
  6980. @end table
  6981. @item lb/linblenddeint
  6982. Linear blend deinterlacing filter that deinterlaces the given block by
  6983. filtering all lines with a @code{(1 2 1)} filter.
  6984. @item li/linipoldeint
  6985. Linear interpolating deinterlacing filter that deinterlaces the given block by
  6986. linearly interpolating every second line.
  6987. @item ci/cubicipoldeint
  6988. Cubic interpolating deinterlacing filter deinterlaces the given block by
  6989. cubically interpolating every second line.
  6990. @item md/mediandeint
  6991. Median deinterlacing filter that deinterlaces the given block by applying a
  6992. median filter to every second line.
  6993. @item fd/ffmpegdeint
  6994. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  6995. second line with a @code{(-1 4 2 4 -1)} filter.
  6996. @item l5/lowpass5
  6997. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  6998. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  6999. @item fq/forceQuant[|quantizer]
  7000. Overrides the quantizer table from the input with the constant quantizer you
  7001. specify.
  7002. @table @option
  7003. @item quantizer
  7004. Quantizer to use
  7005. @end table
  7006. @item de/default
  7007. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  7008. @item fa/fast
  7009. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  7010. @item ac
  7011. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  7012. @end table
  7013. @subsection Examples
  7014. @itemize
  7015. @item
  7016. Apply horizontal and vertical deblocking, deringing and automatic
  7017. brightness/contrast:
  7018. @example
  7019. pp=hb/vb/dr/al
  7020. @end example
  7021. @item
  7022. Apply default filters without brightness/contrast correction:
  7023. @example
  7024. pp=de/-al
  7025. @end example
  7026. @item
  7027. Apply default filters and temporal denoiser:
  7028. @example
  7029. pp=default/tmpnoise|1|2|3
  7030. @end example
  7031. @item
  7032. Apply deblocking on luminance only, and switch vertical deblocking on or off
  7033. automatically depending on available CPU time:
  7034. @example
  7035. pp=hb|y/vb|a
  7036. @end example
  7037. @end itemize
  7038. @section pp7
  7039. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  7040. similar to spp = 6 with 7 point DCT, where only the center sample is
  7041. used after IDCT.
  7042. The filter accepts the following options:
  7043. @table @option
  7044. @item qp
  7045. Force a constant quantization parameter. It accepts an integer in range
  7046. 0 to 63. If not set, the filter will use the QP from the video stream
  7047. (if available).
  7048. @item mode
  7049. Set thresholding mode. Available modes are:
  7050. @table @samp
  7051. @item hard
  7052. Set hard thresholding.
  7053. @item soft
  7054. Set soft thresholding (better de-ringing effect, but likely blurrier).
  7055. @item medium
  7056. Set medium thresholding (good results, default).
  7057. @end table
  7058. @end table
  7059. @section psnr
  7060. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  7061. Ratio) between two input videos.
  7062. This filter takes in input two input videos, the first input is
  7063. considered the "main" source and is passed unchanged to the
  7064. output. The second input is used as a "reference" video for computing
  7065. the PSNR.
  7066. Both video inputs must have the same resolution and pixel format for
  7067. this filter to work correctly. Also it assumes that both inputs
  7068. have the same number of frames, which are compared one by one.
  7069. The obtained average PSNR is printed through the logging system.
  7070. The filter stores the accumulated MSE (mean squared error) of each
  7071. frame, and at the end of the processing it is averaged across all frames
  7072. equally, and the following formula is applied to obtain the PSNR:
  7073. @example
  7074. PSNR = 10*log10(MAX^2/MSE)
  7075. @end example
  7076. Where MAX is the average of the maximum values of each component of the
  7077. image.
  7078. The description of the accepted parameters follows.
  7079. @table @option
  7080. @item stats_file, f
  7081. If specified the filter will use the named file to save the PSNR of
  7082. each individual frame. When filename equals "-" the data is sent to
  7083. standard output.
  7084. @end table
  7085. The file printed if @var{stats_file} is selected, contains a sequence of
  7086. key/value pairs of the form @var{key}:@var{value} for each compared
  7087. couple of frames.
  7088. A description of each shown parameter follows:
  7089. @table @option
  7090. @item n
  7091. sequential number of the input frame, starting from 1
  7092. @item mse_avg
  7093. Mean Square Error pixel-by-pixel average difference of the compared
  7094. frames, averaged over all the image components.
  7095. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  7096. Mean Square Error pixel-by-pixel average difference of the compared
  7097. frames for the component specified by the suffix.
  7098. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  7099. Peak Signal to Noise ratio of the compared frames for the component
  7100. specified by the suffix.
  7101. @end table
  7102. For example:
  7103. @example
  7104. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7105. [main][ref] psnr="stats_file=stats.log" [out]
  7106. @end example
  7107. On this example the input file being processed is compared with the
  7108. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  7109. is stored in @file{stats.log}.
  7110. @anchor{pullup}
  7111. @section pullup
  7112. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  7113. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  7114. content.
  7115. The pullup filter is designed to take advantage of future context in making
  7116. its decisions. This filter is stateless in the sense that it does not lock
  7117. onto a pattern to follow, but it instead looks forward to the following
  7118. fields in order to identify matches and rebuild progressive frames.
  7119. To produce content with an even framerate, insert the fps filter after
  7120. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  7121. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  7122. The filter accepts the following options:
  7123. @table @option
  7124. @item jl
  7125. @item jr
  7126. @item jt
  7127. @item jb
  7128. These options set the amount of "junk" to ignore at the left, right, top, and
  7129. bottom of the image, respectively. Left and right are in units of 8 pixels,
  7130. while top and bottom are in units of 2 lines.
  7131. The default is 8 pixels on each side.
  7132. @item sb
  7133. Set the strict breaks. Setting this option to 1 will reduce the chances of
  7134. filter generating an occasional mismatched frame, but it may also cause an
  7135. excessive number of frames to be dropped during high motion sequences.
  7136. Conversely, setting it to -1 will make filter match fields more easily.
  7137. This may help processing of video where there is slight blurring between
  7138. the fields, but may also cause there to be interlaced frames in the output.
  7139. Default value is @code{0}.
  7140. @item mp
  7141. Set the metric plane to use. It accepts the following values:
  7142. @table @samp
  7143. @item l
  7144. Use luma plane.
  7145. @item u
  7146. Use chroma blue plane.
  7147. @item v
  7148. Use chroma red plane.
  7149. @end table
  7150. This option may be set to use chroma plane instead of the default luma plane
  7151. for doing filter's computations. This may improve accuracy on very clean
  7152. source material, but more likely will decrease accuracy, especially if there
  7153. is chroma noise (rainbow effect) or any grayscale video.
  7154. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  7155. load and make pullup usable in realtime on slow machines.
  7156. @end table
  7157. For best results (without duplicated frames in the output file) it is
  7158. necessary to change the output frame rate. For example, to inverse
  7159. telecine NTSC input:
  7160. @example
  7161. ffmpeg -i input -vf pullup -r 24000/1001 ...
  7162. @end example
  7163. @section qp
  7164. Change video quantization parameters (QP).
  7165. The filter accepts the following option:
  7166. @table @option
  7167. @item qp
  7168. Set expression for quantization parameter.
  7169. @end table
  7170. The expression is evaluated through the eval API and can contain, among others,
  7171. the following constants:
  7172. @table @var
  7173. @item known
  7174. 1 if index is not 129, 0 otherwise.
  7175. @item qp
  7176. Sequentional index starting from -129 to 128.
  7177. @end table
  7178. @subsection Examples
  7179. @itemize
  7180. @item
  7181. Some equation like:
  7182. @example
  7183. qp=2+2*sin(PI*qp)
  7184. @end example
  7185. @end itemize
  7186. @section random
  7187. Flush video frames from internal cache of frames into a random order.
  7188. No frame is discarded.
  7189. Inspired by @ref{frei0r} nervous filter.
  7190. @table @option
  7191. @item frames
  7192. Set size in number of frames of internal cache, in range from @code{2} to
  7193. @code{512}. Default is @code{30}.
  7194. @item seed
  7195. Set seed for random number generator, must be an integer included between
  7196. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  7197. less than @code{0}, the filter will try to use a good random seed on a
  7198. best effort basis.
  7199. @end table
  7200. @section removegrain
  7201. The removegrain filter is a spatial denoiser for progressive video.
  7202. @table @option
  7203. @item m0
  7204. Set mode for the first plane.
  7205. @item m1
  7206. Set mode for the second plane.
  7207. @item m2
  7208. Set mode for the third plane.
  7209. @item m3
  7210. Set mode for the fourth plane.
  7211. @end table
  7212. Range of mode is from 0 to 24. Description of each mode follows:
  7213. @table @var
  7214. @item 0
  7215. Leave input plane unchanged. Default.
  7216. @item 1
  7217. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  7218. @item 2
  7219. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  7220. @item 3
  7221. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  7222. @item 4
  7223. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  7224. This is equivalent to a median filter.
  7225. @item 5
  7226. Line-sensitive clipping giving the minimal change.
  7227. @item 6
  7228. Line-sensitive clipping, intermediate.
  7229. @item 7
  7230. Line-sensitive clipping, intermediate.
  7231. @item 8
  7232. Line-sensitive clipping, intermediate.
  7233. @item 9
  7234. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  7235. @item 10
  7236. Replaces the target pixel with the closest neighbour.
  7237. @item 11
  7238. [1 2 1] horizontal and vertical kernel blur.
  7239. @item 12
  7240. Same as mode 11.
  7241. @item 13
  7242. Bob mode, interpolates top field from the line where the neighbours
  7243. pixels are the closest.
  7244. @item 14
  7245. Bob mode, interpolates bottom field from the line where the neighbours
  7246. pixels are the closest.
  7247. @item 15
  7248. Bob mode, interpolates top field. Same as 13 but with a more complicated
  7249. interpolation formula.
  7250. @item 16
  7251. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  7252. interpolation formula.
  7253. @item 17
  7254. Clips the pixel with the minimum and maximum of respectively the maximum and
  7255. minimum of each pair of opposite neighbour pixels.
  7256. @item 18
  7257. Line-sensitive clipping using opposite neighbours whose greatest distance from
  7258. the current pixel is minimal.
  7259. @item 19
  7260. Replaces the pixel with the average of its 8 neighbours.
  7261. @item 20
  7262. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  7263. @item 21
  7264. Clips pixels using the averages of opposite neighbour.
  7265. @item 22
  7266. Same as mode 21 but simpler and faster.
  7267. @item 23
  7268. Small edge and halo removal, but reputed useless.
  7269. @item 24
  7270. Similar as 23.
  7271. @end table
  7272. @section removelogo
  7273. Suppress a TV station logo, using an image file to determine which
  7274. pixels comprise the logo. It works by filling in the pixels that
  7275. comprise the logo with neighboring pixels.
  7276. The filter accepts the following options:
  7277. @table @option
  7278. @item filename, f
  7279. Set the filter bitmap file, which can be any image format supported by
  7280. libavformat. The width and height of the image file must match those of the
  7281. video stream being processed.
  7282. @end table
  7283. Pixels in the provided bitmap image with a value of zero are not
  7284. considered part of the logo, non-zero pixels are considered part of
  7285. the logo. If you use white (255) for the logo and black (0) for the
  7286. rest, you will be safe. For making the filter bitmap, it is
  7287. recommended to take a screen capture of a black frame with the logo
  7288. visible, and then using a threshold filter followed by the erode
  7289. filter once or twice.
  7290. If needed, little splotches can be fixed manually. Remember that if
  7291. logo pixels are not covered, the filter quality will be much
  7292. reduced. Marking too many pixels as part of the logo does not hurt as
  7293. much, but it will increase the amount of blurring needed to cover over
  7294. the image and will destroy more information than necessary, and extra
  7295. pixels will slow things down on a large logo.
  7296. @section repeatfields
  7297. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  7298. fields based on its value.
  7299. @section reverse, areverse
  7300. Reverse a clip.
  7301. Warning: This filter requires memory to buffer the entire clip, so trimming
  7302. is suggested.
  7303. @subsection Examples
  7304. @itemize
  7305. @item
  7306. Take the first 5 seconds of a clip, and reverse it.
  7307. @example
  7308. trim=end=5,reverse
  7309. @end example
  7310. @end itemize
  7311. @section rotate
  7312. Rotate video by an arbitrary angle expressed in radians.
  7313. The filter accepts the following options:
  7314. A description of the optional parameters follows.
  7315. @table @option
  7316. @item angle, a
  7317. Set an expression for the angle by which to rotate the input video
  7318. clockwise, expressed as a number of radians. A negative value will
  7319. result in a counter-clockwise rotation. By default it is set to "0".
  7320. This expression is evaluated for each frame.
  7321. @item out_w, ow
  7322. Set the output width expression, default value is "iw".
  7323. This expression is evaluated just once during configuration.
  7324. @item out_h, oh
  7325. Set the output height expression, default value is "ih".
  7326. This expression is evaluated just once during configuration.
  7327. @item bilinear
  7328. Enable bilinear interpolation if set to 1, a value of 0 disables
  7329. it. Default value is 1.
  7330. @item fillcolor, c
  7331. Set the color used to fill the output area not covered by the rotated
  7332. image. For the general syntax of this option, check the "Color" section in the
  7333. ffmpeg-utils manual. If the special value "none" is selected then no
  7334. background is printed (useful for example if the background is never shown).
  7335. Default value is "black".
  7336. @end table
  7337. The expressions for the angle and the output size can contain the
  7338. following constants and functions:
  7339. @table @option
  7340. @item n
  7341. sequential number of the input frame, starting from 0. It is always NAN
  7342. before the first frame is filtered.
  7343. @item t
  7344. time in seconds of the input frame, it is set to 0 when the filter is
  7345. configured. It is always NAN before the first frame is filtered.
  7346. @item hsub
  7347. @item vsub
  7348. horizontal and vertical chroma subsample values. For example for the
  7349. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7350. @item in_w, iw
  7351. @item in_h, ih
  7352. the input video width and height
  7353. @item out_w, ow
  7354. @item out_h, oh
  7355. the output width and height, that is the size of the padded area as
  7356. specified by the @var{width} and @var{height} expressions
  7357. @item rotw(a)
  7358. @item roth(a)
  7359. the minimal width/height required for completely containing the input
  7360. video rotated by @var{a} radians.
  7361. These are only available when computing the @option{out_w} and
  7362. @option{out_h} expressions.
  7363. @end table
  7364. @subsection Examples
  7365. @itemize
  7366. @item
  7367. Rotate the input by PI/6 radians clockwise:
  7368. @example
  7369. rotate=PI/6
  7370. @end example
  7371. @item
  7372. Rotate the input by PI/6 radians counter-clockwise:
  7373. @example
  7374. rotate=-PI/6
  7375. @end example
  7376. @item
  7377. Rotate the input by 45 degrees clockwise:
  7378. @example
  7379. rotate=45*PI/180
  7380. @end example
  7381. @item
  7382. Apply a constant rotation with period T, starting from an angle of PI/3:
  7383. @example
  7384. rotate=PI/3+2*PI*t/T
  7385. @end example
  7386. @item
  7387. Make the input video rotation oscillating with a period of T
  7388. seconds and an amplitude of A radians:
  7389. @example
  7390. rotate=A*sin(2*PI/T*t)
  7391. @end example
  7392. @item
  7393. Rotate the video, output size is chosen so that the whole rotating
  7394. input video is always completely contained in the output:
  7395. @example
  7396. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  7397. @end example
  7398. @item
  7399. Rotate the video, reduce the output size so that no background is ever
  7400. shown:
  7401. @example
  7402. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  7403. @end example
  7404. @end itemize
  7405. @subsection Commands
  7406. The filter supports the following commands:
  7407. @table @option
  7408. @item a, angle
  7409. Set the angle expression.
  7410. The command accepts the same syntax of the corresponding option.
  7411. If the specified expression is not valid, it is kept at its current
  7412. value.
  7413. @end table
  7414. @section sab
  7415. Apply Shape Adaptive Blur.
  7416. The filter accepts the following options:
  7417. @table @option
  7418. @item luma_radius, lr
  7419. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  7420. value is 1.0. A greater value will result in a more blurred image, and
  7421. in slower processing.
  7422. @item luma_pre_filter_radius, lpfr
  7423. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  7424. value is 1.0.
  7425. @item luma_strength, ls
  7426. Set luma maximum difference between pixels to still be considered, must
  7427. be a value in the 0.1-100.0 range, default value is 1.0.
  7428. @item chroma_radius, cr
  7429. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  7430. greater value will result in a more blurred image, and in slower
  7431. processing.
  7432. @item chroma_pre_filter_radius, cpfr
  7433. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  7434. @item chroma_strength, cs
  7435. Set chroma maximum difference between pixels to still be considered,
  7436. must be a value in the 0.1-100.0 range.
  7437. @end table
  7438. Each chroma option value, if not explicitly specified, is set to the
  7439. corresponding luma option value.
  7440. @anchor{scale}
  7441. @section scale
  7442. Scale (resize) the input video, using the libswscale library.
  7443. The scale filter forces the output display aspect ratio to be the same
  7444. of the input, by changing the output sample aspect ratio.
  7445. If the input image format is different from the format requested by
  7446. the next filter, the scale filter will convert the input to the
  7447. requested format.
  7448. @subsection Options
  7449. The filter accepts the following options, or any of the options
  7450. supported by the libswscale scaler.
  7451. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  7452. the complete list of scaler options.
  7453. @table @option
  7454. @item width, w
  7455. @item height, h
  7456. Set the output video dimension expression. Default value is the input
  7457. dimension.
  7458. If the value is 0, the input width is used for the output.
  7459. If one of the values is -1, the scale filter will use a value that
  7460. maintains the aspect ratio of the input image, calculated from the
  7461. other specified dimension. If both of them are -1, the input size is
  7462. used
  7463. If one of the values is -n with n > 1, the scale filter will also use a value
  7464. that maintains the aspect ratio of the input image, calculated from the other
  7465. specified dimension. After that it will, however, make sure that the calculated
  7466. dimension is divisible by n and adjust the value if necessary.
  7467. See below for the list of accepted constants for use in the dimension
  7468. expression.
  7469. @item interl
  7470. Set the interlacing mode. It accepts the following values:
  7471. @table @samp
  7472. @item 1
  7473. Force interlaced aware scaling.
  7474. @item 0
  7475. Do not apply interlaced scaling.
  7476. @item -1
  7477. Select interlaced aware scaling depending on whether the source frames
  7478. are flagged as interlaced or not.
  7479. @end table
  7480. Default value is @samp{0}.
  7481. @item flags
  7482. Set libswscale scaling flags. See
  7483. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  7484. complete list of values. If not explicitly specified the filter applies
  7485. the default flags.
  7486. @item size, s
  7487. Set the video size. For the syntax of this option, check the
  7488. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7489. @item in_color_matrix
  7490. @item out_color_matrix
  7491. Set in/output YCbCr color space type.
  7492. This allows the autodetected value to be overridden as well as allows forcing
  7493. a specific value used for the output and encoder.
  7494. If not specified, the color space type depends on the pixel format.
  7495. Possible values:
  7496. @table @samp
  7497. @item auto
  7498. Choose automatically.
  7499. @item bt709
  7500. Format conforming to International Telecommunication Union (ITU)
  7501. Recommendation BT.709.
  7502. @item fcc
  7503. Set color space conforming to the United States Federal Communications
  7504. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  7505. @item bt601
  7506. Set color space conforming to:
  7507. @itemize
  7508. @item
  7509. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  7510. @item
  7511. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  7512. @item
  7513. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  7514. @end itemize
  7515. @item smpte240m
  7516. Set color space conforming to SMPTE ST 240:1999.
  7517. @end table
  7518. @item in_range
  7519. @item out_range
  7520. Set in/output YCbCr sample range.
  7521. This allows the autodetected value to be overridden as well as allows forcing
  7522. a specific value used for the output and encoder. If not specified, the
  7523. range depends on the pixel format. Possible values:
  7524. @table @samp
  7525. @item auto
  7526. Choose automatically.
  7527. @item jpeg/full/pc
  7528. Set full range (0-255 in case of 8-bit luma).
  7529. @item mpeg/tv
  7530. Set "MPEG" range (16-235 in case of 8-bit luma).
  7531. @end table
  7532. @item force_original_aspect_ratio
  7533. Enable decreasing or increasing output video width or height if necessary to
  7534. keep the original aspect ratio. Possible values:
  7535. @table @samp
  7536. @item disable
  7537. Scale the video as specified and disable this feature.
  7538. @item decrease
  7539. The output video dimensions will automatically be decreased if needed.
  7540. @item increase
  7541. The output video dimensions will automatically be increased if needed.
  7542. @end table
  7543. One useful instance of this option is that when you know a specific device's
  7544. maximum allowed resolution, you can use this to limit the output video to
  7545. that, while retaining the aspect ratio. For example, device A allows
  7546. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  7547. decrease) and specifying 1280x720 to the command line makes the output
  7548. 1280x533.
  7549. Please note that this is a different thing than specifying -1 for @option{w}
  7550. or @option{h}, you still need to specify the output resolution for this option
  7551. to work.
  7552. @end table
  7553. The values of the @option{w} and @option{h} options are expressions
  7554. containing the following constants:
  7555. @table @var
  7556. @item in_w
  7557. @item in_h
  7558. The input width and height
  7559. @item iw
  7560. @item ih
  7561. These are the same as @var{in_w} and @var{in_h}.
  7562. @item out_w
  7563. @item out_h
  7564. The output (scaled) width and height
  7565. @item ow
  7566. @item oh
  7567. These are the same as @var{out_w} and @var{out_h}
  7568. @item a
  7569. The same as @var{iw} / @var{ih}
  7570. @item sar
  7571. input sample aspect ratio
  7572. @item dar
  7573. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  7574. @item hsub
  7575. @item vsub
  7576. horizontal and vertical input chroma subsample values. For example for the
  7577. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7578. @item ohsub
  7579. @item ovsub
  7580. horizontal and vertical output chroma subsample values. For example for the
  7581. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7582. @end table
  7583. @subsection Examples
  7584. @itemize
  7585. @item
  7586. Scale the input video to a size of 200x100
  7587. @example
  7588. scale=w=200:h=100
  7589. @end example
  7590. This is equivalent to:
  7591. @example
  7592. scale=200:100
  7593. @end example
  7594. or:
  7595. @example
  7596. scale=200x100
  7597. @end example
  7598. @item
  7599. Specify a size abbreviation for the output size:
  7600. @example
  7601. scale=qcif
  7602. @end example
  7603. which can also be written as:
  7604. @example
  7605. scale=size=qcif
  7606. @end example
  7607. @item
  7608. Scale the input to 2x:
  7609. @example
  7610. scale=w=2*iw:h=2*ih
  7611. @end example
  7612. @item
  7613. The above is the same as:
  7614. @example
  7615. scale=2*in_w:2*in_h
  7616. @end example
  7617. @item
  7618. Scale the input to 2x with forced interlaced scaling:
  7619. @example
  7620. scale=2*iw:2*ih:interl=1
  7621. @end example
  7622. @item
  7623. Scale the input to half size:
  7624. @example
  7625. scale=w=iw/2:h=ih/2
  7626. @end example
  7627. @item
  7628. Increase the width, and set the height to the same size:
  7629. @example
  7630. scale=3/2*iw:ow
  7631. @end example
  7632. @item
  7633. Seek Greek harmony:
  7634. @example
  7635. scale=iw:1/PHI*iw
  7636. scale=ih*PHI:ih
  7637. @end example
  7638. @item
  7639. Increase the height, and set the width to 3/2 of the height:
  7640. @example
  7641. scale=w=3/2*oh:h=3/5*ih
  7642. @end example
  7643. @item
  7644. Increase the size, making the size a multiple of the chroma
  7645. subsample values:
  7646. @example
  7647. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  7648. @end example
  7649. @item
  7650. Increase the width to a maximum of 500 pixels,
  7651. keeping the same aspect ratio as the input:
  7652. @example
  7653. scale=w='min(500\, iw*3/2):h=-1'
  7654. @end example
  7655. @end itemize
  7656. @subsection Commands
  7657. This filter supports the following commands:
  7658. @table @option
  7659. @item width, w
  7660. @item height, h
  7661. Set the output video dimension expression.
  7662. The command accepts the same syntax of the corresponding option.
  7663. If the specified expression is not valid, it is kept at its current
  7664. value.
  7665. @end table
  7666. @section scale2ref
  7667. Scale (resize) the input video, based on a reference video.
  7668. See the scale filter for available options, scale2ref supports the same but
  7669. uses the reference video instead of the main input as basis.
  7670. @subsection Examples
  7671. @itemize
  7672. @item
  7673. Scale a subtitle stream to match the main video in size before overlaying
  7674. @example
  7675. 'scale2ref[b][a];[a][b]overlay'
  7676. @end example
  7677. @end itemize
  7678. @section separatefields
  7679. The @code{separatefields} takes a frame-based video input and splits
  7680. each frame into its components fields, producing a new half height clip
  7681. with twice the frame rate and twice the frame count.
  7682. This filter use field-dominance information in frame to decide which
  7683. of each pair of fields to place first in the output.
  7684. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  7685. @section setdar, setsar
  7686. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  7687. output video.
  7688. This is done by changing the specified Sample (aka Pixel) Aspect
  7689. Ratio, according to the following equation:
  7690. @example
  7691. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  7692. @end example
  7693. Keep in mind that the @code{setdar} filter does not modify the pixel
  7694. dimensions of the video frame. Also, the display aspect ratio set by
  7695. this filter may be changed by later filters in the filterchain,
  7696. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  7697. applied.
  7698. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  7699. the filter output video.
  7700. Note that as a consequence of the application of this filter, the
  7701. output display aspect ratio will change according to the equation
  7702. above.
  7703. Keep in mind that the sample aspect ratio set by the @code{setsar}
  7704. filter may be changed by later filters in the filterchain, e.g. if
  7705. another "setsar" or a "setdar" filter is applied.
  7706. It accepts the following parameters:
  7707. @table @option
  7708. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  7709. Set the aspect ratio used by the filter.
  7710. The parameter can be a floating point number string, an expression, or
  7711. a string of the form @var{num}:@var{den}, where @var{num} and
  7712. @var{den} are the numerator and denominator of the aspect ratio. If
  7713. the parameter is not specified, it is assumed the value "0".
  7714. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  7715. should be escaped.
  7716. @item max
  7717. Set the maximum integer value to use for expressing numerator and
  7718. denominator when reducing the expressed aspect ratio to a rational.
  7719. Default value is @code{100}.
  7720. @end table
  7721. The parameter @var{sar} is an expression containing
  7722. the following constants:
  7723. @table @option
  7724. @item E, PI, PHI
  7725. These are approximated values for the mathematical constants e
  7726. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  7727. @item w, h
  7728. The input width and height.
  7729. @item a
  7730. These are the same as @var{w} / @var{h}.
  7731. @item sar
  7732. The input sample aspect ratio.
  7733. @item dar
  7734. The input display aspect ratio. It is the same as
  7735. (@var{w} / @var{h}) * @var{sar}.
  7736. @item hsub, vsub
  7737. Horizontal and vertical chroma subsample values. For example, for the
  7738. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7739. @end table
  7740. @subsection Examples
  7741. @itemize
  7742. @item
  7743. To change the display aspect ratio to 16:9, specify one of the following:
  7744. @example
  7745. setdar=dar=1.77777
  7746. setdar=dar=16/9
  7747. setdar=dar=1.77777
  7748. @end example
  7749. @item
  7750. To change the sample aspect ratio to 10:11, specify:
  7751. @example
  7752. setsar=sar=10/11
  7753. @end example
  7754. @item
  7755. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  7756. 1000 in the aspect ratio reduction, use the command:
  7757. @example
  7758. setdar=ratio=16/9:max=1000
  7759. @end example
  7760. @end itemize
  7761. @anchor{setfield}
  7762. @section setfield
  7763. Force field for the output video frame.
  7764. The @code{setfield} filter marks the interlace type field for the
  7765. output frames. It does not change the input frame, but only sets the
  7766. corresponding property, which affects how the frame is treated by
  7767. following filters (e.g. @code{fieldorder} or @code{yadif}).
  7768. The filter accepts the following options:
  7769. @table @option
  7770. @item mode
  7771. Available values are:
  7772. @table @samp
  7773. @item auto
  7774. Keep the same field property.
  7775. @item bff
  7776. Mark the frame as bottom-field-first.
  7777. @item tff
  7778. Mark the frame as top-field-first.
  7779. @item prog
  7780. Mark the frame as progressive.
  7781. @end table
  7782. @end table
  7783. @section showinfo
  7784. Show a line containing various information for each input video frame.
  7785. The input video is not modified.
  7786. The shown line contains a sequence of key/value pairs of the form
  7787. @var{key}:@var{value}.
  7788. The following values are shown in the output:
  7789. @table @option
  7790. @item n
  7791. The (sequential) number of the input frame, starting from 0.
  7792. @item pts
  7793. The Presentation TimeStamp of the input frame, expressed as a number of
  7794. time base units. The time base unit depends on the filter input pad.
  7795. @item pts_time
  7796. The Presentation TimeStamp of the input frame, expressed as a number of
  7797. seconds.
  7798. @item pos
  7799. The position of the frame in the input stream, or -1 if this information is
  7800. unavailable and/or meaningless (for example in case of synthetic video).
  7801. @item fmt
  7802. The pixel format name.
  7803. @item sar
  7804. The sample aspect ratio of the input frame, expressed in the form
  7805. @var{num}/@var{den}.
  7806. @item s
  7807. The size of the input frame. For the syntax of this option, check the
  7808. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7809. @item i
  7810. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  7811. for bottom field first).
  7812. @item iskey
  7813. This is 1 if the frame is a key frame, 0 otherwise.
  7814. @item type
  7815. The picture type of the input frame ("I" for an I-frame, "P" for a
  7816. P-frame, "B" for a B-frame, or "?" for an unknown type).
  7817. Also refer to the documentation of the @code{AVPictureType} enum and of
  7818. the @code{av_get_picture_type_char} function defined in
  7819. @file{libavutil/avutil.h}.
  7820. @item checksum
  7821. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  7822. @item plane_checksum
  7823. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  7824. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  7825. @end table
  7826. @section showpalette
  7827. Displays the 256 colors palette of each frame. This filter is only relevant for
  7828. @var{pal8} pixel format frames.
  7829. It accepts the following option:
  7830. @table @option
  7831. @item s
  7832. Set the size of the box used to represent one palette color entry. Default is
  7833. @code{30} (for a @code{30x30} pixel box).
  7834. @end table
  7835. @section shuffleframes
  7836. Reorder and/or duplicate video frames.
  7837. It accepts the following parameters:
  7838. @table @option
  7839. @item mapping
  7840. Set the destination indexes of input frames.
  7841. This is space or '|' separated list of indexes that maps input frames to output
  7842. frames. Number of indexes also sets maximal value that each index may have.
  7843. @end table
  7844. The first frame has the index 0. The default is to keep the input unchanged.
  7845. Swap second and third frame of every three frames of the input:
  7846. @example
  7847. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  7848. @end example
  7849. @section shuffleplanes
  7850. Reorder and/or duplicate video planes.
  7851. It accepts the following parameters:
  7852. @table @option
  7853. @item map0
  7854. The index of the input plane to be used as the first output plane.
  7855. @item map1
  7856. The index of the input plane to be used as the second output plane.
  7857. @item map2
  7858. The index of the input plane to be used as the third output plane.
  7859. @item map3
  7860. The index of the input plane to be used as the fourth output plane.
  7861. @end table
  7862. The first plane has the index 0. The default is to keep the input unchanged.
  7863. Swap the second and third planes of the input:
  7864. @example
  7865. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  7866. @end example
  7867. @anchor{signalstats}
  7868. @section signalstats
  7869. Evaluate various visual metrics that assist in determining issues associated
  7870. with the digitization of analog video media.
  7871. By default the filter will log these metadata values:
  7872. @table @option
  7873. @item YMIN
  7874. Display the minimal Y value contained within the input frame. Expressed in
  7875. range of [0-255].
  7876. @item YLOW
  7877. Display the Y value at the 10% percentile within the input frame. Expressed in
  7878. range of [0-255].
  7879. @item YAVG
  7880. Display the average Y value within the input frame. Expressed in range of
  7881. [0-255].
  7882. @item YHIGH
  7883. Display the Y value at the 90% percentile within the input frame. Expressed in
  7884. range of [0-255].
  7885. @item YMAX
  7886. Display the maximum Y value contained within the input frame. Expressed in
  7887. range of [0-255].
  7888. @item UMIN
  7889. Display the minimal U value contained within the input frame. Expressed in
  7890. range of [0-255].
  7891. @item ULOW
  7892. Display the U value at the 10% percentile within the input frame. Expressed in
  7893. range of [0-255].
  7894. @item UAVG
  7895. Display the average U value within the input frame. Expressed in range of
  7896. [0-255].
  7897. @item UHIGH
  7898. Display the U value at the 90% percentile within the input frame. Expressed in
  7899. range of [0-255].
  7900. @item UMAX
  7901. Display the maximum U value contained within the input frame. Expressed in
  7902. range of [0-255].
  7903. @item VMIN
  7904. Display the minimal V value contained within the input frame. Expressed in
  7905. range of [0-255].
  7906. @item VLOW
  7907. Display the V value at the 10% percentile within the input frame. Expressed in
  7908. range of [0-255].
  7909. @item VAVG
  7910. Display the average V value within the input frame. Expressed in range of
  7911. [0-255].
  7912. @item VHIGH
  7913. Display the V value at the 90% percentile within the input frame. Expressed in
  7914. range of [0-255].
  7915. @item VMAX
  7916. Display the maximum V value contained within the input frame. Expressed in
  7917. range of [0-255].
  7918. @item SATMIN
  7919. Display the minimal saturation value contained within the input frame.
  7920. Expressed in range of [0-~181.02].
  7921. @item SATLOW
  7922. Display the saturation value at the 10% percentile within the input frame.
  7923. Expressed in range of [0-~181.02].
  7924. @item SATAVG
  7925. Display the average saturation value within the input frame. Expressed in range
  7926. of [0-~181.02].
  7927. @item SATHIGH
  7928. Display the saturation value at the 90% percentile within the input frame.
  7929. Expressed in range of [0-~181.02].
  7930. @item SATMAX
  7931. Display the maximum saturation value contained within the input frame.
  7932. Expressed in range of [0-~181.02].
  7933. @item HUEMED
  7934. Display the median value for hue within the input frame. Expressed in range of
  7935. [0-360].
  7936. @item HUEAVG
  7937. Display the average value for hue within the input frame. Expressed in range of
  7938. [0-360].
  7939. @item YDIF
  7940. Display the average of sample value difference between all values of the Y
  7941. plane in the current frame and corresponding values of the previous input frame.
  7942. Expressed in range of [0-255].
  7943. @item UDIF
  7944. Display the average of sample value difference between all values of the U
  7945. plane in the current frame and corresponding values of the previous input frame.
  7946. Expressed in range of [0-255].
  7947. @item VDIF
  7948. Display the average of sample value difference between all values of the V
  7949. plane in the current frame and corresponding values of the previous input frame.
  7950. Expressed in range of [0-255].
  7951. @end table
  7952. The filter accepts the following options:
  7953. @table @option
  7954. @item stat
  7955. @item out
  7956. @option{stat} specify an additional form of image analysis.
  7957. @option{out} output video with the specified type of pixel highlighted.
  7958. Both options accept the following values:
  7959. @table @samp
  7960. @item tout
  7961. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  7962. unlike the neighboring pixels of the same field. Examples of temporal outliers
  7963. include the results of video dropouts, head clogs, or tape tracking issues.
  7964. @item vrep
  7965. Identify @var{vertical line repetition}. Vertical line repetition includes
  7966. similar rows of pixels within a frame. In born-digital video vertical line
  7967. repetition is common, but this pattern is uncommon in video digitized from an
  7968. analog source. When it occurs in video that results from the digitization of an
  7969. analog source it can indicate concealment from a dropout compensator.
  7970. @item brng
  7971. Identify pixels that fall outside of legal broadcast range.
  7972. @end table
  7973. @item color, c
  7974. Set the highlight color for the @option{out} option. The default color is
  7975. yellow.
  7976. @end table
  7977. @subsection Examples
  7978. @itemize
  7979. @item
  7980. Output data of various video metrics:
  7981. @example
  7982. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  7983. @end example
  7984. @item
  7985. Output specific data about the minimum and maximum values of the Y plane per frame:
  7986. @example
  7987. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  7988. @end example
  7989. @item
  7990. Playback video while highlighting pixels that are outside of broadcast range in red.
  7991. @example
  7992. ffplay example.mov -vf signalstats="out=brng:color=red"
  7993. @end example
  7994. @item
  7995. Playback video with signalstats metadata drawn over the frame.
  7996. @example
  7997. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  7998. @end example
  7999. The contents of signalstat_drawtext.txt used in the command are:
  8000. @example
  8001. time %@{pts:hms@}
  8002. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  8003. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  8004. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  8005. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  8006. @end example
  8007. @end itemize
  8008. @anchor{smartblur}
  8009. @section smartblur
  8010. Blur the input video without impacting the outlines.
  8011. It accepts the following options:
  8012. @table @option
  8013. @item luma_radius, lr
  8014. Set the luma radius. The option value must be a float number in
  8015. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8016. used to blur the image (slower if larger). Default value is 1.0.
  8017. @item luma_strength, ls
  8018. Set the luma strength. The option value must be a float number
  8019. in the range [-1.0,1.0] that configures the blurring. A value included
  8020. in [0.0,1.0] will blur the image whereas a value included in
  8021. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8022. @item luma_threshold, lt
  8023. Set the luma threshold used as a coefficient to determine
  8024. whether a pixel should be blurred or not. The option value must be an
  8025. integer in the range [-30,30]. A value of 0 will filter all the image,
  8026. a value included in [0,30] will filter flat areas and a value included
  8027. in [-30,0] will filter edges. Default value is 0.
  8028. @item chroma_radius, cr
  8029. Set the chroma radius. The option value must be a float number in
  8030. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8031. used to blur the image (slower if larger). Default value is 1.0.
  8032. @item chroma_strength, cs
  8033. Set the chroma strength. The option value must be a float number
  8034. in the range [-1.0,1.0] that configures the blurring. A value included
  8035. in [0.0,1.0] will blur the image whereas a value included in
  8036. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8037. @item chroma_threshold, ct
  8038. Set the chroma threshold used as a coefficient to determine
  8039. whether a pixel should be blurred or not. The option value must be an
  8040. integer in the range [-30,30]. A value of 0 will filter all the image,
  8041. a value included in [0,30] will filter flat areas and a value included
  8042. in [-30,0] will filter edges. Default value is 0.
  8043. @end table
  8044. If a chroma option is not explicitly set, the corresponding luma value
  8045. is set.
  8046. @section ssim
  8047. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  8048. This filter takes in input two input videos, the first input is
  8049. considered the "main" source and is passed unchanged to the
  8050. output. The second input is used as a "reference" video for computing
  8051. the SSIM.
  8052. Both video inputs must have the same resolution and pixel format for
  8053. this filter to work correctly. Also it assumes that both inputs
  8054. have the same number of frames, which are compared one by one.
  8055. The filter stores the calculated SSIM of each frame.
  8056. The description of the accepted parameters follows.
  8057. @table @option
  8058. @item stats_file, f
  8059. If specified the filter will use the named file to save the SSIM of
  8060. each individual frame. When filename equals "-" the data is sent to
  8061. standard output.
  8062. @end table
  8063. The file printed if @var{stats_file} is selected, contains a sequence of
  8064. key/value pairs of the form @var{key}:@var{value} for each compared
  8065. couple of frames.
  8066. A description of each shown parameter follows:
  8067. @table @option
  8068. @item n
  8069. sequential number of the input frame, starting from 1
  8070. @item Y, U, V, R, G, B
  8071. SSIM of the compared frames for the component specified by the suffix.
  8072. @item All
  8073. SSIM of the compared frames for the whole frame.
  8074. @item dB
  8075. Same as above but in dB representation.
  8076. @end table
  8077. For example:
  8078. @example
  8079. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8080. [main][ref] ssim="stats_file=stats.log" [out]
  8081. @end example
  8082. On this example the input file being processed is compared with the
  8083. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  8084. is stored in @file{stats.log}.
  8085. Another example with both psnr and ssim at same time:
  8086. @example
  8087. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  8088. @end example
  8089. @section stereo3d
  8090. Convert between different stereoscopic image formats.
  8091. The filters accept the following options:
  8092. @table @option
  8093. @item in
  8094. Set stereoscopic image format of input.
  8095. Available values for input image formats are:
  8096. @table @samp
  8097. @item sbsl
  8098. side by side parallel (left eye left, right eye right)
  8099. @item sbsr
  8100. side by side crosseye (right eye left, left eye right)
  8101. @item sbs2l
  8102. side by side parallel with half width resolution
  8103. (left eye left, right eye right)
  8104. @item sbs2r
  8105. side by side crosseye with half width resolution
  8106. (right eye left, left eye right)
  8107. @item abl
  8108. above-below (left eye above, right eye below)
  8109. @item abr
  8110. above-below (right eye above, left eye below)
  8111. @item ab2l
  8112. above-below with half height resolution
  8113. (left eye above, right eye below)
  8114. @item ab2r
  8115. above-below with half height resolution
  8116. (right eye above, left eye below)
  8117. @item al
  8118. alternating frames (left eye first, right eye second)
  8119. @item ar
  8120. alternating frames (right eye first, left eye second)
  8121. @item irl
  8122. interleaved rows (left eye has top row, right eye starts on next row)
  8123. @item irr
  8124. interleaved rows (right eye has top row, left eye starts on next row)
  8125. Default value is @samp{sbsl}.
  8126. @end table
  8127. @item out
  8128. Set stereoscopic image format of output.
  8129. Available values for output image formats are all the input formats as well as:
  8130. @table @samp
  8131. @item arbg
  8132. anaglyph red/blue gray
  8133. (red filter on left eye, blue filter on right eye)
  8134. @item argg
  8135. anaglyph red/green gray
  8136. (red filter on left eye, green filter on right eye)
  8137. @item arcg
  8138. anaglyph red/cyan gray
  8139. (red filter on left eye, cyan filter on right eye)
  8140. @item arch
  8141. anaglyph red/cyan half colored
  8142. (red filter on left eye, cyan filter on right eye)
  8143. @item arcc
  8144. anaglyph red/cyan color
  8145. (red filter on left eye, cyan filter on right eye)
  8146. @item arcd
  8147. anaglyph red/cyan color optimized with the least squares projection of dubois
  8148. (red filter on left eye, cyan filter on right eye)
  8149. @item agmg
  8150. anaglyph green/magenta gray
  8151. (green filter on left eye, magenta filter on right eye)
  8152. @item agmh
  8153. anaglyph green/magenta half colored
  8154. (green filter on left eye, magenta filter on right eye)
  8155. @item agmc
  8156. anaglyph green/magenta colored
  8157. (green filter on left eye, magenta filter on right eye)
  8158. @item agmd
  8159. anaglyph green/magenta color optimized with the least squares projection of dubois
  8160. (green filter on left eye, magenta filter on right eye)
  8161. @item aybg
  8162. anaglyph yellow/blue gray
  8163. (yellow filter on left eye, blue filter on right eye)
  8164. @item aybh
  8165. anaglyph yellow/blue half colored
  8166. (yellow filter on left eye, blue filter on right eye)
  8167. @item aybc
  8168. anaglyph yellow/blue colored
  8169. (yellow filter on left eye, blue filter on right eye)
  8170. @item aybd
  8171. anaglyph yellow/blue color optimized with the least squares projection of dubois
  8172. (yellow filter on left eye, blue filter on right eye)
  8173. @item ml
  8174. mono output (left eye only)
  8175. @item mr
  8176. mono output (right eye only)
  8177. @item chl
  8178. checkerboard, left eye first
  8179. @item chr
  8180. checkerboard, right eye first
  8181. @item icl
  8182. interleaved columns, left eye first
  8183. @item icr
  8184. interleaved columns, right eye first
  8185. @end table
  8186. Default value is @samp{arcd}.
  8187. @end table
  8188. @subsection Examples
  8189. @itemize
  8190. @item
  8191. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  8192. @example
  8193. stereo3d=sbsl:aybd
  8194. @end example
  8195. @item
  8196. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  8197. @example
  8198. stereo3d=abl:sbsr
  8199. @end example
  8200. @end itemize
  8201. @anchor{spp}
  8202. @section spp
  8203. Apply a simple postprocessing filter that compresses and decompresses the image
  8204. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  8205. and average the results.
  8206. The filter accepts the following options:
  8207. @table @option
  8208. @item quality
  8209. Set quality. This option defines the number of levels for averaging. It accepts
  8210. an integer in the range 0-6. If set to @code{0}, the filter will have no
  8211. effect. A value of @code{6} means the higher quality. For each increment of
  8212. that value the speed drops by a factor of approximately 2. Default value is
  8213. @code{3}.
  8214. @item qp
  8215. Force a constant quantization parameter. If not set, the filter will use the QP
  8216. from the video stream (if available).
  8217. @item mode
  8218. Set thresholding mode. Available modes are:
  8219. @table @samp
  8220. @item hard
  8221. Set hard thresholding (default).
  8222. @item soft
  8223. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8224. @end table
  8225. @item use_bframe_qp
  8226. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8227. option may cause flicker since the B-Frames have often larger QP. Default is
  8228. @code{0} (not enabled).
  8229. @end table
  8230. @anchor{subtitles}
  8231. @section subtitles
  8232. Draw subtitles on top of input video using the libass library.
  8233. To enable compilation of this filter you need to configure FFmpeg with
  8234. @code{--enable-libass}. This filter also requires a build with libavcodec and
  8235. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  8236. Alpha) subtitles format.
  8237. The filter accepts the following options:
  8238. @table @option
  8239. @item filename, f
  8240. Set the filename of the subtitle file to read. It must be specified.
  8241. @item original_size
  8242. Specify the size of the original video, the video for which the ASS file
  8243. was composed. For the syntax of this option, check the
  8244. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8245. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  8246. correctly scale the fonts if the aspect ratio has been changed.
  8247. @item fontsdir
  8248. Set a directory path containing fonts that can be used by the filter.
  8249. These fonts will be used in addition to whatever the font provider uses.
  8250. @item charenc
  8251. Set subtitles input character encoding. @code{subtitles} filter only. Only
  8252. useful if not UTF-8.
  8253. @item stream_index, si
  8254. Set subtitles stream index. @code{subtitles} filter only.
  8255. @item force_style
  8256. Override default style or script info parameters of the subtitles. It accepts a
  8257. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  8258. @end table
  8259. If the first key is not specified, it is assumed that the first value
  8260. specifies the @option{filename}.
  8261. For example, to render the file @file{sub.srt} on top of the input
  8262. video, use the command:
  8263. @example
  8264. subtitles=sub.srt
  8265. @end example
  8266. which is equivalent to:
  8267. @example
  8268. subtitles=filename=sub.srt
  8269. @end example
  8270. To render the default subtitles stream from file @file{video.mkv}, use:
  8271. @example
  8272. subtitles=video.mkv
  8273. @end example
  8274. To render the second subtitles stream from that file, use:
  8275. @example
  8276. subtitles=video.mkv:si=1
  8277. @end example
  8278. To make the subtitles stream from @file{sub.srt} appear in transparent green
  8279. @code{DejaVu Serif}, use:
  8280. @example
  8281. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  8282. @end example
  8283. @section super2xsai
  8284. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  8285. Interpolate) pixel art scaling algorithm.
  8286. Useful for enlarging pixel art images without reducing sharpness.
  8287. @section swapuv
  8288. Swap U & V plane.
  8289. @section telecine
  8290. Apply telecine process to the video.
  8291. This filter accepts the following options:
  8292. @table @option
  8293. @item first_field
  8294. @table @samp
  8295. @item top, t
  8296. top field first
  8297. @item bottom, b
  8298. bottom field first
  8299. The default value is @code{top}.
  8300. @end table
  8301. @item pattern
  8302. A string of numbers representing the pulldown pattern you wish to apply.
  8303. The default value is @code{23}.
  8304. @end table
  8305. @example
  8306. Some typical patterns:
  8307. NTSC output (30i):
  8308. 27.5p: 32222
  8309. 24p: 23 (classic)
  8310. 24p: 2332 (preferred)
  8311. 20p: 33
  8312. 18p: 334
  8313. 16p: 3444
  8314. PAL output (25i):
  8315. 27.5p: 12222
  8316. 24p: 222222222223 ("Euro pulldown")
  8317. 16.67p: 33
  8318. 16p: 33333334
  8319. @end example
  8320. @section thumbnail
  8321. Select the most representative frame in a given sequence of consecutive frames.
  8322. The filter accepts the following options:
  8323. @table @option
  8324. @item n
  8325. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  8326. will pick one of them, and then handle the next batch of @var{n} frames until
  8327. the end. Default is @code{100}.
  8328. @end table
  8329. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  8330. value will result in a higher memory usage, so a high value is not recommended.
  8331. @subsection Examples
  8332. @itemize
  8333. @item
  8334. Extract one picture each 50 frames:
  8335. @example
  8336. thumbnail=50
  8337. @end example
  8338. @item
  8339. Complete example of a thumbnail creation with @command{ffmpeg}:
  8340. @example
  8341. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  8342. @end example
  8343. @end itemize
  8344. @section tile
  8345. Tile several successive frames together.
  8346. The filter accepts the following options:
  8347. @table @option
  8348. @item layout
  8349. Set the grid size (i.e. the number of lines and columns). For the syntax of
  8350. this option, check the
  8351. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8352. @item nb_frames
  8353. Set the maximum number of frames to render in the given area. It must be less
  8354. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  8355. the area will be used.
  8356. @item margin
  8357. Set the outer border margin in pixels.
  8358. @item padding
  8359. Set the inner border thickness (i.e. the number of pixels between frames). For
  8360. more advanced padding options (such as having different values for the edges),
  8361. refer to the pad video filter.
  8362. @item color
  8363. Specify the color of the unused area. For the syntax of this option, check the
  8364. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  8365. is "black".
  8366. @end table
  8367. @subsection Examples
  8368. @itemize
  8369. @item
  8370. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  8371. @example
  8372. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  8373. @end example
  8374. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  8375. duplicating each output frame to accommodate the originally detected frame
  8376. rate.
  8377. @item
  8378. Display @code{5} pictures in an area of @code{3x2} frames,
  8379. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  8380. mixed flat and named options:
  8381. @example
  8382. tile=3x2:nb_frames=5:padding=7:margin=2
  8383. @end example
  8384. @end itemize
  8385. @section tinterlace
  8386. Perform various types of temporal field interlacing.
  8387. Frames are counted starting from 1, so the first input frame is
  8388. considered odd.
  8389. The filter accepts the following options:
  8390. @table @option
  8391. @item mode
  8392. Specify the mode of the interlacing. This option can also be specified
  8393. as a value alone. See below for a list of values for this option.
  8394. Available values are:
  8395. @table @samp
  8396. @item merge, 0
  8397. Move odd frames into the upper field, even into the lower field,
  8398. generating a double height frame at half frame rate.
  8399. @example
  8400. ------> time
  8401. Input:
  8402. Frame 1 Frame 2 Frame 3 Frame 4
  8403. 11111 22222 33333 44444
  8404. 11111 22222 33333 44444
  8405. 11111 22222 33333 44444
  8406. 11111 22222 33333 44444
  8407. Output:
  8408. 11111 33333
  8409. 22222 44444
  8410. 11111 33333
  8411. 22222 44444
  8412. 11111 33333
  8413. 22222 44444
  8414. 11111 33333
  8415. 22222 44444
  8416. @end example
  8417. @item drop_odd, 1
  8418. Only output even frames, odd frames are dropped, generating a frame with
  8419. unchanged height at half frame rate.
  8420. @example
  8421. ------> time
  8422. Input:
  8423. Frame 1 Frame 2 Frame 3 Frame 4
  8424. 11111 22222 33333 44444
  8425. 11111 22222 33333 44444
  8426. 11111 22222 33333 44444
  8427. 11111 22222 33333 44444
  8428. Output:
  8429. 22222 44444
  8430. 22222 44444
  8431. 22222 44444
  8432. 22222 44444
  8433. @end example
  8434. @item drop_even, 2
  8435. Only output odd frames, even frames are dropped, generating a frame with
  8436. unchanged height at half frame rate.
  8437. @example
  8438. ------> time
  8439. Input:
  8440. Frame 1 Frame 2 Frame 3 Frame 4
  8441. 11111 22222 33333 44444
  8442. 11111 22222 33333 44444
  8443. 11111 22222 33333 44444
  8444. 11111 22222 33333 44444
  8445. Output:
  8446. 11111 33333
  8447. 11111 33333
  8448. 11111 33333
  8449. 11111 33333
  8450. @end example
  8451. @item pad, 3
  8452. Expand each frame to full height, but pad alternate lines with black,
  8453. generating a frame with double height at the same input frame rate.
  8454. @example
  8455. ------> time
  8456. Input:
  8457. Frame 1 Frame 2 Frame 3 Frame 4
  8458. 11111 22222 33333 44444
  8459. 11111 22222 33333 44444
  8460. 11111 22222 33333 44444
  8461. 11111 22222 33333 44444
  8462. Output:
  8463. 11111 ..... 33333 .....
  8464. ..... 22222 ..... 44444
  8465. 11111 ..... 33333 .....
  8466. ..... 22222 ..... 44444
  8467. 11111 ..... 33333 .....
  8468. ..... 22222 ..... 44444
  8469. 11111 ..... 33333 .....
  8470. ..... 22222 ..... 44444
  8471. @end example
  8472. @item interleave_top, 4
  8473. Interleave the upper field from odd frames with the lower field from
  8474. even frames, generating a frame with unchanged height at half frame rate.
  8475. @example
  8476. ------> time
  8477. Input:
  8478. Frame 1 Frame 2 Frame 3 Frame 4
  8479. 11111<- 22222 33333<- 44444
  8480. 11111 22222<- 33333 44444<-
  8481. 11111<- 22222 33333<- 44444
  8482. 11111 22222<- 33333 44444<-
  8483. Output:
  8484. 11111 33333
  8485. 22222 44444
  8486. 11111 33333
  8487. 22222 44444
  8488. @end example
  8489. @item interleave_bottom, 5
  8490. Interleave the lower field from odd frames with the upper field from
  8491. even frames, generating a frame with unchanged height at half frame rate.
  8492. @example
  8493. ------> time
  8494. Input:
  8495. Frame 1 Frame 2 Frame 3 Frame 4
  8496. 11111 22222<- 33333 44444<-
  8497. 11111<- 22222 33333<- 44444
  8498. 11111 22222<- 33333 44444<-
  8499. 11111<- 22222 33333<- 44444
  8500. Output:
  8501. 22222 44444
  8502. 11111 33333
  8503. 22222 44444
  8504. 11111 33333
  8505. @end example
  8506. @item interlacex2, 6
  8507. Double frame rate with unchanged height. Frames are inserted each
  8508. containing the second temporal field from the previous input frame and
  8509. the first temporal field from the next input frame. This mode relies on
  8510. the top_field_first flag. Useful for interlaced video displays with no
  8511. field synchronisation.
  8512. @example
  8513. ------> time
  8514. Input:
  8515. Frame 1 Frame 2 Frame 3 Frame 4
  8516. 11111 22222 33333 44444
  8517. 11111 22222 33333 44444
  8518. 11111 22222 33333 44444
  8519. 11111 22222 33333 44444
  8520. Output:
  8521. 11111 22222 22222 33333 33333 44444 44444
  8522. 11111 11111 22222 22222 33333 33333 44444
  8523. 11111 22222 22222 33333 33333 44444 44444
  8524. 11111 11111 22222 22222 33333 33333 44444
  8525. @end example
  8526. @item mergex2, 7
  8527. Move odd frames into the upper field, even into the lower field,
  8528. generating a double height frame at same frame rate.
  8529. @example
  8530. ------> time
  8531. Input:
  8532. Frame 1 Frame 2 Frame 3 Frame 4
  8533. 11111 22222 33333 44444
  8534. 11111 22222 33333 44444
  8535. 11111 22222 33333 44444
  8536. 11111 22222 33333 44444
  8537. Output:
  8538. 11111 33333 33333 55555
  8539. 22222 22222 44444 44444
  8540. 11111 33333 33333 55555
  8541. 22222 22222 44444 44444
  8542. 11111 33333 33333 55555
  8543. 22222 22222 44444 44444
  8544. 11111 33333 33333 55555
  8545. 22222 22222 44444 44444
  8546. @end example
  8547. @end table
  8548. Numeric values are deprecated but are accepted for backward
  8549. compatibility reasons.
  8550. Default mode is @code{merge}.
  8551. @item flags
  8552. Specify flags influencing the filter process.
  8553. Available value for @var{flags} is:
  8554. @table @option
  8555. @item low_pass_filter, vlfp
  8556. Enable vertical low-pass filtering in the filter.
  8557. Vertical low-pass filtering is required when creating an interlaced
  8558. destination from a progressive source which contains high-frequency
  8559. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  8560. patterning.
  8561. Vertical low-pass filtering can only be enabled for @option{mode}
  8562. @var{interleave_top} and @var{interleave_bottom}.
  8563. @end table
  8564. @end table
  8565. @section transpose
  8566. Transpose rows with columns in the input video and optionally flip it.
  8567. It accepts the following parameters:
  8568. @table @option
  8569. @item dir
  8570. Specify the transposition direction.
  8571. Can assume the following values:
  8572. @table @samp
  8573. @item 0, 4, cclock_flip
  8574. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  8575. @example
  8576. L.R L.l
  8577. . . -> . .
  8578. l.r R.r
  8579. @end example
  8580. @item 1, 5, clock
  8581. Rotate by 90 degrees clockwise, that is:
  8582. @example
  8583. L.R l.L
  8584. . . -> . .
  8585. l.r r.R
  8586. @end example
  8587. @item 2, 6, cclock
  8588. Rotate by 90 degrees counterclockwise, that is:
  8589. @example
  8590. L.R R.r
  8591. . . -> . .
  8592. l.r L.l
  8593. @end example
  8594. @item 3, 7, clock_flip
  8595. Rotate by 90 degrees clockwise and vertically flip, that is:
  8596. @example
  8597. L.R r.R
  8598. . . -> . .
  8599. l.r l.L
  8600. @end example
  8601. @end table
  8602. For values between 4-7, the transposition is only done if the input
  8603. video geometry is portrait and not landscape. These values are
  8604. deprecated, the @code{passthrough} option should be used instead.
  8605. Numerical values are deprecated, and should be dropped in favor of
  8606. symbolic constants.
  8607. @item passthrough
  8608. Do not apply the transposition if the input geometry matches the one
  8609. specified by the specified value. It accepts the following values:
  8610. @table @samp
  8611. @item none
  8612. Always apply transposition.
  8613. @item portrait
  8614. Preserve portrait geometry (when @var{height} >= @var{width}).
  8615. @item landscape
  8616. Preserve landscape geometry (when @var{width} >= @var{height}).
  8617. @end table
  8618. Default value is @code{none}.
  8619. @end table
  8620. For example to rotate by 90 degrees clockwise and preserve portrait
  8621. layout:
  8622. @example
  8623. transpose=dir=1:passthrough=portrait
  8624. @end example
  8625. The command above can also be specified as:
  8626. @example
  8627. transpose=1:portrait
  8628. @end example
  8629. @section trim
  8630. Trim the input so that the output contains one continuous subpart of the input.
  8631. It accepts the following parameters:
  8632. @table @option
  8633. @item start
  8634. Specify the time of the start of the kept section, i.e. the frame with the
  8635. timestamp @var{start} will be the first frame in the output.
  8636. @item end
  8637. Specify the time of the first frame that will be dropped, i.e. the frame
  8638. immediately preceding the one with the timestamp @var{end} will be the last
  8639. frame in the output.
  8640. @item start_pts
  8641. This is the same as @var{start}, except this option sets the start timestamp
  8642. in timebase units instead of seconds.
  8643. @item end_pts
  8644. This is the same as @var{end}, except this option sets the end timestamp
  8645. in timebase units instead of seconds.
  8646. @item duration
  8647. The maximum duration of the output in seconds.
  8648. @item start_frame
  8649. The number of the first frame that should be passed to the output.
  8650. @item end_frame
  8651. The number of the first frame that should be dropped.
  8652. @end table
  8653. @option{start}, @option{end}, and @option{duration} are expressed as time
  8654. duration specifications; see
  8655. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  8656. for the accepted syntax.
  8657. Note that the first two sets of the start/end options and the @option{duration}
  8658. option look at the frame timestamp, while the _frame variants simply count the
  8659. frames that pass through the filter. Also note that this filter does not modify
  8660. the timestamps. If you wish for the output timestamps to start at zero, insert a
  8661. setpts filter after the trim filter.
  8662. If multiple start or end options are set, this filter tries to be greedy and
  8663. keep all the frames that match at least one of the specified constraints. To keep
  8664. only the part that matches all the constraints at once, chain multiple trim
  8665. filters.
  8666. The defaults are such that all the input is kept. So it is possible to set e.g.
  8667. just the end values to keep everything before the specified time.
  8668. Examples:
  8669. @itemize
  8670. @item
  8671. Drop everything except the second minute of input:
  8672. @example
  8673. ffmpeg -i INPUT -vf trim=60:120
  8674. @end example
  8675. @item
  8676. Keep only the first second:
  8677. @example
  8678. ffmpeg -i INPUT -vf trim=duration=1
  8679. @end example
  8680. @end itemize
  8681. @anchor{unsharp}
  8682. @section unsharp
  8683. Sharpen or blur the input video.
  8684. It accepts the following parameters:
  8685. @table @option
  8686. @item luma_msize_x, lx
  8687. Set the luma matrix horizontal size. It must be an odd integer between
  8688. 3 and 63. The default value is 5.
  8689. @item luma_msize_y, ly
  8690. Set the luma matrix vertical size. It must be an odd integer between 3
  8691. and 63. The default value is 5.
  8692. @item luma_amount, la
  8693. Set the luma effect strength. It must be a floating point number, reasonable
  8694. values lay between -1.5 and 1.5.
  8695. Negative values will blur the input video, while positive values will
  8696. sharpen it, a value of zero will disable the effect.
  8697. Default value is 1.0.
  8698. @item chroma_msize_x, cx
  8699. Set the chroma matrix horizontal size. It must be an odd integer
  8700. between 3 and 63. The default value is 5.
  8701. @item chroma_msize_y, cy
  8702. Set the chroma matrix vertical size. It must be an odd integer
  8703. between 3 and 63. The default value is 5.
  8704. @item chroma_amount, ca
  8705. Set the chroma effect strength. It must be a floating point number, reasonable
  8706. values lay between -1.5 and 1.5.
  8707. Negative values will blur the input video, while positive values will
  8708. sharpen it, a value of zero will disable the effect.
  8709. Default value is 0.0.
  8710. @item opencl
  8711. If set to 1, specify using OpenCL capabilities, only available if
  8712. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  8713. @end table
  8714. All parameters are optional and default to the equivalent of the
  8715. string '5:5:1.0:5:5:0.0'.
  8716. @subsection Examples
  8717. @itemize
  8718. @item
  8719. Apply strong luma sharpen effect:
  8720. @example
  8721. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  8722. @end example
  8723. @item
  8724. Apply a strong blur of both luma and chroma parameters:
  8725. @example
  8726. unsharp=7:7:-2:7:7:-2
  8727. @end example
  8728. @end itemize
  8729. @section uspp
  8730. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  8731. the image at several (or - in the case of @option{quality} level @code{8} - all)
  8732. shifts and average the results.
  8733. The way this differs from the behavior of spp is that uspp actually encodes &
  8734. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  8735. DCT similar to MJPEG.
  8736. The filter accepts the following options:
  8737. @table @option
  8738. @item quality
  8739. Set quality. This option defines the number of levels for averaging. It accepts
  8740. an integer in the range 0-8. If set to @code{0}, the filter will have no
  8741. effect. A value of @code{8} means the higher quality. For each increment of
  8742. that value the speed drops by a factor of approximately 2. Default value is
  8743. @code{3}.
  8744. @item qp
  8745. Force a constant quantization parameter. If not set, the filter will use the QP
  8746. from the video stream (if available).
  8747. @end table
  8748. @section vectorscope
  8749. Display 2 color component values in the two dimensional graph (which is called
  8750. a vectorscope).
  8751. This filter accepts the following options:
  8752. @table @option
  8753. @item mode, m
  8754. Set vectorscope mode.
  8755. It accepts the following values:
  8756. @table @samp
  8757. @item gray
  8758. Gray values are displayed on graph, higher brightness means more pixels have
  8759. same component color value on location in graph. This is the default mode.
  8760. @item color
  8761. Gray values are displayed on graph. Surrounding pixels values which are not
  8762. present in video frame are drawn in gradient of 2 color components which are
  8763. set by option @code{x} and @code{y}.
  8764. @item color2
  8765. Actual color components values present in video frame are displayed on graph.
  8766. @item color3
  8767. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  8768. on graph increases value of another color component, which is luminance by
  8769. default values of @code{x} and @code{y}.
  8770. @item color4
  8771. Actual colors present in video frame are displayed on graph. If two different
  8772. colors map to same position on graph then color with higher value of component
  8773. not present in graph is picked.
  8774. @end table
  8775. @item x
  8776. Set which color component will be represented on X-axis. Default is @code{1}.
  8777. @item y
  8778. Set which color component will be represented on Y-axis. Default is @code{2}.
  8779. @item intensity, i
  8780. Set intensity, used by modes: gray, color and color3 for increasing brightness
  8781. of color component which represents frequency of (X, Y) location in graph.
  8782. @item envelope, e
  8783. @table @samp
  8784. @item none
  8785. No envelope, this is default.
  8786. @item instant
  8787. Instant envelope, even darkest single pixel will be clearly highlighted.
  8788. @item peak
  8789. Hold maximum and minimum values presented in graph over time. This way you
  8790. can still spot out of range values without constantly looking at vectorscope.
  8791. @item peak+instant
  8792. Peak and instant envelope combined together.
  8793. @end table
  8794. @end table
  8795. @anchor{vidstabdetect}
  8796. @section vidstabdetect
  8797. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  8798. @ref{vidstabtransform} for pass 2.
  8799. This filter generates a file with relative translation and rotation
  8800. transform information about subsequent frames, which is then used by
  8801. the @ref{vidstabtransform} filter.
  8802. To enable compilation of this filter you need to configure FFmpeg with
  8803. @code{--enable-libvidstab}.
  8804. This filter accepts the following options:
  8805. @table @option
  8806. @item result
  8807. Set the path to the file used to write the transforms information.
  8808. Default value is @file{transforms.trf}.
  8809. @item shakiness
  8810. Set how shaky the video is and how quick the camera is. It accepts an
  8811. integer in the range 1-10, a value of 1 means little shakiness, a
  8812. value of 10 means strong shakiness. Default value is 5.
  8813. @item accuracy
  8814. Set the accuracy of the detection process. It must be a value in the
  8815. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  8816. accuracy. Default value is 15.
  8817. @item stepsize
  8818. Set stepsize of the search process. The region around minimum is
  8819. scanned with 1 pixel resolution. Default value is 6.
  8820. @item mincontrast
  8821. Set minimum contrast. Below this value a local measurement field is
  8822. discarded. Must be a floating point value in the range 0-1. Default
  8823. value is 0.3.
  8824. @item tripod
  8825. Set reference frame number for tripod mode.
  8826. If enabled, the motion of the frames is compared to a reference frame
  8827. in the filtered stream, identified by the specified number. The idea
  8828. is to compensate all movements in a more-or-less static scene and keep
  8829. the camera view absolutely still.
  8830. If set to 0, it is disabled. The frames are counted starting from 1.
  8831. @item show
  8832. Show fields and transforms in the resulting frames. It accepts an
  8833. integer in the range 0-2. Default value is 0, which disables any
  8834. visualization.
  8835. @end table
  8836. @subsection Examples
  8837. @itemize
  8838. @item
  8839. Use default values:
  8840. @example
  8841. vidstabdetect
  8842. @end example
  8843. @item
  8844. Analyze strongly shaky movie and put the results in file
  8845. @file{mytransforms.trf}:
  8846. @example
  8847. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  8848. @end example
  8849. @item
  8850. Visualize the result of internal transformations in the resulting
  8851. video:
  8852. @example
  8853. vidstabdetect=show=1
  8854. @end example
  8855. @item
  8856. Analyze a video with medium shakiness using @command{ffmpeg}:
  8857. @example
  8858. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  8859. @end example
  8860. @end itemize
  8861. @anchor{vidstabtransform}
  8862. @section vidstabtransform
  8863. Video stabilization/deshaking: pass 2 of 2,
  8864. see @ref{vidstabdetect} for pass 1.
  8865. Read a file with transform information for each frame and
  8866. apply/compensate them. Together with the @ref{vidstabdetect}
  8867. filter this can be used to deshake videos. See also
  8868. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  8869. the @ref{unsharp} filter, see below.
  8870. To enable compilation of this filter you need to configure FFmpeg with
  8871. @code{--enable-libvidstab}.
  8872. @subsection Options
  8873. @table @option
  8874. @item input
  8875. Set path to the file used to read the transforms. Default value is
  8876. @file{transforms.trf}.
  8877. @item smoothing
  8878. Set the number of frames (value*2 + 1) used for lowpass filtering the
  8879. camera movements. Default value is 10.
  8880. For example a number of 10 means that 21 frames are used (10 in the
  8881. past and 10 in the future) to smoothen the motion in the video. A
  8882. larger value leads to a smoother video, but limits the acceleration of
  8883. the camera (pan/tilt movements). 0 is a special case where a static
  8884. camera is simulated.
  8885. @item optalgo
  8886. Set the camera path optimization algorithm.
  8887. Accepted values are:
  8888. @table @samp
  8889. @item gauss
  8890. gaussian kernel low-pass filter on camera motion (default)
  8891. @item avg
  8892. averaging on transformations
  8893. @end table
  8894. @item maxshift
  8895. Set maximal number of pixels to translate frames. Default value is -1,
  8896. meaning no limit.
  8897. @item maxangle
  8898. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  8899. value is -1, meaning no limit.
  8900. @item crop
  8901. Specify how to deal with borders that may be visible due to movement
  8902. compensation.
  8903. Available values are:
  8904. @table @samp
  8905. @item keep
  8906. keep image information from previous frame (default)
  8907. @item black
  8908. fill the border black
  8909. @end table
  8910. @item invert
  8911. Invert transforms if set to 1. Default value is 0.
  8912. @item relative
  8913. Consider transforms as relative to previous frame if set to 1,
  8914. absolute if set to 0. Default value is 0.
  8915. @item zoom
  8916. Set percentage to zoom. A positive value will result in a zoom-in
  8917. effect, a negative value in a zoom-out effect. Default value is 0 (no
  8918. zoom).
  8919. @item optzoom
  8920. Set optimal zooming to avoid borders.
  8921. Accepted values are:
  8922. @table @samp
  8923. @item 0
  8924. disabled
  8925. @item 1
  8926. optimal static zoom value is determined (only very strong movements
  8927. will lead to visible borders) (default)
  8928. @item 2
  8929. optimal adaptive zoom value is determined (no borders will be
  8930. visible), see @option{zoomspeed}
  8931. @end table
  8932. Note that the value given at zoom is added to the one calculated here.
  8933. @item zoomspeed
  8934. Set percent to zoom maximally each frame (enabled when
  8935. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  8936. 0.25.
  8937. @item interpol
  8938. Specify type of interpolation.
  8939. Available values are:
  8940. @table @samp
  8941. @item no
  8942. no interpolation
  8943. @item linear
  8944. linear only horizontal
  8945. @item bilinear
  8946. linear in both directions (default)
  8947. @item bicubic
  8948. cubic in both directions (slow)
  8949. @end table
  8950. @item tripod
  8951. Enable virtual tripod mode if set to 1, which is equivalent to
  8952. @code{relative=0:smoothing=0}. Default value is 0.
  8953. Use also @code{tripod} option of @ref{vidstabdetect}.
  8954. @item debug
  8955. Increase log verbosity if set to 1. Also the detected global motions
  8956. are written to the temporary file @file{global_motions.trf}. Default
  8957. value is 0.
  8958. @end table
  8959. @subsection Examples
  8960. @itemize
  8961. @item
  8962. Use @command{ffmpeg} for a typical stabilization with default values:
  8963. @example
  8964. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  8965. @end example
  8966. Note the use of the @ref{unsharp} filter which is always recommended.
  8967. @item
  8968. Zoom in a bit more and load transform data from a given file:
  8969. @example
  8970. vidstabtransform=zoom=5:input="mytransforms.trf"
  8971. @end example
  8972. @item
  8973. Smoothen the video even more:
  8974. @example
  8975. vidstabtransform=smoothing=30
  8976. @end example
  8977. @end itemize
  8978. @section vflip
  8979. Flip the input video vertically.
  8980. For example, to vertically flip a video with @command{ffmpeg}:
  8981. @example
  8982. ffmpeg -i in.avi -vf "vflip" out.avi
  8983. @end example
  8984. @anchor{vignette}
  8985. @section vignette
  8986. Make or reverse a natural vignetting effect.
  8987. The filter accepts the following options:
  8988. @table @option
  8989. @item angle, a
  8990. Set lens angle expression as a number of radians.
  8991. The value is clipped in the @code{[0,PI/2]} range.
  8992. Default value: @code{"PI/5"}
  8993. @item x0
  8994. @item y0
  8995. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  8996. by default.
  8997. @item mode
  8998. Set forward/backward mode.
  8999. Available modes are:
  9000. @table @samp
  9001. @item forward
  9002. The larger the distance from the central point, the darker the image becomes.
  9003. @item backward
  9004. The larger the distance from the central point, the brighter the image becomes.
  9005. This can be used to reverse a vignette effect, though there is no automatic
  9006. detection to extract the lens @option{angle} and other settings (yet). It can
  9007. also be used to create a burning effect.
  9008. @end table
  9009. Default value is @samp{forward}.
  9010. @item eval
  9011. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  9012. It accepts the following values:
  9013. @table @samp
  9014. @item init
  9015. Evaluate expressions only once during the filter initialization.
  9016. @item frame
  9017. Evaluate expressions for each incoming frame. This is way slower than the
  9018. @samp{init} mode since it requires all the scalers to be re-computed, but it
  9019. allows advanced dynamic expressions.
  9020. @end table
  9021. Default value is @samp{init}.
  9022. @item dither
  9023. Set dithering to reduce the circular banding effects. Default is @code{1}
  9024. (enabled).
  9025. @item aspect
  9026. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  9027. Setting this value to the SAR of the input will make a rectangular vignetting
  9028. following the dimensions of the video.
  9029. Default is @code{1/1}.
  9030. @end table
  9031. @subsection Expressions
  9032. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  9033. following parameters.
  9034. @table @option
  9035. @item w
  9036. @item h
  9037. input width and height
  9038. @item n
  9039. the number of input frame, starting from 0
  9040. @item pts
  9041. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  9042. @var{TB} units, NAN if undefined
  9043. @item r
  9044. frame rate of the input video, NAN if the input frame rate is unknown
  9045. @item t
  9046. the PTS (Presentation TimeStamp) of the filtered video frame,
  9047. expressed in seconds, NAN if undefined
  9048. @item tb
  9049. time base of the input video
  9050. @end table
  9051. @subsection Examples
  9052. @itemize
  9053. @item
  9054. Apply simple strong vignetting effect:
  9055. @example
  9056. vignette=PI/4
  9057. @end example
  9058. @item
  9059. Make a flickering vignetting:
  9060. @example
  9061. vignette='PI/4+random(1)*PI/50':eval=frame
  9062. @end example
  9063. @end itemize
  9064. @section vstack
  9065. Stack input videos vertically.
  9066. All streams must be of same pixel format and of same width.
  9067. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9068. to create same output.
  9069. The filter accept the following option:
  9070. @table @option
  9071. @item inputs
  9072. Set number of input streams. Default is 2.
  9073. @item shortest
  9074. If set to 1, force the output to terminate when the shortest input
  9075. terminates. Default value is 0.
  9076. @end table
  9077. @section w3fdif
  9078. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  9079. Deinterlacing Filter").
  9080. Based on the process described by Martin Weston for BBC R&D, and
  9081. implemented based on the de-interlace algorithm written by Jim
  9082. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  9083. uses filter coefficients calculated by BBC R&D.
  9084. There are two sets of filter coefficients, so called "simple":
  9085. and "complex". Which set of filter coefficients is used can
  9086. be set by passing an optional parameter:
  9087. @table @option
  9088. @item filter
  9089. Set the interlacing filter coefficients. Accepts one of the following values:
  9090. @table @samp
  9091. @item simple
  9092. Simple filter coefficient set.
  9093. @item complex
  9094. More-complex filter coefficient set.
  9095. @end table
  9096. Default value is @samp{complex}.
  9097. @item deint
  9098. Specify which frames to deinterlace. Accept one of the following values:
  9099. @table @samp
  9100. @item all
  9101. Deinterlace all frames,
  9102. @item interlaced
  9103. Only deinterlace frames marked as interlaced.
  9104. @end table
  9105. Default value is @samp{all}.
  9106. @end table
  9107. @section waveform
  9108. Video waveform monitor.
  9109. The waveform monitor plots color component intensity. By default luminance
  9110. only. Each column of the waveform corresponds to a column of pixels in the
  9111. source video.
  9112. It accepts the following options:
  9113. @table @option
  9114. @item mode, m
  9115. Can be either @code{row}, or @code{column}. Default is @code{column}.
  9116. In row mode, the graph on the left side represents color component value 0 and
  9117. the right side represents value = 255. In column mode, the top side represents
  9118. color component value = 0 and bottom side represents value = 255.
  9119. @item intensity, i
  9120. Set intensity. Smaller values are useful to find out how many values of the same
  9121. luminance are distributed across input rows/columns.
  9122. Default value is @code{0.04}. Allowed range is [0, 1].
  9123. @item mirror, r
  9124. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  9125. In mirrored mode, higher values will be represented on the left
  9126. side for @code{row} mode and at the top for @code{column} mode. Default is
  9127. @code{1} (mirrored).
  9128. @item display, d
  9129. Set display mode.
  9130. It accepts the following values:
  9131. @table @samp
  9132. @item overlay
  9133. Presents information identical to that in the @code{parade}, except
  9134. that the graphs representing color components are superimposed directly
  9135. over one another.
  9136. This display mode makes it easier to spot relative differences or similarities
  9137. in overlapping areas of the color components that are supposed to be identical,
  9138. such as neutral whites, grays, or blacks.
  9139. @item parade
  9140. Display separate graph for the color components side by side in
  9141. @code{row} mode or one below the other in @code{column} mode.
  9142. Using this display mode makes it easy to spot color casts in the highlights
  9143. and shadows of an image, by comparing the contours of the top and the bottom
  9144. graphs of each waveform. Since whites, grays, and blacks are characterized
  9145. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  9146. should display three waveforms of roughly equal width/height. If not, the
  9147. correction is easy to perform by making level adjustments the three waveforms.
  9148. @end table
  9149. Default is @code{parade}.
  9150. @item components, c
  9151. Set which color components to display. Default is 1, which means only luminance
  9152. or red color component if input is in RGB colorspace. If is set for example to
  9153. 7 it will display all 3 (if) available color components.
  9154. @item envelope, e
  9155. @table @samp
  9156. @item none
  9157. No envelope, this is default.
  9158. @item instant
  9159. Instant envelope, minimum and maximum values presented in graph will be easily
  9160. visible even with small @code{step} value.
  9161. @item peak
  9162. Hold minimum and maximum values presented in graph across time. This way you
  9163. can still spot out of range values without constantly looking at waveforms.
  9164. @item peak+instant
  9165. Peak and instant envelope combined together.
  9166. @end table
  9167. @item filter, f
  9168. @table @samp
  9169. @item lowpass
  9170. No filtering, this is default.
  9171. @item flat
  9172. Luma and chroma combined together.
  9173. @item aflat
  9174. Similar as above, but shows difference between blue and red chroma.
  9175. @item chroma
  9176. Displays only chroma.
  9177. @item achroma
  9178. Similar as above, but shows difference between blue and red chroma.
  9179. @item color
  9180. Displays actual color value on waveform.
  9181. @end table
  9182. @end table
  9183. @section xbr
  9184. Apply the xBR high-quality magnification filter which is designed for pixel
  9185. art. It follows a set of edge-detection rules, see
  9186. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  9187. It accepts the following option:
  9188. @table @option
  9189. @item n
  9190. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  9191. @code{3xBR} and @code{4} for @code{4xBR}.
  9192. Default is @code{3}.
  9193. @end table
  9194. @anchor{yadif}
  9195. @section yadif
  9196. Deinterlace the input video ("yadif" means "yet another deinterlacing
  9197. filter").
  9198. It accepts the following parameters:
  9199. @table @option
  9200. @item mode
  9201. The interlacing mode to adopt. It accepts one of the following values:
  9202. @table @option
  9203. @item 0, send_frame
  9204. Output one frame for each frame.
  9205. @item 1, send_field
  9206. Output one frame for each field.
  9207. @item 2, send_frame_nospatial
  9208. Like @code{send_frame}, but it skips the spatial interlacing check.
  9209. @item 3, send_field_nospatial
  9210. Like @code{send_field}, but it skips the spatial interlacing check.
  9211. @end table
  9212. The default value is @code{send_frame}.
  9213. @item parity
  9214. The picture field parity assumed for the input interlaced video. It accepts one
  9215. of the following values:
  9216. @table @option
  9217. @item 0, tff
  9218. Assume the top field is first.
  9219. @item 1, bff
  9220. Assume the bottom field is first.
  9221. @item -1, auto
  9222. Enable automatic detection of field parity.
  9223. @end table
  9224. The default value is @code{auto}.
  9225. If the interlacing is unknown or the decoder does not export this information,
  9226. top field first will be assumed.
  9227. @item deint
  9228. Specify which frames to deinterlace. Accept one of the following
  9229. values:
  9230. @table @option
  9231. @item 0, all
  9232. Deinterlace all frames.
  9233. @item 1, interlaced
  9234. Only deinterlace frames marked as interlaced.
  9235. @end table
  9236. The default value is @code{all}.
  9237. @end table
  9238. @section zoompan
  9239. Apply Zoom & Pan effect.
  9240. This filter accepts the following options:
  9241. @table @option
  9242. @item zoom, z
  9243. Set the zoom expression. Default is 1.
  9244. @item x
  9245. @item y
  9246. Set the x and y expression. Default is 0.
  9247. @item d
  9248. Set the duration expression in number of frames.
  9249. This sets for how many number of frames effect will last for
  9250. single input image.
  9251. @item s
  9252. Set the output image size, default is 'hd720'.
  9253. @end table
  9254. Each expression can contain the following constants:
  9255. @table @option
  9256. @item in_w, iw
  9257. Input width.
  9258. @item in_h, ih
  9259. Input height.
  9260. @item out_w, ow
  9261. Output width.
  9262. @item out_h, oh
  9263. Output height.
  9264. @item in
  9265. Input frame count.
  9266. @item on
  9267. Output frame count.
  9268. @item x
  9269. @item y
  9270. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  9271. for current input frame.
  9272. @item px
  9273. @item py
  9274. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  9275. not yet such frame (first input frame).
  9276. @item zoom
  9277. Last calculated zoom from 'z' expression for current input frame.
  9278. @item pzoom
  9279. Last calculated zoom of last output frame of previous input frame.
  9280. @item duration
  9281. Number of output frames for current input frame. Calculated from 'd' expression
  9282. for each input frame.
  9283. @item pduration
  9284. number of output frames created for previous input frame
  9285. @item a
  9286. Rational number: input width / input height
  9287. @item sar
  9288. sample aspect ratio
  9289. @item dar
  9290. display aspect ratio
  9291. @end table
  9292. @subsection Examples
  9293. @itemize
  9294. @item
  9295. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  9296. @example
  9297. 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
  9298. @end example
  9299. @item
  9300. Zoom-in up to 1.5 and pan always at center of picture:
  9301. @example
  9302. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  9303. @end example
  9304. @end itemize
  9305. @section zscale
  9306. Scale (resize) the input video, using the z.lib library:
  9307. https://github.com/sekrit-twc/zimg.
  9308. The zscale filter forces the output display aspect ratio to be the same
  9309. as the input, by changing the output sample aspect ratio.
  9310. If the input image format is different from the format requested by
  9311. the next filter, the zscale filter will convert the input to the
  9312. requested format.
  9313. @subsection Options
  9314. The filter accepts the following options.
  9315. @table @option
  9316. @item width, w
  9317. @item height, h
  9318. Set the output video dimension expression. Default value is the input
  9319. dimension.
  9320. If the @var{width} or @var{w} is 0, the input width is used for the output.
  9321. If the @var{height} or @var{h} is 0, the input height is used for the output.
  9322. If one of the values is -1, the zscale filter will use a value that
  9323. maintains the aspect ratio of the input image, calculated from the
  9324. other specified dimension. If both of them are -1, the input size is
  9325. used
  9326. If one of the values is -n with n > 1, the zscale filter will also use a value
  9327. that maintains the aspect ratio of the input image, calculated from the other
  9328. specified dimension. After that it will, however, make sure that the calculated
  9329. dimension is divisible by n and adjust the value if necessary.
  9330. See below for the list of accepted constants for use in the dimension
  9331. expression.
  9332. @item size, s
  9333. Set the video size. For the syntax of this option, check the
  9334. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9335. @item dither, d
  9336. Set the dither type.
  9337. Possible values are:
  9338. @table @var
  9339. @item none
  9340. @item ordered
  9341. @item random
  9342. @item error_diffusion
  9343. @end table
  9344. Default is none.
  9345. @item filter, f
  9346. Set the resize filter type.
  9347. Possible values are:
  9348. @table @var
  9349. @item point
  9350. @item bilinear
  9351. @item bicubic
  9352. @item spline16
  9353. @item spline36
  9354. @item lanczos
  9355. @end table
  9356. Default is bilinear.
  9357. @item range, r
  9358. Set the color range.
  9359. Possible values are:
  9360. @table @var
  9361. @item input
  9362. @item limited
  9363. @item full
  9364. @end table
  9365. Default is same as input.
  9366. @item primaries, p
  9367. Set the color primaries.
  9368. Possible values are:
  9369. @table @var
  9370. @item input
  9371. @item 709
  9372. @item unspecified
  9373. @item 170m
  9374. @item 240m
  9375. @item 2020
  9376. @end table
  9377. Default is same as input.
  9378. @item transfer, t
  9379. Set the transfer characteristics.
  9380. Possible values are:
  9381. @table @var
  9382. @item input
  9383. @item 709
  9384. @item unspecified
  9385. @item 601
  9386. @item linear
  9387. @item 2020_10
  9388. @item 2020_12
  9389. @end table
  9390. Default is same as input.
  9391. @item matrix, m
  9392. Set the colorspace matrix.
  9393. Possible value are:
  9394. @table @var
  9395. @item input
  9396. @item 709
  9397. @item unspecified
  9398. @item 470bg
  9399. @item 170m
  9400. @item 2020_ncl
  9401. @item 2020_cl
  9402. @end table
  9403. Default is same as input.
  9404. @end table
  9405. The values of the @option{w} and @option{h} options are expressions
  9406. containing the following constants:
  9407. @table @var
  9408. @item in_w
  9409. @item in_h
  9410. The input width and height
  9411. @item iw
  9412. @item ih
  9413. These are the same as @var{in_w} and @var{in_h}.
  9414. @item out_w
  9415. @item out_h
  9416. The output (scaled) width and height
  9417. @item ow
  9418. @item oh
  9419. These are the same as @var{out_w} and @var{out_h}
  9420. @item a
  9421. The same as @var{iw} / @var{ih}
  9422. @item sar
  9423. input sample aspect ratio
  9424. @item dar
  9425. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9426. @item hsub
  9427. @item vsub
  9428. horizontal and vertical input chroma subsample values. For example for the
  9429. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9430. @item ohsub
  9431. @item ovsub
  9432. horizontal and vertical output chroma subsample values. For example for the
  9433. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9434. @end table
  9435. @table @option
  9436. @end table
  9437. @c man end VIDEO FILTERS
  9438. @chapter Video Sources
  9439. @c man begin VIDEO SOURCES
  9440. Below is a description of the currently available video sources.
  9441. @section buffer
  9442. Buffer video frames, and make them available to the filter chain.
  9443. This source is mainly intended for a programmatic use, in particular
  9444. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  9445. It accepts the following parameters:
  9446. @table @option
  9447. @item video_size
  9448. Specify the size (width and height) of the buffered video frames. For the
  9449. syntax of this option, check the
  9450. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9451. @item width
  9452. The input video width.
  9453. @item height
  9454. The input video height.
  9455. @item pix_fmt
  9456. A string representing the pixel format of the buffered video frames.
  9457. It may be a number corresponding to a pixel format, or a pixel format
  9458. name.
  9459. @item time_base
  9460. Specify the timebase assumed by the timestamps of the buffered frames.
  9461. @item frame_rate
  9462. Specify the frame rate expected for the video stream.
  9463. @item pixel_aspect, sar
  9464. The sample (pixel) aspect ratio of the input video.
  9465. @item sws_param
  9466. Specify the optional parameters to be used for the scale filter which
  9467. is automatically inserted when an input change is detected in the
  9468. input size or format.
  9469. @end table
  9470. For example:
  9471. @example
  9472. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  9473. @end example
  9474. will instruct the source to accept video frames with size 320x240 and
  9475. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  9476. square pixels (1:1 sample aspect ratio).
  9477. Since the pixel format with name "yuv410p" corresponds to the number 6
  9478. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  9479. this example corresponds to:
  9480. @example
  9481. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  9482. @end example
  9483. Alternatively, the options can be specified as a flat string, but this
  9484. syntax is deprecated:
  9485. @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}]
  9486. @section cellauto
  9487. Create a pattern generated by an elementary cellular automaton.
  9488. The initial state of the cellular automaton can be defined through the
  9489. @option{filename}, and @option{pattern} options. If such options are
  9490. not specified an initial state is created randomly.
  9491. At each new frame a new row in the video is filled with the result of
  9492. the cellular automaton next generation. The behavior when the whole
  9493. frame is filled is defined by the @option{scroll} option.
  9494. This source accepts the following options:
  9495. @table @option
  9496. @item filename, f
  9497. Read the initial cellular automaton state, i.e. the starting row, from
  9498. the specified file.
  9499. In the file, each non-whitespace character is considered an alive
  9500. cell, a newline will terminate the row, and further characters in the
  9501. file will be ignored.
  9502. @item pattern, p
  9503. Read the initial cellular automaton state, i.e. the starting row, from
  9504. the specified string.
  9505. Each non-whitespace character in the string is considered an alive
  9506. cell, a newline will terminate the row, and further characters in the
  9507. string will be ignored.
  9508. @item rate, r
  9509. Set the video rate, that is the number of frames generated per second.
  9510. Default is 25.
  9511. @item random_fill_ratio, ratio
  9512. Set the random fill ratio for the initial cellular automaton row. It
  9513. is a floating point number value ranging from 0 to 1, defaults to
  9514. 1/PHI.
  9515. This option is ignored when a file or a pattern is specified.
  9516. @item random_seed, seed
  9517. Set the seed for filling randomly the initial row, must be an integer
  9518. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9519. set to -1, the filter will try to use a good random seed on a best
  9520. effort basis.
  9521. @item rule
  9522. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  9523. Default value is 110.
  9524. @item size, s
  9525. Set the size of the output video. For the syntax of this option, check the
  9526. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9527. If @option{filename} or @option{pattern} is specified, the size is set
  9528. by default to the width of the specified initial state row, and the
  9529. height is set to @var{width} * PHI.
  9530. If @option{size} is set, it must contain the width of the specified
  9531. pattern string, and the specified pattern will be centered in the
  9532. larger row.
  9533. If a filename or a pattern string is not specified, the size value
  9534. defaults to "320x518" (used for a randomly generated initial state).
  9535. @item scroll
  9536. If set to 1, scroll the output upward when all the rows in the output
  9537. have been already filled. If set to 0, the new generated row will be
  9538. written over the top row just after the bottom row is filled.
  9539. Defaults to 1.
  9540. @item start_full, full
  9541. If set to 1, completely fill the output with generated rows before
  9542. outputting the first frame.
  9543. This is the default behavior, for disabling set the value to 0.
  9544. @item stitch
  9545. If set to 1, stitch the left and right row edges together.
  9546. This is the default behavior, for disabling set the value to 0.
  9547. @end table
  9548. @subsection Examples
  9549. @itemize
  9550. @item
  9551. Read the initial state from @file{pattern}, and specify an output of
  9552. size 200x400.
  9553. @example
  9554. cellauto=f=pattern:s=200x400
  9555. @end example
  9556. @item
  9557. Generate a random initial row with a width of 200 cells, with a fill
  9558. ratio of 2/3:
  9559. @example
  9560. cellauto=ratio=2/3:s=200x200
  9561. @end example
  9562. @item
  9563. Create a pattern generated by rule 18 starting by a single alive cell
  9564. centered on an initial row with width 100:
  9565. @example
  9566. cellauto=p=@@:s=100x400:full=0:rule=18
  9567. @end example
  9568. @item
  9569. Specify a more elaborated initial pattern:
  9570. @example
  9571. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  9572. @end example
  9573. @end itemize
  9574. @section mandelbrot
  9575. Generate a Mandelbrot set fractal, and progressively zoom towards the
  9576. point specified with @var{start_x} and @var{start_y}.
  9577. This source accepts the following options:
  9578. @table @option
  9579. @item end_pts
  9580. Set the terminal pts value. Default value is 400.
  9581. @item end_scale
  9582. Set the terminal scale value.
  9583. Must be a floating point value. Default value is 0.3.
  9584. @item inner
  9585. Set the inner coloring mode, that is the algorithm used to draw the
  9586. Mandelbrot fractal internal region.
  9587. It shall assume one of the following values:
  9588. @table @option
  9589. @item black
  9590. Set black mode.
  9591. @item convergence
  9592. Show time until convergence.
  9593. @item mincol
  9594. Set color based on point closest to the origin of the iterations.
  9595. @item period
  9596. Set period mode.
  9597. @end table
  9598. Default value is @var{mincol}.
  9599. @item bailout
  9600. Set the bailout value. Default value is 10.0.
  9601. @item maxiter
  9602. Set the maximum of iterations performed by the rendering
  9603. algorithm. Default value is 7189.
  9604. @item outer
  9605. Set outer coloring mode.
  9606. It shall assume one of following values:
  9607. @table @option
  9608. @item iteration_count
  9609. Set iteration cound mode.
  9610. @item normalized_iteration_count
  9611. set normalized iteration count mode.
  9612. @end table
  9613. Default value is @var{normalized_iteration_count}.
  9614. @item rate, r
  9615. Set frame rate, expressed as number of frames per second. Default
  9616. value is "25".
  9617. @item size, s
  9618. Set frame size. For the syntax of this option, check the "Video
  9619. size" section in the ffmpeg-utils manual. Default value is "640x480".
  9620. @item start_scale
  9621. Set the initial scale value. Default value is 3.0.
  9622. @item start_x
  9623. Set the initial x position. Must be a floating point value between
  9624. -100 and 100. Default value is -0.743643887037158704752191506114774.
  9625. @item start_y
  9626. Set the initial y position. Must be a floating point value between
  9627. -100 and 100. Default value is -0.131825904205311970493132056385139.
  9628. @end table
  9629. @section mptestsrc
  9630. Generate various test patterns, as generated by the MPlayer test filter.
  9631. The size of the generated video is fixed, and is 256x256.
  9632. This source is useful in particular for testing encoding features.
  9633. This source accepts the following options:
  9634. @table @option
  9635. @item rate, r
  9636. Specify the frame rate of the sourced video, as the number of frames
  9637. generated per second. It has to be a string in the format
  9638. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9639. number or a valid video frame rate abbreviation. The default value is
  9640. "25".
  9641. @item duration, d
  9642. Set the duration of the sourced video. See
  9643. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9644. for the accepted syntax.
  9645. If not specified, or the expressed duration is negative, the video is
  9646. supposed to be generated forever.
  9647. @item test, t
  9648. Set the number or the name of the test to perform. Supported tests are:
  9649. @table @option
  9650. @item dc_luma
  9651. @item dc_chroma
  9652. @item freq_luma
  9653. @item freq_chroma
  9654. @item amp_luma
  9655. @item amp_chroma
  9656. @item cbp
  9657. @item mv
  9658. @item ring1
  9659. @item ring2
  9660. @item all
  9661. @end table
  9662. Default value is "all", which will cycle through the list of all tests.
  9663. @end table
  9664. Some examples:
  9665. @example
  9666. mptestsrc=t=dc_luma
  9667. @end example
  9668. will generate a "dc_luma" test pattern.
  9669. @section frei0r_src
  9670. Provide a frei0r source.
  9671. To enable compilation of this filter you need to install the frei0r
  9672. header and configure FFmpeg with @code{--enable-frei0r}.
  9673. This source accepts the following parameters:
  9674. @table @option
  9675. @item size
  9676. The size of the video to generate. For the syntax of this option, check the
  9677. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9678. @item framerate
  9679. The framerate of the generated video. It may be a string of the form
  9680. @var{num}/@var{den} or a frame rate abbreviation.
  9681. @item filter_name
  9682. The name to the frei0r source to load. For more information regarding frei0r and
  9683. how to set the parameters, read the @ref{frei0r} section in the video filters
  9684. documentation.
  9685. @item filter_params
  9686. A '|'-separated list of parameters to pass to the frei0r source.
  9687. @end table
  9688. For example, to generate a frei0r partik0l source with size 200x200
  9689. and frame rate 10 which is overlaid on the overlay filter main input:
  9690. @example
  9691. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  9692. @end example
  9693. @section life
  9694. Generate a life pattern.
  9695. This source is based on a generalization of John Conway's life game.
  9696. The sourced input represents a life grid, each pixel represents a cell
  9697. which can be in one of two possible states, alive or dead. Every cell
  9698. interacts with its eight neighbours, which are the cells that are
  9699. horizontally, vertically, or diagonally adjacent.
  9700. At each interaction the grid evolves according to the adopted rule,
  9701. which specifies the number of neighbor alive cells which will make a
  9702. cell stay alive or born. The @option{rule} option allows one to specify
  9703. the rule to adopt.
  9704. This source accepts the following options:
  9705. @table @option
  9706. @item filename, f
  9707. Set the file from which to read the initial grid state. In the file,
  9708. each non-whitespace character is considered an alive cell, and newline
  9709. is used to delimit the end of each row.
  9710. If this option is not specified, the initial grid is generated
  9711. randomly.
  9712. @item rate, r
  9713. Set the video rate, that is the number of frames generated per second.
  9714. Default is 25.
  9715. @item random_fill_ratio, ratio
  9716. Set the random fill ratio for the initial random grid. It is a
  9717. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  9718. It is ignored when a file is specified.
  9719. @item random_seed, seed
  9720. Set the seed for filling the initial random grid, must be an integer
  9721. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9722. set to -1, the filter will try to use a good random seed on a best
  9723. effort basis.
  9724. @item rule
  9725. Set the life rule.
  9726. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  9727. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  9728. @var{NS} specifies the number of alive neighbor cells which make a
  9729. live cell stay alive, and @var{NB} the number of alive neighbor cells
  9730. which make a dead cell to become alive (i.e. to "born").
  9731. "s" and "b" can be used in place of "S" and "B", respectively.
  9732. Alternatively a rule can be specified by an 18-bits integer. The 9
  9733. high order bits are used to encode the next cell state if it is alive
  9734. for each number of neighbor alive cells, the low order bits specify
  9735. the rule for "borning" new cells. Higher order bits encode for an
  9736. higher number of neighbor cells.
  9737. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  9738. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  9739. Default value is "S23/B3", which is the original Conway's game of life
  9740. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  9741. cells, and will born a new cell if there are three alive cells around
  9742. a dead cell.
  9743. @item size, s
  9744. Set the size of the output video. For the syntax of this option, check the
  9745. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9746. If @option{filename} is specified, the size is set by default to the
  9747. same size of the input file. If @option{size} is set, it must contain
  9748. the size specified in the input file, and the initial grid defined in
  9749. that file is centered in the larger resulting area.
  9750. If a filename is not specified, the size value defaults to "320x240"
  9751. (used for a randomly generated initial grid).
  9752. @item stitch
  9753. If set to 1, stitch the left and right grid edges together, and the
  9754. top and bottom edges also. Defaults to 1.
  9755. @item mold
  9756. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  9757. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  9758. value from 0 to 255.
  9759. @item life_color
  9760. Set the color of living (or new born) cells.
  9761. @item death_color
  9762. Set the color of dead cells. If @option{mold} is set, this is the first color
  9763. used to represent a dead cell.
  9764. @item mold_color
  9765. Set mold color, for definitely dead and moldy cells.
  9766. For the syntax of these 3 color options, check the "Color" section in the
  9767. ffmpeg-utils manual.
  9768. @end table
  9769. @subsection Examples
  9770. @itemize
  9771. @item
  9772. Read a grid from @file{pattern}, and center it on a grid of size
  9773. 300x300 pixels:
  9774. @example
  9775. life=f=pattern:s=300x300
  9776. @end example
  9777. @item
  9778. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  9779. @example
  9780. life=ratio=2/3:s=200x200
  9781. @end example
  9782. @item
  9783. Specify a custom rule for evolving a randomly generated grid:
  9784. @example
  9785. life=rule=S14/B34
  9786. @end example
  9787. @item
  9788. Full example with slow death effect (mold) using @command{ffplay}:
  9789. @example
  9790. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  9791. @end example
  9792. @end itemize
  9793. @anchor{allrgb}
  9794. @anchor{allyuv}
  9795. @anchor{color}
  9796. @anchor{haldclutsrc}
  9797. @anchor{nullsrc}
  9798. @anchor{rgbtestsrc}
  9799. @anchor{smptebars}
  9800. @anchor{smptehdbars}
  9801. @anchor{testsrc}
  9802. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  9803. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  9804. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  9805. The @code{color} source provides an uniformly colored input.
  9806. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  9807. @ref{haldclut} filter.
  9808. The @code{nullsrc} source returns unprocessed video frames. It is
  9809. mainly useful to be employed in analysis / debugging tools, or as the
  9810. source for filters which ignore the input data.
  9811. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  9812. detecting RGB vs BGR issues. You should see a red, green and blue
  9813. stripe from top to bottom.
  9814. The @code{smptebars} source generates a color bars pattern, based on
  9815. the SMPTE Engineering Guideline EG 1-1990.
  9816. The @code{smptehdbars} source generates a color bars pattern, based on
  9817. the SMPTE RP 219-2002.
  9818. The @code{testsrc} source generates a test video pattern, showing a
  9819. color pattern, a scrolling gradient and a timestamp. This is mainly
  9820. intended for testing purposes.
  9821. The sources accept the following parameters:
  9822. @table @option
  9823. @item color, c
  9824. Specify the color of the source, only available in the @code{color}
  9825. source. For the syntax of this option, check the "Color" section in the
  9826. ffmpeg-utils manual.
  9827. @item level
  9828. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  9829. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  9830. pixels to be used as identity matrix for 3D lookup tables. Each component is
  9831. coded on a @code{1/(N*N)} scale.
  9832. @item size, s
  9833. Specify the size of the sourced video. For the syntax of this option, check the
  9834. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9835. The default value is @code{320x240}.
  9836. This option is not available with the @code{haldclutsrc} filter.
  9837. @item rate, r
  9838. Specify the frame rate of the sourced video, as the number of frames
  9839. generated per second. It has to be a string in the format
  9840. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9841. number or a valid video frame rate abbreviation. The default value is
  9842. "25".
  9843. @item sar
  9844. Set the sample aspect ratio of the sourced video.
  9845. @item duration, d
  9846. Set the duration of the sourced video. See
  9847. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9848. for the accepted syntax.
  9849. If not specified, or the expressed duration is negative, the video is
  9850. supposed to be generated forever.
  9851. @item decimals, n
  9852. Set the number of decimals to show in the timestamp, only available in the
  9853. @code{testsrc} source.
  9854. The displayed timestamp value will correspond to the original
  9855. timestamp value multiplied by the power of 10 of the specified
  9856. value. Default value is 0.
  9857. @end table
  9858. For example the following:
  9859. @example
  9860. testsrc=duration=5.3:size=qcif:rate=10
  9861. @end example
  9862. will generate a video with a duration of 5.3 seconds, with size
  9863. 176x144 and a frame rate of 10 frames per second.
  9864. The following graph description will generate a red source
  9865. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  9866. frames per second.
  9867. @example
  9868. color=c=red@@0.2:s=qcif:r=10
  9869. @end example
  9870. If the input content is to be ignored, @code{nullsrc} can be used. The
  9871. following command generates noise in the luminance plane by employing
  9872. the @code{geq} filter:
  9873. @example
  9874. nullsrc=s=256x256, geq=random(1)*255:128:128
  9875. @end example
  9876. @subsection Commands
  9877. The @code{color} source supports the following commands:
  9878. @table @option
  9879. @item c, color
  9880. Set the color of the created image. Accepts the same syntax of the
  9881. corresponding @option{color} option.
  9882. @end table
  9883. @c man end VIDEO SOURCES
  9884. @chapter Video Sinks
  9885. @c man begin VIDEO SINKS
  9886. Below is a description of the currently available video sinks.
  9887. @section buffersink
  9888. Buffer video frames, and make them available to the end of the filter
  9889. graph.
  9890. This sink is mainly intended for programmatic use, in particular
  9891. through the interface defined in @file{libavfilter/buffersink.h}
  9892. or the options system.
  9893. It accepts a pointer to an AVBufferSinkContext structure, which
  9894. defines the incoming buffers' formats, to be passed as the opaque
  9895. parameter to @code{avfilter_init_filter} for initialization.
  9896. @section nullsink
  9897. Null video sink: do absolutely nothing with the input video. It is
  9898. mainly useful as a template and for use in analysis / debugging
  9899. tools.
  9900. @c man end VIDEO SINKS
  9901. @chapter Multimedia Filters
  9902. @c man begin MULTIMEDIA FILTERS
  9903. Below is a description of the currently available multimedia filters.
  9904. @section aphasemeter
  9905. Convert input audio to a video output, displaying the audio phase.
  9906. The filter accepts the following options:
  9907. @table @option
  9908. @item rate, r
  9909. Set the output frame rate. Default value is @code{25}.
  9910. @item size, s
  9911. Set the video size for the output. For the syntax of this option, check the
  9912. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9913. Default value is @code{800x400}.
  9914. @item rc
  9915. @item gc
  9916. @item bc
  9917. Specify the red, green, blue contrast. Default values are @code{2},
  9918. @code{7} and @code{1}.
  9919. Allowed range is @code{[0, 255]}.
  9920. @item mpc
  9921. Set color which will be used for drawing median phase. If color is
  9922. @code{none} which is default, no median phase value will be drawn.
  9923. @end table
  9924. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  9925. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  9926. The @code{-1} means left and right channels are completely out of phase and
  9927. @code{1} means channels are in phase.
  9928. @section avectorscope
  9929. Convert input audio to a video output, representing the audio vector
  9930. scope.
  9931. The filter is used to measure the difference between channels of stereo
  9932. audio stream. A monoaural signal, consisting of identical left and right
  9933. signal, results in straight vertical line. Any stereo separation is visible
  9934. as a deviation from this line, creating a Lissajous figure.
  9935. If the straight (or deviation from it) but horizontal line appears this
  9936. indicates that the left and right channels are out of phase.
  9937. The filter accepts the following options:
  9938. @table @option
  9939. @item mode, m
  9940. Set the vectorscope mode.
  9941. Available values are:
  9942. @table @samp
  9943. @item lissajous
  9944. Lissajous rotated by 45 degrees.
  9945. @item lissajous_xy
  9946. Same as above but not rotated.
  9947. @item polar
  9948. Shape resembling half of circle.
  9949. @end table
  9950. Default value is @samp{lissajous}.
  9951. @item size, s
  9952. Set the video size for the output. For the syntax of this option, check the
  9953. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9954. Default value is @code{400x400}.
  9955. @item rate, r
  9956. Set the output frame rate. Default value is @code{25}.
  9957. @item rc
  9958. @item gc
  9959. @item bc
  9960. @item ac
  9961. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  9962. @code{160}, @code{80} and @code{255}.
  9963. Allowed range is @code{[0, 255]}.
  9964. @item rf
  9965. @item gf
  9966. @item bf
  9967. @item af
  9968. Specify the red, green, blue and alpha fade. Default values are @code{15},
  9969. @code{10}, @code{5} and @code{5}.
  9970. Allowed range is @code{[0, 255]}.
  9971. @item zoom
  9972. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  9973. @end table
  9974. @subsection Examples
  9975. @itemize
  9976. @item
  9977. Complete example using @command{ffplay}:
  9978. @example
  9979. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  9980. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  9981. @end example
  9982. @end itemize
  9983. @section concat
  9984. Concatenate audio and video streams, joining them together one after the
  9985. other.
  9986. The filter works on segments of synchronized video and audio streams. All
  9987. segments must have the same number of streams of each type, and that will
  9988. also be the number of streams at output.
  9989. The filter accepts the following options:
  9990. @table @option
  9991. @item n
  9992. Set the number of segments. Default is 2.
  9993. @item v
  9994. Set the number of output video streams, that is also the number of video
  9995. streams in each segment. Default is 1.
  9996. @item a
  9997. Set the number of output audio streams, that is also the number of audio
  9998. streams in each segment. Default is 0.
  9999. @item unsafe
  10000. Activate unsafe mode: do not fail if segments have a different format.
  10001. @end table
  10002. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  10003. @var{a} audio outputs.
  10004. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  10005. segment, in the same order as the outputs, then the inputs for the second
  10006. segment, etc.
  10007. Related streams do not always have exactly the same duration, for various
  10008. reasons including codec frame size or sloppy authoring. For that reason,
  10009. related synchronized streams (e.g. a video and its audio track) should be
  10010. concatenated at once. The concat filter will use the duration of the longest
  10011. stream in each segment (except the last one), and if necessary pad shorter
  10012. audio streams with silence.
  10013. For this filter to work correctly, all segments must start at timestamp 0.
  10014. All corresponding streams must have the same parameters in all segments; the
  10015. filtering system will automatically select a common pixel format for video
  10016. streams, and a common sample format, sample rate and channel layout for
  10017. audio streams, but other settings, such as resolution, must be converted
  10018. explicitly by the user.
  10019. Different frame rates are acceptable but will result in variable frame rate
  10020. at output; be sure to configure the output file to handle it.
  10021. @subsection Examples
  10022. @itemize
  10023. @item
  10024. Concatenate an opening, an episode and an ending, all in bilingual version
  10025. (video in stream 0, audio in streams 1 and 2):
  10026. @example
  10027. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  10028. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  10029. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  10030. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  10031. @end example
  10032. @item
  10033. Concatenate two parts, handling audio and video separately, using the
  10034. (a)movie sources, and adjusting the resolution:
  10035. @example
  10036. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  10037. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  10038. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  10039. @end example
  10040. Note that a desync will happen at the stitch if the audio and video streams
  10041. do not have exactly the same duration in the first file.
  10042. @end itemize
  10043. @anchor{ebur128}
  10044. @section ebur128
  10045. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  10046. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  10047. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  10048. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  10049. The filter also has a video output (see the @var{video} option) with a real
  10050. time graph to observe the loudness evolution. The graphic contains the logged
  10051. message mentioned above, so it is not printed anymore when this option is set,
  10052. unless the verbose logging is set. The main graphing area contains the
  10053. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  10054. the momentary loudness (400 milliseconds).
  10055. More information about the Loudness Recommendation EBU R128 on
  10056. @url{http://tech.ebu.ch/loudness}.
  10057. The filter accepts the following options:
  10058. @table @option
  10059. @item video
  10060. Activate the video output. The audio stream is passed unchanged whether this
  10061. option is set or no. The video stream will be the first output stream if
  10062. activated. Default is @code{0}.
  10063. @item size
  10064. Set the video size. This option is for video only. For the syntax of this
  10065. option, check the
  10066. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10067. Default and minimum resolution is @code{640x480}.
  10068. @item meter
  10069. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  10070. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  10071. other integer value between this range is allowed.
  10072. @item metadata
  10073. Set metadata injection. If set to @code{1}, the audio input will be segmented
  10074. into 100ms output frames, each of them containing various loudness information
  10075. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  10076. Default is @code{0}.
  10077. @item framelog
  10078. Force the frame logging level.
  10079. Available values are:
  10080. @table @samp
  10081. @item info
  10082. information logging level
  10083. @item verbose
  10084. verbose logging level
  10085. @end table
  10086. By default, the logging level is set to @var{info}. If the @option{video} or
  10087. the @option{metadata} options are set, it switches to @var{verbose}.
  10088. @item peak
  10089. Set peak mode(s).
  10090. Available modes can be cumulated (the option is a @code{flag} type). Possible
  10091. values are:
  10092. @table @samp
  10093. @item none
  10094. Disable any peak mode (default).
  10095. @item sample
  10096. Enable sample-peak mode.
  10097. Simple peak mode looking for the higher sample value. It logs a message
  10098. for sample-peak (identified by @code{SPK}).
  10099. @item true
  10100. Enable true-peak mode.
  10101. If enabled, the peak lookup is done on an over-sampled version of the input
  10102. stream for better peak accuracy. It logs a message for true-peak.
  10103. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  10104. This mode requires a build with @code{libswresample}.
  10105. @end table
  10106. @item dualmono
  10107. Treat mono input files as "dual mono". If a mono file is intended for playback
  10108. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  10109. If set to @code{true}, this option will compensate for this effect.
  10110. Multi-channel input files are not affected by this option.
  10111. @item panlaw
  10112. Set a specific pan law to be used for the measurement of dual mono files.
  10113. This parameter is optional, and has a default value of -3.01dB.
  10114. @end table
  10115. @subsection Examples
  10116. @itemize
  10117. @item
  10118. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  10119. @example
  10120. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  10121. @end example
  10122. @item
  10123. Run an analysis with @command{ffmpeg}:
  10124. @example
  10125. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  10126. @end example
  10127. @end itemize
  10128. @section interleave, ainterleave
  10129. Temporally interleave frames from several inputs.
  10130. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  10131. These filters read frames from several inputs and send the oldest
  10132. queued frame to the output.
  10133. Input streams must have a well defined, monotonically increasing frame
  10134. timestamp values.
  10135. In order to submit one frame to output, these filters need to enqueue
  10136. at least one frame for each input, so they cannot work in case one
  10137. input is not yet terminated and will not receive incoming frames.
  10138. For example consider the case when one input is a @code{select} filter
  10139. which always drop input frames. The @code{interleave} filter will keep
  10140. reading from that input, but it will never be able to send new frames
  10141. to output until the input will send an end-of-stream signal.
  10142. Also, depending on inputs synchronization, the filters will drop
  10143. frames in case one input receives more frames than the other ones, and
  10144. the queue is already filled.
  10145. These filters accept the following options:
  10146. @table @option
  10147. @item nb_inputs, n
  10148. Set the number of different inputs, it is 2 by default.
  10149. @end table
  10150. @subsection Examples
  10151. @itemize
  10152. @item
  10153. Interleave frames belonging to different streams using @command{ffmpeg}:
  10154. @example
  10155. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  10156. @end example
  10157. @item
  10158. Add flickering blur effect:
  10159. @example
  10160. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  10161. @end example
  10162. @end itemize
  10163. @section perms, aperms
  10164. Set read/write permissions for the output frames.
  10165. These filters are mainly aimed at developers to test direct path in the
  10166. following filter in the filtergraph.
  10167. The filters accept the following options:
  10168. @table @option
  10169. @item mode
  10170. Select the permissions mode.
  10171. It accepts the following values:
  10172. @table @samp
  10173. @item none
  10174. Do nothing. This is the default.
  10175. @item ro
  10176. Set all the output frames read-only.
  10177. @item rw
  10178. Set all the output frames directly writable.
  10179. @item toggle
  10180. Make the frame read-only if writable, and writable if read-only.
  10181. @item random
  10182. Set each output frame read-only or writable randomly.
  10183. @end table
  10184. @item seed
  10185. Set the seed for the @var{random} mode, must be an integer included between
  10186. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10187. @code{-1}, the filter will try to use a good random seed on a best effort
  10188. basis.
  10189. @end table
  10190. Note: in case of auto-inserted filter between the permission filter and the
  10191. following one, the permission might not be received as expected in that
  10192. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  10193. perms/aperms filter can avoid this problem.
  10194. @section realtime, arealtime
  10195. Slow down filtering to match real time approximatively.
  10196. These filters will pause the filtering for a variable amount of time to
  10197. match the output rate with the input timestamps.
  10198. They are similar to the @option{re} option to @code{ffmpeg}.
  10199. They accept the following options:
  10200. @table @option
  10201. @item limit
  10202. Time limit for the pauses. Any pause longer than that will be considered
  10203. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  10204. @end table
  10205. @section select, aselect
  10206. Select frames to pass in output.
  10207. This filter accepts the following options:
  10208. @table @option
  10209. @item expr, e
  10210. Set expression, which is evaluated for each input frame.
  10211. If the expression is evaluated to zero, the frame is discarded.
  10212. If the evaluation result is negative or NaN, the frame is sent to the
  10213. first output; otherwise it is sent to the output with index
  10214. @code{ceil(val)-1}, assuming that the input index starts from 0.
  10215. For example a value of @code{1.2} corresponds to the output with index
  10216. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  10217. @item outputs, n
  10218. Set the number of outputs. The output to which to send the selected
  10219. frame is based on the result of the evaluation. Default value is 1.
  10220. @end table
  10221. The expression can contain the following constants:
  10222. @table @option
  10223. @item n
  10224. The (sequential) number of the filtered frame, starting from 0.
  10225. @item selected_n
  10226. The (sequential) number of the selected frame, starting from 0.
  10227. @item prev_selected_n
  10228. The sequential number of the last selected frame. It's NAN if undefined.
  10229. @item TB
  10230. The timebase of the input timestamps.
  10231. @item pts
  10232. The PTS (Presentation TimeStamp) of the filtered video frame,
  10233. expressed in @var{TB} units. It's NAN if undefined.
  10234. @item t
  10235. The PTS of the filtered video frame,
  10236. expressed in seconds. It's NAN if undefined.
  10237. @item prev_pts
  10238. The PTS of the previously filtered video frame. It's NAN if undefined.
  10239. @item prev_selected_pts
  10240. The PTS of the last previously filtered video frame. It's NAN if undefined.
  10241. @item prev_selected_t
  10242. The PTS of the last previously selected video frame. It's NAN if undefined.
  10243. @item start_pts
  10244. The PTS of the first video frame in the video. It's NAN if undefined.
  10245. @item start_t
  10246. The time of the first video frame in the video. It's NAN if undefined.
  10247. @item pict_type @emph{(video only)}
  10248. The type of the filtered frame. It can assume one of the following
  10249. values:
  10250. @table @option
  10251. @item I
  10252. @item P
  10253. @item B
  10254. @item S
  10255. @item SI
  10256. @item SP
  10257. @item BI
  10258. @end table
  10259. @item interlace_type @emph{(video only)}
  10260. The frame interlace type. It can assume one of the following values:
  10261. @table @option
  10262. @item PROGRESSIVE
  10263. The frame is progressive (not interlaced).
  10264. @item TOPFIRST
  10265. The frame is top-field-first.
  10266. @item BOTTOMFIRST
  10267. The frame is bottom-field-first.
  10268. @end table
  10269. @item consumed_sample_n @emph{(audio only)}
  10270. the number of selected samples before the current frame
  10271. @item samples_n @emph{(audio only)}
  10272. the number of samples in the current frame
  10273. @item sample_rate @emph{(audio only)}
  10274. the input sample rate
  10275. @item key
  10276. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  10277. @item pos
  10278. the position in the file of the filtered frame, -1 if the information
  10279. is not available (e.g. for synthetic video)
  10280. @item scene @emph{(video only)}
  10281. value between 0 and 1 to indicate a new scene; a low value reflects a low
  10282. probability for the current frame to introduce a new scene, while a higher
  10283. value means the current frame is more likely to be one (see the example below)
  10284. @item concatdec_select
  10285. The concat demuxer can select only part of a concat input file by setting an
  10286. inpoint and an outpoint, but the output packets may not be entirely contained
  10287. in the selected interval. By using this variable, it is possible to skip frames
  10288. generated by the concat demuxer which are not exactly contained in the selected
  10289. interval.
  10290. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  10291. and the @var{lavf.concat.duration} packet metadata values which are also
  10292. present in the decoded frames.
  10293. The @var{concatdec_select} variable is -1 if the frame pts is at least
  10294. start_time and either the duration metadata is missing or the frame pts is less
  10295. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  10296. missing.
  10297. That basically means that an input frame is selected if its pts is within the
  10298. interval set by the concat demuxer.
  10299. @end table
  10300. The default value of the select expression is "1".
  10301. @subsection Examples
  10302. @itemize
  10303. @item
  10304. Select all frames in input:
  10305. @example
  10306. select
  10307. @end example
  10308. The example above is the same as:
  10309. @example
  10310. select=1
  10311. @end example
  10312. @item
  10313. Skip all frames:
  10314. @example
  10315. select=0
  10316. @end example
  10317. @item
  10318. Select only I-frames:
  10319. @example
  10320. select='eq(pict_type\,I)'
  10321. @end example
  10322. @item
  10323. Select one frame every 100:
  10324. @example
  10325. select='not(mod(n\,100))'
  10326. @end example
  10327. @item
  10328. Select only frames contained in the 10-20 time interval:
  10329. @example
  10330. select=between(t\,10\,20)
  10331. @end example
  10332. @item
  10333. Select only I frames contained in the 10-20 time interval:
  10334. @example
  10335. select=between(t\,10\,20)*eq(pict_type\,I)
  10336. @end example
  10337. @item
  10338. Select frames with a minimum distance of 10 seconds:
  10339. @example
  10340. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  10341. @end example
  10342. @item
  10343. Use aselect to select only audio frames with samples number > 100:
  10344. @example
  10345. aselect='gt(samples_n\,100)'
  10346. @end example
  10347. @item
  10348. Create a mosaic of the first scenes:
  10349. @example
  10350. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  10351. @end example
  10352. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  10353. choice.
  10354. @item
  10355. Send even and odd frames to separate outputs, and compose them:
  10356. @example
  10357. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  10358. @end example
  10359. @item
  10360. Select useful frames from an ffconcat file which is using inpoints and
  10361. outpoints but where the source files are not intra frame only.
  10362. @example
  10363. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  10364. @end example
  10365. @end itemize
  10366. @section selectivecolor
  10367. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10368. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10369. by the "purity" of the color (that is, how saturated it already is).
  10370. This filter is similar to the Adobe Photoshop Selective Color tool.
  10371. The filter accepts the following options:
  10372. @table @option
  10373. @item correction_method
  10374. Select color correction method.
  10375. Available values are:
  10376. @table @samp
  10377. @item absolute
  10378. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10379. component value).
  10380. @item relative
  10381. Specified adjustments are relative to the original component value.
  10382. @end table
  10383. Default is @code{absolute}.
  10384. @item reds
  10385. Adjustments for red pixels (pixels where the red component is the maximum)
  10386. @item yellows
  10387. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10388. @item greens
  10389. Adjustments for green pixels (pixels where the green component is the maximum)
  10390. @item cyans
  10391. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10392. @item blues
  10393. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10394. @item magentas
  10395. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10396. @item whites
  10397. Adjustments for white pixels (pixels where all components are greater than 128)
  10398. @item neutrals
  10399. Adjustments for all pixels except pure black and pure white
  10400. @item blacks
  10401. Adjustments for black pixels (pixels where all components are lesser than 128)
  10402. @item psfile
  10403. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10404. @end table
  10405. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10406. 4 space separated floating point adjustment values in the [-1,1] range,
  10407. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10408. pixels of its range.
  10409. @subsection Examples
  10410. @itemize
  10411. @item
  10412. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10413. increase magenta by 27% in blue areas:
  10414. @example
  10415. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10416. @end example
  10417. @item
  10418. Use a Photoshop selective color preset:
  10419. @example
  10420. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10421. @end example
  10422. @end itemize
  10423. @section sendcmd, asendcmd
  10424. Send commands to filters in the filtergraph.
  10425. These filters read commands to be sent to other filters in the
  10426. filtergraph.
  10427. @code{sendcmd} must be inserted between two video filters,
  10428. @code{asendcmd} must be inserted between two audio filters, but apart
  10429. from that they act the same way.
  10430. The specification of commands can be provided in the filter arguments
  10431. with the @var{commands} option, or in a file specified by the
  10432. @var{filename} option.
  10433. These filters accept the following options:
  10434. @table @option
  10435. @item commands, c
  10436. Set the commands to be read and sent to the other filters.
  10437. @item filename, f
  10438. Set the filename of the commands to be read and sent to the other
  10439. filters.
  10440. @end table
  10441. @subsection Commands syntax
  10442. A commands description consists of a sequence of interval
  10443. specifications, comprising a list of commands to be executed when a
  10444. particular event related to that interval occurs. The occurring event
  10445. is typically the current frame time entering or leaving a given time
  10446. interval.
  10447. An interval is specified by the following syntax:
  10448. @example
  10449. @var{START}[-@var{END}] @var{COMMANDS};
  10450. @end example
  10451. The time interval is specified by the @var{START} and @var{END} times.
  10452. @var{END} is optional and defaults to the maximum time.
  10453. The current frame time is considered within the specified interval if
  10454. it is included in the interval [@var{START}, @var{END}), that is when
  10455. the time is greater or equal to @var{START} and is lesser than
  10456. @var{END}.
  10457. @var{COMMANDS} consists of a sequence of one or more command
  10458. specifications, separated by ",", relating to that interval. The
  10459. syntax of a command specification is given by:
  10460. @example
  10461. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  10462. @end example
  10463. @var{FLAGS} is optional and specifies the type of events relating to
  10464. the time interval which enable sending the specified command, and must
  10465. be a non-null sequence of identifier flags separated by "+" or "|" and
  10466. enclosed between "[" and "]".
  10467. The following flags are recognized:
  10468. @table @option
  10469. @item enter
  10470. The command is sent when the current frame timestamp enters the
  10471. specified interval. In other words, the command is sent when the
  10472. previous frame timestamp was not in the given interval, and the
  10473. current is.
  10474. @item leave
  10475. The command is sent when the current frame timestamp leaves the
  10476. specified interval. In other words, the command is sent when the
  10477. previous frame timestamp was in the given interval, and the
  10478. current is not.
  10479. @end table
  10480. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  10481. assumed.
  10482. @var{TARGET} specifies the target of the command, usually the name of
  10483. the filter class or a specific filter instance name.
  10484. @var{COMMAND} specifies the name of the command for the target filter.
  10485. @var{ARG} is optional and specifies the optional list of argument for
  10486. the given @var{COMMAND}.
  10487. Between one interval specification and another, whitespaces, or
  10488. sequences of characters starting with @code{#} until the end of line,
  10489. are ignored and can be used to annotate comments.
  10490. A simplified BNF description of the commands specification syntax
  10491. follows:
  10492. @example
  10493. @var{COMMAND_FLAG} ::= "enter" | "leave"
  10494. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  10495. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  10496. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  10497. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  10498. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  10499. @end example
  10500. @subsection Examples
  10501. @itemize
  10502. @item
  10503. Specify audio tempo change at second 4:
  10504. @example
  10505. asendcmd=c='4.0 atempo tempo 1.5',atempo
  10506. @end example
  10507. @item
  10508. Specify a list of drawtext and hue commands in a file.
  10509. @example
  10510. # show text in the interval 5-10
  10511. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  10512. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  10513. # desaturate the image in the interval 15-20
  10514. 15.0-20.0 [enter] hue s 0,
  10515. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  10516. [leave] hue s 1,
  10517. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  10518. # apply an exponential saturation fade-out effect, starting from time 25
  10519. 25 [enter] hue s exp(25-t)
  10520. @end example
  10521. A filtergraph allowing to read and process the above command list
  10522. stored in a file @file{test.cmd}, can be specified with:
  10523. @example
  10524. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  10525. @end example
  10526. @end itemize
  10527. @anchor{setpts}
  10528. @section setpts, asetpts
  10529. Change the PTS (presentation timestamp) of the input frames.
  10530. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  10531. This filter accepts the following options:
  10532. @table @option
  10533. @item expr
  10534. The expression which is evaluated for each frame to construct its timestamp.
  10535. @end table
  10536. The expression is evaluated through the eval API and can contain the following
  10537. constants:
  10538. @table @option
  10539. @item FRAME_RATE
  10540. frame rate, only defined for constant frame-rate video
  10541. @item PTS
  10542. The presentation timestamp in input
  10543. @item N
  10544. The count of the input frame for video or the number of consumed samples,
  10545. not including the current frame for audio, starting from 0.
  10546. @item NB_CONSUMED_SAMPLES
  10547. The number of consumed samples, not including the current frame (only
  10548. audio)
  10549. @item NB_SAMPLES, S
  10550. The number of samples in the current frame (only audio)
  10551. @item SAMPLE_RATE, SR
  10552. The audio sample rate.
  10553. @item STARTPTS
  10554. The PTS of the first frame.
  10555. @item STARTT
  10556. the time in seconds of the first frame
  10557. @item INTERLACED
  10558. State whether the current frame is interlaced.
  10559. @item T
  10560. the time in seconds of the current frame
  10561. @item POS
  10562. original position in the file of the frame, or undefined if undefined
  10563. for the current frame
  10564. @item PREV_INPTS
  10565. The previous input PTS.
  10566. @item PREV_INT
  10567. previous input time in seconds
  10568. @item PREV_OUTPTS
  10569. The previous output PTS.
  10570. @item PREV_OUTT
  10571. previous output time in seconds
  10572. @item RTCTIME
  10573. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  10574. instead.
  10575. @item RTCSTART
  10576. The wallclock (RTC) time at the start of the movie in microseconds.
  10577. @item TB
  10578. The timebase of the input timestamps.
  10579. @end table
  10580. @subsection Examples
  10581. @itemize
  10582. @item
  10583. Start counting PTS from zero
  10584. @example
  10585. setpts=PTS-STARTPTS
  10586. @end example
  10587. @item
  10588. Apply fast motion effect:
  10589. @example
  10590. setpts=0.5*PTS
  10591. @end example
  10592. @item
  10593. Apply slow motion effect:
  10594. @example
  10595. setpts=2.0*PTS
  10596. @end example
  10597. @item
  10598. Set fixed rate of 25 frames per second:
  10599. @example
  10600. setpts=N/(25*TB)
  10601. @end example
  10602. @item
  10603. Set fixed rate 25 fps with some jitter:
  10604. @example
  10605. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  10606. @end example
  10607. @item
  10608. Apply an offset of 10 seconds to the input PTS:
  10609. @example
  10610. setpts=PTS+10/TB
  10611. @end example
  10612. @item
  10613. Generate timestamps from a "live source" and rebase onto the current timebase:
  10614. @example
  10615. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  10616. @end example
  10617. @item
  10618. Generate timestamps by counting samples:
  10619. @example
  10620. asetpts=N/SR/TB
  10621. @end example
  10622. @end itemize
  10623. @section settb, asettb
  10624. Set the timebase to use for the output frames timestamps.
  10625. It is mainly useful for testing timebase configuration.
  10626. It accepts the following parameters:
  10627. @table @option
  10628. @item expr, tb
  10629. The expression which is evaluated into the output timebase.
  10630. @end table
  10631. The value for @option{tb} is an arithmetic expression representing a
  10632. rational. The expression can contain the constants "AVTB" (the default
  10633. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  10634. audio only). Default value is "intb".
  10635. @subsection Examples
  10636. @itemize
  10637. @item
  10638. Set the timebase to 1/25:
  10639. @example
  10640. settb=expr=1/25
  10641. @end example
  10642. @item
  10643. Set the timebase to 1/10:
  10644. @example
  10645. settb=expr=0.1
  10646. @end example
  10647. @item
  10648. Set the timebase to 1001/1000:
  10649. @example
  10650. settb=1+0.001
  10651. @end example
  10652. @item
  10653. Set the timebase to 2*intb:
  10654. @example
  10655. settb=2*intb
  10656. @end example
  10657. @item
  10658. Set the default timebase value:
  10659. @example
  10660. settb=AVTB
  10661. @end example
  10662. @end itemize
  10663. @section showcqt
  10664. Convert input audio to a video output representing frequency spectrum
  10665. logarithmically using Brown-Puckette constant Q transform algorithm with
  10666. direct frequency domain coefficient calculation (but the transform itself
  10667. is not really constant Q, instead the Q factor is actually variable/clamped),
  10668. with musical tone scale, from E0 to D#10.
  10669. The filter accepts the following options:
  10670. @table @option
  10671. @item size, s
  10672. Specify the video size for the output. It must be even. For the syntax of this option,
  10673. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10674. Default value is @code{1920x1080}.
  10675. @item fps, rate, r
  10676. Set the output frame rate. Default value is @code{25}.
  10677. @item bar_h
  10678. Set the bargraph height. It must be even. Default value is @code{-1} which
  10679. computes the bargraph height automatically.
  10680. @item axis_h
  10681. Set the axis height. It must be even. Default value is @code{-1} which computes
  10682. the axis height automatically.
  10683. @item sono_h
  10684. Set the sonogram height. It must be even. Default value is @code{-1} which
  10685. computes the sonogram height automatically.
  10686. @item fullhd
  10687. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  10688. instead. Default value is @code{1}.
  10689. @item sono_v, volume
  10690. Specify the sonogram volume expression. It can contain variables:
  10691. @table @option
  10692. @item bar_v
  10693. the @var{bar_v} evaluated expression
  10694. @item frequency, freq, f
  10695. the frequency where it is evaluated
  10696. @item timeclamp, tc
  10697. the value of @var{timeclamp} option
  10698. @end table
  10699. and functions:
  10700. @table @option
  10701. @item a_weighting(f)
  10702. A-weighting of equal loudness
  10703. @item b_weighting(f)
  10704. B-weighting of equal loudness
  10705. @item c_weighting(f)
  10706. C-weighting of equal loudness.
  10707. @end table
  10708. Default value is @code{16}.
  10709. @item bar_v, volume2
  10710. Specify the bargraph volume expression. It can contain variables:
  10711. @table @option
  10712. @item sono_v
  10713. the @var{sono_v} evaluated expression
  10714. @item frequency, freq, f
  10715. the frequency where it is evaluated
  10716. @item timeclamp, tc
  10717. the value of @var{timeclamp} option
  10718. @end table
  10719. and functions:
  10720. @table @option
  10721. @item a_weighting(f)
  10722. A-weighting of equal loudness
  10723. @item b_weighting(f)
  10724. B-weighting of equal loudness
  10725. @item c_weighting(f)
  10726. C-weighting of equal loudness.
  10727. @end table
  10728. Default value is @code{sono_v}.
  10729. @item sono_g, gamma
  10730. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  10731. higher gamma makes the spectrum having more range. Default value is @code{3}.
  10732. Acceptable range is @code{[1, 7]}.
  10733. @item bar_g, gamma2
  10734. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  10735. @code{[1, 7]}.
  10736. @item timeclamp, tc
  10737. Specify the transform timeclamp. At low frequency, there is trade-off between
  10738. accuracy in time domain and frequency domain. If timeclamp is lower,
  10739. event in time domain is represented more accurately (such as fast bass drum),
  10740. otherwise event in frequency domain is represented more accurately
  10741. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  10742. @item basefreq
  10743. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  10744. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  10745. @item endfreq
  10746. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  10747. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  10748. @item coeffclamp
  10749. This option is deprecated and ignored.
  10750. @item tlength
  10751. Specify the transform length in time domain. Use this option to control accuracy
  10752. trade-off between time domain and frequency domain at every frequency sample.
  10753. It can contain variables:
  10754. @table @option
  10755. @item frequency, freq, f
  10756. the frequency where it is evaluated
  10757. @item timeclamp, tc
  10758. the value of @var{timeclamp} option.
  10759. @end table
  10760. Default value is @code{384*tc/(384+tc*f)}.
  10761. @item count
  10762. Specify the transform count for every video frame. Default value is @code{6}.
  10763. Acceptable range is @code{[1, 30]}.
  10764. @item fcount
  10765. Specify the transform count for every single pixel. Default value is @code{0},
  10766. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  10767. @item fontfile
  10768. Specify font file for use with freetype to draw the axis. If not specified,
  10769. use embedded font. Note that drawing with font file or embedded font is not
  10770. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  10771. option instead.
  10772. @item fontcolor
  10773. Specify font color expression. This is arithmetic expression that should return
  10774. integer value 0xRRGGBB. It can contain variables:
  10775. @table @option
  10776. @item frequency, freq, f
  10777. the frequency where it is evaluated
  10778. @item timeclamp, tc
  10779. the value of @var{timeclamp} option
  10780. @end table
  10781. and functions:
  10782. @table @option
  10783. @item midi(f)
  10784. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  10785. @item r(x), g(x), b(x)
  10786. red, green, and blue value of intensity x.
  10787. @end table
  10788. Default value is @code{st(0, (midi(f)-59.5)/12);
  10789. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  10790. r(1-ld(1)) + b(ld(1))}.
  10791. @item axisfile
  10792. Specify image file to draw the axis. This option override @var{fontfile} and
  10793. @var{fontcolor} option.
  10794. @item axis, text
  10795. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  10796. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  10797. Default value is @code{1}.
  10798. @end table
  10799. @subsection Examples
  10800. @itemize
  10801. @item
  10802. Playing audio while showing the spectrum:
  10803. @example
  10804. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  10805. @end example
  10806. @item
  10807. Same as above, but with frame rate 30 fps:
  10808. @example
  10809. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  10810. @end example
  10811. @item
  10812. Playing at 1280x720:
  10813. @example
  10814. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  10815. @end example
  10816. @item
  10817. Disable sonogram display:
  10818. @example
  10819. sono_h=0
  10820. @end example
  10821. @item
  10822. A1 and its harmonics: A1, A2, (near)E3, A3:
  10823. @example
  10824. 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),
  10825. asplit[a][out1]; [a] showcqt [out0]'
  10826. @end example
  10827. @item
  10828. Same as above, but with more accuracy in frequency domain:
  10829. @example
  10830. 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),
  10831. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  10832. @end example
  10833. @item
  10834. Custom volume:
  10835. @example
  10836. bar_v=10:sono_v=bar_v*a_weighting(f)
  10837. @end example
  10838. @item
  10839. Custom gamma, now spectrum is linear to the amplitude.
  10840. @example
  10841. bar_g=2:sono_g=2
  10842. @end example
  10843. @item
  10844. Custom tlength equation:
  10845. @example
  10846. 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)))'
  10847. @end example
  10848. @item
  10849. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  10850. @example
  10851. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  10852. @end example
  10853. @item
  10854. Custom frequency range with custom axis using image file:
  10855. @example
  10856. axisfile=myaxis.png:basefreq=40:endfreq=10000
  10857. @end example
  10858. @end itemize
  10859. @section showfreqs
  10860. Convert input audio to video output representing the audio power spectrum.
  10861. Audio amplitude is on Y-axis while frequency is on X-axis.
  10862. The filter accepts the following options:
  10863. @table @option
  10864. @item size, s
  10865. Specify size of video. For the syntax of this option, check the
  10866. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10867. Default is @code{1024x512}.
  10868. @item mode
  10869. Set display mode.
  10870. This set how each frequency bin will be represented.
  10871. It accepts the following values:
  10872. @table @samp
  10873. @item line
  10874. @item bar
  10875. @item dot
  10876. @end table
  10877. Default is @code{bar}.
  10878. @item ascale
  10879. Set amplitude scale.
  10880. It accepts the following values:
  10881. @table @samp
  10882. @item lin
  10883. Linear scale.
  10884. @item sqrt
  10885. Square root scale.
  10886. @item cbrt
  10887. Cubic root scale.
  10888. @item log
  10889. Logarithmic scale.
  10890. @end table
  10891. Default is @code{log}.
  10892. @item fscale
  10893. Set frequency scale.
  10894. It accepts the following values:
  10895. @table @samp
  10896. @item lin
  10897. Linear scale.
  10898. @item log
  10899. Logarithmic scale.
  10900. @item rlog
  10901. Reverse logarithmic scale.
  10902. @end table
  10903. Default is @code{lin}.
  10904. @item win_size
  10905. Set window size.
  10906. It accepts the following values:
  10907. @table @samp
  10908. @item w16
  10909. @item w32
  10910. @item w64
  10911. @item w128
  10912. @item w256
  10913. @item w512
  10914. @item w1024
  10915. @item w2048
  10916. @item w4096
  10917. @item w8192
  10918. @item w16384
  10919. @item w32768
  10920. @item w65536
  10921. @end table
  10922. Default is @code{w2048}
  10923. @item win_func
  10924. Set windowing function.
  10925. It accepts the following values:
  10926. @table @samp
  10927. @item rect
  10928. @item bartlett
  10929. @item hanning
  10930. @item hamming
  10931. @item blackman
  10932. @item welch
  10933. @item flattop
  10934. @item bharris
  10935. @item bnuttall
  10936. @item bhann
  10937. @item sine
  10938. @item nuttall
  10939. @item lanczos
  10940. @item gauss
  10941. @end table
  10942. Default is @code{hanning}.
  10943. @item overlap
  10944. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  10945. which means optimal overlap for selected window function will be picked.
  10946. @item averaging
  10947. Set time averaging. Setting this to 0 will display current maximal peaks.
  10948. Default is @code{1}, which means time averaging is disabled.
  10949. @item colors
  10950. Specify list of colors separated by space or by '|' which will be used to
  10951. draw channel frequencies. Unrecognized or missing colors will be replaced
  10952. by white color.
  10953. @end table
  10954. @section showspectrum
  10955. Convert input audio to a video output, representing the audio frequency
  10956. spectrum.
  10957. The filter accepts the following options:
  10958. @table @option
  10959. @item size, s
  10960. Specify the video size for the output. For the syntax of this option, check the
  10961. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10962. Default value is @code{640x512}.
  10963. @item slide
  10964. Specify how the spectrum should slide along the window.
  10965. It accepts the following values:
  10966. @table @samp
  10967. @item replace
  10968. the samples start again on the left when they reach the right
  10969. @item scroll
  10970. the samples scroll from right to left
  10971. @item fullframe
  10972. frames are only produced when the samples reach the right
  10973. @end table
  10974. Default value is @code{replace}.
  10975. @item mode
  10976. Specify display mode.
  10977. It accepts the following values:
  10978. @table @samp
  10979. @item combined
  10980. all channels are displayed in the same row
  10981. @item separate
  10982. all channels are displayed in separate rows
  10983. @end table
  10984. Default value is @samp{combined}.
  10985. @item color
  10986. Specify display color mode.
  10987. It accepts the following values:
  10988. @table @samp
  10989. @item channel
  10990. each channel is displayed in a separate color
  10991. @item intensity
  10992. each channel is is displayed using the same color scheme
  10993. @end table
  10994. Default value is @samp{channel}.
  10995. @item scale
  10996. Specify scale used for calculating intensity color values.
  10997. It accepts the following values:
  10998. @table @samp
  10999. @item lin
  11000. linear
  11001. @item sqrt
  11002. square root, default
  11003. @item cbrt
  11004. cubic root
  11005. @item log
  11006. logarithmic
  11007. @end table
  11008. Default value is @samp{sqrt}.
  11009. @item saturation
  11010. Set saturation modifier for displayed colors. Negative values provide
  11011. alternative color scheme. @code{0} is no saturation at all.
  11012. Saturation must be in [-10.0, 10.0] range.
  11013. Default value is @code{1}.
  11014. @item win_func
  11015. Set window function.
  11016. It accepts the following values:
  11017. @table @samp
  11018. @item none
  11019. No samples pre-processing (do not expect this to be faster)
  11020. @item hann
  11021. Hann window
  11022. @item hamming
  11023. Hamming window
  11024. @item blackman
  11025. Blackman window
  11026. @end table
  11027. Default value is @code{hann}.
  11028. @end table
  11029. The usage is very similar to the showwaves filter; see the examples in that
  11030. section.
  11031. @subsection Examples
  11032. @itemize
  11033. @item
  11034. Large window with logarithmic color scaling:
  11035. @example
  11036. showspectrum=s=1280x480:scale=log
  11037. @end example
  11038. @item
  11039. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  11040. @example
  11041. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11042. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  11043. @end example
  11044. @end itemize
  11045. @section showvolume
  11046. Convert input audio volume to a video output.
  11047. The filter accepts the following options:
  11048. @table @option
  11049. @item rate, r
  11050. Set video rate.
  11051. @item b
  11052. Set border width, allowed range is [0, 5]. Default is 1.
  11053. @item w
  11054. Set channel width, allowed range is [80, 1080]. Default is 400.
  11055. @item h
  11056. Set channel height, allowed range is [1, 100]. Default is 20.
  11057. @item f
  11058. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  11059. @item c
  11060. Set volume color expression.
  11061. The expression can use the following variables:
  11062. @table @option
  11063. @item VOLUME
  11064. Current max volume of channel in dB.
  11065. @item CHANNEL
  11066. Current channel number, starting from 0.
  11067. @end table
  11068. @item t
  11069. If set, displays channel names. Default is enabled.
  11070. @item v
  11071. If set, displays volume values. Default is enabled.
  11072. @end table
  11073. @section showwaves
  11074. Convert input audio to a video output, representing the samples waves.
  11075. The filter accepts the following options:
  11076. @table @option
  11077. @item size, s
  11078. Specify the video size for the output. For the syntax of this option, check the
  11079. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11080. Default value is @code{600x240}.
  11081. @item mode
  11082. Set display mode.
  11083. Available values are:
  11084. @table @samp
  11085. @item point
  11086. Draw a point for each sample.
  11087. @item line
  11088. Draw a vertical line for each sample.
  11089. @item p2p
  11090. Draw a point for each sample and a line between them.
  11091. @item cline
  11092. Draw a centered vertical line for each sample.
  11093. @end table
  11094. Default value is @code{point}.
  11095. @item n
  11096. Set the number of samples which are printed on the same column. A
  11097. larger value will decrease the frame rate. Must be a positive
  11098. integer. This option can be set only if the value for @var{rate}
  11099. is not explicitly specified.
  11100. @item rate, r
  11101. Set the (approximate) output frame rate. This is done by setting the
  11102. option @var{n}. Default value is "25".
  11103. @item split_channels
  11104. Set if channels should be drawn separately or overlap. Default value is 0.
  11105. @end table
  11106. @subsection Examples
  11107. @itemize
  11108. @item
  11109. Output the input file audio and the corresponding video representation
  11110. at the same time:
  11111. @example
  11112. amovie=a.mp3,asplit[out0],showwaves[out1]
  11113. @end example
  11114. @item
  11115. Create a synthetic signal and show it with showwaves, forcing a
  11116. frame rate of 30 frames per second:
  11117. @example
  11118. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  11119. @end example
  11120. @end itemize
  11121. @section showwavespic
  11122. Convert input audio to a single video frame, representing the samples waves.
  11123. The filter accepts the following options:
  11124. @table @option
  11125. @item size, s
  11126. Specify the video size for the output. For the syntax of this option, check the
  11127. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11128. Default value is @code{600x240}.
  11129. @item split_channels
  11130. Set if channels should be drawn separately or overlap. Default value is 0.
  11131. @end table
  11132. @subsection Examples
  11133. @itemize
  11134. @item
  11135. Extract a channel split representation of the wave form of a whole audio track
  11136. in a 1024x800 picture using @command{ffmpeg}:
  11137. @example
  11138. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  11139. @end example
  11140. @end itemize
  11141. @section split, asplit
  11142. Split input into several identical outputs.
  11143. @code{asplit} works with audio input, @code{split} with video.
  11144. The filter accepts a single parameter which specifies the number of outputs. If
  11145. unspecified, it defaults to 2.
  11146. @subsection Examples
  11147. @itemize
  11148. @item
  11149. Create two separate outputs from the same input:
  11150. @example
  11151. [in] split [out0][out1]
  11152. @end example
  11153. @item
  11154. To create 3 or more outputs, you need to specify the number of
  11155. outputs, like in:
  11156. @example
  11157. [in] asplit=3 [out0][out1][out2]
  11158. @end example
  11159. @item
  11160. Create two separate outputs from the same input, one cropped and
  11161. one padded:
  11162. @example
  11163. [in] split [splitout1][splitout2];
  11164. [splitout1] crop=100:100:0:0 [cropout];
  11165. [splitout2] pad=200:200:100:100 [padout];
  11166. @end example
  11167. @item
  11168. Create 5 copies of the input audio with @command{ffmpeg}:
  11169. @example
  11170. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  11171. @end example
  11172. @end itemize
  11173. @section zmq, azmq
  11174. Receive commands sent through a libzmq client, and forward them to
  11175. filters in the filtergraph.
  11176. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  11177. must be inserted between two video filters, @code{azmq} between two
  11178. audio filters.
  11179. To enable these filters you need to install the libzmq library and
  11180. headers and configure FFmpeg with @code{--enable-libzmq}.
  11181. For more information about libzmq see:
  11182. @url{http://www.zeromq.org/}
  11183. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  11184. receives messages sent through a network interface defined by the
  11185. @option{bind_address} option.
  11186. The received message must be in the form:
  11187. @example
  11188. @var{TARGET} @var{COMMAND} [@var{ARG}]
  11189. @end example
  11190. @var{TARGET} specifies the target of the command, usually the name of
  11191. the filter class or a specific filter instance name.
  11192. @var{COMMAND} specifies the name of the command for the target filter.
  11193. @var{ARG} is optional and specifies the optional argument list for the
  11194. given @var{COMMAND}.
  11195. Upon reception, the message is processed and the corresponding command
  11196. is injected into the filtergraph. Depending on the result, the filter
  11197. will send a reply to the client, adopting the format:
  11198. @example
  11199. @var{ERROR_CODE} @var{ERROR_REASON}
  11200. @var{MESSAGE}
  11201. @end example
  11202. @var{MESSAGE} is optional.
  11203. @subsection Examples
  11204. Look at @file{tools/zmqsend} for an example of a zmq client which can
  11205. be used to send commands processed by these filters.
  11206. Consider the following filtergraph generated by @command{ffplay}
  11207. @example
  11208. ffplay -dumpgraph 1 -f lavfi "
  11209. color=s=100x100:c=red [l];
  11210. color=s=100x100:c=blue [r];
  11211. nullsrc=s=200x100, zmq [bg];
  11212. [bg][l] overlay [bg+l];
  11213. [bg+l][r] overlay=x=100 "
  11214. @end example
  11215. To change the color of the left side of the video, the following
  11216. command can be used:
  11217. @example
  11218. echo Parsed_color_0 c yellow | tools/zmqsend
  11219. @end example
  11220. To change the right side:
  11221. @example
  11222. echo Parsed_color_1 c pink | tools/zmqsend
  11223. @end example
  11224. @c man end MULTIMEDIA FILTERS
  11225. @chapter Multimedia Sources
  11226. @c man begin MULTIMEDIA SOURCES
  11227. Below is a description of the currently available multimedia sources.
  11228. @section amovie
  11229. This is the same as @ref{movie} source, except it selects an audio
  11230. stream by default.
  11231. @anchor{movie}
  11232. @section movie
  11233. Read audio and/or video stream(s) from a movie container.
  11234. It accepts the following parameters:
  11235. @table @option
  11236. @item filename
  11237. The name of the resource to read (not necessarily a file; it can also be a
  11238. device or a stream accessed through some protocol).
  11239. @item format_name, f
  11240. Specifies the format assumed for the movie to read, and can be either
  11241. the name of a container or an input device. If not specified, the
  11242. format is guessed from @var{movie_name} or by probing.
  11243. @item seek_point, sp
  11244. Specifies the seek point in seconds. The frames will be output
  11245. starting from this seek point. The parameter is evaluated with
  11246. @code{av_strtod}, so the numerical value may be suffixed by an IS
  11247. postfix. The default value is "0".
  11248. @item streams, s
  11249. Specifies the streams to read. Several streams can be specified,
  11250. separated by "+". The source will then have as many outputs, in the
  11251. same order. The syntax is explained in the ``Stream specifiers''
  11252. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  11253. respectively the default (best suited) video and audio stream. Default
  11254. is "dv", or "da" if the filter is called as "amovie".
  11255. @item stream_index, si
  11256. Specifies the index of the video stream to read. If the value is -1,
  11257. the most suitable video stream will be automatically selected. The default
  11258. value is "-1". Deprecated. If the filter is called "amovie", it will select
  11259. audio instead of video.
  11260. @item loop
  11261. Specifies how many times to read the stream in sequence.
  11262. If the value is less than 1, the stream will be read again and again.
  11263. Default value is "1".
  11264. Note that when the movie is looped the source timestamps are not
  11265. changed, so it will generate non monotonically increasing timestamps.
  11266. @end table
  11267. It allows overlaying a second video on top of the main input of
  11268. a filtergraph, as shown in this graph:
  11269. @example
  11270. input -----------> deltapts0 --> overlay --> output
  11271. ^
  11272. |
  11273. movie --> scale--> deltapts1 -------+
  11274. @end example
  11275. @subsection Examples
  11276. @itemize
  11277. @item
  11278. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  11279. on top of the input labelled "in":
  11280. @example
  11281. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11282. [in] setpts=PTS-STARTPTS [main];
  11283. [main][over] overlay=16:16 [out]
  11284. @end example
  11285. @item
  11286. Read from a video4linux2 device, and overlay it on top of the input
  11287. labelled "in":
  11288. @example
  11289. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11290. [in] setpts=PTS-STARTPTS [main];
  11291. [main][over] overlay=16:16 [out]
  11292. @end example
  11293. @item
  11294. Read the first video stream and the audio stream with id 0x81 from
  11295. dvd.vob; the video is connected to the pad named "video" and the audio is
  11296. connected to the pad named "audio":
  11297. @example
  11298. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  11299. @end example
  11300. @end itemize
  11301. @c man end MULTIMEDIA SOURCES