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.

17006 lines
456KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program.
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section adelay
  353. Delay one or more audio channels.
  354. Samples in delayed channel are filled with silence.
  355. The filter accepts the following option:
  356. @table @option
  357. @item delays
  358. Set list of delays in milliseconds for each channel separated by '|'.
  359. At least one delay greater than 0 should be provided.
  360. Unused delays will be silently ignored. If number of given delays is
  361. smaller than number of channels all remaining channels will not be delayed.
  362. @end table
  363. @subsection Examples
  364. @itemize
  365. @item
  366. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  367. the second channel (and any other channels that may be present) unchanged.
  368. @example
  369. adelay=1500|0|500
  370. @end example
  371. @end itemize
  372. @section aecho
  373. Apply echoing to the input audio.
  374. Echoes are reflected sound and can occur naturally amongst mountains
  375. (and sometimes large buildings) when talking or shouting; digital echo
  376. effects emulate this behaviour and are often used to help fill out the
  377. sound of a single instrument or vocal. The time difference between the
  378. original signal and the reflection is the @code{delay}, and the
  379. loudness of the reflected signal is the @code{decay}.
  380. Multiple echoes can have different delays and decays.
  381. A description of the accepted parameters follows.
  382. @table @option
  383. @item in_gain
  384. Set input gain of reflected signal. Default is @code{0.6}.
  385. @item out_gain
  386. Set output gain of reflected signal. Default is @code{0.3}.
  387. @item delays
  388. Set list of time intervals in milliseconds between original signal and reflections
  389. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  390. Default is @code{1000}.
  391. @item decays
  392. Set list of loudnesses of reflected signals separated by '|'.
  393. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  394. Default is @code{0.5}.
  395. @end table
  396. @subsection Examples
  397. @itemize
  398. @item
  399. Make it sound as if there are twice as many instruments as are actually playing:
  400. @example
  401. aecho=0.8:0.88:60:0.4
  402. @end example
  403. @item
  404. If delay is very short, then it sound like a (metallic) robot playing music:
  405. @example
  406. aecho=0.8:0.88:6:0.4
  407. @end example
  408. @item
  409. A longer delay will sound like an open air concert in the mountains:
  410. @example
  411. aecho=0.8:0.9:1000:0.3
  412. @end example
  413. @item
  414. Same as above but with one more mountain:
  415. @example
  416. aecho=0.8:0.9:1000|1800:0.3|0.25
  417. @end example
  418. @end itemize
  419. @section aemphasis
  420. Audio emphasis filter creates or restores material directly taken from LPs or
  421. emphased CDs with different filter curves. E.g. to store music on vinyl the
  422. signal has to be altered by a filter first to even out the disadvantages of
  423. this recording medium.
  424. Once the material is played back the inverse filter has to be applied to
  425. restore the distortion of the frequency response.
  426. The filter accepts the following options:
  427. @table @option
  428. @item level_in
  429. Set input gain.
  430. @item level_out
  431. Set output gain.
  432. @item mode
  433. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  434. use @code{production} mode. Default is @code{reproduction} mode.
  435. @item type
  436. Set filter type. Selects medium. Can be one of the following:
  437. @table @option
  438. @item col
  439. select Columbia.
  440. @item emi
  441. select EMI.
  442. @item bsi
  443. select BSI (78RPM).
  444. @item riaa
  445. select RIAA.
  446. @item cd
  447. select Compact Disc (CD).
  448. @item 50fm
  449. select 50µs (FM).
  450. @item 75fm
  451. select 75µs (FM).
  452. @item 50kf
  453. select 50µs (FM-KF).
  454. @item 75kf
  455. select 75µs (FM-KF).
  456. @end table
  457. @end table
  458. @section aeval
  459. Modify an audio signal according to the specified expressions.
  460. This filter accepts one or more expressions (one for each channel),
  461. which are evaluated and used to modify a corresponding audio signal.
  462. It accepts the following parameters:
  463. @table @option
  464. @item exprs
  465. Set the '|'-separated expressions list for each separate channel. If
  466. the number of input channels is greater than the number of
  467. expressions, the last specified expression is used for the remaining
  468. output channels.
  469. @item channel_layout, c
  470. Set output channel layout. If not specified, the channel layout is
  471. specified by the number of expressions. If set to @samp{same}, it will
  472. use by default the same input channel layout.
  473. @end table
  474. Each expression in @var{exprs} can contain the following constants and functions:
  475. @table @option
  476. @item ch
  477. channel number of the current expression
  478. @item n
  479. number of the evaluated sample, starting from 0
  480. @item s
  481. sample rate
  482. @item t
  483. time of the evaluated sample expressed in seconds
  484. @item nb_in_channels
  485. @item nb_out_channels
  486. input and output number of channels
  487. @item val(CH)
  488. the value of input channel with number @var{CH}
  489. @end table
  490. Note: this filter is slow. For faster processing you should use a
  491. dedicated filter.
  492. @subsection Examples
  493. @itemize
  494. @item
  495. Half volume:
  496. @example
  497. aeval=val(ch)/2:c=same
  498. @end example
  499. @item
  500. Invert phase of the second channel:
  501. @example
  502. aeval=val(0)|-val(1)
  503. @end example
  504. @end itemize
  505. @anchor{afade}
  506. @section afade
  507. Apply fade-in/out effect to input audio.
  508. A description of the accepted parameters follows.
  509. @table @option
  510. @item type, t
  511. Specify the effect type, can be either @code{in} for fade-in, or
  512. @code{out} for a fade-out effect. Default is @code{in}.
  513. @item start_sample, ss
  514. Specify the number of the start sample for starting to apply the fade
  515. effect. Default is 0.
  516. @item nb_samples, ns
  517. Specify the number of samples for which the fade effect has to last. At
  518. the end of the fade-in effect the output audio will have the same
  519. volume as the input audio, at the end of the fade-out transition
  520. the output audio will be silence. Default is 44100.
  521. @item start_time, st
  522. Specify the start time of the fade effect. Default is 0.
  523. The value must be specified as a time duration; see
  524. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  525. for the accepted syntax.
  526. If set this option is used instead of @var{start_sample}.
  527. @item duration, d
  528. Specify the duration of the fade effect. See
  529. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  530. for the accepted syntax.
  531. At the end of the fade-in effect the output audio will have the same
  532. volume as the input audio, at the end of the fade-out transition
  533. the output audio will be silence.
  534. By default the duration is determined by @var{nb_samples}.
  535. If set this option is used instead of @var{nb_samples}.
  536. @item curve
  537. Set curve for fade transition.
  538. It accepts the following values:
  539. @table @option
  540. @item tri
  541. select triangular, linear slope (default)
  542. @item qsin
  543. select quarter of sine wave
  544. @item hsin
  545. select half of sine wave
  546. @item esin
  547. select exponential sine wave
  548. @item log
  549. select logarithmic
  550. @item ipar
  551. select inverted parabola
  552. @item qua
  553. select quadratic
  554. @item cub
  555. select cubic
  556. @item squ
  557. select square root
  558. @item cbr
  559. select cubic root
  560. @item par
  561. select parabola
  562. @item exp
  563. select exponential
  564. @item iqsin
  565. select inverted quarter of sine wave
  566. @item ihsin
  567. select inverted half of sine wave
  568. @item dese
  569. select double-exponential seat
  570. @item desi
  571. select double-exponential sigmoid
  572. @end table
  573. @end table
  574. @subsection Examples
  575. @itemize
  576. @item
  577. Fade in first 15 seconds of audio:
  578. @example
  579. afade=t=in:ss=0:d=15
  580. @end example
  581. @item
  582. Fade out last 25 seconds of a 900 seconds audio:
  583. @example
  584. afade=t=out:st=875:d=25
  585. @end example
  586. @end itemize
  587. @section afftfilt
  588. Apply arbitrary expressions to samples in frequency domain.
  589. @table @option
  590. @item real
  591. Set frequency domain real expression for each separate channel separated
  592. by '|'. Default is "1".
  593. If the number of input channels is greater than the number of
  594. expressions, the last specified expression is used for the remaining
  595. output channels.
  596. @item imag
  597. Set frequency domain imaginary expression for each separate channel
  598. separated by '|'. If not set, @var{real} option is used.
  599. Each expression in @var{real} and @var{imag} can contain the following
  600. constants:
  601. @table @option
  602. @item sr
  603. sample rate
  604. @item b
  605. current frequency bin number
  606. @item nb
  607. number of available bins
  608. @item ch
  609. channel number of the current expression
  610. @item chs
  611. number of channels
  612. @item pts
  613. current frame pts
  614. @end table
  615. @item win_size
  616. Set window size.
  617. It accepts the following values:
  618. @table @samp
  619. @item w16
  620. @item w32
  621. @item w64
  622. @item w128
  623. @item w256
  624. @item w512
  625. @item w1024
  626. @item w2048
  627. @item w4096
  628. @item w8192
  629. @item w16384
  630. @item w32768
  631. @item w65536
  632. @end table
  633. Default is @code{w4096}
  634. @item win_func
  635. Set window function. Default is @code{hann}.
  636. @item overlap
  637. Set window overlap. If set to 1, the recommended overlap for selected
  638. window function will be picked. Default is @code{0.75}.
  639. @end table
  640. @subsection Examples
  641. @itemize
  642. @item
  643. Leave almost only low frequencies in audio:
  644. @example
  645. afftfilt="1-clip((b/nb)*b,0,1)"
  646. @end example
  647. @end itemize
  648. @anchor{aformat}
  649. @section aformat
  650. Set output format constraints for the input audio. The framework will
  651. negotiate the most appropriate format to minimize conversions.
  652. It accepts the following parameters:
  653. @table @option
  654. @item sample_fmts
  655. A '|'-separated list of requested sample formats.
  656. @item sample_rates
  657. A '|'-separated list of requested sample rates.
  658. @item channel_layouts
  659. A '|'-separated list of requested channel layouts.
  660. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  661. for the required syntax.
  662. @end table
  663. If a parameter is omitted, all values are allowed.
  664. Force the output to either unsigned 8-bit or signed 16-bit stereo
  665. @example
  666. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  667. @end example
  668. @section agate
  669. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  670. processing reduces disturbing noise between useful signals.
  671. Gating is done by detecting the volume below a chosen level @var{threshold}
  672. and divide it by the factor set with @var{ratio}. The bottom of the noise
  673. floor is set via @var{range}. Because an exact manipulation of the signal
  674. would cause distortion of the waveform the reduction can be levelled over
  675. time. This is done by setting @var{attack} and @var{release}.
  676. @var{attack} determines how long the signal has to fall below the threshold
  677. before any reduction will occur and @var{release} sets the time the signal
  678. has to raise above the threshold to reduce the reduction again.
  679. Shorter signals than the chosen attack time will be left untouched.
  680. @table @option
  681. @item level_in
  682. Set input level before filtering.
  683. Default is 1. Allowed range is from 0.015625 to 64.
  684. @item range
  685. Set the level of gain reduction when the signal is below the threshold.
  686. Default is 0.06125. Allowed range is from 0 to 1.
  687. @item threshold
  688. If a signal rises above this level the gain reduction is released.
  689. Default is 0.125. Allowed range is from 0 to 1.
  690. @item ratio
  691. Set a ratio about which the signal is reduced.
  692. Default is 2. Allowed range is from 1 to 9000.
  693. @item attack
  694. Amount of milliseconds the signal has to rise above the threshold before gain
  695. reduction stops.
  696. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  697. @item release
  698. Amount of milliseconds the signal has to fall below the threshold before the
  699. reduction is increased again. Default is 250 milliseconds.
  700. Allowed range is from 0.01 to 9000.
  701. @item makeup
  702. Set amount of amplification of signal after processing.
  703. Default is 1. Allowed range is from 1 to 64.
  704. @item knee
  705. Curve the sharp knee around the threshold to enter gain reduction more softly.
  706. Default is 2.828427125. Allowed range is from 1 to 8.
  707. @item detection
  708. Choose if exact signal should be taken for detection or an RMS like one.
  709. Default is rms. Can be peak or rms.
  710. @item link
  711. Choose if the average level between all channels or the louder channel affects
  712. the reduction.
  713. Default is average. Can be average or maximum.
  714. @end table
  715. @section alimiter
  716. The limiter prevents input signal from raising over a desired threshold.
  717. This limiter uses lookahead technology to prevent your signal from distorting.
  718. It means that there is a small delay after signal is processed. Keep in mind
  719. that the delay it produces is the attack time you set.
  720. The filter accepts the following options:
  721. @table @option
  722. @item level_in
  723. Set input gain. Default is 1.
  724. @item level_out
  725. Set output gain. Default is 1.
  726. @item limit
  727. Don't let signals above this level pass the limiter. Default is 1.
  728. @item attack
  729. The limiter will reach its attenuation level in this amount of time in
  730. milliseconds. Default is 5 milliseconds.
  731. @item release
  732. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  733. Default is 50 milliseconds.
  734. @item asc
  735. When gain reduction is always needed ASC takes care of releasing to an
  736. average reduction level rather than reaching a reduction of 0 in the release
  737. time.
  738. @item asc_level
  739. Select how much the release time is affected by ASC, 0 means nearly no changes
  740. in release time while 1 produces higher release times.
  741. @item level
  742. Auto level output signal. Default is enabled.
  743. This normalizes audio back to 0dB if enabled.
  744. @end table
  745. Depending on picked setting it is recommended to upsample input 2x or 4x times
  746. with @ref{aresample} before applying this filter.
  747. @section allpass
  748. Apply a two-pole all-pass filter with central frequency (in Hz)
  749. @var{frequency}, and filter-width @var{width}.
  750. An all-pass filter changes the audio's frequency to phase relationship
  751. without changing its frequency to amplitude relationship.
  752. The filter accepts the following options:
  753. @table @option
  754. @item frequency, f
  755. Set frequency in Hz.
  756. @item width_type
  757. Set method to specify band-width of filter.
  758. @table @option
  759. @item h
  760. Hz
  761. @item q
  762. Q-Factor
  763. @item o
  764. octave
  765. @item s
  766. slope
  767. @end table
  768. @item width, w
  769. Specify the band-width of a filter in width_type units.
  770. @end table
  771. @anchor{amerge}
  772. @section amerge
  773. Merge two or more audio streams into a single multi-channel stream.
  774. The filter accepts the following options:
  775. @table @option
  776. @item inputs
  777. Set the number of inputs. Default is 2.
  778. @end table
  779. If the channel layouts of the inputs are disjoint, and therefore compatible,
  780. the channel layout of the output will be set accordingly and the channels
  781. will be reordered as necessary. If the channel layouts of the inputs are not
  782. disjoint, the output will have all the channels of the first input then all
  783. the channels of the second input, in that order, and the channel layout of
  784. the output will be the default value corresponding to the total number of
  785. channels.
  786. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  787. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  788. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  789. first input, b1 is the first channel of the second input).
  790. On the other hand, if both input are in stereo, the output channels will be
  791. in the default order: a1, a2, b1, b2, and the channel layout will be
  792. arbitrarily set to 4.0, which may or may not be the expected value.
  793. All inputs must have the same sample rate, and format.
  794. If inputs do not have the same duration, the output will stop with the
  795. shortest.
  796. @subsection Examples
  797. @itemize
  798. @item
  799. Merge two mono files into a stereo stream:
  800. @example
  801. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  802. @end example
  803. @item
  804. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  805. @example
  806. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  807. @end example
  808. @end itemize
  809. @section amix
  810. Mixes multiple audio inputs into a single output.
  811. Note that this filter only supports float samples (the @var{amerge}
  812. and @var{pan} audio filters support many formats). If the @var{amix}
  813. input has integer samples then @ref{aresample} will be automatically
  814. inserted to perform the conversion to float samples.
  815. For example
  816. @example
  817. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  818. @end example
  819. will mix 3 input audio streams to a single output with the same duration as the
  820. first input and a dropout transition time of 3 seconds.
  821. It accepts the following parameters:
  822. @table @option
  823. @item inputs
  824. The number of inputs. If unspecified, it defaults to 2.
  825. @item duration
  826. How to determine the end-of-stream.
  827. @table @option
  828. @item longest
  829. The duration of the longest input. (default)
  830. @item shortest
  831. The duration of the shortest input.
  832. @item first
  833. The duration of the first input.
  834. @end table
  835. @item dropout_transition
  836. The transition time, in seconds, for volume renormalization when an input
  837. stream ends. The default value is 2 seconds.
  838. @end table
  839. @section anequalizer
  840. High-order parametric multiband equalizer for each channel.
  841. It accepts the following parameters:
  842. @table @option
  843. @item params
  844. This option string is in format:
  845. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  846. Each equalizer band is separated by '|'.
  847. @table @option
  848. @item chn
  849. Set channel number to which equalization will be applied.
  850. If input doesn't have that channel the entry is ignored.
  851. @item cf
  852. Set central frequency for band.
  853. If input doesn't have that frequency the entry is ignored.
  854. @item w
  855. Set band width in hertz.
  856. @item g
  857. Set band gain in dB.
  858. @item f
  859. Set filter type for band, optional, can be:
  860. @table @samp
  861. @item 0
  862. Butterworth, this is default.
  863. @item 1
  864. Chebyshev type 1.
  865. @item 2
  866. Chebyshev type 2.
  867. @end table
  868. @end table
  869. @item curves
  870. With this option activated frequency response of anequalizer is displayed
  871. in video stream.
  872. @item size
  873. Set video stream size. Only useful if curves option is activated.
  874. @item mgain
  875. Set max gain that will be displayed. Only useful if curves option is activated.
  876. Setting this to reasonable value allows to display gain which is derived from
  877. neighbour bands which are too close to each other and thus produce higher gain
  878. when both are activated.
  879. @item fscale
  880. Set frequency scale used to draw frequency response in video output.
  881. Can be linear or logarithmic. Default is logarithmic.
  882. @item colors
  883. Set color for each channel curve which is going to be displayed in video stream.
  884. This is list of color names separated by space or by '|'.
  885. Unrecognised or missing colors will be replaced by white color.
  886. @end table
  887. @subsection Examples
  888. @itemize
  889. @item
  890. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  891. for first 2 channels using Chebyshev type 1 filter:
  892. @example
  893. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  894. @end example
  895. @end itemize
  896. @subsection Commands
  897. This filter supports the following commands:
  898. @table @option
  899. @item change
  900. Alter existing filter parameters.
  901. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  902. @var{fN} is existing filter number, starting from 0, if no such filter is available
  903. error is returned.
  904. @var{freq} set new frequency parameter.
  905. @var{width} set new width parameter in herz.
  906. @var{gain} set new gain parameter in dB.
  907. Full filter invocation with asendcmd may look like this:
  908. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  909. @end table
  910. @section anull
  911. Pass the audio source unchanged to the output.
  912. @section apad
  913. Pad the end of an audio stream with silence.
  914. This can be used together with @command{ffmpeg} @option{-shortest} to
  915. extend audio streams to the same length as the video stream.
  916. A description of the accepted options follows.
  917. @table @option
  918. @item packet_size
  919. Set silence packet size. Default value is 4096.
  920. @item pad_len
  921. Set the number of samples of silence to add to the end. After the
  922. value is reached, the stream is terminated. This option is mutually
  923. exclusive with @option{whole_len}.
  924. @item whole_len
  925. Set the minimum total number of samples in the output audio stream. If
  926. the value is longer than the input audio length, silence is added to
  927. the end, until the value is reached. This option is mutually exclusive
  928. with @option{pad_len}.
  929. @end table
  930. If neither the @option{pad_len} nor the @option{whole_len} option is
  931. set, the filter will add silence to the end of the input stream
  932. indefinitely.
  933. @subsection Examples
  934. @itemize
  935. @item
  936. Add 1024 samples of silence to the end of the input:
  937. @example
  938. apad=pad_len=1024
  939. @end example
  940. @item
  941. Make sure the audio output will contain at least 10000 samples, pad
  942. the input with silence if required:
  943. @example
  944. apad=whole_len=10000
  945. @end example
  946. @item
  947. Use @command{ffmpeg} to pad the audio input with silence, so that the
  948. video stream will always result the shortest and will be converted
  949. until the end in the output file when using the @option{shortest}
  950. option:
  951. @example
  952. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  953. @end example
  954. @end itemize
  955. @section aphaser
  956. Add a phasing effect to the input audio.
  957. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  958. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  959. A description of the accepted parameters follows.
  960. @table @option
  961. @item in_gain
  962. Set input gain. Default is 0.4.
  963. @item out_gain
  964. Set output gain. Default is 0.74
  965. @item delay
  966. Set delay in milliseconds. Default is 3.0.
  967. @item decay
  968. Set decay. Default is 0.4.
  969. @item speed
  970. Set modulation speed in Hz. Default is 0.5.
  971. @item type
  972. Set modulation type. Default is triangular.
  973. It accepts the following values:
  974. @table @samp
  975. @item triangular, t
  976. @item sinusoidal, s
  977. @end table
  978. @end table
  979. @section apulsator
  980. Audio pulsator is something between an autopanner and a tremolo.
  981. But it can produce funny stereo effects as well. Pulsator changes the volume
  982. of the left and right channel based on a LFO (low frequency oscillator) with
  983. different waveforms and shifted phases.
  984. This filter have the ability to define an offset between left and right
  985. channel. An offset of 0 means that both LFO shapes match each other.
  986. The left and right channel are altered equally - a conventional tremolo.
  987. An offset of 50% means that the shape of the right channel is exactly shifted
  988. in phase (or moved backwards about half of the frequency) - pulsator acts as
  989. an autopanner. At 1 both curves match again. Every setting in between moves the
  990. phase shift gapless between all stages and produces some "bypassing" sounds with
  991. sine and triangle waveforms. The more you set the offset near 1 (starting from
  992. the 0.5) the faster the signal passes from the left to the right speaker.
  993. The filter accepts the following options:
  994. @table @option
  995. @item level_in
  996. Set input gain. By default it is 1. Range is [0.015625 - 64].
  997. @item level_out
  998. Set output gain. By default it is 1. Range is [0.015625 - 64].
  999. @item mode
  1000. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1001. sawup or sawdown. Default is sine.
  1002. @item amount
  1003. Set modulation. Define how much of original signal is affected by the LFO.
  1004. @item offset_l
  1005. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1006. @item offset_r
  1007. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1008. @item width
  1009. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1010. @item timing
  1011. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1012. @item bpm
  1013. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1014. is set to bpm.
  1015. @item ms
  1016. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1017. is set to ms.
  1018. @item hz
  1019. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1020. if timing is set to hz.
  1021. @end table
  1022. @anchor{aresample}
  1023. @section aresample
  1024. Resample the input audio to the specified parameters, using the
  1025. libswresample library. If none are specified then the filter will
  1026. automatically convert between its input and output.
  1027. This filter is also able to stretch/squeeze the audio data to make it match
  1028. the timestamps or to inject silence / cut out audio to make it match the
  1029. timestamps, do a combination of both or do neither.
  1030. The filter accepts the syntax
  1031. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1032. expresses a sample rate and @var{resampler_options} is a list of
  1033. @var{key}=@var{value} pairs, separated by ":". See the
  1034. ffmpeg-resampler manual for the complete list of supported options.
  1035. @subsection Examples
  1036. @itemize
  1037. @item
  1038. Resample the input audio to 44100Hz:
  1039. @example
  1040. aresample=44100
  1041. @end example
  1042. @item
  1043. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1044. samples per second compensation:
  1045. @example
  1046. aresample=async=1000
  1047. @end example
  1048. @end itemize
  1049. @section asetnsamples
  1050. Set the number of samples per each output audio frame.
  1051. The last output packet may contain a different number of samples, as
  1052. the filter will flush all the remaining samples when the input audio
  1053. signal its end.
  1054. The filter accepts the following options:
  1055. @table @option
  1056. @item nb_out_samples, n
  1057. Set the number of frames per each output audio frame. The number is
  1058. intended as the number of samples @emph{per each channel}.
  1059. Default value is 1024.
  1060. @item pad, p
  1061. If set to 1, the filter will pad the last audio frame with zeroes, so
  1062. that the last frame will contain the same number of samples as the
  1063. previous ones. Default value is 1.
  1064. @end table
  1065. For example, to set the number of per-frame samples to 1234 and
  1066. disable padding for the last frame, use:
  1067. @example
  1068. asetnsamples=n=1234:p=0
  1069. @end example
  1070. @section asetrate
  1071. Set the sample rate without altering the PCM data.
  1072. This will result in a change of speed and pitch.
  1073. The filter accepts the following options:
  1074. @table @option
  1075. @item sample_rate, r
  1076. Set the output sample rate. Default is 44100 Hz.
  1077. @end table
  1078. @section ashowinfo
  1079. Show a line containing various information for each input audio frame.
  1080. The input audio is not modified.
  1081. The shown line contains a sequence of key/value pairs of the form
  1082. @var{key}:@var{value}.
  1083. The following values are shown in the output:
  1084. @table @option
  1085. @item n
  1086. The (sequential) number of the input frame, starting from 0.
  1087. @item pts
  1088. The presentation timestamp of the input frame, in time base units; the time base
  1089. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1090. @item pts_time
  1091. The presentation timestamp of the input frame in seconds.
  1092. @item pos
  1093. position of the frame in the input stream, -1 if this information in
  1094. unavailable and/or meaningless (for example in case of synthetic audio)
  1095. @item fmt
  1096. The sample format.
  1097. @item chlayout
  1098. The channel layout.
  1099. @item rate
  1100. The sample rate for the audio frame.
  1101. @item nb_samples
  1102. The number of samples (per channel) in the frame.
  1103. @item checksum
  1104. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1105. audio, the data is treated as if all the planes were concatenated.
  1106. @item plane_checksums
  1107. A list of Adler-32 checksums for each data plane.
  1108. @end table
  1109. @anchor{astats}
  1110. @section astats
  1111. Display time domain statistical information about the audio channels.
  1112. Statistics are calculated and displayed for each audio channel and,
  1113. where applicable, an overall figure is also given.
  1114. It accepts the following option:
  1115. @table @option
  1116. @item length
  1117. Short window length in seconds, used for peak and trough RMS measurement.
  1118. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1119. @item metadata
  1120. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1121. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1122. disabled.
  1123. Available keys for each channel are:
  1124. DC_offset
  1125. Min_level
  1126. Max_level
  1127. Min_difference
  1128. Max_difference
  1129. Mean_difference
  1130. Peak_level
  1131. RMS_peak
  1132. RMS_trough
  1133. Crest_factor
  1134. Flat_factor
  1135. Peak_count
  1136. Bit_depth
  1137. and for Overall:
  1138. DC_offset
  1139. Min_level
  1140. Max_level
  1141. Min_difference
  1142. Max_difference
  1143. Mean_difference
  1144. Peak_level
  1145. RMS_level
  1146. RMS_peak
  1147. RMS_trough
  1148. Flat_factor
  1149. Peak_count
  1150. Bit_depth
  1151. Number_of_samples
  1152. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1153. this @code{lavfi.astats.Overall.Peak_count}.
  1154. For description what each key means read below.
  1155. @item reset
  1156. Set number of frame after which stats are going to be recalculated.
  1157. Default is disabled.
  1158. @end table
  1159. A description of each shown parameter follows:
  1160. @table @option
  1161. @item DC offset
  1162. Mean amplitude displacement from zero.
  1163. @item Min level
  1164. Minimal sample level.
  1165. @item Max level
  1166. Maximal sample level.
  1167. @item Min difference
  1168. Minimal difference between two consecutive samples.
  1169. @item Max difference
  1170. Maximal difference between two consecutive samples.
  1171. @item Mean difference
  1172. Mean difference between two consecutive samples.
  1173. The average of each difference between two consecutive samples.
  1174. @item Peak level dB
  1175. @item RMS level dB
  1176. Standard peak and RMS level measured in dBFS.
  1177. @item RMS peak dB
  1178. @item RMS trough dB
  1179. Peak and trough values for RMS level measured over a short window.
  1180. @item Crest factor
  1181. Standard ratio of peak to RMS level (note: not in dB).
  1182. @item Flat factor
  1183. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1184. (i.e. either @var{Min level} or @var{Max level}).
  1185. @item Peak count
  1186. Number of occasions (not the number of samples) that the signal attained either
  1187. @var{Min level} or @var{Max level}.
  1188. @item Bit depth
  1189. Overall bit depth of audio. Number of bits used for each sample.
  1190. @end table
  1191. @section asyncts
  1192. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1193. dropping samples/adding silence when needed.
  1194. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1195. It accepts the following parameters:
  1196. @table @option
  1197. @item compensate
  1198. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1199. by default. When disabled, time gaps are covered with silence.
  1200. @item min_delta
  1201. The minimum difference between timestamps and audio data (in seconds) to trigger
  1202. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1203. sync with this filter, try setting this parameter to 0.
  1204. @item max_comp
  1205. The maximum compensation in samples per second. Only relevant with compensate=1.
  1206. The default value is 500.
  1207. @item first_pts
  1208. Assume that the first PTS should be this value. The time base is 1 / sample
  1209. rate. This allows for padding/trimming at the start of the stream. By default,
  1210. no assumption is made about the first frame's expected PTS, so no padding or
  1211. trimming is done. For example, this could be set to 0 to pad the beginning with
  1212. silence if an audio stream starts after the video stream or to trim any samples
  1213. with a negative PTS due to encoder delay.
  1214. @end table
  1215. @section atempo
  1216. Adjust audio tempo.
  1217. The filter accepts exactly one parameter, the audio tempo. If not
  1218. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1219. be in the [0.5, 2.0] range.
  1220. @subsection Examples
  1221. @itemize
  1222. @item
  1223. Slow down audio to 80% tempo:
  1224. @example
  1225. atempo=0.8
  1226. @end example
  1227. @item
  1228. To speed up audio to 125% tempo:
  1229. @example
  1230. atempo=1.25
  1231. @end example
  1232. @end itemize
  1233. @section atrim
  1234. Trim the input so that the output contains one continuous subpart of the input.
  1235. It accepts the following parameters:
  1236. @table @option
  1237. @item start
  1238. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1239. sample with the timestamp @var{start} will be the first sample in the output.
  1240. @item end
  1241. Specify time of the first audio sample that will be dropped, i.e. the
  1242. audio sample immediately preceding the one with the timestamp @var{end} will be
  1243. the last sample in the output.
  1244. @item start_pts
  1245. Same as @var{start}, except this option sets the start timestamp in samples
  1246. instead of seconds.
  1247. @item end_pts
  1248. Same as @var{end}, except this option sets the end timestamp in samples instead
  1249. of seconds.
  1250. @item duration
  1251. The maximum duration of the output in seconds.
  1252. @item start_sample
  1253. The number of the first sample that should be output.
  1254. @item end_sample
  1255. The number of the first sample that should be dropped.
  1256. @end table
  1257. @option{start}, @option{end}, and @option{duration} are expressed as time
  1258. duration specifications; see
  1259. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1260. Note that the first two sets of the start/end options and the @option{duration}
  1261. option look at the frame timestamp, while the _sample options simply count the
  1262. samples that pass through the filter. So start/end_pts and start/end_sample will
  1263. give different results when the timestamps are wrong, inexact or do not start at
  1264. zero. Also note that this filter does not modify the timestamps. If you wish
  1265. to have the output timestamps start at zero, insert the asetpts filter after the
  1266. atrim filter.
  1267. If multiple start or end options are set, this filter tries to be greedy and
  1268. keep all samples that match at least one of the specified constraints. To keep
  1269. only the part that matches all the constraints at once, chain multiple atrim
  1270. filters.
  1271. The defaults are such that all the input is kept. So it is possible to set e.g.
  1272. just the end values to keep everything before the specified time.
  1273. Examples:
  1274. @itemize
  1275. @item
  1276. Drop everything except the second minute of input:
  1277. @example
  1278. ffmpeg -i INPUT -af atrim=60:120
  1279. @end example
  1280. @item
  1281. Keep only the first 1000 samples:
  1282. @example
  1283. ffmpeg -i INPUT -af atrim=end_sample=1000
  1284. @end example
  1285. @end itemize
  1286. @section bandpass
  1287. Apply a two-pole Butterworth band-pass filter with central
  1288. frequency @var{frequency}, and (3dB-point) band-width width.
  1289. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1290. instead of the default: constant 0dB peak gain.
  1291. The filter roll off at 6dB per octave (20dB per decade).
  1292. The filter accepts the following options:
  1293. @table @option
  1294. @item frequency, f
  1295. Set the filter's central frequency. Default is @code{3000}.
  1296. @item csg
  1297. Constant skirt gain if set to 1. Defaults to 0.
  1298. @item width_type
  1299. Set method to specify band-width of filter.
  1300. @table @option
  1301. @item h
  1302. Hz
  1303. @item q
  1304. Q-Factor
  1305. @item o
  1306. octave
  1307. @item s
  1308. slope
  1309. @end table
  1310. @item width, w
  1311. Specify the band-width of a filter in width_type units.
  1312. @end table
  1313. @section bandreject
  1314. Apply a two-pole Butterworth band-reject filter with central
  1315. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1316. The filter roll off at 6dB per octave (20dB per decade).
  1317. The filter accepts the following options:
  1318. @table @option
  1319. @item frequency, f
  1320. Set the filter's central frequency. Default is @code{3000}.
  1321. @item width_type
  1322. Set method to specify band-width of filter.
  1323. @table @option
  1324. @item h
  1325. Hz
  1326. @item q
  1327. Q-Factor
  1328. @item o
  1329. octave
  1330. @item s
  1331. slope
  1332. @end table
  1333. @item width, w
  1334. Specify the band-width of a filter in width_type units.
  1335. @end table
  1336. @section bass
  1337. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1338. shelving filter with a response similar to that of a standard
  1339. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1340. The filter accepts the following options:
  1341. @table @option
  1342. @item gain, g
  1343. Give the gain at 0 Hz. Its useful range is about -20
  1344. (for a large cut) to +20 (for a large boost).
  1345. Beware of clipping when using a positive gain.
  1346. @item frequency, f
  1347. Set the filter's central frequency and so can be used
  1348. to extend or reduce the frequency range to be boosted or cut.
  1349. The default value is @code{100} Hz.
  1350. @item width_type
  1351. Set method to specify band-width of filter.
  1352. @table @option
  1353. @item h
  1354. Hz
  1355. @item q
  1356. Q-Factor
  1357. @item o
  1358. octave
  1359. @item s
  1360. slope
  1361. @end table
  1362. @item width, w
  1363. Determine how steep is the filter's shelf transition.
  1364. @end table
  1365. @section biquad
  1366. Apply a biquad IIR filter with the given coefficients.
  1367. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1368. are the numerator and denominator coefficients respectively.
  1369. @section bs2b
  1370. Bauer stereo to binaural transformation, which improves headphone listening of
  1371. stereo audio records.
  1372. It accepts the following parameters:
  1373. @table @option
  1374. @item profile
  1375. Pre-defined crossfeed level.
  1376. @table @option
  1377. @item default
  1378. Default level (fcut=700, feed=50).
  1379. @item cmoy
  1380. Chu Moy circuit (fcut=700, feed=60).
  1381. @item jmeier
  1382. Jan Meier circuit (fcut=650, feed=95).
  1383. @end table
  1384. @item fcut
  1385. Cut frequency (in Hz).
  1386. @item feed
  1387. Feed level (in Hz).
  1388. @end table
  1389. @section channelmap
  1390. Remap input channels to new locations.
  1391. It accepts the following parameters:
  1392. @table @option
  1393. @item channel_layout
  1394. The channel layout of the output stream.
  1395. @item map
  1396. Map channels from input to output. The argument is a '|'-separated list of
  1397. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1398. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1399. channel (e.g. FL for front left) or its index in the input channel layout.
  1400. @var{out_channel} is the name of the output channel or its index in the output
  1401. channel layout. If @var{out_channel} is not given then it is implicitly an
  1402. index, starting with zero and increasing by one for each mapping.
  1403. @end table
  1404. If no mapping is present, the filter will implicitly map input channels to
  1405. output channels, preserving indices.
  1406. For example, assuming a 5.1+downmix input MOV file,
  1407. @example
  1408. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1409. @end example
  1410. will create an output WAV file tagged as stereo from the downmix channels of
  1411. the input.
  1412. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1413. @example
  1414. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1415. @end example
  1416. @section channelsplit
  1417. Split each channel from an input audio stream into a separate output stream.
  1418. It accepts the following parameters:
  1419. @table @option
  1420. @item channel_layout
  1421. The channel layout of the input stream. The default is "stereo".
  1422. @end table
  1423. For example, assuming a stereo input MP3 file,
  1424. @example
  1425. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1426. @end example
  1427. will create an output Matroska file with two audio streams, one containing only
  1428. the left channel and the other the right channel.
  1429. Split a 5.1 WAV file into per-channel files:
  1430. @example
  1431. ffmpeg -i in.wav -filter_complex
  1432. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1433. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1434. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1435. side_right.wav
  1436. @end example
  1437. @section chorus
  1438. Add a chorus effect to the audio.
  1439. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1440. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1441. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1442. The modulation depth defines the range the modulated delay is played before or after
  1443. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1444. sound tuned around the original one, like in a chorus where some vocals are slightly
  1445. off key.
  1446. It accepts the following parameters:
  1447. @table @option
  1448. @item in_gain
  1449. Set input gain. Default is 0.4.
  1450. @item out_gain
  1451. Set output gain. Default is 0.4.
  1452. @item delays
  1453. Set delays. A typical delay is around 40ms to 60ms.
  1454. @item decays
  1455. Set decays.
  1456. @item speeds
  1457. Set speeds.
  1458. @item depths
  1459. Set depths.
  1460. @end table
  1461. @subsection Examples
  1462. @itemize
  1463. @item
  1464. A single delay:
  1465. @example
  1466. chorus=0.7:0.9:55:0.4:0.25:2
  1467. @end example
  1468. @item
  1469. Two delays:
  1470. @example
  1471. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1472. @end example
  1473. @item
  1474. Fuller sounding chorus with three delays:
  1475. @example
  1476. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  1477. @end example
  1478. @end itemize
  1479. @section compand
  1480. Compress or expand the audio's dynamic range.
  1481. It accepts the following parameters:
  1482. @table @option
  1483. @item attacks
  1484. @item decays
  1485. A list of times in seconds for each channel over which the instantaneous level
  1486. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1487. increase of volume and @var{decays} refers to decrease of volume. For most
  1488. situations, the attack time (response to the audio getting louder) should be
  1489. shorter than the decay time, because the human ear is more sensitive to sudden
  1490. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1491. a typical value for decay is 0.8 seconds.
  1492. If specified number of attacks & decays is lower than number of channels, the last
  1493. set attack/decay will be used for all remaining channels.
  1494. @item points
  1495. A list of points for the transfer function, specified in dB relative to the
  1496. maximum possible signal amplitude. Each key points list must be defined using
  1497. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1498. @code{x0/y0 x1/y1 x2/y2 ....}
  1499. The input values must be in strictly increasing order but the transfer function
  1500. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1501. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1502. function are @code{-70/-70|-60/-20}.
  1503. @item soft-knee
  1504. Set the curve radius in dB for all joints. It defaults to 0.01.
  1505. @item gain
  1506. Set the additional gain in dB to be applied at all points on the transfer
  1507. function. This allows for easy adjustment of the overall gain.
  1508. It defaults to 0.
  1509. @item volume
  1510. Set an initial volume, in dB, to be assumed for each channel when filtering
  1511. starts. This permits the user to supply a nominal level initially, so that, for
  1512. example, a very large gain is not applied to initial signal levels before the
  1513. companding has begun to operate. A typical value for audio which is initially
  1514. quiet is -90 dB. It defaults to 0.
  1515. @item delay
  1516. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1517. delayed before being fed to the volume adjuster. Specifying a delay
  1518. approximately equal to the attack/decay times allows the filter to effectively
  1519. operate in predictive rather than reactive mode. It defaults to 0.
  1520. @end table
  1521. @subsection Examples
  1522. @itemize
  1523. @item
  1524. Make music with both quiet and loud passages suitable for listening to in a
  1525. noisy environment:
  1526. @example
  1527. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1528. @end example
  1529. Another example for audio with whisper and explosion parts:
  1530. @example
  1531. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1532. @end example
  1533. @item
  1534. A noise gate for when the noise is at a lower level than the signal:
  1535. @example
  1536. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1537. @end example
  1538. @item
  1539. Here is another noise gate, this time for when the noise is at a higher level
  1540. than the signal (making it, in some ways, similar to squelch):
  1541. @example
  1542. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1543. @end example
  1544. @item
  1545. 2:1 compression starting at -6dB:
  1546. @example
  1547. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1548. @end example
  1549. @item
  1550. 2:1 compression starting at -9dB:
  1551. @example
  1552. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1553. @end example
  1554. @item
  1555. 2:1 compression starting at -12dB:
  1556. @example
  1557. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1558. @end example
  1559. @item
  1560. 2:1 compression starting at -18dB:
  1561. @example
  1562. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1563. @end example
  1564. @item
  1565. 3:1 compression starting at -15dB:
  1566. @example
  1567. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1568. @end example
  1569. @item
  1570. Compressor/Gate:
  1571. @example
  1572. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1573. @end example
  1574. @item
  1575. Expander:
  1576. @example
  1577. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  1578. @end example
  1579. @item
  1580. Hard limiter at -6dB:
  1581. @example
  1582. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1583. @end example
  1584. @item
  1585. Hard limiter at -12dB:
  1586. @example
  1587. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1588. @end example
  1589. @item
  1590. Hard noise gate at -35 dB:
  1591. @example
  1592. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1593. @end example
  1594. @item
  1595. Soft limiter:
  1596. @example
  1597. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1598. @end example
  1599. @end itemize
  1600. @section compensationdelay
  1601. Compensation Delay Line is a metric based delay to compensate differing
  1602. positions of microphones or speakers.
  1603. For example, you have recorded guitar with two microphones placed in
  1604. different location. Because the front of sound wave has fixed speed in
  1605. normal conditions, the phasing of microphones can vary and depends on
  1606. their location and interposition. The best sound mix can be achieved when
  1607. these microphones are in phase (synchronized). Note that distance of
  1608. ~30 cm between microphones makes one microphone to capture signal in
  1609. antiphase to another microphone. That makes the final mix sounding moody.
  1610. This filter helps to solve phasing problems by adding different delays
  1611. to each microphone track and make them synchronized.
  1612. The best result can be reached when you take one track as base and
  1613. synchronize other tracks one by one with it.
  1614. Remember that synchronization/delay tolerance depends on sample rate, too.
  1615. Higher sample rates will give more tolerance.
  1616. It accepts the following parameters:
  1617. @table @option
  1618. @item mm
  1619. Set millimeters distance. This is compensation distance for fine tuning.
  1620. Default is 0.
  1621. @item cm
  1622. Set cm distance. This is compensation distance for tightening distance setup.
  1623. Default is 0.
  1624. @item m
  1625. Set meters distance. This is compensation distance for hard distance setup.
  1626. Default is 0.
  1627. @item dry
  1628. Set dry amount. Amount of unprocessed (dry) signal.
  1629. Default is 0.
  1630. @item wet
  1631. Set wet amount. Amount of processed (wet) signal.
  1632. Default is 1.
  1633. @item temp
  1634. Set temperature degree in Celsius. This is the temperature of the environment.
  1635. Default is 20.
  1636. @end table
  1637. @section dcshift
  1638. Apply a DC shift to the audio.
  1639. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1640. in the recording chain) from the audio. The effect of a DC offset is reduced
  1641. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1642. a signal has a DC offset.
  1643. @table @option
  1644. @item shift
  1645. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1646. the audio.
  1647. @item limitergain
  1648. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1649. used to prevent clipping.
  1650. @end table
  1651. @section dynaudnorm
  1652. Dynamic Audio Normalizer.
  1653. This filter applies a certain amount of gain to the input audio in order
  1654. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1655. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1656. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1657. This allows for applying extra gain to the "quiet" sections of the audio
  1658. while avoiding distortions or clipping the "loud" sections. In other words:
  1659. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1660. sections, in the sense that the volume of each section is brought to the
  1661. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1662. this goal *without* applying "dynamic range compressing". It will retain 100%
  1663. of the dynamic range *within* each section of the audio file.
  1664. @table @option
  1665. @item f
  1666. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1667. Default is 500 milliseconds.
  1668. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1669. referred to as frames. This is required, because a peak magnitude has no
  1670. meaning for just a single sample value. Instead, we need to determine the
  1671. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1672. normalizer would simply use the peak magnitude of the complete file, the
  1673. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1674. frame. The length of a frame is specified in milliseconds. By default, the
  1675. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1676. been found to give good results with most files.
  1677. Note that the exact frame length, in number of samples, will be determined
  1678. automatically, based on the sampling rate of the individual input audio file.
  1679. @item g
  1680. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1681. number. Default is 31.
  1682. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1683. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1684. is specified in frames, centered around the current frame. For the sake of
  1685. simplicity, this must be an odd number. Consequently, the default value of 31
  1686. takes into account the current frame, as well as the 15 preceding frames and
  1687. the 15 subsequent frames. Using a larger window results in a stronger
  1688. smoothing effect and thus in less gain variation, i.e. slower gain
  1689. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1690. effect and thus in more gain variation, i.e. faster gain adaptation.
  1691. In other words, the more you increase this value, the more the Dynamic Audio
  1692. Normalizer will behave like a "traditional" normalization filter. On the
  1693. contrary, the more you decrease this value, the more the Dynamic Audio
  1694. Normalizer will behave like a dynamic range compressor.
  1695. @item p
  1696. Set the target peak value. This specifies the highest permissible magnitude
  1697. level for the normalized audio input. This filter will try to approach the
  1698. target peak magnitude as closely as possible, but at the same time it also
  1699. makes sure that the normalized signal will never exceed the peak magnitude.
  1700. A frame's maximum local gain factor is imposed directly by the target peak
  1701. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1702. It is not recommended to go above this value.
  1703. @item m
  1704. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1705. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1706. factor for each input frame, i.e. the maximum gain factor that does not
  1707. result in clipping or distortion. The maximum gain factor is determined by
  1708. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1709. additionally bounds the frame's maximum gain factor by a predetermined
  1710. (global) maximum gain factor. This is done in order to avoid excessive gain
  1711. factors in "silent" or almost silent frames. By default, the maximum gain
  1712. factor is 10.0, For most inputs the default value should be sufficient and
  1713. it usually is not recommended to increase this value. Though, for input
  1714. with an extremely low overall volume level, it may be necessary to allow even
  1715. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1716. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1717. Instead, a "sigmoid" threshold function will be applied. This way, the
  1718. gain factors will smoothly approach the threshold value, but never exceed that
  1719. value.
  1720. @item r
  1721. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1722. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1723. This means that the maximum local gain factor for each frame is defined
  1724. (only) by the frame's highest magnitude sample. This way, the samples can
  1725. be amplified as much as possible without exceeding the maximum signal
  1726. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1727. Normalizer can also take into account the frame's root mean square,
  1728. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1729. determine the power of a time-varying signal. It is therefore considered
  1730. that the RMS is a better approximation of the "perceived loudness" than
  1731. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1732. frames to a constant RMS value, a uniform "perceived loudness" can be
  1733. established. If a target RMS value has been specified, a frame's local gain
  1734. factor is defined as the factor that would result in exactly that RMS value.
  1735. Note, however, that the maximum local gain factor is still restricted by the
  1736. frame's highest magnitude sample, in order to prevent clipping.
  1737. @item n
  1738. Enable channels coupling. By default is enabled.
  1739. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1740. amount. This means the same gain factor will be applied to all channels, i.e.
  1741. the maximum possible gain factor is determined by the "loudest" channel.
  1742. However, in some recordings, it may happen that the volume of the different
  1743. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1744. In this case, this option can be used to disable the channel coupling. This way,
  1745. the gain factor will be determined independently for each channel, depending
  1746. only on the individual channel's highest magnitude sample. This allows for
  1747. harmonizing the volume of the different channels.
  1748. @item c
  1749. Enable DC bias correction. By default is disabled.
  1750. An audio signal (in the time domain) is a sequence of sample values.
  1751. In the Dynamic Audio Normalizer these sample values are represented in the
  1752. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1753. audio signal, or "waveform", should be centered around the zero point.
  1754. That means if we calculate the mean value of all samples in a file, or in a
  1755. single frame, then the result should be 0.0 or at least very close to that
  1756. value. If, however, there is a significant deviation of the mean value from
  1757. 0.0, in either positive or negative direction, this is referred to as a
  1758. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1759. Audio Normalizer provides optional DC bias correction.
  1760. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1761. the mean value, or "DC correction" offset, of each input frame and subtract
  1762. that value from all of the frame's sample values which ensures those samples
  1763. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1764. boundaries, the DC correction offset values will be interpolated smoothly
  1765. between neighbouring frames.
  1766. @item b
  1767. Enable alternative boundary mode. By default is disabled.
  1768. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1769. around each frame. This includes the preceding frames as well as the
  1770. subsequent frames. However, for the "boundary" frames, located at the very
  1771. beginning and at the very end of the audio file, not all neighbouring
  1772. frames are available. In particular, for the first few frames in the audio
  1773. file, the preceding frames are not known. And, similarly, for the last few
  1774. frames in the audio file, the subsequent frames are not known. Thus, the
  1775. question arises which gain factors should be assumed for the missing frames
  1776. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1777. to deal with this situation. The default boundary mode assumes a gain factor
  1778. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1779. "fade out" at the beginning and at the end of the input, respectively.
  1780. @item s
  1781. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1782. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1783. compression. This means that signal peaks will not be pruned and thus the
  1784. full dynamic range will be retained within each local neighbourhood. However,
  1785. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1786. normalization algorithm with a more "traditional" compression.
  1787. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1788. (thresholding) function. If (and only if) the compression feature is enabled,
  1789. all input frames will be processed by a soft knee thresholding function prior
  1790. to the actual normalization process. Put simply, the thresholding function is
  1791. going to prune all samples whose magnitude exceeds a certain threshold value.
  1792. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1793. value. Instead, the threshold value will be adjusted for each individual
  1794. frame.
  1795. In general, smaller parameters result in stronger compression, and vice versa.
  1796. Values below 3.0 are not recommended, because audible distortion may appear.
  1797. @end table
  1798. @section earwax
  1799. Make audio easier to listen to on headphones.
  1800. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1801. so that when listened to on headphones the stereo image is moved from
  1802. inside your head (standard for headphones) to outside and in front of
  1803. the listener (standard for speakers).
  1804. Ported from SoX.
  1805. @section equalizer
  1806. Apply a two-pole peaking equalisation (EQ) filter. With this
  1807. filter, the signal-level at and around a selected frequency can
  1808. be increased or decreased, whilst (unlike bandpass and bandreject
  1809. filters) that at all other frequencies is unchanged.
  1810. In order to produce complex equalisation curves, this filter can
  1811. be given several times, each with a different central frequency.
  1812. The filter accepts the following options:
  1813. @table @option
  1814. @item frequency, f
  1815. Set the filter's central frequency in Hz.
  1816. @item width_type
  1817. Set method to specify band-width of filter.
  1818. @table @option
  1819. @item h
  1820. Hz
  1821. @item q
  1822. Q-Factor
  1823. @item o
  1824. octave
  1825. @item s
  1826. slope
  1827. @end table
  1828. @item width, w
  1829. Specify the band-width of a filter in width_type units.
  1830. @item gain, g
  1831. Set the required gain or attenuation in dB.
  1832. Beware of clipping when using a positive gain.
  1833. @end table
  1834. @subsection Examples
  1835. @itemize
  1836. @item
  1837. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1838. @example
  1839. equalizer=f=1000:width_type=h:width=200:g=-10
  1840. @end example
  1841. @item
  1842. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1843. @example
  1844. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1845. @end example
  1846. @end itemize
  1847. @section extrastereo
  1848. Linearly increases the difference between left and right channels which
  1849. adds some sort of "live" effect to playback.
  1850. The filter accepts the following option:
  1851. @table @option
  1852. @item m
  1853. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1854. (average of both channels), with 1.0 sound will be unchanged, with
  1855. -1.0 left and right channels will be swapped.
  1856. @item c
  1857. Enable clipping. By default is enabled.
  1858. @end table
  1859. @section firequalizer
  1860. Apply FIR Equalization using arbitrary frequency response.
  1861. The filter accepts the following option:
  1862. @table @option
  1863. @item gain
  1864. Set gain curve equation (in dB). The expression can contain variables:
  1865. @table @option
  1866. @item f
  1867. the evaluated frequency
  1868. @item sr
  1869. sample rate
  1870. @item ch
  1871. channel number, set to 0 when multichannels evaluation is disabled
  1872. @item chid
  1873. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1874. multichannels evaluation is disabled
  1875. @item chs
  1876. number of channels
  1877. @item chlayout
  1878. channel_layout, see libavutil/channel_layout.h
  1879. @end table
  1880. and functions:
  1881. @table @option
  1882. @item gain_interpolate(f)
  1883. interpolate gain on frequency f based on gain_entry
  1884. @end table
  1885. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1886. @item gain_entry
  1887. Set gain entry for gain_interpolate function. The expression can
  1888. contain functions:
  1889. @table @option
  1890. @item entry(f, g)
  1891. store gain entry at frequency f with value g
  1892. @end table
  1893. This option is also available as command.
  1894. @item delay
  1895. Set filter delay in seconds. Higher value means more accurate.
  1896. Default is @code{0.01}.
  1897. @item accuracy
  1898. Set filter accuracy in Hz. Lower value means more accurate.
  1899. Default is @code{5}.
  1900. @item wfunc
  1901. Set window function. Acceptable values are:
  1902. @table @option
  1903. @item rectangular
  1904. rectangular window, useful when gain curve is already smooth
  1905. @item hann
  1906. hann window (default)
  1907. @item hamming
  1908. hamming window
  1909. @item blackman
  1910. blackman window
  1911. @item nuttall3
  1912. 3-terms continuous 1st derivative nuttall window
  1913. @item mnuttall3
  1914. minimum 3-terms discontinuous nuttall window
  1915. @item nuttall
  1916. 4-terms continuous 1st derivative nuttall window
  1917. @item bnuttall
  1918. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  1919. @item bharris
  1920. blackman-harris window
  1921. @end table
  1922. @item fixed
  1923. If enabled, use fixed number of audio samples. This improves speed when
  1924. filtering with large delay. Default is disabled.
  1925. @item multi
  1926. Enable multichannels evaluation on gain. Default is disabled.
  1927. @end table
  1928. @subsection Examples
  1929. @itemize
  1930. @item
  1931. lowpass at 1000 Hz:
  1932. @example
  1933. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  1934. @end example
  1935. @item
  1936. lowpass at 1000 Hz with gain_entry:
  1937. @example
  1938. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  1939. @end example
  1940. @item
  1941. custom equalization:
  1942. @example
  1943. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  1944. @end example
  1945. @item
  1946. higher delay:
  1947. @example
  1948. firequalizer=delay=0.1:fixed=on
  1949. @end example
  1950. @item
  1951. lowpass on left channel, highpass on right channel:
  1952. @example
  1953. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  1954. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  1955. @end example
  1956. @end itemize
  1957. @section flanger
  1958. Apply a flanging effect to the audio.
  1959. The filter accepts the following options:
  1960. @table @option
  1961. @item delay
  1962. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1963. @item depth
  1964. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1965. @item regen
  1966. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1967. Default value is 0.
  1968. @item width
  1969. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1970. Default value is 71.
  1971. @item speed
  1972. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1973. @item shape
  1974. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1975. Default value is @var{sinusoidal}.
  1976. @item phase
  1977. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1978. Default value is 25.
  1979. @item interp
  1980. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1981. Default is @var{linear}.
  1982. @end table
  1983. @section highpass
  1984. Apply a high-pass filter with 3dB point frequency.
  1985. The filter can be either single-pole, or double-pole (the default).
  1986. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1987. The filter accepts the following options:
  1988. @table @option
  1989. @item frequency, f
  1990. Set frequency in Hz. Default is 3000.
  1991. @item poles, p
  1992. Set number of poles. Default is 2.
  1993. @item width_type
  1994. Set method to specify band-width of filter.
  1995. @table @option
  1996. @item h
  1997. Hz
  1998. @item q
  1999. Q-Factor
  2000. @item o
  2001. octave
  2002. @item s
  2003. slope
  2004. @end table
  2005. @item width, w
  2006. Specify the band-width of a filter in width_type units.
  2007. Applies only to double-pole filter.
  2008. The default is 0.707q and gives a Butterworth response.
  2009. @end table
  2010. @section join
  2011. Join multiple input streams into one multi-channel stream.
  2012. It accepts the following parameters:
  2013. @table @option
  2014. @item inputs
  2015. The number of input streams. It defaults to 2.
  2016. @item channel_layout
  2017. The desired output channel layout. It defaults to stereo.
  2018. @item map
  2019. Map channels from inputs to output. The argument is a '|'-separated list of
  2020. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2021. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2022. can be either the name of the input channel (e.g. FL for front left) or its
  2023. index in the specified input stream. @var{out_channel} is the name of the output
  2024. channel.
  2025. @end table
  2026. The filter will attempt to guess the mappings when they are not specified
  2027. explicitly. It does so by first trying to find an unused matching input channel
  2028. and if that fails it picks the first unused input channel.
  2029. Join 3 inputs (with properly set channel layouts):
  2030. @example
  2031. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2032. @end example
  2033. Build a 5.1 output from 6 single-channel streams:
  2034. @example
  2035. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2036. 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
  2037. out
  2038. @end example
  2039. @section ladspa
  2040. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2041. To enable compilation of this filter you need to configure FFmpeg with
  2042. @code{--enable-ladspa}.
  2043. @table @option
  2044. @item file, f
  2045. Specifies the name of LADSPA plugin library to load. If the environment
  2046. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2047. each one of the directories specified by the colon separated list in
  2048. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2049. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2050. @file{/usr/lib/ladspa/}.
  2051. @item plugin, p
  2052. Specifies the plugin within the library. Some libraries contain only
  2053. one plugin, but others contain many of them. If this is not set filter
  2054. will list all available plugins within the specified library.
  2055. @item controls, c
  2056. Set the '|' separated list of controls which are zero or more floating point
  2057. values that determine the behavior of the loaded plugin (for example delay,
  2058. threshold or gain).
  2059. Controls need to be defined using the following syntax:
  2060. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2061. @var{valuei} is the value set on the @var{i}-th control.
  2062. Alternatively they can be also defined using the following syntax:
  2063. @var{value0}|@var{value1}|@var{value2}|..., where
  2064. @var{valuei} is the value set on the @var{i}-th control.
  2065. If @option{controls} is set to @code{help}, all available controls and
  2066. their valid ranges are printed.
  2067. @item sample_rate, s
  2068. Specify the sample rate, default to 44100. Only used if plugin have
  2069. zero inputs.
  2070. @item nb_samples, n
  2071. Set the number of samples per channel per each output frame, default
  2072. is 1024. Only used if plugin have zero inputs.
  2073. @item duration, d
  2074. Set the minimum duration of the sourced audio. See
  2075. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2076. for the accepted syntax.
  2077. Note that the resulting duration may be greater than the specified duration,
  2078. as the generated audio is always cut at the end of a complete frame.
  2079. If not specified, or the expressed duration is negative, the audio is
  2080. supposed to be generated forever.
  2081. Only used if plugin have zero inputs.
  2082. @end table
  2083. @subsection Examples
  2084. @itemize
  2085. @item
  2086. List all available plugins within amp (LADSPA example plugin) library:
  2087. @example
  2088. ladspa=file=amp
  2089. @end example
  2090. @item
  2091. List all available controls and their valid ranges for @code{vcf_notch}
  2092. plugin from @code{VCF} library:
  2093. @example
  2094. ladspa=f=vcf:p=vcf_notch:c=help
  2095. @end example
  2096. @item
  2097. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2098. plugin library:
  2099. @example
  2100. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2101. @end example
  2102. @item
  2103. Add reverberation to the audio using TAP-plugins
  2104. (Tom's Audio Processing plugins):
  2105. @example
  2106. ladspa=file=tap_reverb:tap_reverb
  2107. @end example
  2108. @item
  2109. Generate white noise, with 0.2 amplitude:
  2110. @example
  2111. ladspa=file=cmt:noise_source_white:c=c0=.2
  2112. @end example
  2113. @item
  2114. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2115. @code{C* Audio Plugin Suite} (CAPS) library:
  2116. @example
  2117. ladspa=file=caps:Click:c=c1=20'
  2118. @end example
  2119. @item
  2120. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2121. @example
  2122. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2123. @end example
  2124. @item
  2125. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2126. @code{SWH Plugins} collection:
  2127. @example
  2128. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2129. @end example
  2130. @item
  2131. Attenuate low frequencies using Multiband EQ from Steve Harris
  2132. @code{SWH Plugins} collection:
  2133. @example
  2134. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2135. @end example
  2136. @end itemize
  2137. @subsection Commands
  2138. This filter supports the following commands:
  2139. @table @option
  2140. @item cN
  2141. Modify the @var{N}-th control value.
  2142. If the specified value is not valid, it is ignored and prior one is kept.
  2143. @end table
  2144. @section loudnorm
  2145. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2146. Support for both single pass (livestreams, files) and double pass (files) modes.
  2147. This algorithm can target IL, LRA, and maximum true peak.
  2148. To enable compilation of this filter you need to configure FFmpeg with
  2149. @code{--enable-libebur128}.
  2150. The filter accepts the following options:
  2151. @table @option
  2152. @item I, i
  2153. Set integrated loudness target.
  2154. Range is -70.0 - -5.0. Default value is -24.0.
  2155. @item LRA, lra
  2156. Set loudness range target.
  2157. Range is 1.0 - 20.0. Default value is 7.0.
  2158. @item TP, tp
  2159. Set maximum true peak.
  2160. Range is -9.0 - +0.0. Default value is -2.0.
  2161. @item measured_I, measured_i
  2162. Measured IL of input file.
  2163. Range is -99.0 - +0.0.
  2164. @item measured_LRA, measured_lra
  2165. Measured LRA of input file.
  2166. Range is 0.0 - 99.0.
  2167. @item measured_TP, measured_tp
  2168. Measured true peak of input file.
  2169. Range is -99.0 - +99.0.
  2170. @item measured_thresh
  2171. Measured threshold of input file.
  2172. Range is -99.0 - +0.0.
  2173. @item offset
  2174. Set offset gain. Gain is applied before the true-peak limiter.
  2175. Range is -99.0 - +99.0. Default is +0.0.
  2176. @item linear
  2177. Normalize linearly if possible.
  2178. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2179. to be specified in order to use this mode.
  2180. Options are true or false. Default is true.
  2181. @item print_format
  2182. Set print format for stats. Options are summary, json, or none.
  2183. Default value is none.
  2184. @end table
  2185. @section lowpass
  2186. Apply a low-pass filter with 3dB point frequency.
  2187. The filter can be either single-pole or double-pole (the default).
  2188. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2189. The filter accepts the following options:
  2190. @table @option
  2191. @item frequency, f
  2192. Set frequency in Hz. Default is 500.
  2193. @item poles, p
  2194. Set number of poles. Default is 2.
  2195. @item width_type
  2196. Set method to specify band-width of filter.
  2197. @table @option
  2198. @item h
  2199. Hz
  2200. @item q
  2201. Q-Factor
  2202. @item o
  2203. octave
  2204. @item s
  2205. slope
  2206. @end table
  2207. @item width, w
  2208. Specify the band-width of a filter in width_type units.
  2209. Applies only to double-pole filter.
  2210. The default is 0.707q and gives a Butterworth response.
  2211. @end table
  2212. @anchor{pan}
  2213. @section pan
  2214. Mix channels with specific gain levels. The filter accepts the output
  2215. channel layout followed by a set of channels definitions.
  2216. This filter is also designed to efficiently remap the channels of an audio
  2217. stream.
  2218. The filter accepts parameters of the form:
  2219. "@var{l}|@var{outdef}|@var{outdef}|..."
  2220. @table @option
  2221. @item l
  2222. output channel layout or number of channels
  2223. @item outdef
  2224. output channel specification, of the form:
  2225. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2226. @item out_name
  2227. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2228. number (c0, c1, etc.)
  2229. @item gain
  2230. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2231. @item in_name
  2232. input channel to use, see out_name for details; it is not possible to mix
  2233. named and numbered input channels
  2234. @end table
  2235. If the `=' in a channel specification is replaced by `<', then the gains for
  2236. that specification will be renormalized so that the total is 1, thus
  2237. avoiding clipping noise.
  2238. @subsection Mixing examples
  2239. For example, if you want to down-mix from stereo to mono, but with a bigger
  2240. factor for the left channel:
  2241. @example
  2242. pan=1c|c0=0.9*c0+0.1*c1
  2243. @end example
  2244. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2245. 7-channels surround:
  2246. @example
  2247. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2248. @end example
  2249. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2250. that should be preferred (see "-ac" option) unless you have very specific
  2251. needs.
  2252. @subsection Remapping examples
  2253. The channel remapping will be effective if, and only if:
  2254. @itemize
  2255. @item gain coefficients are zeroes or ones,
  2256. @item only one input per channel output,
  2257. @end itemize
  2258. If all these conditions are satisfied, the filter will notify the user ("Pure
  2259. channel mapping detected"), and use an optimized and lossless method to do the
  2260. remapping.
  2261. For example, if you have a 5.1 source and want a stereo audio stream by
  2262. dropping the extra channels:
  2263. @example
  2264. pan="stereo| c0=FL | c1=FR"
  2265. @end example
  2266. Given the same source, you can also switch front left and front right channels
  2267. and keep the input channel layout:
  2268. @example
  2269. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2270. @end example
  2271. If the input is a stereo audio stream, you can mute the front left channel (and
  2272. still keep the stereo channel layout) with:
  2273. @example
  2274. pan="stereo|c1=c1"
  2275. @end example
  2276. Still with a stereo audio stream input, you can copy the right channel in both
  2277. front left and right:
  2278. @example
  2279. pan="stereo| c0=FR | c1=FR"
  2280. @end example
  2281. @section replaygain
  2282. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2283. outputs it unchanged.
  2284. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2285. @section resample
  2286. Convert the audio sample format, sample rate and channel layout. It is
  2287. not meant to be used directly.
  2288. @section rubberband
  2289. Apply time-stretching and pitch-shifting with librubberband.
  2290. The filter accepts the following options:
  2291. @table @option
  2292. @item tempo
  2293. Set tempo scale factor.
  2294. @item pitch
  2295. Set pitch scale factor.
  2296. @item transients
  2297. Set transients detector.
  2298. Possible values are:
  2299. @table @var
  2300. @item crisp
  2301. @item mixed
  2302. @item smooth
  2303. @end table
  2304. @item detector
  2305. Set detector.
  2306. Possible values are:
  2307. @table @var
  2308. @item compound
  2309. @item percussive
  2310. @item soft
  2311. @end table
  2312. @item phase
  2313. Set phase.
  2314. Possible values are:
  2315. @table @var
  2316. @item laminar
  2317. @item independent
  2318. @end table
  2319. @item window
  2320. Set processing window size.
  2321. Possible values are:
  2322. @table @var
  2323. @item standard
  2324. @item short
  2325. @item long
  2326. @end table
  2327. @item smoothing
  2328. Set smoothing.
  2329. Possible values are:
  2330. @table @var
  2331. @item off
  2332. @item on
  2333. @end table
  2334. @item formant
  2335. Enable formant preservation when shift pitching.
  2336. Possible values are:
  2337. @table @var
  2338. @item shifted
  2339. @item preserved
  2340. @end table
  2341. @item pitchq
  2342. Set pitch quality.
  2343. Possible values are:
  2344. @table @var
  2345. @item quality
  2346. @item speed
  2347. @item consistency
  2348. @end table
  2349. @item channels
  2350. Set channels.
  2351. Possible values are:
  2352. @table @var
  2353. @item apart
  2354. @item together
  2355. @end table
  2356. @end table
  2357. @section sidechaincompress
  2358. This filter acts like normal compressor but has the ability to compress
  2359. detected signal using second input signal.
  2360. It needs two input streams and returns one output stream.
  2361. First input stream will be processed depending on second stream signal.
  2362. The filtered signal then can be filtered with other filters in later stages of
  2363. processing. See @ref{pan} and @ref{amerge} filter.
  2364. The filter accepts the following options:
  2365. @table @option
  2366. @item level_in
  2367. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2368. @item threshold
  2369. If a signal of second stream raises above this level it will affect the gain
  2370. reduction of first stream.
  2371. By default is 0.125. Range is between 0.00097563 and 1.
  2372. @item ratio
  2373. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2374. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2375. Default is 2. Range is between 1 and 20.
  2376. @item attack
  2377. Amount of milliseconds the signal has to rise above the threshold before gain
  2378. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2379. @item release
  2380. Amount of milliseconds the signal has to fall below the threshold before
  2381. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2382. @item makeup
  2383. Set the amount by how much signal will be amplified after processing.
  2384. Default is 2. Range is from 1 and 64.
  2385. @item knee
  2386. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2387. Default is 2.82843. Range is between 1 and 8.
  2388. @item link
  2389. Choose if the @code{average} level between all channels of side-chain stream
  2390. or the louder(@code{maximum}) channel of side-chain stream affects the
  2391. reduction. Default is @code{average}.
  2392. @item detection
  2393. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2394. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2395. @item level_sc
  2396. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2397. @item mix
  2398. How much to use compressed signal in output. Default is 1.
  2399. Range is between 0 and 1.
  2400. @end table
  2401. @subsection Examples
  2402. @itemize
  2403. @item
  2404. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2405. depending on the signal of 2nd input and later compressed signal to be
  2406. merged with 2nd input:
  2407. @example
  2408. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2409. @end example
  2410. @end itemize
  2411. @section sidechaingate
  2412. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2413. filter the detected signal before sending it to the gain reduction stage.
  2414. Normally a gate uses the full range signal to detect a level above the
  2415. threshold.
  2416. For example: If you cut all lower frequencies from your sidechain signal
  2417. the gate will decrease the volume of your track only if not enough highs
  2418. appear. With this technique you are able to reduce the resonation of a
  2419. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2420. guitar.
  2421. It needs two input streams and returns one output stream.
  2422. First input stream will be processed depending on second stream signal.
  2423. The filter accepts the following options:
  2424. @table @option
  2425. @item level_in
  2426. Set input level before filtering.
  2427. Default is 1. Allowed range is from 0.015625 to 64.
  2428. @item range
  2429. Set the level of gain reduction when the signal is below the threshold.
  2430. Default is 0.06125. Allowed range is from 0 to 1.
  2431. @item threshold
  2432. If a signal rises above this level the gain reduction is released.
  2433. Default is 0.125. Allowed range is from 0 to 1.
  2434. @item ratio
  2435. Set a ratio about which the signal is reduced.
  2436. Default is 2. Allowed range is from 1 to 9000.
  2437. @item attack
  2438. Amount of milliseconds the signal has to rise above the threshold before gain
  2439. reduction stops.
  2440. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2441. @item release
  2442. Amount of milliseconds the signal has to fall below the threshold before the
  2443. reduction is increased again. Default is 250 milliseconds.
  2444. Allowed range is from 0.01 to 9000.
  2445. @item makeup
  2446. Set amount of amplification of signal after processing.
  2447. Default is 1. Allowed range is from 1 to 64.
  2448. @item knee
  2449. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2450. Default is 2.828427125. Allowed range is from 1 to 8.
  2451. @item detection
  2452. Choose if exact signal should be taken for detection or an RMS like one.
  2453. Default is rms. Can be peak or rms.
  2454. @item link
  2455. Choose if the average level between all channels or the louder channel affects
  2456. the reduction.
  2457. Default is average. Can be average or maximum.
  2458. @item level_sc
  2459. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2460. @end table
  2461. @section silencedetect
  2462. Detect silence in an audio stream.
  2463. This filter logs a message when it detects that the input audio volume is less
  2464. or equal to a noise tolerance value for a duration greater or equal to the
  2465. minimum detected noise duration.
  2466. The printed times and duration are expressed in seconds.
  2467. The filter accepts the following options:
  2468. @table @option
  2469. @item duration, d
  2470. Set silence duration until notification (default is 2 seconds).
  2471. @item noise, n
  2472. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2473. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2474. @end table
  2475. @subsection Examples
  2476. @itemize
  2477. @item
  2478. Detect 5 seconds of silence with -50dB noise tolerance:
  2479. @example
  2480. silencedetect=n=-50dB:d=5
  2481. @end example
  2482. @item
  2483. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2484. tolerance in @file{silence.mp3}:
  2485. @example
  2486. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2487. @end example
  2488. @end itemize
  2489. @section silenceremove
  2490. Remove silence from the beginning, middle or end of the audio.
  2491. The filter accepts the following options:
  2492. @table @option
  2493. @item start_periods
  2494. This value is used to indicate if audio should be trimmed at beginning of
  2495. the audio. A value of zero indicates no silence should be trimmed from the
  2496. beginning. When specifying a non-zero value, it trims audio up until it
  2497. finds non-silence. Normally, when trimming silence from beginning of audio
  2498. the @var{start_periods} will be @code{1} but it can be increased to higher
  2499. values to trim all audio up to specific count of non-silence periods.
  2500. Default value is @code{0}.
  2501. @item start_duration
  2502. Specify the amount of time that non-silence must be detected before it stops
  2503. trimming audio. By increasing the duration, bursts of noises can be treated
  2504. as silence and trimmed off. Default value is @code{0}.
  2505. @item start_threshold
  2506. This indicates what sample value should be treated as silence. For digital
  2507. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2508. you may wish to increase the value to account for background noise.
  2509. Can be specified in dB (in case "dB" is appended to the specified value)
  2510. or amplitude ratio. Default value is @code{0}.
  2511. @item stop_periods
  2512. Set the count for trimming silence from the end of audio.
  2513. To remove silence from the middle of a file, specify a @var{stop_periods}
  2514. that is negative. This value is then treated as a positive value and is
  2515. used to indicate the effect should restart processing as specified by
  2516. @var{start_periods}, making it suitable for removing periods of silence
  2517. in the middle of the audio.
  2518. Default value is @code{0}.
  2519. @item stop_duration
  2520. Specify a duration of silence that must exist before audio is not copied any
  2521. more. By specifying a higher duration, silence that is wanted can be left in
  2522. the audio.
  2523. Default value is @code{0}.
  2524. @item stop_threshold
  2525. This is the same as @option{start_threshold} but for trimming silence from
  2526. the end of audio.
  2527. Can be specified in dB (in case "dB" is appended to the specified value)
  2528. or amplitude ratio. Default value is @code{0}.
  2529. @item leave_silence
  2530. This indicate that @var{stop_duration} length of audio should be left intact
  2531. at the beginning of each period of silence.
  2532. For example, if you want to remove long pauses between words but do not want
  2533. to remove the pauses completely. Default value is @code{0}.
  2534. @item detection
  2535. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2536. and works better with digital silence which is exactly 0.
  2537. Default value is @code{rms}.
  2538. @item window
  2539. Set ratio used to calculate size of window for detecting silence.
  2540. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2541. @end table
  2542. @subsection Examples
  2543. @itemize
  2544. @item
  2545. The following example shows how this filter can be used to start a recording
  2546. that does not contain the delay at the start which usually occurs between
  2547. pressing the record button and the start of the performance:
  2548. @example
  2549. silenceremove=1:5:0.02
  2550. @end example
  2551. @item
  2552. Trim all silence encountered from begining to end where there is more than 1
  2553. second of silence in audio:
  2554. @example
  2555. silenceremove=0:0:0:-1:1:-90dB
  2556. @end example
  2557. @end itemize
  2558. @section sofalizer
  2559. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2560. loudspeakers around the user for binaural listening via headphones (audio
  2561. formats up to 9 channels supported).
  2562. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2563. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2564. Austrian Academy of Sciences.
  2565. To enable compilation of this filter you need to configure FFmpeg with
  2566. @code{--enable-netcdf}.
  2567. The filter accepts the following options:
  2568. @table @option
  2569. @item sofa
  2570. Set the SOFA file used for rendering.
  2571. @item gain
  2572. Set gain applied to audio. Value is in dB. Default is 0.
  2573. @item rotation
  2574. Set rotation of virtual loudspeakers in deg. Default is 0.
  2575. @item elevation
  2576. Set elevation of virtual speakers in deg. Default is 0.
  2577. @item radius
  2578. Set distance in meters between loudspeakers and the listener with near-field
  2579. HRTFs. Default is 1.
  2580. @item type
  2581. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2582. processing audio in time domain which is slow.
  2583. @var{freq} is processing audio in frequency domain which is fast.
  2584. Default is @var{freq}.
  2585. @item speakers
  2586. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2587. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2588. Each virtual loudspeaker is described with short channel name following with
  2589. azimuth and elevation in degreees.
  2590. Each virtual loudspeaker description is separated by '|'.
  2591. For example to override front left and front right channel positions use:
  2592. 'speakers=FL 45 15|FR 345 15'.
  2593. Descriptions with unrecognised channel names are ignored.
  2594. @end table
  2595. @subsection Examples
  2596. @itemize
  2597. @item
  2598. Using ClubFritz6 sofa file:
  2599. @example
  2600. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2601. @end example
  2602. @item
  2603. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2604. @example
  2605. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2606. @end example
  2607. @item
  2608. Similar as above but with custom speaker positions for front left, front right, rear left and rear right
  2609. and also with custom gain:
  2610. @example
  2611. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|RL 135|RR 225:gain=28"
  2612. @end example
  2613. @end itemize
  2614. @section stereotools
  2615. This filter has some handy utilities to manage stereo signals, for converting
  2616. M/S stereo recordings to L/R signal while having control over the parameters
  2617. or spreading the stereo image of master track.
  2618. The filter accepts the following options:
  2619. @table @option
  2620. @item level_in
  2621. Set input level before filtering for both channels. Defaults is 1.
  2622. Allowed range is from 0.015625 to 64.
  2623. @item level_out
  2624. Set output level after filtering for both channels. Defaults is 1.
  2625. Allowed range is from 0.015625 to 64.
  2626. @item balance_in
  2627. Set input balance between both channels. Default is 0.
  2628. Allowed range is from -1 to 1.
  2629. @item balance_out
  2630. Set output balance between both channels. Default is 0.
  2631. Allowed range is from -1 to 1.
  2632. @item softclip
  2633. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2634. clipping. Disabled by default.
  2635. @item mutel
  2636. Mute the left channel. Disabled by default.
  2637. @item muter
  2638. Mute the right channel. Disabled by default.
  2639. @item phasel
  2640. Change the phase of the left channel. Disabled by default.
  2641. @item phaser
  2642. Change the phase of the right channel. Disabled by default.
  2643. @item mode
  2644. Set stereo mode. Available values are:
  2645. @table @samp
  2646. @item lr>lr
  2647. Left/Right to Left/Right, this is default.
  2648. @item lr>ms
  2649. Left/Right to Mid/Side.
  2650. @item ms>lr
  2651. Mid/Side to Left/Right.
  2652. @item lr>ll
  2653. Left/Right to Left/Left.
  2654. @item lr>rr
  2655. Left/Right to Right/Right.
  2656. @item lr>l+r
  2657. Left/Right to Left + Right.
  2658. @item lr>rl
  2659. Left/Right to Right/Left.
  2660. @end table
  2661. @item slev
  2662. Set level of side signal. Default is 1.
  2663. Allowed range is from 0.015625 to 64.
  2664. @item sbal
  2665. Set balance of side signal. Default is 0.
  2666. Allowed range is from -1 to 1.
  2667. @item mlev
  2668. Set level of the middle signal. Default is 1.
  2669. Allowed range is from 0.015625 to 64.
  2670. @item mpan
  2671. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2672. @item base
  2673. Set stereo base between mono and inversed channels. Default is 0.
  2674. Allowed range is from -1 to 1.
  2675. @item delay
  2676. Set delay in milliseconds how much to delay left from right channel and
  2677. vice versa. Default is 0. Allowed range is from -20 to 20.
  2678. @item sclevel
  2679. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2680. @item phase
  2681. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2682. @end table
  2683. @subsection Examples
  2684. @itemize
  2685. @item
  2686. Apply karaoke like effect:
  2687. @example
  2688. stereotools=mlev=0.015625
  2689. @end example
  2690. @item
  2691. Convert M/S signal to L/R:
  2692. @example
  2693. "stereotools=mode=ms>lr"
  2694. @end example
  2695. @end itemize
  2696. @section stereowiden
  2697. This filter enhance the stereo effect by suppressing signal common to both
  2698. channels and by delaying the signal of left into right and vice versa,
  2699. thereby widening the stereo effect.
  2700. The filter accepts the following options:
  2701. @table @option
  2702. @item delay
  2703. Time in milliseconds of the delay of left signal into right and vice versa.
  2704. Default is 20 milliseconds.
  2705. @item feedback
  2706. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2707. effect of left signal in right output and vice versa which gives widening
  2708. effect. Default is 0.3.
  2709. @item crossfeed
  2710. Cross feed of left into right with inverted phase. This helps in suppressing
  2711. the mono. If the value is 1 it will cancel all the signal common to both
  2712. channels. Default is 0.3.
  2713. @item drymix
  2714. Set level of input signal of original channel. Default is 0.8.
  2715. @end table
  2716. @section scale_npp
  2717. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  2718. format conversion on CUDA video frames. Setting the output width and height
  2719. works in the same way as for the @var{scale} filter.
  2720. The following additional options are accepted:
  2721. @table @option
  2722. @item format
  2723. The pixel format of the output CUDA frames. If set to the string "same" (the
  2724. default), the input format will be kept. Note that automatic format negotiation
  2725. and conversion is not yet supported for hardware frames
  2726. @item interp_algo
  2727. The interpolation algorithm used for resizing. One of the following:
  2728. @table @option
  2729. @item nn
  2730. Nearest neighbour.
  2731. @item linear
  2732. @item cubic
  2733. @item cubic2p_bspline
  2734. 2-parameter cubic (B=1, C=0)
  2735. @item cubic2p_catmullrom
  2736. 2-parameter cubic (B=0, C=1/2)
  2737. @item cubic2p_b05c03
  2738. 2-parameter cubic (B=1/2, C=3/10)
  2739. @item super
  2740. Supersampling
  2741. @item lanczos
  2742. @end table
  2743. @end table
  2744. @section select
  2745. Select frames to pass in output.
  2746. @section treble
  2747. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2748. shelving filter with a response similar to that of a standard
  2749. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2750. The filter accepts the following options:
  2751. @table @option
  2752. @item gain, g
  2753. Give the gain at whichever is the lower of ~22 kHz and the
  2754. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2755. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2756. @item frequency, f
  2757. Set the filter's central frequency and so can be used
  2758. to extend or reduce the frequency range to be boosted or cut.
  2759. The default value is @code{3000} Hz.
  2760. @item width_type
  2761. Set method to specify band-width of filter.
  2762. @table @option
  2763. @item h
  2764. Hz
  2765. @item q
  2766. Q-Factor
  2767. @item o
  2768. octave
  2769. @item s
  2770. slope
  2771. @end table
  2772. @item width, w
  2773. Determine how steep is the filter's shelf transition.
  2774. @end table
  2775. @section tremolo
  2776. Sinusoidal amplitude modulation.
  2777. The filter accepts the following options:
  2778. @table @option
  2779. @item f
  2780. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2781. (20 Hz or lower) will result in a tremolo effect.
  2782. This filter may also be used as a ring modulator by specifying
  2783. a modulation frequency higher than 20 Hz.
  2784. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2785. @item d
  2786. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2787. Default value is 0.5.
  2788. @end table
  2789. @section vibrato
  2790. Sinusoidal phase modulation.
  2791. The filter accepts the following options:
  2792. @table @option
  2793. @item f
  2794. Modulation frequency in Hertz.
  2795. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2796. @item d
  2797. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2798. Default value is 0.5.
  2799. @end table
  2800. @section volume
  2801. Adjust the input audio volume.
  2802. It accepts the following parameters:
  2803. @table @option
  2804. @item volume
  2805. Set audio volume expression.
  2806. Output values are clipped to the maximum value.
  2807. The output audio volume is given by the relation:
  2808. @example
  2809. @var{output_volume} = @var{volume} * @var{input_volume}
  2810. @end example
  2811. The default value for @var{volume} is "1.0".
  2812. @item precision
  2813. This parameter represents the mathematical precision.
  2814. It determines which input sample formats will be allowed, which affects the
  2815. precision of the volume scaling.
  2816. @table @option
  2817. @item fixed
  2818. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2819. @item float
  2820. 32-bit floating-point; this limits input sample format to FLT. (default)
  2821. @item double
  2822. 64-bit floating-point; this limits input sample format to DBL.
  2823. @end table
  2824. @item replaygain
  2825. Choose the behaviour on encountering ReplayGain side data in input frames.
  2826. @table @option
  2827. @item drop
  2828. Remove ReplayGain side data, ignoring its contents (the default).
  2829. @item ignore
  2830. Ignore ReplayGain side data, but leave it in the frame.
  2831. @item track
  2832. Prefer the track gain, if present.
  2833. @item album
  2834. Prefer the album gain, if present.
  2835. @end table
  2836. @item replaygain_preamp
  2837. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2838. Default value for @var{replaygain_preamp} is 0.0.
  2839. @item eval
  2840. Set when the volume expression is evaluated.
  2841. It accepts the following values:
  2842. @table @samp
  2843. @item once
  2844. only evaluate expression once during the filter initialization, or
  2845. when the @samp{volume} command is sent
  2846. @item frame
  2847. evaluate expression for each incoming frame
  2848. @end table
  2849. Default value is @samp{once}.
  2850. @end table
  2851. The volume expression can contain the following parameters.
  2852. @table @option
  2853. @item n
  2854. frame number (starting at zero)
  2855. @item nb_channels
  2856. number of channels
  2857. @item nb_consumed_samples
  2858. number of samples consumed by the filter
  2859. @item nb_samples
  2860. number of samples in the current frame
  2861. @item pos
  2862. original frame position in the file
  2863. @item pts
  2864. frame PTS
  2865. @item sample_rate
  2866. sample rate
  2867. @item startpts
  2868. PTS at start of stream
  2869. @item startt
  2870. time at start of stream
  2871. @item t
  2872. frame time
  2873. @item tb
  2874. timestamp timebase
  2875. @item volume
  2876. last set volume value
  2877. @end table
  2878. Note that when @option{eval} is set to @samp{once} only the
  2879. @var{sample_rate} and @var{tb} variables are available, all other
  2880. variables will evaluate to NAN.
  2881. @subsection Commands
  2882. This filter supports the following commands:
  2883. @table @option
  2884. @item volume
  2885. Modify the volume expression.
  2886. The command accepts the same syntax of the corresponding option.
  2887. If the specified expression is not valid, it is kept at its current
  2888. value.
  2889. @item replaygain_noclip
  2890. Prevent clipping by limiting the gain applied.
  2891. Default value for @var{replaygain_noclip} is 1.
  2892. @end table
  2893. @subsection Examples
  2894. @itemize
  2895. @item
  2896. Halve the input audio volume:
  2897. @example
  2898. volume=volume=0.5
  2899. volume=volume=1/2
  2900. volume=volume=-6.0206dB
  2901. @end example
  2902. In all the above example the named key for @option{volume} can be
  2903. omitted, for example like in:
  2904. @example
  2905. volume=0.5
  2906. @end example
  2907. @item
  2908. Increase input audio power by 6 decibels using fixed-point precision:
  2909. @example
  2910. volume=volume=6dB:precision=fixed
  2911. @end example
  2912. @item
  2913. Fade volume after time 10 with an annihilation period of 5 seconds:
  2914. @example
  2915. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2916. @end example
  2917. @end itemize
  2918. @section volumedetect
  2919. Detect the volume of the input video.
  2920. The filter has no parameters. The input is not modified. Statistics about
  2921. the volume will be printed in the log when the input stream end is reached.
  2922. In particular it will show the mean volume (root mean square), maximum
  2923. volume (on a per-sample basis), and the beginning of a histogram of the
  2924. registered volume values (from the maximum value to a cumulated 1/1000 of
  2925. the samples).
  2926. All volumes are in decibels relative to the maximum PCM value.
  2927. @subsection Examples
  2928. Here is an excerpt of the output:
  2929. @example
  2930. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2931. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2932. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2933. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2934. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2935. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2936. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2937. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2938. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2939. @end example
  2940. It means that:
  2941. @itemize
  2942. @item
  2943. The mean square energy is approximately -27 dB, or 10^-2.7.
  2944. @item
  2945. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2946. @item
  2947. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2948. @end itemize
  2949. In other words, raising the volume by +4 dB does not cause any clipping,
  2950. raising it by +5 dB causes clipping for 6 samples, etc.
  2951. @c man end AUDIO FILTERS
  2952. @chapter Audio Sources
  2953. @c man begin AUDIO SOURCES
  2954. Below is a description of the currently available audio sources.
  2955. @section abuffer
  2956. Buffer audio frames, and make them available to the filter chain.
  2957. This source is mainly intended for a programmatic use, in particular
  2958. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2959. It accepts the following parameters:
  2960. @table @option
  2961. @item time_base
  2962. The timebase which will be used for timestamps of submitted frames. It must be
  2963. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2964. @item sample_rate
  2965. The sample rate of the incoming audio buffers.
  2966. @item sample_fmt
  2967. The sample format of the incoming audio buffers.
  2968. Either a sample format name or its corresponding integer representation from
  2969. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2970. @item channel_layout
  2971. The channel layout of the incoming audio buffers.
  2972. Either a channel layout name from channel_layout_map in
  2973. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2974. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2975. @item channels
  2976. The number of channels of the incoming audio buffers.
  2977. If both @var{channels} and @var{channel_layout} are specified, then they
  2978. must be consistent.
  2979. @end table
  2980. @subsection Examples
  2981. @example
  2982. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2983. @end example
  2984. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2985. Since the sample format with name "s16p" corresponds to the number
  2986. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2987. equivalent to:
  2988. @example
  2989. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2990. @end example
  2991. @section aevalsrc
  2992. Generate an audio signal specified by an expression.
  2993. This source accepts in input one or more expressions (one for each
  2994. channel), which are evaluated and used to generate a corresponding
  2995. audio signal.
  2996. This source accepts the following options:
  2997. @table @option
  2998. @item exprs
  2999. Set the '|'-separated expressions list for each separate channel. In case the
  3000. @option{channel_layout} option is not specified, the selected channel layout
  3001. depends on the number of provided expressions. Otherwise the last
  3002. specified expression is applied to the remaining output channels.
  3003. @item channel_layout, c
  3004. Set the channel layout. The number of channels in the specified layout
  3005. must be equal to the number of specified expressions.
  3006. @item duration, d
  3007. Set the minimum duration of the sourced audio. See
  3008. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3009. for the accepted syntax.
  3010. Note that the resulting duration may be greater than the specified
  3011. duration, as the generated audio is always cut at the end of a
  3012. complete frame.
  3013. If not specified, or the expressed duration is negative, the audio is
  3014. supposed to be generated forever.
  3015. @item nb_samples, n
  3016. Set the number of samples per channel per each output frame,
  3017. default to 1024.
  3018. @item sample_rate, s
  3019. Specify the sample rate, default to 44100.
  3020. @end table
  3021. Each expression in @var{exprs} can contain the following constants:
  3022. @table @option
  3023. @item n
  3024. number of the evaluated sample, starting from 0
  3025. @item t
  3026. time of the evaluated sample expressed in seconds, starting from 0
  3027. @item s
  3028. sample rate
  3029. @end table
  3030. @subsection Examples
  3031. @itemize
  3032. @item
  3033. Generate silence:
  3034. @example
  3035. aevalsrc=0
  3036. @end example
  3037. @item
  3038. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3039. 8000 Hz:
  3040. @example
  3041. aevalsrc="sin(440*2*PI*t):s=8000"
  3042. @end example
  3043. @item
  3044. Generate a two channels signal, specify the channel layout (Front
  3045. Center + Back Center) explicitly:
  3046. @example
  3047. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3048. @end example
  3049. @item
  3050. Generate white noise:
  3051. @example
  3052. aevalsrc="-2+random(0)"
  3053. @end example
  3054. @item
  3055. Generate an amplitude modulated signal:
  3056. @example
  3057. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3058. @end example
  3059. @item
  3060. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3061. @example
  3062. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3063. @end example
  3064. @end itemize
  3065. @section anullsrc
  3066. The null audio source, return unprocessed audio frames. It is mainly useful
  3067. as a template and to be employed in analysis / debugging tools, or as
  3068. the source for filters which ignore the input data (for example the sox
  3069. synth filter).
  3070. This source accepts the following options:
  3071. @table @option
  3072. @item channel_layout, cl
  3073. Specifies the channel layout, and can be either an integer or a string
  3074. representing a channel layout. The default value of @var{channel_layout}
  3075. is "stereo".
  3076. Check the channel_layout_map definition in
  3077. @file{libavutil/channel_layout.c} for the mapping between strings and
  3078. channel layout values.
  3079. @item sample_rate, r
  3080. Specifies the sample rate, and defaults to 44100.
  3081. @item nb_samples, n
  3082. Set the number of samples per requested frames.
  3083. @end table
  3084. @subsection Examples
  3085. @itemize
  3086. @item
  3087. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3088. @example
  3089. anullsrc=r=48000:cl=4
  3090. @end example
  3091. @item
  3092. Do the same operation with a more obvious syntax:
  3093. @example
  3094. anullsrc=r=48000:cl=mono
  3095. @end example
  3096. @end itemize
  3097. All the parameters need to be explicitly defined.
  3098. @section flite
  3099. Synthesize a voice utterance using the libflite library.
  3100. To enable compilation of this filter you need to configure FFmpeg with
  3101. @code{--enable-libflite}.
  3102. Note that the flite library is not thread-safe.
  3103. The filter accepts the following options:
  3104. @table @option
  3105. @item list_voices
  3106. If set to 1, list the names of the available voices and exit
  3107. immediately. Default value is 0.
  3108. @item nb_samples, n
  3109. Set the maximum number of samples per frame. Default value is 512.
  3110. @item textfile
  3111. Set the filename containing the text to speak.
  3112. @item text
  3113. Set the text to speak.
  3114. @item voice, v
  3115. Set the voice to use for the speech synthesis. Default value is
  3116. @code{kal}. See also the @var{list_voices} option.
  3117. @end table
  3118. @subsection Examples
  3119. @itemize
  3120. @item
  3121. Read from file @file{speech.txt}, and synthesize the text using the
  3122. standard flite voice:
  3123. @example
  3124. flite=textfile=speech.txt
  3125. @end example
  3126. @item
  3127. Read the specified text selecting the @code{slt} voice:
  3128. @example
  3129. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3130. @end example
  3131. @item
  3132. Input text to ffmpeg:
  3133. @example
  3134. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3135. @end example
  3136. @item
  3137. Make @file{ffplay} speak the specified text, using @code{flite} and
  3138. the @code{lavfi} device:
  3139. @example
  3140. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3141. @end example
  3142. @end itemize
  3143. For more information about libflite, check:
  3144. @url{http://www.speech.cs.cmu.edu/flite/}
  3145. @section anoisesrc
  3146. Generate a noise audio signal.
  3147. The filter accepts the following options:
  3148. @table @option
  3149. @item sample_rate, r
  3150. Specify the sample rate. Default value is 48000 Hz.
  3151. @item amplitude, a
  3152. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3153. is 1.0.
  3154. @item duration, d
  3155. Specify the duration of the generated audio stream. Not specifying this option
  3156. results in noise with an infinite length.
  3157. @item color, colour, c
  3158. Specify the color of noise. Available noise colors are white, pink, and brown.
  3159. Default color is white.
  3160. @item seed, s
  3161. Specify a value used to seed the PRNG.
  3162. @item nb_samples, n
  3163. Set the number of samples per each output frame, default is 1024.
  3164. @end table
  3165. @subsection Examples
  3166. @itemize
  3167. @item
  3168. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3169. @example
  3170. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3171. @end example
  3172. @end itemize
  3173. @section sine
  3174. Generate an audio signal made of a sine wave with amplitude 1/8.
  3175. The audio signal is bit-exact.
  3176. The filter accepts the following options:
  3177. @table @option
  3178. @item frequency, f
  3179. Set the carrier frequency. Default is 440 Hz.
  3180. @item beep_factor, b
  3181. Enable a periodic beep every second with frequency @var{beep_factor} times
  3182. the carrier frequency. Default is 0, meaning the beep is disabled.
  3183. @item sample_rate, r
  3184. Specify the sample rate, default is 44100.
  3185. @item duration, d
  3186. Specify the duration of the generated audio stream.
  3187. @item samples_per_frame
  3188. Set the number of samples per output frame.
  3189. The expression can contain the following constants:
  3190. @table @option
  3191. @item n
  3192. The (sequential) number of the output audio frame, starting from 0.
  3193. @item pts
  3194. The PTS (Presentation TimeStamp) of the output audio frame,
  3195. expressed in @var{TB} units.
  3196. @item t
  3197. The PTS of the output audio frame, expressed in seconds.
  3198. @item TB
  3199. The timebase of the output audio frames.
  3200. @end table
  3201. Default is @code{1024}.
  3202. @end table
  3203. @subsection Examples
  3204. @itemize
  3205. @item
  3206. Generate a simple 440 Hz sine wave:
  3207. @example
  3208. sine
  3209. @end example
  3210. @item
  3211. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3212. @example
  3213. sine=220:4:d=5
  3214. sine=f=220:b=4:d=5
  3215. sine=frequency=220:beep_factor=4:duration=5
  3216. @end example
  3217. @item
  3218. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3219. pattern:
  3220. @example
  3221. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3222. @end example
  3223. @end itemize
  3224. @c man end AUDIO SOURCES
  3225. @chapter Audio Sinks
  3226. @c man begin AUDIO SINKS
  3227. Below is a description of the currently available audio sinks.
  3228. @section abuffersink
  3229. Buffer audio frames, and make them available to the end of filter chain.
  3230. This sink is mainly intended for programmatic use, in particular
  3231. through the interface defined in @file{libavfilter/buffersink.h}
  3232. or the options system.
  3233. It accepts a pointer to an AVABufferSinkContext structure, which
  3234. defines the incoming buffers' formats, to be passed as the opaque
  3235. parameter to @code{avfilter_init_filter} for initialization.
  3236. @section anullsink
  3237. Null audio sink; do absolutely nothing with the input audio. It is
  3238. mainly useful as a template and for use in analysis / debugging
  3239. tools.
  3240. @c man end AUDIO SINKS
  3241. @chapter Video Filters
  3242. @c man begin VIDEO FILTERS
  3243. When you configure your FFmpeg build, you can disable any of the
  3244. existing filters using @code{--disable-filters}.
  3245. The configure output will show the video filters included in your
  3246. build.
  3247. Below is a description of the currently available video filters.
  3248. @section alphaextract
  3249. Extract the alpha component from the input as a grayscale video. This
  3250. is especially useful with the @var{alphamerge} filter.
  3251. @section alphamerge
  3252. Add or replace the alpha component of the primary input with the
  3253. grayscale value of a second input. This is intended for use with
  3254. @var{alphaextract} to allow the transmission or storage of frame
  3255. sequences that have alpha in a format that doesn't support an alpha
  3256. channel.
  3257. For example, to reconstruct full frames from a normal YUV-encoded video
  3258. and a separate video created with @var{alphaextract}, you might use:
  3259. @example
  3260. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3261. @end example
  3262. Since this filter is designed for reconstruction, it operates on frame
  3263. sequences without considering timestamps, and terminates when either
  3264. input reaches end of stream. This will cause problems if your encoding
  3265. pipeline drops frames. If you're trying to apply an image as an
  3266. overlay to a video stream, consider the @var{overlay} filter instead.
  3267. @section ass
  3268. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3269. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3270. Substation Alpha) subtitles files.
  3271. This filter accepts the following option in addition to the common options from
  3272. the @ref{subtitles} filter:
  3273. @table @option
  3274. @item shaping
  3275. Set the shaping engine
  3276. Available values are:
  3277. @table @samp
  3278. @item auto
  3279. The default libass shaping engine, which is the best available.
  3280. @item simple
  3281. Fast, font-agnostic shaper that can do only substitutions
  3282. @item complex
  3283. Slower shaper using OpenType for substitutions and positioning
  3284. @end table
  3285. The default is @code{auto}.
  3286. @end table
  3287. @section atadenoise
  3288. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3289. The filter accepts the following options:
  3290. @table @option
  3291. @item 0a
  3292. Set threshold A for 1st plane. Default is 0.02.
  3293. Valid range is 0 to 0.3.
  3294. @item 0b
  3295. Set threshold B for 1st plane. Default is 0.04.
  3296. Valid range is 0 to 5.
  3297. @item 1a
  3298. Set threshold A for 2nd plane. Default is 0.02.
  3299. Valid range is 0 to 0.3.
  3300. @item 1b
  3301. Set threshold B for 2nd plane. Default is 0.04.
  3302. Valid range is 0 to 5.
  3303. @item 2a
  3304. Set threshold A for 3rd plane. Default is 0.02.
  3305. Valid range is 0 to 0.3.
  3306. @item 2b
  3307. Set threshold B for 3rd plane. Default is 0.04.
  3308. Valid range is 0 to 5.
  3309. Threshold A is designed to react on abrupt changes in the input signal and
  3310. threshold B is designed to react on continuous changes in the input signal.
  3311. @item s
  3312. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3313. number in range [5, 129].
  3314. @end table
  3315. @section bbox
  3316. Compute the bounding box for the non-black pixels in the input frame
  3317. luminance plane.
  3318. This filter computes the bounding box containing all the pixels with a
  3319. luminance value greater than the minimum allowed value.
  3320. The parameters describing the bounding box are printed on the filter
  3321. log.
  3322. The filter accepts the following option:
  3323. @table @option
  3324. @item min_val
  3325. Set the minimal luminance value. Default is @code{16}.
  3326. @end table
  3327. @section blackdetect
  3328. Detect video intervals that are (almost) completely black. Can be
  3329. useful to detect chapter transitions, commercials, or invalid
  3330. recordings. Output lines contains the time for the start, end and
  3331. duration of the detected black interval expressed in seconds.
  3332. In order to display the output lines, you need to set the loglevel at
  3333. least to the AV_LOG_INFO value.
  3334. The filter accepts the following options:
  3335. @table @option
  3336. @item black_min_duration, d
  3337. Set the minimum detected black duration expressed in seconds. It must
  3338. be a non-negative floating point number.
  3339. Default value is 2.0.
  3340. @item picture_black_ratio_th, pic_th
  3341. Set the threshold for considering a picture "black".
  3342. Express the minimum value for the ratio:
  3343. @example
  3344. @var{nb_black_pixels} / @var{nb_pixels}
  3345. @end example
  3346. for which a picture is considered black.
  3347. Default value is 0.98.
  3348. @item pixel_black_th, pix_th
  3349. Set the threshold for considering a pixel "black".
  3350. The threshold expresses the maximum pixel luminance value for which a
  3351. pixel is considered "black". The provided value is scaled according to
  3352. the following equation:
  3353. @example
  3354. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3355. @end example
  3356. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3357. the input video format, the range is [0-255] for YUV full-range
  3358. formats and [16-235] for YUV non full-range formats.
  3359. Default value is 0.10.
  3360. @end table
  3361. The following example sets the maximum pixel threshold to the minimum
  3362. value, and detects only black intervals of 2 or more seconds:
  3363. @example
  3364. blackdetect=d=2:pix_th=0.00
  3365. @end example
  3366. @section blackframe
  3367. Detect frames that are (almost) completely black. Can be useful to
  3368. detect chapter transitions or commercials. Output lines consist of
  3369. the frame number of the detected frame, the percentage of blackness,
  3370. the position in the file if known or -1 and the timestamp in seconds.
  3371. In order to display the output lines, you need to set the loglevel at
  3372. least to the AV_LOG_INFO value.
  3373. It accepts the following parameters:
  3374. @table @option
  3375. @item amount
  3376. The percentage of the pixels that have to be below the threshold; it defaults to
  3377. @code{98}.
  3378. @item threshold, thresh
  3379. The threshold below which a pixel value is considered black; it defaults to
  3380. @code{32}.
  3381. @end table
  3382. @section blend, tblend
  3383. Blend two video frames into each other.
  3384. The @code{blend} filter takes two input streams and outputs one
  3385. stream, the first input is the "top" layer and second input is
  3386. "bottom" layer. Output terminates when shortest input terminates.
  3387. The @code{tblend} (time blend) filter takes two consecutive frames
  3388. from one single stream, and outputs the result obtained by blending
  3389. the new frame on top of the old frame.
  3390. A description of the accepted options follows.
  3391. @table @option
  3392. @item c0_mode
  3393. @item c1_mode
  3394. @item c2_mode
  3395. @item c3_mode
  3396. @item all_mode
  3397. Set blend mode for specific pixel component or all pixel components in case
  3398. of @var{all_mode}. Default value is @code{normal}.
  3399. Available values for component modes are:
  3400. @table @samp
  3401. @item addition
  3402. @item addition128
  3403. @item and
  3404. @item average
  3405. @item burn
  3406. @item darken
  3407. @item difference
  3408. @item difference128
  3409. @item divide
  3410. @item dodge
  3411. @item freeze
  3412. @item exclusion
  3413. @item glow
  3414. @item hardlight
  3415. @item hardmix
  3416. @item heat
  3417. @item lighten
  3418. @item linearlight
  3419. @item multiply
  3420. @item multiply128
  3421. @item negation
  3422. @item normal
  3423. @item or
  3424. @item overlay
  3425. @item phoenix
  3426. @item pinlight
  3427. @item reflect
  3428. @item screen
  3429. @item softlight
  3430. @item subtract
  3431. @item vividlight
  3432. @item xor
  3433. @end table
  3434. @item c0_opacity
  3435. @item c1_opacity
  3436. @item c2_opacity
  3437. @item c3_opacity
  3438. @item all_opacity
  3439. Set blend opacity for specific pixel component or all pixel components in case
  3440. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3441. @item c0_expr
  3442. @item c1_expr
  3443. @item c2_expr
  3444. @item c3_expr
  3445. @item all_expr
  3446. Set blend expression for specific pixel component or all pixel components in case
  3447. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3448. The expressions can use the following variables:
  3449. @table @option
  3450. @item N
  3451. The sequential number of the filtered frame, starting from @code{0}.
  3452. @item X
  3453. @item Y
  3454. the coordinates of the current sample
  3455. @item W
  3456. @item H
  3457. the width and height of currently filtered plane
  3458. @item SW
  3459. @item SH
  3460. Width and height scale depending on the currently filtered plane. It is the
  3461. ratio between the corresponding luma plane number of pixels and the current
  3462. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3463. @code{0.5,0.5} for chroma planes.
  3464. @item T
  3465. Time of the current frame, expressed in seconds.
  3466. @item TOP, A
  3467. Value of pixel component at current location for first video frame (top layer).
  3468. @item BOTTOM, B
  3469. Value of pixel component at current location for second video frame (bottom layer).
  3470. @end table
  3471. @item shortest
  3472. Force termination when the shortest input terminates. Default is
  3473. @code{0}. This option is only defined for the @code{blend} filter.
  3474. @item repeatlast
  3475. Continue applying the last bottom frame after the end of the stream. A value of
  3476. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3477. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3478. @end table
  3479. @subsection Examples
  3480. @itemize
  3481. @item
  3482. Apply transition from bottom layer to top layer in first 10 seconds:
  3483. @example
  3484. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3485. @end example
  3486. @item
  3487. Apply 1x1 checkerboard effect:
  3488. @example
  3489. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3490. @end example
  3491. @item
  3492. Apply uncover left effect:
  3493. @example
  3494. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3495. @end example
  3496. @item
  3497. Apply uncover down effect:
  3498. @example
  3499. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3500. @end example
  3501. @item
  3502. Apply uncover up-left effect:
  3503. @example
  3504. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3505. @end example
  3506. @item
  3507. Split diagonally video and shows top and bottom layer on each side:
  3508. @example
  3509. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3510. @end example
  3511. @item
  3512. Display differences between the current and the previous frame:
  3513. @example
  3514. tblend=all_mode=difference128
  3515. @end example
  3516. @end itemize
  3517. @section bwdif
  3518. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3519. Deinterlacing Filter").
  3520. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3521. interpolation algorithms.
  3522. It accepts the following parameters:
  3523. @table @option
  3524. @item mode
  3525. The interlacing mode to adopt. It accepts one of the following values:
  3526. @table @option
  3527. @item 0, send_frame
  3528. Output one frame for each frame.
  3529. @item 1, send_field
  3530. Output one frame for each field.
  3531. @end table
  3532. The default value is @code{send_field}.
  3533. @item parity
  3534. The picture field parity assumed for the input interlaced video. It accepts one
  3535. of the following values:
  3536. @table @option
  3537. @item 0, tff
  3538. Assume the top field is first.
  3539. @item 1, bff
  3540. Assume the bottom field is first.
  3541. @item -1, auto
  3542. Enable automatic detection of field parity.
  3543. @end table
  3544. The default value is @code{auto}.
  3545. If the interlacing is unknown or the decoder does not export this information,
  3546. top field first will be assumed.
  3547. @item deint
  3548. Specify which frames to deinterlace. Accept one of the following
  3549. values:
  3550. @table @option
  3551. @item 0, all
  3552. Deinterlace all frames.
  3553. @item 1, interlaced
  3554. Only deinterlace frames marked as interlaced.
  3555. @end table
  3556. The default value is @code{all}.
  3557. @end table
  3558. @section boxblur
  3559. Apply a boxblur algorithm to the input video.
  3560. It accepts the following parameters:
  3561. @table @option
  3562. @item luma_radius, lr
  3563. @item luma_power, lp
  3564. @item chroma_radius, cr
  3565. @item chroma_power, cp
  3566. @item alpha_radius, ar
  3567. @item alpha_power, ap
  3568. @end table
  3569. A description of the accepted options follows.
  3570. @table @option
  3571. @item luma_radius, lr
  3572. @item chroma_radius, cr
  3573. @item alpha_radius, ar
  3574. Set an expression for the box radius in pixels used for blurring the
  3575. corresponding input plane.
  3576. The radius value must be a non-negative number, and must not be
  3577. greater than the value of the expression @code{min(w,h)/2} for the
  3578. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3579. planes.
  3580. Default value for @option{luma_radius} is "2". If not specified,
  3581. @option{chroma_radius} and @option{alpha_radius} default to the
  3582. corresponding value set for @option{luma_radius}.
  3583. The expressions can contain the following constants:
  3584. @table @option
  3585. @item w
  3586. @item h
  3587. The input width and height in pixels.
  3588. @item cw
  3589. @item ch
  3590. The input chroma image width and height in pixels.
  3591. @item hsub
  3592. @item vsub
  3593. The horizontal and vertical chroma subsample values. For example, for the
  3594. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3595. @end table
  3596. @item luma_power, lp
  3597. @item chroma_power, cp
  3598. @item alpha_power, ap
  3599. Specify how many times the boxblur filter is applied to the
  3600. corresponding plane.
  3601. Default value for @option{luma_power} is 2. If not specified,
  3602. @option{chroma_power} and @option{alpha_power} default to the
  3603. corresponding value set for @option{luma_power}.
  3604. A value of 0 will disable the effect.
  3605. @end table
  3606. @subsection Examples
  3607. @itemize
  3608. @item
  3609. Apply a boxblur filter with the luma, chroma, and alpha radii
  3610. set to 2:
  3611. @example
  3612. boxblur=luma_radius=2:luma_power=1
  3613. boxblur=2:1
  3614. @end example
  3615. @item
  3616. Set the luma radius to 2, and alpha and chroma radius to 0:
  3617. @example
  3618. boxblur=2:1:cr=0:ar=0
  3619. @end example
  3620. @item
  3621. Set the luma and chroma radii to a fraction of the video dimension:
  3622. @example
  3623. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3624. @end example
  3625. @end itemize
  3626. @section chromakey
  3627. YUV colorspace color/chroma keying.
  3628. The filter accepts the following options:
  3629. @table @option
  3630. @item color
  3631. The color which will be replaced with transparency.
  3632. @item similarity
  3633. Similarity percentage with the key color.
  3634. 0.01 matches only the exact key color, while 1.0 matches everything.
  3635. @item blend
  3636. Blend percentage.
  3637. 0.0 makes pixels either fully transparent, or not transparent at all.
  3638. Higher values result in semi-transparent pixels, with a higher transparency
  3639. the more similar the pixels color is to the key color.
  3640. @item yuv
  3641. Signals that the color passed is already in YUV instead of RGB.
  3642. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3643. This can be used to pass exact YUV values as hexadecimal numbers.
  3644. @end table
  3645. @subsection Examples
  3646. @itemize
  3647. @item
  3648. Make every green pixel in the input image transparent:
  3649. @example
  3650. ffmpeg -i input.png -vf chromakey=green out.png
  3651. @end example
  3652. @item
  3653. Overlay a greenscreen-video on top of a static black background.
  3654. @example
  3655. 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
  3656. @end example
  3657. @end itemize
  3658. @section ciescope
  3659. Display CIE color diagram with pixels overlaid onto it.
  3660. The filter acccepts the following options:
  3661. @table @option
  3662. @item system
  3663. Set color system.
  3664. @table @samp
  3665. @item ntsc, 470m
  3666. @item ebu, 470bg
  3667. @item smpte
  3668. @item 240m
  3669. @item apple
  3670. @item widergb
  3671. @item cie1931
  3672. @item rec709, hdtv
  3673. @item uhdtv, rec2020
  3674. @end table
  3675. @item cie
  3676. Set CIE system.
  3677. @table @samp
  3678. @item xyy
  3679. @item ucs
  3680. @item luv
  3681. @end table
  3682. @item gamuts
  3683. Set what gamuts to draw.
  3684. See @code{system} option for avaiable values.
  3685. @item size, s
  3686. Set ciescope size, by default set to 512.
  3687. @item intensity, i
  3688. Set intensity used to map input pixel values to CIE diagram.
  3689. @item contrast
  3690. Set contrast used to draw tongue colors that are out of active color system gamut.
  3691. @item corrgamma
  3692. Correct gamma displayed on scope, by default enabled.
  3693. @item showwhite
  3694. Show white point on CIE diagram, by default disabled.
  3695. @item gamma
  3696. Set input gamma. Used only with XYZ input color space.
  3697. @end table
  3698. @section codecview
  3699. Visualize information exported by some codecs.
  3700. Some codecs can export information through frames using side-data or other
  3701. means. For example, some MPEG based codecs export motion vectors through the
  3702. @var{export_mvs} flag in the codec @option{flags2} option.
  3703. The filter accepts the following option:
  3704. @table @option
  3705. @item mv
  3706. Set motion vectors to visualize.
  3707. Available flags for @var{mv} are:
  3708. @table @samp
  3709. @item pf
  3710. forward predicted MVs of P-frames
  3711. @item bf
  3712. forward predicted MVs of B-frames
  3713. @item bb
  3714. backward predicted MVs of B-frames
  3715. @end table
  3716. @item qp
  3717. Display quantization parameters using the chroma planes
  3718. @end table
  3719. @subsection Examples
  3720. @itemize
  3721. @item
  3722. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  3723. @example
  3724. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  3725. @end example
  3726. @end itemize
  3727. @section colorbalance
  3728. Modify intensity of primary colors (red, green and blue) of input frames.
  3729. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3730. regions for the red-cyan, green-magenta or blue-yellow balance.
  3731. A positive adjustment value shifts the balance towards the primary color, a negative
  3732. value towards the complementary color.
  3733. The filter accepts the following options:
  3734. @table @option
  3735. @item rs
  3736. @item gs
  3737. @item bs
  3738. Adjust red, green and blue shadows (darkest pixels).
  3739. @item rm
  3740. @item gm
  3741. @item bm
  3742. Adjust red, green and blue midtones (medium pixels).
  3743. @item rh
  3744. @item gh
  3745. @item bh
  3746. Adjust red, green and blue highlights (brightest pixels).
  3747. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3748. @end table
  3749. @subsection Examples
  3750. @itemize
  3751. @item
  3752. Add red color cast to shadows:
  3753. @example
  3754. colorbalance=rs=.3
  3755. @end example
  3756. @end itemize
  3757. @section colorkey
  3758. RGB colorspace color keying.
  3759. The filter accepts the following options:
  3760. @table @option
  3761. @item color
  3762. The color which will be replaced with transparency.
  3763. @item similarity
  3764. Similarity percentage with the key color.
  3765. 0.01 matches only the exact key color, while 1.0 matches everything.
  3766. @item blend
  3767. Blend percentage.
  3768. 0.0 makes pixels either fully transparent, or not transparent at all.
  3769. Higher values result in semi-transparent pixels, with a higher transparency
  3770. the more similar the pixels color is to the key color.
  3771. @end table
  3772. @subsection Examples
  3773. @itemize
  3774. @item
  3775. Make every green pixel in the input image transparent:
  3776. @example
  3777. ffmpeg -i input.png -vf colorkey=green out.png
  3778. @end example
  3779. @item
  3780. Overlay a greenscreen-video on top of a static background image.
  3781. @example
  3782. 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
  3783. @end example
  3784. @end itemize
  3785. @section colorlevels
  3786. Adjust video input frames using levels.
  3787. The filter accepts the following options:
  3788. @table @option
  3789. @item rimin
  3790. @item gimin
  3791. @item bimin
  3792. @item aimin
  3793. Adjust red, green, blue and alpha input black point.
  3794. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3795. @item rimax
  3796. @item gimax
  3797. @item bimax
  3798. @item aimax
  3799. Adjust red, green, blue and alpha input white point.
  3800. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3801. Input levels are used to lighten highlights (bright tones), darken shadows
  3802. (dark tones), change the balance of bright and dark tones.
  3803. @item romin
  3804. @item gomin
  3805. @item bomin
  3806. @item aomin
  3807. Adjust red, green, blue and alpha output black point.
  3808. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3809. @item romax
  3810. @item gomax
  3811. @item bomax
  3812. @item aomax
  3813. Adjust red, green, blue and alpha output white point.
  3814. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3815. Output levels allows manual selection of a constrained output level range.
  3816. @end table
  3817. @subsection Examples
  3818. @itemize
  3819. @item
  3820. Make video output darker:
  3821. @example
  3822. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3823. @end example
  3824. @item
  3825. Increase contrast:
  3826. @example
  3827. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3828. @end example
  3829. @item
  3830. Make video output lighter:
  3831. @example
  3832. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3833. @end example
  3834. @item
  3835. Increase brightness:
  3836. @example
  3837. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3838. @end example
  3839. @end itemize
  3840. @section colorchannelmixer
  3841. Adjust video input frames by re-mixing color channels.
  3842. This filter modifies a color channel by adding the values associated to
  3843. the other channels of the same pixels. For example if the value to
  3844. modify is red, the output value will be:
  3845. @example
  3846. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3847. @end example
  3848. The filter accepts the following options:
  3849. @table @option
  3850. @item rr
  3851. @item rg
  3852. @item rb
  3853. @item ra
  3854. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3855. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3856. @item gr
  3857. @item gg
  3858. @item gb
  3859. @item ga
  3860. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3861. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3862. @item br
  3863. @item bg
  3864. @item bb
  3865. @item ba
  3866. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3867. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3868. @item ar
  3869. @item ag
  3870. @item ab
  3871. @item aa
  3872. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3873. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3874. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3875. @end table
  3876. @subsection Examples
  3877. @itemize
  3878. @item
  3879. Convert source to grayscale:
  3880. @example
  3881. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3882. @end example
  3883. @item
  3884. Simulate sepia tones:
  3885. @example
  3886. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3887. @end example
  3888. @end itemize
  3889. @section colormatrix
  3890. Convert color matrix.
  3891. The filter accepts the following options:
  3892. @table @option
  3893. @item src
  3894. @item dst
  3895. Specify the source and destination color matrix. Both values must be
  3896. specified.
  3897. The accepted values are:
  3898. @table @samp
  3899. @item bt709
  3900. BT.709
  3901. @item bt601
  3902. BT.601
  3903. @item smpte240m
  3904. SMPTE-240M
  3905. @item fcc
  3906. FCC
  3907. @item bt2020
  3908. BT.2020
  3909. @end table
  3910. @end table
  3911. For example to convert from BT.601 to SMPTE-240M, use the command:
  3912. @example
  3913. colormatrix=bt601:smpte240m
  3914. @end example
  3915. @section colorspace
  3916. Convert colorspace, transfer characteristics or color primaries.
  3917. The filter accepts the following options:
  3918. @table @option
  3919. @item all
  3920. Specify all color properties at once.
  3921. The accepted values are:
  3922. @table @samp
  3923. @item bt470m
  3924. BT.470M
  3925. @item bt470bg
  3926. BT.470BG
  3927. @item bt601-6-525
  3928. BT.601-6 525
  3929. @item bt601-6-625
  3930. BT.601-6 625
  3931. @item bt709
  3932. BT.709
  3933. @item smpte170m
  3934. SMPTE-170M
  3935. @item smpte240m
  3936. SMPTE-240M
  3937. @item bt2020
  3938. BT.2020
  3939. @end table
  3940. @item space
  3941. Specify output colorspace.
  3942. The accepted values are:
  3943. @table @samp
  3944. @item bt709
  3945. BT.709
  3946. @item fcc
  3947. FCC
  3948. @item bt470bg
  3949. BT.470BG or BT.601-6 625
  3950. @item smpte170m
  3951. SMPTE-170M or BT.601-6 525
  3952. @item smpte240m
  3953. SMPTE-240M
  3954. @item bt2020ncl
  3955. BT.2020 with non-constant luminance
  3956. @end table
  3957. @item trc
  3958. Specify output transfer characteristics.
  3959. The accepted values are:
  3960. @table @samp
  3961. @item bt709
  3962. BT.709
  3963. @item gamma22
  3964. Constant gamma of 2.2
  3965. @item gamma28
  3966. Constant gamma of 2.8
  3967. @item smpte170m
  3968. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  3969. @item smpte240m
  3970. SMPTE-240M
  3971. @item bt2020-10
  3972. BT.2020 for 10-bits content
  3973. @item bt2020-12
  3974. BT.2020 for 12-bits content
  3975. @end table
  3976. @item prm
  3977. Specify output color primaries.
  3978. The accepted values are:
  3979. @table @samp
  3980. @item bt709
  3981. BT.709
  3982. @item bt470m
  3983. BT.470M
  3984. @item bt470bg
  3985. BT.470BG or BT.601-6 625
  3986. @item smpte170m
  3987. SMPTE-170M or BT.601-6 525
  3988. @item smpte240m
  3989. SMPTE-240M
  3990. @item bt2020
  3991. BT.2020
  3992. @end table
  3993. @item rng
  3994. Specify output color range.
  3995. The accepted values are:
  3996. @table @samp
  3997. @item mpeg
  3998. MPEG (restricted) range
  3999. @item jpeg
  4000. JPEG (full) range
  4001. @end table
  4002. @item format
  4003. Specify output color format.
  4004. The accepted values are:
  4005. @table @samp
  4006. @item yuv420p
  4007. YUV 4:2:0 planar 8-bits
  4008. @item yuv420p10
  4009. YUV 4:2:0 planar 10-bits
  4010. @item yuv420p12
  4011. YUV 4:2:0 planar 12-bits
  4012. @item yuv422p
  4013. YUV 4:2:2 planar 8-bits
  4014. @item yuv422p10
  4015. YUV 4:2:2 planar 10-bits
  4016. @item yuv422p12
  4017. YUV 4:2:2 planar 12-bits
  4018. @item yuv444p
  4019. YUV 4:4:4 planar 8-bits
  4020. @item yuv444p10
  4021. YUV 4:4:4 planar 10-bits
  4022. @item yuv444p12
  4023. YUV 4:4:4 planar 12-bits
  4024. @end table
  4025. @item fast
  4026. Do a fast conversion, which skips gamma/primary correction. This will take
  4027. significantly less CPU, but will be mathematically incorrect. To get output
  4028. compatible with that produced by the colormatrix filter, use fast=1.
  4029. @item dither
  4030. Specify dithering mode.
  4031. The accepted values are:
  4032. @table @samp
  4033. @item none
  4034. No dithering
  4035. @item fsb
  4036. Floyd-Steinberg dithering
  4037. @end table
  4038. @item wpadapt
  4039. Whitepoint adaptation mode.
  4040. The accepted values are:
  4041. @table @samp
  4042. @item bradford
  4043. Bradford whitepoint adaptation
  4044. @item vonkries
  4045. von Kries whitepoint adaptation
  4046. @item identity
  4047. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4048. @end table
  4049. @end table
  4050. The filter converts the transfer characteristics, color space and color
  4051. primaries to the specified user values. The output value, if not specified,
  4052. is set to a default value based on the "all" property. If that property is
  4053. also not specified, the filter will log an error. The output color range and
  4054. format default to the same value as the input color range and format. The
  4055. input transfer characteristics, color space, color primaries and color range
  4056. should be set on the input data. If any of these are missing, the filter will
  4057. log an error and no conversion will take place.
  4058. For example to convert the input to SMPTE-240M, use the command:
  4059. @example
  4060. colorspace=smpte240m
  4061. @end example
  4062. @section convolution
  4063. Apply convolution 3x3 or 5x5 filter.
  4064. The filter accepts the following options:
  4065. @table @option
  4066. @item 0m
  4067. @item 1m
  4068. @item 2m
  4069. @item 3m
  4070. Set matrix for each plane.
  4071. Matrix is sequence of 9 or 25 signed integers.
  4072. @item 0rdiv
  4073. @item 1rdiv
  4074. @item 2rdiv
  4075. @item 3rdiv
  4076. Set multiplier for calculated value for each plane.
  4077. @item 0bias
  4078. @item 1bias
  4079. @item 2bias
  4080. @item 3bias
  4081. Set bias for each plane. This value is added to the result of the multiplication.
  4082. Useful for making the overall image brighter or darker. Default is 0.0.
  4083. @end table
  4084. @subsection Examples
  4085. @itemize
  4086. @item
  4087. Apply sharpen:
  4088. @example
  4089. convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0"
  4090. @end example
  4091. @item
  4092. Apply blur:
  4093. @example
  4094. convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9"
  4095. @end example
  4096. @item
  4097. Apply edge enhance:
  4098. @example
  4099. convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128"
  4100. @end example
  4101. @item
  4102. Apply edge detect:
  4103. @example
  4104. convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128"
  4105. @end example
  4106. @item
  4107. Apply emboss:
  4108. @example
  4109. convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2"
  4110. @end example
  4111. @end itemize
  4112. @section copy
  4113. Copy the input source unchanged to the output. This is mainly useful for
  4114. testing purposes.
  4115. @anchor{coreimage}
  4116. @section coreimage
  4117. Video filtering on GPU using Apple's CoreImage API on OSX.
  4118. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4119. processed by video hardware. However, software-based OpenGL implementations
  4120. exist which means there is no guarantee for hardware processing. It depends on
  4121. the respective OSX.
  4122. There are many filters and image generators provided by Apple that come with a
  4123. large variety of options. The filter has to be referenced by its name along
  4124. with its options.
  4125. The coreimage filter accepts the following options:
  4126. @table @option
  4127. @item list_filters
  4128. List all available filters and generators along with all their respective
  4129. options as well as possible minimum and maximum values along with the default
  4130. values.
  4131. @example
  4132. list_filters=true
  4133. @end example
  4134. @item filter
  4135. Specify all filters by their respective name and options.
  4136. Use @var{list_filters} to determine all valid filter names and options.
  4137. Numerical options are specified by a float value and are automatically clamped
  4138. to their respective value range. Vector and color options have to be specified
  4139. by a list of space separated float values. Character escaping has to be done.
  4140. A special option name @code{default} is available to use default options for a
  4141. filter.
  4142. It is required to specify either @code{default} or at least one of the filter options.
  4143. All omitted options are used with their default values.
  4144. The syntax of the filter string is as follows:
  4145. @example
  4146. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4147. @end example
  4148. @item output_rect
  4149. Specify a rectangle where the output of the filter chain is copied into the
  4150. input image. It is given by a list of space separated float values:
  4151. @example
  4152. output_rect=x\ y\ width\ height
  4153. @end example
  4154. If not given, the output rectangle equals the dimensions of the input image.
  4155. The output rectangle is automatically cropped at the borders of the input
  4156. image. Negative values are valid for each component.
  4157. @example
  4158. output_rect=25\ 25\ 100\ 100
  4159. @end example
  4160. @end table
  4161. Several filters can be chained for successive processing without GPU-HOST
  4162. transfers allowing for fast processing of complex filter chains.
  4163. Currently, only filters with zero (generators) or exactly one (filters) input
  4164. image and one output image are supported. Also, transition filters are not yet
  4165. usable as intended.
  4166. Some filters generate output images with additional padding depending on the
  4167. respective filter kernel. The padding is automatically removed to ensure the
  4168. filter output has the same size as the input image.
  4169. For image generators, the size of the output image is determined by the
  4170. previous output image of the filter chain or the input image of the whole
  4171. filterchain, respectively. The generators do not use the pixel information of
  4172. this image to generate their output. However, the generated output is
  4173. blended onto this image, resulting in partial or complete coverage of the
  4174. output image.
  4175. The @ref{coreimagesrc} video source can be used for generating input images
  4176. which are directly fed into the filter chain. By using it, providing input
  4177. images by another video source or an input video is not required.
  4178. @subsection Examples
  4179. @itemize
  4180. @item
  4181. List all filters available:
  4182. @example
  4183. coreimage=list_filters=true
  4184. @end example
  4185. @item
  4186. Use the CIBoxBlur filter with default options to blur an image:
  4187. @example
  4188. coreimage=filter=CIBoxBlur@@default
  4189. @end example
  4190. @item
  4191. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4192. its center at 100x100 and a radius of 50 pixels:
  4193. @example
  4194. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4195. @end example
  4196. @item
  4197. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4198. given as complete and escaped command-line for Apple's standard bash shell:
  4199. @example
  4200. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4201. @end example
  4202. @end itemize
  4203. @section crop
  4204. Crop the input video to given dimensions.
  4205. It accepts the following parameters:
  4206. @table @option
  4207. @item w, out_w
  4208. The width of the output video. It defaults to @code{iw}.
  4209. This expression is evaluated only once during the filter
  4210. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4211. @item h, out_h
  4212. The height of the output video. It defaults to @code{ih}.
  4213. This expression is evaluated only once during the filter
  4214. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4215. @item x
  4216. The horizontal position, in the input video, of the left edge of the output
  4217. video. It defaults to @code{(in_w-out_w)/2}.
  4218. This expression is evaluated per-frame.
  4219. @item y
  4220. The vertical position, in the input video, of the top edge of the output video.
  4221. It defaults to @code{(in_h-out_h)/2}.
  4222. This expression is evaluated per-frame.
  4223. @item keep_aspect
  4224. If set to 1 will force the output display aspect ratio
  4225. to be the same of the input, by changing the output sample aspect
  4226. ratio. It defaults to 0.
  4227. @end table
  4228. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4229. expressions containing the following constants:
  4230. @table @option
  4231. @item x
  4232. @item y
  4233. The computed values for @var{x} and @var{y}. They are evaluated for
  4234. each new frame.
  4235. @item in_w
  4236. @item in_h
  4237. The input width and height.
  4238. @item iw
  4239. @item ih
  4240. These are the same as @var{in_w} and @var{in_h}.
  4241. @item out_w
  4242. @item out_h
  4243. The output (cropped) width and height.
  4244. @item ow
  4245. @item oh
  4246. These are the same as @var{out_w} and @var{out_h}.
  4247. @item a
  4248. same as @var{iw} / @var{ih}
  4249. @item sar
  4250. input sample aspect ratio
  4251. @item dar
  4252. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4253. @item hsub
  4254. @item vsub
  4255. horizontal and vertical chroma subsample values. For example for the
  4256. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4257. @item n
  4258. The number of the input frame, starting from 0.
  4259. @item pos
  4260. the position in the file of the input frame, NAN if unknown
  4261. @item t
  4262. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4263. @end table
  4264. The expression for @var{out_w} may depend on the value of @var{out_h},
  4265. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4266. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4267. evaluated after @var{out_w} and @var{out_h}.
  4268. The @var{x} and @var{y} parameters specify the expressions for the
  4269. position of the top-left corner of the output (non-cropped) area. They
  4270. are evaluated for each frame. If the evaluated value is not valid, it
  4271. is approximated to the nearest valid value.
  4272. The expression for @var{x} may depend on @var{y}, and the expression
  4273. for @var{y} may depend on @var{x}.
  4274. @subsection Examples
  4275. @itemize
  4276. @item
  4277. Crop area with size 100x100 at position (12,34).
  4278. @example
  4279. crop=100:100:12:34
  4280. @end example
  4281. Using named options, the example above becomes:
  4282. @example
  4283. crop=w=100:h=100:x=12:y=34
  4284. @end example
  4285. @item
  4286. Crop the central input area with size 100x100:
  4287. @example
  4288. crop=100:100
  4289. @end example
  4290. @item
  4291. Crop the central input area with size 2/3 of the input video:
  4292. @example
  4293. crop=2/3*in_w:2/3*in_h
  4294. @end example
  4295. @item
  4296. Crop the input video central square:
  4297. @example
  4298. crop=out_w=in_h
  4299. crop=in_h
  4300. @end example
  4301. @item
  4302. Delimit the rectangle with the top-left corner placed at position
  4303. 100:100 and the right-bottom corner corresponding to the right-bottom
  4304. corner of the input image.
  4305. @example
  4306. crop=in_w-100:in_h-100:100:100
  4307. @end example
  4308. @item
  4309. Crop 10 pixels from the left and right borders, and 20 pixels from
  4310. the top and bottom borders
  4311. @example
  4312. crop=in_w-2*10:in_h-2*20
  4313. @end example
  4314. @item
  4315. Keep only the bottom right quarter of the input image:
  4316. @example
  4317. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4318. @end example
  4319. @item
  4320. Crop height for getting Greek harmony:
  4321. @example
  4322. crop=in_w:1/PHI*in_w
  4323. @end example
  4324. @item
  4325. Apply trembling effect:
  4326. @example
  4327. 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)
  4328. @end example
  4329. @item
  4330. Apply erratic camera effect depending on timestamp:
  4331. @example
  4332. 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)"
  4333. @end example
  4334. @item
  4335. Set x depending on the value of y:
  4336. @example
  4337. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4338. @end example
  4339. @end itemize
  4340. @subsection Commands
  4341. This filter supports the following commands:
  4342. @table @option
  4343. @item w, out_w
  4344. @item h, out_h
  4345. @item x
  4346. @item y
  4347. Set width/height of the output video and the horizontal/vertical position
  4348. in the input video.
  4349. The command accepts the same syntax of the corresponding option.
  4350. If the specified expression is not valid, it is kept at its current
  4351. value.
  4352. @end table
  4353. @section cropdetect
  4354. Auto-detect the crop size.
  4355. It calculates the necessary cropping parameters and prints the
  4356. recommended parameters via the logging system. The detected dimensions
  4357. correspond to the non-black area of the input video.
  4358. It accepts the following parameters:
  4359. @table @option
  4360. @item limit
  4361. Set higher black value threshold, which can be optionally specified
  4362. from nothing (0) to everything (255 for 8bit based formats). An intensity
  4363. value greater to the set value is considered non-black. It defaults to 24.
  4364. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4365. on the bitdepth of the pixel format.
  4366. @item round
  4367. The value which the width/height should be divisible by. It defaults to
  4368. 16. The offset is automatically adjusted to center the video. Use 2 to
  4369. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4370. encoding to most video codecs.
  4371. @item reset_count, reset
  4372. Set the counter that determines after how many frames cropdetect will
  4373. reset the previously detected largest video area and start over to
  4374. detect the current optimal crop area. Default value is 0.
  4375. This can be useful when channel logos distort the video area. 0
  4376. indicates 'never reset', and returns the largest area encountered during
  4377. playback.
  4378. @end table
  4379. @anchor{curves}
  4380. @section curves
  4381. Apply color adjustments using curves.
  4382. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4383. component (red, green and blue) has its values defined by @var{N} key points
  4384. tied from each other using a smooth curve. The x-axis represents the pixel
  4385. values from the input frame, and the y-axis the new pixel values to be set for
  4386. the output frame.
  4387. By default, a component curve is defined by the two points @var{(0;0)} and
  4388. @var{(1;1)}. This creates a straight line where each original pixel value is
  4389. "adjusted" to its own value, which means no change to the image.
  4390. The filter allows you to redefine these two points and add some more. A new
  4391. curve (using a natural cubic spline interpolation) will be define to pass
  4392. smoothly through all these new coordinates. The new defined points needs to be
  4393. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4394. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4395. the vector spaces, the values will be clipped accordingly.
  4396. If there is no key point defined in @code{x=0}, the filter will automatically
  4397. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  4398. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  4399. The filter accepts the following options:
  4400. @table @option
  4401. @item preset
  4402. Select one of the available color presets. This option can be used in addition
  4403. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4404. options takes priority on the preset values.
  4405. Available presets are:
  4406. @table @samp
  4407. @item none
  4408. @item color_negative
  4409. @item cross_process
  4410. @item darker
  4411. @item increase_contrast
  4412. @item lighter
  4413. @item linear_contrast
  4414. @item medium_contrast
  4415. @item negative
  4416. @item strong_contrast
  4417. @item vintage
  4418. @end table
  4419. Default is @code{none}.
  4420. @item master, m
  4421. Set the master key points. These points will define a second pass mapping. It
  4422. is sometimes called a "luminance" or "value" mapping. It can be used with
  4423. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4424. post-processing LUT.
  4425. @item red, r
  4426. Set the key points for the red component.
  4427. @item green, g
  4428. Set the key points for the green component.
  4429. @item blue, b
  4430. Set the key points for the blue component.
  4431. @item all
  4432. Set the key points for all components (not including master).
  4433. Can be used in addition to the other key points component
  4434. options. In this case, the unset component(s) will fallback on this
  4435. @option{all} setting.
  4436. @item psfile
  4437. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4438. @end table
  4439. To avoid some filtergraph syntax conflicts, each key points list need to be
  4440. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4441. @subsection Examples
  4442. @itemize
  4443. @item
  4444. Increase slightly the middle level of blue:
  4445. @example
  4446. curves=blue='0.5/0.58'
  4447. @end example
  4448. @item
  4449. Vintage effect:
  4450. @example
  4451. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  4452. @end example
  4453. Here we obtain the following coordinates for each components:
  4454. @table @var
  4455. @item red
  4456. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4457. @item green
  4458. @code{(0;0) (0.50;0.48) (1;1)}
  4459. @item blue
  4460. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4461. @end table
  4462. @item
  4463. The previous example can also be achieved with the associated built-in preset:
  4464. @example
  4465. curves=preset=vintage
  4466. @end example
  4467. @item
  4468. Or simply:
  4469. @example
  4470. curves=vintage
  4471. @end example
  4472. @item
  4473. Use a Photoshop preset and redefine the points of the green component:
  4474. @example
  4475. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  4476. @end example
  4477. @end itemize
  4478. @section datascope
  4479. Video data analysis filter.
  4480. This filter shows hexadecimal pixel values of part of video.
  4481. The filter accepts the following options:
  4482. @table @option
  4483. @item size, s
  4484. Set output video size.
  4485. @item x
  4486. Set x offset from where to pick pixels.
  4487. @item y
  4488. Set y offset from where to pick pixels.
  4489. @item mode
  4490. Set scope mode, can be one of the following:
  4491. @table @samp
  4492. @item mono
  4493. Draw hexadecimal pixel values with white color on black background.
  4494. @item color
  4495. Draw hexadecimal pixel values with input video pixel color on black
  4496. background.
  4497. @item color2
  4498. Draw hexadecimal pixel values on color background picked from input video,
  4499. the text color is picked in such way so its always visible.
  4500. @end table
  4501. @item axis
  4502. Draw rows and columns numbers on left and top of video.
  4503. @end table
  4504. @section dctdnoiz
  4505. Denoise frames using 2D DCT (frequency domain filtering).
  4506. This filter is not designed for real time.
  4507. The filter accepts the following options:
  4508. @table @option
  4509. @item sigma, s
  4510. Set the noise sigma constant.
  4511. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4512. coefficient (absolute value) below this threshold with be dropped.
  4513. If you need a more advanced filtering, see @option{expr}.
  4514. Default is @code{0}.
  4515. @item overlap
  4516. Set number overlapping pixels for each block. Since the filter can be slow, you
  4517. may want to reduce this value, at the cost of a less effective filter and the
  4518. risk of various artefacts.
  4519. If the overlapping value doesn't permit processing the whole input width or
  4520. height, a warning will be displayed and according borders won't be denoised.
  4521. Default value is @var{blocksize}-1, which is the best possible setting.
  4522. @item expr, e
  4523. Set the coefficient factor expression.
  4524. For each coefficient of a DCT block, this expression will be evaluated as a
  4525. multiplier value for the coefficient.
  4526. If this is option is set, the @option{sigma} option will be ignored.
  4527. The absolute value of the coefficient can be accessed through the @var{c}
  4528. variable.
  4529. @item n
  4530. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4531. @var{blocksize}, which is the width and height of the processed blocks.
  4532. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4533. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4534. on the speed processing. Also, a larger block size does not necessarily means a
  4535. better de-noising.
  4536. @end table
  4537. @subsection Examples
  4538. Apply a denoise with a @option{sigma} of @code{4.5}:
  4539. @example
  4540. dctdnoiz=4.5
  4541. @end example
  4542. The same operation can be achieved using the expression system:
  4543. @example
  4544. dctdnoiz=e='gte(c, 4.5*3)'
  4545. @end example
  4546. Violent denoise using a block size of @code{16x16}:
  4547. @example
  4548. dctdnoiz=15:n=4
  4549. @end example
  4550. @section deband
  4551. Remove banding artifacts from input video.
  4552. It works by replacing banded pixels with average value of referenced pixels.
  4553. The filter accepts the following options:
  4554. @table @option
  4555. @item 1thr
  4556. @item 2thr
  4557. @item 3thr
  4558. @item 4thr
  4559. Set banding detection threshold for each plane. Default is 0.02.
  4560. Valid range is 0.00003 to 0.5.
  4561. If difference between current pixel and reference pixel is less than threshold,
  4562. it will be considered as banded.
  4563. @item range, r
  4564. Banding detection range in pixels. Default is 16. If positive, random number
  4565. in range 0 to set value will be used. If negative, exact absolute value
  4566. will be used.
  4567. The range defines square of four pixels around current pixel.
  4568. @item direction, d
  4569. Set direction in radians from which four pixel will be compared. If positive,
  4570. random direction from 0 to set direction will be picked. If negative, exact of
  4571. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4572. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4573. column.
  4574. @item blur
  4575. If enabled, current pixel is compared with average value of all four
  4576. surrounding pixels. The default is enabled. If disabled current pixel is
  4577. compared with all four surrounding pixels. The pixel is considered banded
  4578. if only all four differences with surrounding pixels are less than threshold.
  4579. @end table
  4580. @anchor{decimate}
  4581. @section decimate
  4582. Drop duplicated frames at regular intervals.
  4583. The filter accepts the following options:
  4584. @table @option
  4585. @item cycle
  4586. Set the number of frames from which one will be dropped. Setting this to
  4587. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4588. Default is @code{5}.
  4589. @item dupthresh
  4590. Set the threshold for duplicate detection. If the difference metric for a frame
  4591. is less than or equal to this value, then it is declared as duplicate. Default
  4592. is @code{1.1}
  4593. @item scthresh
  4594. Set scene change threshold. Default is @code{15}.
  4595. @item blockx
  4596. @item blocky
  4597. Set the size of the x and y-axis blocks used during metric calculations.
  4598. Larger blocks give better noise suppression, but also give worse detection of
  4599. small movements. Must be a power of two. Default is @code{32}.
  4600. @item ppsrc
  4601. Mark main input as a pre-processed input and activate clean source input
  4602. stream. This allows the input to be pre-processed with various filters to help
  4603. the metrics calculation while keeping the frame selection lossless. When set to
  4604. @code{1}, the first stream is for the pre-processed input, and the second
  4605. stream is the clean source from where the kept frames are chosen. Default is
  4606. @code{0}.
  4607. @item chroma
  4608. Set whether or not chroma is considered in the metric calculations. Default is
  4609. @code{1}.
  4610. @end table
  4611. @section deflate
  4612. Apply deflate effect to the video.
  4613. This filter replaces the pixel by the local(3x3) average by taking into account
  4614. only values lower than the pixel.
  4615. It accepts the following options:
  4616. @table @option
  4617. @item threshold0
  4618. @item threshold1
  4619. @item threshold2
  4620. @item threshold3
  4621. Limit the maximum change for each plane, default is 65535.
  4622. If 0, plane will remain unchanged.
  4623. @end table
  4624. @section dejudder
  4625. Remove judder produced by partially interlaced telecined content.
  4626. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4627. source was partially telecined content then the output of @code{pullup,dejudder}
  4628. will have a variable frame rate. May change the recorded frame rate of the
  4629. container. Aside from that change, this filter will not affect constant frame
  4630. rate video.
  4631. The option available in this filter is:
  4632. @table @option
  4633. @item cycle
  4634. Specify the length of the window over which the judder repeats.
  4635. Accepts any integer greater than 1. Useful values are:
  4636. @table @samp
  4637. @item 4
  4638. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4639. @item 5
  4640. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4641. @item 20
  4642. If a mixture of the two.
  4643. @end table
  4644. The default is @samp{4}.
  4645. @end table
  4646. @section delogo
  4647. Suppress a TV station logo by a simple interpolation of the surrounding
  4648. pixels. Just set a rectangle covering the logo and watch it disappear
  4649. (and sometimes something even uglier appear - your mileage may vary).
  4650. It accepts the following parameters:
  4651. @table @option
  4652. @item x
  4653. @item y
  4654. Specify the top left corner coordinates of the logo. They must be
  4655. specified.
  4656. @item w
  4657. @item h
  4658. Specify the width and height of the logo to clear. They must be
  4659. specified.
  4660. @item band, t
  4661. Specify the thickness of the fuzzy edge of the rectangle (added to
  4662. @var{w} and @var{h}). The default value is 1. This option is
  4663. deprecated, setting higher values should no longer be necessary and
  4664. is not recommended.
  4665. @item show
  4666. When set to 1, a green rectangle is drawn on the screen to simplify
  4667. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4668. The default value is 0.
  4669. The rectangle is drawn on the outermost pixels which will be (partly)
  4670. replaced with interpolated values. The values of the next pixels
  4671. immediately outside this rectangle in each direction will be used to
  4672. compute the interpolated pixel values inside the rectangle.
  4673. @end table
  4674. @subsection Examples
  4675. @itemize
  4676. @item
  4677. Set a rectangle covering the area with top left corner coordinates 0,0
  4678. and size 100x77, and a band of size 10:
  4679. @example
  4680. delogo=x=0:y=0:w=100:h=77:band=10
  4681. @end example
  4682. @end itemize
  4683. @section deshake
  4684. Attempt to fix small changes in horizontal and/or vertical shift. This
  4685. filter helps remove camera shake from hand-holding a camera, bumping a
  4686. tripod, moving on a vehicle, etc.
  4687. The filter accepts the following options:
  4688. @table @option
  4689. @item x
  4690. @item y
  4691. @item w
  4692. @item h
  4693. Specify a rectangular area where to limit the search for motion
  4694. vectors.
  4695. If desired the search for motion vectors can be limited to a
  4696. rectangular area of the frame defined by its top left corner, width
  4697. and height. These parameters have the same meaning as the drawbox
  4698. filter which can be used to visualise the position of the bounding
  4699. box.
  4700. This is useful when simultaneous movement of subjects within the frame
  4701. might be confused for camera motion by the motion vector search.
  4702. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4703. then the full frame is used. This allows later options to be set
  4704. without specifying the bounding box for the motion vector search.
  4705. Default - search the whole frame.
  4706. @item rx
  4707. @item ry
  4708. Specify the maximum extent of movement in x and y directions in the
  4709. range 0-64 pixels. Default 16.
  4710. @item edge
  4711. Specify how to generate pixels to fill blanks at the edge of the
  4712. frame. Available values are:
  4713. @table @samp
  4714. @item blank, 0
  4715. Fill zeroes at blank locations
  4716. @item original, 1
  4717. Original image at blank locations
  4718. @item clamp, 2
  4719. Extruded edge value at blank locations
  4720. @item mirror, 3
  4721. Mirrored edge at blank locations
  4722. @end table
  4723. Default value is @samp{mirror}.
  4724. @item blocksize
  4725. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4726. default 8.
  4727. @item contrast
  4728. Specify the contrast threshold for blocks. Only blocks with more than
  4729. the specified contrast (difference between darkest and lightest
  4730. pixels) will be considered. Range 1-255, default 125.
  4731. @item search
  4732. Specify the search strategy. Available values are:
  4733. @table @samp
  4734. @item exhaustive, 0
  4735. Set exhaustive search
  4736. @item less, 1
  4737. Set less exhaustive search.
  4738. @end table
  4739. Default value is @samp{exhaustive}.
  4740. @item filename
  4741. If set then a detailed log of the motion search is written to the
  4742. specified file.
  4743. @item opencl
  4744. If set to 1, specify using OpenCL capabilities, only available if
  4745. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4746. @end table
  4747. @section detelecine
  4748. Apply an exact inverse of the telecine operation. It requires a predefined
  4749. pattern specified using the pattern option which must be the same as that passed
  4750. to the telecine filter.
  4751. This filter accepts the following options:
  4752. @table @option
  4753. @item first_field
  4754. @table @samp
  4755. @item top, t
  4756. top field first
  4757. @item bottom, b
  4758. bottom field first
  4759. The default value is @code{top}.
  4760. @end table
  4761. @item pattern
  4762. A string of numbers representing the pulldown pattern you wish to apply.
  4763. The default value is @code{23}.
  4764. @item start_frame
  4765. A number representing position of the first frame with respect to the telecine
  4766. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4767. @end table
  4768. @section dilation
  4769. Apply dilation effect to the video.
  4770. This filter replaces the pixel by the local(3x3) maximum.
  4771. It accepts the following options:
  4772. @table @option
  4773. @item threshold0
  4774. @item threshold1
  4775. @item threshold2
  4776. @item threshold3
  4777. Limit the maximum change for each plane, default is 65535.
  4778. If 0, plane will remain unchanged.
  4779. @item coordinates
  4780. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4781. pixels are used.
  4782. Flags to local 3x3 coordinates maps like this:
  4783. 1 2 3
  4784. 4 5
  4785. 6 7 8
  4786. @end table
  4787. @section displace
  4788. Displace pixels as indicated by second and third input stream.
  4789. It takes three input streams and outputs one stream, the first input is the
  4790. source, and second and third input are displacement maps.
  4791. The second input specifies how much to displace pixels along the
  4792. x-axis, while the third input specifies how much to displace pixels
  4793. along the y-axis.
  4794. If one of displacement map streams terminates, last frame from that
  4795. displacement map will be used.
  4796. Note that once generated, displacements maps can be reused over and over again.
  4797. A description of the accepted options follows.
  4798. @table @option
  4799. @item edge
  4800. Set displace behavior for pixels that are out of range.
  4801. Available values are:
  4802. @table @samp
  4803. @item blank
  4804. Missing pixels are replaced by black pixels.
  4805. @item smear
  4806. Adjacent pixels will spread out to replace missing pixels.
  4807. @item wrap
  4808. Out of range pixels are wrapped so they point to pixels of other side.
  4809. @end table
  4810. Default is @samp{smear}.
  4811. @end table
  4812. @subsection Examples
  4813. @itemize
  4814. @item
  4815. Add ripple effect to rgb input of video size hd720:
  4816. @example
  4817. 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
  4818. @end example
  4819. @item
  4820. Add wave effect to rgb input of video size hd720:
  4821. @example
  4822. 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
  4823. @end example
  4824. @end itemize
  4825. @section drawbox
  4826. Draw a colored box on the input image.
  4827. It accepts the following parameters:
  4828. @table @option
  4829. @item x
  4830. @item y
  4831. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4832. @item width, w
  4833. @item height, h
  4834. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4835. the input width and height. It defaults to 0.
  4836. @item color, c
  4837. Specify the color of the box to write. For the general syntax of this option,
  4838. check the "Color" section in the ffmpeg-utils manual. If the special
  4839. value @code{invert} is used, the box edge color is the same as the
  4840. video with inverted luma.
  4841. @item thickness, t
  4842. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4843. See below for the list of accepted constants.
  4844. @end table
  4845. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4846. following constants:
  4847. @table @option
  4848. @item dar
  4849. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4850. @item hsub
  4851. @item vsub
  4852. horizontal and vertical chroma subsample values. For example for the
  4853. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4854. @item in_h, ih
  4855. @item in_w, iw
  4856. The input width and height.
  4857. @item sar
  4858. The input sample aspect ratio.
  4859. @item x
  4860. @item y
  4861. The x and y offset coordinates where the box is drawn.
  4862. @item w
  4863. @item h
  4864. The width and height of the drawn box.
  4865. @item t
  4866. The thickness of the drawn box.
  4867. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4868. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4869. @end table
  4870. @subsection Examples
  4871. @itemize
  4872. @item
  4873. Draw a black box around the edge of the input image:
  4874. @example
  4875. drawbox
  4876. @end example
  4877. @item
  4878. Draw a box with color red and an opacity of 50%:
  4879. @example
  4880. drawbox=10:20:200:60:red@@0.5
  4881. @end example
  4882. The previous example can be specified as:
  4883. @example
  4884. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  4885. @end example
  4886. @item
  4887. Fill the box with pink color:
  4888. @example
  4889. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  4890. @end example
  4891. @item
  4892. Draw a 2-pixel red 2.40:1 mask:
  4893. @example
  4894. 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
  4895. @end example
  4896. @end itemize
  4897. @section drawgraph, adrawgraph
  4898. Draw a graph using input video or audio metadata.
  4899. It accepts the following parameters:
  4900. @table @option
  4901. @item m1
  4902. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  4903. @item fg1
  4904. Set 1st foreground color expression.
  4905. @item m2
  4906. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  4907. @item fg2
  4908. Set 2nd foreground color expression.
  4909. @item m3
  4910. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  4911. @item fg3
  4912. Set 3rd foreground color expression.
  4913. @item m4
  4914. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  4915. @item fg4
  4916. Set 4th foreground color expression.
  4917. @item min
  4918. Set minimal value of metadata value.
  4919. @item max
  4920. Set maximal value of metadata value.
  4921. @item bg
  4922. Set graph background color. Default is white.
  4923. @item mode
  4924. Set graph mode.
  4925. Available values for mode is:
  4926. @table @samp
  4927. @item bar
  4928. @item dot
  4929. @item line
  4930. @end table
  4931. Default is @code{line}.
  4932. @item slide
  4933. Set slide mode.
  4934. Available values for slide is:
  4935. @table @samp
  4936. @item frame
  4937. Draw new frame when right border is reached.
  4938. @item replace
  4939. Replace old columns with new ones.
  4940. @item scroll
  4941. Scroll from right to left.
  4942. @item rscroll
  4943. Scroll from left to right.
  4944. @end table
  4945. Default is @code{frame}.
  4946. @item size
  4947. Set size of graph video. For the syntax of this option, check the
  4948. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  4949. The default value is @code{900x256}.
  4950. The foreground color expressions can use the following variables:
  4951. @table @option
  4952. @item MIN
  4953. Minimal value of metadata value.
  4954. @item MAX
  4955. Maximal value of metadata value.
  4956. @item VAL
  4957. Current metadata key value.
  4958. @end table
  4959. The color is defined as 0xAABBGGRR.
  4960. @end table
  4961. Example using metadata from @ref{signalstats} filter:
  4962. @example
  4963. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  4964. @end example
  4965. Example using metadata from @ref{ebur128} filter:
  4966. @example
  4967. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  4968. @end example
  4969. @section drawgrid
  4970. Draw a grid on the input image.
  4971. It accepts the following parameters:
  4972. @table @option
  4973. @item x
  4974. @item y
  4975. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  4976. @item width, w
  4977. @item height, h
  4978. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  4979. input width and height, respectively, minus @code{thickness}, so image gets
  4980. framed. Default to 0.
  4981. @item color, c
  4982. Specify the color of the grid. For the general syntax of this option,
  4983. check the "Color" section in the ffmpeg-utils manual. If the special
  4984. value @code{invert} is used, the grid color is the same as the
  4985. video with inverted luma.
  4986. @item thickness, t
  4987. The expression which sets the thickness of the grid line. Default value is @code{1}.
  4988. See below for the list of accepted constants.
  4989. @end table
  4990. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4991. following constants:
  4992. @table @option
  4993. @item dar
  4994. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4995. @item hsub
  4996. @item vsub
  4997. horizontal and vertical chroma subsample values. For example for the
  4998. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4999. @item in_h, ih
  5000. @item in_w, iw
  5001. The input grid cell width and height.
  5002. @item sar
  5003. The input sample aspect ratio.
  5004. @item x
  5005. @item y
  5006. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5007. @item w
  5008. @item h
  5009. The width and height of the drawn cell.
  5010. @item t
  5011. The thickness of the drawn cell.
  5012. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5013. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5014. @end table
  5015. @subsection Examples
  5016. @itemize
  5017. @item
  5018. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5019. @example
  5020. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5021. @end example
  5022. @item
  5023. Draw a white 3x3 grid with an opacity of 50%:
  5024. @example
  5025. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5026. @end example
  5027. @end itemize
  5028. @anchor{drawtext}
  5029. @section drawtext
  5030. Draw a text string or text from a specified file on top of a video, using the
  5031. libfreetype library.
  5032. To enable compilation of this filter, you need to configure FFmpeg with
  5033. @code{--enable-libfreetype}.
  5034. To enable default font fallback and the @var{font} option you need to
  5035. configure FFmpeg with @code{--enable-libfontconfig}.
  5036. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5037. @code{--enable-libfribidi}.
  5038. @subsection Syntax
  5039. It accepts the following parameters:
  5040. @table @option
  5041. @item box
  5042. Used to draw a box around text using the background color.
  5043. The value must be either 1 (enable) or 0 (disable).
  5044. The default value of @var{box} is 0.
  5045. @item boxborderw
  5046. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5047. The default value of @var{boxborderw} is 0.
  5048. @item boxcolor
  5049. The color to be used for drawing box around text. For the syntax of this
  5050. option, check the "Color" section in the ffmpeg-utils manual.
  5051. The default value of @var{boxcolor} is "white".
  5052. @item borderw
  5053. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5054. The default value of @var{borderw} is 0.
  5055. @item bordercolor
  5056. Set the color to be used for drawing border around text. For the syntax of this
  5057. option, check the "Color" section in the ffmpeg-utils manual.
  5058. The default value of @var{bordercolor} is "black".
  5059. @item expansion
  5060. Select how the @var{text} is expanded. Can be either @code{none},
  5061. @code{strftime} (deprecated) or
  5062. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5063. below for details.
  5064. @item fix_bounds
  5065. If true, check and fix text coords to avoid clipping.
  5066. @item fontcolor
  5067. The color to be used for drawing fonts. For the syntax of this option, check
  5068. the "Color" section in the ffmpeg-utils manual.
  5069. The default value of @var{fontcolor} is "black".
  5070. @item fontcolor_expr
  5071. String which is expanded the same way as @var{text} to obtain dynamic
  5072. @var{fontcolor} value. By default this option has empty value and is not
  5073. processed. When this option is set, it overrides @var{fontcolor} option.
  5074. @item font
  5075. The font family to be used for drawing text. By default Sans.
  5076. @item fontfile
  5077. The font file to be used for drawing text. The path must be included.
  5078. This parameter is mandatory if the fontconfig support is disabled.
  5079. @item draw
  5080. This option does not exist, please see the timeline system
  5081. @item alpha
  5082. Draw the text applying alpha blending. The value can
  5083. be either a number between 0.0 and 1.0
  5084. The expression accepts the same variables @var{x, y} do.
  5085. The default value is 1.
  5086. Please see fontcolor_expr
  5087. @item fontsize
  5088. The font size to be used for drawing text.
  5089. The default value of @var{fontsize} is 16.
  5090. @item text_shaping
  5091. If set to 1, attempt to shape the text (for example, reverse the order of
  5092. right-to-left text and join Arabic characters) before drawing it.
  5093. Otherwise, just draw the text exactly as given.
  5094. By default 1 (if supported).
  5095. @item ft_load_flags
  5096. The flags to be used for loading the fonts.
  5097. The flags map the corresponding flags supported by libfreetype, and are
  5098. a combination of the following values:
  5099. @table @var
  5100. @item default
  5101. @item no_scale
  5102. @item no_hinting
  5103. @item render
  5104. @item no_bitmap
  5105. @item vertical_layout
  5106. @item force_autohint
  5107. @item crop_bitmap
  5108. @item pedantic
  5109. @item ignore_global_advance_width
  5110. @item no_recurse
  5111. @item ignore_transform
  5112. @item monochrome
  5113. @item linear_design
  5114. @item no_autohint
  5115. @end table
  5116. Default value is "default".
  5117. For more information consult the documentation for the FT_LOAD_*
  5118. libfreetype flags.
  5119. @item shadowcolor
  5120. The color to be used for drawing a shadow behind the drawn text. For the
  5121. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5122. The default value of @var{shadowcolor} is "black".
  5123. @item shadowx
  5124. @item shadowy
  5125. The x and y offsets for the text shadow position with respect to the
  5126. position of the text. They can be either positive or negative
  5127. values. The default value for both is "0".
  5128. @item start_number
  5129. The starting frame number for the n/frame_num variable. The default value
  5130. is "0".
  5131. @item tabsize
  5132. The size in number of spaces to use for rendering the tab.
  5133. Default value is 4.
  5134. @item timecode
  5135. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5136. format. It can be used with or without text parameter. @var{timecode_rate}
  5137. option must be specified.
  5138. @item timecode_rate, rate, r
  5139. Set the timecode frame rate (timecode only).
  5140. @item text
  5141. The text string to be drawn. The text must be a sequence of UTF-8
  5142. encoded characters.
  5143. This parameter is mandatory if no file is specified with the parameter
  5144. @var{textfile}.
  5145. @item textfile
  5146. A text file containing text to be drawn. The text must be a sequence
  5147. of UTF-8 encoded characters.
  5148. This parameter is mandatory if no text string is specified with the
  5149. parameter @var{text}.
  5150. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5151. @item reload
  5152. If set to 1, the @var{textfile} will be reloaded before each frame.
  5153. Be sure to update it atomically, or it may be read partially, or even fail.
  5154. @item x
  5155. @item y
  5156. The expressions which specify the offsets where text will be drawn
  5157. within the video frame. They are relative to the top/left border of the
  5158. output image.
  5159. The default value of @var{x} and @var{y} is "0".
  5160. See below for the list of accepted constants and functions.
  5161. @end table
  5162. The parameters for @var{x} and @var{y} are expressions containing the
  5163. following constants and functions:
  5164. @table @option
  5165. @item dar
  5166. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5167. @item hsub
  5168. @item vsub
  5169. horizontal and vertical chroma subsample values. For example for the
  5170. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5171. @item line_h, lh
  5172. the height of each text line
  5173. @item main_h, h, H
  5174. the input height
  5175. @item main_w, w, W
  5176. the input width
  5177. @item max_glyph_a, ascent
  5178. the maximum distance from the baseline to the highest/upper grid
  5179. coordinate used to place a glyph outline point, for all the rendered
  5180. glyphs.
  5181. It is a positive value, due to the grid's orientation with the Y axis
  5182. upwards.
  5183. @item max_glyph_d, descent
  5184. the maximum distance from the baseline to the lowest grid coordinate
  5185. used to place a glyph outline point, for all the rendered glyphs.
  5186. This is a negative value, due to the grid's orientation, with the Y axis
  5187. upwards.
  5188. @item max_glyph_h
  5189. maximum glyph height, that is the maximum height for all the glyphs
  5190. contained in the rendered text, it is equivalent to @var{ascent} -
  5191. @var{descent}.
  5192. @item max_glyph_w
  5193. maximum glyph width, that is the maximum width for all the glyphs
  5194. contained in the rendered text
  5195. @item n
  5196. the number of input frame, starting from 0
  5197. @item rand(min, max)
  5198. return a random number included between @var{min} and @var{max}
  5199. @item sar
  5200. The input sample aspect ratio.
  5201. @item t
  5202. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5203. @item text_h, th
  5204. the height of the rendered text
  5205. @item text_w, tw
  5206. the width of the rendered text
  5207. @item x
  5208. @item y
  5209. the x and y offset coordinates where the text is drawn.
  5210. These parameters allow the @var{x} and @var{y} expressions to refer
  5211. each other, so you can for example specify @code{y=x/dar}.
  5212. @end table
  5213. @anchor{drawtext_expansion}
  5214. @subsection Text expansion
  5215. If @option{expansion} is set to @code{strftime},
  5216. the filter recognizes strftime() sequences in the provided text and
  5217. expands them accordingly. Check the documentation of strftime(). This
  5218. feature is deprecated.
  5219. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5220. If @option{expansion} is set to @code{normal} (which is the default),
  5221. the following expansion mechanism is used.
  5222. The backslash character @samp{\}, followed by any character, always expands to
  5223. the second character.
  5224. Sequence of the form @code{%@{...@}} are expanded. The text between the
  5225. braces is a function name, possibly followed by arguments separated by ':'.
  5226. If the arguments contain special characters or delimiters (':' or '@}'),
  5227. they should be escaped.
  5228. Note that they probably must also be escaped as the value for the
  5229. @option{text} option in the filter argument string and as the filter
  5230. argument in the filtergraph description, and possibly also for the shell,
  5231. that makes up to four levels of escaping; using a text file avoids these
  5232. problems.
  5233. The following functions are available:
  5234. @table @command
  5235. @item expr, e
  5236. The expression evaluation result.
  5237. It must take one argument specifying the expression to be evaluated,
  5238. which accepts the same constants and functions as the @var{x} and
  5239. @var{y} values. Note that not all constants should be used, for
  5240. example the text size is not known when evaluating the expression, so
  5241. the constants @var{text_w} and @var{text_h} will have an undefined
  5242. value.
  5243. @item expr_int_format, eif
  5244. Evaluate the expression's value and output as formatted integer.
  5245. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5246. The second argument specifies the output format. Allowed values are @samp{x},
  5247. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5248. @code{printf} function.
  5249. The third parameter is optional and sets the number of positions taken by the output.
  5250. It can be used to add padding with zeros from the left.
  5251. @item gmtime
  5252. The time at which the filter is running, expressed in UTC.
  5253. It can accept an argument: a strftime() format string.
  5254. @item localtime
  5255. The time at which the filter is running, expressed in the local time zone.
  5256. It can accept an argument: a strftime() format string.
  5257. @item metadata
  5258. Frame metadata. Takes one or two arguments.
  5259. The first argument is mandatory and specifies the metadata key.
  5260. The second argument is optional and specifies a default value, used when the
  5261. metadata key is not found or empty.
  5262. @item n, frame_num
  5263. The frame number, starting from 0.
  5264. @item pict_type
  5265. A 1 character description of the current picture type.
  5266. @item pts
  5267. The timestamp of the current frame.
  5268. It can take up to three arguments.
  5269. The first argument is the format of the timestamp; it defaults to @code{flt}
  5270. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5271. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5272. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5273. @code{localtime} stands for the timestamp of the frame formatted as
  5274. local time zone time.
  5275. The second argument is an offset added to the timestamp.
  5276. If the format is set to @code{localtime} or @code{gmtime},
  5277. a third argument may be supplied: a strftime() format string.
  5278. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5279. @end table
  5280. @subsection Examples
  5281. @itemize
  5282. @item
  5283. Draw "Test Text" with font FreeSerif, using the default values for the
  5284. optional parameters.
  5285. @example
  5286. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5287. @end example
  5288. @item
  5289. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5290. and y=50 (counting from the top-left corner of the screen), text is
  5291. yellow with a red box around it. Both the text and the box have an
  5292. opacity of 20%.
  5293. @example
  5294. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5295. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5296. @end example
  5297. Note that the double quotes are not necessary if spaces are not used
  5298. within the parameter list.
  5299. @item
  5300. Show the text at the center of the video frame:
  5301. @example
  5302. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5303. @end example
  5304. @item
  5305. Show the text at a random position, switching to a new position every 30 seconds:
  5306. @example
  5307. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=if(eq(mod(t\,30)\,0)\,rand(0\,(w-text_w))\,x):y=if(eq(mod(t\,30)\,0)\,rand(0\,(h-text_h))\,y)"
  5308. @end example
  5309. @item
  5310. Show a text line sliding from right to left in the last row of the video
  5311. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5312. with no newlines.
  5313. @example
  5314. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5315. @end example
  5316. @item
  5317. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5318. @example
  5319. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5320. @end example
  5321. @item
  5322. Draw a single green letter "g", at the center of the input video.
  5323. The glyph baseline is placed at half screen height.
  5324. @example
  5325. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5326. @end example
  5327. @item
  5328. Show text for 1 second every 3 seconds:
  5329. @example
  5330. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5331. @end example
  5332. @item
  5333. Use fontconfig to set the font. Note that the colons need to be escaped.
  5334. @example
  5335. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5336. @end example
  5337. @item
  5338. Print the date of a real-time encoding (see strftime(3)):
  5339. @example
  5340. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5341. @end example
  5342. @item
  5343. Show text fading in and out (appearing/disappearing):
  5344. @example
  5345. #!/bin/sh
  5346. DS=1.0 # display start
  5347. DE=10.0 # display end
  5348. FID=1.5 # fade in duration
  5349. FOD=5 # fade out duration
  5350. 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 @}"
  5351. @end example
  5352. @end itemize
  5353. For more information about libfreetype, check:
  5354. @url{http://www.freetype.org/}.
  5355. For more information about fontconfig, check:
  5356. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5357. For more information about libfribidi, check:
  5358. @url{http://fribidi.org/}.
  5359. @section edgedetect
  5360. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5361. The filter accepts the following options:
  5362. @table @option
  5363. @item low
  5364. @item high
  5365. Set low and high threshold values used by the Canny thresholding
  5366. algorithm.
  5367. The high threshold selects the "strong" edge pixels, which are then
  5368. connected through 8-connectivity with the "weak" edge pixels selected
  5369. by the low threshold.
  5370. @var{low} and @var{high} threshold values must be chosen in the range
  5371. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5372. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5373. is @code{50/255}.
  5374. @item mode
  5375. Define the drawing mode.
  5376. @table @samp
  5377. @item wires
  5378. Draw white/gray wires on black background.
  5379. @item colormix
  5380. Mix the colors to create a paint/cartoon effect.
  5381. @end table
  5382. Default value is @var{wires}.
  5383. @end table
  5384. @subsection Examples
  5385. @itemize
  5386. @item
  5387. Standard edge detection with custom values for the hysteresis thresholding:
  5388. @example
  5389. edgedetect=low=0.1:high=0.4
  5390. @end example
  5391. @item
  5392. Painting effect without thresholding:
  5393. @example
  5394. edgedetect=mode=colormix:high=0
  5395. @end example
  5396. @end itemize
  5397. @section eq
  5398. Set brightness, contrast, saturation and approximate gamma adjustment.
  5399. The filter accepts the following options:
  5400. @table @option
  5401. @item contrast
  5402. Set the contrast expression. The value must be a float value in range
  5403. @code{-2.0} to @code{2.0}. The default value is "1".
  5404. @item brightness
  5405. Set the brightness expression. The value must be a float value in
  5406. range @code{-1.0} to @code{1.0}. The default value is "0".
  5407. @item saturation
  5408. Set the saturation expression. The value must be a float in
  5409. range @code{0.0} to @code{3.0}. The default value is "1".
  5410. @item gamma
  5411. Set the gamma expression. The value must be a float in range
  5412. @code{0.1} to @code{10.0}. The default value is "1".
  5413. @item gamma_r
  5414. Set the gamma expression for red. The value must be a float in
  5415. range @code{0.1} to @code{10.0}. The default value is "1".
  5416. @item gamma_g
  5417. Set the gamma expression for green. The value must be a float in range
  5418. @code{0.1} to @code{10.0}. The default value is "1".
  5419. @item gamma_b
  5420. Set the gamma expression for blue. The value must be a float in range
  5421. @code{0.1} to @code{10.0}. The default value is "1".
  5422. @item gamma_weight
  5423. Set the gamma weight expression. It can be used to reduce the effect
  5424. of a high gamma value on bright image areas, e.g. keep them from
  5425. getting overamplified and just plain white. The value must be a float
  5426. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5427. gamma correction all the way down while @code{1.0} leaves it at its
  5428. full strength. Default is "1".
  5429. @item eval
  5430. Set when the expressions for brightness, contrast, saturation and
  5431. gamma expressions are evaluated.
  5432. It accepts the following values:
  5433. @table @samp
  5434. @item init
  5435. only evaluate expressions once during the filter initialization or
  5436. when a command is processed
  5437. @item frame
  5438. evaluate expressions for each incoming frame
  5439. @end table
  5440. Default value is @samp{init}.
  5441. @end table
  5442. The expressions accept the following parameters:
  5443. @table @option
  5444. @item n
  5445. frame count of the input frame starting from 0
  5446. @item pos
  5447. byte position of the corresponding packet in the input file, NAN if
  5448. unspecified
  5449. @item r
  5450. frame rate of the input video, NAN if the input frame rate is unknown
  5451. @item t
  5452. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5453. @end table
  5454. @subsection Commands
  5455. The filter supports the following commands:
  5456. @table @option
  5457. @item contrast
  5458. Set the contrast expression.
  5459. @item brightness
  5460. Set the brightness expression.
  5461. @item saturation
  5462. Set the saturation expression.
  5463. @item gamma
  5464. Set the gamma expression.
  5465. @item gamma_r
  5466. Set the gamma_r expression.
  5467. @item gamma_g
  5468. Set gamma_g expression.
  5469. @item gamma_b
  5470. Set gamma_b expression.
  5471. @item gamma_weight
  5472. Set gamma_weight expression.
  5473. The command accepts the same syntax of the corresponding option.
  5474. If the specified expression is not valid, it is kept at its current
  5475. value.
  5476. @end table
  5477. @section erosion
  5478. Apply erosion effect to the video.
  5479. This filter replaces the pixel by the local(3x3) minimum.
  5480. It accepts the following options:
  5481. @table @option
  5482. @item threshold0
  5483. @item threshold1
  5484. @item threshold2
  5485. @item threshold3
  5486. Limit the maximum change for each plane, default is 65535.
  5487. If 0, plane will remain unchanged.
  5488. @item coordinates
  5489. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5490. pixels are used.
  5491. Flags to local 3x3 coordinates maps like this:
  5492. 1 2 3
  5493. 4 5
  5494. 6 7 8
  5495. @end table
  5496. @section extractplanes
  5497. Extract color channel components from input video stream into
  5498. separate grayscale video streams.
  5499. The filter accepts the following option:
  5500. @table @option
  5501. @item planes
  5502. Set plane(s) to extract.
  5503. Available values for planes are:
  5504. @table @samp
  5505. @item y
  5506. @item u
  5507. @item v
  5508. @item a
  5509. @item r
  5510. @item g
  5511. @item b
  5512. @end table
  5513. Choosing planes not available in the input will result in an error.
  5514. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5515. with @code{y}, @code{u}, @code{v} planes at same time.
  5516. @end table
  5517. @subsection Examples
  5518. @itemize
  5519. @item
  5520. Extract luma, u and v color channel component from input video frame
  5521. into 3 grayscale outputs:
  5522. @example
  5523. 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
  5524. @end example
  5525. @end itemize
  5526. @section elbg
  5527. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5528. For each input image, the filter will compute the optimal mapping from
  5529. the input to the output given the codebook length, that is the number
  5530. of distinct output colors.
  5531. This filter accepts the following options.
  5532. @table @option
  5533. @item codebook_length, l
  5534. Set codebook length. The value must be a positive integer, and
  5535. represents the number of distinct output colors. Default value is 256.
  5536. @item nb_steps, n
  5537. Set the maximum number of iterations to apply for computing the optimal
  5538. mapping. The higher the value the better the result and the higher the
  5539. computation time. Default value is 1.
  5540. @item seed, s
  5541. Set a random seed, must be an integer included between 0 and
  5542. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5543. will try to use a good random seed on a best effort basis.
  5544. @item pal8
  5545. Set pal8 output pixel format. This option does not work with codebook
  5546. length greater than 256.
  5547. @end table
  5548. @section fade
  5549. Apply a fade-in/out effect to the input video.
  5550. It accepts the following parameters:
  5551. @table @option
  5552. @item type, t
  5553. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5554. effect.
  5555. Default is @code{in}.
  5556. @item start_frame, s
  5557. Specify the number of the frame to start applying the fade
  5558. effect at. Default is 0.
  5559. @item nb_frames, n
  5560. The number of frames that the fade effect lasts. At the end of the
  5561. fade-in effect, the output video will have the same intensity as the input video.
  5562. At the end of the fade-out transition, the output video will be filled with the
  5563. selected @option{color}.
  5564. Default is 25.
  5565. @item alpha
  5566. If set to 1, fade only alpha channel, if one exists on the input.
  5567. Default value is 0.
  5568. @item start_time, st
  5569. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5570. effect. If both start_frame and start_time are specified, the fade will start at
  5571. whichever comes last. Default is 0.
  5572. @item duration, d
  5573. The number of seconds for which the fade effect has to last. At the end of the
  5574. fade-in effect the output video will have the same intensity as the input video,
  5575. at the end of the fade-out transition the output video will be filled with the
  5576. selected @option{color}.
  5577. If both duration and nb_frames are specified, duration is used. Default is 0
  5578. (nb_frames is used by default).
  5579. @item color, c
  5580. Specify the color of the fade. Default is "black".
  5581. @end table
  5582. @subsection Examples
  5583. @itemize
  5584. @item
  5585. Fade in the first 30 frames of video:
  5586. @example
  5587. fade=in:0:30
  5588. @end example
  5589. The command above is equivalent to:
  5590. @example
  5591. fade=t=in:s=0:n=30
  5592. @end example
  5593. @item
  5594. Fade out the last 45 frames of a 200-frame video:
  5595. @example
  5596. fade=out:155:45
  5597. fade=type=out:start_frame=155:nb_frames=45
  5598. @end example
  5599. @item
  5600. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5601. @example
  5602. fade=in:0:25, fade=out:975:25
  5603. @end example
  5604. @item
  5605. Make the first 5 frames yellow, then fade in from frame 5-24:
  5606. @example
  5607. fade=in:5:20:color=yellow
  5608. @end example
  5609. @item
  5610. Fade in alpha over first 25 frames of video:
  5611. @example
  5612. fade=in:0:25:alpha=1
  5613. @end example
  5614. @item
  5615. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5616. @example
  5617. fade=t=in:st=5.5:d=0.5
  5618. @end example
  5619. @end itemize
  5620. @section fftfilt
  5621. Apply arbitrary expressions to samples in frequency domain
  5622. @table @option
  5623. @item dc_Y
  5624. Adjust the dc value (gain) of the luma plane of the image. The filter
  5625. accepts an integer value in range @code{0} to @code{1000}. The default
  5626. value is set to @code{0}.
  5627. @item dc_U
  5628. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5629. filter accepts an integer value in range @code{0} to @code{1000}. The
  5630. default value is set to @code{0}.
  5631. @item dc_V
  5632. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5633. filter accepts an integer value in range @code{0} to @code{1000}. The
  5634. default value is set to @code{0}.
  5635. @item weight_Y
  5636. Set the frequency domain weight expression for the luma plane.
  5637. @item weight_U
  5638. Set the frequency domain weight expression for the 1st chroma plane.
  5639. @item weight_V
  5640. Set the frequency domain weight expression for the 2nd chroma plane.
  5641. The filter accepts the following variables:
  5642. @item X
  5643. @item Y
  5644. The coordinates of the current sample.
  5645. @item W
  5646. @item H
  5647. The width and height of the image.
  5648. @end table
  5649. @subsection Examples
  5650. @itemize
  5651. @item
  5652. High-pass:
  5653. @example
  5654. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5655. @end example
  5656. @item
  5657. Low-pass:
  5658. @example
  5659. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5660. @end example
  5661. @item
  5662. Sharpen:
  5663. @example
  5664. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5665. @end example
  5666. @item
  5667. Blur:
  5668. @example
  5669. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5670. @end example
  5671. @end itemize
  5672. @section field
  5673. Extract a single field from an interlaced image using stride
  5674. arithmetic to avoid wasting CPU time. The output frames are marked as
  5675. non-interlaced.
  5676. The filter accepts the following options:
  5677. @table @option
  5678. @item type
  5679. Specify whether to extract the top (if the value is @code{0} or
  5680. @code{top}) or the bottom field (if the value is @code{1} or
  5681. @code{bottom}).
  5682. @end table
  5683. @section fieldhint
  5684. Create new frames by copying the top and bottom fields from surrounding frames
  5685. supplied as numbers by the hint file.
  5686. @table @option
  5687. @item hint
  5688. Set file containing hints: absolute/relative frame numbers.
  5689. There must be one line for each frame in a clip. Each line must contain two
  5690. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5691. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5692. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5693. for @code{relative} mode. First number tells from which frame to pick up top
  5694. field and second number tells from which frame to pick up bottom field.
  5695. If optionally followed by @code{+} output frame will be marked as interlaced,
  5696. else if followed by @code{-} output frame will be marked as progressive, else
  5697. it will be marked same as input frame.
  5698. If line starts with @code{#} or @code{;} that line is skipped.
  5699. @item mode
  5700. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5701. @end table
  5702. Example of first several lines of @code{hint} file for @code{relative} mode:
  5703. @example
  5704. 0,0 - # first frame
  5705. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5706. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5707. 1,0 -
  5708. 0,0 -
  5709. 0,0 -
  5710. 1,0 -
  5711. 1,0 -
  5712. 1,0 -
  5713. 0,0 -
  5714. 0,0 -
  5715. 1,0 -
  5716. 1,0 -
  5717. 1,0 -
  5718. 0,0 -
  5719. @end example
  5720. @section fieldmatch
  5721. Field matching filter for inverse telecine. It is meant to reconstruct the
  5722. progressive frames from a telecined stream. The filter does not drop duplicated
  5723. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5724. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5725. The separation of the field matching and the decimation is notably motivated by
  5726. the possibility of inserting a de-interlacing filter fallback between the two.
  5727. If the source has mixed telecined and real interlaced content,
  5728. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5729. But these remaining combed frames will be marked as interlaced, and thus can be
  5730. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5731. In addition to the various configuration options, @code{fieldmatch} can take an
  5732. optional second stream, activated through the @option{ppsrc} option. If
  5733. enabled, the frames reconstruction will be based on the fields and frames from
  5734. this second stream. This allows the first input to be pre-processed in order to
  5735. help the various algorithms of the filter, while keeping the output lossless
  5736. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5737. or brightness/contrast adjustments can help.
  5738. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5739. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5740. which @code{fieldmatch} is based on. While the semantic and usage are very
  5741. close, some behaviour and options names can differ.
  5742. The @ref{decimate} filter currently only works for constant frame rate input.
  5743. If your input has mixed telecined (30fps) and progressive content with a lower
  5744. framerate like 24fps use the following filterchain to produce the necessary cfr
  5745. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5746. The filter accepts the following options:
  5747. @table @option
  5748. @item order
  5749. Specify the assumed field order of the input stream. Available values are:
  5750. @table @samp
  5751. @item auto
  5752. Auto detect parity (use FFmpeg's internal parity value).
  5753. @item bff
  5754. Assume bottom field first.
  5755. @item tff
  5756. Assume top field first.
  5757. @end table
  5758. Note that it is sometimes recommended not to trust the parity announced by the
  5759. stream.
  5760. Default value is @var{auto}.
  5761. @item mode
  5762. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5763. sense that it won't risk creating jerkiness due to duplicate frames when
  5764. possible, but if there are bad edits or blended fields it will end up
  5765. outputting combed frames when a good match might actually exist. On the other
  5766. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5767. but will almost always find a good frame if there is one. The other values are
  5768. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5769. jerkiness and creating duplicate frames versus finding good matches in sections
  5770. with bad edits, orphaned fields, blended fields, etc.
  5771. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5772. Available values are:
  5773. @table @samp
  5774. @item pc
  5775. 2-way matching (p/c)
  5776. @item pc_n
  5777. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5778. @item pc_u
  5779. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5780. @item pc_n_ub
  5781. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5782. still combed (p/c + n + u/b)
  5783. @item pcn
  5784. 3-way matching (p/c/n)
  5785. @item pcn_ub
  5786. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5787. detected as combed (p/c/n + u/b)
  5788. @end table
  5789. The parenthesis at the end indicate the matches that would be used for that
  5790. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5791. @var{top}).
  5792. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5793. the slowest.
  5794. Default value is @var{pc_n}.
  5795. @item ppsrc
  5796. Mark the main input stream as a pre-processed input, and enable the secondary
  5797. input stream as the clean source to pick the fields from. See the filter
  5798. introduction for more details. It is similar to the @option{clip2} feature from
  5799. VFM/TFM.
  5800. Default value is @code{0} (disabled).
  5801. @item field
  5802. Set the field to match from. It is recommended to set this to the same value as
  5803. @option{order} unless you experience matching failures with that setting. In
  5804. certain circumstances changing the field that is used to match from can have a
  5805. large impact on matching performance. Available values are:
  5806. @table @samp
  5807. @item auto
  5808. Automatic (same value as @option{order}).
  5809. @item bottom
  5810. Match from the bottom field.
  5811. @item top
  5812. Match from the top field.
  5813. @end table
  5814. Default value is @var{auto}.
  5815. @item mchroma
  5816. Set whether or not chroma is included during the match comparisons. In most
  5817. cases it is recommended to leave this enabled. You should set this to @code{0}
  5818. only if your clip has bad chroma problems such as heavy rainbowing or other
  5819. artifacts. Setting this to @code{0} could also be used to speed things up at
  5820. the cost of some accuracy.
  5821. Default value is @code{1}.
  5822. @item y0
  5823. @item y1
  5824. These define an exclusion band which excludes the lines between @option{y0} and
  5825. @option{y1} from being included in the field matching decision. An exclusion
  5826. band can be used to ignore subtitles, a logo, or other things that may
  5827. interfere with the matching. @option{y0} sets the starting scan line and
  5828. @option{y1} sets the ending line; all lines in between @option{y0} and
  5829. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5830. @option{y0} and @option{y1} to the same value will disable the feature.
  5831. @option{y0} and @option{y1} defaults to @code{0}.
  5832. @item scthresh
  5833. Set the scene change detection threshold as a percentage of maximum change on
  5834. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5835. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5836. @option{scthresh} is @code{[0.0, 100.0]}.
  5837. Default value is @code{12.0}.
  5838. @item combmatch
  5839. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5840. account the combed scores of matches when deciding what match to use as the
  5841. final match. Available values are:
  5842. @table @samp
  5843. @item none
  5844. No final matching based on combed scores.
  5845. @item sc
  5846. Combed scores are only used when a scene change is detected.
  5847. @item full
  5848. Use combed scores all the time.
  5849. @end table
  5850. Default is @var{sc}.
  5851. @item combdbg
  5852. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5853. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5854. Available values are:
  5855. @table @samp
  5856. @item none
  5857. No forced calculation.
  5858. @item pcn
  5859. Force p/c/n calculations.
  5860. @item pcnub
  5861. Force p/c/n/u/b calculations.
  5862. @end table
  5863. Default value is @var{none}.
  5864. @item cthresh
  5865. This is the area combing threshold used for combed frame detection. This
  5866. essentially controls how "strong" or "visible" combing must be to be detected.
  5867. Larger values mean combing must be more visible and smaller values mean combing
  5868. can be less visible or strong and still be detected. Valid settings are from
  5869. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5870. be detected as combed). This is basically a pixel difference value. A good
  5871. range is @code{[8, 12]}.
  5872. Default value is @code{9}.
  5873. @item chroma
  5874. Sets whether or not chroma is considered in the combed frame decision. Only
  5875. disable this if your source has chroma problems (rainbowing, etc.) that are
  5876. causing problems for the combed frame detection with chroma enabled. Actually,
  5877. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5878. where there is chroma only combing in the source.
  5879. Default value is @code{0}.
  5880. @item blockx
  5881. @item blocky
  5882. Respectively set the x-axis and y-axis size of the window used during combed
  5883. frame detection. This has to do with the size of the area in which
  5884. @option{combpel} pixels are required to be detected as combed for a frame to be
  5885. declared combed. See the @option{combpel} parameter description for more info.
  5886. Possible values are any number that is a power of 2 starting at 4 and going up
  5887. to 512.
  5888. Default value is @code{16}.
  5889. @item combpel
  5890. The number of combed pixels inside any of the @option{blocky} by
  5891. @option{blockx} size blocks on the frame for the frame to be detected as
  5892. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5893. setting controls "how much" combing there must be in any localized area (a
  5894. window defined by the @option{blockx} and @option{blocky} settings) on the
  5895. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5896. which point no frames will ever be detected as combed). This setting is known
  5897. as @option{MI} in TFM/VFM vocabulary.
  5898. Default value is @code{80}.
  5899. @end table
  5900. @anchor{p/c/n/u/b meaning}
  5901. @subsection p/c/n/u/b meaning
  5902. @subsubsection p/c/n
  5903. We assume the following telecined stream:
  5904. @example
  5905. Top fields: 1 2 2 3 4
  5906. Bottom fields: 1 2 3 4 4
  5907. @end example
  5908. The numbers correspond to the progressive frame the fields relate to. Here, the
  5909. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5910. When @code{fieldmatch} is configured to run a matching from bottom
  5911. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5912. @example
  5913. Input stream:
  5914. T 1 2 2 3 4
  5915. B 1 2 3 4 4 <-- matching reference
  5916. Matches: c c n n c
  5917. Output stream:
  5918. T 1 2 3 4 4
  5919. B 1 2 3 4 4
  5920. @end example
  5921. As a result of the field matching, we can see that some frames get duplicated.
  5922. To perform a complete inverse telecine, you need to rely on a decimation filter
  5923. after this operation. See for instance the @ref{decimate} filter.
  5924. The same operation now matching from top fields (@option{field}=@var{top})
  5925. looks like this:
  5926. @example
  5927. Input stream:
  5928. T 1 2 2 3 4 <-- matching reference
  5929. B 1 2 3 4 4
  5930. Matches: c c p p c
  5931. Output stream:
  5932. T 1 2 2 3 4
  5933. B 1 2 2 3 4
  5934. @end example
  5935. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5936. basically, they refer to the frame and field of the opposite parity:
  5937. @itemize
  5938. @item @var{p} matches the field of the opposite parity in the previous frame
  5939. @item @var{c} matches the field of the opposite parity in the current frame
  5940. @item @var{n} matches the field of the opposite parity in the next frame
  5941. @end itemize
  5942. @subsubsection u/b
  5943. The @var{u} and @var{b} matching are a bit special in the sense that they match
  5944. from the opposite parity flag. In the following examples, we assume that we are
  5945. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  5946. 'x' is placed above and below each matched fields.
  5947. With bottom matching (@option{field}=@var{bottom}):
  5948. @example
  5949. Match: c p n b u
  5950. x x x x x
  5951. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5952. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5953. x x x x x
  5954. Output frames:
  5955. 2 1 2 2 2
  5956. 2 2 2 1 3
  5957. @end example
  5958. With top matching (@option{field}=@var{top}):
  5959. @example
  5960. Match: c p n b u
  5961. x x x x x
  5962. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5963. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5964. x x x x x
  5965. Output frames:
  5966. 2 2 2 1 2
  5967. 2 1 3 2 2
  5968. @end example
  5969. @subsection Examples
  5970. Simple IVTC of a top field first telecined stream:
  5971. @example
  5972. fieldmatch=order=tff:combmatch=none, decimate
  5973. @end example
  5974. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  5975. @example
  5976. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  5977. @end example
  5978. @section fieldorder
  5979. Transform the field order of the input video.
  5980. It accepts the following parameters:
  5981. @table @option
  5982. @item order
  5983. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  5984. for bottom field first.
  5985. @end table
  5986. The default value is @samp{tff}.
  5987. The transformation is done by shifting the picture content up or down
  5988. by one line, and filling the remaining line with appropriate picture content.
  5989. This method is consistent with most broadcast field order converters.
  5990. If the input video is not flagged as being interlaced, or it is already
  5991. flagged as being of the required output field order, then this filter does
  5992. not alter the incoming video.
  5993. It is very useful when converting to or from PAL DV material,
  5994. which is bottom field first.
  5995. For example:
  5996. @example
  5997. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  5998. @end example
  5999. @section fifo, afifo
  6000. Buffer input images and send them when they are requested.
  6001. It is mainly useful when auto-inserted by the libavfilter
  6002. framework.
  6003. It does not take parameters.
  6004. @section find_rect
  6005. Find a rectangular object
  6006. It accepts the following options:
  6007. @table @option
  6008. @item object
  6009. Filepath of the object image, needs to be in gray8.
  6010. @item threshold
  6011. Detection threshold, default is 0.5.
  6012. @item mipmaps
  6013. Number of mipmaps, default is 3.
  6014. @item xmin, ymin, xmax, ymax
  6015. Specifies the rectangle in which to search.
  6016. @end table
  6017. @subsection Examples
  6018. @itemize
  6019. @item
  6020. Generate a representative palette of a given video using @command{ffmpeg}:
  6021. @example
  6022. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6023. @end example
  6024. @end itemize
  6025. @section cover_rect
  6026. Cover a rectangular object
  6027. It accepts the following options:
  6028. @table @option
  6029. @item cover
  6030. Filepath of the optional cover image, needs to be in yuv420.
  6031. @item mode
  6032. Set covering mode.
  6033. It accepts the following values:
  6034. @table @samp
  6035. @item cover
  6036. cover it by the supplied image
  6037. @item blur
  6038. cover it by interpolating the surrounding pixels
  6039. @end table
  6040. Default value is @var{blur}.
  6041. @end table
  6042. @subsection Examples
  6043. @itemize
  6044. @item
  6045. Generate a representative palette of a given video using @command{ffmpeg}:
  6046. @example
  6047. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6048. @end example
  6049. @end itemize
  6050. @anchor{format}
  6051. @section format
  6052. Convert the input video to one of the specified pixel formats.
  6053. Libavfilter will try to pick one that is suitable as input to
  6054. the next filter.
  6055. It accepts the following parameters:
  6056. @table @option
  6057. @item pix_fmts
  6058. A '|'-separated list of pixel format names, such as
  6059. "pix_fmts=yuv420p|monow|rgb24".
  6060. @end table
  6061. @subsection Examples
  6062. @itemize
  6063. @item
  6064. Convert the input video to the @var{yuv420p} format
  6065. @example
  6066. format=pix_fmts=yuv420p
  6067. @end example
  6068. Convert the input video to any of the formats in the list
  6069. @example
  6070. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6071. @end example
  6072. @end itemize
  6073. @anchor{fps}
  6074. @section fps
  6075. Convert the video to specified constant frame rate by duplicating or dropping
  6076. frames as necessary.
  6077. It accepts the following parameters:
  6078. @table @option
  6079. @item fps
  6080. The desired output frame rate. The default is @code{25}.
  6081. @item round
  6082. Rounding method.
  6083. Possible values are:
  6084. @table @option
  6085. @item zero
  6086. zero round towards 0
  6087. @item inf
  6088. round away from 0
  6089. @item down
  6090. round towards -infinity
  6091. @item up
  6092. round towards +infinity
  6093. @item near
  6094. round to nearest
  6095. @end table
  6096. The default is @code{near}.
  6097. @item start_time
  6098. Assume the first PTS should be the given value, in seconds. This allows for
  6099. padding/trimming at the start of stream. By default, no assumption is made
  6100. about the first frame's expected PTS, so no padding or trimming is done.
  6101. For example, this could be set to 0 to pad the beginning with duplicates of
  6102. the first frame if a video stream starts after the audio stream or to trim any
  6103. frames with a negative PTS.
  6104. @end table
  6105. Alternatively, the options can be specified as a flat string:
  6106. @var{fps}[:@var{round}].
  6107. See also the @ref{setpts} filter.
  6108. @subsection Examples
  6109. @itemize
  6110. @item
  6111. A typical usage in order to set the fps to 25:
  6112. @example
  6113. fps=fps=25
  6114. @end example
  6115. @item
  6116. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6117. @example
  6118. fps=fps=film:round=near
  6119. @end example
  6120. @end itemize
  6121. @section framepack
  6122. Pack two different video streams into a stereoscopic video, setting proper
  6123. metadata on supported codecs. The two views should have the same size and
  6124. framerate and processing will stop when the shorter video ends. Please note
  6125. that you may conveniently adjust view properties with the @ref{scale} and
  6126. @ref{fps} filters.
  6127. It accepts the following parameters:
  6128. @table @option
  6129. @item format
  6130. The desired packing format. Supported values are:
  6131. @table @option
  6132. @item sbs
  6133. The views are next to each other (default).
  6134. @item tab
  6135. The views are on top of each other.
  6136. @item lines
  6137. The views are packed by line.
  6138. @item columns
  6139. The views are packed by column.
  6140. @item frameseq
  6141. The views are temporally interleaved.
  6142. @end table
  6143. @end table
  6144. Some examples:
  6145. @example
  6146. # Convert left and right views into a frame-sequential video
  6147. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6148. # Convert views into a side-by-side video with the same output resolution as the input
  6149. 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
  6150. @end example
  6151. @section framerate
  6152. Change the frame rate by interpolating new video output frames from the source
  6153. frames.
  6154. This filter is not designed to function correctly with interlaced media. If
  6155. you wish to change the frame rate of interlaced media then you are required
  6156. to deinterlace before this filter and re-interlace after this filter.
  6157. A description of the accepted options follows.
  6158. @table @option
  6159. @item fps
  6160. Specify the output frames per second. This option can also be specified
  6161. as a value alone. The default is @code{50}.
  6162. @item interp_start
  6163. Specify the start of a range where the output frame will be created as a
  6164. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6165. the default is @code{15}.
  6166. @item interp_end
  6167. Specify the end of a range where the output frame will be created as a
  6168. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6169. the default is @code{240}.
  6170. @item scene
  6171. Specify the level at which a scene change is detected as a value between
  6172. 0 and 100 to indicate a new scene; a low value reflects a low
  6173. probability for the current frame to introduce a new scene, while a higher
  6174. value means the current frame is more likely to be one.
  6175. The default is @code{7}.
  6176. @item flags
  6177. Specify flags influencing the filter process.
  6178. Available value for @var{flags} is:
  6179. @table @option
  6180. @item scene_change_detect, scd
  6181. Enable scene change detection using the value of the option @var{scene}.
  6182. This flag is enabled by default.
  6183. @end table
  6184. @end table
  6185. @section framestep
  6186. Select one frame every N-th frame.
  6187. This filter accepts the following option:
  6188. @table @option
  6189. @item step
  6190. Select frame after every @code{step} frames.
  6191. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6192. @end table
  6193. @anchor{frei0r}
  6194. @section frei0r
  6195. Apply a frei0r effect to the input video.
  6196. To enable the compilation of this filter, you need to install the frei0r
  6197. header and configure FFmpeg with @code{--enable-frei0r}.
  6198. It accepts the following parameters:
  6199. @table @option
  6200. @item filter_name
  6201. The name of the frei0r effect to load. If the environment variable
  6202. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6203. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6204. Otherwise, the standard frei0r paths are searched, in this order:
  6205. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6206. @file{/usr/lib/frei0r-1/}.
  6207. @item filter_params
  6208. A '|'-separated list of parameters to pass to the frei0r effect.
  6209. @end table
  6210. A frei0r effect parameter can be a boolean (its value is either
  6211. "y" or "n"), a double, a color (specified as
  6212. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6213. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6214. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6215. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6216. The number and types of parameters depend on the loaded effect. If an
  6217. effect parameter is not specified, the default value is set.
  6218. @subsection Examples
  6219. @itemize
  6220. @item
  6221. Apply the distort0r effect, setting the first two double parameters:
  6222. @example
  6223. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6224. @end example
  6225. @item
  6226. Apply the colordistance effect, taking a color as the first parameter:
  6227. @example
  6228. frei0r=colordistance:0.2/0.3/0.4
  6229. frei0r=colordistance:violet
  6230. frei0r=colordistance:0x112233
  6231. @end example
  6232. @item
  6233. Apply the perspective effect, specifying the top left and top right image
  6234. positions:
  6235. @example
  6236. frei0r=perspective:0.2/0.2|0.8/0.2
  6237. @end example
  6238. @end itemize
  6239. For more information, see
  6240. @url{http://frei0r.dyne.org}
  6241. @section fspp
  6242. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6243. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6244. processing filter, one of them is performed once per block, not per pixel.
  6245. This allows for much higher speed.
  6246. The filter accepts the following options:
  6247. @table @option
  6248. @item quality
  6249. Set quality. This option defines the number of levels for averaging. It accepts
  6250. an integer in the range 4-5. Default value is @code{4}.
  6251. @item qp
  6252. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6253. If not set, the filter will use the QP from the video stream (if available).
  6254. @item strength
  6255. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6256. more details but also more artifacts, while higher values make the image smoother
  6257. but also blurrier. Default value is @code{0} − PSNR optimal.
  6258. @item use_bframe_qp
  6259. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6260. option may cause flicker since the B-Frames have often larger QP. Default is
  6261. @code{0} (not enabled).
  6262. @end table
  6263. @section geq
  6264. The filter accepts the following options:
  6265. @table @option
  6266. @item lum_expr, lum
  6267. Set the luminance expression.
  6268. @item cb_expr, cb
  6269. Set the chrominance blue expression.
  6270. @item cr_expr, cr
  6271. Set the chrominance red expression.
  6272. @item alpha_expr, a
  6273. Set the alpha expression.
  6274. @item red_expr, r
  6275. Set the red expression.
  6276. @item green_expr, g
  6277. Set the green expression.
  6278. @item blue_expr, b
  6279. Set the blue expression.
  6280. @end table
  6281. The colorspace is selected according to the specified options. If one
  6282. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6283. options is specified, the filter will automatically select a YCbCr
  6284. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6285. @option{blue_expr} options is specified, it will select an RGB
  6286. colorspace.
  6287. If one of the chrominance expression is not defined, it falls back on the other
  6288. one. If no alpha expression is specified it will evaluate to opaque value.
  6289. If none of chrominance expressions are specified, they will evaluate
  6290. to the luminance expression.
  6291. The expressions can use the following variables and functions:
  6292. @table @option
  6293. @item N
  6294. The sequential number of the filtered frame, starting from @code{0}.
  6295. @item X
  6296. @item Y
  6297. The coordinates of the current sample.
  6298. @item W
  6299. @item H
  6300. The width and height of the image.
  6301. @item SW
  6302. @item SH
  6303. Width and height scale depending on the currently filtered plane. It is the
  6304. ratio between the corresponding luma plane number of pixels and the current
  6305. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6306. @code{0.5,0.5} for chroma planes.
  6307. @item T
  6308. Time of the current frame, expressed in seconds.
  6309. @item p(x, y)
  6310. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6311. plane.
  6312. @item lum(x, y)
  6313. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6314. plane.
  6315. @item cb(x, y)
  6316. Return the value of the pixel at location (@var{x},@var{y}) of the
  6317. blue-difference chroma plane. Return 0 if there is no such plane.
  6318. @item cr(x, y)
  6319. Return the value of the pixel at location (@var{x},@var{y}) of the
  6320. red-difference chroma plane. Return 0 if there is no such plane.
  6321. @item r(x, y)
  6322. @item g(x, y)
  6323. @item b(x, y)
  6324. Return the value of the pixel at location (@var{x},@var{y}) of the
  6325. red/green/blue component. Return 0 if there is no such component.
  6326. @item alpha(x, y)
  6327. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6328. plane. Return 0 if there is no such plane.
  6329. @end table
  6330. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6331. automatically clipped to the closer edge.
  6332. @subsection Examples
  6333. @itemize
  6334. @item
  6335. Flip the image horizontally:
  6336. @example
  6337. geq=p(W-X\,Y)
  6338. @end example
  6339. @item
  6340. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6341. wavelength of 100 pixels:
  6342. @example
  6343. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6344. @end example
  6345. @item
  6346. Generate a fancy enigmatic moving light:
  6347. @example
  6348. 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
  6349. @end example
  6350. @item
  6351. Generate a quick emboss effect:
  6352. @example
  6353. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6354. @end example
  6355. @item
  6356. Modify RGB components depending on pixel position:
  6357. @example
  6358. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6359. @end example
  6360. @item
  6361. Create a radial gradient that is the same size as the input (also see
  6362. the @ref{vignette} filter):
  6363. @example
  6364. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6365. @end example
  6366. @end itemize
  6367. @section gradfun
  6368. Fix the banding artifacts that are sometimes introduced into nearly flat
  6369. regions by truncation to 8bit color depth.
  6370. Interpolate the gradients that should go where the bands are, and
  6371. dither them.
  6372. It is designed for playback only. Do not use it prior to
  6373. lossy compression, because compression tends to lose the dither and
  6374. bring back the bands.
  6375. It accepts the following parameters:
  6376. @table @option
  6377. @item strength
  6378. The maximum amount by which the filter will change any one pixel. This is also
  6379. the threshold for detecting nearly flat regions. Acceptable values range from
  6380. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6381. valid range.
  6382. @item radius
  6383. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6384. gradients, but also prevents the filter from modifying the pixels near detailed
  6385. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6386. values will be clipped to the valid range.
  6387. @end table
  6388. Alternatively, the options can be specified as a flat string:
  6389. @var{strength}[:@var{radius}]
  6390. @subsection Examples
  6391. @itemize
  6392. @item
  6393. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6394. @example
  6395. gradfun=3.5:8
  6396. @end example
  6397. @item
  6398. Specify radius, omitting the strength (which will fall-back to the default
  6399. value):
  6400. @example
  6401. gradfun=radius=8
  6402. @end example
  6403. @end itemize
  6404. @anchor{haldclut}
  6405. @section haldclut
  6406. Apply a Hald CLUT to a video stream.
  6407. First input is the video stream to process, and second one is the Hald CLUT.
  6408. The Hald CLUT input can be a simple picture or a complete video stream.
  6409. The filter accepts the following options:
  6410. @table @option
  6411. @item shortest
  6412. Force termination when the shortest input terminates. Default is @code{0}.
  6413. @item repeatlast
  6414. Continue applying the last CLUT after the end of the stream. A value of
  6415. @code{0} disable the filter after the last frame of the CLUT is reached.
  6416. Default is @code{1}.
  6417. @end table
  6418. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6419. filters share the same internals).
  6420. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6421. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6422. @subsection Workflow examples
  6423. @subsubsection Hald CLUT video stream
  6424. Generate an identity Hald CLUT stream altered with various effects:
  6425. @example
  6426. 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
  6427. @end example
  6428. Note: make sure you use a lossless codec.
  6429. Then use it with @code{haldclut} to apply it on some random stream:
  6430. @example
  6431. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6432. @end example
  6433. The Hald CLUT will be applied to the 10 first seconds (duration of
  6434. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6435. to the remaining frames of the @code{mandelbrot} stream.
  6436. @subsubsection Hald CLUT with preview
  6437. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6438. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6439. biggest possible square starting at the top left of the picture. The remaining
  6440. padding pixels (bottom or right) will be ignored. This area can be used to add
  6441. a preview of the Hald CLUT.
  6442. Typically, the following generated Hald CLUT will be supported by the
  6443. @code{haldclut} filter:
  6444. @example
  6445. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6446. pad=iw+320 [padded_clut];
  6447. smptebars=s=320x256, split [a][b];
  6448. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6449. [main][b] overlay=W-320" -frames:v 1 clut.png
  6450. @end example
  6451. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6452. bars are displayed on the right-top, and below the same color bars processed by
  6453. the color changes.
  6454. Then, the effect of this Hald CLUT can be visualized with:
  6455. @example
  6456. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6457. @end example
  6458. @section hdcd
  6459. Decodes high definition audio cd data. 16-Bit PCM stream containing hdcd flags
  6460. is converted to 20-bit PCM stream.
  6461. @section hflip
  6462. Flip the input video horizontally.
  6463. For example, to horizontally flip the input video with @command{ffmpeg}:
  6464. @example
  6465. ffmpeg -i in.avi -vf "hflip" out.avi
  6466. @end example
  6467. @section histeq
  6468. This filter applies a global color histogram equalization on a
  6469. per-frame basis.
  6470. It can be used to correct video that has a compressed range of pixel
  6471. intensities. The filter redistributes the pixel intensities to
  6472. equalize their distribution across the intensity range. It may be
  6473. viewed as an "automatically adjusting contrast filter". This filter is
  6474. useful only for correcting degraded or poorly captured source
  6475. video.
  6476. The filter accepts the following options:
  6477. @table @option
  6478. @item strength
  6479. Determine the amount of equalization to be applied. As the strength
  6480. is reduced, the distribution of pixel intensities more-and-more
  6481. approaches that of the input frame. The value must be a float number
  6482. in the range [0,1] and defaults to 0.200.
  6483. @item intensity
  6484. Set the maximum intensity that can generated and scale the output
  6485. values appropriately. The strength should be set as desired and then
  6486. the intensity can be limited if needed to avoid washing-out. The value
  6487. must be a float number in the range [0,1] and defaults to 0.210.
  6488. @item antibanding
  6489. Set the antibanding level. If enabled the filter will randomly vary
  6490. the luminance of output pixels by a small amount to avoid banding of
  6491. the histogram. Possible values are @code{none}, @code{weak} or
  6492. @code{strong}. It defaults to @code{none}.
  6493. @end table
  6494. @section histogram
  6495. Compute and draw a color distribution histogram for the input video.
  6496. The computed histogram is a representation of the color component
  6497. distribution in an image.
  6498. Standard histogram displays the color components distribution in an image.
  6499. Displays color graph for each color component. Shows distribution of
  6500. the Y, U, V, A or R, G, B components, depending on input format, in the
  6501. current frame. Below each graph a color component scale meter is shown.
  6502. The filter accepts the following options:
  6503. @table @option
  6504. @item level_height
  6505. Set height of level. Default value is @code{200}.
  6506. Allowed range is [50, 2048].
  6507. @item scale_height
  6508. Set height of color scale. Default value is @code{12}.
  6509. Allowed range is [0, 40].
  6510. @item display_mode
  6511. Set display mode.
  6512. It accepts the following values:
  6513. @table @samp
  6514. @item parade
  6515. Per color component graphs are placed below each other.
  6516. @item overlay
  6517. Presents information identical to that in the @code{parade}, except
  6518. that the graphs representing color components are superimposed directly
  6519. over one another.
  6520. @end table
  6521. Default is @code{parade}.
  6522. @item levels_mode
  6523. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6524. Default is @code{linear}.
  6525. @item components
  6526. Set what color components to display.
  6527. Default is @code{7}.
  6528. @end table
  6529. @subsection Examples
  6530. @itemize
  6531. @item
  6532. Calculate and draw histogram:
  6533. @example
  6534. ffplay -i input -vf histogram
  6535. @end example
  6536. @end itemize
  6537. @anchor{hqdn3d}
  6538. @section hqdn3d
  6539. This is a high precision/quality 3d denoise filter. It aims to reduce
  6540. image noise, producing smooth images and making still images really
  6541. still. It should enhance compressibility.
  6542. It accepts the following optional parameters:
  6543. @table @option
  6544. @item luma_spatial
  6545. A non-negative floating point number which specifies spatial luma strength.
  6546. It defaults to 4.0.
  6547. @item chroma_spatial
  6548. A non-negative floating point number which specifies spatial chroma strength.
  6549. It defaults to 3.0*@var{luma_spatial}/4.0.
  6550. @item luma_tmp
  6551. A floating point number which specifies luma temporal strength. It defaults to
  6552. 6.0*@var{luma_spatial}/4.0.
  6553. @item chroma_tmp
  6554. A floating point number which specifies chroma temporal strength. It defaults to
  6555. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6556. @end table
  6557. @anchor{hwupload_cuda}
  6558. @section hwupload_cuda
  6559. Upload system memory frames to a CUDA device.
  6560. It accepts the following optional parameters:
  6561. @table @option
  6562. @item device
  6563. The number of the CUDA device to use
  6564. @end table
  6565. @section hqx
  6566. Apply a high-quality magnification filter designed for pixel art. This filter
  6567. was originally created by Maxim Stepin.
  6568. It accepts the following option:
  6569. @table @option
  6570. @item n
  6571. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6572. @code{hq3x} and @code{4} for @code{hq4x}.
  6573. Default is @code{3}.
  6574. @end table
  6575. @section hstack
  6576. Stack input videos horizontally.
  6577. All streams must be of same pixel format and of same height.
  6578. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6579. to create same output.
  6580. The filter accept the following option:
  6581. @table @option
  6582. @item inputs
  6583. Set number of input streams. Default is 2.
  6584. @item shortest
  6585. If set to 1, force the output to terminate when the shortest input
  6586. terminates. Default value is 0.
  6587. @end table
  6588. @section hue
  6589. Modify the hue and/or the saturation of the input.
  6590. It accepts the following parameters:
  6591. @table @option
  6592. @item h
  6593. Specify the hue angle as a number of degrees. It accepts an expression,
  6594. and defaults to "0".
  6595. @item s
  6596. Specify the saturation in the [-10,10] range. It accepts an expression and
  6597. defaults to "1".
  6598. @item H
  6599. Specify the hue angle as a number of radians. It accepts an
  6600. expression, and defaults to "0".
  6601. @item b
  6602. Specify the brightness in the [-10,10] range. It accepts an expression and
  6603. defaults to "0".
  6604. @end table
  6605. @option{h} and @option{H} are mutually exclusive, and can't be
  6606. specified at the same time.
  6607. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6608. expressions containing the following constants:
  6609. @table @option
  6610. @item n
  6611. frame count of the input frame starting from 0
  6612. @item pts
  6613. presentation timestamp of the input frame expressed in time base units
  6614. @item r
  6615. frame rate of the input video, NAN if the input frame rate is unknown
  6616. @item t
  6617. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6618. @item tb
  6619. time base of the input video
  6620. @end table
  6621. @subsection Examples
  6622. @itemize
  6623. @item
  6624. Set the hue to 90 degrees and the saturation to 1.0:
  6625. @example
  6626. hue=h=90:s=1
  6627. @end example
  6628. @item
  6629. Same command but expressing the hue in radians:
  6630. @example
  6631. hue=H=PI/2:s=1
  6632. @end example
  6633. @item
  6634. Rotate hue and make the saturation swing between 0
  6635. and 2 over a period of 1 second:
  6636. @example
  6637. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6638. @end example
  6639. @item
  6640. Apply a 3 seconds saturation fade-in effect starting at 0:
  6641. @example
  6642. hue="s=min(t/3\,1)"
  6643. @end example
  6644. The general fade-in expression can be written as:
  6645. @example
  6646. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6647. @end example
  6648. @item
  6649. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6650. @example
  6651. hue="s=max(0\, min(1\, (8-t)/3))"
  6652. @end example
  6653. The general fade-out expression can be written as:
  6654. @example
  6655. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6656. @end example
  6657. @end itemize
  6658. @subsection Commands
  6659. This filter supports the following commands:
  6660. @table @option
  6661. @item b
  6662. @item s
  6663. @item h
  6664. @item H
  6665. Modify the hue and/or the saturation and/or brightness of the input video.
  6666. The command accepts the same syntax of the corresponding option.
  6667. If the specified expression is not valid, it is kept at its current
  6668. value.
  6669. @end table
  6670. @section idet
  6671. Detect video interlacing type.
  6672. This filter tries to detect if the input frames as interlaced, progressive,
  6673. top or bottom field first. It will also try and detect fields that are
  6674. repeated between adjacent frames (a sign of telecine).
  6675. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6676. Multiple frame detection incorporates the classification history of previous frames.
  6677. The filter will log these metadata values:
  6678. @table @option
  6679. @item single.current_frame
  6680. Detected type of current frame using single-frame detection. One of:
  6681. ``tff'' (top field first), ``bff'' (bottom field first),
  6682. ``progressive'', or ``undetermined''
  6683. @item single.tff
  6684. Cumulative number of frames detected as top field first using single-frame detection.
  6685. @item multiple.tff
  6686. Cumulative number of frames detected as top field first using multiple-frame detection.
  6687. @item single.bff
  6688. Cumulative number of frames detected as bottom field first using single-frame detection.
  6689. @item multiple.current_frame
  6690. Detected type of current frame using multiple-frame detection. One of:
  6691. ``tff'' (top field first), ``bff'' (bottom field first),
  6692. ``progressive'', or ``undetermined''
  6693. @item multiple.bff
  6694. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6695. @item single.progressive
  6696. Cumulative number of frames detected as progressive using single-frame detection.
  6697. @item multiple.progressive
  6698. Cumulative number of frames detected as progressive using multiple-frame detection.
  6699. @item single.undetermined
  6700. Cumulative number of frames that could not be classified using single-frame detection.
  6701. @item multiple.undetermined
  6702. Cumulative number of frames that could not be classified using multiple-frame detection.
  6703. @item repeated.current_frame
  6704. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6705. @item repeated.neither
  6706. Cumulative number of frames with no repeated field.
  6707. @item repeated.top
  6708. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6709. @item repeated.bottom
  6710. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6711. @end table
  6712. The filter accepts the following options:
  6713. @table @option
  6714. @item intl_thres
  6715. Set interlacing threshold.
  6716. @item prog_thres
  6717. Set progressive threshold.
  6718. @item rep_thres
  6719. Threshold for repeated field detection.
  6720. @item half_life
  6721. Number of frames after which a given frame's contribution to the
  6722. statistics is halved (i.e., it contributes only 0.5 to it's
  6723. classification). The default of 0 means that all frames seen are given
  6724. full weight of 1.0 forever.
  6725. @item analyze_interlaced_flag
  6726. When this is not 0 then idet will use the specified number of frames to determine
  6727. if the interlaced flag is accurate, it will not count undetermined frames.
  6728. If the flag is found to be accurate it will be used without any further
  6729. computations, if it is found to be inaccurate it will be cleared without any
  6730. further computations. This allows inserting the idet filter as a low computational
  6731. method to clean up the interlaced flag
  6732. @end table
  6733. @section il
  6734. Deinterleave or interleave fields.
  6735. This filter allows one to process interlaced images fields without
  6736. deinterlacing them. Deinterleaving splits the input frame into 2
  6737. fields (so called half pictures). Odd lines are moved to the top
  6738. half of the output image, even lines to the bottom half.
  6739. You can process (filter) them independently and then re-interleave them.
  6740. The filter accepts the following options:
  6741. @table @option
  6742. @item luma_mode, l
  6743. @item chroma_mode, c
  6744. @item alpha_mode, a
  6745. Available values for @var{luma_mode}, @var{chroma_mode} and
  6746. @var{alpha_mode} are:
  6747. @table @samp
  6748. @item none
  6749. Do nothing.
  6750. @item deinterleave, d
  6751. Deinterleave fields, placing one above the other.
  6752. @item interleave, i
  6753. Interleave fields. Reverse the effect of deinterleaving.
  6754. @end table
  6755. Default value is @code{none}.
  6756. @item luma_swap, ls
  6757. @item chroma_swap, cs
  6758. @item alpha_swap, as
  6759. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6760. @end table
  6761. @section inflate
  6762. Apply inflate effect to the video.
  6763. This filter replaces the pixel by the local(3x3) average by taking into account
  6764. only values higher than the pixel.
  6765. It accepts the following options:
  6766. @table @option
  6767. @item threshold0
  6768. @item threshold1
  6769. @item threshold2
  6770. @item threshold3
  6771. Limit the maximum change for each plane, default is 65535.
  6772. If 0, plane will remain unchanged.
  6773. @end table
  6774. @section interlace
  6775. Simple interlacing filter from progressive contents. This interleaves upper (or
  6776. lower) lines from odd frames with lower (or upper) lines from even frames,
  6777. halving the frame rate and preserving image height.
  6778. @example
  6779. Original Original New Frame
  6780. Frame 'j' Frame 'j+1' (tff)
  6781. ========== =========== ==================
  6782. Line 0 --------------------> Frame 'j' Line 0
  6783. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6784. Line 2 ---------------------> Frame 'j' Line 2
  6785. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6786. ... ... ...
  6787. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6788. @end example
  6789. It accepts the following optional parameters:
  6790. @table @option
  6791. @item scan
  6792. This determines whether the interlaced frame is taken from the even
  6793. (tff - default) or odd (bff) lines of the progressive frame.
  6794. @item lowpass
  6795. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6796. interlacing and reduce moire patterns.
  6797. @end table
  6798. @section kerndeint
  6799. Deinterlace input video by applying Donald Graft's adaptive kernel
  6800. deinterling. Work on interlaced parts of a video to produce
  6801. progressive frames.
  6802. The description of the accepted parameters follows.
  6803. @table @option
  6804. @item thresh
  6805. Set the threshold which affects the filter's tolerance when
  6806. determining if a pixel line must be processed. It must be an integer
  6807. in the range [0,255] and defaults to 10. A value of 0 will result in
  6808. applying the process on every pixels.
  6809. @item map
  6810. Paint pixels exceeding the threshold value to white if set to 1.
  6811. Default is 0.
  6812. @item order
  6813. Set the fields order. Swap fields if set to 1, leave fields alone if
  6814. 0. Default is 0.
  6815. @item sharp
  6816. Enable additional sharpening if set to 1. Default is 0.
  6817. @item twoway
  6818. Enable twoway sharpening if set to 1. Default is 0.
  6819. @end table
  6820. @subsection Examples
  6821. @itemize
  6822. @item
  6823. Apply default values:
  6824. @example
  6825. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6826. @end example
  6827. @item
  6828. Enable additional sharpening:
  6829. @example
  6830. kerndeint=sharp=1
  6831. @end example
  6832. @item
  6833. Paint processed pixels in white:
  6834. @example
  6835. kerndeint=map=1
  6836. @end example
  6837. @end itemize
  6838. @section lenscorrection
  6839. Correct radial lens distortion
  6840. This filter can be used to correct for radial distortion as can result from the use
  6841. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6842. one can use tools available for example as part of opencv or simply trial-and-error.
  6843. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6844. and extract the k1 and k2 coefficients from the resulting matrix.
  6845. Note that effectively the same filter is available in the open-source tools Krita and
  6846. Digikam from the KDE project.
  6847. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6848. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6849. brightness distribution, so you may want to use both filters together in certain
  6850. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6851. be applied before or after lens correction.
  6852. @subsection Options
  6853. The filter accepts the following options:
  6854. @table @option
  6855. @item cx
  6856. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6857. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6858. width.
  6859. @item cy
  6860. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6861. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6862. height.
  6863. @item k1
  6864. Coefficient of the quadratic correction term. 0.5 means no correction.
  6865. @item k2
  6866. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6867. @end table
  6868. The formula that generates the correction is:
  6869. @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)
  6870. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6871. distances from the focal point in the source and target images, respectively.
  6872. @section loop, aloop
  6873. Loop video frames or audio samples.
  6874. Those filters accepts the following options:
  6875. @table @option
  6876. @item loop
  6877. Set the number of loops.
  6878. @item size
  6879. Set maximal size in number of frames for @code{loop} filter or maximal number
  6880. of samples in case of @code{aloop} filter.
  6881. @item start
  6882. Set first frame of loop for @code{loop} filter or first sample of loop in case
  6883. of @code{aloop} filter.
  6884. @end table
  6885. @anchor{lut3d}
  6886. @section lut3d
  6887. Apply a 3D LUT to an input video.
  6888. The filter accepts the following options:
  6889. @table @option
  6890. @item file
  6891. Set the 3D LUT file name.
  6892. Currently supported formats:
  6893. @table @samp
  6894. @item 3dl
  6895. AfterEffects
  6896. @item cube
  6897. Iridas
  6898. @item dat
  6899. DaVinci
  6900. @item m3d
  6901. Pandora
  6902. @end table
  6903. @item interp
  6904. Select interpolation mode.
  6905. Available values are:
  6906. @table @samp
  6907. @item nearest
  6908. Use values from the nearest defined point.
  6909. @item trilinear
  6910. Interpolate values using the 8 points defining a cube.
  6911. @item tetrahedral
  6912. Interpolate values using a tetrahedron.
  6913. @end table
  6914. @end table
  6915. @section lut, lutrgb, lutyuv
  6916. Compute a look-up table for binding each pixel component input value
  6917. to an output value, and apply it to the input video.
  6918. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6919. to an RGB input video.
  6920. These filters accept the following parameters:
  6921. @table @option
  6922. @item c0
  6923. set first pixel component expression
  6924. @item c1
  6925. set second pixel component expression
  6926. @item c2
  6927. set third pixel component expression
  6928. @item c3
  6929. set fourth pixel component expression, corresponds to the alpha component
  6930. @item r
  6931. set red component expression
  6932. @item g
  6933. set green component expression
  6934. @item b
  6935. set blue component expression
  6936. @item a
  6937. alpha component expression
  6938. @item y
  6939. set Y/luminance component expression
  6940. @item u
  6941. set U/Cb component expression
  6942. @item v
  6943. set V/Cr component expression
  6944. @end table
  6945. Each of them specifies the expression to use for computing the lookup table for
  6946. the corresponding pixel component values.
  6947. The exact component associated to each of the @var{c*} options depends on the
  6948. format in input.
  6949. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  6950. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  6951. The expressions can contain the following constants and functions:
  6952. @table @option
  6953. @item w
  6954. @item h
  6955. The input width and height.
  6956. @item val
  6957. The input value for the pixel component.
  6958. @item clipval
  6959. The input value, clipped to the @var{minval}-@var{maxval} range.
  6960. @item maxval
  6961. The maximum value for the pixel component.
  6962. @item minval
  6963. The minimum value for the pixel component.
  6964. @item negval
  6965. The negated value for the pixel component value, clipped to the
  6966. @var{minval}-@var{maxval} range; it corresponds to the expression
  6967. "maxval-clipval+minval".
  6968. @item clip(val)
  6969. The computed value in @var{val}, clipped to the
  6970. @var{minval}-@var{maxval} range.
  6971. @item gammaval(gamma)
  6972. The computed gamma correction value of the pixel component value,
  6973. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  6974. expression
  6975. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  6976. @end table
  6977. All expressions default to "val".
  6978. @subsection Examples
  6979. @itemize
  6980. @item
  6981. Negate input video:
  6982. @example
  6983. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  6984. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  6985. @end example
  6986. The above is the same as:
  6987. @example
  6988. lutrgb="r=negval:g=negval:b=negval"
  6989. lutyuv="y=negval:u=negval:v=negval"
  6990. @end example
  6991. @item
  6992. Negate luminance:
  6993. @example
  6994. lutyuv=y=negval
  6995. @end example
  6996. @item
  6997. Remove chroma components, turning the video into a graytone image:
  6998. @example
  6999. lutyuv="u=128:v=128"
  7000. @end example
  7001. @item
  7002. Apply a luma burning effect:
  7003. @example
  7004. lutyuv="y=2*val"
  7005. @end example
  7006. @item
  7007. Remove green and blue components:
  7008. @example
  7009. lutrgb="g=0:b=0"
  7010. @end example
  7011. @item
  7012. Set a constant alpha channel value on input:
  7013. @example
  7014. format=rgba,lutrgb=a="maxval-minval/2"
  7015. @end example
  7016. @item
  7017. Correct luminance gamma by a factor of 0.5:
  7018. @example
  7019. lutyuv=y=gammaval(0.5)
  7020. @end example
  7021. @item
  7022. Discard least significant bits of luma:
  7023. @example
  7024. lutyuv=y='bitand(val, 128+64+32)'
  7025. @end example
  7026. @end itemize
  7027. @section maskedmerge
  7028. Merge the first input stream with the second input stream using per pixel
  7029. weights in the third input stream.
  7030. A value of 0 in the third stream pixel component means that pixel component
  7031. from first stream is returned unchanged, while maximum value (eg. 255 for
  7032. 8-bit videos) means that pixel component from second stream is returned
  7033. unchanged. Intermediate values define the amount of merging between both
  7034. input stream's pixel components.
  7035. This filter accepts the following options:
  7036. @table @option
  7037. @item planes
  7038. Set which planes will be processed as bitmap, unprocessed planes will be
  7039. copied from first stream.
  7040. By default value 0xf, all planes will be processed.
  7041. @end table
  7042. @section mcdeint
  7043. Apply motion-compensation deinterlacing.
  7044. It needs one field per frame as input and must thus be used together
  7045. with yadif=1/3 or equivalent.
  7046. This filter accepts the following options:
  7047. @table @option
  7048. @item mode
  7049. Set the deinterlacing mode.
  7050. It accepts one of the following values:
  7051. @table @samp
  7052. @item fast
  7053. @item medium
  7054. @item slow
  7055. use iterative motion estimation
  7056. @item extra_slow
  7057. like @samp{slow}, but use multiple reference frames.
  7058. @end table
  7059. Default value is @samp{fast}.
  7060. @item parity
  7061. Set the picture field parity assumed for the input video. It must be
  7062. one of the following values:
  7063. @table @samp
  7064. @item 0, tff
  7065. assume top field first
  7066. @item 1, bff
  7067. assume bottom field first
  7068. @end table
  7069. Default value is @samp{bff}.
  7070. @item qp
  7071. Set per-block quantization parameter (QP) used by the internal
  7072. encoder.
  7073. Higher values should result in a smoother motion vector field but less
  7074. optimal individual vectors. Default value is 1.
  7075. @end table
  7076. @section mergeplanes
  7077. Merge color channel components from several video streams.
  7078. The filter accepts up to 4 input streams, and merge selected input
  7079. planes to the output video.
  7080. This filter accepts the following options:
  7081. @table @option
  7082. @item mapping
  7083. Set input to output plane mapping. Default is @code{0}.
  7084. The mappings is specified as a bitmap. It should be specified as a
  7085. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7086. mapping for the first plane of the output stream. 'A' sets the number of
  7087. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7088. corresponding input to use (from 0 to 3). The rest of the mappings is
  7089. similar, 'Bb' describes the mapping for the output stream second
  7090. plane, 'Cc' describes the mapping for the output stream third plane and
  7091. 'Dd' describes the mapping for the output stream fourth plane.
  7092. @item format
  7093. Set output pixel format. Default is @code{yuva444p}.
  7094. @end table
  7095. @subsection Examples
  7096. @itemize
  7097. @item
  7098. Merge three gray video streams of same width and height into single video stream:
  7099. @example
  7100. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7101. @end example
  7102. @item
  7103. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7104. @example
  7105. [a0][a1]mergeplanes=0x00010210:yuva444p
  7106. @end example
  7107. @item
  7108. Swap Y and A plane in yuva444p stream:
  7109. @example
  7110. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7111. @end example
  7112. @item
  7113. Swap U and V plane in yuv420p stream:
  7114. @example
  7115. format=yuv420p,mergeplanes=0x000201:yuv420p
  7116. @end example
  7117. @item
  7118. Cast a rgb24 clip to yuv444p:
  7119. @example
  7120. format=rgb24,mergeplanes=0x000102:yuv444p
  7121. @end example
  7122. @end itemize
  7123. @section metadata, ametadata
  7124. Manipulate frame metadata.
  7125. This filter accepts the following options:
  7126. @table @option
  7127. @item mode
  7128. Set mode of operation of the filter.
  7129. Can be one of the following:
  7130. @table @samp
  7131. @item select
  7132. If both @code{value} and @code{key} is set, select frames
  7133. which have such metadata. If only @code{key} is set, select
  7134. every frame that has such key in metadata.
  7135. @item add
  7136. Add new metadata @code{key} and @code{value}. If key is already available
  7137. do nothing.
  7138. @item modify
  7139. Modify value of already present key.
  7140. @item delete
  7141. If @code{value} is set, delete only keys that have such value.
  7142. Otherwise, delete key.
  7143. @item print
  7144. Print key and its value if metadata was found. If @code{key} is not set print all
  7145. metadata values available in frame.
  7146. @end table
  7147. @item key
  7148. Set key used with all modes. Must be set for all modes except @code{print}.
  7149. @item value
  7150. Set metadata value which will be used. This option is mandatory for
  7151. @code{modify} and @code{add} mode.
  7152. @item function
  7153. Which function to use when comparing metadata value and @code{value}.
  7154. Can be one of following:
  7155. @table @samp
  7156. @item same_str
  7157. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  7158. @item starts_with
  7159. Values are interpreted as strings, returns true if metadata value starts with
  7160. the @code{value} option string.
  7161. @item less
  7162. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  7163. @item equal
  7164. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  7165. @item greater
  7166. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  7167. @item expr
  7168. Values are interpreted as floats, returns true if expression from option @code{expr}
  7169. evaluates to true.
  7170. @end table
  7171. @item expr
  7172. Set expression which is used when @code{function} is set to @code{expr}.
  7173. The expression is evaluated through the eval API and can contain the following
  7174. constants:
  7175. @table @option
  7176. @item VALUE1
  7177. Float representation of @code{value} from metadata key.
  7178. @item VALUE2
  7179. Float representation of @code{value} as supplied by user in @code{value} option.
  7180. @end table
  7181. @item file
  7182. If specified in @code{print} mode, output is written to the named file. When
  7183. filename equals "-" data is written to standard output.
  7184. If @code{file} option is not set, output is written to the log with AV_LOG_INFO
  7185. loglevel.
  7186. @end table
  7187. @subsection Examples
  7188. @itemize
  7189. @item
  7190. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  7191. between 0 and 1.
  7192. @example
  7193. @end example
  7194. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  7195. @end itemize
  7196. @section mpdecimate
  7197. Drop frames that do not differ greatly from the previous frame in
  7198. order to reduce frame rate.
  7199. The main use of this filter is for very-low-bitrate encoding
  7200. (e.g. streaming over dialup modem), but it could in theory be used for
  7201. fixing movies that were inverse-telecined incorrectly.
  7202. A description of the accepted options follows.
  7203. @table @option
  7204. @item max
  7205. Set the maximum number of consecutive frames which can be dropped (if
  7206. positive), or the minimum interval between dropped frames (if
  7207. negative). If the value is 0, the frame is dropped unregarding the
  7208. number of previous sequentially dropped frames.
  7209. Default value is 0.
  7210. @item hi
  7211. @item lo
  7212. @item frac
  7213. Set the dropping threshold values.
  7214. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7215. represent actual pixel value differences, so a threshold of 64
  7216. corresponds to 1 unit of difference for each pixel, or the same spread
  7217. out differently over the block.
  7218. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7219. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7220. meaning the whole image) differ by more than a threshold of @option{lo}.
  7221. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7222. 64*5, and default value for @option{frac} is 0.33.
  7223. @end table
  7224. @section negate
  7225. Negate input video.
  7226. It accepts an integer in input; if non-zero it negates the
  7227. alpha component (if available). The default value in input is 0.
  7228. @section nnedi
  7229. Deinterlace video using neural network edge directed interpolation.
  7230. This filter accepts the following options:
  7231. @table @option
  7232. @item weights
  7233. Mandatory option, without binary file filter can not work.
  7234. Currently file can be found here:
  7235. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7236. @item deint
  7237. Set which frames to deinterlace, by default it is @code{all}.
  7238. Can be @code{all} or @code{interlaced}.
  7239. @item field
  7240. Set mode of operation.
  7241. Can be one of the following:
  7242. @table @samp
  7243. @item af
  7244. Use frame flags, both fields.
  7245. @item a
  7246. Use frame flags, single field.
  7247. @item t
  7248. Use top field only.
  7249. @item b
  7250. Use bottom field only.
  7251. @item tf
  7252. Use both fields, top first.
  7253. @item bf
  7254. Use both fields, bottom first.
  7255. @end table
  7256. @item planes
  7257. Set which planes to process, by default filter process all frames.
  7258. @item nsize
  7259. Set size of local neighborhood around each pixel, used by the predictor neural
  7260. network.
  7261. Can be one of the following:
  7262. @table @samp
  7263. @item s8x6
  7264. @item s16x6
  7265. @item s32x6
  7266. @item s48x6
  7267. @item s8x4
  7268. @item s16x4
  7269. @item s32x4
  7270. @end table
  7271. @item nns
  7272. Set the number of neurons in predicctor neural network.
  7273. Can be one of the following:
  7274. @table @samp
  7275. @item n16
  7276. @item n32
  7277. @item n64
  7278. @item n128
  7279. @item n256
  7280. @end table
  7281. @item qual
  7282. Controls the number of different neural network predictions that are blended
  7283. together to compute the final output value. Can be @code{fast}, default or
  7284. @code{slow}.
  7285. @item etype
  7286. Set which set of weights to use in the predictor.
  7287. Can be one of the following:
  7288. @table @samp
  7289. @item a
  7290. weights trained to minimize absolute error
  7291. @item s
  7292. weights trained to minimize squared error
  7293. @end table
  7294. @item pscrn
  7295. Controls whether or not the prescreener neural network is used to decide
  7296. which pixels should be processed by the predictor neural network and which
  7297. can be handled by simple cubic interpolation.
  7298. The prescreener is trained to know whether cubic interpolation will be
  7299. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7300. The computational complexity of the prescreener nn is much less than that of
  7301. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7302. using the prescreener generally results in much faster processing.
  7303. The prescreener is pretty accurate, so the difference between using it and not
  7304. using it is almost always unnoticeable.
  7305. Can be one of the following:
  7306. @table @samp
  7307. @item none
  7308. @item original
  7309. @item new
  7310. @end table
  7311. Default is @code{new}.
  7312. @item fapprox
  7313. Set various debugging flags.
  7314. @end table
  7315. @section noformat
  7316. Force libavfilter not to use any of the specified pixel formats for the
  7317. input to the next filter.
  7318. It accepts the following parameters:
  7319. @table @option
  7320. @item pix_fmts
  7321. A '|'-separated list of pixel format names, such as
  7322. apix_fmts=yuv420p|monow|rgb24".
  7323. @end table
  7324. @subsection Examples
  7325. @itemize
  7326. @item
  7327. Force libavfilter to use a format different from @var{yuv420p} for the
  7328. input to the vflip filter:
  7329. @example
  7330. noformat=pix_fmts=yuv420p,vflip
  7331. @end example
  7332. @item
  7333. Convert the input video to any of the formats not contained in the list:
  7334. @example
  7335. noformat=yuv420p|yuv444p|yuv410p
  7336. @end example
  7337. @end itemize
  7338. @section noise
  7339. Add noise on video input frame.
  7340. The filter accepts the following options:
  7341. @table @option
  7342. @item all_seed
  7343. @item c0_seed
  7344. @item c1_seed
  7345. @item c2_seed
  7346. @item c3_seed
  7347. Set noise seed for specific pixel component or all pixel components in case
  7348. of @var{all_seed}. Default value is @code{123457}.
  7349. @item all_strength, alls
  7350. @item c0_strength, c0s
  7351. @item c1_strength, c1s
  7352. @item c2_strength, c2s
  7353. @item c3_strength, c3s
  7354. Set noise strength for specific pixel component or all pixel components in case
  7355. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7356. @item all_flags, allf
  7357. @item c0_flags, c0f
  7358. @item c1_flags, c1f
  7359. @item c2_flags, c2f
  7360. @item c3_flags, c3f
  7361. Set pixel component flags or set flags for all components if @var{all_flags}.
  7362. Available values for component flags are:
  7363. @table @samp
  7364. @item a
  7365. averaged temporal noise (smoother)
  7366. @item p
  7367. mix random noise with a (semi)regular pattern
  7368. @item t
  7369. temporal noise (noise pattern changes between frames)
  7370. @item u
  7371. uniform noise (gaussian otherwise)
  7372. @end table
  7373. @end table
  7374. @subsection Examples
  7375. Add temporal and uniform noise to input video:
  7376. @example
  7377. noise=alls=20:allf=t+u
  7378. @end example
  7379. @section null
  7380. Pass the video source unchanged to the output.
  7381. @section ocr
  7382. Optical Character Recognition
  7383. This filter uses Tesseract for optical character recognition.
  7384. It accepts the following options:
  7385. @table @option
  7386. @item datapath
  7387. Set datapath to tesseract data. Default is to use whatever was
  7388. set at installation.
  7389. @item language
  7390. Set language, default is "eng".
  7391. @item whitelist
  7392. Set character whitelist.
  7393. @item blacklist
  7394. Set character blacklist.
  7395. @end table
  7396. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7397. @section ocv
  7398. Apply a video transform using libopencv.
  7399. To enable this filter, install the libopencv library and headers and
  7400. configure FFmpeg with @code{--enable-libopencv}.
  7401. It accepts the following parameters:
  7402. @table @option
  7403. @item filter_name
  7404. The name of the libopencv filter to apply.
  7405. @item filter_params
  7406. The parameters to pass to the libopencv filter. If not specified, the default
  7407. values are assumed.
  7408. @end table
  7409. Refer to the official libopencv documentation for more precise
  7410. information:
  7411. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7412. Several libopencv filters are supported; see the following subsections.
  7413. @anchor{dilate}
  7414. @subsection dilate
  7415. Dilate an image by using a specific structuring element.
  7416. It corresponds to the libopencv function @code{cvDilate}.
  7417. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7418. @var{struct_el} represents a structuring element, and has the syntax:
  7419. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7420. @var{cols} and @var{rows} represent the number of columns and rows of
  7421. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7422. point, and @var{shape} the shape for the structuring element. @var{shape}
  7423. must be "rect", "cross", "ellipse", or "custom".
  7424. If the value for @var{shape} is "custom", it must be followed by a
  7425. string of the form "=@var{filename}". The file with name
  7426. @var{filename} is assumed to represent a binary image, with each
  7427. printable character corresponding to a bright pixel. When a custom
  7428. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7429. or columns and rows of the read file are assumed instead.
  7430. The default value for @var{struct_el} is "3x3+0x0/rect".
  7431. @var{nb_iterations} specifies the number of times the transform is
  7432. applied to the image, and defaults to 1.
  7433. Some examples:
  7434. @example
  7435. # Use the default values
  7436. ocv=dilate
  7437. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7438. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7439. # Read the shape from the file diamond.shape, iterating two times.
  7440. # The file diamond.shape may contain a pattern of characters like this
  7441. # *
  7442. # ***
  7443. # *****
  7444. # ***
  7445. # *
  7446. # The specified columns and rows are ignored
  7447. # but the anchor point coordinates are not
  7448. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7449. @end example
  7450. @subsection erode
  7451. Erode an image by using a specific structuring element.
  7452. It corresponds to the libopencv function @code{cvErode}.
  7453. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7454. with the same syntax and semantics as the @ref{dilate} filter.
  7455. @subsection smooth
  7456. Smooth the input video.
  7457. The filter takes the following parameters:
  7458. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7459. @var{type} is the type of smooth filter to apply, and must be one of
  7460. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7461. or "bilateral". The default value is "gaussian".
  7462. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7463. depend on the smooth type. @var{param1} and
  7464. @var{param2} accept integer positive values or 0. @var{param3} and
  7465. @var{param4} accept floating point values.
  7466. The default value for @var{param1} is 3. The default value for the
  7467. other parameters is 0.
  7468. These parameters correspond to the parameters assigned to the
  7469. libopencv function @code{cvSmooth}.
  7470. @anchor{overlay}
  7471. @section overlay
  7472. Overlay one video on top of another.
  7473. It takes two inputs and has one output. The first input is the "main"
  7474. video on which the second input is overlaid.
  7475. It accepts the following parameters:
  7476. A description of the accepted options follows.
  7477. @table @option
  7478. @item x
  7479. @item y
  7480. Set the expression for the x and y coordinates of the overlaid video
  7481. on the main video. Default value is "0" for both expressions. In case
  7482. the expression is invalid, it is set to a huge value (meaning that the
  7483. overlay will not be displayed within the output visible area).
  7484. @item eof_action
  7485. The action to take when EOF is encountered on the secondary input; it accepts
  7486. one of the following values:
  7487. @table @option
  7488. @item repeat
  7489. Repeat the last frame (the default).
  7490. @item endall
  7491. End both streams.
  7492. @item pass
  7493. Pass the main input through.
  7494. @end table
  7495. @item eval
  7496. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7497. It accepts the following values:
  7498. @table @samp
  7499. @item init
  7500. only evaluate expressions once during the filter initialization or
  7501. when a command is processed
  7502. @item frame
  7503. evaluate expressions for each incoming frame
  7504. @end table
  7505. Default value is @samp{frame}.
  7506. @item shortest
  7507. If set to 1, force the output to terminate when the shortest input
  7508. terminates. Default value is 0.
  7509. @item format
  7510. Set the format for the output video.
  7511. It accepts the following values:
  7512. @table @samp
  7513. @item yuv420
  7514. force YUV420 output
  7515. @item yuv422
  7516. force YUV422 output
  7517. @item yuv444
  7518. force YUV444 output
  7519. @item rgb
  7520. force RGB output
  7521. @end table
  7522. Default value is @samp{yuv420}.
  7523. @item rgb @emph{(deprecated)}
  7524. If set to 1, force the filter to accept inputs in the RGB
  7525. color space. Default value is 0. This option is deprecated, use
  7526. @option{format} instead.
  7527. @item repeatlast
  7528. If set to 1, force the filter to draw the last overlay frame over the
  7529. main input until the end of the stream. A value of 0 disables this
  7530. behavior. Default value is 1.
  7531. @end table
  7532. The @option{x}, and @option{y} expressions can contain the following
  7533. parameters.
  7534. @table @option
  7535. @item main_w, W
  7536. @item main_h, H
  7537. The main input width and height.
  7538. @item overlay_w, w
  7539. @item overlay_h, h
  7540. The overlay input width and height.
  7541. @item x
  7542. @item y
  7543. The computed values for @var{x} and @var{y}. They are evaluated for
  7544. each new frame.
  7545. @item hsub
  7546. @item vsub
  7547. horizontal and vertical chroma subsample values of the output
  7548. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7549. @var{vsub} is 1.
  7550. @item n
  7551. the number of input frame, starting from 0
  7552. @item pos
  7553. the position in the file of the input frame, NAN if unknown
  7554. @item t
  7555. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7556. @end table
  7557. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7558. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7559. when @option{eval} is set to @samp{init}.
  7560. Be aware that frames are taken from each input video in timestamp
  7561. order, hence, if their initial timestamps differ, it is a good idea
  7562. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7563. have them begin in the same zero timestamp, as the example for
  7564. the @var{movie} filter does.
  7565. You can chain together more overlays but you should test the
  7566. efficiency of such approach.
  7567. @subsection Commands
  7568. This filter supports the following commands:
  7569. @table @option
  7570. @item x
  7571. @item y
  7572. Modify the x and y of the overlay input.
  7573. The command accepts the same syntax of the corresponding option.
  7574. If the specified expression is not valid, it is kept at its current
  7575. value.
  7576. @end table
  7577. @subsection Examples
  7578. @itemize
  7579. @item
  7580. Draw the overlay at 10 pixels from the bottom right corner of the main
  7581. video:
  7582. @example
  7583. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7584. @end example
  7585. Using named options the example above becomes:
  7586. @example
  7587. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7588. @end example
  7589. @item
  7590. Insert a transparent PNG logo in the bottom left corner of the input,
  7591. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7592. @example
  7593. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7594. @end example
  7595. @item
  7596. Insert 2 different transparent PNG logos (second logo on bottom
  7597. right corner) using the @command{ffmpeg} tool:
  7598. @example
  7599. 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
  7600. @end example
  7601. @item
  7602. Add a transparent color layer on top of the main video; @code{WxH}
  7603. must specify the size of the main input to the overlay filter:
  7604. @example
  7605. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7606. @end example
  7607. @item
  7608. Play an original video and a filtered version (here with the deshake
  7609. filter) side by side using the @command{ffplay} tool:
  7610. @example
  7611. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7612. @end example
  7613. The above command is the same as:
  7614. @example
  7615. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7616. @end example
  7617. @item
  7618. Make a sliding overlay appearing from the left to the right top part of the
  7619. screen starting since time 2:
  7620. @example
  7621. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7622. @end example
  7623. @item
  7624. Compose output by putting two input videos side to side:
  7625. @example
  7626. ffmpeg -i left.avi -i right.avi -filter_complex "
  7627. nullsrc=size=200x100 [background];
  7628. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7629. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7630. [background][left] overlay=shortest=1 [background+left];
  7631. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7632. "
  7633. @end example
  7634. @item
  7635. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7636. @example
  7637. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7638. -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]'
  7639. masked.avi
  7640. @end example
  7641. @item
  7642. Chain several overlays in cascade:
  7643. @example
  7644. nullsrc=s=200x200 [bg];
  7645. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7646. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7647. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7648. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7649. [in3] null, [mid2] overlay=100:100 [out0]
  7650. @end example
  7651. @end itemize
  7652. @section owdenoise
  7653. Apply Overcomplete Wavelet denoiser.
  7654. The filter accepts the following options:
  7655. @table @option
  7656. @item depth
  7657. Set depth.
  7658. Larger depth values will denoise lower frequency components more, but
  7659. slow down filtering.
  7660. Must be an int in the range 8-16, default is @code{8}.
  7661. @item luma_strength, ls
  7662. Set luma strength.
  7663. Must be a double value in the range 0-1000, default is @code{1.0}.
  7664. @item chroma_strength, cs
  7665. Set chroma strength.
  7666. Must be a double value in the range 0-1000, default is @code{1.0}.
  7667. @end table
  7668. @anchor{pad}
  7669. @section pad
  7670. Add paddings to the input image, and place the original input at the
  7671. provided @var{x}, @var{y} coordinates.
  7672. It accepts the following parameters:
  7673. @table @option
  7674. @item width, w
  7675. @item height, h
  7676. Specify an expression for the size of the output image with the
  7677. paddings added. If the value for @var{width} or @var{height} is 0, the
  7678. corresponding input size is used for the output.
  7679. The @var{width} expression can reference the value set by the
  7680. @var{height} expression, and vice versa.
  7681. The default value of @var{width} and @var{height} is 0.
  7682. @item x
  7683. @item y
  7684. Specify the offsets to place the input image at within the padded area,
  7685. with respect to the top/left border of the output image.
  7686. The @var{x} expression can reference the value set by the @var{y}
  7687. expression, and vice versa.
  7688. The default value of @var{x} and @var{y} is 0.
  7689. @item color
  7690. Specify the color of the padded area. For the syntax of this option,
  7691. check the "Color" section in the ffmpeg-utils manual.
  7692. The default value of @var{color} is "black".
  7693. @end table
  7694. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  7695. options are expressions containing the following constants:
  7696. @table @option
  7697. @item in_w
  7698. @item in_h
  7699. The input video width and height.
  7700. @item iw
  7701. @item ih
  7702. These are the same as @var{in_w} and @var{in_h}.
  7703. @item out_w
  7704. @item out_h
  7705. The output width and height (the size of the padded area), as
  7706. specified by the @var{width} and @var{height} expressions.
  7707. @item ow
  7708. @item oh
  7709. These are the same as @var{out_w} and @var{out_h}.
  7710. @item x
  7711. @item y
  7712. The x and y offsets as specified by the @var{x} and @var{y}
  7713. expressions, or NAN if not yet specified.
  7714. @item a
  7715. same as @var{iw} / @var{ih}
  7716. @item sar
  7717. input sample aspect ratio
  7718. @item dar
  7719. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7720. @item hsub
  7721. @item vsub
  7722. The horizontal and vertical chroma subsample values. For example for the
  7723. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7724. @end table
  7725. @subsection Examples
  7726. @itemize
  7727. @item
  7728. Add paddings with the color "violet" to the input video. The output video
  7729. size is 640x480, and the top-left corner of the input video is placed at
  7730. column 0, row 40
  7731. @example
  7732. pad=640:480:0:40:violet
  7733. @end example
  7734. The example above is equivalent to the following command:
  7735. @example
  7736. pad=width=640:height=480:x=0:y=40:color=violet
  7737. @end example
  7738. @item
  7739. Pad the input to get an output with dimensions increased by 3/2,
  7740. and put the input video at the center of the padded area:
  7741. @example
  7742. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  7743. @end example
  7744. @item
  7745. Pad the input to get a squared output with size equal to the maximum
  7746. value between the input width and height, and put the input video at
  7747. the center of the padded area:
  7748. @example
  7749. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  7750. @end example
  7751. @item
  7752. Pad the input to get a final w/h ratio of 16:9:
  7753. @example
  7754. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  7755. @end example
  7756. @item
  7757. In case of anamorphic video, in order to set the output display aspect
  7758. correctly, it is necessary to use @var{sar} in the expression,
  7759. according to the relation:
  7760. @example
  7761. (ih * X / ih) * sar = output_dar
  7762. X = output_dar / sar
  7763. @end example
  7764. Thus the previous example needs to be modified to:
  7765. @example
  7766. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  7767. @end example
  7768. @item
  7769. Double the output size and put the input video in the bottom-right
  7770. corner of the output padded area:
  7771. @example
  7772. pad="2*iw:2*ih:ow-iw:oh-ih"
  7773. @end example
  7774. @end itemize
  7775. @anchor{palettegen}
  7776. @section palettegen
  7777. Generate one palette for a whole video stream.
  7778. It accepts the following options:
  7779. @table @option
  7780. @item max_colors
  7781. Set the maximum number of colors to quantize in the palette.
  7782. Note: the palette will still contain 256 colors; the unused palette entries
  7783. will be black.
  7784. @item reserve_transparent
  7785. Create a palette of 255 colors maximum and reserve the last one for
  7786. transparency. Reserving the transparency color is useful for GIF optimization.
  7787. If not set, the maximum of colors in the palette will be 256. You probably want
  7788. to disable this option for a standalone image.
  7789. Set by default.
  7790. @item stats_mode
  7791. Set statistics mode.
  7792. It accepts the following values:
  7793. @table @samp
  7794. @item full
  7795. Compute full frame histograms.
  7796. @item diff
  7797. Compute histograms only for the part that differs from previous frame. This
  7798. might be relevant to give more importance to the moving part of your input if
  7799. the background is static.
  7800. @end table
  7801. Default value is @var{full}.
  7802. @end table
  7803. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  7804. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  7805. color quantization of the palette. This information is also visible at
  7806. @var{info} logging level.
  7807. @subsection Examples
  7808. @itemize
  7809. @item
  7810. Generate a representative palette of a given video using @command{ffmpeg}:
  7811. @example
  7812. ffmpeg -i input.mkv -vf palettegen palette.png
  7813. @end example
  7814. @end itemize
  7815. @section paletteuse
  7816. Use a palette to downsample an input video stream.
  7817. The filter takes two inputs: one video stream and a palette. The palette must
  7818. be a 256 pixels image.
  7819. It accepts the following options:
  7820. @table @option
  7821. @item dither
  7822. Select dithering mode. Available algorithms are:
  7823. @table @samp
  7824. @item bayer
  7825. Ordered 8x8 bayer dithering (deterministic)
  7826. @item heckbert
  7827. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  7828. Note: this dithering is sometimes considered "wrong" and is included as a
  7829. reference.
  7830. @item floyd_steinberg
  7831. Floyd and Steingberg dithering (error diffusion)
  7832. @item sierra2
  7833. Frankie Sierra dithering v2 (error diffusion)
  7834. @item sierra2_4a
  7835. Frankie Sierra dithering v2 "Lite" (error diffusion)
  7836. @end table
  7837. Default is @var{sierra2_4a}.
  7838. @item bayer_scale
  7839. When @var{bayer} dithering is selected, this option defines the scale of the
  7840. pattern (how much the crosshatch pattern is visible). A low value means more
  7841. visible pattern for less banding, and higher value means less visible pattern
  7842. at the cost of more banding.
  7843. The option must be an integer value in the range [0,5]. Default is @var{2}.
  7844. @item diff_mode
  7845. If set, define the zone to process
  7846. @table @samp
  7847. @item rectangle
  7848. Only the changing rectangle will be reprocessed. This is similar to GIF
  7849. cropping/offsetting compression mechanism. This option can be useful for speed
  7850. if only a part of the image is changing, and has use cases such as limiting the
  7851. scope of the error diffusal @option{dither} to the rectangle that bounds the
  7852. moving scene (it leads to more deterministic output if the scene doesn't change
  7853. much, and as a result less moving noise and better GIF compression).
  7854. @end table
  7855. Default is @var{none}.
  7856. @end table
  7857. @subsection Examples
  7858. @itemize
  7859. @item
  7860. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  7861. using @command{ffmpeg}:
  7862. @example
  7863. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  7864. @end example
  7865. @end itemize
  7866. @section perspective
  7867. Correct perspective of video not recorded perpendicular to the screen.
  7868. A description of the accepted parameters follows.
  7869. @table @option
  7870. @item x0
  7871. @item y0
  7872. @item x1
  7873. @item y1
  7874. @item x2
  7875. @item y2
  7876. @item x3
  7877. @item y3
  7878. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  7879. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  7880. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  7881. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  7882. then the corners of the source will be sent to the specified coordinates.
  7883. The expressions can use the following variables:
  7884. @table @option
  7885. @item W
  7886. @item H
  7887. the width and height of video frame.
  7888. @item in
  7889. Input frame count.
  7890. @item on
  7891. Output frame count.
  7892. @end table
  7893. @item interpolation
  7894. Set interpolation for perspective correction.
  7895. It accepts the following values:
  7896. @table @samp
  7897. @item linear
  7898. @item cubic
  7899. @end table
  7900. Default value is @samp{linear}.
  7901. @item sense
  7902. Set interpretation of coordinate options.
  7903. It accepts the following values:
  7904. @table @samp
  7905. @item 0, source
  7906. Send point in the source specified by the given coordinates to
  7907. the corners of the destination.
  7908. @item 1, destination
  7909. Send the corners of the source to the point in the destination specified
  7910. by the given coordinates.
  7911. Default value is @samp{source}.
  7912. @end table
  7913. @item eval
  7914. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  7915. It accepts the following values:
  7916. @table @samp
  7917. @item init
  7918. only evaluate expressions once during the filter initialization or
  7919. when a command is processed
  7920. @item frame
  7921. evaluate expressions for each incoming frame
  7922. @end table
  7923. Default value is @samp{init}.
  7924. @end table
  7925. @section phase
  7926. Delay interlaced video by one field time so that the field order changes.
  7927. The intended use is to fix PAL movies that have been captured with the
  7928. opposite field order to the film-to-video transfer.
  7929. A description of the accepted parameters follows.
  7930. @table @option
  7931. @item mode
  7932. Set phase mode.
  7933. It accepts the following values:
  7934. @table @samp
  7935. @item t
  7936. Capture field order top-first, transfer bottom-first.
  7937. Filter will delay the bottom field.
  7938. @item b
  7939. Capture field order bottom-first, transfer top-first.
  7940. Filter will delay the top field.
  7941. @item p
  7942. Capture and transfer with the same field order. This mode only exists
  7943. for the documentation of the other options to refer to, but if you
  7944. actually select it, the filter will faithfully do nothing.
  7945. @item a
  7946. Capture field order determined automatically by field flags, transfer
  7947. opposite.
  7948. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  7949. basis using field flags. If no field information is available,
  7950. then this works just like @samp{u}.
  7951. @item u
  7952. Capture unknown or varying, transfer opposite.
  7953. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  7954. analyzing the images and selecting the alternative that produces best
  7955. match between the fields.
  7956. @item T
  7957. Capture top-first, transfer unknown or varying.
  7958. Filter selects among @samp{t} and @samp{p} using image analysis.
  7959. @item B
  7960. Capture bottom-first, transfer unknown or varying.
  7961. Filter selects among @samp{b} and @samp{p} using image analysis.
  7962. @item A
  7963. Capture determined by field flags, transfer unknown or varying.
  7964. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  7965. image analysis. If no field information is available, then this works just
  7966. like @samp{U}. This is the default mode.
  7967. @item U
  7968. Both capture and transfer unknown or varying.
  7969. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  7970. @end table
  7971. @end table
  7972. @section pixdesctest
  7973. Pixel format descriptor test filter, mainly useful for internal
  7974. testing. The output video should be equal to the input video.
  7975. For example:
  7976. @example
  7977. format=monow, pixdesctest
  7978. @end example
  7979. can be used to test the monowhite pixel format descriptor definition.
  7980. @section pp
  7981. Enable the specified chain of postprocessing subfilters using libpostproc. This
  7982. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  7983. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  7984. Each subfilter and some options have a short and a long name that can be used
  7985. interchangeably, i.e. dr/dering are the same.
  7986. The filters accept the following options:
  7987. @table @option
  7988. @item subfilters
  7989. Set postprocessing subfilters string.
  7990. @end table
  7991. All subfilters share common options to determine their scope:
  7992. @table @option
  7993. @item a/autoq
  7994. Honor the quality commands for this subfilter.
  7995. @item c/chrom
  7996. Do chrominance filtering, too (default).
  7997. @item y/nochrom
  7998. Do luminance filtering only (no chrominance).
  7999. @item n/noluma
  8000. Do chrominance filtering only (no luminance).
  8001. @end table
  8002. These options can be appended after the subfilter name, separated by a '|'.
  8003. Available subfilters are:
  8004. @table @option
  8005. @item hb/hdeblock[|difference[|flatness]]
  8006. Horizontal deblocking filter
  8007. @table @option
  8008. @item difference
  8009. Difference factor where higher values mean more deblocking (default: @code{32}).
  8010. @item flatness
  8011. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8012. @end table
  8013. @item vb/vdeblock[|difference[|flatness]]
  8014. Vertical deblocking filter
  8015. @table @option
  8016. @item difference
  8017. Difference factor where higher values mean more deblocking (default: @code{32}).
  8018. @item flatness
  8019. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8020. @end table
  8021. @item ha/hadeblock[|difference[|flatness]]
  8022. Accurate horizontal deblocking filter
  8023. @table @option
  8024. @item difference
  8025. Difference factor where higher values mean more deblocking (default: @code{32}).
  8026. @item flatness
  8027. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8028. @end table
  8029. @item va/vadeblock[|difference[|flatness]]
  8030. Accurate vertical deblocking filter
  8031. @table @option
  8032. @item difference
  8033. Difference factor where higher values mean more deblocking (default: @code{32}).
  8034. @item flatness
  8035. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8036. @end table
  8037. @end table
  8038. The horizontal and vertical deblocking filters share the difference and
  8039. flatness values so you cannot set different horizontal and vertical
  8040. thresholds.
  8041. @table @option
  8042. @item h1/x1hdeblock
  8043. Experimental horizontal deblocking filter
  8044. @item v1/x1vdeblock
  8045. Experimental vertical deblocking filter
  8046. @item dr/dering
  8047. Deringing filter
  8048. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8049. @table @option
  8050. @item threshold1
  8051. larger -> stronger filtering
  8052. @item threshold2
  8053. larger -> stronger filtering
  8054. @item threshold3
  8055. larger -> stronger filtering
  8056. @end table
  8057. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8058. @table @option
  8059. @item f/fullyrange
  8060. Stretch luminance to @code{0-255}.
  8061. @end table
  8062. @item lb/linblenddeint
  8063. Linear blend deinterlacing filter that deinterlaces the given block by
  8064. filtering all lines with a @code{(1 2 1)} filter.
  8065. @item li/linipoldeint
  8066. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8067. linearly interpolating every second line.
  8068. @item ci/cubicipoldeint
  8069. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8070. cubically interpolating every second line.
  8071. @item md/mediandeint
  8072. Median deinterlacing filter that deinterlaces the given block by applying a
  8073. median filter to every second line.
  8074. @item fd/ffmpegdeint
  8075. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8076. second line with a @code{(-1 4 2 4 -1)} filter.
  8077. @item l5/lowpass5
  8078. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8079. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8080. @item fq/forceQuant[|quantizer]
  8081. Overrides the quantizer table from the input with the constant quantizer you
  8082. specify.
  8083. @table @option
  8084. @item quantizer
  8085. Quantizer to use
  8086. @end table
  8087. @item de/default
  8088. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8089. @item fa/fast
  8090. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8091. @item ac
  8092. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8093. @end table
  8094. @subsection Examples
  8095. @itemize
  8096. @item
  8097. Apply horizontal and vertical deblocking, deringing and automatic
  8098. brightness/contrast:
  8099. @example
  8100. pp=hb/vb/dr/al
  8101. @end example
  8102. @item
  8103. Apply default filters without brightness/contrast correction:
  8104. @example
  8105. pp=de/-al
  8106. @end example
  8107. @item
  8108. Apply default filters and temporal denoiser:
  8109. @example
  8110. pp=default/tmpnoise|1|2|3
  8111. @end example
  8112. @item
  8113. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8114. automatically depending on available CPU time:
  8115. @example
  8116. pp=hb|y/vb|a
  8117. @end example
  8118. @end itemize
  8119. @section pp7
  8120. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8121. similar to spp = 6 with 7 point DCT, where only the center sample is
  8122. used after IDCT.
  8123. The filter accepts the following options:
  8124. @table @option
  8125. @item qp
  8126. Force a constant quantization parameter. It accepts an integer in range
  8127. 0 to 63. If not set, the filter will use the QP from the video stream
  8128. (if available).
  8129. @item mode
  8130. Set thresholding mode. Available modes are:
  8131. @table @samp
  8132. @item hard
  8133. Set hard thresholding.
  8134. @item soft
  8135. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8136. @item medium
  8137. Set medium thresholding (good results, default).
  8138. @end table
  8139. @end table
  8140. @section psnr
  8141. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8142. Ratio) between two input videos.
  8143. This filter takes in input two input videos, the first input is
  8144. considered the "main" source and is passed unchanged to the
  8145. output. The second input is used as a "reference" video for computing
  8146. the PSNR.
  8147. Both video inputs must have the same resolution and pixel format for
  8148. this filter to work correctly. Also it assumes that both inputs
  8149. have the same number of frames, which are compared one by one.
  8150. The obtained average PSNR is printed through the logging system.
  8151. The filter stores the accumulated MSE (mean squared error) of each
  8152. frame, and at the end of the processing it is averaged across all frames
  8153. equally, and the following formula is applied to obtain the PSNR:
  8154. @example
  8155. PSNR = 10*log10(MAX^2/MSE)
  8156. @end example
  8157. Where MAX is the average of the maximum values of each component of the
  8158. image.
  8159. The description of the accepted parameters follows.
  8160. @table @option
  8161. @item stats_file, f
  8162. If specified the filter will use the named file to save the PSNR of
  8163. each individual frame. When filename equals "-" the data is sent to
  8164. standard output.
  8165. @end table
  8166. The file printed if @var{stats_file} is selected, contains a sequence of
  8167. key/value pairs of the form @var{key}:@var{value} for each compared
  8168. couple of frames.
  8169. A description of each shown parameter follows:
  8170. @table @option
  8171. @item n
  8172. sequential number of the input frame, starting from 1
  8173. @item mse_avg
  8174. Mean Square Error pixel-by-pixel average difference of the compared
  8175. frames, averaged over all the image components.
  8176. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8177. Mean Square Error pixel-by-pixel average difference of the compared
  8178. frames for the component specified by the suffix.
  8179. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8180. Peak Signal to Noise ratio of the compared frames for the component
  8181. specified by the suffix.
  8182. @end table
  8183. For example:
  8184. @example
  8185. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8186. [main][ref] psnr="stats_file=stats.log" [out]
  8187. @end example
  8188. On this example the input file being processed is compared with the
  8189. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8190. is stored in @file{stats.log}.
  8191. @anchor{pullup}
  8192. @section pullup
  8193. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8194. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8195. content.
  8196. The pullup filter is designed to take advantage of future context in making
  8197. its decisions. This filter is stateless in the sense that it does not lock
  8198. onto a pattern to follow, but it instead looks forward to the following
  8199. fields in order to identify matches and rebuild progressive frames.
  8200. To produce content with an even framerate, insert the fps filter after
  8201. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8202. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8203. The filter accepts the following options:
  8204. @table @option
  8205. @item jl
  8206. @item jr
  8207. @item jt
  8208. @item jb
  8209. These options set the amount of "junk" to ignore at the left, right, top, and
  8210. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8211. while top and bottom are in units of 2 lines.
  8212. The default is 8 pixels on each side.
  8213. @item sb
  8214. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8215. filter generating an occasional mismatched frame, but it may also cause an
  8216. excessive number of frames to be dropped during high motion sequences.
  8217. Conversely, setting it to -1 will make filter match fields more easily.
  8218. This may help processing of video where there is slight blurring between
  8219. the fields, but may also cause there to be interlaced frames in the output.
  8220. Default value is @code{0}.
  8221. @item mp
  8222. Set the metric plane to use. It accepts the following values:
  8223. @table @samp
  8224. @item l
  8225. Use luma plane.
  8226. @item u
  8227. Use chroma blue plane.
  8228. @item v
  8229. Use chroma red plane.
  8230. @end table
  8231. This option may be set to use chroma plane instead of the default luma plane
  8232. for doing filter's computations. This may improve accuracy on very clean
  8233. source material, but more likely will decrease accuracy, especially if there
  8234. is chroma noise (rainbow effect) or any grayscale video.
  8235. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8236. load and make pullup usable in realtime on slow machines.
  8237. @end table
  8238. For best results (without duplicated frames in the output file) it is
  8239. necessary to change the output frame rate. For example, to inverse
  8240. telecine NTSC input:
  8241. @example
  8242. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8243. @end example
  8244. @section qp
  8245. Change video quantization parameters (QP).
  8246. The filter accepts the following option:
  8247. @table @option
  8248. @item qp
  8249. Set expression for quantization parameter.
  8250. @end table
  8251. The expression is evaluated through the eval API and can contain, among others,
  8252. the following constants:
  8253. @table @var
  8254. @item known
  8255. 1 if index is not 129, 0 otherwise.
  8256. @item qp
  8257. Sequentional index starting from -129 to 128.
  8258. @end table
  8259. @subsection Examples
  8260. @itemize
  8261. @item
  8262. Some equation like:
  8263. @example
  8264. qp=2+2*sin(PI*qp)
  8265. @end example
  8266. @end itemize
  8267. @section random
  8268. Flush video frames from internal cache of frames into a random order.
  8269. No frame is discarded.
  8270. Inspired by @ref{frei0r} nervous filter.
  8271. @table @option
  8272. @item frames
  8273. Set size in number of frames of internal cache, in range from @code{2} to
  8274. @code{512}. Default is @code{30}.
  8275. @item seed
  8276. Set seed for random number generator, must be an integer included between
  8277. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8278. less than @code{0}, the filter will try to use a good random seed on a
  8279. best effort basis.
  8280. @end table
  8281. @section readvitc
  8282. Read vertical interval timecode (VITC) information from the top lines of a
  8283. video frame.
  8284. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8285. timecode value, if a valid timecode has been detected. Further metadata key
  8286. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8287. timecode data has been found or not.
  8288. This filter accepts the following options:
  8289. @table @option
  8290. @item scan_max
  8291. Set the maximum number of lines to scan for VITC data. If the value is set to
  8292. @code{-1} the full video frame is scanned. Default is @code{45}.
  8293. @item thr_b
  8294. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8295. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8296. @item thr_w
  8297. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8298. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8299. @end table
  8300. @subsection Examples
  8301. @itemize
  8302. @item
  8303. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8304. draw @code{--:--:--:--} as a placeholder:
  8305. @example
  8306. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8307. @end example
  8308. @end itemize
  8309. @section remap
  8310. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8311. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8312. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8313. value for pixel will be used for destination pixel.
  8314. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8315. will have Xmap/Ymap video stream dimensions.
  8316. Xmap and Ymap input video streams are 16bit depth, single channel.
  8317. @section removegrain
  8318. The removegrain filter is a spatial denoiser for progressive video.
  8319. @table @option
  8320. @item m0
  8321. Set mode for the first plane.
  8322. @item m1
  8323. Set mode for the second plane.
  8324. @item m2
  8325. Set mode for the third plane.
  8326. @item m3
  8327. Set mode for the fourth plane.
  8328. @end table
  8329. Range of mode is from 0 to 24. Description of each mode follows:
  8330. @table @var
  8331. @item 0
  8332. Leave input plane unchanged. Default.
  8333. @item 1
  8334. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8335. @item 2
  8336. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8337. @item 3
  8338. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8339. @item 4
  8340. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8341. This is equivalent to a median filter.
  8342. @item 5
  8343. Line-sensitive clipping giving the minimal change.
  8344. @item 6
  8345. Line-sensitive clipping, intermediate.
  8346. @item 7
  8347. Line-sensitive clipping, intermediate.
  8348. @item 8
  8349. Line-sensitive clipping, intermediate.
  8350. @item 9
  8351. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8352. @item 10
  8353. Replaces the target pixel with the closest neighbour.
  8354. @item 11
  8355. [1 2 1] horizontal and vertical kernel blur.
  8356. @item 12
  8357. Same as mode 11.
  8358. @item 13
  8359. Bob mode, interpolates top field from the line where the neighbours
  8360. pixels are the closest.
  8361. @item 14
  8362. Bob mode, interpolates bottom field from the line where the neighbours
  8363. pixels are the closest.
  8364. @item 15
  8365. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8366. interpolation formula.
  8367. @item 16
  8368. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8369. interpolation formula.
  8370. @item 17
  8371. Clips the pixel with the minimum and maximum of respectively the maximum and
  8372. minimum of each pair of opposite neighbour pixels.
  8373. @item 18
  8374. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8375. the current pixel is minimal.
  8376. @item 19
  8377. Replaces the pixel with the average of its 8 neighbours.
  8378. @item 20
  8379. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8380. @item 21
  8381. Clips pixels using the averages of opposite neighbour.
  8382. @item 22
  8383. Same as mode 21 but simpler and faster.
  8384. @item 23
  8385. Small edge and halo removal, but reputed useless.
  8386. @item 24
  8387. Similar as 23.
  8388. @end table
  8389. @section removelogo
  8390. Suppress a TV station logo, using an image file to determine which
  8391. pixels comprise the logo. It works by filling in the pixels that
  8392. comprise the logo with neighboring pixels.
  8393. The filter accepts the following options:
  8394. @table @option
  8395. @item filename, f
  8396. Set the filter bitmap file, which can be any image format supported by
  8397. libavformat. The width and height of the image file must match those of the
  8398. video stream being processed.
  8399. @end table
  8400. Pixels in the provided bitmap image with a value of zero are not
  8401. considered part of the logo, non-zero pixels are considered part of
  8402. the logo. If you use white (255) for the logo and black (0) for the
  8403. rest, you will be safe. For making the filter bitmap, it is
  8404. recommended to take a screen capture of a black frame with the logo
  8405. visible, and then using a threshold filter followed by the erode
  8406. filter once or twice.
  8407. If needed, little splotches can be fixed manually. Remember that if
  8408. logo pixels are not covered, the filter quality will be much
  8409. reduced. Marking too many pixels as part of the logo does not hurt as
  8410. much, but it will increase the amount of blurring needed to cover over
  8411. the image and will destroy more information than necessary, and extra
  8412. pixels will slow things down on a large logo.
  8413. @section repeatfields
  8414. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8415. fields based on its value.
  8416. @section reverse, areverse
  8417. Reverse a clip.
  8418. Warning: This filter requires memory to buffer the entire clip, so trimming
  8419. is suggested.
  8420. @subsection Examples
  8421. @itemize
  8422. @item
  8423. Take the first 5 seconds of a clip, and reverse it.
  8424. @example
  8425. trim=end=5,reverse
  8426. @end example
  8427. @end itemize
  8428. @section rotate
  8429. Rotate video by an arbitrary angle expressed in radians.
  8430. The filter accepts the following options:
  8431. A description of the optional parameters follows.
  8432. @table @option
  8433. @item angle, a
  8434. Set an expression for the angle by which to rotate the input video
  8435. clockwise, expressed as a number of radians. A negative value will
  8436. result in a counter-clockwise rotation. By default it is set to "0".
  8437. This expression is evaluated for each frame.
  8438. @item out_w, ow
  8439. Set the output width expression, default value is "iw".
  8440. This expression is evaluated just once during configuration.
  8441. @item out_h, oh
  8442. Set the output height expression, default value is "ih".
  8443. This expression is evaluated just once during configuration.
  8444. @item bilinear
  8445. Enable bilinear interpolation if set to 1, a value of 0 disables
  8446. it. Default value is 1.
  8447. @item fillcolor, c
  8448. Set the color used to fill the output area not covered by the rotated
  8449. image. For the general syntax of this option, check the "Color" section in the
  8450. ffmpeg-utils manual. If the special value "none" is selected then no
  8451. background is printed (useful for example if the background is never shown).
  8452. Default value is "black".
  8453. @end table
  8454. The expressions for the angle and the output size can contain the
  8455. following constants and functions:
  8456. @table @option
  8457. @item n
  8458. sequential number of the input frame, starting from 0. It is always NAN
  8459. before the first frame is filtered.
  8460. @item t
  8461. time in seconds of the input frame, it is set to 0 when the filter is
  8462. configured. It is always NAN before the first frame is filtered.
  8463. @item hsub
  8464. @item vsub
  8465. horizontal and vertical chroma subsample values. For example for the
  8466. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8467. @item in_w, iw
  8468. @item in_h, ih
  8469. the input video width and height
  8470. @item out_w, ow
  8471. @item out_h, oh
  8472. the output width and height, that is the size of the padded area as
  8473. specified by the @var{width} and @var{height} expressions
  8474. @item rotw(a)
  8475. @item roth(a)
  8476. the minimal width/height required for completely containing the input
  8477. video rotated by @var{a} radians.
  8478. These are only available when computing the @option{out_w} and
  8479. @option{out_h} expressions.
  8480. @end table
  8481. @subsection Examples
  8482. @itemize
  8483. @item
  8484. Rotate the input by PI/6 radians clockwise:
  8485. @example
  8486. rotate=PI/6
  8487. @end example
  8488. @item
  8489. Rotate the input by PI/6 radians counter-clockwise:
  8490. @example
  8491. rotate=-PI/6
  8492. @end example
  8493. @item
  8494. Rotate the input by 45 degrees clockwise:
  8495. @example
  8496. rotate=45*PI/180
  8497. @end example
  8498. @item
  8499. Apply a constant rotation with period T, starting from an angle of PI/3:
  8500. @example
  8501. rotate=PI/3+2*PI*t/T
  8502. @end example
  8503. @item
  8504. Make the input video rotation oscillating with a period of T
  8505. seconds and an amplitude of A radians:
  8506. @example
  8507. rotate=A*sin(2*PI/T*t)
  8508. @end example
  8509. @item
  8510. Rotate the video, output size is chosen so that the whole rotating
  8511. input video is always completely contained in the output:
  8512. @example
  8513. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8514. @end example
  8515. @item
  8516. Rotate the video, reduce the output size so that no background is ever
  8517. shown:
  8518. @example
  8519. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8520. @end example
  8521. @end itemize
  8522. @subsection Commands
  8523. The filter supports the following commands:
  8524. @table @option
  8525. @item a, angle
  8526. Set the angle expression.
  8527. The command accepts the same syntax of the corresponding option.
  8528. If the specified expression is not valid, it is kept at its current
  8529. value.
  8530. @end table
  8531. @section sab
  8532. Apply Shape Adaptive Blur.
  8533. The filter accepts the following options:
  8534. @table @option
  8535. @item luma_radius, lr
  8536. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8537. value is 1.0. A greater value will result in a more blurred image, and
  8538. in slower processing.
  8539. @item luma_pre_filter_radius, lpfr
  8540. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8541. value is 1.0.
  8542. @item luma_strength, ls
  8543. Set luma maximum difference between pixels to still be considered, must
  8544. be a value in the 0.1-100.0 range, default value is 1.0.
  8545. @item chroma_radius, cr
  8546. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  8547. greater value will result in a more blurred image, and in slower
  8548. processing.
  8549. @item chroma_pre_filter_radius, cpfr
  8550. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  8551. @item chroma_strength, cs
  8552. Set chroma maximum difference between pixels to still be considered,
  8553. must be a value in the 0.1-100.0 range.
  8554. @end table
  8555. Each chroma option value, if not explicitly specified, is set to the
  8556. corresponding luma option value.
  8557. @anchor{scale}
  8558. @section scale
  8559. Scale (resize) the input video, using the libswscale library.
  8560. The scale filter forces the output display aspect ratio to be the same
  8561. of the input, by changing the output sample aspect ratio.
  8562. If the input image format is different from the format requested by
  8563. the next filter, the scale filter will convert the input to the
  8564. requested format.
  8565. @subsection Options
  8566. The filter accepts the following options, or any of the options
  8567. supported by the libswscale scaler.
  8568. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8569. the complete list of scaler options.
  8570. @table @option
  8571. @item width, w
  8572. @item height, h
  8573. Set the output video dimension expression. Default value is the input
  8574. dimension.
  8575. If the value is 0, the input width is used for the output.
  8576. If one of the values is -1, the scale filter will use a value that
  8577. maintains the aspect ratio of the input image, calculated from the
  8578. other specified dimension. If both of them are -1, the input size is
  8579. used
  8580. If one of the values is -n with n > 1, the scale filter will also use a value
  8581. that maintains the aspect ratio of the input image, calculated from the other
  8582. specified dimension. After that it will, however, make sure that the calculated
  8583. dimension is divisible by n and adjust the value if necessary.
  8584. See below for the list of accepted constants for use in the dimension
  8585. expression.
  8586. @item eval
  8587. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8588. @table @samp
  8589. @item init
  8590. Only evaluate expressions once during the filter initialization or when a command is processed.
  8591. @item frame
  8592. Evaluate expressions for each incoming frame.
  8593. @end table
  8594. Default value is @samp{init}.
  8595. @item interl
  8596. Set the interlacing mode. It accepts the following values:
  8597. @table @samp
  8598. @item 1
  8599. Force interlaced aware scaling.
  8600. @item 0
  8601. Do not apply interlaced scaling.
  8602. @item -1
  8603. Select interlaced aware scaling depending on whether the source frames
  8604. are flagged as interlaced or not.
  8605. @end table
  8606. Default value is @samp{0}.
  8607. @item flags
  8608. Set libswscale scaling flags. See
  8609. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8610. complete list of values. If not explicitly specified the filter applies
  8611. the default flags.
  8612. @item param0, param1
  8613. Set libswscale input parameters for scaling algorithms that need them. See
  8614. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8615. complete documentation. If not explicitly specified the filter applies
  8616. empty parameters.
  8617. @item size, s
  8618. Set the video size. For the syntax of this option, check the
  8619. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8620. @item in_color_matrix
  8621. @item out_color_matrix
  8622. Set in/output YCbCr color space type.
  8623. This allows the autodetected value to be overridden as well as allows forcing
  8624. a specific value used for the output and encoder.
  8625. If not specified, the color space type depends on the pixel format.
  8626. Possible values:
  8627. @table @samp
  8628. @item auto
  8629. Choose automatically.
  8630. @item bt709
  8631. Format conforming to International Telecommunication Union (ITU)
  8632. Recommendation BT.709.
  8633. @item fcc
  8634. Set color space conforming to the United States Federal Communications
  8635. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  8636. @item bt601
  8637. Set color space conforming to:
  8638. @itemize
  8639. @item
  8640. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  8641. @item
  8642. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  8643. @item
  8644. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  8645. @end itemize
  8646. @item smpte240m
  8647. Set color space conforming to SMPTE ST 240:1999.
  8648. @end table
  8649. @item in_range
  8650. @item out_range
  8651. Set in/output YCbCr sample range.
  8652. This allows the autodetected value to be overridden as well as allows forcing
  8653. a specific value used for the output and encoder. If not specified, the
  8654. range depends on the pixel format. Possible values:
  8655. @table @samp
  8656. @item auto
  8657. Choose automatically.
  8658. @item jpeg/full/pc
  8659. Set full range (0-255 in case of 8-bit luma).
  8660. @item mpeg/tv
  8661. Set "MPEG" range (16-235 in case of 8-bit luma).
  8662. @end table
  8663. @item force_original_aspect_ratio
  8664. Enable decreasing or increasing output video width or height if necessary to
  8665. keep the original aspect ratio. Possible values:
  8666. @table @samp
  8667. @item disable
  8668. Scale the video as specified and disable this feature.
  8669. @item decrease
  8670. The output video dimensions will automatically be decreased if needed.
  8671. @item increase
  8672. The output video dimensions will automatically be increased if needed.
  8673. @end table
  8674. One useful instance of this option is that when you know a specific device's
  8675. maximum allowed resolution, you can use this to limit the output video to
  8676. that, while retaining the aspect ratio. For example, device A allows
  8677. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  8678. decrease) and specifying 1280x720 to the command line makes the output
  8679. 1280x533.
  8680. Please note that this is a different thing than specifying -1 for @option{w}
  8681. or @option{h}, you still need to specify the output resolution for this option
  8682. to work.
  8683. @end table
  8684. The values of the @option{w} and @option{h} options are expressions
  8685. containing the following constants:
  8686. @table @var
  8687. @item in_w
  8688. @item in_h
  8689. The input width and height
  8690. @item iw
  8691. @item ih
  8692. These are the same as @var{in_w} and @var{in_h}.
  8693. @item out_w
  8694. @item out_h
  8695. The output (scaled) width and height
  8696. @item ow
  8697. @item oh
  8698. These are the same as @var{out_w} and @var{out_h}
  8699. @item a
  8700. The same as @var{iw} / @var{ih}
  8701. @item sar
  8702. input sample aspect ratio
  8703. @item dar
  8704. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  8705. @item hsub
  8706. @item vsub
  8707. horizontal and vertical input chroma subsample values. For example for the
  8708. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8709. @item ohsub
  8710. @item ovsub
  8711. horizontal and vertical output chroma subsample values. For example for the
  8712. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8713. @end table
  8714. @subsection Examples
  8715. @itemize
  8716. @item
  8717. Scale the input video to a size of 200x100
  8718. @example
  8719. scale=w=200:h=100
  8720. @end example
  8721. This is equivalent to:
  8722. @example
  8723. scale=200:100
  8724. @end example
  8725. or:
  8726. @example
  8727. scale=200x100
  8728. @end example
  8729. @item
  8730. Specify a size abbreviation for the output size:
  8731. @example
  8732. scale=qcif
  8733. @end example
  8734. which can also be written as:
  8735. @example
  8736. scale=size=qcif
  8737. @end example
  8738. @item
  8739. Scale the input to 2x:
  8740. @example
  8741. scale=w=2*iw:h=2*ih
  8742. @end example
  8743. @item
  8744. The above is the same as:
  8745. @example
  8746. scale=2*in_w:2*in_h
  8747. @end example
  8748. @item
  8749. Scale the input to 2x with forced interlaced scaling:
  8750. @example
  8751. scale=2*iw:2*ih:interl=1
  8752. @end example
  8753. @item
  8754. Scale the input to half size:
  8755. @example
  8756. scale=w=iw/2:h=ih/2
  8757. @end example
  8758. @item
  8759. Increase the width, and set the height to the same size:
  8760. @example
  8761. scale=3/2*iw:ow
  8762. @end example
  8763. @item
  8764. Seek Greek harmony:
  8765. @example
  8766. scale=iw:1/PHI*iw
  8767. scale=ih*PHI:ih
  8768. @end example
  8769. @item
  8770. Increase the height, and set the width to 3/2 of the height:
  8771. @example
  8772. scale=w=3/2*oh:h=3/5*ih
  8773. @end example
  8774. @item
  8775. Increase the size, making the size a multiple of the chroma
  8776. subsample values:
  8777. @example
  8778. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  8779. @end example
  8780. @item
  8781. Increase the width to a maximum of 500 pixels,
  8782. keeping the same aspect ratio as the input:
  8783. @example
  8784. scale=w='min(500\, iw*3/2):h=-1'
  8785. @end example
  8786. @end itemize
  8787. @subsection Commands
  8788. This filter supports the following commands:
  8789. @table @option
  8790. @item width, w
  8791. @item height, h
  8792. Set the output video dimension expression.
  8793. The command accepts the same syntax of the corresponding option.
  8794. If the specified expression is not valid, it is kept at its current
  8795. value.
  8796. @end table
  8797. @section scale2ref
  8798. Scale (resize) the input video, based on a reference video.
  8799. See the scale filter for available options, scale2ref supports the same but
  8800. uses the reference video instead of the main input as basis.
  8801. @subsection Examples
  8802. @itemize
  8803. @item
  8804. Scale a subtitle stream to match the main video in size before overlaying
  8805. @example
  8806. 'scale2ref[b][a];[a][b]overlay'
  8807. @end example
  8808. @end itemize
  8809. @anchor{selectivecolor}
  8810. @section selectivecolor
  8811. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  8812. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  8813. by the "purity" of the color (that is, how saturated it already is).
  8814. This filter is similar to the Adobe Photoshop Selective Color tool.
  8815. The filter accepts the following options:
  8816. @table @option
  8817. @item correction_method
  8818. Select color correction method.
  8819. Available values are:
  8820. @table @samp
  8821. @item absolute
  8822. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  8823. component value).
  8824. @item relative
  8825. Specified adjustments are relative to the original component value.
  8826. @end table
  8827. Default is @code{absolute}.
  8828. @item reds
  8829. Adjustments for red pixels (pixels where the red component is the maximum)
  8830. @item yellows
  8831. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  8832. @item greens
  8833. Adjustments for green pixels (pixels where the green component is the maximum)
  8834. @item cyans
  8835. Adjustments for cyan pixels (pixels where the red component is the minimum)
  8836. @item blues
  8837. Adjustments for blue pixels (pixels where the blue component is the maximum)
  8838. @item magentas
  8839. Adjustments for magenta pixels (pixels where the green component is the minimum)
  8840. @item whites
  8841. Adjustments for white pixels (pixels where all components are greater than 128)
  8842. @item neutrals
  8843. Adjustments for all pixels except pure black and pure white
  8844. @item blacks
  8845. Adjustments for black pixels (pixels where all components are lesser than 128)
  8846. @item psfile
  8847. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  8848. @end table
  8849. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  8850. 4 space separated floating point adjustment values in the [-1,1] range,
  8851. respectively to adjust the amount of cyan, magenta, yellow and black for the
  8852. pixels of its range.
  8853. @subsection Examples
  8854. @itemize
  8855. @item
  8856. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  8857. increase magenta by 27% in blue areas:
  8858. @example
  8859. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  8860. @end example
  8861. @item
  8862. Use a Photoshop selective color preset:
  8863. @example
  8864. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  8865. @end example
  8866. @end itemize
  8867. @section separatefields
  8868. The @code{separatefields} takes a frame-based video input and splits
  8869. each frame into its components fields, producing a new half height clip
  8870. with twice the frame rate and twice the frame count.
  8871. This filter use field-dominance information in frame to decide which
  8872. of each pair of fields to place first in the output.
  8873. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  8874. @section setdar, setsar
  8875. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  8876. output video.
  8877. This is done by changing the specified Sample (aka Pixel) Aspect
  8878. Ratio, according to the following equation:
  8879. @example
  8880. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  8881. @end example
  8882. Keep in mind that the @code{setdar} filter does not modify the pixel
  8883. dimensions of the video frame. Also, the display aspect ratio set by
  8884. this filter may be changed by later filters in the filterchain,
  8885. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  8886. applied.
  8887. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  8888. the filter output video.
  8889. Note that as a consequence of the application of this filter, the
  8890. output display aspect ratio will change according to the equation
  8891. above.
  8892. Keep in mind that the sample aspect ratio set by the @code{setsar}
  8893. filter may be changed by later filters in the filterchain, e.g. if
  8894. another "setsar" or a "setdar" filter is applied.
  8895. It accepts the following parameters:
  8896. @table @option
  8897. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  8898. Set the aspect ratio used by the filter.
  8899. The parameter can be a floating point number string, an expression, or
  8900. a string of the form @var{num}:@var{den}, where @var{num} and
  8901. @var{den} are the numerator and denominator of the aspect ratio. If
  8902. the parameter is not specified, it is assumed the value "0".
  8903. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  8904. should be escaped.
  8905. @item max
  8906. Set the maximum integer value to use for expressing numerator and
  8907. denominator when reducing the expressed aspect ratio to a rational.
  8908. Default value is @code{100}.
  8909. @end table
  8910. The parameter @var{sar} is an expression containing
  8911. the following constants:
  8912. @table @option
  8913. @item E, PI, PHI
  8914. These are approximated values for the mathematical constants e
  8915. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  8916. @item w, h
  8917. The input width and height.
  8918. @item a
  8919. These are the same as @var{w} / @var{h}.
  8920. @item sar
  8921. The input sample aspect ratio.
  8922. @item dar
  8923. The input display aspect ratio. It is the same as
  8924. (@var{w} / @var{h}) * @var{sar}.
  8925. @item hsub, vsub
  8926. Horizontal and vertical chroma subsample values. For example, for the
  8927. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8928. @end table
  8929. @subsection Examples
  8930. @itemize
  8931. @item
  8932. To change the display aspect ratio to 16:9, specify one of the following:
  8933. @example
  8934. setdar=dar=1.77777
  8935. setdar=dar=16/9
  8936. @end example
  8937. @item
  8938. To change the sample aspect ratio to 10:11, specify:
  8939. @example
  8940. setsar=sar=10/11
  8941. @end example
  8942. @item
  8943. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  8944. 1000 in the aspect ratio reduction, use the command:
  8945. @example
  8946. setdar=ratio=16/9:max=1000
  8947. @end example
  8948. @end itemize
  8949. @anchor{setfield}
  8950. @section setfield
  8951. Force field for the output video frame.
  8952. The @code{setfield} filter marks the interlace type field for the
  8953. output frames. It does not change the input frame, but only sets the
  8954. corresponding property, which affects how the frame is treated by
  8955. following filters (e.g. @code{fieldorder} or @code{yadif}).
  8956. The filter accepts the following options:
  8957. @table @option
  8958. @item mode
  8959. Available values are:
  8960. @table @samp
  8961. @item auto
  8962. Keep the same field property.
  8963. @item bff
  8964. Mark the frame as bottom-field-first.
  8965. @item tff
  8966. Mark the frame as top-field-first.
  8967. @item prog
  8968. Mark the frame as progressive.
  8969. @end table
  8970. @end table
  8971. @section showinfo
  8972. Show a line containing various information for each input video frame.
  8973. The input video is not modified.
  8974. The shown line contains a sequence of key/value pairs of the form
  8975. @var{key}:@var{value}.
  8976. The following values are shown in the output:
  8977. @table @option
  8978. @item n
  8979. The (sequential) number of the input frame, starting from 0.
  8980. @item pts
  8981. The Presentation TimeStamp of the input frame, expressed as a number of
  8982. time base units. The time base unit depends on the filter input pad.
  8983. @item pts_time
  8984. The Presentation TimeStamp of the input frame, expressed as a number of
  8985. seconds.
  8986. @item pos
  8987. The position of the frame in the input stream, or -1 if this information is
  8988. unavailable and/or meaningless (for example in case of synthetic video).
  8989. @item fmt
  8990. The pixel format name.
  8991. @item sar
  8992. The sample aspect ratio of the input frame, expressed in the form
  8993. @var{num}/@var{den}.
  8994. @item s
  8995. The size of the input frame. For the syntax of this option, check the
  8996. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8997. @item i
  8998. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  8999. for bottom field first).
  9000. @item iskey
  9001. This is 1 if the frame is a key frame, 0 otherwise.
  9002. @item type
  9003. The picture type of the input frame ("I" for an I-frame, "P" for a
  9004. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9005. Also refer to the documentation of the @code{AVPictureType} enum and of
  9006. the @code{av_get_picture_type_char} function defined in
  9007. @file{libavutil/avutil.h}.
  9008. @item checksum
  9009. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9010. @item plane_checksum
  9011. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9012. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9013. @end table
  9014. @section showpalette
  9015. Displays the 256 colors palette of each frame. This filter is only relevant for
  9016. @var{pal8} pixel format frames.
  9017. It accepts the following option:
  9018. @table @option
  9019. @item s
  9020. Set the size of the box used to represent one palette color entry. Default is
  9021. @code{30} (for a @code{30x30} pixel box).
  9022. @end table
  9023. @section shuffleframes
  9024. Reorder and/or duplicate video frames.
  9025. It accepts the following parameters:
  9026. @table @option
  9027. @item mapping
  9028. Set the destination indexes of input frames.
  9029. This is space or '|' separated list of indexes that maps input frames to output
  9030. frames. Number of indexes also sets maximal value that each index may have.
  9031. @end table
  9032. The first frame has the index 0. The default is to keep the input unchanged.
  9033. Swap second and third frame of every three frames of the input:
  9034. @example
  9035. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9036. @end example
  9037. @section shuffleplanes
  9038. Reorder and/or duplicate video planes.
  9039. It accepts the following parameters:
  9040. @table @option
  9041. @item map0
  9042. The index of the input plane to be used as the first output plane.
  9043. @item map1
  9044. The index of the input plane to be used as the second output plane.
  9045. @item map2
  9046. The index of the input plane to be used as the third output plane.
  9047. @item map3
  9048. The index of the input plane to be used as the fourth output plane.
  9049. @end table
  9050. The first plane has the index 0. The default is to keep the input unchanged.
  9051. Swap the second and third planes of the input:
  9052. @example
  9053. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9054. @end example
  9055. @anchor{signalstats}
  9056. @section signalstats
  9057. Evaluate various visual metrics that assist in determining issues associated
  9058. with the digitization of analog video media.
  9059. By default the filter will log these metadata values:
  9060. @table @option
  9061. @item YMIN
  9062. Display the minimal Y value contained within the input frame. Expressed in
  9063. range of [0-255].
  9064. @item YLOW
  9065. Display the Y value at the 10% percentile within the input frame. Expressed in
  9066. range of [0-255].
  9067. @item YAVG
  9068. Display the average Y value within the input frame. Expressed in range of
  9069. [0-255].
  9070. @item YHIGH
  9071. Display the Y value at the 90% percentile within the input frame. Expressed in
  9072. range of [0-255].
  9073. @item YMAX
  9074. Display the maximum Y value contained within the input frame. Expressed in
  9075. range of [0-255].
  9076. @item UMIN
  9077. Display the minimal U value contained within the input frame. Expressed in
  9078. range of [0-255].
  9079. @item ULOW
  9080. Display the U value at the 10% percentile within the input frame. Expressed in
  9081. range of [0-255].
  9082. @item UAVG
  9083. Display the average U value within the input frame. Expressed in range of
  9084. [0-255].
  9085. @item UHIGH
  9086. Display the U value at the 90% percentile within the input frame. Expressed in
  9087. range of [0-255].
  9088. @item UMAX
  9089. Display the maximum U value contained within the input frame. Expressed in
  9090. range of [0-255].
  9091. @item VMIN
  9092. Display the minimal V value contained within the input frame. Expressed in
  9093. range of [0-255].
  9094. @item VLOW
  9095. Display the V value at the 10% percentile within the input frame. Expressed in
  9096. range of [0-255].
  9097. @item VAVG
  9098. Display the average V value within the input frame. Expressed in range of
  9099. [0-255].
  9100. @item VHIGH
  9101. Display the V value at the 90% percentile within the input frame. Expressed in
  9102. range of [0-255].
  9103. @item VMAX
  9104. Display the maximum V value contained within the input frame. Expressed in
  9105. range of [0-255].
  9106. @item SATMIN
  9107. Display the minimal saturation value contained within the input frame.
  9108. Expressed in range of [0-~181.02].
  9109. @item SATLOW
  9110. Display the saturation value at the 10% percentile within the input frame.
  9111. Expressed in range of [0-~181.02].
  9112. @item SATAVG
  9113. Display the average saturation value within the input frame. Expressed in range
  9114. of [0-~181.02].
  9115. @item SATHIGH
  9116. Display the saturation value at the 90% percentile within the input frame.
  9117. Expressed in range of [0-~181.02].
  9118. @item SATMAX
  9119. Display the maximum saturation value contained within the input frame.
  9120. Expressed in range of [0-~181.02].
  9121. @item HUEMED
  9122. Display the median value for hue within the input frame. Expressed in range of
  9123. [0-360].
  9124. @item HUEAVG
  9125. Display the average value for hue within the input frame. Expressed in range of
  9126. [0-360].
  9127. @item YDIF
  9128. Display the average of sample value difference between all values of the Y
  9129. plane in the current frame and corresponding values of the previous input frame.
  9130. Expressed in range of [0-255].
  9131. @item UDIF
  9132. Display the average of sample value difference between all values of the U
  9133. plane in the current frame and corresponding values of the previous input frame.
  9134. Expressed in range of [0-255].
  9135. @item VDIF
  9136. Display the average of sample value difference between all values of the V
  9137. plane in the current frame and corresponding values of the previous input frame.
  9138. Expressed in range of [0-255].
  9139. @end table
  9140. The filter accepts the following options:
  9141. @table @option
  9142. @item stat
  9143. @item out
  9144. @option{stat} specify an additional form of image analysis.
  9145. @option{out} output video with the specified type of pixel highlighted.
  9146. Both options accept the following values:
  9147. @table @samp
  9148. @item tout
  9149. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9150. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9151. include the results of video dropouts, head clogs, or tape tracking issues.
  9152. @item vrep
  9153. Identify @var{vertical line repetition}. Vertical line repetition includes
  9154. similar rows of pixels within a frame. In born-digital video vertical line
  9155. repetition is common, but this pattern is uncommon in video digitized from an
  9156. analog source. When it occurs in video that results from the digitization of an
  9157. analog source it can indicate concealment from a dropout compensator.
  9158. @item brng
  9159. Identify pixels that fall outside of legal broadcast range.
  9160. @end table
  9161. @item color, c
  9162. Set the highlight color for the @option{out} option. The default color is
  9163. yellow.
  9164. @end table
  9165. @subsection Examples
  9166. @itemize
  9167. @item
  9168. Output data of various video metrics:
  9169. @example
  9170. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9171. @end example
  9172. @item
  9173. Output specific data about the minimum and maximum values of the Y plane per frame:
  9174. @example
  9175. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9176. @end example
  9177. @item
  9178. Playback video while highlighting pixels that are outside of broadcast range in red.
  9179. @example
  9180. ffplay example.mov -vf signalstats="out=brng:color=red"
  9181. @end example
  9182. @item
  9183. Playback video with signalstats metadata drawn over the frame.
  9184. @example
  9185. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9186. @end example
  9187. The contents of signalstat_drawtext.txt used in the command are:
  9188. @example
  9189. time %@{pts:hms@}
  9190. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9191. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9192. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9193. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9194. @end example
  9195. @end itemize
  9196. @anchor{smartblur}
  9197. @section smartblur
  9198. Blur the input video without impacting the outlines.
  9199. It accepts the following options:
  9200. @table @option
  9201. @item luma_radius, lr
  9202. Set the luma radius. The option value must be a float number in
  9203. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9204. used to blur the image (slower if larger). Default value is 1.0.
  9205. @item luma_strength, ls
  9206. Set the luma strength. The option value must be a float number
  9207. in the range [-1.0,1.0] that configures the blurring. A value included
  9208. in [0.0,1.0] will blur the image whereas a value included in
  9209. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9210. @item luma_threshold, lt
  9211. Set the luma threshold used as a coefficient to determine
  9212. whether a pixel should be blurred or not. The option value must be an
  9213. integer in the range [-30,30]. A value of 0 will filter all the image,
  9214. a value included in [0,30] will filter flat areas and a value included
  9215. in [-30,0] will filter edges. Default value is 0.
  9216. @item chroma_radius, cr
  9217. Set the chroma radius. The option value must be a float number in
  9218. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9219. used to blur the image (slower if larger). Default value is 1.0.
  9220. @item chroma_strength, cs
  9221. Set the chroma strength. The option value must be a float number
  9222. in the range [-1.0,1.0] that configures the blurring. A value included
  9223. in [0.0,1.0] will blur the image whereas a value included in
  9224. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9225. @item chroma_threshold, ct
  9226. Set the chroma threshold used as a coefficient to determine
  9227. whether a pixel should be blurred or not. The option value must be an
  9228. integer in the range [-30,30]. A value of 0 will filter all the image,
  9229. a value included in [0,30] will filter flat areas and a value included
  9230. in [-30,0] will filter edges. Default value is 0.
  9231. @end table
  9232. If a chroma option is not explicitly set, the corresponding luma value
  9233. is set.
  9234. @section ssim
  9235. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9236. This filter takes in input two input videos, the first input is
  9237. considered the "main" source and is passed unchanged to the
  9238. output. The second input is used as a "reference" video for computing
  9239. the SSIM.
  9240. Both video inputs must have the same resolution and pixel format for
  9241. this filter to work correctly. Also it assumes that both inputs
  9242. have the same number of frames, which are compared one by one.
  9243. The filter stores the calculated SSIM of each frame.
  9244. The description of the accepted parameters follows.
  9245. @table @option
  9246. @item stats_file, f
  9247. If specified the filter will use the named file to save the SSIM of
  9248. each individual frame. When filename equals "-" the data is sent to
  9249. standard output.
  9250. @end table
  9251. The file printed if @var{stats_file} is selected, contains a sequence of
  9252. key/value pairs of the form @var{key}:@var{value} for each compared
  9253. couple of frames.
  9254. A description of each shown parameter follows:
  9255. @table @option
  9256. @item n
  9257. sequential number of the input frame, starting from 1
  9258. @item Y, U, V, R, G, B
  9259. SSIM of the compared frames for the component specified by the suffix.
  9260. @item All
  9261. SSIM of the compared frames for the whole frame.
  9262. @item dB
  9263. Same as above but in dB representation.
  9264. @end table
  9265. For example:
  9266. @example
  9267. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9268. [main][ref] ssim="stats_file=stats.log" [out]
  9269. @end example
  9270. On this example the input file being processed is compared with the
  9271. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9272. is stored in @file{stats.log}.
  9273. Another example with both psnr and ssim at same time:
  9274. @example
  9275. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9276. @end example
  9277. @section stereo3d
  9278. Convert between different stereoscopic image formats.
  9279. The filters accept the following options:
  9280. @table @option
  9281. @item in
  9282. Set stereoscopic image format of input.
  9283. Available values for input image formats are:
  9284. @table @samp
  9285. @item sbsl
  9286. side by side parallel (left eye left, right eye right)
  9287. @item sbsr
  9288. side by side crosseye (right eye left, left eye right)
  9289. @item sbs2l
  9290. side by side parallel with half width resolution
  9291. (left eye left, right eye right)
  9292. @item sbs2r
  9293. side by side crosseye with half width resolution
  9294. (right eye left, left eye right)
  9295. @item abl
  9296. above-below (left eye above, right eye below)
  9297. @item abr
  9298. above-below (right eye above, left eye below)
  9299. @item ab2l
  9300. above-below with half height resolution
  9301. (left eye above, right eye below)
  9302. @item ab2r
  9303. above-below with half height resolution
  9304. (right eye above, left eye below)
  9305. @item al
  9306. alternating frames (left eye first, right eye second)
  9307. @item ar
  9308. alternating frames (right eye first, left eye second)
  9309. @item irl
  9310. interleaved rows (left eye has top row, right eye starts on next row)
  9311. @item irr
  9312. interleaved rows (right eye has top row, left eye starts on next row)
  9313. @item icl
  9314. interleaved columns, left eye first
  9315. @item icr
  9316. interleaved columns, right eye first
  9317. Default value is @samp{sbsl}.
  9318. @end table
  9319. @item out
  9320. Set stereoscopic image format of output.
  9321. @table @samp
  9322. @item sbsl
  9323. side by side parallel (left eye left, right eye right)
  9324. @item sbsr
  9325. side by side crosseye (right eye left, left eye right)
  9326. @item sbs2l
  9327. side by side parallel with half width resolution
  9328. (left eye left, right eye right)
  9329. @item sbs2r
  9330. side by side crosseye with half width resolution
  9331. (right eye left, left eye right)
  9332. @item abl
  9333. above-below (left eye above, right eye below)
  9334. @item abr
  9335. above-below (right eye above, left eye below)
  9336. @item ab2l
  9337. above-below with half height resolution
  9338. (left eye above, right eye below)
  9339. @item ab2r
  9340. above-below with half height resolution
  9341. (right eye above, left eye below)
  9342. @item al
  9343. alternating frames (left eye first, right eye second)
  9344. @item ar
  9345. alternating frames (right eye first, left eye second)
  9346. @item irl
  9347. interleaved rows (left eye has top row, right eye starts on next row)
  9348. @item irr
  9349. interleaved rows (right eye has top row, left eye starts on next row)
  9350. @item arbg
  9351. anaglyph red/blue gray
  9352. (red filter on left eye, blue filter on right eye)
  9353. @item argg
  9354. anaglyph red/green gray
  9355. (red filter on left eye, green filter on right eye)
  9356. @item arcg
  9357. anaglyph red/cyan gray
  9358. (red filter on left eye, cyan filter on right eye)
  9359. @item arch
  9360. anaglyph red/cyan half colored
  9361. (red filter on left eye, cyan filter on right eye)
  9362. @item arcc
  9363. anaglyph red/cyan color
  9364. (red filter on left eye, cyan filter on right eye)
  9365. @item arcd
  9366. anaglyph red/cyan color optimized with the least squares projection of dubois
  9367. (red filter on left eye, cyan filter on right eye)
  9368. @item agmg
  9369. anaglyph green/magenta gray
  9370. (green filter on left eye, magenta filter on right eye)
  9371. @item agmh
  9372. anaglyph green/magenta half colored
  9373. (green filter on left eye, magenta filter on right eye)
  9374. @item agmc
  9375. anaglyph green/magenta colored
  9376. (green filter on left eye, magenta filter on right eye)
  9377. @item agmd
  9378. anaglyph green/magenta color optimized with the least squares projection of dubois
  9379. (green filter on left eye, magenta filter on right eye)
  9380. @item aybg
  9381. anaglyph yellow/blue gray
  9382. (yellow filter on left eye, blue filter on right eye)
  9383. @item aybh
  9384. anaglyph yellow/blue half colored
  9385. (yellow filter on left eye, blue filter on right eye)
  9386. @item aybc
  9387. anaglyph yellow/blue colored
  9388. (yellow filter on left eye, blue filter on right eye)
  9389. @item aybd
  9390. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9391. (yellow filter on left eye, blue filter on right eye)
  9392. @item ml
  9393. mono output (left eye only)
  9394. @item mr
  9395. mono output (right eye only)
  9396. @item chl
  9397. checkerboard, left eye first
  9398. @item chr
  9399. checkerboard, right eye first
  9400. @item icl
  9401. interleaved columns, left eye first
  9402. @item icr
  9403. interleaved columns, right eye first
  9404. @end table
  9405. Default value is @samp{arcd}.
  9406. @end table
  9407. @subsection Examples
  9408. @itemize
  9409. @item
  9410. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9411. @example
  9412. stereo3d=sbsl:aybd
  9413. @end example
  9414. @item
  9415. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9416. @example
  9417. stereo3d=abl:sbsr
  9418. @end example
  9419. @end itemize
  9420. @section streamselect, astreamselect
  9421. Select video or audio streams.
  9422. The filter accepts the following options:
  9423. @table @option
  9424. @item inputs
  9425. Set number of inputs. Default is 2.
  9426. @item map
  9427. Set input indexes to remap to outputs.
  9428. @end table
  9429. @subsection Commands
  9430. The @code{streamselect} and @code{astreamselect} filter supports the following
  9431. commands:
  9432. @table @option
  9433. @item map
  9434. Set input indexes to remap to outputs.
  9435. @end table
  9436. @subsection Examples
  9437. @itemize
  9438. @item
  9439. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9440. @example
  9441. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9442. @end example
  9443. @item
  9444. Same as above, but for audio:
  9445. @example
  9446. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9447. @end example
  9448. @end itemize
  9449. @anchor{spp}
  9450. @section spp
  9451. Apply a simple postprocessing filter that compresses and decompresses the image
  9452. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9453. and average the results.
  9454. The filter accepts the following options:
  9455. @table @option
  9456. @item quality
  9457. Set quality. This option defines the number of levels for averaging. It accepts
  9458. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9459. effect. A value of @code{6} means the higher quality. For each increment of
  9460. that value the speed drops by a factor of approximately 2. Default value is
  9461. @code{3}.
  9462. @item qp
  9463. Force a constant quantization parameter. If not set, the filter will use the QP
  9464. from the video stream (if available).
  9465. @item mode
  9466. Set thresholding mode. Available modes are:
  9467. @table @samp
  9468. @item hard
  9469. Set hard thresholding (default).
  9470. @item soft
  9471. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9472. @end table
  9473. @item use_bframe_qp
  9474. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9475. option may cause flicker since the B-Frames have often larger QP. Default is
  9476. @code{0} (not enabled).
  9477. @end table
  9478. @anchor{subtitles}
  9479. @section subtitles
  9480. Draw subtitles on top of input video using the libass library.
  9481. To enable compilation of this filter you need to configure FFmpeg with
  9482. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9483. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9484. Alpha) subtitles format.
  9485. The filter accepts the following options:
  9486. @table @option
  9487. @item filename, f
  9488. Set the filename of the subtitle file to read. It must be specified.
  9489. @item original_size
  9490. Specify the size of the original video, the video for which the ASS file
  9491. was composed. For the syntax of this option, check the
  9492. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9493. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9494. correctly scale the fonts if the aspect ratio has been changed.
  9495. @item fontsdir
  9496. Set a directory path containing fonts that can be used by the filter.
  9497. These fonts will be used in addition to whatever the font provider uses.
  9498. @item charenc
  9499. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9500. useful if not UTF-8.
  9501. @item stream_index, si
  9502. Set subtitles stream index. @code{subtitles} filter only.
  9503. @item force_style
  9504. Override default style or script info parameters of the subtitles. It accepts a
  9505. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9506. @end table
  9507. If the first key is not specified, it is assumed that the first value
  9508. specifies the @option{filename}.
  9509. For example, to render the file @file{sub.srt} on top of the input
  9510. video, use the command:
  9511. @example
  9512. subtitles=sub.srt
  9513. @end example
  9514. which is equivalent to:
  9515. @example
  9516. subtitles=filename=sub.srt
  9517. @end example
  9518. To render the default subtitles stream from file @file{video.mkv}, use:
  9519. @example
  9520. subtitles=video.mkv
  9521. @end example
  9522. To render the second subtitles stream from that file, use:
  9523. @example
  9524. subtitles=video.mkv:si=1
  9525. @end example
  9526. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9527. @code{DejaVu Serif}, use:
  9528. @example
  9529. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9530. @end example
  9531. @section super2xsai
  9532. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9533. Interpolate) pixel art scaling algorithm.
  9534. Useful for enlarging pixel art images without reducing sharpness.
  9535. @section swaprect
  9536. Swap two rectangular objects in video.
  9537. This filter accepts the following options:
  9538. @table @option
  9539. @item w
  9540. Set object width.
  9541. @item h
  9542. Set object height.
  9543. @item x1
  9544. Set 1st rect x coordinate.
  9545. @item y1
  9546. Set 1st rect y coordinate.
  9547. @item x2
  9548. Set 2nd rect x coordinate.
  9549. @item y2
  9550. Set 2nd rect y coordinate.
  9551. All expressions are evaluated once for each frame.
  9552. @end table
  9553. The all options are expressions containing the following constants:
  9554. @table @option
  9555. @item w
  9556. @item h
  9557. The input width and height.
  9558. @item a
  9559. same as @var{w} / @var{h}
  9560. @item sar
  9561. input sample aspect ratio
  9562. @item dar
  9563. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9564. @item n
  9565. The number of the input frame, starting from 0.
  9566. @item t
  9567. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9568. @item pos
  9569. the position in the file of the input frame, NAN if unknown
  9570. @end table
  9571. @section swapuv
  9572. Swap U & V plane.
  9573. @section telecine
  9574. Apply telecine process to the video.
  9575. This filter accepts the following options:
  9576. @table @option
  9577. @item first_field
  9578. @table @samp
  9579. @item top, t
  9580. top field first
  9581. @item bottom, b
  9582. bottom field first
  9583. The default value is @code{top}.
  9584. @end table
  9585. @item pattern
  9586. A string of numbers representing the pulldown pattern you wish to apply.
  9587. The default value is @code{23}.
  9588. @end table
  9589. @example
  9590. Some typical patterns:
  9591. NTSC output (30i):
  9592. 27.5p: 32222
  9593. 24p: 23 (classic)
  9594. 24p: 2332 (preferred)
  9595. 20p: 33
  9596. 18p: 334
  9597. 16p: 3444
  9598. PAL output (25i):
  9599. 27.5p: 12222
  9600. 24p: 222222222223 ("Euro pulldown")
  9601. 16.67p: 33
  9602. 16p: 33333334
  9603. @end example
  9604. @section thumbnail
  9605. Select the most representative frame in a given sequence of consecutive frames.
  9606. The filter accepts the following options:
  9607. @table @option
  9608. @item n
  9609. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  9610. will pick one of them, and then handle the next batch of @var{n} frames until
  9611. the end. Default is @code{100}.
  9612. @end table
  9613. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  9614. value will result in a higher memory usage, so a high value is not recommended.
  9615. @subsection Examples
  9616. @itemize
  9617. @item
  9618. Extract one picture each 50 frames:
  9619. @example
  9620. thumbnail=50
  9621. @end example
  9622. @item
  9623. Complete example of a thumbnail creation with @command{ffmpeg}:
  9624. @example
  9625. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  9626. @end example
  9627. @end itemize
  9628. @section tile
  9629. Tile several successive frames together.
  9630. The filter accepts the following options:
  9631. @table @option
  9632. @item layout
  9633. Set the grid size (i.e. the number of lines and columns). For the syntax of
  9634. this option, check the
  9635. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9636. @item nb_frames
  9637. Set the maximum number of frames to render in the given area. It must be less
  9638. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  9639. the area will be used.
  9640. @item margin
  9641. Set the outer border margin in pixels.
  9642. @item padding
  9643. Set the inner border thickness (i.e. the number of pixels between frames). For
  9644. more advanced padding options (such as having different values for the edges),
  9645. refer to the pad video filter.
  9646. @item color
  9647. Specify the color of the unused area. For the syntax of this option, check the
  9648. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  9649. is "black".
  9650. @end table
  9651. @subsection Examples
  9652. @itemize
  9653. @item
  9654. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  9655. @example
  9656. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  9657. @end example
  9658. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  9659. duplicating each output frame to accommodate the originally detected frame
  9660. rate.
  9661. @item
  9662. Display @code{5} pictures in an area of @code{3x2} frames,
  9663. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  9664. mixed flat and named options:
  9665. @example
  9666. tile=3x2:nb_frames=5:padding=7:margin=2
  9667. @end example
  9668. @end itemize
  9669. @section tinterlace
  9670. Perform various types of temporal field interlacing.
  9671. Frames are counted starting from 1, so the first input frame is
  9672. considered odd.
  9673. The filter accepts the following options:
  9674. @table @option
  9675. @item mode
  9676. Specify the mode of the interlacing. This option can also be specified
  9677. as a value alone. See below for a list of values for this option.
  9678. Available values are:
  9679. @table @samp
  9680. @item merge, 0
  9681. Move odd frames into the upper field, even into the lower field,
  9682. generating a double height frame at half frame rate.
  9683. @example
  9684. ------> time
  9685. Input:
  9686. Frame 1 Frame 2 Frame 3 Frame 4
  9687. 11111 22222 33333 44444
  9688. 11111 22222 33333 44444
  9689. 11111 22222 33333 44444
  9690. 11111 22222 33333 44444
  9691. Output:
  9692. 11111 33333
  9693. 22222 44444
  9694. 11111 33333
  9695. 22222 44444
  9696. 11111 33333
  9697. 22222 44444
  9698. 11111 33333
  9699. 22222 44444
  9700. @end example
  9701. @item drop_even, 1
  9702. Only output odd frames, even frames are dropped, generating a frame with
  9703. unchanged height at half frame rate.
  9704. @example
  9705. ------> time
  9706. Input:
  9707. Frame 1 Frame 2 Frame 3 Frame 4
  9708. 11111 22222 33333 44444
  9709. 11111 22222 33333 44444
  9710. 11111 22222 33333 44444
  9711. 11111 22222 33333 44444
  9712. Output:
  9713. 11111 33333
  9714. 11111 33333
  9715. 11111 33333
  9716. 11111 33333
  9717. @end example
  9718. @item drop_odd, 2
  9719. Only output even frames, odd frames are dropped, generating a frame with
  9720. unchanged height at half frame rate.
  9721. @example
  9722. ------> time
  9723. Input:
  9724. Frame 1 Frame 2 Frame 3 Frame 4
  9725. 11111 22222 33333 44444
  9726. 11111 22222 33333 44444
  9727. 11111 22222 33333 44444
  9728. 11111 22222 33333 44444
  9729. Output:
  9730. 22222 44444
  9731. 22222 44444
  9732. 22222 44444
  9733. 22222 44444
  9734. @end example
  9735. @item pad, 3
  9736. Expand each frame to full height, but pad alternate lines with black,
  9737. generating a frame with double height at the same input frame rate.
  9738. @example
  9739. ------> time
  9740. Input:
  9741. Frame 1 Frame 2 Frame 3 Frame 4
  9742. 11111 22222 33333 44444
  9743. 11111 22222 33333 44444
  9744. 11111 22222 33333 44444
  9745. 11111 22222 33333 44444
  9746. Output:
  9747. 11111 ..... 33333 .....
  9748. ..... 22222 ..... 44444
  9749. 11111 ..... 33333 .....
  9750. ..... 22222 ..... 44444
  9751. 11111 ..... 33333 .....
  9752. ..... 22222 ..... 44444
  9753. 11111 ..... 33333 .....
  9754. ..... 22222 ..... 44444
  9755. @end example
  9756. @item interleave_top, 4
  9757. Interleave the upper field from odd frames with the lower field from
  9758. even frames, generating a frame with unchanged height at half frame rate.
  9759. @example
  9760. ------> time
  9761. Input:
  9762. Frame 1 Frame 2 Frame 3 Frame 4
  9763. 11111<- 22222 33333<- 44444
  9764. 11111 22222<- 33333 44444<-
  9765. 11111<- 22222 33333<- 44444
  9766. 11111 22222<- 33333 44444<-
  9767. Output:
  9768. 11111 33333
  9769. 22222 44444
  9770. 11111 33333
  9771. 22222 44444
  9772. @end example
  9773. @item interleave_bottom, 5
  9774. Interleave the lower field from odd frames with the upper field from
  9775. even frames, generating a frame with unchanged height at half frame rate.
  9776. @example
  9777. ------> time
  9778. Input:
  9779. Frame 1 Frame 2 Frame 3 Frame 4
  9780. 11111 22222<- 33333 44444<-
  9781. 11111<- 22222 33333<- 44444
  9782. 11111 22222<- 33333 44444<-
  9783. 11111<- 22222 33333<- 44444
  9784. Output:
  9785. 22222 44444
  9786. 11111 33333
  9787. 22222 44444
  9788. 11111 33333
  9789. @end example
  9790. @item interlacex2, 6
  9791. Double frame rate with unchanged height. Frames are inserted each
  9792. containing the second temporal field from the previous input frame and
  9793. the first temporal field from the next input frame. This mode relies on
  9794. the top_field_first flag. Useful for interlaced video displays with no
  9795. field synchronisation.
  9796. @example
  9797. ------> time
  9798. Input:
  9799. Frame 1 Frame 2 Frame 3 Frame 4
  9800. 11111 22222 33333 44444
  9801. 11111 22222 33333 44444
  9802. 11111 22222 33333 44444
  9803. 11111 22222 33333 44444
  9804. Output:
  9805. 11111 22222 22222 33333 33333 44444 44444
  9806. 11111 11111 22222 22222 33333 33333 44444
  9807. 11111 22222 22222 33333 33333 44444 44444
  9808. 11111 11111 22222 22222 33333 33333 44444
  9809. @end example
  9810. @item mergex2, 7
  9811. Move odd frames into the upper field, even into the lower field,
  9812. generating a double height frame at same frame rate.
  9813. @example
  9814. ------> time
  9815. Input:
  9816. Frame 1 Frame 2 Frame 3 Frame 4
  9817. 11111 22222 33333 44444
  9818. 11111 22222 33333 44444
  9819. 11111 22222 33333 44444
  9820. 11111 22222 33333 44444
  9821. Output:
  9822. 11111 33333 33333 55555
  9823. 22222 22222 44444 44444
  9824. 11111 33333 33333 55555
  9825. 22222 22222 44444 44444
  9826. 11111 33333 33333 55555
  9827. 22222 22222 44444 44444
  9828. 11111 33333 33333 55555
  9829. 22222 22222 44444 44444
  9830. @end example
  9831. @end table
  9832. Numeric values are deprecated but are accepted for backward
  9833. compatibility reasons.
  9834. Default mode is @code{merge}.
  9835. @item flags
  9836. Specify flags influencing the filter process.
  9837. Available value for @var{flags} is:
  9838. @table @option
  9839. @item low_pass_filter, vlfp
  9840. Enable vertical low-pass filtering in the filter.
  9841. Vertical low-pass filtering is required when creating an interlaced
  9842. destination from a progressive source which contains high-frequency
  9843. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  9844. patterning.
  9845. Vertical low-pass filtering can only be enabled for @option{mode}
  9846. @var{interleave_top} and @var{interleave_bottom}.
  9847. @end table
  9848. @end table
  9849. @section transpose
  9850. Transpose rows with columns in the input video and optionally flip it.
  9851. It accepts the following parameters:
  9852. @table @option
  9853. @item dir
  9854. Specify the transposition direction.
  9855. Can assume the following values:
  9856. @table @samp
  9857. @item 0, 4, cclock_flip
  9858. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  9859. @example
  9860. L.R L.l
  9861. . . -> . .
  9862. l.r R.r
  9863. @end example
  9864. @item 1, 5, clock
  9865. Rotate by 90 degrees clockwise, that is:
  9866. @example
  9867. L.R l.L
  9868. . . -> . .
  9869. l.r r.R
  9870. @end example
  9871. @item 2, 6, cclock
  9872. Rotate by 90 degrees counterclockwise, that is:
  9873. @example
  9874. L.R R.r
  9875. . . -> . .
  9876. l.r L.l
  9877. @end example
  9878. @item 3, 7, clock_flip
  9879. Rotate by 90 degrees clockwise and vertically flip, that is:
  9880. @example
  9881. L.R r.R
  9882. . . -> . .
  9883. l.r l.L
  9884. @end example
  9885. @end table
  9886. For values between 4-7, the transposition is only done if the input
  9887. video geometry is portrait and not landscape. These values are
  9888. deprecated, the @code{passthrough} option should be used instead.
  9889. Numerical values are deprecated, and should be dropped in favor of
  9890. symbolic constants.
  9891. @item passthrough
  9892. Do not apply the transposition if the input geometry matches the one
  9893. specified by the specified value. It accepts the following values:
  9894. @table @samp
  9895. @item none
  9896. Always apply transposition.
  9897. @item portrait
  9898. Preserve portrait geometry (when @var{height} >= @var{width}).
  9899. @item landscape
  9900. Preserve landscape geometry (when @var{width} >= @var{height}).
  9901. @end table
  9902. Default value is @code{none}.
  9903. @end table
  9904. For example to rotate by 90 degrees clockwise and preserve portrait
  9905. layout:
  9906. @example
  9907. transpose=dir=1:passthrough=portrait
  9908. @end example
  9909. The command above can also be specified as:
  9910. @example
  9911. transpose=1:portrait
  9912. @end example
  9913. @section trim
  9914. Trim the input so that the output contains one continuous subpart of the input.
  9915. It accepts the following parameters:
  9916. @table @option
  9917. @item start
  9918. Specify the time of the start of the kept section, i.e. the frame with the
  9919. timestamp @var{start} will be the first frame in the output.
  9920. @item end
  9921. Specify the time of the first frame that will be dropped, i.e. the frame
  9922. immediately preceding the one with the timestamp @var{end} will be the last
  9923. frame in the output.
  9924. @item start_pts
  9925. This is the same as @var{start}, except this option sets the start timestamp
  9926. in timebase units instead of seconds.
  9927. @item end_pts
  9928. This is the same as @var{end}, except this option sets the end timestamp
  9929. in timebase units instead of seconds.
  9930. @item duration
  9931. The maximum duration of the output in seconds.
  9932. @item start_frame
  9933. The number of the first frame that should be passed to the output.
  9934. @item end_frame
  9935. The number of the first frame that should be dropped.
  9936. @end table
  9937. @option{start}, @option{end}, and @option{duration} are expressed as time
  9938. duration specifications; see
  9939. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9940. for the accepted syntax.
  9941. Note that the first two sets of the start/end options and the @option{duration}
  9942. option look at the frame timestamp, while the _frame variants simply count the
  9943. frames that pass through the filter. Also note that this filter does not modify
  9944. the timestamps. If you wish for the output timestamps to start at zero, insert a
  9945. setpts filter after the trim filter.
  9946. If multiple start or end options are set, this filter tries to be greedy and
  9947. keep all the frames that match at least one of the specified constraints. To keep
  9948. only the part that matches all the constraints at once, chain multiple trim
  9949. filters.
  9950. The defaults are such that all the input is kept. So it is possible to set e.g.
  9951. just the end values to keep everything before the specified time.
  9952. Examples:
  9953. @itemize
  9954. @item
  9955. Drop everything except the second minute of input:
  9956. @example
  9957. ffmpeg -i INPUT -vf trim=60:120
  9958. @end example
  9959. @item
  9960. Keep only the first second:
  9961. @example
  9962. ffmpeg -i INPUT -vf trim=duration=1
  9963. @end example
  9964. @end itemize
  9965. @anchor{unsharp}
  9966. @section unsharp
  9967. Sharpen or blur the input video.
  9968. It accepts the following parameters:
  9969. @table @option
  9970. @item luma_msize_x, lx
  9971. Set the luma matrix horizontal size. It must be an odd integer between
  9972. 3 and 63. The default value is 5.
  9973. @item luma_msize_y, ly
  9974. Set the luma matrix vertical size. It must be an odd integer between 3
  9975. and 63. The default value is 5.
  9976. @item luma_amount, la
  9977. Set the luma effect strength. It must be a floating point number, reasonable
  9978. values lay between -1.5 and 1.5.
  9979. Negative values will blur the input video, while positive values will
  9980. sharpen it, a value of zero will disable the effect.
  9981. Default value is 1.0.
  9982. @item chroma_msize_x, cx
  9983. Set the chroma matrix horizontal size. It must be an odd integer
  9984. between 3 and 63. The default value is 5.
  9985. @item chroma_msize_y, cy
  9986. Set the chroma matrix vertical size. It must be an odd integer
  9987. between 3 and 63. The default value is 5.
  9988. @item chroma_amount, ca
  9989. Set the chroma effect strength. It must be a floating point number, reasonable
  9990. values lay between -1.5 and 1.5.
  9991. Negative values will blur the input video, while positive values will
  9992. sharpen it, a value of zero will disable the effect.
  9993. Default value is 0.0.
  9994. @item opencl
  9995. If set to 1, specify using OpenCL capabilities, only available if
  9996. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  9997. @end table
  9998. All parameters are optional and default to the equivalent of the
  9999. string '5:5:1.0:5:5:0.0'.
  10000. @subsection Examples
  10001. @itemize
  10002. @item
  10003. Apply strong luma sharpen effect:
  10004. @example
  10005. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10006. @end example
  10007. @item
  10008. Apply a strong blur of both luma and chroma parameters:
  10009. @example
  10010. unsharp=7:7:-2:7:7:-2
  10011. @end example
  10012. @end itemize
  10013. @section uspp
  10014. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10015. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10016. shifts and average the results.
  10017. The way this differs from the behavior of spp is that uspp actually encodes &
  10018. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10019. DCT similar to MJPEG.
  10020. The filter accepts the following options:
  10021. @table @option
  10022. @item quality
  10023. Set quality. This option defines the number of levels for averaging. It accepts
  10024. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10025. effect. A value of @code{8} means the higher quality. For each increment of
  10026. that value the speed drops by a factor of approximately 2. Default value is
  10027. @code{3}.
  10028. @item qp
  10029. Force a constant quantization parameter. If not set, the filter will use the QP
  10030. from the video stream (if available).
  10031. @end table
  10032. @section vectorscope
  10033. Display 2 color component values in the two dimensional graph (which is called
  10034. a vectorscope).
  10035. This filter accepts the following options:
  10036. @table @option
  10037. @item mode, m
  10038. Set vectorscope mode.
  10039. It accepts the following values:
  10040. @table @samp
  10041. @item gray
  10042. Gray values are displayed on graph, higher brightness means more pixels have
  10043. same component color value on location in graph. This is the default mode.
  10044. @item color
  10045. Gray values are displayed on graph. Surrounding pixels values which are not
  10046. present in video frame are drawn in gradient of 2 color components which are
  10047. set by option @code{x} and @code{y}. The 3rd color component is static.
  10048. @item color2
  10049. Actual color components values present in video frame are displayed on graph.
  10050. @item color3
  10051. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10052. on graph increases value of another color component, which is luminance by
  10053. default values of @code{x} and @code{y}.
  10054. @item color4
  10055. Actual colors present in video frame are displayed on graph. If two different
  10056. colors map to same position on graph then color with higher value of component
  10057. not present in graph is picked.
  10058. @item color5
  10059. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10060. component picked from radial gradient.
  10061. @end table
  10062. @item x
  10063. Set which color component will be represented on X-axis. Default is @code{1}.
  10064. @item y
  10065. Set which color component will be represented on Y-axis. Default is @code{2}.
  10066. @item intensity, i
  10067. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10068. of color component which represents frequency of (X, Y) location in graph.
  10069. @item envelope, e
  10070. @table @samp
  10071. @item none
  10072. No envelope, this is default.
  10073. @item instant
  10074. Instant envelope, even darkest single pixel will be clearly highlighted.
  10075. @item peak
  10076. Hold maximum and minimum values presented in graph over time. This way you
  10077. can still spot out of range values without constantly looking at vectorscope.
  10078. @item peak+instant
  10079. Peak and instant envelope combined together.
  10080. @end table
  10081. @item graticule, g
  10082. Set what kind of graticule to draw.
  10083. @table @samp
  10084. @item none
  10085. @item green
  10086. @item color
  10087. @end table
  10088. @item opacity, o
  10089. Set graticule opacity.
  10090. @item flags, f
  10091. Set graticule flags.
  10092. @table @samp
  10093. @item white
  10094. Draw graticule for white point.
  10095. @item black
  10096. Draw graticule for black point.
  10097. @item name
  10098. Draw color points short names.
  10099. @end table
  10100. @item bgopacity, b
  10101. Set background opacity.
  10102. @item lthreshold, l
  10103. Set low threshold for color component not represented on X or Y axis.
  10104. Values lower than this value will be ignored. Default is 0.
  10105. Note this value is multiplied with actual max possible value one pixel component
  10106. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10107. is 0.1 * 255 = 25.
  10108. @item hthreshold, h
  10109. Set high threshold for color component not represented on X or Y axis.
  10110. Values higher than this value will be ignored. Default is 1.
  10111. Note this value is multiplied with actual max possible value one pixel component
  10112. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10113. is 0.9 * 255 = 230.
  10114. @item colorspace, c
  10115. Set what kind of colorspace to use when drawing graticule.
  10116. @table @samp
  10117. @item auto
  10118. @item 601
  10119. @item 709
  10120. @end table
  10121. Default is auto.
  10122. @end table
  10123. @anchor{vidstabdetect}
  10124. @section vidstabdetect
  10125. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10126. @ref{vidstabtransform} for pass 2.
  10127. This filter generates a file with relative translation and rotation
  10128. transform information about subsequent frames, which is then used by
  10129. the @ref{vidstabtransform} filter.
  10130. To enable compilation of this filter you need to configure FFmpeg with
  10131. @code{--enable-libvidstab}.
  10132. This filter accepts the following options:
  10133. @table @option
  10134. @item result
  10135. Set the path to the file used to write the transforms information.
  10136. Default value is @file{transforms.trf}.
  10137. @item shakiness
  10138. Set how shaky the video is and how quick the camera is. It accepts an
  10139. integer in the range 1-10, a value of 1 means little shakiness, a
  10140. value of 10 means strong shakiness. Default value is 5.
  10141. @item accuracy
  10142. Set the accuracy of the detection process. It must be a value in the
  10143. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10144. accuracy. Default value is 15.
  10145. @item stepsize
  10146. Set stepsize of the search process. The region around minimum is
  10147. scanned with 1 pixel resolution. Default value is 6.
  10148. @item mincontrast
  10149. Set minimum contrast. Below this value a local measurement field is
  10150. discarded. Must be a floating point value in the range 0-1. Default
  10151. value is 0.3.
  10152. @item tripod
  10153. Set reference frame number for tripod mode.
  10154. If enabled, the motion of the frames is compared to a reference frame
  10155. in the filtered stream, identified by the specified number. The idea
  10156. is to compensate all movements in a more-or-less static scene and keep
  10157. the camera view absolutely still.
  10158. If set to 0, it is disabled. The frames are counted starting from 1.
  10159. @item show
  10160. Show fields and transforms in the resulting frames. It accepts an
  10161. integer in the range 0-2. Default value is 0, which disables any
  10162. visualization.
  10163. @end table
  10164. @subsection Examples
  10165. @itemize
  10166. @item
  10167. Use default values:
  10168. @example
  10169. vidstabdetect
  10170. @end example
  10171. @item
  10172. Analyze strongly shaky movie and put the results in file
  10173. @file{mytransforms.trf}:
  10174. @example
  10175. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10176. @end example
  10177. @item
  10178. Visualize the result of internal transformations in the resulting
  10179. video:
  10180. @example
  10181. vidstabdetect=show=1
  10182. @end example
  10183. @item
  10184. Analyze a video with medium shakiness using @command{ffmpeg}:
  10185. @example
  10186. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10187. @end example
  10188. @end itemize
  10189. @anchor{vidstabtransform}
  10190. @section vidstabtransform
  10191. Video stabilization/deshaking: pass 2 of 2,
  10192. see @ref{vidstabdetect} for pass 1.
  10193. Read a file with transform information for each frame and
  10194. apply/compensate them. Together with the @ref{vidstabdetect}
  10195. filter this can be used to deshake videos. See also
  10196. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10197. the @ref{unsharp} filter, see below.
  10198. To enable compilation of this filter you need to configure FFmpeg with
  10199. @code{--enable-libvidstab}.
  10200. @subsection Options
  10201. @table @option
  10202. @item input
  10203. Set path to the file used to read the transforms. Default value is
  10204. @file{transforms.trf}.
  10205. @item smoothing
  10206. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10207. camera movements. Default value is 10.
  10208. For example a number of 10 means that 21 frames are used (10 in the
  10209. past and 10 in the future) to smoothen the motion in the video. A
  10210. larger value leads to a smoother video, but limits the acceleration of
  10211. the camera (pan/tilt movements). 0 is a special case where a static
  10212. camera is simulated.
  10213. @item optalgo
  10214. Set the camera path optimization algorithm.
  10215. Accepted values are:
  10216. @table @samp
  10217. @item gauss
  10218. gaussian kernel low-pass filter on camera motion (default)
  10219. @item avg
  10220. averaging on transformations
  10221. @end table
  10222. @item maxshift
  10223. Set maximal number of pixels to translate frames. Default value is -1,
  10224. meaning no limit.
  10225. @item maxangle
  10226. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10227. value is -1, meaning no limit.
  10228. @item crop
  10229. Specify how to deal with borders that may be visible due to movement
  10230. compensation.
  10231. Available values are:
  10232. @table @samp
  10233. @item keep
  10234. keep image information from previous frame (default)
  10235. @item black
  10236. fill the border black
  10237. @end table
  10238. @item invert
  10239. Invert transforms if set to 1. Default value is 0.
  10240. @item relative
  10241. Consider transforms as relative to previous frame if set to 1,
  10242. absolute if set to 0. Default value is 0.
  10243. @item zoom
  10244. Set percentage to zoom. A positive value will result in a zoom-in
  10245. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10246. zoom).
  10247. @item optzoom
  10248. Set optimal zooming to avoid borders.
  10249. Accepted values are:
  10250. @table @samp
  10251. @item 0
  10252. disabled
  10253. @item 1
  10254. optimal static zoom value is determined (only very strong movements
  10255. will lead to visible borders) (default)
  10256. @item 2
  10257. optimal adaptive zoom value is determined (no borders will be
  10258. visible), see @option{zoomspeed}
  10259. @end table
  10260. Note that the value given at zoom is added to the one calculated here.
  10261. @item zoomspeed
  10262. Set percent to zoom maximally each frame (enabled when
  10263. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10264. 0.25.
  10265. @item interpol
  10266. Specify type of interpolation.
  10267. Available values are:
  10268. @table @samp
  10269. @item no
  10270. no interpolation
  10271. @item linear
  10272. linear only horizontal
  10273. @item bilinear
  10274. linear in both directions (default)
  10275. @item bicubic
  10276. cubic in both directions (slow)
  10277. @end table
  10278. @item tripod
  10279. Enable virtual tripod mode if set to 1, which is equivalent to
  10280. @code{relative=0:smoothing=0}. Default value is 0.
  10281. Use also @code{tripod} option of @ref{vidstabdetect}.
  10282. @item debug
  10283. Increase log verbosity if set to 1. Also the detected global motions
  10284. are written to the temporary file @file{global_motions.trf}. Default
  10285. value is 0.
  10286. @end table
  10287. @subsection Examples
  10288. @itemize
  10289. @item
  10290. Use @command{ffmpeg} for a typical stabilization with default values:
  10291. @example
  10292. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10293. @end example
  10294. Note the use of the @ref{unsharp} filter which is always recommended.
  10295. @item
  10296. Zoom in a bit more and load transform data from a given file:
  10297. @example
  10298. vidstabtransform=zoom=5:input="mytransforms.trf"
  10299. @end example
  10300. @item
  10301. Smoothen the video even more:
  10302. @example
  10303. vidstabtransform=smoothing=30
  10304. @end example
  10305. @end itemize
  10306. @section vflip
  10307. Flip the input video vertically.
  10308. For example, to vertically flip a video with @command{ffmpeg}:
  10309. @example
  10310. ffmpeg -i in.avi -vf "vflip" out.avi
  10311. @end example
  10312. @anchor{vignette}
  10313. @section vignette
  10314. Make or reverse a natural vignetting effect.
  10315. The filter accepts the following options:
  10316. @table @option
  10317. @item angle, a
  10318. Set lens angle expression as a number of radians.
  10319. The value is clipped in the @code{[0,PI/2]} range.
  10320. Default value: @code{"PI/5"}
  10321. @item x0
  10322. @item y0
  10323. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10324. by default.
  10325. @item mode
  10326. Set forward/backward mode.
  10327. Available modes are:
  10328. @table @samp
  10329. @item forward
  10330. The larger the distance from the central point, the darker the image becomes.
  10331. @item backward
  10332. The larger the distance from the central point, the brighter the image becomes.
  10333. This can be used to reverse a vignette effect, though there is no automatic
  10334. detection to extract the lens @option{angle} and other settings (yet). It can
  10335. also be used to create a burning effect.
  10336. @end table
  10337. Default value is @samp{forward}.
  10338. @item eval
  10339. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10340. It accepts the following values:
  10341. @table @samp
  10342. @item init
  10343. Evaluate expressions only once during the filter initialization.
  10344. @item frame
  10345. Evaluate expressions for each incoming frame. This is way slower than the
  10346. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10347. allows advanced dynamic expressions.
  10348. @end table
  10349. Default value is @samp{init}.
  10350. @item dither
  10351. Set dithering to reduce the circular banding effects. Default is @code{1}
  10352. (enabled).
  10353. @item aspect
  10354. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10355. Setting this value to the SAR of the input will make a rectangular vignetting
  10356. following the dimensions of the video.
  10357. Default is @code{1/1}.
  10358. @end table
  10359. @subsection Expressions
  10360. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10361. following parameters.
  10362. @table @option
  10363. @item w
  10364. @item h
  10365. input width and height
  10366. @item n
  10367. the number of input frame, starting from 0
  10368. @item pts
  10369. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10370. @var{TB} units, NAN if undefined
  10371. @item r
  10372. frame rate of the input video, NAN if the input frame rate is unknown
  10373. @item t
  10374. the PTS (Presentation TimeStamp) of the filtered video frame,
  10375. expressed in seconds, NAN if undefined
  10376. @item tb
  10377. time base of the input video
  10378. @end table
  10379. @subsection Examples
  10380. @itemize
  10381. @item
  10382. Apply simple strong vignetting effect:
  10383. @example
  10384. vignette=PI/4
  10385. @end example
  10386. @item
  10387. Make a flickering vignetting:
  10388. @example
  10389. vignette='PI/4+random(1)*PI/50':eval=frame
  10390. @end example
  10391. @end itemize
  10392. @section vstack
  10393. Stack input videos vertically.
  10394. All streams must be of same pixel format and of same width.
  10395. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10396. to create same output.
  10397. The filter accept the following option:
  10398. @table @option
  10399. @item inputs
  10400. Set number of input streams. Default is 2.
  10401. @item shortest
  10402. If set to 1, force the output to terminate when the shortest input
  10403. terminates. Default value is 0.
  10404. @end table
  10405. @section w3fdif
  10406. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  10407. Deinterlacing Filter").
  10408. Based on the process described by Martin Weston for BBC R&D, and
  10409. implemented based on the de-interlace algorithm written by Jim
  10410. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  10411. uses filter coefficients calculated by BBC R&D.
  10412. There are two sets of filter coefficients, so called "simple":
  10413. and "complex". Which set of filter coefficients is used can
  10414. be set by passing an optional parameter:
  10415. @table @option
  10416. @item filter
  10417. Set the interlacing filter coefficients. Accepts one of the following values:
  10418. @table @samp
  10419. @item simple
  10420. Simple filter coefficient set.
  10421. @item complex
  10422. More-complex filter coefficient set.
  10423. @end table
  10424. Default value is @samp{complex}.
  10425. @item deint
  10426. Specify which frames to deinterlace. Accept one of the following values:
  10427. @table @samp
  10428. @item all
  10429. Deinterlace all frames,
  10430. @item interlaced
  10431. Only deinterlace frames marked as interlaced.
  10432. @end table
  10433. Default value is @samp{all}.
  10434. @end table
  10435. @section waveform
  10436. Video waveform monitor.
  10437. The waveform monitor plots color component intensity. By default luminance
  10438. only. Each column of the waveform corresponds to a column of pixels in the
  10439. source video.
  10440. It accepts the following options:
  10441. @table @option
  10442. @item mode, m
  10443. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10444. In row mode, the graph on the left side represents color component value 0 and
  10445. the right side represents value = 255. In column mode, the top side represents
  10446. color component value = 0 and bottom side represents value = 255.
  10447. @item intensity, i
  10448. Set intensity. Smaller values are useful to find out how many values of the same
  10449. luminance are distributed across input rows/columns.
  10450. Default value is @code{0.04}. Allowed range is [0, 1].
  10451. @item mirror, r
  10452. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10453. In mirrored mode, higher values will be represented on the left
  10454. side for @code{row} mode and at the top for @code{column} mode. Default is
  10455. @code{1} (mirrored).
  10456. @item display, d
  10457. Set display mode.
  10458. It accepts the following values:
  10459. @table @samp
  10460. @item overlay
  10461. Presents information identical to that in the @code{parade}, except
  10462. that the graphs representing color components are superimposed directly
  10463. over one another.
  10464. This display mode makes it easier to spot relative differences or similarities
  10465. in overlapping areas of the color components that are supposed to be identical,
  10466. such as neutral whites, grays, or blacks.
  10467. @item stack
  10468. Display separate graph for the color components side by side in
  10469. @code{row} mode or one below the other in @code{column} mode.
  10470. @item parade
  10471. Display separate graph for the color components side by side in
  10472. @code{column} mode or one below the other in @code{row} mode.
  10473. Using this display mode makes it easy to spot color casts in the highlights
  10474. and shadows of an image, by comparing the contours of the top and the bottom
  10475. graphs of each waveform. Since whites, grays, and blacks are characterized
  10476. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10477. should display three waveforms of roughly equal width/height. If not, the
  10478. correction is easy to perform by making level adjustments the three waveforms.
  10479. @end table
  10480. Default is @code{stack}.
  10481. @item components, c
  10482. Set which color components to display. Default is 1, which means only luminance
  10483. or red color component if input is in RGB colorspace. If is set for example to
  10484. 7 it will display all 3 (if) available color components.
  10485. @item envelope, e
  10486. @table @samp
  10487. @item none
  10488. No envelope, this is default.
  10489. @item instant
  10490. Instant envelope, minimum and maximum values presented in graph will be easily
  10491. visible even with small @code{step} value.
  10492. @item peak
  10493. Hold minimum and maximum values presented in graph across time. This way you
  10494. can still spot out of range values without constantly looking at waveforms.
  10495. @item peak+instant
  10496. Peak and instant envelope combined together.
  10497. @end table
  10498. @item filter, f
  10499. @table @samp
  10500. @item lowpass
  10501. No filtering, this is default.
  10502. @item flat
  10503. Luma and chroma combined together.
  10504. @item aflat
  10505. Similar as above, but shows difference between blue and red chroma.
  10506. @item chroma
  10507. Displays only chroma.
  10508. @item color
  10509. Displays actual color value on waveform.
  10510. @item acolor
  10511. Similar as above, but with luma showing frequency of chroma values.
  10512. @end table
  10513. @item graticule, g
  10514. Set which graticule to display.
  10515. @table @samp
  10516. @item none
  10517. Do not display graticule.
  10518. @item green
  10519. Display green graticule showing legal broadcast ranges.
  10520. @end table
  10521. @item opacity, o
  10522. Set graticule opacity.
  10523. @item flags, fl
  10524. Set graticule flags.
  10525. @table @samp
  10526. @item numbers
  10527. Draw numbers above lines. By default enabled.
  10528. @item dots
  10529. Draw dots instead of lines.
  10530. @end table
  10531. @item scale, s
  10532. Set scale used for displaying graticule.
  10533. @table @samp
  10534. @item digital
  10535. @item millivolts
  10536. @item ire
  10537. @end table
  10538. Default is digital.
  10539. @end table
  10540. @section xbr
  10541. Apply the xBR high-quality magnification filter which is designed for pixel
  10542. art. It follows a set of edge-detection rules, see
  10543. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  10544. It accepts the following option:
  10545. @table @option
  10546. @item n
  10547. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  10548. @code{3xBR} and @code{4} for @code{4xBR}.
  10549. Default is @code{3}.
  10550. @end table
  10551. @anchor{yadif}
  10552. @section yadif
  10553. Deinterlace the input video ("yadif" means "yet another deinterlacing
  10554. filter").
  10555. It accepts the following parameters:
  10556. @table @option
  10557. @item mode
  10558. The interlacing mode to adopt. It accepts one of the following values:
  10559. @table @option
  10560. @item 0, send_frame
  10561. Output one frame for each frame.
  10562. @item 1, send_field
  10563. Output one frame for each field.
  10564. @item 2, send_frame_nospatial
  10565. Like @code{send_frame}, but it skips the spatial interlacing check.
  10566. @item 3, send_field_nospatial
  10567. Like @code{send_field}, but it skips the spatial interlacing check.
  10568. @end table
  10569. The default value is @code{send_frame}.
  10570. @item parity
  10571. The picture field parity assumed for the input interlaced video. It accepts one
  10572. of the following values:
  10573. @table @option
  10574. @item 0, tff
  10575. Assume the top field is first.
  10576. @item 1, bff
  10577. Assume the bottom field is first.
  10578. @item -1, auto
  10579. Enable automatic detection of field parity.
  10580. @end table
  10581. The default value is @code{auto}.
  10582. If the interlacing is unknown or the decoder does not export this information,
  10583. top field first will be assumed.
  10584. @item deint
  10585. Specify which frames to deinterlace. Accept one of the following
  10586. values:
  10587. @table @option
  10588. @item 0, all
  10589. Deinterlace all frames.
  10590. @item 1, interlaced
  10591. Only deinterlace frames marked as interlaced.
  10592. @end table
  10593. The default value is @code{all}.
  10594. @end table
  10595. @section zoompan
  10596. Apply Zoom & Pan effect.
  10597. This filter accepts the following options:
  10598. @table @option
  10599. @item zoom, z
  10600. Set the zoom expression. Default is 1.
  10601. @item x
  10602. @item y
  10603. Set the x and y expression. Default is 0.
  10604. @item d
  10605. Set the duration expression in number of frames.
  10606. This sets for how many number of frames effect will last for
  10607. single input image.
  10608. @item s
  10609. Set the output image size, default is 'hd720'.
  10610. @item fps
  10611. Set the output frame rate, default is '25'.
  10612. @end table
  10613. Each expression can contain the following constants:
  10614. @table @option
  10615. @item in_w, iw
  10616. Input width.
  10617. @item in_h, ih
  10618. Input height.
  10619. @item out_w, ow
  10620. Output width.
  10621. @item out_h, oh
  10622. Output height.
  10623. @item in
  10624. Input frame count.
  10625. @item on
  10626. Output frame count.
  10627. @item x
  10628. @item y
  10629. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  10630. for current input frame.
  10631. @item px
  10632. @item py
  10633. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  10634. not yet such frame (first input frame).
  10635. @item zoom
  10636. Last calculated zoom from 'z' expression for current input frame.
  10637. @item pzoom
  10638. Last calculated zoom of last output frame of previous input frame.
  10639. @item duration
  10640. Number of output frames for current input frame. Calculated from 'd' expression
  10641. for each input frame.
  10642. @item pduration
  10643. number of output frames created for previous input frame
  10644. @item a
  10645. Rational number: input width / input height
  10646. @item sar
  10647. sample aspect ratio
  10648. @item dar
  10649. display aspect ratio
  10650. @end table
  10651. @subsection Examples
  10652. @itemize
  10653. @item
  10654. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  10655. @example
  10656. 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
  10657. @end example
  10658. @item
  10659. Zoom-in up to 1.5 and pan always at center of picture:
  10660. @example
  10661. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10662. @end example
  10663. @end itemize
  10664. @section zscale
  10665. Scale (resize) the input video, using the z.lib library:
  10666. https://github.com/sekrit-twc/zimg.
  10667. The zscale filter forces the output display aspect ratio to be the same
  10668. as the input, by changing the output sample aspect ratio.
  10669. If the input image format is different from the format requested by
  10670. the next filter, the zscale filter will convert the input to the
  10671. requested format.
  10672. @subsection Options
  10673. The filter accepts the following options.
  10674. @table @option
  10675. @item width, w
  10676. @item height, h
  10677. Set the output video dimension expression. Default value is the input
  10678. dimension.
  10679. If the @var{width} or @var{w} is 0, the input width is used for the output.
  10680. If the @var{height} or @var{h} is 0, the input height is used for the output.
  10681. If one of the values is -1, the zscale filter will use a value that
  10682. maintains the aspect ratio of the input image, calculated from the
  10683. other specified dimension. If both of them are -1, the input size is
  10684. used
  10685. If one of the values is -n with n > 1, the zscale filter will also use a value
  10686. that maintains the aspect ratio of the input image, calculated from the other
  10687. specified dimension. After that it will, however, make sure that the calculated
  10688. dimension is divisible by n and adjust the value if necessary.
  10689. See below for the list of accepted constants for use in the dimension
  10690. expression.
  10691. @item size, s
  10692. Set the video size. For the syntax of this option, check the
  10693. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10694. @item dither, d
  10695. Set the dither type.
  10696. Possible values are:
  10697. @table @var
  10698. @item none
  10699. @item ordered
  10700. @item random
  10701. @item error_diffusion
  10702. @end table
  10703. Default is none.
  10704. @item filter, f
  10705. Set the resize filter type.
  10706. Possible values are:
  10707. @table @var
  10708. @item point
  10709. @item bilinear
  10710. @item bicubic
  10711. @item spline16
  10712. @item spline36
  10713. @item lanczos
  10714. @end table
  10715. Default is bilinear.
  10716. @item range, r
  10717. Set the color range.
  10718. Possible values are:
  10719. @table @var
  10720. @item input
  10721. @item limited
  10722. @item full
  10723. @end table
  10724. Default is same as input.
  10725. @item primaries, p
  10726. Set the color primaries.
  10727. Possible values are:
  10728. @table @var
  10729. @item input
  10730. @item 709
  10731. @item unspecified
  10732. @item 170m
  10733. @item 240m
  10734. @item 2020
  10735. @end table
  10736. Default is same as input.
  10737. @item transfer, t
  10738. Set the transfer characteristics.
  10739. Possible values are:
  10740. @table @var
  10741. @item input
  10742. @item 709
  10743. @item unspecified
  10744. @item 601
  10745. @item linear
  10746. @item 2020_10
  10747. @item 2020_12
  10748. @end table
  10749. Default is same as input.
  10750. @item matrix, m
  10751. Set the colorspace matrix.
  10752. Possible value are:
  10753. @table @var
  10754. @item input
  10755. @item 709
  10756. @item unspecified
  10757. @item 470bg
  10758. @item 170m
  10759. @item 2020_ncl
  10760. @item 2020_cl
  10761. @end table
  10762. Default is same as input.
  10763. @item rangein, rin
  10764. Set the input color range.
  10765. Possible values are:
  10766. @table @var
  10767. @item input
  10768. @item limited
  10769. @item full
  10770. @end table
  10771. Default is same as input.
  10772. @item primariesin, pin
  10773. Set the input color primaries.
  10774. Possible values are:
  10775. @table @var
  10776. @item input
  10777. @item 709
  10778. @item unspecified
  10779. @item 170m
  10780. @item 240m
  10781. @item 2020
  10782. @end table
  10783. Default is same as input.
  10784. @item transferin, tin
  10785. Set the input transfer characteristics.
  10786. Possible values are:
  10787. @table @var
  10788. @item input
  10789. @item 709
  10790. @item unspecified
  10791. @item 601
  10792. @item linear
  10793. @item 2020_10
  10794. @item 2020_12
  10795. @end table
  10796. Default is same as input.
  10797. @item matrixin, min
  10798. Set the input colorspace matrix.
  10799. Possible value are:
  10800. @table @var
  10801. @item input
  10802. @item 709
  10803. @item unspecified
  10804. @item 470bg
  10805. @item 170m
  10806. @item 2020_ncl
  10807. @item 2020_cl
  10808. @end table
  10809. @end table
  10810. The values of the @option{w} and @option{h} options are expressions
  10811. containing the following constants:
  10812. @table @var
  10813. @item in_w
  10814. @item in_h
  10815. The input width and height
  10816. @item iw
  10817. @item ih
  10818. These are the same as @var{in_w} and @var{in_h}.
  10819. @item out_w
  10820. @item out_h
  10821. The output (scaled) width and height
  10822. @item ow
  10823. @item oh
  10824. These are the same as @var{out_w} and @var{out_h}
  10825. @item a
  10826. The same as @var{iw} / @var{ih}
  10827. @item sar
  10828. input sample aspect ratio
  10829. @item dar
  10830. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10831. @item hsub
  10832. @item vsub
  10833. horizontal and vertical input chroma subsample values. For example for the
  10834. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10835. @item ohsub
  10836. @item ovsub
  10837. horizontal and vertical output chroma subsample values. For example for the
  10838. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10839. @end table
  10840. @table @option
  10841. @end table
  10842. @c man end VIDEO FILTERS
  10843. @chapter Video Sources
  10844. @c man begin VIDEO SOURCES
  10845. Below is a description of the currently available video sources.
  10846. @section buffer
  10847. Buffer video frames, and make them available to the filter chain.
  10848. This source is mainly intended for a programmatic use, in particular
  10849. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  10850. It accepts the following parameters:
  10851. @table @option
  10852. @item video_size
  10853. Specify the size (width and height) of the buffered video frames. For the
  10854. syntax of this option, check the
  10855. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10856. @item width
  10857. The input video width.
  10858. @item height
  10859. The input video height.
  10860. @item pix_fmt
  10861. A string representing the pixel format of the buffered video frames.
  10862. It may be a number corresponding to a pixel format, or a pixel format
  10863. name.
  10864. @item time_base
  10865. Specify the timebase assumed by the timestamps of the buffered frames.
  10866. @item frame_rate
  10867. Specify the frame rate expected for the video stream.
  10868. @item pixel_aspect, sar
  10869. The sample (pixel) aspect ratio of the input video.
  10870. @item sws_param
  10871. Specify the optional parameters to be used for the scale filter which
  10872. is automatically inserted when an input change is detected in the
  10873. input size or format.
  10874. @item hw_frames_ctx
  10875. When using a hardware pixel format, this should be a reference to an
  10876. AVHWFramesContext describing input frames.
  10877. @end table
  10878. For example:
  10879. @example
  10880. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  10881. @end example
  10882. will instruct the source to accept video frames with size 320x240 and
  10883. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  10884. square pixels (1:1 sample aspect ratio).
  10885. Since the pixel format with name "yuv410p" corresponds to the number 6
  10886. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  10887. this example corresponds to:
  10888. @example
  10889. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  10890. @end example
  10891. Alternatively, the options can be specified as a flat string, but this
  10892. syntax is deprecated:
  10893. @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}]
  10894. @section cellauto
  10895. Create a pattern generated by an elementary cellular automaton.
  10896. The initial state of the cellular automaton can be defined through the
  10897. @option{filename}, and @option{pattern} options. If such options are
  10898. not specified an initial state is created randomly.
  10899. At each new frame a new row in the video is filled with the result of
  10900. the cellular automaton next generation. The behavior when the whole
  10901. frame is filled is defined by the @option{scroll} option.
  10902. This source accepts the following options:
  10903. @table @option
  10904. @item filename, f
  10905. Read the initial cellular automaton state, i.e. the starting row, from
  10906. the specified file.
  10907. In the file, each non-whitespace character is considered an alive
  10908. cell, a newline will terminate the row, and further characters in the
  10909. file will be ignored.
  10910. @item pattern, p
  10911. Read the initial cellular automaton state, i.e. the starting row, from
  10912. the specified string.
  10913. Each non-whitespace character in the string is considered an alive
  10914. cell, a newline will terminate the row, and further characters in the
  10915. string will be ignored.
  10916. @item rate, r
  10917. Set the video rate, that is the number of frames generated per second.
  10918. Default is 25.
  10919. @item random_fill_ratio, ratio
  10920. Set the random fill ratio for the initial cellular automaton row. It
  10921. is a floating point number value ranging from 0 to 1, defaults to
  10922. 1/PHI.
  10923. This option is ignored when a file or a pattern is specified.
  10924. @item random_seed, seed
  10925. Set the seed for filling randomly the initial row, must be an integer
  10926. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10927. set to -1, the filter will try to use a good random seed on a best
  10928. effort basis.
  10929. @item rule
  10930. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  10931. Default value is 110.
  10932. @item size, s
  10933. Set the size of the output video. For the syntax of this option, check the
  10934. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10935. If @option{filename} or @option{pattern} is specified, the size is set
  10936. by default to the width of the specified initial state row, and the
  10937. height is set to @var{width} * PHI.
  10938. If @option{size} is set, it must contain the width of the specified
  10939. pattern string, and the specified pattern will be centered in the
  10940. larger row.
  10941. If a filename or a pattern string is not specified, the size value
  10942. defaults to "320x518" (used for a randomly generated initial state).
  10943. @item scroll
  10944. If set to 1, scroll the output upward when all the rows in the output
  10945. have been already filled. If set to 0, the new generated row will be
  10946. written over the top row just after the bottom row is filled.
  10947. Defaults to 1.
  10948. @item start_full, full
  10949. If set to 1, completely fill the output with generated rows before
  10950. outputting the first frame.
  10951. This is the default behavior, for disabling set the value to 0.
  10952. @item stitch
  10953. If set to 1, stitch the left and right row edges together.
  10954. This is the default behavior, for disabling set the value to 0.
  10955. @end table
  10956. @subsection Examples
  10957. @itemize
  10958. @item
  10959. Read the initial state from @file{pattern}, and specify an output of
  10960. size 200x400.
  10961. @example
  10962. cellauto=f=pattern:s=200x400
  10963. @end example
  10964. @item
  10965. Generate a random initial row with a width of 200 cells, with a fill
  10966. ratio of 2/3:
  10967. @example
  10968. cellauto=ratio=2/3:s=200x200
  10969. @end example
  10970. @item
  10971. Create a pattern generated by rule 18 starting by a single alive cell
  10972. centered on an initial row with width 100:
  10973. @example
  10974. cellauto=p=@@:s=100x400:full=0:rule=18
  10975. @end example
  10976. @item
  10977. Specify a more elaborated initial pattern:
  10978. @example
  10979. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  10980. @end example
  10981. @end itemize
  10982. @anchor{coreimagesrc}
  10983. @section coreimagesrc
  10984. Video source generated on GPU using Apple's CoreImage API on OSX.
  10985. This video source is a specialized version of the @ref{coreimage} video filter.
  10986. Use a core image generator at the beginning of the applied filterchain to
  10987. generate the content.
  10988. The coreimagesrc video source accepts the following options:
  10989. @table @option
  10990. @item list_generators
  10991. List all available generators along with all their respective options as well as
  10992. possible minimum and maximum values along with the default values.
  10993. @example
  10994. list_generators=true
  10995. @end example
  10996. @item size, s
  10997. Specify the size of the sourced video. For the syntax of this option, check the
  10998. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10999. The default value is @code{320x240}.
  11000. @item rate, r
  11001. Specify the frame rate of the sourced video, as the number of frames
  11002. generated per second. It has to be a string in the format
  11003. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11004. number or a valid video frame rate abbreviation. The default value is
  11005. "25".
  11006. @item sar
  11007. Set the sample aspect ratio of the sourced video.
  11008. @item duration, d
  11009. Set the duration of the sourced video. See
  11010. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11011. for the accepted syntax.
  11012. If not specified, or the expressed duration is negative, the video is
  11013. supposed to be generated forever.
  11014. @end table
  11015. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11016. A complete filterchain can be used for further processing of the
  11017. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11018. and examples for details.
  11019. @subsection Examples
  11020. @itemize
  11021. @item
  11022. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11023. given as complete and escaped command-line for Apple's standard bash shell:
  11024. @example
  11025. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11026. @end example
  11027. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11028. need for a nullsrc video source.
  11029. @end itemize
  11030. @section mandelbrot
  11031. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11032. point specified with @var{start_x} and @var{start_y}.
  11033. This source accepts the following options:
  11034. @table @option
  11035. @item end_pts
  11036. Set the terminal pts value. Default value is 400.
  11037. @item end_scale
  11038. Set the terminal scale value.
  11039. Must be a floating point value. Default value is 0.3.
  11040. @item inner
  11041. Set the inner coloring mode, that is the algorithm used to draw the
  11042. Mandelbrot fractal internal region.
  11043. It shall assume one of the following values:
  11044. @table @option
  11045. @item black
  11046. Set black mode.
  11047. @item convergence
  11048. Show time until convergence.
  11049. @item mincol
  11050. Set color based on point closest to the origin of the iterations.
  11051. @item period
  11052. Set period mode.
  11053. @end table
  11054. Default value is @var{mincol}.
  11055. @item bailout
  11056. Set the bailout value. Default value is 10.0.
  11057. @item maxiter
  11058. Set the maximum of iterations performed by the rendering
  11059. algorithm. Default value is 7189.
  11060. @item outer
  11061. Set outer coloring mode.
  11062. It shall assume one of following values:
  11063. @table @option
  11064. @item iteration_count
  11065. Set iteration cound mode.
  11066. @item normalized_iteration_count
  11067. set normalized iteration count mode.
  11068. @end table
  11069. Default value is @var{normalized_iteration_count}.
  11070. @item rate, r
  11071. Set frame rate, expressed as number of frames per second. Default
  11072. value is "25".
  11073. @item size, s
  11074. Set frame size. For the syntax of this option, check the "Video
  11075. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11076. @item start_scale
  11077. Set the initial scale value. Default value is 3.0.
  11078. @item start_x
  11079. Set the initial x position. Must be a floating point value between
  11080. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11081. @item start_y
  11082. Set the initial y position. Must be a floating point value between
  11083. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11084. @end table
  11085. @section mptestsrc
  11086. Generate various test patterns, as generated by the MPlayer test filter.
  11087. The size of the generated video is fixed, and is 256x256.
  11088. This source is useful in particular for testing encoding features.
  11089. This source accepts the following options:
  11090. @table @option
  11091. @item rate, r
  11092. Specify the frame rate of the sourced video, as the number of frames
  11093. generated per second. It has to be a string in the format
  11094. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11095. number or a valid video frame rate abbreviation. The default value is
  11096. "25".
  11097. @item duration, d
  11098. Set the duration of the sourced video. See
  11099. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11100. for the accepted syntax.
  11101. If not specified, or the expressed duration is negative, the video is
  11102. supposed to be generated forever.
  11103. @item test, t
  11104. Set the number or the name of the test to perform. Supported tests are:
  11105. @table @option
  11106. @item dc_luma
  11107. @item dc_chroma
  11108. @item freq_luma
  11109. @item freq_chroma
  11110. @item amp_luma
  11111. @item amp_chroma
  11112. @item cbp
  11113. @item mv
  11114. @item ring1
  11115. @item ring2
  11116. @item all
  11117. @end table
  11118. Default value is "all", which will cycle through the list of all tests.
  11119. @end table
  11120. Some examples:
  11121. @example
  11122. mptestsrc=t=dc_luma
  11123. @end example
  11124. will generate a "dc_luma" test pattern.
  11125. @section frei0r_src
  11126. Provide a frei0r source.
  11127. To enable compilation of this filter you need to install the frei0r
  11128. header and configure FFmpeg with @code{--enable-frei0r}.
  11129. This source accepts the following parameters:
  11130. @table @option
  11131. @item size
  11132. The size of the video to generate. For the syntax of this option, check the
  11133. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11134. @item framerate
  11135. The framerate of the generated video. It may be a string of the form
  11136. @var{num}/@var{den} or a frame rate abbreviation.
  11137. @item filter_name
  11138. The name to the frei0r source to load. For more information regarding frei0r and
  11139. how to set the parameters, read the @ref{frei0r} section in the video filters
  11140. documentation.
  11141. @item filter_params
  11142. A '|'-separated list of parameters to pass to the frei0r source.
  11143. @end table
  11144. For example, to generate a frei0r partik0l source with size 200x200
  11145. and frame rate 10 which is overlaid on the overlay filter main input:
  11146. @example
  11147. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11148. @end example
  11149. @section life
  11150. Generate a life pattern.
  11151. This source is based on a generalization of John Conway's life game.
  11152. The sourced input represents a life grid, each pixel represents a cell
  11153. which can be in one of two possible states, alive or dead. Every cell
  11154. interacts with its eight neighbours, which are the cells that are
  11155. horizontally, vertically, or diagonally adjacent.
  11156. At each interaction the grid evolves according to the adopted rule,
  11157. which specifies the number of neighbor alive cells which will make a
  11158. cell stay alive or born. The @option{rule} option allows one to specify
  11159. the rule to adopt.
  11160. This source accepts the following options:
  11161. @table @option
  11162. @item filename, f
  11163. Set the file from which to read the initial grid state. In the file,
  11164. each non-whitespace character is considered an alive cell, and newline
  11165. is used to delimit the end of each row.
  11166. If this option is not specified, the initial grid is generated
  11167. randomly.
  11168. @item rate, r
  11169. Set the video rate, that is the number of frames generated per second.
  11170. Default is 25.
  11171. @item random_fill_ratio, ratio
  11172. Set the random fill ratio for the initial random grid. It is a
  11173. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11174. It is ignored when a file is specified.
  11175. @item random_seed, seed
  11176. Set the seed for filling the initial random grid, must be an integer
  11177. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11178. set to -1, the filter will try to use a good random seed on a best
  11179. effort basis.
  11180. @item rule
  11181. Set the life rule.
  11182. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11183. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11184. @var{NS} specifies the number of alive neighbor cells which make a
  11185. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11186. which make a dead cell to become alive (i.e. to "born").
  11187. "s" and "b" can be used in place of "S" and "B", respectively.
  11188. Alternatively a rule can be specified by an 18-bits integer. The 9
  11189. high order bits are used to encode the next cell state if it is alive
  11190. for each number of neighbor alive cells, the low order bits specify
  11191. the rule for "borning" new cells. Higher order bits encode for an
  11192. higher number of neighbor cells.
  11193. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11194. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11195. Default value is "S23/B3", which is the original Conway's game of life
  11196. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11197. cells, and will born a new cell if there are three alive cells around
  11198. a dead cell.
  11199. @item size, s
  11200. Set the size of the output video. For the syntax of this option, check the
  11201. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11202. If @option{filename} is specified, the size is set by default to the
  11203. same size of the input file. If @option{size} is set, it must contain
  11204. the size specified in the input file, and the initial grid defined in
  11205. that file is centered in the larger resulting area.
  11206. If a filename is not specified, the size value defaults to "320x240"
  11207. (used for a randomly generated initial grid).
  11208. @item stitch
  11209. If set to 1, stitch the left and right grid edges together, and the
  11210. top and bottom edges also. Defaults to 1.
  11211. @item mold
  11212. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11213. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11214. value from 0 to 255.
  11215. @item life_color
  11216. Set the color of living (or new born) cells.
  11217. @item death_color
  11218. Set the color of dead cells. If @option{mold} is set, this is the first color
  11219. used to represent a dead cell.
  11220. @item mold_color
  11221. Set mold color, for definitely dead and moldy cells.
  11222. For the syntax of these 3 color options, check the "Color" section in the
  11223. ffmpeg-utils manual.
  11224. @end table
  11225. @subsection Examples
  11226. @itemize
  11227. @item
  11228. Read a grid from @file{pattern}, and center it on a grid of size
  11229. 300x300 pixels:
  11230. @example
  11231. life=f=pattern:s=300x300
  11232. @end example
  11233. @item
  11234. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11235. @example
  11236. life=ratio=2/3:s=200x200
  11237. @end example
  11238. @item
  11239. Specify a custom rule for evolving a randomly generated grid:
  11240. @example
  11241. life=rule=S14/B34
  11242. @end example
  11243. @item
  11244. Full example with slow death effect (mold) using @command{ffplay}:
  11245. @example
  11246. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11247. @end example
  11248. @end itemize
  11249. @anchor{allrgb}
  11250. @anchor{allyuv}
  11251. @anchor{color}
  11252. @anchor{haldclutsrc}
  11253. @anchor{nullsrc}
  11254. @anchor{rgbtestsrc}
  11255. @anchor{smptebars}
  11256. @anchor{smptehdbars}
  11257. @anchor{testsrc}
  11258. @anchor{testsrc2}
  11259. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2
  11260. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11261. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11262. The @code{color} source provides an uniformly colored input.
  11263. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11264. @ref{haldclut} filter.
  11265. The @code{nullsrc} source returns unprocessed video frames. It is
  11266. mainly useful to be employed in analysis / debugging tools, or as the
  11267. source for filters which ignore the input data.
  11268. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11269. detecting RGB vs BGR issues. You should see a red, green and blue
  11270. stripe from top to bottom.
  11271. The @code{smptebars} source generates a color bars pattern, based on
  11272. the SMPTE Engineering Guideline EG 1-1990.
  11273. The @code{smptehdbars} source generates a color bars pattern, based on
  11274. the SMPTE RP 219-2002.
  11275. The @code{testsrc} source generates a test video pattern, showing a
  11276. color pattern, a scrolling gradient and a timestamp. This is mainly
  11277. intended for testing purposes.
  11278. The @code{testsrc2} source is similar to testsrc, but supports more
  11279. pixel formats instead of just @code{rgb24}. This allows using it as an
  11280. input for other tests without requiring a format conversion.
  11281. The sources accept the following parameters:
  11282. @table @option
  11283. @item color, c
  11284. Specify the color of the source, only available in the @code{color}
  11285. source. For the syntax of this option, check the "Color" section in the
  11286. ffmpeg-utils manual.
  11287. @item level
  11288. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11289. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11290. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11291. coded on a @code{1/(N*N)} scale.
  11292. @item size, s
  11293. Specify the size of the sourced video. For the syntax of this option, check the
  11294. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11295. The default value is @code{320x240}.
  11296. This option is not available with the @code{haldclutsrc} filter.
  11297. @item rate, r
  11298. Specify the frame rate of the sourced video, as the number of frames
  11299. generated per second. It has to be a string in the format
  11300. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11301. number or a valid video frame rate abbreviation. The default value is
  11302. "25".
  11303. @item sar
  11304. Set the sample aspect ratio of the sourced video.
  11305. @item duration, d
  11306. Set the duration of the sourced video. See
  11307. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11308. for the accepted syntax.
  11309. If not specified, or the expressed duration is negative, the video is
  11310. supposed to be generated forever.
  11311. @item decimals, n
  11312. Set the number of decimals to show in the timestamp, only available in the
  11313. @code{testsrc} source.
  11314. The displayed timestamp value will correspond to the original
  11315. timestamp value multiplied by the power of 10 of the specified
  11316. value. Default value is 0.
  11317. @end table
  11318. For example the following:
  11319. @example
  11320. testsrc=duration=5.3:size=qcif:rate=10
  11321. @end example
  11322. will generate a video with a duration of 5.3 seconds, with size
  11323. 176x144 and a frame rate of 10 frames per second.
  11324. The following graph description will generate a red source
  11325. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11326. frames per second.
  11327. @example
  11328. color=c=red@@0.2:s=qcif:r=10
  11329. @end example
  11330. If the input content is to be ignored, @code{nullsrc} can be used. The
  11331. following command generates noise in the luminance plane by employing
  11332. the @code{geq} filter:
  11333. @example
  11334. nullsrc=s=256x256, geq=random(1)*255:128:128
  11335. @end example
  11336. @subsection Commands
  11337. The @code{color} source supports the following commands:
  11338. @table @option
  11339. @item c, color
  11340. Set the color of the created image. Accepts the same syntax of the
  11341. corresponding @option{color} option.
  11342. @end table
  11343. @c man end VIDEO SOURCES
  11344. @chapter Video Sinks
  11345. @c man begin VIDEO SINKS
  11346. Below is a description of the currently available video sinks.
  11347. @section buffersink
  11348. Buffer video frames, and make them available to the end of the filter
  11349. graph.
  11350. This sink is mainly intended for programmatic use, in particular
  11351. through the interface defined in @file{libavfilter/buffersink.h}
  11352. or the options system.
  11353. It accepts a pointer to an AVBufferSinkContext structure, which
  11354. defines the incoming buffers' formats, to be passed as the opaque
  11355. parameter to @code{avfilter_init_filter} for initialization.
  11356. @section nullsink
  11357. Null video sink: do absolutely nothing with the input video. It is
  11358. mainly useful as a template and for use in analysis / debugging
  11359. tools.
  11360. @c man end VIDEO SINKS
  11361. @chapter Multimedia Filters
  11362. @c man begin MULTIMEDIA FILTERS
  11363. Below is a description of the currently available multimedia filters.
  11364. @section ahistogram
  11365. Convert input audio to a video output, displaying the volume histogram.
  11366. The filter accepts the following options:
  11367. @table @option
  11368. @item dmode
  11369. Specify how histogram is calculated.
  11370. It accepts the following values:
  11371. @table @samp
  11372. @item single
  11373. Use single histogram for all channels.
  11374. @item separate
  11375. Use separate histogram for each channel.
  11376. @end table
  11377. Default is @code{single}.
  11378. @item rate, r
  11379. Set frame rate, expressed as number of frames per second. Default
  11380. value is "25".
  11381. @item size, s
  11382. Specify the video size for the output. For the syntax of this option, check the
  11383. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11384. Default value is @code{hd720}.
  11385. @item scale
  11386. Set display scale.
  11387. It accepts the following values:
  11388. @table @samp
  11389. @item log
  11390. logarithmic
  11391. @item sqrt
  11392. square root
  11393. @item cbrt
  11394. cubic root
  11395. @item lin
  11396. linear
  11397. @item rlog
  11398. reverse logarithmic
  11399. @end table
  11400. Default is @code{log}.
  11401. @item ascale
  11402. Set amplitude scale.
  11403. It accepts the following values:
  11404. @table @samp
  11405. @item log
  11406. logarithmic
  11407. @item lin
  11408. linear
  11409. @end table
  11410. Default is @code{log}.
  11411. @item acount
  11412. Set how much frames to accumulate in histogram.
  11413. Defauls is 1. Setting this to -1 accumulates all frames.
  11414. @item rheight
  11415. Set histogram ratio of window height.
  11416. @item slide
  11417. Set sonogram sliding.
  11418. It accepts the following values:
  11419. @table @samp
  11420. @item replace
  11421. replace old rows with new ones.
  11422. @item scroll
  11423. scroll from top to bottom.
  11424. @end table
  11425. Default is @code{replace}.
  11426. @end table
  11427. @section aphasemeter
  11428. Convert input audio to a video output, displaying the audio phase.
  11429. The filter accepts the following options:
  11430. @table @option
  11431. @item rate, r
  11432. Set the output frame rate. Default value is @code{25}.
  11433. @item size, s
  11434. Set the video size for the output. For the syntax of this option, check the
  11435. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11436. Default value is @code{800x400}.
  11437. @item rc
  11438. @item gc
  11439. @item bc
  11440. Specify the red, green, blue contrast. Default values are @code{2},
  11441. @code{7} and @code{1}.
  11442. Allowed range is @code{[0, 255]}.
  11443. @item mpc
  11444. Set color which will be used for drawing median phase. If color is
  11445. @code{none} which is default, no median phase value will be drawn.
  11446. @end table
  11447. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  11448. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  11449. The @code{-1} means left and right channels are completely out of phase and
  11450. @code{1} means channels are in phase.
  11451. @section avectorscope
  11452. Convert input audio to a video output, representing the audio vector
  11453. scope.
  11454. The filter is used to measure the difference between channels of stereo
  11455. audio stream. A monoaural signal, consisting of identical left and right
  11456. signal, results in straight vertical line. Any stereo separation is visible
  11457. as a deviation from this line, creating a Lissajous figure.
  11458. If the straight (or deviation from it) but horizontal line appears this
  11459. indicates that the left and right channels are out of phase.
  11460. The filter accepts the following options:
  11461. @table @option
  11462. @item mode, m
  11463. Set the vectorscope mode.
  11464. Available values are:
  11465. @table @samp
  11466. @item lissajous
  11467. Lissajous rotated by 45 degrees.
  11468. @item lissajous_xy
  11469. Same as above but not rotated.
  11470. @item polar
  11471. Shape resembling half of circle.
  11472. @end table
  11473. Default value is @samp{lissajous}.
  11474. @item size, s
  11475. Set the video size for the output. For the syntax of this option, check the
  11476. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11477. Default value is @code{400x400}.
  11478. @item rate, r
  11479. Set the output frame rate. Default value is @code{25}.
  11480. @item rc
  11481. @item gc
  11482. @item bc
  11483. @item ac
  11484. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  11485. @code{160}, @code{80} and @code{255}.
  11486. Allowed range is @code{[0, 255]}.
  11487. @item rf
  11488. @item gf
  11489. @item bf
  11490. @item af
  11491. Specify the red, green, blue and alpha fade. Default values are @code{15},
  11492. @code{10}, @code{5} and @code{5}.
  11493. Allowed range is @code{[0, 255]}.
  11494. @item zoom
  11495. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  11496. @item draw
  11497. Set the vectorscope drawing mode.
  11498. Available values are:
  11499. @table @samp
  11500. @item dot
  11501. Draw dot for each sample.
  11502. @item line
  11503. Draw line between previous and current sample.
  11504. @end table
  11505. Default value is @samp{dot}.
  11506. @end table
  11507. @subsection Examples
  11508. @itemize
  11509. @item
  11510. Complete example using @command{ffplay}:
  11511. @example
  11512. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11513. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  11514. @end example
  11515. @end itemize
  11516. @section bench, abench
  11517. Benchmark part of a filtergraph.
  11518. The filter accepts the following options:
  11519. @table @option
  11520. @item action
  11521. Start or stop a timer.
  11522. Available values are:
  11523. @table @samp
  11524. @item start
  11525. Get the current time, set it as frame metadata (using the key
  11526. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  11527. @item stop
  11528. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  11529. the input frame metadata to get the time difference. Time difference, average,
  11530. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  11531. @code{min}) are then printed. The timestamps are expressed in seconds.
  11532. @end table
  11533. @end table
  11534. @subsection Examples
  11535. @itemize
  11536. @item
  11537. Benchmark @ref{selectivecolor} filter:
  11538. @example
  11539. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  11540. @end example
  11541. @end itemize
  11542. @section concat
  11543. Concatenate audio and video streams, joining them together one after the
  11544. other.
  11545. The filter works on segments of synchronized video and audio streams. All
  11546. segments must have the same number of streams of each type, and that will
  11547. also be the number of streams at output.
  11548. The filter accepts the following options:
  11549. @table @option
  11550. @item n
  11551. Set the number of segments. Default is 2.
  11552. @item v
  11553. Set the number of output video streams, that is also the number of video
  11554. streams in each segment. Default is 1.
  11555. @item a
  11556. Set the number of output audio streams, that is also the number of audio
  11557. streams in each segment. Default is 0.
  11558. @item unsafe
  11559. Activate unsafe mode: do not fail if segments have a different format.
  11560. @end table
  11561. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  11562. @var{a} audio outputs.
  11563. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  11564. segment, in the same order as the outputs, then the inputs for the second
  11565. segment, etc.
  11566. Related streams do not always have exactly the same duration, for various
  11567. reasons including codec frame size or sloppy authoring. For that reason,
  11568. related synchronized streams (e.g. a video and its audio track) should be
  11569. concatenated at once. The concat filter will use the duration of the longest
  11570. stream in each segment (except the last one), and if necessary pad shorter
  11571. audio streams with silence.
  11572. For this filter to work correctly, all segments must start at timestamp 0.
  11573. All corresponding streams must have the same parameters in all segments; the
  11574. filtering system will automatically select a common pixel format for video
  11575. streams, and a common sample format, sample rate and channel layout for
  11576. audio streams, but other settings, such as resolution, must be converted
  11577. explicitly by the user.
  11578. Different frame rates are acceptable but will result in variable frame rate
  11579. at output; be sure to configure the output file to handle it.
  11580. @subsection Examples
  11581. @itemize
  11582. @item
  11583. Concatenate an opening, an episode and an ending, all in bilingual version
  11584. (video in stream 0, audio in streams 1 and 2):
  11585. @example
  11586. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  11587. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  11588. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  11589. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  11590. @end example
  11591. @item
  11592. Concatenate two parts, handling audio and video separately, using the
  11593. (a)movie sources, and adjusting the resolution:
  11594. @example
  11595. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  11596. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  11597. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  11598. @end example
  11599. Note that a desync will happen at the stitch if the audio and video streams
  11600. do not have exactly the same duration in the first file.
  11601. @end itemize
  11602. @anchor{ebur128}
  11603. @section ebur128
  11604. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  11605. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  11606. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  11607. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  11608. The filter also has a video output (see the @var{video} option) with a real
  11609. time graph to observe the loudness evolution. The graphic contains the logged
  11610. message mentioned above, so it is not printed anymore when this option is set,
  11611. unless the verbose logging is set. The main graphing area contains the
  11612. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  11613. the momentary loudness (400 milliseconds).
  11614. More information about the Loudness Recommendation EBU R128 on
  11615. @url{http://tech.ebu.ch/loudness}.
  11616. The filter accepts the following options:
  11617. @table @option
  11618. @item video
  11619. Activate the video output. The audio stream is passed unchanged whether this
  11620. option is set or no. The video stream will be the first output stream if
  11621. activated. Default is @code{0}.
  11622. @item size
  11623. Set the video size. This option is for video only. For the syntax of this
  11624. option, check the
  11625. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11626. Default and minimum resolution is @code{640x480}.
  11627. @item meter
  11628. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  11629. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  11630. other integer value between this range is allowed.
  11631. @item metadata
  11632. Set metadata injection. If set to @code{1}, the audio input will be segmented
  11633. into 100ms output frames, each of them containing various loudness information
  11634. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  11635. Default is @code{0}.
  11636. @item framelog
  11637. Force the frame logging level.
  11638. Available values are:
  11639. @table @samp
  11640. @item info
  11641. information logging level
  11642. @item verbose
  11643. verbose logging level
  11644. @end table
  11645. By default, the logging level is set to @var{info}. If the @option{video} or
  11646. the @option{metadata} options are set, it switches to @var{verbose}.
  11647. @item peak
  11648. Set peak mode(s).
  11649. Available modes can be cumulated (the option is a @code{flag} type). Possible
  11650. values are:
  11651. @table @samp
  11652. @item none
  11653. Disable any peak mode (default).
  11654. @item sample
  11655. Enable sample-peak mode.
  11656. Simple peak mode looking for the higher sample value. It logs a message
  11657. for sample-peak (identified by @code{SPK}).
  11658. @item true
  11659. Enable true-peak mode.
  11660. If enabled, the peak lookup is done on an over-sampled version of the input
  11661. stream for better peak accuracy. It logs a message for true-peak.
  11662. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  11663. This mode requires a build with @code{libswresample}.
  11664. @end table
  11665. @item dualmono
  11666. Treat mono input files as "dual mono". If a mono file is intended for playback
  11667. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  11668. If set to @code{true}, this option will compensate for this effect.
  11669. Multi-channel input files are not affected by this option.
  11670. @item panlaw
  11671. Set a specific pan law to be used for the measurement of dual mono files.
  11672. This parameter is optional, and has a default value of -3.01dB.
  11673. @end table
  11674. @subsection Examples
  11675. @itemize
  11676. @item
  11677. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  11678. @example
  11679. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  11680. @end example
  11681. @item
  11682. Run an analysis with @command{ffmpeg}:
  11683. @example
  11684. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  11685. @end example
  11686. @end itemize
  11687. @section interleave, ainterleave
  11688. Temporally interleave frames from several inputs.
  11689. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  11690. These filters read frames from several inputs and send the oldest
  11691. queued frame to the output.
  11692. Input streams must have a well defined, monotonically increasing frame
  11693. timestamp values.
  11694. In order to submit one frame to output, these filters need to enqueue
  11695. at least one frame for each input, so they cannot work in case one
  11696. input is not yet terminated and will not receive incoming frames.
  11697. For example consider the case when one input is a @code{select} filter
  11698. which always drop input frames. The @code{interleave} filter will keep
  11699. reading from that input, but it will never be able to send new frames
  11700. to output until the input will send an end-of-stream signal.
  11701. Also, depending on inputs synchronization, the filters will drop
  11702. frames in case one input receives more frames than the other ones, and
  11703. the queue is already filled.
  11704. These filters accept the following options:
  11705. @table @option
  11706. @item nb_inputs, n
  11707. Set the number of different inputs, it is 2 by default.
  11708. @end table
  11709. @subsection Examples
  11710. @itemize
  11711. @item
  11712. Interleave frames belonging to different streams using @command{ffmpeg}:
  11713. @example
  11714. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  11715. @end example
  11716. @item
  11717. Add flickering blur effect:
  11718. @example
  11719. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  11720. @end example
  11721. @end itemize
  11722. @section perms, aperms
  11723. Set read/write permissions for the output frames.
  11724. These filters are mainly aimed at developers to test direct path in the
  11725. following filter in the filtergraph.
  11726. The filters accept the following options:
  11727. @table @option
  11728. @item mode
  11729. Select the permissions mode.
  11730. It accepts the following values:
  11731. @table @samp
  11732. @item none
  11733. Do nothing. This is the default.
  11734. @item ro
  11735. Set all the output frames read-only.
  11736. @item rw
  11737. Set all the output frames directly writable.
  11738. @item toggle
  11739. Make the frame read-only if writable, and writable if read-only.
  11740. @item random
  11741. Set each output frame read-only or writable randomly.
  11742. @end table
  11743. @item seed
  11744. Set the seed for the @var{random} mode, must be an integer included between
  11745. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11746. @code{-1}, the filter will try to use a good random seed on a best effort
  11747. basis.
  11748. @end table
  11749. Note: in case of auto-inserted filter between the permission filter and the
  11750. following one, the permission might not be received as expected in that
  11751. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  11752. perms/aperms filter can avoid this problem.
  11753. @section realtime, arealtime
  11754. Slow down filtering to match real time approximatively.
  11755. These filters will pause the filtering for a variable amount of time to
  11756. match the output rate with the input timestamps.
  11757. They are similar to the @option{re} option to @code{ffmpeg}.
  11758. They accept the following options:
  11759. @table @option
  11760. @item limit
  11761. Time limit for the pauses. Any pause longer than that will be considered
  11762. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  11763. @end table
  11764. @section select, aselect
  11765. Select frames to pass in output.
  11766. This filter accepts the following options:
  11767. @table @option
  11768. @item expr, e
  11769. Set expression, which is evaluated for each input frame.
  11770. If the expression is evaluated to zero, the frame is discarded.
  11771. If the evaluation result is negative or NaN, the frame is sent to the
  11772. first output; otherwise it is sent to the output with index
  11773. @code{ceil(val)-1}, assuming that the input index starts from 0.
  11774. For example a value of @code{1.2} corresponds to the output with index
  11775. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  11776. @item outputs, n
  11777. Set the number of outputs. The output to which to send the selected
  11778. frame is based on the result of the evaluation. Default value is 1.
  11779. @end table
  11780. The expression can contain the following constants:
  11781. @table @option
  11782. @item n
  11783. The (sequential) number of the filtered frame, starting from 0.
  11784. @item selected_n
  11785. The (sequential) number of the selected frame, starting from 0.
  11786. @item prev_selected_n
  11787. The sequential number of the last selected frame. It's NAN if undefined.
  11788. @item TB
  11789. The timebase of the input timestamps.
  11790. @item pts
  11791. The PTS (Presentation TimeStamp) of the filtered video frame,
  11792. expressed in @var{TB} units. It's NAN if undefined.
  11793. @item t
  11794. The PTS of the filtered video frame,
  11795. expressed in seconds. It's NAN if undefined.
  11796. @item prev_pts
  11797. The PTS of the previously filtered video frame. It's NAN if undefined.
  11798. @item prev_selected_pts
  11799. The PTS of the last previously filtered video frame. It's NAN if undefined.
  11800. @item prev_selected_t
  11801. The PTS of the last previously selected video frame. It's NAN if undefined.
  11802. @item start_pts
  11803. The PTS of the first video frame in the video. It's NAN if undefined.
  11804. @item start_t
  11805. The time of the first video frame in the video. It's NAN if undefined.
  11806. @item pict_type @emph{(video only)}
  11807. The type of the filtered frame. It can assume one of the following
  11808. values:
  11809. @table @option
  11810. @item I
  11811. @item P
  11812. @item B
  11813. @item S
  11814. @item SI
  11815. @item SP
  11816. @item BI
  11817. @end table
  11818. @item interlace_type @emph{(video only)}
  11819. The frame interlace type. It can assume one of the following values:
  11820. @table @option
  11821. @item PROGRESSIVE
  11822. The frame is progressive (not interlaced).
  11823. @item TOPFIRST
  11824. The frame is top-field-first.
  11825. @item BOTTOMFIRST
  11826. The frame is bottom-field-first.
  11827. @end table
  11828. @item consumed_sample_n @emph{(audio only)}
  11829. the number of selected samples before the current frame
  11830. @item samples_n @emph{(audio only)}
  11831. the number of samples in the current frame
  11832. @item sample_rate @emph{(audio only)}
  11833. the input sample rate
  11834. @item key
  11835. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  11836. @item pos
  11837. the position in the file of the filtered frame, -1 if the information
  11838. is not available (e.g. for synthetic video)
  11839. @item scene @emph{(video only)}
  11840. value between 0 and 1 to indicate a new scene; a low value reflects a low
  11841. probability for the current frame to introduce a new scene, while a higher
  11842. value means the current frame is more likely to be one (see the example below)
  11843. @item concatdec_select
  11844. The concat demuxer can select only part of a concat input file by setting an
  11845. inpoint and an outpoint, but the output packets may not be entirely contained
  11846. in the selected interval. By using this variable, it is possible to skip frames
  11847. generated by the concat demuxer which are not exactly contained in the selected
  11848. interval.
  11849. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  11850. and the @var{lavf.concat.duration} packet metadata values which are also
  11851. present in the decoded frames.
  11852. The @var{concatdec_select} variable is -1 if the frame pts is at least
  11853. start_time and either the duration metadata is missing or the frame pts is less
  11854. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  11855. missing.
  11856. That basically means that an input frame is selected if its pts is within the
  11857. interval set by the concat demuxer.
  11858. @end table
  11859. The default value of the select expression is "1".
  11860. @subsection Examples
  11861. @itemize
  11862. @item
  11863. Select all frames in input:
  11864. @example
  11865. select
  11866. @end example
  11867. The example above is the same as:
  11868. @example
  11869. select=1
  11870. @end example
  11871. @item
  11872. Skip all frames:
  11873. @example
  11874. select=0
  11875. @end example
  11876. @item
  11877. Select only I-frames:
  11878. @example
  11879. select='eq(pict_type\,I)'
  11880. @end example
  11881. @item
  11882. Select one frame every 100:
  11883. @example
  11884. select='not(mod(n\,100))'
  11885. @end example
  11886. @item
  11887. Select only frames contained in the 10-20 time interval:
  11888. @example
  11889. select=between(t\,10\,20)
  11890. @end example
  11891. @item
  11892. Select only I frames contained in the 10-20 time interval:
  11893. @example
  11894. select=between(t\,10\,20)*eq(pict_type\,I)
  11895. @end example
  11896. @item
  11897. Select frames with a minimum distance of 10 seconds:
  11898. @example
  11899. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  11900. @end example
  11901. @item
  11902. Use aselect to select only audio frames with samples number > 100:
  11903. @example
  11904. aselect='gt(samples_n\,100)'
  11905. @end example
  11906. @item
  11907. Create a mosaic of the first scenes:
  11908. @example
  11909. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  11910. @end example
  11911. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  11912. choice.
  11913. @item
  11914. Send even and odd frames to separate outputs, and compose them:
  11915. @example
  11916. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  11917. @end example
  11918. @item
  11919. Select useful frames from an ffconcat file which is using inpoints and
  11920. outpoints but where the source files are not intra frame only.
  11921. @example
  11922. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  11923. @end example
  11924. @end itemize
  11925. @section sendcmd, asendcmd
  11926. Send commands to filters in the filtergraph.
  11927. These filters read commands to be sent to other filters in the
  11928. filtergraph.
  11929. @code{sendcmd} must be inserted between two video filters,
  11930. @code{asendcmd} must be inserted between two audio filters, but apart
  11931. from that they act the same way.
  11932. The specification of commands can be provided in the filter arguments
  11933. with the @var{commands} option, or in a file specified by the
  11934. @var{filename} option.
  11935. These filters accept the following options:
  11936. @table @option
  11937. @item commands, c
  11938. Set the commands to be read and sent to the other filters.
  11939. @item filename, f
  11940. Set the filename of the commands to be read and sent to the other
  11941. filters.
  11942. @end table
  11943. @subsection Commands syntax
  11944. A commands description consists of a sequence of interval
  11945. specifications, comprising a list of commands to be executed when a
  11946. particular event related to that interval occurs. The occurring event
  11947. is typically the current frame time entering or leaving a given time
  11948. interval.
  11949. An interval is specified by the following syntax:
  11950. @example
  11951. @var{START}[-@var{END}] @var{COMMANDS};
  11952. @end example
  11953. The time interval is specified by the @var{START} and @var{END} times.
  11954. @var{END} is optional and defaults to the maximum time.
  11955. The current frame time is considered within the specified interval if
  11956. it is included in the interval [@var{START}, @var{END}), that is when
  11957. the time is greater or equal to @var{START} and is lesser than
  11958. @var{END}.
  11959. @var{COMMANDS} consists of a sequence of one or more command
  11960. specifications, separated by ",", relating to that interval. The
  11961. syntax of a command specification is given by:
  11962. @example
  11963. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  11964. @end example
  11965. @var{FLAGS} is optional and specifies the type of events relating to
  11966. the time interval which enable sending the specified command, and must
  11967. be a non-null sequence of identifier flags separated by "+" or "|" and
  11968. enclosed between "[" and "]".
  11969. The following flags are recognized:
  11970. @table @option
  11971. @item enter
  11972. The command is sent when the current frame timestamp enters the
  11973. specified interval. In other words, the command is sent when the
  11974. previous frame timestamp was not in the given interval, and the
  11975. current is.
  11976. @item leave
  11977. The command is sent when the current frame timestamp leaves the
  11978. specified interval. In other words, the command is sent when the
  11979. previous frame timestamp was in the given interval, and the
  11980. current is not.
  11981. @end table
  11982. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  11983. assumed.
  11984. @var{TARGET} specifies the target of the command, usually the name of
  11985. the filter class or a specific filter instance name.
  11986. @var{COMMAND} specifies the name of the command for the target filter.
  11987. @var{ARG} is optional and specifies the optional list of argument for
  11988. the given @var{COMMAND}.
  11989. Between one interval specification and another, whitespaces, or
  11990. sequences of characters starting with @code{#} until the end of line,
  11991. are ignored and can be used to annotate comments.
  11992. A simplified BNF description of the commands specification syntax
  11993. follows:
  11994. @example
  11995. @var{COMMAND_FLAG} ::= "enter" | "leave"
  11996. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  11997. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  11998. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  11999. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12000. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12001. @end example
  12002. @subsection Examples
  12003. @itemize
  12004. @item
  12005. Specify audio tempo change at second 4:
  12006. @example
  12007. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12008. @end example
  12009. @item
  12010. Specify a list of drawtext and hue commands in a file.
  12011. @example
  12012. # show text in the interval 5-10
  12013. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12014. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12015. # desaturate the image in the interval 15-20
  12016. 15.0-20.0 [enter] hue s 0,
  12017. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12018. [leave] hue s 1,
  12019. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12020. # apply an exponential saturation fade-out effect, starting from time 25
  12021. 25 [enter] hue s exp(25-t)
  12022. @end example
  12023. A filtergraph allowing to read and process the above command list
  12024. stored in a file @file{test.cmd}, can be specified with:
  12025. @example
  12026. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12027. @end example
  12028. @end itemize
  12029. @anchor{setpts}
  12030. @section setpts, asetpts
  12031. Change the PTS (presentation timestamp) of the input frames.
  12032. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12033. This filter accepts the following options:
  12034. @table @option
  12035. @item expr
  12036. The expression which is evaluated for each frame to construct its timestamp.
  12037. @end table
  12038. The expression is evaluated through the eval API and can contain the following
  12039. constants:
  12040. @table @option
  12041. @item FRAME_RATE
  12042. frame rate, only defined for constant frame-rate video
  12043. @item PTS
  12044. The presentation timestamp in input
  12045. @item N
  12046. The count of the input frame for video or the number of consumed samples,
  12047. not including the current frame for audio, starting from 0.
  12048. @item NB_CONSUMED_SAMPLES
  12049. The number of consumed samples, not including the current frame (only
  12050. audio)
  12051. @item NB_SAMPLES, S
  12052. The number of samples in the current frame (only audio)
  12053. @item SAMPLE_RATE, SR
  12054. The audio sample rate.
  12055. @item STARTPTS
  12056. The PTS of the first frame.
  12057. @item STARTT
  12058. the time in seconds of the first frame
  12059. @item INTERLACED
  12060. State whether the current frame is interlaced.
  12061. @item T
  12062. the time in seconds of the current frame
  12063. @item POS
  12064. original position in the file of the frame, or undefined if undefined
  12065. for the current frame
  12066. @item PREV_INPTS
  12067. The previous input PTS.
  12068. @item PREV_INT
  12069. previous input time in seconds
  12070. @item PREV_OUTPTS
  12071. The previous output PTS.
  12072. @item PREV_OUTT
  12073. previous output time in seconds
  12074. @item RTCTIME
  12075. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12076. instead.
  12077. @item RTCSTART
  12078. The wallclock (RTC) time at the start of the movie in microseconds.
  12079. @item TB
  12080. The timebase of the input timestamps.
  12081. @end table
  12082. @subsection Examples
  12083. @itemize
  12084. @item
  12085. Start counting PTS from zero
  12086. @example
  12087. setpts=PTS-STARTPTS
  12088. @end example
  12089. @item
  12090. Apply fast motion effect:
  12091. @example
  12092. setpts=0.5*PTS
  12093. @end example
  12094. @item
  12095. Apply slow motion effect:
  12096. @example
  12097. setpts=2.0*PTS
  12098. @end example
  12099. @item
  12100. Set fixed rate of 25 frames per second:
  12101. @example
  12102. setpts=N/(25*TB)
  12103. @end example
  12104. @item
  12105. Set fixed rate 25 fps with some jitter:
  12106. @example
  12107. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12108. @end example
  12109. @item
  12110. Apply an offset of 10 seconds to the input PTS:
  12111. @example
  12112. setpts=PTS+10/TB
  12113. @end example
  12114. @item
  12115. Generate timestamps from a "live source" and rebase onto the current timebase:
  12116. @example
  12117. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12118. @end example
  12119. @item
  12120. Generate timestamps by counting samples:
  12121. @example
  12122. asetpts=N/SR/TB
  12123. @end example
  12124. @end itemize
  12125. @section settb, asettb
  12126. Set the timebase to use for the output frames timestamps.
  12127. It is mainly useful for testing timebase configuration.
  12128. It accepts the following parameters:
  12129. @table @option
  12130. @item expr, tb
  12131. The expression which is evaluated into the output timebase.
  12132. @end table
  12133. The value for @option{tb} is an arithmetic expression representing a
  12134. rational. The expression can contain the constants "AVTB" (the default
  12135. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12136. audio only). Default value is "intb".
  12137. @subsection Examples
  12138. @itemize
  12139. @item
  12140. Set the timebase to 1/25:
  12141. @example
  12142. settb=expr=1/25
  12143. @end example
  12144. @item
  12145. Set the timebase to 1/10:
  12146. @example
  12147. settb=expr=0.1
  12148. @end example
  12149. @item
  12150. Set the timebase to 1001/1000:
  12151. @example
  12152. settb=1+0.001
  12153. @end example
  12154. @item
  12155. Set the timebase to 2*intb:
  12156. @example
  12157. settb=2*intb
  12158. @end example
  12159. @item
  12160. Set the default timebase value:
  12161. @example
  12162. settb=AVTB
  12163. @end example
  12164. @end itemize
  12165. @section showcqt
  12166. Convert input audio to a video output representing frequency spectrum
  12167. logarithmically using Brown-Puckette constant Q transform algorithm with
  12168. direct frequency domain coefficient calculation (but the transform itself
  12169. is not really constant Q, instead the Q factor is actually variable/clamped),
  12170. with musical tone scale, from E0 to D#10.
  12171. The filter accepts the following options:
  12172. @table @option
  12173. @item size, s
  12174. Specify the video size for the output. It must be even. For the syntax of this option,
  12175. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12176. Default value is @code{1920x1080}.
  12177. @item fps, rate, r
  12178. Set the output frame rate. Default value is @code{25}.
  12179. @item bar_h
  12180. Set the bargraph height. It must be even. Default value is @code{-1} which
  12181. computes the bargraph height automatically.
  12182. @item axis_h
  12183. Set the axis height. It must be even. Default value is @code{-1} which computes
  12184. the axis height automatically.
  12185. @item sono_h
  12186. Set the sonogram height. It must be even. Default value is @code{-1} which
  12187. computes the sonogram height automatically.
  12188. @item fullhd
  12189. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  12190. instead. Default value is @code{1}.
  12191. @item sono_v, volume
  12192. Specify the sonogram volume expression. It can contain variables:
  12193. @table @option
  12194. @item bar_v
  12195. the @var{bar_v} evaluated expression
  12196. @item frequency, freq, f
  12197. the frequency where it is evaluated
  12198. @item timeclamp, tc
  12199. the value of @var{timeclamp} option
  12200. @end table
  12201. and functions:
  12202. @table @option
  12203. @item a_weighting(f)
  12204. A-weighting of equal loudness
  12205. @item b_weighting(f)
  12206. B-weighting of equal loudness
  12207. @item c_weighting(f)
  12208. C-weighting of equal loudness.
  12209. @end table
  12210. Default value is @code{16}.
  12211. @item bar_v, volume2
  12212. Specify the bargraph volume expression. It can contain variables:
  12213. @table @option
  12214. @item sono_v
  12215. the @var{sono_v} evaluated expression
  12216. @item frequency, freq, f
  12217. the frequency where it is evaluated
  12218. @item timeclamp, tc
  12219. the value of @var{timeclamp} option
  12220. @end table
  12221. and functions:
  12222. @table @option
  12223. @item a_weighting(f)
  12224. A-weighting of equal loudness
  12225. @item b_weighting(f)
  12226. B-weighting of equal loudness
  12227. @item c_weighting(f)
  12228. C-weighting of equal loudness.
  12229. @end table
  12230. Default value is @code{sono_v}.
  12231. @item sono_g, gamma
  12232. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  12233. higher gamma makes the spectrum having more range. Default value is @code{3}.
  12234. Acceptable range is @code{[1, 7]}.
  12235. @item bar_g, gamma2
  12236. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  12237. @code{[1, 7]}.
  12238. @item timeclamp, tc
  12239. Specify the transform timeclamp. At low frequency, there is trade-off between
  12240. accuracy in time domain and frequency domain. If timeclamp is lower,
  12241. event in time domain is represented more accurately (such as fast bass drum),
  12242. otherwise event in frequency domain is represented more accurately
  12243. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  12244. @item basefreq
  12245. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  12246. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  12247. @item endfreq
  12248. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  12249. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  12250. @item coeffclamp
  12251. This option is deprecated and ignored.
  12252. @item tlength
  12253. Specify the transform length in time domain. Use this option to control accuracy
  12254. trade-off between time domain and frequency domain at every frequency sample.
  12255. It can contain variables:
  12256. @table @option
  12257. @item frequency, freq, f
  12258. the frequency where it is evaluated
  12259. @item timeclamp, tc
  12260. the value of @var{timeclamp} option.
  12261. @end table
  12262. Default value is @code{384*tc/(384+tc*f)}.
  12263. @item count
  12264. Specify the transform count for every video frame. Default value is @code{6}.
  12265. Acceptable range is @code{[1, 30]}.
  12266. @item fcount
  12267. Specify the transform count for every single pixel. Default value is @code{0},
  12268. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  12269. @item fontfile
  12270. Specify font file for use with freetype to draw the axis. If not specified,
  12271. use embedded font. Note that drawing with font file or embedded font is not
  12272. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  12273. option instead.
  12274. @item fontcolor
  12275. Specify font color expression. This is arithmetic expression that should return
  12276. integer value 0xRRGGBB. It can contain variables:
  12277. @table @option
  12278. @item frequency, freq, f
  12279. the frequency where it is evaluated
  12280. @item timeclamp, tc
  12281. the value of @var{timeclamp} option
  12282. @end table
  12283. and functions:
  12284. @table @option
  12285. @item midi(f)
  12286. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  12287. @item r(x), g(x), b(x)
  12288. red, green, and blue value of intensity x.
  12289. @end table
  12290. Default value is @code{st(0, (midi(f)-59.5)/12);
  12291. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  12292. r(1-ld(1)) + b(ld(1))}.
  12293. @item axisfile
  12294. Specify image file to draw the axis. This option override @var{fontfile} and
  12295. @var{fontcolor} option.
  12296. @item axis, text
  12297. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  12298. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  12299. Default value is @code{1}.
  12300. @end table
  12301. @subsection Examples
  12302. @itemize
  12303. @item
  12304. Playing audio while showing the spectrum:
  12305. @example
  12306. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  12307. @end example
  12308. @item
  12309. Same as above, but with frame rate 30 fps:
  12310. @example
  12311. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  12312. @end example
  12313. @item
  12314. Playing at 1280x720:
  12315. @example
  12316. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  12317. @end example
  12318. @item
  12319. Disable sonogram display:
  12320. @example
  12321. sono_h=0
  12322. @end example
  12323. @item
  12324. A1 and its harmonics: A1, A2, (near)E3, A3:
  12325. @example
  12326. 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),
  12327. asplit[a][out1]; [a] showcqt [out0]'
  12328. @end example
  12329. @item
  12330. Same as above, but with more accuracy in frequency domain:
  12331. @example
  12332. 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),
  12333. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  12334. @end example
  12335. @item
  12336. Custom volume:
  12337. @example
  12338. bar_v=10:sono_v=bar_v*a_weighting(f)
  12339. @end example
  12340. @item
  12341. Custom gamma, now spectrum is linear to the amplitude.
  12342. @example
  12343. bar_g=2:sono_g=2
  12344. @end example
  12345. @item
  12346. Custom tlength equation:
  12347. @example
  12348. 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)))'
  12349. @end example
  12350. @item
  12351. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  12352. @example
  12353. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  12354. @end example
  12355. @item
  12356. Custom frequency range with custom axis using image file:
  12357. @example
  12358. axisfile=myaxis.png:basefreq=40:endfreq=10000
  12359. @end example
  12360. @end itemize
  12361. @section showfreqs
  12362. Convert input audio to video output representing the audio power spectrum.
  12363. Audio amplitude is on Y-axis while frequency is on X-axis.
  12364. The filter accepts the following options:
  12365. @table @option
  12366. @item size, s
  12367. Specify size of video. For the syntax of this option, check the
  12368. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12369. Default is @code{1024x512}.
  12370. @item mode
  12371. Set display mode.
  12372. This set how each frequency bin will be represented.
  12373. It accepts the following values:
  12374. @table @samp
  12375. @item line
  12376. @item bar
  12377. @item dot
  12378. @end table
  12379. Default is @code{bar}.
  12380. @item ascale
  12381. Set amplitude scale.
  12382. It accepts the following values:
  12383. @table @samp
  12384. @item lin
  12385. Linear scale.
  12386. @item sqrt
  12387. Square root scale.
  12388. @item cbrt
  12389. Cubic root scale.
  12390. @item log
  12391. Logarithmic scale.
  12392. @end table
  12393. Default is @code{log}.
  12394. @item fscale
  12395. Set frequency scale.
  12396. It accepts the following values:
  12397. @table @samp
  12398. @item lin
  12399. Linear scale.
  12400. @item log
  12401. Logarithmic scale.
  12402. @item rlog
  12403. Reverse logarithmic scale.
  12404. @end table
  12405. Default is @code{lin}.
  12406. @item win_size
  12407. Set window size.
  12408. It accepts the following values:
  12409. @table @samp
  12410. @item w16
  12411. @item w32
  12412. @item w64
  12413. @item w128
  12414. @item w256
  12415. @item w512
  12416. @item w1024
  12417. @item w2048
  12418. @item w4096
  12419. @item w8192
  12420. @item w16384
  12421. @item w32768
  12422. @item w65536
  12423. @end table
  12424. Default is @code{w2048}
  12425. @item win_func
  12426. Set windowing function.
  12427. It accepts the following values:
  12428. @table @samp
  12429. @item rect
  12430. @item bartlett
  12431. @item hanning
  12432. @item hamming
  12433. @item blackman
  12434. @item welch
  12435. @item flattop
  12436. @item bharris
  12437. @item bnuttall
  12438. @item bhann
  12439. @item sine
  12440. @item nuttall
  12441. @item lanczos
  12442. @item gauss
  12443. @item tukey
  12444. @end table
  12445. Default is @code{hanning}.
  12446. @item overlap
  12447. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12448. which means optimal overlap for selected window function will be picked.
  12449. @item averaging
  12450. Set time averaging. Setting this to 0 will display current maximal peaks.
  12451. Default is @code{1}, which means time averaging is disabled.
  12452. @item colors
  12453. Specify list of colors separated by space or by '|' which will be used to
  12454. draw channel frequencies. Unrecognized or missing colors will be replaced
  12455. by white color.
  12456. @item cmode
  12457. Set channel display mode.
  12458. It accepts the following values:
  12459. @table @samp
  12460. @item combined
  12461. @item separate
  12462. @end table
  12463. Default is @code{combined}.
  12464. @end table
  12465. @anchor{showspectrum}
  12466. @section showspectrum
  12467. Convert input audio to a video output, representing the audio frequency
  12468. spectrum.
  12469. The filter accepts the following options:
  12470. @table @option
  12471. @item size, s
  12472. Specify the video size for the output. For the syntax of this option, check the
  12473. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12474. Default value is @code{640x512}.
  12475. @item slide
  12476. Specify how the spectrum should slide along the window.
  12477. It accepts the following values:
  12478. @table @samp
  12479. @item replace
  12480. the samples start again on the left when they reach the right
  12481. @item scroll
  12482. the samples scroll from right to left
  12483. @item rscroll
  12484. the samples scroll from left to right
  12485. @item fullframe
  12486. frames are only produced when the samples reach the right
  12487. @end table
  12488. Default value is @code{replace}.
  12489. @item mode
  12490. Specify display mode.
  12491. It accepts the following values:
  12492. @table @samp
  12493. @item combined
  12494. all channels are displayed in the same row
  12495. @item separate
  12496. all channels are displayed in separate rows
  12497. @end table
  12498. Default value is @samp{combined}.
  12499. @item color
  12500. Specify display color mode.
  12501. It accepts the following values:
  12502. @table @samp
  12503. @item channel
  12504. each channel is displayed in a separate color
  12505. @item intensity
  12506. each channel is displayed using the same color scheme
  12507. @item rainbow
  12508. each channel is displayed using the rainbow color scheme
  12509. @item moreland
  12510. each channel is displayed using the moreland color scheme
  12511. @item nebulae
  12512. each channel is displayed using the nebulae color scheme
  12513. @item fire
  12514. each channel is displayed using the fire color scheme
  12515. @item fiery
  12516. each channel is displayed using the fiery color scheme
  12517. @item fruit
  12518. each channel is displayed using the fruit color scheme
  12519. @item cool
  12520. each channel is displayed using the cool color scheme
  12521. @end table
  12522. Default value is @samp{channel}.
  12523. @item scale
  12524. Specify scale used for calculating intensity color values.
  12525. It accepts the following values:
  12526. @table @samp
  12527. @item lin
  12528. linear
  12529. @item sqrt
  12530. square root, default
  12531. @item cbrt
  12532. cubic root
  12533. @item 4thrt
  12534. 4th root
  12535. @item 5thrt
  12536. 5th root
  12537. @item log
  12538. logarithmic
  12539. @end table
  12540. Default value is @samp{sqrt}.
  12541. @item saturation
  12542. Set saturation modifier for displayed colors. Negative values provide
  12543. alternative color scheme. @code{0} is no saturation at all.
  12544. Saturation must be in [-10.0, 10.0] range.
  12545. Default value is @code{1}.
  12546. @item win_func
  12547. Set window function.
  12548. It accepts the following values:
  12549. @table @samp
  12550. @item rect
  12551. @item bartlett
  12552. @item hann
  12553. @item hanning
  12554. @item hamming
  12555. @item blackman
  12556. @item welch
  12557. @item flattop
  12558. @item bharris
  12559. @item bnuttall
  12560. @item bhann
  12561. @item sine
  12562. @item nuttall
  12563. @item lanczos
  12564. @item gauss
  12565. @item tukey
  12566. @end table
  12567. Default value is @code{hann}.
  12568. @item orientation
  12569. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12570. @code{horizontal}. Default is @code{vertical}.
  12571. @item overlap
  12572. Set ratio of overlap window. Default value is @code{0}.
  12573. When value is @code{1} overlap is set to recommended size for specific
  12574. window function currently used.
  12575. @item gain
  12576. Set scale gain for calculating intensity color values.
  12577. Default value is @code{1}.
  12578. @item data
  12579. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  12580. @end table
  12581. The usage is very similar to the showwaves filter; see the examples in that
  12582. section.
  12583. @subsection Examples
  12584. @itemize
  12585. @item
  12586. Large window with logarithmic color scaling:
  12587. @example
  12588. showspectrum=s=1280x480:scale=log
  12589. @end example
  12590. @item
  12591. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  12592. @example
  12593. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12594. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  12595. @end example
  12596. @end itemize
  12597. @section showspectrumpic
  12598. Convert input audio to a single video frame, representing the audio frequency
  12599. spectrum.
  12600. The filter accepts the following options:
  12601. @table @option
  12602. @item size, s
  12603. Specify the video size for the output. For the syntax of this option, check the
  12604. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12605. Default value is @code{4096x2048}.
  12606. @item mode
  12607. Specify display mode.
  12608. It accepts the following values:
  12609. @table @samp
  12610. @item combined
  12611. all channels are displayed in the same row
  12612. @item separate
  12613. all channels are displayed in separate rows
  12614. @end table
  12615. Default value is @samp{combined}.
  12616. @item color
  12617. Specify display color mode.
  12618. It accepts the following values:
  12619. @table @samp
  12620. @item channel
  12621. each channel is displayed in a separate color
  12622. @item intensity
  12623. each channel is displayed using the same color scheme
  12624. @item rainbow
  12625. each channel is displayed using the rainbow color scheme
  12626. @item moreland
  12627. each channel is displayed using the moreland color scheme
  12628. @item nebulae
  12629. each channel is displayed using the nebulae color scheme
  12630. @item fire
  12631. each channel is displayed using the fire color scheme
  12632. @item fiery
  12633. each channel is displayed using the fiery color scheme
  12634. @item fruit
  12635. each channel is displayed using the fruit color scheme
  12636. @item cool
  12637. each channel is displayed using the cool color scheme
  12638. @end table
  12639. Default value is @samp{intensity}.
  12640. @item scale
  12641. Specify scale used for calculating intensity color values.
  12642. It accepts the following values:
  12643. @table @samp
  12644. @item lin
  12645. linear
  12646. @item sqrt
  12647. square root, default
  12648. @item cbrt
  12649. cubic root
  12650. @item 4thrt
  12651. 4th root
  12652. @item 5thrt
  12653. 5th root
  12654. @item log
  12655. logarithmic
  12656. @end table
  12657. Default value is @samp{log}.
  12658. @item saturation
  12659. Set saturation modifier for displayed colors. Negative values provide
  12660. alternative color scheme. @code{0} is no saturation at all.
  12661. Saturation must be in [-10.0, 10.0] range.
  12662. Default value is @code{1}.
  12663. @item win_func
  12664. Set window function.
  12665. It accepts the following values:
  12666. @table @samp
  12667. @item rect
  12668. @item bartlett
  12669. @item hann
  12670. @item hanning
  12671. @item hamming
  12672. @item blackman
  12673. @item welch
  12674. @item flattop
  12675. @item bharris
  12676. @item bnuttall
  12677. @item bhann
  12678. @item sine
  12679. @item nuttall
  12680. @item lanczos
  12681. @item gauss
  12682. @item tukey
  12683. @end table
  12684. Default value is @code{hann}.
  12685. @item orientation
  12686. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12687. @code{horizontal}. Default is @code{vertical}.
  12688. @item gain
  12689. Set scale gain for calculating intensity color values.
  12690. Default value is @code{1}.
  12691. @item legend
  12692. Draw time and frequency axes and legends. Default is enabled.
  12693. @end table
  12694. @subsection Examples
  12695. @itemize
  12696. @item
  12697. Extract an audio spectrogram of a whole audio track
  12698. in a 1024x1024 picture using @command{ffmpeg}:
  12699. @example
  12700. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  12701. @end example
  12702. @end itemize
  12703. @section showvolume
  12704. Convert input audio volume to a video output.
  12705. The filter accepts the following options:
  12706. @table @option
  12707. @item rate, r
  12708. Set video rate.
  12709. @item b
  12710. Set border width, allowed range is [0, 5]. Default is 1.
  12711. @item w
  12712. Set channel width, allowed range is [80, 8192]. Default is 400.
  12713. @item h
  12714. Set channel height, allowed range is [1, 900]. Default is 20.
  12715. @item f
  12716. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  12717. @item c
  12718. Set volume color expression.
  12719. The expression can use the following variables:
  12720. @table @option
  12721. @item VOLUME
  12722. Current max volume of channel in dB.
  12723. @item CHANNEL
  12724. Current channel number, starting from 0.
  12725. @end table
  12726. @item t
  12727. If set, displays channel names. Default is enabled.
  12728. @item v
  12729. If set, displays volume values. Default is enabled.
  12730. @item o
  12731. Set orientation, can be @code{horizontal} or @code{vertical},
  12732. default is @code{horizontal}.
  12733. @item s
  12734. Set step size, allowed range s [0, 5]. Default is 0, which means
  12735. step is disabled.
  12736. @end table
  12737. @section showwaves
  12738. Convert input audio to a video output, representing the samples waves.
  12739. The filter accepts the following options:
  12740. @table @option
  12741. @item size, s
  12742. Specify the video size for the output. For the syntax of this option, check the
  12743. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12744. Default value is @code{600x240}.
  12745. @item mode
  12746. Set display mode.
  12747. Available values are:
  12748. @table @samp
  12749. @item point
  12750. Draw a point for each sample.
  12751. @item line
  12752. Draw a vertical line for each sample.
  12753. @item p2p
  12754. Draw a point for each sample and a line between them.
  12755. @item cline
  12756. Draw a centered vertical line for each sample.
  12757. @end table
  12758. Default value is @code{point}.
  12759. @item n
  12760. Set the number of samples which are printed on the same column. A
  12761. larger value will decrease the frame rate. Must be a positive
  12762. integer. This option can be set only if the value for @var{rate}
  12763. is not explicitly specified.
  12764. @item rate, r
  12765. Set the (approximate) output frame rate. This is done by setting the
  12766. option @var{n}. Default value is "25".
  12767. @item split_channels
  12768. Set if channels should be drawn separately or overlap. Default value is 0.
  12769. @item colors
  12770. Set colors separated by '|' which are going to be used for drawing of each channel.
  12771. @item scale
  12772. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12773. Default is linear.
  12774. @end table
  12775. @subsection Examples
  12776. @itemize
  12777. @item
  12778. Output the input file audio and the corresponding video representation
  12779. at the same time:
  12780. @example
  12781. amovie=a.mp3,asplit[out0],showwaves[out1]
  12782. @end example
  12783. @item
  12784. Create a synthetic signal and show it with showwaves, forcing a
  12785. frame rate of 30 frames per second:
  12786. @example
  12787. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  12788. @end example
  12789. @end itemize
  12790. @section showwavespic
  12791. Convert input audio to a single video frame, representing the samples waves.
  12792. The filter accepts the following options:
  12793. @table @option
  12794. @item size, s
  12795. Specify the video size for the output. For the syntax of this option, check the
  12796. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12797. Default value is @code{600x240}.
  12798. @item split_channels
  12799. Set if channels should be drawn separately or overlap. Default value is 0.
  12800. @item colors
  12801. Set colors separated by '|' which are going to be used for drawing of each channel.
  12802. @item scale
  12803. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12804. Default is linear.
  12805. @end table
  12806. @subsection Examples
  12807. @itemize
  12808. @item
  12809. Extract a channel split representation of the wave form of a whole audio track
  12810. in a 1024x800 picture using @command{ffmpeg}:
  12811. @example
  12812. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  12813. @end example
  12814. @item
  12815. Colorize the waveform with colorchannelmixer. This example will make
  12816. the waveform a green color approximately RGB(66,217,150). Additional
  12817. channels will be shades of this color.
  12818. @example
  12819. ffmpeg -i audio.mp3 -filter_complex "showwavespic,colorchannelmixer=rr=66/255:gg=217/255:bb=150/255" waveform.png
  12820. @end example
  12821. @end itemize
  12822. @section spectrumsynth
  12823. Sythesize audio from 2 input video spectrums, first input stream represents
  12824. magnitude across time and second represents phase across time.
  12825. The filter will transform from frequency domain as displayed in videos back
  12826. to time domain as presented in audio output.
  12827. This filter is primarly created for reversing processed @ref{showspectrum}
  12828. filter outputs, but can synthesize sound from other spectrograms too.
  12829. But in such case results are going to be poor if the phase data is not
  12830. available, because in such cases phase data need to be recreated, usually
  12831. its just recreated from random noise.
  12832. For best results use gray only output (@code{channel} color mode in
  12833. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  12834. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  12835. @code{data} option. Inputs videos should generally use @code{fullframe}
  12836. slide mode as that saves resources needed for decoding video.
  12837. The filter accepts the following options:
  12838. @table @option
  12839. @item sample_rate
  12840. Specify sample rate of output audio, the sample rate of audio from which
  12841. spectrum was generated may differ.
  12842. @item channels
  12843. Set number of channels represented in input video spectrums.
  12844. @item scale
  12845. Set scale which was used when generating magnitude input spectrum.
  12846. Can be @code{lin} or @code{log}. Default is @code{log}.
  12847. @item slide
  12848. Set slide which was used when generating inputs spectrums.
  12849. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  12850. Default is @code{fullframe}.
  12851. @item win_func
  12852. Set window function used for resynthesis.
  12853. @item overlap
  12854. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12855. which means optimal overlap for selected window function will be picked.
  12856. @item orientation
  12857. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  12858. Default is @code{vertical}.
  12859. @end table
  12860. @subsection Examples
  12861. @itemize
  12862. @item
  12863. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  12864. then resynthesize videos back to audio with spectrumsynth:
  12865. @example
  12866. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=log:overlap=0.875:color=channel:slide=fullframe:data=magnitude -an -c:v rawvideo magnitude.nut
  12867. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=lin:overlap=0.875:color=channel:slide=fullframe:data=phase -an -c:v rawvideo phase.nut
  12868. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  12869. @end example
  12870. @end itemize
  12871. @section split, asplit
  12872. Split input into several identical outputs.
  12873. @code{asplit} works with audio input, @code{split} with video.
  12874. The filter accepts a single parameter which specifies the number of outputs. If
  12875. unspecified, it defaults to 2.
  12876. @subsection Examples
  12877. @itemize
  12878. @item
  12879. Create two separate outputs from the same input:
  12880. @example
  12881. [in] split [out0][out1]
  12882. @end example
  12883. @item
  12884. To create 3 or more outputs, you need to specify the number of
  12885. outputs, like in:
  12886. @example
  12887. [in] asplit=3 [out0][out1][out2]
  12888. @end example
  12889. @item
  12890. Create two separate outputs from the same input, one cropped and
  12891. one padded:
  12892. @example
  12893. [in] split [splitout1][splitout2];
  12894. [splitout1] crop=100:100:0:0 [cropout];
  12895. [splitout2] pad=200:200:100:100 [padout];
  12896. @end example
  12897. @item
  12898. Create 5 copies of the input audio with @command{ffmpeg}:
  12899. @example
  12900. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  12901. @end example
  12902. @end itemize
  12903. @section zmq, azmq
  12904. Receive commands sent through a libzmq client, and forward them to
  12905. filters in the filtergraph.
  12906. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  12907. must be inserted between two video filters, @code{azmq} between two
  12908. audio filters.
  12909. To enable these filters you need to install the libzmq library and
  12910. headers and configure FFmpeg with @code{--enable-libzmq}.
  12911. For more information about libzmq see:
  12912. @url{http://www.zeromq.org/}
  12913. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  12914. receives messages sent through a network interface defined by the
  12915. @option{bind_address} option.
  12916. The received message must be in the form:
  12917. @example
  12918. @var{TARGET} @var{COMMAND} [@var{ARG}]
  12919. @end example
  12920. @var{TARGET} specifies the target of the command, usually the name of
  12921. the filter class or a specific filter instance name.
  12922. @var{COMMAND} specifies the name of the command for the target filter.
  12923. @var{ARG} is optional and specifies the optional argument list for the
  12924. given @var{COMMAND}.
  12925. Upon reception, the message is processed and the corresponding command
  12926. is injected into the filtergraph. Depending on the result, the filter
  12927. will send a reply to the client, adopting the format:
  12928. @example
  12929. @var{ERROR_CODE} @var{ERROR_REASON}
  12930. @var{MESSAGE}
  12931. @end example
  12932. @var{MESSAGE} is optional.
  12933. @subsection Examples
  12934. Look at @file{tools/zmqsend} for an example of a zmq client which can
  12935. be used to send commands processed by these filters.
  12936. Consider the following filtergraph generated by @command{ffplay}
  12937. @example
  12938. ffplay -dumpgraph 1 -f lavfi "
  12939. color=s=100x100:c=red [l];
  12940. color=s=100x100:c=blue [r];
  12941. nullsrc=s=200x100, zmq [bg];
  12942. [bg][l] overlay [bg+l];
  12943. [bg+l][r] overlay=x=100 "
  12944. @end example
  12945. To change the color of the left side of the video, the following
  12946. command can be used:
  12947. @example
  12948. echo Parsed_color_0 c yellow | tools/zmqsend
  12949. @end example
  12950. To change the right side:
  12951. @example
  12952. echo Parsed_color_1 c pink | tools/zmqsend
  12953. @end example
  12954. @c man end MULTIMEDIA FILTERS
  12955. @chapter Multimedia Sources
  12956. @c man begin MULTIMEDIA SOURCES
  12957. Below is a description of the currently available multimedia sources.
  12958. @section amovie
  12959. This is the same as @ref{movie} source, except it selects an audio
  12960. stream by default.
  12961. @anchor{movie}
  12962. @section movie
  12963. Read audio and/or video stream(s) from a movie container.
  12964. It accepts the following parameters:
  12965. @table @option
  12966. @item filename
  12967. The name of the resource to read (not necessarily a file; it can also be a
  12968. device or a stream accessed through some protocol).
  12969. @item format_name, f
  12970. Specifies the format assumed for the movie to read, and can be either
  12971. the name of a container or an input device. If not specified, the
  12972. format is guessed from @var{movie_name} or by probing.
  12973. @item seek_point, sp
  12974. Specifies the seek point in seconds. The frames will be output
  12975. starting from this seek point. The parameter is evaluated with
  12976. @code{av_strtod}, so the numerical value may be suffixed by an IS
  12977. postfix. The default value is "0".
  12978. @item streams, s
  12979. Specifies the streams to read. Several streams can be specified,
  12980. separated by "+". The source will then have as many outputs, in the
  12981. same order. The syntax is explained in the ``Stream specifiers''
  12982. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  12983. respectively the default (best suited) video and audio stream. Default
  12984. is "dv", or "da" if the filter is called as "amovie".
  12985. @item stream_index, si
  12986. Specifies the index of the video stream to read. If the value is -1,
  12987. the most suitable video stream will be automatically selected. The default
  12988. value is "-1". Deprecated. If the filter is called "amovie", it will select
  12989. audio instead of video.
  12990. @item loop
  12991. Specifies how many times to read the stream in sequence.
  12992. If the value is less than 1, the stream will be read again and again.
  12993. Default value is "1".
  12994. Note that when the movie is looped the source timestamps are not
  12995. changed, so it will generate non monotonically increasing timestamps.
  12996. @end table
  12997. It allows overlaying a second video on top of the main input of
  12998. a filtergraph, as shown in this graph:
  12999. @example
  13000. input -----------> deltapts0 --> overlay --> output
  13001. ^
  13002. |
  13003. movie --> scale--> deltapts1 -------+
  13004. @end example
  13005. @subsection Examples
  13006. @itemize
  13007. @item
  13008. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13009. on top of the input labelled "in":
  13010. @example
  13011. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13012. [in] setpts=PTS-STARTPTS [main];
  13013. [main][over] overlay=16:16 [out]
  13014. @end example
  13015. @item
  13016. Read from a video4linux2 device, and overlay it on top of the input
  13017. labelled "in":
  13018. @example
  13019. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13020. [in] setpts=PTS-STARTPTS [main];
  13021. [main][over] overlay=16:16 [out]
  13022. @end example
  13023. @item
  13024. Read the first video stream and the audio stream with id 0x81 from
  13025. dvd.vob; the video is connected to the pad named "video" and the audio is
  13026. connected to the pad named "audio":
  13027. @example
  13028. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13029. @end example
  13030. @end itemize
  13031. @subsection Commands
  13032. Both movie and amovie support the following commands:
  13033. @table @option
  13034. @item seek
  13035. Perform seek using "av_seek_frame".
  13036. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13037. @itemize
  13038. @item
  13039. @var{stream_index}: If stream_index is -1, a default
  13040. stream is selected, and @var{timestamp} is automatically converted
  13041. from AV_TIME_BASE units to the stream specific time_base.
  13042. @item
  13043. @var{timestamp}: Timestamp in AVStream.time_base units
  13044. or, if no stream is specified, in AV_TIME_BASE units.
  13045. @item
  13046. @var{flags}: Flags which select direction and seeking mode.
  13047. @end itemize
  13048. @item get_duration
  13049. Get movie duration in AV_TIME_BASE units.
  13050. @end table
  13051. @c man end MULTIMEDIA SOURCES