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.

17078 lines
458KB

  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. @item zero_phase
  1928. Enable zero phase mode by substracting timestamp to compensate delay.
  1929. Default is disabled.
  1930. @end table
  1931. @subsection Examples
  1932. @itemize
  1933. @item
  1934. lowpass at 1000 Hz:
  1935. @example
  1936. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  1937. @end example
  1938. @item
  1939. lowpass at 1000 Hz with gain_entry:
  1940. @example
  1941. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  1942. @end example
  1943. @item
  1944. custom equalization:
  1945. @example
  1946. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  1947. @end example
  1948. @item
  1949. higher delay with zero phase to compensate delay:
  1950. @example
  1951. firequalizer=delay=0.1:fixed=on:zero_phase=on
  1952. @end example
  1953. @item
  1954. lowpass on left channel, highpass on right channel:
  1955. @example
  1956. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  1957. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  1958. @end example
  1959. @end itemize
  1960. @section flanger
  1961. Apply a flanging effect to the audio.
  1962. The filter accepts the following options:
  1963. @table @option
  1964. @item delay
  1965. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1966. @item depth
  1967. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1968. @item regen
  1969. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1970. Default value is 0.
  1971. @item width
  1972. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1973. Default value is 71.
  1974. @item speed
  1975. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1976. @item shape
  1977. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1978. Default value is @var{sinusoidal}.
  1979. @item phase
  1980. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1981. Default value is 25.
  1982. @item interp
  1983. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1984. Default is @var{linear}.
  1985. @end table
  1986. @section highpass
  1987. Apply a high-pass filter with 3dB point frequency.
  1988. The filter can be either single-pole, or double-pole (the default).
  1989. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1990. The filter accepts the following options:
  1991. @table @option
  1992. @item frequency, f
  1993. Set frequency in Hz. Default is 3000.
  1994. @item poles, p
  1995. Set number of poles. Default is 2.
  1996. @item width_type
  1997. Set method to specify band-width of filter.
  1998. @table @option
  1999. @item h
  2000. Hz
  2001. @item q
  2002. Q-Factor
  2003. @item o
  2004. octave
  2005. @item s
  2006. slope
  2007. @end table
  2008. @item width, w
  2009. Specify the band-width of a filter in width_type units.
  2010. Applies only to double-pole filter.
  2011. The default is 0.707q and gives a Butterworth response.
  2012. @end table
  2013. @section join
  2014. Join multiple input streams into one multi-channel stream.
  2015. It accepts the following parameters:
  2016. @table @option
  2017. @item inputs
  2018. The number of input streams. It defaults to 2.
  2019. @item channel_layout
  2020. The desired output channel layout. It defaults to stereo.
  2021. @item map
  2022. Map channels from inputs to output. The argument is a '|'-separated list of
  2023. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2024. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2025. can be either the name of the input channel (e.g. FL for front left) or its
  2026. index in the specified input stream. @var{out_channel} is the name of the output
  2027. channel.
  2028. @end table
  2029. The filter will attempt to guess the mappings when they are not specified
  2030. explicitly. It does so by first trying to find an unused matching input channel
  2031. and if that fails it picks the first unused input channel.
  2032. Join 3 inputs (with properly set channel layouts):
  2033. @example
  2034. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2035. @end example
  2036. Build a 5.1 output from 6 single-channel streams:
  2037. @example
  2038. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2039. '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'
  2040. out
  2041. @end example
  2042. @section ladspa
  2043. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2044. To enable compilation of this filter you need to configure FFmpeg with
  2045. @code{--enable-ladspa}.
  2046. @table @option
  2047. @item file, f
  2048. Specifies the name of LADSPA plugin library to load. If the environment
  2049. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2050. each one of the directories specified by the colon separated list in
  2051. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2052. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2053. @file{/usr/lib/ladspa/}.
  2054. @item plugin, p
  2055. Specifies the plugin within the library. Some libraries contain only
  2056. one plugin, but others contain many of them. If this is not set filter
  2057. will list all available plugins within the specified library.
  2058. @item controls, c
  2059. Set the '|' separated list of controls which are zero or more floating point
  2060. values that determine the behavior of the loaded plugin (for example delay,
  2061. threshold or gain).
  2062. Controls need to be defined using the following syntax:
  2063. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2064. @var{valuei} is the value set on the @var{i}-th control.
  2065. Alternatively they can be also defined using the following syntax:
  2066. @var{value0}|@var{value1}|@var{value2}|..., where
  2067. @var{valuei} is the value set on the @var{i}-th control.
  2068. If @option{controls} is set to @code{help}, all available controls and
  2069. their valid ranges are printed.
  2070. @item sample_rate, s
  2071. Specify the sample rate, default to 44100. Only used if plugin have
  2072. zero inputs.
  2073. @item nb_samples, n
  2074. Set the number of samples per channel per each output frame, default
  2075. is 1024. Only used if plugin have zero inputs.
  2076. @item duration, d
  2077. Set the minimum duration of the sourced audio. See
  2078. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2079. for the accepted syntax.
  2080. Note that the resulting duration may be greater than the specified duration,
  2081. as the generated audio is always cut at the end of a complete frame.
  2082. If not specified, or the expressed duration is negative, the audio is
  2083. supposed to be generated forever.
  2084. Only used if plugin have zero inputs.
  2085. @end table
  2086. @subsection Examples
  2087. @itemize
  2088. @item
  2089. List all available plugins within amp (LADSPA example plugin) library:
  2090. @example
  2091. ladspa=file=amp
  2092. @end example
  2093. @item
  2094. List all available controls and their valid ranges for @code{vcf_notch}
  2095. plugin from @code{VCF} library:
  2096. @example
  2097. ladspa=f=vcf:p=vcf_notch:c=help
  2098. @end example
  2099. @item
  2100. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2101. plugin library:
  2102. @example
  2103. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2104. @end example
  2105. @item
  2106. Add reverberation to the audio using TAP-plugins
  2107. (Tom's Audio Processing plugins):
  2108. @example
  2109. ladspa=file=tap_reverb:tap_reverb
  2110. @end example
  2111. @item
  2112. Generate white noise, with 0.2 amplitude:
  2113. @example
  2114. ladspa=file=cmt:noise_source_white:c=c0=.2
  2115. @end example
  2116. @item
  2117. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2118. @code{C* Audio Plugin Suite} (CAPS) library:
  2119. @example
  2120. ladspa=file=caps:Click:c=c1=20'
  2121. @end example
  2122. @item
  2123. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2124. @example
  2125. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2126. @end example
  2127. @item
  2128. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2129. @code{SWH Plugins} collection:
  2130. @example
  2131. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2132. @end example
  2133. @item
  2134. Attenuate low frequencies using Multiband EQ from Steve Harris
  2135. @code{SWH Plugins} collection:
  2136. @example
  2137. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2138. @end example
  2139. @end itemize
  2140. @subsection Commands
  2141. This filter supports the following commands:
  2142. @table @option
  2143. @item cN
  2144. Modify the @var{N}-th control value.
  2145. If the specified value is not valid, it is ignored and prior one is kept.
  2146. @end table
  2147. @section loudnorm
  2148. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2149. Support for both single pass (livestreams, files) and double pass (files) modes.
  2150. This algorithm can target IL, LRA, and maximum true peak.
  2151. To enable compilation of this filter you need to configure FFmpeg with
  2152. @code{--enable-libebur128}.
  2153. The filter accepts the following options:
  2154. @table @option
  2155. @item I, i
  2156. Set integrated loudness target.
  2157. Range is -70.0 - -5.0. Default value is -24.0.
  2158. @item LRA, lra
  2159. Set loudness range target.
  2160. Range is 1.0 - 20.0. Default value is 7.0.
  2161. @item TP, tp
  2162. Set maximum true peak.
  2163. Range is -9.0 - +0.0. Default value is -2.0.
  2164. @item measured_I, measured_i
  2165. Measured IL of input file.
  2166. Range is -99.0 - +0.0.
  2167. @item measured_LRA, measured_lra
  2168. Measured LRA of input file.
  2169. Range is 0.0 - 99.0.
  2170. @item measured_TP, measured_tp
  2171. Measured true peak of input file.
  2172. Range is -99.0 - +99.0.
  2173. @item measured_thresh
  2174. Measured threshold of input file.
  2175. Range is -99.0 - +0.0.
  2176. @item offset
  2177. Set offset gain. Gain is applied before the true-peak limiter.
  2178. Range is -99.0 - +99.0. Default is +0.0.
  2179. @item linear
  2180. Normalize linearly if possible.
  2181. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2182. to be specified in order to use this mode.
  2183. Options are true or false. Default is true.
  2184. @item dual_mono
  2185. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2186. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2187. If set to @code{true}, this option will compensate for this effect.
  2188. Multi-channel input files are not affected by this option.
  2189. Options are true or false. Default is false.
  2190. @item print_format
  2191. Set print format for stats. Options are summary, json, or none.
  2192. Default value is none.
  2193. @end table
  2194. @section lowpass
  2195. Apply a low-pass filter with 3dB point frequency.
  2196. The filter can be either single-pole or double-pole (the default).
  2197. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2198. The filter accepts the following options:
  2199. @table @option
  2200. @item frequency, f
  2201. Set frequency in Hz. Default is 500.
  2202. @item poles, p
  2203. Set number of poles. Default is 2.
  2204. @item width_type
  2205. Set method to specify band-width of filter.
  2206. @table @option
  2207. @item h
  2208. Hz
  2209. @item q
  2210. Q-Factor
  2211. @item o
  2212. octave
  2213. @item s
  2214. slope
  2215. @end table
  2216. @item width, w
  2217. Specify the band-width of a filter in width_type units.
  2218. Applies only to double-pole filter.
  2219. The default is 0.707q and gives a Butterworth response.
  2220. @end table
  2221. @anchor{pan}
  2222. @section pan
  2223. Mix channels with specific gain levels. The filter accepts the output
  2224. channel layout followed by a set of channels definitions.
  2225. This filter is also designed to efficiently remap the channels of an audio
  2226. stream.
  2227. The filter accepts parameters of the form:
  2228. "@var{l}|@var{outdef}|@var{outdef}|..."
  2229. @table @option
  2230. @item l
  2231. output channel layout or number of channels
  2232. @item outdef
  2233. output channel specification, of the form:
  2234. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2235. @item out_name
  2236. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2237. number (c0, c1, etc.)
  2238. @item gain
  2239. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2240. @item in_name
  2241. input channel to use, see out_name for details; it is not possible to mix
  2242. named and numbered input channels
  2243. @end table
  2244. If the `=' in a channel specification is replaced by `<', then the gains for
  2245. that specification will be renormalized so that the total is 1, thus
  2246. avoiding clipping noise.
  2247. @subsection Mixing examples
  2248. For example, if you want to down-mix from stereo to mono, but with a bigger
  2249. factor for the left channel:
  2250. @example
  2251. pan=1c|c0=0.9*c0+0.1*c1
  2252. @end example
  2253. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2254. 7-channels surround:
  2255. @example
  2256. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2257. @end example
  2258. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2259. that should be preferred (see "-ac" option) unless you have very specific
  2260. needs.
  2261. @subsection Remapping examples
  2262. The channel remapping will be effective if, and only if:
  2263. @itemize
  2264. @item gain coefficients are zeroes or ones,
  2265. @item only one input per channel output,
  2266. @end itemize
  2267. If all these conditions are satisfied, the filter will notify the user ("Pure
  2268. channel mapping detected"), and use an optimized and lossless method to do the
  2269. remapping.
  2270. For example, if you have a 5.1 source and want a stereo audio stream by
  2271. dropping the extra channels:
  2272. @example
  2273. pan="stereo| c0=FL | c1=FR"
  2274. @end example
  2275. Given the same source, you can also switch front left and front right channels
  2276. and keep the input channel layout:
  2277. @example
  2278. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2279. @end example
  2280. If the input is a stereo audio stream, you can mute the front left channel (and
  2281. still keep the stereo channel layout) with:
  2282. @example
  2283. pan="stereo|c1=c1"
  2284. @end example
  2285. Still with a stereo audio stream input, you can copy the right channel in both
  2286. front left and right:
  2287. @example
  2288. pan="stereo| c0=FR | c1=FR"
  2289. @end example
  2290. @section replaygain
  2291. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2292. outputs it unchanged.
  2293. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2294. @section resample
  2295. Convert the audio sample format, sample rate and channel layout. It is
  2296. not meant to be used directly.
  2297. @section rubberband
  2298. Apply time-stretching and pitch-shifting with librubberband.
  2299. The filter accepts the following options:
  2300. @table @option
  2301. @item tempo
  2302. Set tempo scale factor.
  2303. @item pitch
  2304. Set pitch scale factor.
  2305. @item transients
  2306. Set transients detector.
  2307. Possible values are:
  2308. @table @var
  2309. @item crisp
  2310. @item mixed
  2311. @item smooth
  2312. @end table
  2313. @item detector
  2314. Set detector.
  2315. Possible values are:
  2316. @table @var
  2317. @item compound
  2318. @item percussive
  2319. @item soft
  2320. @end table
  2321. @item phase
  2322. Set phase.
  2323. Possible values are:
  2324. @table @var
  2325. @item laminar
  2326. @item independent
  2327. @end table
  2328. @item window
  2329. Set processing window size.
  2330. Possible values are:
  2331. @table @var
  2332. @item standard
  2333. @item short
  2334. @item long
  2335. @end table
  2336. @item smoothing
  2337. Set smoothing.
  2338. Possible values are:
  2339. @table @var
  2340. @item off
  2341. @item on
  2342. @end table
  2343. @item formant
  2344. Enable formant preservation when shift pitching.
  2345. Possible values are:
  2346. @table @var
  2347. @item shifted
  2348. @item preserved
  2349. @end table
  2350. @item pitchq
  2351. Set pitch quality.
  2352. Possible values are:
  2353. @table @var
  2354. @item quality
  2355. @item speed
  2356. @item consistency
  2357. @end table
  2358. @item channels
  2359. Set channels.
  2360. Possible values are:
  2361. @table @var
  2362. @item apart
  2363. @item together
  2364. @end table
  2365. @end table
  2366. @section sidechaincompress
  2367. This filter acts like normal compressor but has the ability to compress
  2368. detected signal using second input signal.
  2369. It needs two input streams and returns one output stream.
  2370. First input stream will be processed depending on second stream signal.
  2371. The filtered signal then can be filtered with other filters in later stages of
  2372. processing. See @ref{pan} and @ref{amerge} filter.
  2373. The filter accepts the following options:
  2374. @table @option
  2375. @item level_in
  2376. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2377. @item threshold
  2378. If a signal of second stream raises above this level it will affect the gain
  2379. reduction of first stream.
  2380. By default is 0.125. Range is between 0.00097563 and 1.
  2381. @item ratio
  2382. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2383. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2384. Default is 2. Range is between 1 and 20.
  2385. @item attack
  2386. Amount of milliseconds the signal has to rise above the threshold before gain
  2387. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2388. @item release
  2389. Amount of milliseconds the signal has to fall below the threshold before
  2390. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2391. @item makeup
  2392. Set the amount by how much signal will be amplified after processing.
  2393. Default is 2. Range is from 1 and 64.
  2394. @item knee
  2395. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2396. Default is 2.82843. Range is between 1 and 8.
  2397. @item link
  2398. Choose if the @code{average} level between all channels of side-chain stream
  2399. or the louder(@code{maximum}) channel of side-chain stream affects the
  2400. reduction. Default is @code{average}.
  2401. @item detection
  2402. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2403. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2404. @item level_sc
  2405. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2406. @item mix
  2407. How much to use compressed signal in output. Default is 1.
  2408. Range is between 0 and 1.
  2409. @end table
  2410. @subsection Examples
  2411. @itemize
  2412. @item
  2413. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2414. depending on the signal of 2nd input and later compressed signal to be
  2415. merged with 2nd input:
  2416. @example
  2417. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2418. @end example
  2419. @end itemize
  2420. @section sidechaingate
  2421. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2422. filter the detected signal before sending it to the gain reduction stage.
  2423. Normally a gate uses the full range signal to detect a level above the
  2424. threshold.
  2425. For example: If you cut all lower frequencies from your sidechain signal
  2426. the gate will decrease the volume of your track only if not enough highs
  2427. appear. With this technique you are able to reduce the resonation of a
  2428. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2429. guitar.
  2430. It needs two input streams and returns one output stream.
  2431. First input stream will be processed depending on second stream signal.
  2432. The filter accepts the following options:
  2433. @table @option
  2434. @item level_in
  2435. Set input level before filtering.
  2436. Default is 1. Allowed range is from 0.015625 to 64.
  2437. @item range
  2438. Set the level of gain reduction when the signal is below the threshold.
  2439. Default is 0.06125. Allowed range is from 0 to 1.
  2440. @item threshold
  2441. If a signal rises above this level the gain reduction is released.
  2442. Default is 0.125. Allowed range is from 0 to 1.
  2443. @item ratio
  2444. Set a ratio about which the signal is reduced.
  2445. Default is 2. Allowed range is from 1 to 9000.
  2446. @item attack
  2447. Amount of milliseconds the signal has to rise above the threshold before gain
  2448. reduction stops.
  2449. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2450. @item release
  2451. Amount of milliseconds the signal has to fall below the threshold before the
  2452. reduction is increased again. Default is 250 milliseconds.
  2453. Allowed range is from 0.01 to 9000.
  2454. @item makeup
  2455. Set amount of amplification of signal after processing.
  2456. Default is 1. Allowed range is from 1 to 64.
  2457. @item knee
  2458. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2459. Default is 2.828427125. Allowed range is from 1 to 8.
  2460. @item detection
  2461. Choose if exact signal should be taken for detection or an RMS like one.
  2462. Default is rms. Can be peak or rms.
  2463. @item link
  2464. Choose if the average level between all channels or the louder channel affects
  2465. the reduction.
  2466. Default is average. Can be average or maximum.
  2467. @item level_sc
  2468. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2469. @end table
  2470. @section silencedetect
  2471. Detect silence in an audio stream.
  2472. This filter logs a message when it detects that the input audio volume is less
  2473. or equal to a noise tolerance value for a duration greater or equal to the
  2474. minimum detected noise duration.
  2475. The printed times and duration are expressed in seconds.
  2476. The filter accepts the following options:
  2477. @table @option
  2478. @item duration, d
  2479. Set silence duration until notification (default is 2 seconds).
  2480. @item noise, n
  2481. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2482. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2483. @end table
  2484. @subsection Examples
  2485. @itemize
  2486. @item
  2487. Detect 5 seconds of silence with -50dB noise tolerance:
  2488. @example
  2489. silencedetect=n=-50dB:d=5
  2490. @end example
  2491. @item
  2492. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2493. tolerance in @file{silence.mp3}:
  2494. @example
  2495. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2496. @end example
  2497. @end itemize
  2498. @section silenceremove
  2499. Remove silence from the beginning, middle or end of the audio.
  2500. The filter accepts the following options:
  2501. @table @option
  2502. @item start_periods
  2503. This value is used to indicate if audio should be trimmed at beginning of
  2504. the audio. A value of zero indicates no silence should be trimmed from the
  2505. beginning. When specifying a non-zero value, it trims audio up until it
  2506. finds non-silence. Normally, when trimming silence from beginning of audio
  2507. the @var{start_periods} will be @code{1} but it can be increased to higher
  2508. values to trim all audio up to specific count of non-silence periods.
  2509. Default value is @code{0}.
  2510. @item start_duration
  2511. Specify the amount of time that non-silence must be detected before it stops
  2512. trimming audio. By increasing the duration, bursts of noises can be treated
  2513. as silence and trimmed off. Default value is @code{0}.
  2514. @item start_threshold
  2515. This indicates what sample value should be treated as silence. For digital
  2516. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2517. you may wish to increase the value to account for background noise.
  2518. Can be specified in dB (in case "dB" is appended to the specified value)
  2519. or amplitude ratio. Default value is @code{0}.
  2520. @item stop_periods
  2521. Set the count for trimming silence from the end of audio.
  2522. To remove silence from the middle of a file, specify a @var{stop_periods}
  2523. that is negative. This value is then treated as a positive value and is
  2524. used to indicate the effect should restart processing as specified by
  2525. @var{start_periods}, making it suitable for removing periods of silence
  2526. in the middle of the audio.
  2527. Default value is @code{0}.
  2528. @item stop_duration
  2529. Specify a duration of silence that must exist before audio is not copied any
  2530. more. By specifying a higher duration, silence that is wanted can be left in
  2531. the audio.
  2532. Default value is @code{0}.
  2533. @item stop_threshold
  2534. This is the same as @option{start_threshold} but for trimming silence from
  2535. the end of audio.
  2536. Can be specified in dB (in case "dB" is appended to the specified value)
  2537. or amplitude ratio. Default value is @code{0}.
  2538. @item leave_silence
  2539. This indicate that @var{stop_duration} length of audio should be left intact
  2540. at the beginning of each period of silence.
  2541. For example, if you want to remove long pauses between words but do not want
  2542. to remove the pauses completely. Default value is @code{0}.
  2543. @item detection
  2544. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2545. and works better with digital silence which is exactly 0.
  2546. Default value is @code{rms}.
  2547. @item window
  2548. Set ratio used to calculate size of window for detecting silence.
  2549. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2550. @end table
  2551. @subsection Examples
  2552. @itemize
  2553. @item
  2554. The following example shows how this filter can be used to start a recording
  2555. that does not contain the delay at the start which usually occurs between
  2556. pressing the record button and the start of the performance:
  2557. @example
  2558. silenceremove=1:5:0.02
  2559. @end example
  2560. @item
  2561. Trim all silence encountered from beginning to end where there is more than 1
  2562. second of silence in audio:
  2563. @example
  2564. silenceremove=0:0:0:-1:1:-90dB
  2565. @end example
  2566. @end itemize
  2567. @section sofalizer
  2568. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2569. loudspeakers around the user for binaural listening via headphones (audio
  2570. formats up to 9 channels supported).
  2571. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2572. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2573. Austrian Academy of Sciences.
  2574. To enable compilation of this filter you need to configure FFmpeg with
  2575. @code{--enable-netcdf}.
  2576. The filter accepts the following options:
  2577. @table @option
  2578. @item sofa
  2579. Set the SOFA file used for rendering.
  2580. @item gain
  2581. Set gain applied to audio. Value is in dB. Default is 0.
  2582. @item rotation
  2583. Set rotation of virtual loudspeakers in deg. Default is 0.
  2584. @item elevation
  2585. Set elevation of virtual speakers in deg. Default is 0.
  2586. @item radius
  2587. Set distance in meters between loudspeakers and the listener with near-field
  2588. HRTFs. Default is 1.
  2589. @item type
  2590. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2591. processing audio in time domain which is slow.
  2592. @var{freq} is processing audio in frequency domain which is fast.
  2593. Default is @var{freq}.
  2594. @item speakers
  2595. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2596. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2597. Each virtual loudspeaker is described with short channel name following with
  2598. azimuth and elevation in degreees.
  2599. Each virtual loudspeaker description is separated by '|'.
  2600. For example to override front left and front right channel positions use:
  2601. 'speakers=FL 45 15|FR 345 15'.
  2602. Descriptions with unrecognised channel names are ignored.
  2603. @end table
  2604. @subsection Examples
  2605. @itemize
  2606. @item
  2607. Using ClubFritz6 sofa file:
  2608. @example
  2609. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2610. @end example
  2611. @item
  2612. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2613. @example
  2614. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2615. @end example
  2616. @item
  2617. Similar as above but with custom speaker positions for front left, front right, rear left and rear right
  2618. and also with custom gain:
  2619. @example
  2620. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|RL 135|RR 225:gain=28"
  2621. @end example
  2622. @end itemize
  2623. @section stereotools
  2624. This filter has some handy utilities to manage stereo signals, for converting
  2625. M/S stereo recordings to L/R signal while having control over the parameters
  2626. or spreading the stereo image of master track.
  2627. The filter accepts the following options:
  2628. @table @option
  2629. @item level_in
  2630. Set input level before filtering for both channels. Defaults is 1.
  2631. Allowed range is from 0.015625 to 64.
  2632. @item level_out
  2633. Set output level after filtering for both channels. Defaults is 1.
  2634. Allowed range is from 0.015625 to 64.
  2635. @item balance_in
  2636. Set input balance between both channels. Default is 0.
  2637. Allowed range is from -1 to 1.
  2638. @item balance_out
  2639. Set output balance between both channels. Default is 0.
  2640. Allowed range is from -1 to 1.
  2641. @item softclip
  2642. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2643. clipping. Disabled by default.
  2644. @item mutel
  2645. Mute the left channel. Disabled by default.
  2646. @item muter
  2647. Mute the right channel. Disabled by default.
  2648. @item phasel
  2649. Change the phase of the left channel. Disabled by default.
  2650. @item phaser
  2651. Change the phase of the right channel. Disabled by default.
  2652. @item mode
  2653. Set stereo mode. Available values are:
  2654. @table @samp
  2655. @item lr>lr
  2656. Left/Right to Left/Right, this is default.
  2657. @item lr>ms
  2658. Left/Right to Mid/Side.
  2659. @item ms>lr
  2660. Mid/Side to Left/Right.
  2661. @item lr>ll
  2662. Left/Right to Left/Left.
  2663. @item lr>rr
  2664. Left/Right to Right/Right.
  2665. @item lr>l+r
  2666. Left/Right to Left + Right.
  2667. @item lr>rl
  2668. Left/Right to Right/Left.
  2669. @end table
  2670. @item slev
  2671. Set level of side signal. Default is 1.
  2672. Allowed range is from 0.015625 to 64.
  2673. @item sbal
  2674. Set balance of side signal. Default is 0.
  2675. Allowed range is from -1 to 1.
  2676. @item mlev
  2677. Set level of the middle signal. Default is 1.
  2678. Allowed range is from 0.015625 to 64.
  2679. @item mpan
  2680. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2681. @item base
  2682. Set stereo base between mono and inversed channels. Default is 0.
  2683. Allowed range is from -1 to 1.
  2684. @item delay
  2685. Set delay in milliseconds how much to delay left from right channel and
  2686. vice versa. Default is 0. Allowed range is from -20 to 20.
  2687. @item sclevel
  2688. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2689. @item phase
  2690. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2691. @end table
  2692. @subsection Examples
  2693. @itemize
  2694. @item
  2695. Apply karaoke like effect:
  2696. @example
  2697. stereotools=mlev=0.015625
  2698. @end example
  2699. @item
  2700. Convert M/S signal to L/R:
  2701. @example
  2702. "stereotools=mode=ms>lr"
  2703. @end example
  2704. @end itemize
  2705. @section stereowiden
  2706. This filter enhance the stereo effect by suppressing signal common to both
  2707. channels and by delaying the signal of left into right and vice versa,
  2708. thereby widening the stereo effect.
  2709. The filter accepts the following options:
  2710. @table @option
  2711. @item delay
  2712. Time in milliseconds of the delay of left signal into right and vice versa.
  2713. Default is 20 milliseconds.
  2714. @item feedback
  2715. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2716. effect of left signal in right output and vice versa which gives widening
  2717. effect. Default is 0.3.
  2718. @item crossfeed
  2719. Cross feed of left into right with inverted phase. This helps in suppressing
  2720. the mono. If the value is 1 it will cancel all the signal common to both
  2721. channels. Default is 0.3.
  2722. @item drymix
  2723. Set level of input signal of original channel. Default is 0.8.
  2724. @end table
  2725. @section scale_npp
  2726. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  2727. format conversion on CUDA video frames. Setting the output width and height
  2728. works in the same way as for the @var{scale} filter.
  2729. The following additional options are accepted:
  2730. @table @option
  2731. @item format
  2732. The pixel format of the output CUDA frames. If set to the string "same" (the
  2733. default), the input format will be kept. Note that automatic format negotiation
  2734. and conversion is not yet supported for hardware frames
  2735. @item interp_algo
  2736. The interpolation algorithm used for resizing. One of the following:
  2737. @table @option
  2738. @item nn
  2739. Nearest neighbour.
  2740. @item linear
  2741. @item cubic
  2742. @item cubic2p_bspline
  2743. 2-parameter cubic (B=1, C=0)
  2744. @item cubic2p_catmullrom
  2745. 2-parameter cubic (B=0, C=1/2)
  2746. @item cubic2p_b05c03
  2747. 2-parameter cubic (B=1/2, C=3/10)
  2748. @item super
  2749. Supersampling
  2750. @item lanczos
  2751. @end table
  2752. @end table
  2753. @section select
  2754. Select frames to pass in output.
  2755. @section treble
  2756. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2757. shelving filter with a response similar to that of a standard
  2758. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2759. The filter accepts the following options:
  2760. @table @option
  2761. @item gain, g
  2762. Give the gain at whichever is the lower of ~22 kHz and the
  2763. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2764. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2765. @item frequency, f
  2766. Set the filter's central frequency and so can be used
  2767. to extend or reduce the frequency range to be boosted or cut.
  2768. The default value is @code{3000} Hz.
  2769. @item width_type
  2770. Set method to specify band-width of filter.
  2771. @table @option
  2772. @item h
  2773. Hz
  2774. @item q
  2775. Q-Factor
  2776. @item o
  2777. octave
  2778. @item s
  2779. slope
  2780. @end table
  2781. @item width, w
  2782. Determine how steep is the filter's shelf transition.
  2783. @end table
  2784. @section tremolo
  2785. Sinusoidal amplitude modulation.
  2786. The filter accepts the following options:
  2787. @table @option
  2788. @item f
  2789. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2790. (20 Hz or lower) will result in a tremolo effect.
  2791. This filter may also be used as a ring modulator by specifying
  2792. a modulation frequency higher than 20 Hz.
  2793. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2794. @item d
  2795. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2796. Default value is 0.5.
  2797. @end table
  2798. @section vibrato
  2799. Sinusoidal phase modulation.
  2800. The filter accepts the following options:
  2801. @table @option
  2802. @item f
  2803. Modulation frequency in Hertz.
  2804. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2805. @item d
  2806. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2807. Default value is 0.5.
  2808. @end table
  2809. @section volume
  2810. Adjust the input audio volume.
  2811. It accepts the following parameters:
  2812. @table @option
  2813. @item volume
  2814. Set audio volume expression.
  2815. Output values are clipped to the maximum value.
  2816. The output audio volume is given by the relation:
  2817. @example
  2818. @var{output_volume} = @var{volume} * @var{input_volume}
  2819. @end example
  2820. The default value for @var{volume} is "1.0".
  2821. @item precision
  2822. This parameter represents the mathematical precision.
  2823. It determines which input sample formats will be allowed, which affects the
  2824. precision of the volume scaling.
  2825. @table @option
  2826. @item fixed
  2827. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2828. @item float
  2829. 32-bit floating-point; this limits input sample format to FLT. (default)
  2830. @item double
  2831. 64-bit floating-point; this limits input sample format to DBL.
  2832. @end table
  2833. @item replaygain
  2834. Choose the behaviour on encountering ReplayGain side data in input frames.
  2835. @table @option
  2836. @item drop
  2837. Remove ReplayGain side data, ignoring its contents (the default).
  2838. @item ignore
  2839. Ignore ReplayGain side data, but leave it in the frame.
  2840. @item track
  2841. Prefer the track gain, if present.
  2842. @item album
  2843. Prefer the album gain, if present.
  2844. @end table
  2845. @item replaygain_preamp
  2846. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2847. Default value for @var{replaygain_preamp} is 0.0.
  2848. @item eval
  2849. Set when the volume expression is evaluated.
  2850. It accepts the following values:
  2851. @table @samp
  2852. @item once
  2853. only evaluate expression once during the filter initialization, or
  2854. when the @samp{volume} command is sent
  2855. @item frame
  2856. evaluate expression for each incoming frame
  2857. @end table
  2858. Default value is @samp{once}.
  2859. @end table
  2860. The volume expression can contain the following parameters.
  2861. @table @option
  2862. @item n
  2863. frame number (starting at zero)
  2864. @item nb_channels
  2865. number of channels
  2866. @item nb_consumed_samples
  2867. number of samples consumed by the filter
  2868. @item nb_samples
  2869. number of samples in the current frame
  2870. @item pos
  2871. original frame position in the file
  2872. @item pts
  2873. frame PTS
  2874. @item sample_rate
  2875. sample rate
  2876. @item startpts
  2877. PTS at start of stream
  2878. @item startt
  2879. time at start of stream
  2880. @item t
  2881. frame time
  2882. @item tb
  2883. timestamp timebase
  2884. @item volume
  2885. last set volume value
  2886. @end table
  2887. Note that when @option{eval} is set to @samp{once} only the
  2888. @var{sample_rate} and @var{tb} variables are available, all other
  2889. variables will evaluate to NAN.
  2890. @subsection Commands
  2891. This filter supports the following commands:
  2892. @table @option
  2893. @item volume
  2894. Modify the volume expression.
  2895. The command accepts the same syntax of the corresponding option.
  2896. If the specified expression is not valid, it is kept at its current
  2897. value.
  2898. @item replaygain_noclip
  2899. Prevent clipping by limiting the gain applied.
  2900. Default value for @var{replaygain_noclip} is 1.
  2901. @end table
  2902. @subsection Examples
  2903. @itemize
  2904. @item
  2905. Halve the input audio volume:
  2906. @example
  2907. volume=volume=0.5
  2908. volume=volume=1/2
  2909. volume=volume=-6.0206dB
  2910. @end example
  2911. In all the above example the named key for @option{volume} can be
  2912. omitted, for example like in:
  2913. @example
  2914. volume=0.5
  2915. @end example
  2916. @item
  2917. Increase input audio power by 6 decibels using fixed-point precision:
  2918. @example
  2919. volume=volume=6dB:precision=fixed
  2920. @end example
  2921. @item
  2922. Fade volume after time 10 with an annihilation period of 5 seconds:
  2923. @example
  2924. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2925. @end example
  2926. @end itemize
  2927. @section volumedetect
  2928. Detect the volume of the input video.
  2929. The filter has no parameters. The input is not modified. Statistics about
  2930. the volume will be printed in the log when the input stream end is reached.
  2931. In particular it will show the mean volume (root mean square), maximum
  2932. volume (on a per-sample basis), and the beginning of a histogram of the
  2933. registered volume values (from the maximum value to a cumulated 1/1000 of
  2934. the samples).
  2935. All volumes are in decibels relative to the maximum PCM value.
  2936. @subsection Examples
  2937. Here is an excerpt of the output:
  2938. @example
  2939. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2940. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2941. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2942. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2943. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2944. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2945. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2946. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2947. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2948. @end example
  2949. It means that:
  2950. @itemize
  2951. @item
  2952. The mean square energy is approximately -27 dB, or 10^-2.7.
  2953. @item
  2954. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2955. @item
  2956. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2957. @end itemize
  2958. In other words, raising the volume by +4 dB does not cause any clipping,
  2959. raising it by +5 dB causes clipping for 6 samples, etc.
  2960. @c man end AUDIO FILTERS
  2961. @chapter Audio Sources
  2962. @c man begin AUDIO SOURCES
  2963. Below is a description of the currently available audio sources.
  2964. @section abuffer
  2965. Buffer audio frames, and make them available to the filter chain.
  2966. This source is mainly intended for a programmatic use, in particular
  2967. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2968. It accepts the following parameters:
  2969. @table @option
  2970. @item time_base
  2971. The timebase which will be used for timestamps of submitted frames. It must be
  2972. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2973. @item sample_rate
  2974. The sample rate of the incoming audio buffers.
  2975. @item sample_fmt
  2976. The sample format of the incoming audio buffers.
  2977. Either a sample format name or its corresponding integer representation from
  2978. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2979. @item channel_layout
  2980. The channel layout of the incoming audio buffers.
  2981. Either a channel layout name from channel_layout_map in
  2982. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2983. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2984. @item channels
  2985. The number of channels of the incoming audio buffers.
  2986. If both @var{channels} and @var{channel_layout} are specified, then they
  2987. must be consistent.
  2988. @end table
  2989. @subsection Examples
  2990. @example
  2991. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2992. @end example
  2993. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2994. Since the sample format with name "s16p" corresponds to the number
  2995. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2996. equivalent to:
  2997. @example
  2998. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2999. @end example
  3000. @section aevalsrc
  3001. Generate an audio signal specified by an expression.
  3002. This source accepts in input one or more expressions (one for each
  3003. channel), which are evaluated and used to generate a corresponding
  3004. audio signal.
  3005. This source accepts the following options:
  3006. @table @option
  3007. @item exprs
  3008. Set the '|'-separated expressions list for each separate channel. In case the
  3009. @option{channel_layout} option is not specified, the selected channel layout
  3010. depends on the number of provided expressions. Otherwise the last
  3011. specified expression is applied to the remaining output channels.
  3012. @item channel_layout, c
  3013. Set the channel layout. The number of channels in the specified layout
  3014. must be equal to the number of specified expressions.
  3015. @item duration, d
  3016. Set the minimum duration of the sourced audio. See
  3017. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3018. for the accepted syntax.
  3019. Note that the resulting duration may be greater than the specified
  3020. duration, as the generated audio is always cut at the end of a
  3021. complete frame.
  3022. If not specified, or the expressed duration is negative, the audio is
  3023. supposed to be generated forever.
  3024. @item nb_samples, n
  3025. Set the number of samples per channel per each output frame,
  3026. default to 1024.
  3027. @item sample_rate, s
  3028. Specify the sample rate, default to 44100.
  3029. @end table
  3030. Each expression in @var{exprs} can contain the following constants:
  3031. @table @option
  3032. @item n
  3033. number of the evaluated sample, starting from 0
  3034. @item t
  3035. time of the evaluated sample expressed in seconds, starting from 0
  3036. @item s
  3037. sample rate
  3038. @end table
  3039. @subsection Examples
  3040. @itemize
  3041. @item
  3042. Generate silence:
  3043. @example
  3044. aevalsrc=0
  3045. @end example
  3046. @item
  3047. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3048. 8000 Hz:
  3049. @example
  3050. aevalsrc="sin(440*2*PI*t):s=8000"
  3051. @end example
  3052. @item
  3053. Generate a two channels signal, specify the channel layout (Front
  3054. Center + Back Center) explicitly:
  3055. @example
  3056. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3057. @end example
  3058. @item
  3059. Generate white noise:
  3060. @example
  3061. aevalsrc="-2+random(0)"
  3062. @end example
  3063. @item
  3064. Generate an amplitude modulated signal:
  3065. @example
  3066. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3067. @end example
  3068. @item
  3069. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3070. @example
  3071. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3072. @end example
  3073. @end itemize
  3074. @section anullsrc
  3075. The null audio source, return unprocessed audio frames. It is mainly useful
  3076. as a template and to be employed in analysis / debugging tools, or as
  3077. the source for filters which ignore the input data (for example the sox
  3078. synth filter).
  3079. This source accepts the following options:
  3080. @table @option
  3081. @item channel_layout, cl
  3082. Specifies the channel layout, and can be either an integer or a string
  3083. representing a channel layout. The default value of @var{channel_layout}
  3084. is "stereo".
  3085. Check the channel_layout_map definition in
  3086. @file{libavutil/channel_layout.c} for the mapping between strings and
  3087. channel layout values.
  3088. @item sample_rate, r
  3089. Specifies the sample rate, and defaults to 44100.
  3090. @item nb_samples, n
  3091. Set the number of samples per requested frames.
  3092. @end table
  3093. @subsection Examples
  3094. @itemize
  3095. @item
  3096. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3097. @example
  3098. anullsrc=r=48000:cl=4
  3099. @end example
  3100. @item
  3101. Do the same operation with a more obvious syntax:
  3102. @example
  3103. anullsrc=r=48000:cl=mono
  3104. @end example
  3105. @end itemize
  3106. All the parameters need to be explicitly defined.
  3107. @section flite
  3108. Synthesize a voice utterance using the libflite library.
  3109. To enable compilation of this filter you need to configure FFmpeg with
  3110. @code{--enable-libflite}.
  3111. Note that the flite library is not thread-safe.
  3112. The filter accepts the following options:
  3113. @table @option
  3114. @item list_voices
  3115. If set to 1, list the names of the available voices and exit
  3116. immediately. Default value is 0.
  3117. @item nb_samples, n
  3118. Set the maximum number of samples per frame. Default value is 512.
  3119. @item textfile
  3120. Set the filename containing the text to speak.
  3121. @item text
  3122. Set the text to speak.
  3123. @item voice, v
  3124. Set the voice to use for the speech synthesis. Default value is
  3125. @code{kal}. See also the @var{list_voices} option.
  3126. @end table
  3127. @subsection Examples
  3128. @itemize
  3129. @item
  3130. Read from file @file{speech.txt}, and synthesize the text using the
  3131. standard flite voice:
  3132. @example
  3133. flite=textfile=speech.txt
  3134. @end example
  3135. @item
  3136. Read the specified text selecting the @code{slt} voice:
  3137. @example
  3138. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3139. @end example
  3140. @item
  3141. Input text to ffmpeg:
  3142. @example
  3143. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3144. @end example
  3145. @item
  3146. Make @file{ffplay} speak the specified text, using @code{flite} and
  3147. the @code{lavfi} device:
  3148. @example
  3149. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3150. @end example
  3151. @end itemize
  3152. For more information about libflite, check:
  3153. @url{http://www.speech.cs.cmu.edu/flite/}
  3154. @section anoisesrc
  3155. Generate a noise audio signal.
  3156. The filter accepts the following options:
  3157. @table @option
  3158. @item sample_rate, r
  3159. Specify the sample rate. Default value is 48000 Hz.
  3160. @item amplitude, a
  3161. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3162. is 1.0.
  3163. @item duration, d
  3164. Specify the duration of the generated audio stream. Not specifying this option
  3165. results in noise with an infinite length.
  3166. @item color, colour, c
  3167. Specify the color of noise. Available noise colors are white, pink, and brown.
  3168. Default color is white.
  3169. @item seed, s
  3170. Specify a value used to seed the PRNG.
  3171. @item nb_samples, n
  3172. Set the number of samples per each output frame, default is 1024.
  3173. @end table
  3174. @subsection Examples
  3175. @itemize
  3176. @item
  3177. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3178. @example
  3179. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3180. @end example
  3181. @end itemize
  3182. @section sine
  3183. Generate an audio signal made of a sine wave with amplitude 1/8.
  3184. The audio signal is bit-exact.
  3185. The filter accepts the following options:
  3186. @table @option
  3187. @item frequency, f
  3188. Set the carrier frequency. Default is 440 Hz.
  3189. @item beep_factor, b
  3190. Enable a periodic beep every second with frequency @var{beep_factor} times
  3191. the carrier frequency. Default is 0, meaning the beep is disabled.
  3192. @item sample_rate, r
  3193. Specify the sample rate, default is 44100.
  3194. @item duration, d
  3195. Specify the duration of the generated audio stream.
  3196. @item samples_per_frame
  3197. Set the number of samples per output frame.
  3198. The expression can contain the following constants:
  3199. @table @option
  3200. @item n
  3201. The (sequential) number of the output audio frame, starting from 0.
  3202. @item pts
  3203. The PTS (Presentation TimeStamp) of the output audio frame,
  3204. expressed in @var{TB} units.
  3205. @item t
  3206. The PTS of the output audio frame, expressed in seconds.
  3207. @item TB
  3208. The timebase of the output audio frames.
  3209. @end table
  3210. Default is @code{1024}.
  3211. @end table
  3212. @subsection Examples
  3213. @itemize
  3214. @item
  3215. Generate a simple 440 Hz sine wave:
  3216. @example
  3217. sine
  3218. @end example
  3219. @item
  3220. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3221. @example
  3222. sine=220:4:d=5
  3223. sine=f=220:b=4:d=5
  3224. sine=frequency=220:beep_factor=4:duration=5
  3225. @end example
  3226. @item
  3227. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3228. pattern:
  3229. @example
  3230. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3231. @end example
  3232. @end itemize
  3233. @c man end AUDIO SOURCES
  3234. @chapter Audio Sinks
  3235. @c man begin AUDIO SINKS
  3236. Below is a description of the currently available audio sinks.
  3237. @section abuffersink
  3238. Buffer audio frames, and make them available to the end of filter chain.
  3239. This sink is mainly intended for programmatic use, in particular
  3240. through the interface defined in @file{libavfilter/buffersink.h}
  3241. or the options system.
  3242. It accepts a pointer to an AVABufferSinkContext structure, which
  3243. defines the incoming buffers' formats, to be passed as the opaque
  3244. parameter to @code{avfilter_init_filter} for initialization.
  3245. @section anullsink
  3246. Null audio sink; do absolutely nothing with the input audio. It is
  3247. mainly useful as a template and for use in analysis / debugging
  3248. tools.
  3249. @c man end AUDIO SINKS
  3250. @chapter Video Filters
  3251. @c man begin VIDEO FILTERS
  3252. When you configure your FFmpeg build, you can disable any of the
  3253. existing filters using @code{--disable-filters}.
  3254. The configure output will show the video filters included in your
  3255. build.
  3256. Below is a description of the currently available video filters.
  3257. @section alphaextract
  3258. Extract the alpha component from the input as a grayscale video. This
  3259. is especially useful with the @var{alphamerge} filter.
  3260. @section alphamerge
  3261. Add or replace the alpha component of the primary input with the
  3262. grayscale value of a second input. This is intended for use with
  3263. @var{alphaextract} to allow the transmission or storage of frame
  3264. sequences that have alpha in a format that doesn't support an alpha
  3265. channel.
  3266. For example, to reconstruct full frames from a normal YUV-encoded video
  3267. and a separate video created with @var{alphaextract}, you might use:
  3268. @example
  3269. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3270. @end example
  3271. Since this filter is designed for reconstruction, it operates on frame
  3272. sequences without considering timestamps, and terminates when either
  3273. input reaches end of stream. This will cause problems if your encoding
  3274. pipeline drops frames. If you're trying to apply an image as an
  3275. overlay to a video stream, consider the @var{overlay} filter instead.
  3276. @section ass
  3277. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3278. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3279. Substation Alpha) subtitles files.
  3280. This filter accepts the following option in addition to the common options from
  3281. the @ref{subtitles} filter:
  3282. @table @option
  3283. @item shaping
  3284. Set the shaping engine
  3285. Available values are:
  3286. @table @samp
  3287. @item auto
  3288. The default libass shaping engine, which is the best available.
  3289. @item simple
  3290. Fast, font-agnostic shaper that can do only substitutions
  3291. @item complex
  3292. Slower shaper using OpenType for substitutions and positioning
  3293. @end table
  3294. The default is @code{auto}.
  3295. @end table
  3296. @section atadenoise
  3297. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3298. The filter accepts the following options:
  3299. @table @option
  3300. @item 0a
  3301. Set threshold A for 1st plane. Default is 0.02.
  3302. Valid range is 0 to 0.3.
  3303. @item 0b
  3304. Set threshold B for 1st plane. Default is 0.04.
  3305. Valid range is 0 to 5.
  3306. @item 1a
  3307. Set threshold A for 2nd plane. Default is 0.02.
  3308. Valid range is 0 to 0.3.
  3309. @item 1b
  3310. Set threshold B for 2nd plane. Default is 0.04.
  3311. Valid range is 0 to 5.
  3312. @item 2a
  3313. Set threshold A for 3rd plane. Default is 0.02.
  3314. Valid range is 0 to 0.3.
  3315. @item 2b
  3316. Set threshold B for 3rd plane. Default is 0.04.
  3317. Valid range is 0 to 5.
  3318. Threshold A is designed to react on abrupt changes in the input signal and
  3319. threshold B is designed to react on continuous changes in the input signal.
  3320. @item s
  3321. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3322. number in range [5, 129].
  3323. @end table
  3324. @section bbox
  3325. Compute the bounding box for the non-black pixels in the input frame
  3326. luminance plane.
  3327. This filter computes the bounding box containing all the pixels with a
  3328. luminance value greater than the minimum allowed value.
  3329. The parameters describing the bounding box are printed on the filter
  3330. log.
  3331. The filter accepts the following option:
  3332. @table @option
  3333. @item min_val
  3334. Set the minimal luminance value. Default is @code{16}.
  3335. @end table
  3336. @section blackdetect
  3337. Detect video intervals that are (almost) completely black. Can be
  3338. useful to detect chapter transitions, commercials, or invalid
  3339. recordings. Output lines contains the time for the start, end and
  3340. duration of the detected black interval expressed in seconds.
  3341. In order to display the output lines, you need to set the loglevel at
  3342. least to the AV_LOG_INFO value.
  3343. The filter accepts the following options:
  3344. @table @option
  3345. @item black_min_duration, d
  3346. Set the minimum detected black duration expressed in seconds. It must
  3347. be a non-negative floating point number.
  3348. Default value is 2.0.
  3349. @item picture_black_ratio_th, pic_th
  3350. Set the threshold for considering a picture "black".
  3351. Express the minimum value for the ratio:
  3352. @example
  3353. @var{nb_black_pixels} / @var{nb_pixels}
  3354. @end example
  3355. for which a picture is considered black.
  3356. Default value is 0.98.
  3357. @item pixel_black_th, pix_th
  3358. Set the threshold for considering a pixel "black".
  3359. The threshold expresses the maximum pixel luminance value for which a
  3360. pixel is considered "black". The provided value is scaled according to
  3361. the following equation:
  3362. @example
  3363. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3364. @end example
  3365. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3366. the input video format, the range is [0-255] for YUV full-range
  3367. formats and [16-235] for YUV non full-range formats.
  3368. Default value is 0.10.
  3369. @end table
  3370. The following example sets the maximum pixel threshold to the minimum
  3371. value, and detects only black intervals of 2 or more seconds:
  3372. @example
  3373. blackdetect=d=2:pix_th=0.00
  3374. @end example
  3375. @section blackframe
  3376. Detect frames that are (almost) completely black. Can be useful to
  3377. detect chapter transitions or commercials. Output lines consist of
  3378. the frame number of the detected frame, the percentage of blackness,
  3379. the position in the file if known or -1 and the timestamp in seconds.
  3380. In order to display the output lines, you need to set the loglevel at
  3381. least to the AV_LOG_INFO value.
  3382. It accepts the following parameters:
  3383. @table @option
  3384. @item amount
  3385. The percentage of the pixels that have to be below the threshold; it defaults to
  3386. @code{98}.
  3387. @item threshold, thresh
  3388. The threshold below which a pixel value is considered black; it defaults to
  3389. @code{32}.
  3390. @end table
  3391. @section blend, tblend
  3392. Blend two video frames into each other.
  3393. The @code{blend} filter takes two input streams and outputs one
  3394. stream, the first input is the "top" layer and second input is
  3395. "bottom" layer. Output terminates when shortest input terminates.
  3396. The @code{tblend} (time blend) filter takes two consecutive frames
  3397. from one single stream, and outputs the result obtained by blending
  3398. the new frame on top of the old frame.
  3399. A description of the accepted options follows.
  3400. @table @option
  3401. @item c0_mode
  3402. @item c1_mode
  3403. @item c2_mode
  3404. @item c3_mode
  3405. @item all_mode
  3406. Set blend mode for specific pixel component or all pixel components in case
  3407. of @var{all_mode}. Default value is @code{normal}.
  3408. Available values for component modes are:
  3409. @table @samp
  3410. @item addition
  3411. @item addition128
  3412. @item and
  3413. @item average
  3414. @item burn
  3415. @item darken
  3416. @item difference
  3417. @item difference128
  3418. @item divide
  3419. @item dodge
  3420. @item freeze
  3421. @item exclusion
  3422. @item glow
  3423. @item hardlight
  3424. @item hardmix
  3425. @item heat
  3426. @item lighten
  3427. @item linearlight
  3428. @item multiply
  3429. @item multiply128
  3430. @item negation
  3431. @item normal
  3432. @item or
  3433. @item overlay
  3434. @item phoenix
  3435. @item pinlight
  3436. @item reflect
  3437. @item screen
  3438. @item softlight
  3439. @item subtract
  3440. @item vividlight
  3441. @item xor
  3442. @end table
  3443. @item c0_opacity
  3444. @item c1_opacity
  3445. @item c2_opacity
  3446. @item c3_opacity
  3447. @item all_opacity
  3448. Set blend opacity for specific pixel component or all pixel components in case
  3449. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3450. @item c0_expr
  3451. @item c1_expr
  3452. @item c2_expr
  3453. @item c3_expr
  3454. @item all_expr
  3455. Set blend expression for specific pixel component or all pixel components in case
  3456. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3457. The expressions can use the following variables:
  3458. @table @option
  3459. @item N
  3460. The sequential number of the filtered frame, starting from @code{0}.
  3461. @item X
  3462. @item Y
  3463. the coordinates of the current sample
  3464. @item W
  3465. @item H
  3466. the width and height of currently filtered plane
  3467. @item SW
  3468. @item SH
  3469. Width and height scale depending on the currently filtered plane. It is the
  3470. ratio between the corresponding luma plane number of pixels and the current
  3471. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3472. @code{0.5,0.5} for chroma planes.
  3473. @item T
  3474. Time of the current frame, expressed in seconds.
  3475. @item TOP, A
  3476. Value of pixel component at current location for first video frame (top layer).
  3477. @item BOTTOM, B
  3478. Value of pixel component at current location for second video frame (bottom layer).
  3479. @end table
  3480. @item shortest
  3481. Force termination when the shortest input terminates. Default is
  3482. @code{0}. This option is only defined for the @code{blend} filter.
  3483. @item repeatlast
  3484. Continue applying the last bottom frame after the end of the stream. A value of
  3485. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3486. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3487. @end table
  3488. @subsection Examples
  3489. @itemize
  3490. @item
  3491. Apply transition from bottom layer to top layer in first 10 seconds:
  3492. @example
  3493. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3494. @end example
  3495. @item
  3496. Apply 1x1 checkerboard effect:
  3497. @example
  3498. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3499. @end example
  3500. @item
  3501. Apply uncover left effect:
  3502. @example
  3503. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3504. @end example
  3505. @item
  3506. Apply uncover down effect:
  3507. @example
  3508. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3509. @end example
  3510. @item
  3511. Apply uncover up-left effect:
  3512. @example
  3513. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3514. @end example
  3515. @item
  3516. Split diagonally video and shows top and bottom layer on each side:
  3517. @example
  3518. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3519. @end example
  3520. @item
  3521. Display differences between the current and the previous frame:
  3522. @example
  3523. tblend=all_mode=difference128
  3524. @end example
  3525. @end itemize
  3526. @section boxblur
  3527. Apply a boxblur algorithm to the input video.
  3528. It accepts the following parameters:
  3529. @table @option
  3530. @item luma_radius, lr
  3531. @item luma_power, lp
  3532. @item chroma_radius, cr
  3533. @item chroma_power, cp
  3534. @item alpha_radius, ar
  3535. @item alpha_power, ap
  3536. @end table
  3537. A description of the accepted options follows.
  3538. @table @option
  3539. @item luma_radius, lr
  3540. @item chroma_radius, cr
  3541. @item alpha_radius, ar
  3542. Set an expression for the box radius in pixels used for blurring the
  3543. corresponding input plane.
  3544. The radius value must be a non-negative number, and must not be
  3545. greater than the value of the expression @code{min(w,h)/2} for the
  3546. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3547. planes.
  3548. Default value for @option{luma_radius} is "2". If not specified,
  3549. @option{chroma_radius} and @option{alpha_radius} default to the
  3550. corresponding value set for @option{luma_radius}.
  3551. The expressions can contain the following constants:
  3552. @table @option
  3553. @item w
  3554. @item h
  3555. The input width and height in pixels.
  3556. @item cw
  3557. @item ch
  3558. The input chroma image width and height in pixels.
  3559. @item hsub
  3560. @item vsub
  3561. The horizontal and vertical chroma subsample values. For example, for the
  3562. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3563. @end table
  3564. @item luma_power, lp
  3565. @item chroma_power, cp
  3566. @item alpha_power, ap
  3567. Specify how many times the boxblur filter is applied to the
  3568. corresponding plane.
  3569. Default value for @option{luma_power} is 2. If not specified,
  3570. @option{chroma_power} and @option{alpha_power} default to the
  3571. corresponding value set for @option{luma_power}.
  3572. A value of 0 will disable the effect.
  3573. @end table
  3574. @subsection Examples
  3575. @itemize
  3576. @item
  3577. Apply a boxblur filter with the luma, chroma, and alpha radii
  3578. set to 2:
  3579. @example
  3580. boxblur=luma_radius=2:luma_power=1
  3581. boxblur=2:1
  3582. @end example
  3583. @item
  3584. Set the luma radius to 2, and alpha and chroma radius to 0:
  3585. @example
  3586. boxblur=2:1:cr=0:ar=0
  3587. @end example
  3588. @item
  3589. Set the luma and chroma radii to a fraction of the video dimension:
  3590. @example
  3591. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3592. @end example
  3593. @end itemize
  3594. @section bwdif
  3595. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3596. Deinterlacing Filter").
  3597. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3598. interpolation algorithms.
  3599. It accepts the following parameters:
  3600. @table @option
  3601. @item mode
  3602. The interlacing mode to adopt. It accepts one of the following values:
  3603. @table @option
  3604. @item 0, send_frame
  3605. Output one frame for each frame.
  3606. @item 1, send_field
  3607. Output one frame for each field.
  3608. @end table
  3609. The default value is @code{send_field}.
  3610. @item parity
  3611. The picture field parity assumed for the input interlaced video. It accepts one
  3612. of the following values:
  3613. @table @option
  3614. @item 0, tff
  3615. Assume the top field is first.
  3616. @item 1, bff
  3617. Assume the bottom field is first.
  3618. @item -1, auto
  3619. Enable automatic detection of field parity.
  3620. @end table
  3621. The default value is @code{auto}.
  3622. If the interlacing is unknown or the decoder does not export this information,
  3623. top field first will be assumed.
  3624. @item deint
  3625. Specify which frames to deinterlace. Accept one of the following
  3626. values:
  3627. @table @option
  3628. @item 0, all
  3629. Deinterlace all frames.
  3630. @item 1, interlaced
  3631. Only deinterlace frames marked as interlaced.
  3632. @end table
  3633. The default value is @code{all}.
  3634. @end table
  3635. @section chromakey
  3636. YUV colorspace color/chroma keying.
  3637. The filter accepts the following options:
  3638. @table @option
  3639. @item color
  3640. The color which will be replaced with transparency.
  3641. @item similarity
  3642. Similarity percentage with the key color.
  3643. 0.01 matches only the exact key color, while 1.0 matches everything.
  3644. @item blend
  3645. Blend percentage.
  3646. 0.0 makes pixels either fully transparent, or not transparent at all.
  3647. Higher values result in semi-transparent pixels, with a higher transparency
  3648. the more similar the pixels color is to the key color.
  3649. @item yuv
  3650. Signals that the color passed is already in YUV instead of RGB.
  3651. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3652. This can be used to pass exact YUV values as hexadecimal numbers.
  3653. @end table
  3654. @subsection Examples
  3655. @itemize
  3656. @item
  3657. Make every green pixel in the input image transparent:
  3658. @example
  3659. ffmpeg -i input.png -vf chromakey=green out.png
  3660. @end example
  3661. @item
  3662. Overlay a greenscreen-video on top of a static black background.
  3663. @example
  3664. 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
  3665. @end example
  3666. @end itemize
  3667. @section ciescope
  3668. Display CIE color diagram with pixels overlaid onto it.
  3669. The filter accepts the following options:
  3670. @table @option
  3671. @item system
  3672. Set color system.
  3673. @table @samp
  3674. @item ntsc, 470m
  3675. @item ebu, 470bg
  3676. @item smpte
  3677. @item 240m
  3678. @item apple
  3679. @item widergb
  3680. @item cie1931
  3681. @item rec709, hdtv
  3682. @item uhdtv, rec2020
  3683. @end table
  3684. @item cie
  3685. Set CIE system.
  3686. @table @samp
  3687. @item xyy
  3688. @item ucs
  3689. @item luv
  3690. @end table
  3691. @item gamuts
  3692. Set what gamuts to draw.
  3693. See @code{system} option for available values.
  3694. @item size, s
  3695. Set ciescope size, by default set to 512.
  3696. @item intensity, i
  3697. Set intensity used to map input pixel values to CIE diagram.
  3698. @item contrast
  3699. Set contrast used to draw tongue colors that are out of active color system gamut.
  3700. @item corrgamma
  3701. Correct gamma displayed on scope, by default enabled.
  3702. @item showwhite
  3703. Show white point on CIE diagram, by default disabled.
  3704. @item gamma
  3705. Set input gamma. Used only with XYZ input color space.
  3706. @end table
  3707. @section codecview
  3708. Visualize information exported by some codecs.
  3709. Some codecs can export information through frames using side-data or other
  3710. means. For example, some MPEG based codecs export motion vectors through the
  3711. @var{export_mvs} flag in the codec @option{flags2} option.
  3712. The filter accepts the following option:
  3713. @table @option
  3714. @item mv
  3715. Set motion vectors to visualize.
  3716. Available flags for @var{mv} are:
  3717. @table @samp
  3718. @item pf
  3719. forward predicted MVs of P-frames
  3720. @item bf
  3721. forward predicted MVs of B-frames
  3722. @item bb
  3723. backward predicted MVs of B-frames
  3724. @end table
  3725. @item qp
  3726. Display quantization parameters using the chroma planes.
  3727. @item mv_type, mvt
  3728. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3729. Available flags for @var{mv_type} are:
  3730. @table @samp
  3731. @item fp
  3732. forward predicted MVs
  3733. @item bp
  3734. backward predicted MVs
  3735. @end table
  3736. @item frame_type, ft
  3737. Set frame type to visualize motion vectors of.
  3738. Available flags for @var{frame_type} are:
  3739. @table @samp
  3740. @item if
  3741. intra-coded frames (I-frames)
  3742. @item pf
  3743. predicted frames (P-frames)
  3744. @item bf
  3745. bi-directionally predicted frames (B-frames)
  3746. @end table
  3747. @end table
  3748. @subsection Examples
  3749. @itemize
  3750. @item
  3751. Visualize forward predicted MVs of all frames using @command{ffplay}:
  3752. @example
  3753. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  3754. @end example
  3755. @item
  3756. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  3757. @example
  3758. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  3759. @end example
  3760. @end itemize
  3761. @section colorbalance
  3762. Modify intensity of primary colors (red, green and blue) of input frames.
  3763. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3764. regions for the red-cyan, green-magenta or blue-yellow balance.
  3765. A positive adjustment value shifts the balance towards the primary color, a negative
  3766. value towards the complementary color.
  3767. The filter accepts the following options:
  3768. @table @option
  3769. @item rs
  3770. @item gs
  3771. @item bs
  3772. Adjust red, green and blue shadows (darkest pixels).
  3773. @item rm
  3774. @item gm
  3775. @item bm
  3776. Adjust red, green and blue midtones (medium pixels).
  3777. @item rh
  3778. @item gh
  3779. @item bh
  3780. Adjust red, green and blue highlights (brightest pixels).
  3781. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3782. @end table
  3783. @subsection Examples
  3784. @itemize
  3785. @item
  3786. Add red color cast to shadows:
  3787. @example
  3788. colorbalance=rs=.3
  3789. @end example
  3790. @end itemize
  3791. @section colorkey
  3792. RGB colorspace color keying.
  3793. The filter accepts the following options:
  3794. @table @option
  3795. @item color
  3796. The color which will be replaced with transparency.
  3797. @item similarity
  3798. Similarity percentage with the key color.
  3799. 0.01 matches only the exact key color, while 1.0 matches everything.
  3800. @item blend
  3801. Blend percentage.
  3802. 0.0 makes pixels either fully transparent, or not transparent at all.
  3803. Higher values result in semi-transparent pixels, with a higher transparency
  3804. the more similar the pixels color is to the key color.
  3805. @end table
  3806. @subsection Examples
  3807. @itemize
  3808. @item
  3809. Make every green pixel in the input image transparent:
  3810. @example
  3811. ffmpeg -i input.png -vf colorkey=green out.png
  3812. @end example
  3813. @item
  3814. Overlay a greenscreen-video on top of a static background image.
  3815. @example
  3816. 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
  3817. @end example
  3818. @end itemize
  3819. @section colorlevels
  3820. Adjust video input frames using levels.
  3821. The filter accepts the following options:
  3822. @table @option
  3823. @item rimin
  3824. @item gimin
  3825. @item bimin
  3826. @item aimin
  3827. Adjust red, green, blue and alpha input black point.
  3828. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3829. @item rimax
  3830. @item gimax
  3831. @item bimax
  3832. @item aimax
  3833. Adjust red, green, blue and alpha input white point.
  3834. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3835. Input levels are used to lighten highlights (bright tones), darken shadows
  3836. (dark tones), change the balance of bright and dark tones.
  3837. @item romin
  3838. @item gomin
  3839. @item bomin
  3840. @item aomin
  3841. Adjust red, green, blue and alpha output black point.
  3842. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3843. @item romax
  3844. @item gomax
  3845. @item bomax
  3846. @item aomax
  3847. Adjust red, green, blue and alpha output white point.
  3848. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3849. Output levels allows manual selection of a constrained output level range.
  3850. @end table
  3851. @subsection Examples
  3852. @itemize
  3853. @item
  3854. Make video output darker:
  3855. @example
  3856. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3857. @end example
  3858. @item
  3859. Increase contrast:
  3860. @example
  3861. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3862. @end example
  3863. @item
  3864. Make video output lighter:
  3865. @example
  3866. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3867. @end example
  3868. @item
  3869. Increase brightness:
  3870. @example
  3871. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3872. @end example
  3873. @end itemize
  3874. @section colorchannelmixer
  3875. Adjust video input frames by re-mixing color channels.
  3876. This filter modifies a color channel by adding the values associated to
  3877. the other channels of the same pixels. For example if the value to
  3878. modify is red, the output value will be:
  3879. @example
  3880. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3881. @end example
  3882. The filter accepts the following options:
  3883. @table @option
  3884. @item rr
  3885. @item rg
  3886. @item rb
  3887. @item ra
  3888. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3889. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3890. @item gr
  3891. @item gg
  3892. @item gb
  3893. @item ga
  3894. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3895. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3896. @item br
  3897. @item bg
  3898. @item bb
  3899. @item ba
  3900. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3901. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3902. @item ar
  3903. @item ag
  3904. @item ab
  3905. @item aa
  3906. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3907. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3908. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3909. @end table
  3910. @subsection Examples
  3911. @itemize
  3912. @item
  3913. Convert source to grayscale:
  3914. @example
  3915. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3916. @end example
  3917. @item
  3918. Simulate sepia tones:
  3919. @example
  3920. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3921. @end example
  3922. @end itemize
  3923. @section colormatrix
  3924. Convert color matrix.
  3925. The filter accepts the following options:
  3926. @table @option
  3927. @item src
  3928. @item dst
  3929. Specify the source and destination color matrix. Both values must be
  3930. specified.
  3931. The accepted values are:
  3932. @table @samp
  3933. @item bt709
  3934. BT.709
  3935. @item bt601
  3936. BT.601
  3937. @item smpte240m
  3938. SMPTE-240M
  3939. @item fcc
  3940. FCC
  3941. @item bt2020
  3942. BT.2020
  3943. @end table
  3944. @end table
  3945. For example to convert from BT.601 to SMPTE-240M, use the command:
  3946. @example
  3947. colormatrix=bt601:smpte240m
  3948. @end example
  3949. @section colorspace
  3950. Convert colorspace, transfer characteristics or color primaries.
  3951. The filter accepts the following options:
  3952. @table @option
  3953. @item all
  3954. Specify all color properties at once.
  3955. The accepted values are:
  3956. @table @samp
  3957. @item bt470m
  3958. BT.470M
  3959. @item bt470bg
  3960. BT.470BG
  3961. @item bt601-6-525
  3962. BT.601-6 525
  3963. @item bt601-6-625
  3964. BT.601-6 625
  3965. @item bt709
  3966. BT.709
  3967. @item smpte170m
  3968. SMPTE-170M
  3969. @item smpte240m
  3970. SMPTE-240M
  3971. @item bt2020
  3972. BT.2020
  3973. @end table
  3974. @item space
  3975. Specify output colorspace.
  3976. The accepted values are:
  3977. @table @samp
  3978. @item bt709
  3979. BT.709
  3980. @item fcc
  3981. FCC
  3982. @item bt470bg
  3983. BT.470BG or BT.601-6 625
  3984. @item smpte170m
  3985. SMPTE-170M or BT.601-6 525
  3986. @item smpte240m
  3987. SMPTE-240M
  3988. @item bt2020ncl
  3989. BT.2020 with non-constant luminance
  3990. @end table
  3991. @item trc
  3992. Specify output transfer characteristics.
  3993. The accepted values are:
  3994. @table @samp
  3995. @item bt709
  3996. BT.709
  3997. @item gamma22
  3998. Constant gamma of 2.2
  3999. @item gamma28
  4000. Constant gamma of 2.8
  4001. @item smpte170m
  4002. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4003. @item smpte240m
  4004. SMPTE-240M
  4005. @item bt2020-10
  4006. BT.2020 for 10-bits content
  4007. @item bt2020-12
  4008. BT.2020 for 12-bits content
  4009. @end table
  4010. @item prm
  4011. Specify output color primaries.
  4012. The accepted values are:
  4013. @table @samp
  4014. @item bt709
  4015. BT.709
  4016. @item bt470m
  4017. BT.470M
  4018. @item bt470bg
  4019. BT.470BG or BT.601-6 625
  4020. @item smpte170m
  4021. SMPTE-170M or BT.601-6 525
  4022. @item smpte240m
  4023. SMPTE-240M
  4024. @item bt2020
  4025. BT.2020
  4026. @end table
  4027. @item rng
  4028. Specify output color range.
  4029. The accepted values are:
  4030. @table @samp
  4031. @item mpeg
  4032. MPEG (restricted) range
  4033. @item jpeg
  4034. JPEG (full) range
  4035. @end table
  4036. @item format
  4037. Specify output color format.
  4038. The accepted values are:
  4039. @table @samp
  4040. @item yuv420p
  4041. YUV 4:2:0 planar 8-bits
  4042. @item yuv420p10
  4043. YUV 4:2:0 planar 10-bits
  4044. @item yuv420p12
  4045. YUV 4:2:0 planar 12-bits
  4046. @item yuv422p
  4047. YUV 4:2:2 planar 8-bits
  4048. @item yuv422p10
  4049. YUV 4:2:2 planar 10-bits
  4050. @item yuv422p12
  4051. YUV 4:2:2 planar 12-bits
  4052. @item yuv444p
  4053. YUV 4:4:4 planar 8-bits
  4054. @item yuv444p10
  4055. YUV 4:4:4 planar 10-bits
  4056. @item yuv444p12
  4057. YUV 4:4:4 planar 12-bits
  4058. @end table
  4059. @item fast
  4060. Do a fast conversion, which skips gamma/primary correction. This will take
  4061. significantly less CPU, but will be mathematically incorrect. To get output
  4062. compatible with that produced by the colormatrix filter, use fast=1.
  4063. @item dither
  4064. Specify dithering mode.
  4065. The accepted values are:
  4066. @table @samp
  4067. @item none
  4068. No dithering
  4069. @item fsb
  4070. Floyd-Steinberg dithering
  4071. @end table
  4072. @item wpadapt
  4073. Whitepoint adaptation mode.
  4074. The accepted values are:
  4075. @table @samp
  4076. @item bradford
  4077. Bradford whitepoint adaptation
  4078. @item vonkries
  4079. von Kries whitepoint adaptation
  4080. @item identity
  4081. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4082. @end table
  4083. @end table
  4084. The filter converts the transfer characteristics, color space and color
  4085. primaries to the specified user values. The output value, if not specified,
  4086. is set to a default value based on the "all" property. If that property is
  4087. also not specified, the filter will log an error. The output color range and
  4088. format default to the same value as the input color range and format. The
  4089. input transfer characteristics, color space, color primaries and color range
  4090. should be set on the input data. If any of these are missing, the filter will
  4091. log an error and no conversion will take place.
  4092. For example to convert the input to SMPTE-240M, use the command:
  4093. @example
  4094. colorspace=smpte240m
  4095. @end example
  4096. @section convolution
  4097. Apply convolution 3x3 or 5x5 filter.
  4098. The filter accepts the following options:
  4099. @table @option
  4100. @item 0m
  4101. @item 1m
  4102. @item 2m
  4103. @item 3m
  4104. Set matrix for each plane.
  4105. Matrix is sequence of 9 or 25 signed integers.
  4106. @item 0rdiv
  4107. @item 1rdiv
  4108. @item 2rdiv
  4109. @item 3rdiv
  4110. Set multiplier for calculated value for each plane.
  4111. @item 0bias
  4112. @item 1bias
  4113. @item 2bias
  4114. @item 3bias
  4115. Set bias for each plane. This value is added to the result of the multiplication.
  4116. Useful for making the overall image brighter or darker. Default is 0.0.
  4117. @end table
  4118. @subsection Examples
  4119. @itemize
  4120. @item
  4121. Apply sharpen:
  4122. @example
  4123. 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"
  4124. @end example
  4125. @item
  4126. Apply blur:
  4127. @example
  4128. 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"
  4129. @end example
  4130. @item
  4131. Apply edge enhance:
  4132. @example
  4133. 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"
  4134. @end example
  4135. @item
  4136. Apply edge detect:
  4137. @example
  4138. 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"
  4139. @end example
  4140. @item
  4141. Apply emboss:
  4142. @example
  4143. 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"
  4144. @end example
  4145. @end itemize
  4146. @section copy
  4147. Copy the input source unchanged to the output. This is mainly useful for
  4148. testing purposes.
  4149. @anchor{coreimage}
  4150. @section coreimage
  4151. Video filtering on GPU using Apple's CoreImage API on OSX.
  4152. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4153. processed by video hardware. However, software-based OpenGL implementations
  4154. exist which means there is no guarantee for hardware processing. It depends on
  4155. the respective OSX.
  4156. There are many filters and image generators provided by Apple that come with a
  4157. large variety of options. The filter has to be referenced by its name along
  4158. with its options.
  4159. The coreimage filter accepts the following options:
  4160. @table @option
  4161. @item list_filters
  4162. List all available filters and generators along with all their respective
  4163. options as well as possible minimum and maximum values along with the default
  4164. values.
  4165. @example
  4166. list_filters=true
  4167. @end example
  4168. @item filter
  4169. Specify all filters by their respective name and options.
  4170. Use @var{list_filters} to determine all valid filter names and options.
  4171. Numerical options are specified by a float value and are automatically clamped
  4172. to their respective value range. Vector and color options have to be specified
  4173. by a list of space separated float values. Character escaping has to be done.
  4174. A special option name @code{default} is available to use default options for a
  4175. filter.
  4176. It is required to specify either @code{default} or at least one of the filter options.
  4177. All omitted options are used with their default values.
  4178. The syntax of the filter string is as follows:
  4179. @example
  4180. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4181. @end example
  4182. @item output_rect
  4183. Specify a rectangle where the output of the filter chain is copied into the
  4184. input image. It is given by a list of space separated float values:
  4185. @example
  4186. output_rect=x\ y\ width\ height
  4187. @end example
  4188. If not given, the output rectangle equals the dimensions of the input image.
  4189. The output rectangle is automatically cropped at the borders of the input
  4190. image. Negative values are valid for each component.
  4191. @example
  4192. output_rect=25\ 25\ 100\ 100
  4193. @end example
  4194. @end table
  4195. Several filters can be chained for successive processing without GPU-HOST
  4196. transfers allowing for fast processing of complex filter chains.
  4197. Currently, only filters with zero (generators) or exactly one (filters) input
  4198. image and one output image are supported. Also, transition filters are not yet
  4199. usable as intended.
  4200. Some filters generate output images with additional padding depending on the
  4201. respective filter kernel. The padding is automatically removed to ensure the
  4202. filter output has the same size as the input image.
  4203. For image generators, the size of the output image is determined by the
  4204. previous output image of the filter chain or the input image of the whole
  4205. filterchain, respectively. The generators do not use the pixel information of
  4206. this image to generate their output. However, the generated output is
  4207. blended onto this image, resulting in partial or complete coverage of the
  4208. output image.
  4209. The @ref{coreimagesrc} video source can be used for generating input images
  4210. which are directly fed into the filter chain. By using it, providing input
  4211. images by another video source or an input video is not required.
  4212. @subsection Examples
  4213. @itemize
  4214. @item
  4215. List all filters available:
  4216. @example
  4217. coreimage=list_filters=true
  4218. @end example
  4219. @item
  4220. Use the CIBoxBlur filter with default options to blur an image:
  4221. @example
  4222. coreimage=filter=CIBoxBlur@@default
  4223. @end example
  4224. @item
  4225. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4226. its center at 100x100 and a radius of 50 pixels:
  4227. @example
  4228. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4229. @end example
  4230. @item
  4231. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4232. given as complete and escaped command-line for Apple's standard bash shell:
  4233. @example
  4234. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4235. @end example
  4236. @end itemize
  4237. @section crop
  4238. Crop the input video to given dimensions.
  4239. It accepts the following parameters:
  4240. @table @option
  4241. @item w, out_w
  4242. The width of the output video. It defaults to @code{iw}.
  4243. This expression is evaluated only once during the filter
  4244. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4245. @item h, out_h
  4246. The height of the output video. It defaults to @code{ih}.
  4247. This expression is evaluated only once during the filter
  4248. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4249. @item x
  4250. The horizontal position, in the input video, of the left edge of the output
  4251. video. It defaults to @code{(in_w-out_w)/2}.
  4252. This expression is evaluated per-frame.
  4253. @item y
  4254. The vertical position, in the input video, of the top edge of the output video.
  4255. It defaults to @code{(in_h-out_h)/2}.
  4256. This expression is evaluated per-frame.
  4257. @item keep_aspect
  4258. If set to 1 will force the output display aspect ratio
  4259. to be the same of the input, by changing the output sample aspect
  4260. ratio. It defaults to 0.
  4261. @end table
  4262. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4263. expressions containing the following constants:
  4264. @table @option
  4265. @item x
  4266. @item y
  4267. The computed values for @var{x} and @var{y}. They are evaluated for
  4268. each new frame.
  4269. @item in_w
  4270. @item in_h
  4271. The input width and height.
  4272. @item iw
  4273. @item ih
  4274. These are the same as @var{in_w} and @var{in_h}.
  4275. @item out_w
  4276. @item out_h
  4277. The output (cropped) width and height.
  4278. @item ow
  4279. @item oh
  4280. These are the same as @var{out_w} and @var{out_h}.
  4281. @item a
  4282. same as @var{iw} / @var{ih}
  4283. @item sar
  4284. input sample aspect ratio
  4285. @item dar
  4286. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4287. @item hsub
  4288. @item vsub
  4289. horizontal and vertical chroma subsample values. For example for the
  4290. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4291. @item n
  4292. The number of the input frame, starting from 0.
  4293. @item pos
  4294. the position in the file of the input frame, NAN if unknown
  4295. @item t
  4296. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4297. @end table
  4298. The expression for @var{out_w} may depend on the value of @var{out_h},
  4299. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4300. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4301. evaluated after @var{out_w} and @var{out_h}.
  4302. The @var{x} and @var{y} parameters specify the expressions for the
  4303. position of the top-left corner of the output (non-cropped) area. They
  4304. are evaluated for each frame. If the evaluated value is not valid, it
  4305. is approximated to the nearest valid value.
  4306. The expression for @var{x} may depend on @var{y}, and the expression
  4307. for @var{y} may depend on @var{x}.
  4308. @subsection Examples
  4309. @itemize
  4310. @item
  4311. Crop area with size 100x100 at position (12,34).
  4312. @example
  4313. crop=100:100:12:34
  4314. @end example
  4315. Using named options, the example above becomes:
  4316. @example
  4317. crop=w=100:h=100:x=12:y=34
  4318. @end example
  4319. @item
  4320. Crop the central input area with size 100x100:
  4321. @example
  4322. crop=100:100
  4323. @end example
  4324. @item
  4325. Crop the central input area with size 2/3 of the input video:
  4326. @example
  4327. crop=2/3*in_w:2/3*in_h
  4328. @end example
  4329. @item
  4330. Crop the input video central square:
  4331. @example
  4332. crop=out_w=in_h
  4333. crop=in_h
  4334. @end example
  4335. @item
  4336. Delimit the rectangle with the top-left corner placed at position
  4337. 100:100 and the right-bottom corner corresponding to the right-bottom
  4338. corner of the input image.
  4339. @example
  4340. crop=in_w-100:in_h-100:100:100
  4341. @end example
  4342. @item
  4343. Crop 10 pixels from the left and right borders, and 20 pixels from
  4344. the top and bottom borders
  4345. @example
  4346. crop=in_w-2*10:in_h-2*20
  4347. @end example
  4348. @item
  4349. Keep only the bottom right quarter of the input image:
  4350. @example
  4351. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4352. @end example
  4353. @item
  4354. Crop height for getting Greek harmony:
  4355. @example
  4356. crop=in_w:1/PHI*in_w
  4357. @end example
  4358. @item
  4359. Apply trembling effect:
  4360. @example
  4361. 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)
  4362. @end example
  4363. @item
  4364. Apply erratic camera effect depending on timestamp:
  4365. @example
  4366. 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)"
  4367. @end example
  4368. @item
  4369. Set x depending on the value of y:
  4370. @example
  4371. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4372. @end example
  4373. @end itemize
  4374. @subsection Commands
  4375. This filter supports the following commands:
  4376. @table @option
  4377. @item w, out_w
  4378. @item h, out_h
  4379. @item x
  4380. @item y
  4381. Set width/height of the output video and the horizontal/vertical position
  4382. in the input video.
  4383. The command accepts the same syntax of the corresponding option.
  4384. If the specified expression is not valid, it is kept at its current
  4385. value.
  4386. @end table
  4387. @section cropdetect
  4388. Auto-detect the crop size.
  4389. It calculates the necessary cropping parameters and prints the
  4390. recommended parameters via the logging system. The detected dimensions
  4391. correspond to the non-black area of the input video.
  4392. It accepts the following parameters:
  4393. @table @option
  4394. @item limit
  4395. Set higher black value threshold, which can be optionally specified
  4396. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4397. value greater to the set value is considered non-black. It defaults to 24.
  4398. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4399. on the bitdepth of the pixel format.
  4400. @item round
  4401. The value which the width/height should be divisible by. It defaults to
  4402. 16. The offset is automatically adjusted to center the video. Use 2 to
  4403. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4404. encoding to most video codecs.
  4405. @item reset_count, reset
  4406. Set the counter that determines after how many frames cropdetect will
  4407. reset the previously detected largest video area and start over to
  4408. detect the current optimal crop area. Default value is 0.
  4409. This can be useful when channel logos distort the video area. 0
  4410. indicates 'never reset', and returns the largest area encountered during
  4411. playback.
  4412. @end table
  4413. @anchor{curves}
  4414. @section curves
  4415. Apply color adjustments using curves.
  4416. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4417. component (red, green and blue) has its values defined by @var{N} key points
  4418. tied from each other using a smooth curve. The x-axis represents the pixel
  4419. values from the input frame, and the y-axis the new pixel values to be set for
  4420. the output frame.
  4421. By default, a component curve is defined by the two points @var{(0;0)} and
  4422. @var{(1;1)}. This creates a straight line where each original pixel value is
  4423. "adjusted" to its own value, which means no change to the image.
  4424. The filter allows you to redefine these two points and add some more. A new
  4425. curve (using a natural cubic spline interpolation) will be define to pass
  4426. smoothly through all these new coordinates. The new defined points needs to be
  4427. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4428. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4429. the vector spaces, the values will be clipped accordingly.
  4430. The filter accepts the following options:
  4431. @table @option
  4432. @item preset
  4433. Select one of the available color presets. This option can be used in addition
  4434. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4435. options takes priority on the preset values.
  4436. Available presets are:
  4437. @table @samp
  4438. @item none
  4439. @item color_negative
  4440. @item cross_process
  4441. @item darker
  4442. @item increase_contrast
  4443. @item lighter
  4444. @item linear_contrast
  4445. @item medium_contrast
  4446. @item negative
  4447. @item strong_contrast
  4448. @item vintage
  4449. @end table
  4450. Default is @code{none}.
  4451. @item master, m
  4452. Set the master key points. These points will define a second pass mapping. It
  4453. is sometimes called a "luminance" or "value" mapping. It can be used with
  4454. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4455. post-processing LUT.
  4456. @item red, r
  4457. Set the key points for the red component.
  4458. @item green, g
  4459. Set the key points for the green component.
  4460. @item blue, b
  4461. Set the key points for the blue component.
  4462. @item all
  4463. Set the key points for all components (not including master).
  4464. Can be used in addition to the other key points component
  4465. options. In this case, the unset component(s) will fallback on this
  4466. @option{all} setting.
  4467. @item psfile
  4468. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4469. @item plot
  4470. Save Gnuplot script of the curves in specified file.
  4471. @end table
  4472. To avoid some filtergraph syntax conflicts, each key points list need to be
  4473. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4474. @subsection Examples
  4475. @itemize
  4476. @item
  4477. Increase slightly the middle level of blue:
  4478. @example
  4479. curves=blue='0/0 0.5/0.58 1/1'
  4480. @end example
  4481. @item
  4482. Vintage effect:
  4483. @example
  4484. curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
  4485. @end example
  4486. Here we obtain the following coordinates for each components:
  4487. @table @var
  4488. @item red
  4489. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4490. @item green
  4491. @code{(0;0) (0.50;0.48) (1;1)}
  4492. @item blue
  4493. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4494. @end table
  4495. @item
  4496. The previous example can also be achieved with the associated built-in preset:
  4497. @example
  4498. curves=preset=vintage
  4499. @end example
  4500. @item
  4501. Or simply:
  4502. @example
  4503. curves=vintage
  4504. @end example
  4505. @item
  4506. Use a Photoshop preset and redefine the points of the green component:
  4507. @example
  4508. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4509. @end example
  4510. @item
  4511. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4512. and @command{gnuplot}:
  4513. @example
  4514. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4515. gnuplot -p /tmp/curves.plt
  4516. @end example
  4517. @end itemize
  4518. @section datascope
  4519. Video data analysis filter.
  4520. This filter shows hexadecimal pixel values of part of video.
  4521. The filter accepts the following options:
  4522. @table @option
  4523. @item size, s
  4524. Set output video size.
  4525. @item x
  4526. Set x offset from where to pick pixels.
  4527. @item y
  4528. Set y offset from where to pick pixels.
  4529. @item mode
  4530. Set scope mode, can be one of the following:
  4531. @table @samp
  4532. @item mono
  4533. Draw hexadecimal pixel values with white color on black background.
  4534. @item color
  4535. Draw hexadecimal pixel values with input video pixel color on black
  4536. background.
  4537. @item color2
  4538. Draw hexadecimal pixel values on color background picked from input video,
  4539. the text color is picked in such way so its always visible.
  4540. @end table
  4541. @item axis
  4542. Draw rows and columns numbers on left and top of video.
  4543. @end table
  4544. @section dctdnoiz
  4545. Denoise frames using 2D DCT (frequency domain filtering).
  4546. This filter is not designed for real time.
  4547. The filter accepts the following options:
  4548. @table @option
  4549. @item sigma, s
  4550. Set the noise sigma constant.
  4551. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4552. coefficient (absolute value) below this threshold with be dropped.
  4553. If you need a more advanced filtering, see @option{expr}.
  4554. Default is @code{0}.
  4555. @item overlap
  4556. Set number overlapping pixels for each block. Since the filter can be slow, you
  4557. may want to reduce this value, at the cost of a less effective filter and the
  4558. risk of various artefacts.
  4559. If the overlapping value doesn't permit processing the whole input width or
  4560. height, a warning will be displayed and according borders won't be denoised.
  4561. Default value is @var{blocksize}-1, which is the best possible setting.
  4562. @item expr, e
  4563. Set the coefficient factor expression.
  4564. For each coefficient of a DCT block, this expression will be evaluated as a
  4565. multiplier value for the coefficient.
  4566. If this is option is set, the @option{sigma} option will be ignored.
  4567. The absolute value of the coefficient can be accessed through the @var{c}
  4568. variable.
  4569. @item n
  4570. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4571. @var{blocksize}, which is the width and height of the processed blocks.
  4572. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4573. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4574. on the speed processing. Also, a larger block size does not necessarily means a
  4575. better de-noising.
  4576. @end table
  4577. @subsection Examples
  4578. Apply a denoise with a @option{sigma} of @code{4.5}:
  4579. @example
  4580. dctdnoiz=4.5
  4581. @end example
  4582. The same operation can be achieved using the expression system:
  4583. @example
  4584. dctdnoiz=e='gte(c, 4.5*3)'
  4585. @end example
  4586. Violent denoise using a block size of @code{16x16}:
  4587. @example
  4588. dctdnoiz=15:n=4
  4589. @end example
  4590. @section deband
  4591. Remove banding artifacts from input video.
  4592. It works by replacing banded pixels with average value of referenced pixels.
  4593. The filter accepts the following options:
  4594. @table @option
  4595. @item 1thr
  4596. @item 2thr
  4597. @item 3thr
  4598. @item 4thr
  4599. Set banding detection threshold for each plane. Default is 0.02.
  4600. Valid range is 0.00003 to 0.5.
  4601. If difference between current pixel and reference pixel is less than threshold,
  4602. it will be considered as banded.
  4603. @item range, r
  4604. Banding detection range in pixels. Default is 16. If positive, random number
  4605. in range 0 to set value will be used. If negative, exact absolute value
  4606. will be used.
  4607. The range defines square of four pixels around current pixel.
  4608. @item direction, d
  4609. Set direction in radians from which four pixel will be compared. If positive,
  4610. random direction from 0 to set direction will be picked. If negative, exact of
  4611. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4612. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4613. column.
  4614. @item blur
  4615. If enabled, current pixel is compared with average value of all four
  4616. surrounding pixels. The default is enabled. If disabled current pixel is
  4617. compared with all four surrounding pixels. The pixel is considered banded
  4618. if only all four differences with surrounding pixels are less than threshold.
  4619. @end table
  4620. @anchor{decimate}
  4621. @section decimate
  4622. Drop duplicated frames at regular intervals.
  4623. The filter accepts the following options:
  4624. @table @option
  4625. @item cycle
  4626. Set the number of frames from which one will be dropped. Setting this to
  4627. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4628. Default is @code{5}.
  4629. @item dupthresh
  4630. Set the threshold for duplicate detection. If the difference metric for a frame
  4631. is less than or equal to this value, then it is declared as duplicate. Default
  4632. is @code{1.1}
  4633. @item scthresh
  4634. Set scene change threshold. Default is @code{15}.
  4635. @item blockx
  4636. @item blocky
  4637. Set the size of the x and y-axis blocks used during metric calculations.
  4638. Larger blocks give better noise suppression, but also give worse detection of
  4639. small movements. Must be a power of two. Default is @code{32}.
  4640. @item ppsrc
  4641. Mark main input as a pre-processed input and activate clean source input
  4642. stream. This allows the input to be pre-processed with various filters to help
  4643. the metrics calculation while keeping the frame selection lossless. When set to
  4644. @code{1}, the first stream is for the pre-processed input, and the second
  4645. stream is the clean source from where the kept frames are chosen. Default is
  4646. @code{0}.
  4647. @item chroma
  4648. Set whether or not chroma is considered in the metric calculations. Default is
  4649. @code{1}.
  4650. @end table
  4651. @section deflate
  4652. Apply deflate effect to the video.
  4653. This filter replaces the pixel by the local(3x3) average by taking into account
  4654. only values lower than the pixel.
  4655. It accepts the following options:
  4656. @table @option
  4657. @item threshold0
  4658. @item threshold1
  4659. @item threshold2
  4660. @item threshold3
  4661. Limit the maximum change for each plane, default is 65535.
  4662. If 0, plane will remain unchanged.
  4663. @end table
  4664. @section dejudder
  4665. Remove judder produced by partially interlaced telecined content.
  4666. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4667. source was partially telecined content then the output of @code{pullup,dejudder}
  4668. will have a variable frame rate. May change the recorded frame rate of the
  4669. container. Aside from that change, this filter will not affect constant frame
  4670. rate video.
  4671. The option available in this filter is:
  4672. @table @option
  4673. @item cycle
  4674. Specify the length of the window over which the judder repeats.
  4675. Accepts any integer greater than 1. Useful values are:
  4676. @table @samp
  4677. @item 4
  4678. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4679. @item 5
  4680. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4681. @item 20
  4682. If a mixture of the two.
  4683. @end table
  4684. The default is @samp{4}.
  4685. @end table
  4686. @section delogo
  4687. Suppress a TV station logo by a simple interpolation of the surrounding
  4688. pixels. Just set a rectangle covering the logo and watch it disappear
  4689. (and sometimes something even uglier appear - your mileage may vary).
  4690. It accepts the following parameters:
  4691. @table @option
  4692. @item x
  4693. @item y
  4694. Specify the top left corner coordinates of the logo. They must be
  4695. specified.
  4696. @item w
  4697. @item h
  4698. Specify the width and height of the logo to clear. They must be
  4699. specified.
  4700. @item band, t
  4701. Specify the thickness of the fuzzy edge of the rectangle (added to
  4702. @var{w} and @var{h}). The default value is 1. This option is
  4703. deprecated, setting higher values should no longer be necessary and
  4704. is not recommended.
  4705. @item show
  4706. When set to 1, a green rectangle is drawn on the screen to simplify
  4707. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4708. The default value is 0.
  4709. The rectangle is drawn on the outermost pixels which will be (partly)
  4710. replaced with interpolated values. The values of the next pixels
  4711. immediately outside this rectangle in each direction will be used to
  4712. compute the interpolated pixel values inside the rectangle.
  4713. @end table
  4714. @subsection Examples
  4715. @itemize
  4716. @item
  4717. Set a rectangle covering the area with top left corner coordinates 0,0
  4718. and size 100x77, and a band of size 10:
  4719. @example
  4720. delogo=x=0:y=0:w=100:h=77:band=10
  4721. @end example
  4722. @end itemize
  4723. @section deshake
  4724. Attempt to fix small changes in horizontal and/or vertical shift. This
  4725. filter helps remove camera shake from hand-holding a camera, bumping a
  4726. tripod, moving on a vehicle, etc.
  4727. The filter accepts the following options:
  4728. @table @option
  4729. @item x
  4730. @item y
  4731. @item w
  4732. @item h
  4733. Specify a rectangular area where to limit the search for motion
  4734. vectors.
  4735. If desired the search for motion vectors can be limited to a
  4736. rectangular area of the frame defined by its top left corner, width
  4737. and height. These parameters have the same meaning as the drawbox
  4738. filter which can be used to visualise the position of the bounding
  4739. box.
  4740. This is useful when simultaneous movement of subjects within the frame
  4741. might be confused for camera motion by the motion vector search.
  4742. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4743. then the full frame is used. This allows later options to be set
  4744. without specifying the bounding box for the motion vector search.
  4745. Default - search the whole frame.
  4746. @item rx
  4747. @item ry
  4748. Specify the maximum extent of movement in x and y directions in the
  4749. range 0-64 pixels. Default 16.
  4750. @item edge
  4751. Specify how to generate pixels to fill blanks at the edge of the
  4752. frame. Available values are:
  4753. @table @samp
  4754. @item blank, 0
  4755. Fill zeroes at blank locations
  4756. @item original, 1
  4757. Original image at blank locations
  4758. @item clamp, 2
  4759. Extruded edge value at blank locations
  4760. @item mirror, 3
  4761. Mirrored edge at blank locations
  4762. @end table
  4763. Default value is @samp{mirror}.
  4764. @item blocksize
  4765. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4766. default 8.
  4767. @item contrast
  4768. Specify the contrast threshold for blocks. Only blocks with more than
  4769. the specified contrast (difference between darkest and lightest
  4770. pixels) will be considered. Range 1-255, default 125.
  4771. @item search
  4772. Specify the search strategy. Available values are:
  4773. @table @samp
  4774. @item exhaustive, 0
  4775. Set exhaustive search
  4776. @item less, 1
  4777. Set less exhaustive search.
  4778. @end table
  4779. Default value is @samp{exhaustive}.
  4780. @item filename
  4781. If set then a detailed log of the motion search is written to the
  4782. specified file.
  4783. @item opencl
  4784. If set to 1, specify using OpenCL capabilities, only available if
  4785. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4786. @end table
  4787. @section detelecine
  4788. Apply an exact inverse of the telecine operation. It requires a predefined
  4789. pattern specified using the pattern option which must be the same as that passed
  4790. to the telecine filter.
  4791. This filter accepts the following options:
  4792. @table @option
  4793. @item first_field
  4794. @table @samp
  4795. @item top, t
  4796. top field first
  4797. @item bottom, b
  4798. bottom field first
  4799. The default value is @code{top}.
  4800. @end table
  4801. @item pattern
  4802. A string of numbers representing the pulldown pattern you wish to apply.
  4803. The default value is @code{23}.
  4804. @item start_frame
  4805. A number representing position of the first frame with respect to the telecine
  4806. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4807. @end table
  4808. @section dilation
  4809. Apply dilation effect to the video.
  4810. This filter replaces the pixel by the local(3x3) maximum.
  4811. It accepts the following options:
  4812. @table @option
  4813. @item threshold0
  4814. @item threshold1
  4815. @item threshold2
  4816. @item threshold3
  4817. Limit the maximum change for each plane, default is 65535.
  4818. If 0, plane will remain unchanged.
  4819. @item coordinates
  4820. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4821. pixels are used.
  4822. Flags to local 3x3 coordinates maps like this:
  4823. 1 2 3
  4824. 4 5
  4825. 6 7 8
  4826. @end table
  4827. @section displace
  4828. Displace pixels as indicated by second and third input stream.
  4829. It takes three input streams and outputs one stream, the first input is the
  4830. source, and second and third input are displacement maps.
  4831. The second input specifies how much to displace pixels along the
  4832. x-axis, while the third input specifies how much to displace pixels
  4833. along the y-axis.
  4834. If one of displacement map streams terminates, last frame from that
  4835. displacement map will be used.
  4836. Note that once generated, displacements maps can be reused over and over again.
  4837. A description of the accepted options follows.
  4838. @table @option
  4839. @item edge
  4840. Set displace behavior for pixels that are out of range.
  4841. Available values are:
  4842. @table @samp
  4843. @item blank
  4844. Missing pixels are replaced by black pixels.
  4845. @item smear
  4846. Adjacent pixels will spread out to replace missing pixels.
  4847. @item wrap
  4848. Out of range pixels are wrapped so they point to pixels of other side.
  4849. @end table
  4850. Default is @samp{smear}.
  4851. @end table
  4852. @subsection Examples
  4853. @itemize
  4854. @item
  4855. Add ripple effect to rgb input of video size hd720:
  4856. @example
  4857. 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
  4858. @end example
  4859. @item
  4860. Add wave effect to rgb input of video size hd720:
  4861. @example
  4862. 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
  4863. @end example
  4864. @end itemize
  4865. @section drawbox
  4866. Draw a colored box on the input image.
  4867. It accepts the following parameters:
  4868. @table @option
  4869. @item x
  4870. @item y
  4871. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4872. @item width, w
  4873. @item height, h
  4874. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4875. the input width and height. It defaults to 0.
  4876. @item color, c
  4877. Specify the color of the box to write. For the general syntax of this option,
  4878. check the "Color" section in the ffmpeg-utils manual. If the special
  4879. value @code{invert} is used, the box edge color is the same as the
  4880. video with inverted luma.
  4881. @item thickness, t
  4882. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4883. See below for the list of accepted constants.
  4884. @end table
  4885. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4886. following constants:
  4887. @table @option
  4888. @item dar
  4889. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4890. @item hsub
  4891. @item vsub
  4892. horizontal and vertical chroma subsample values. For example for the
  4893. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4894. @item in_h, ih
  4895. @item in_w, iw
  4896. The input width and height.
  4897. @item sar
  4898. The input sample aspect ratio.
  4899. @item x
  4900. @item y
  4901. The x and y offset coordinates where the box is drawn.
  4902. @item w
  4903. @item h
  4904. The width and height of the drawn box.
  4905. @item t
  4906. The thickness of the drawn box.
  4907. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4908. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4909. @end table
  4910. @subsection Examples
  4911. @itemize
  4912. @item
  4913. Draw a black box around the edge of the input image:
  4914. @example
  4915. drawbox
  4916. @end example
  4917. @item
  4918. Draw a box with color red and an opacity of 50%:
  4919. @example
  4920. drawbox=10:20:200:60:red@@0.5
  4921. @end example
  4922. The previous example can be specified as:
  4923. @example
  4924. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  4925. @end example
  4926. @item
  4927. Fill the box with pink color:
  4928. @example
  4929. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  4930. @end example
  4931. @item
  4932. Draw a 2-pixel red 2.40:1 mask:
  4933. @example
  4934. 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
  4935. @end example
  4936. @end itemize
  4937. @section drawgraph, adrawgraph
  4938. Draw a graph using input video or audio metadata.
  4939. It accepts the following parameters:
  4940. @table @option
  4941. @item m1
  4942. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  4943. @item fg1
  4944. Set 1st foreground color expression.
  4945. @item m2
  4946. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  4947. @item fg2
  4948. Set 2nd foreground color expression.
  4949. @item m3
  4950. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  4951. @item fg3
  4952. Set 3rd foreground color expression.
  4953. @item m4
  4954. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  4955. @item fg4
  4956. Set 4th foreground color expression.
  4957. @item min
  4958. Set minimal value of metadata value.
  4959. @item max
  4960. Set maximal value of metadata value.
  4961. @item bg
  4962. Set graph background color. Default is white.
  4963. @item mode
  4964. Set graph mode.
  4965. Available values for mode is:
  4966. @table @samp
  4967. @item bar
  4968. @item dot
  4969. @item line
  4970. @end table
  4971. Default is @code{line}.
  4972. @item slide
  4973. Set slide mode.
  4974. Available values for slide is:
  4975. @table @samp
  4976. @item frame
  4977. Draw new frame when right border is reached.
  4978. @item replace
  4979. Replace old columns with new ones.
  4980. @item scroll
  4981. Scroll from right to left.
  4982. @item rscroll
  4983. Scroll from left to right.
  4984. @end table
  4985. Default is @code{frame}.
  4986. @item size
  4987. Set size of graph video. For the syntax of this option, check the
  4988. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  4989. The default value is @code{900x256}.
  4990. The foreground color expressions can use the following variables:
  4991. @table @option
  4992. @item MIN
  4993. Minimal value of metadata value.
  4994. @item MAX
  4995. Maximal value of metadata value.
  4996. @item VAL
  4997. Current metadata key value.
  4998. @end table
  4999. The color is defined as 0xAABBGGRR.
  5000. @end table
  5001. Example using metadata from @ref{signalstats} filter:
  5002. @example
  5003. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  5004. @end example
  5005. Example using metadata from @ref{ebur128} filter:
  5006. @example
  5007. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  5008. @end example
  5009. @section drawgrid
  5010. Draw a grid on the input image.
  5011. It accepts the following parameters:
  5012. @table @option
  5013. @item x
  5014. @item y
  5015. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5016. @item width, w
  5017. @item height, h
  5018. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5019. input width and height, respectively, minus @code{thickness}, so image gets
  5020. framed. Default to 0.
  5021. @item color, c
  5022. Specify the color of the grid. For the general syntax of this option,
  5023. check the "Color" section in the ffmpeg-utils manual. If the special
  5024. value @code{invert} is used, the grid color is the same as the
  5025. video with inverted luma.
  5026. @item thickness, t
  5027. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5028. See below for the list of accepted constants.
  5029. @end table
  5030. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5031. following constants:
  5032. @table @option
  5033. @item dar
  5034. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5035. @item hsub
  5036. @item vsub
  5037. horizontal and vertical chroma subsample values. For example for the
  5038. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5039. @item in_h, ih
  5040. @item in_w, iw
  5041. The input grid cell width and height.
  5042. @item sar
  5043. The input sample aspect ratio.
  5044. @item x
  5045. @item y
  5046. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5047. @item w
  5048. @item h
  5049. The width and height of the drawn cell.
  5050. @item t
  5051. The thickness of the drawn cell.
  5052. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5053. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5054. @end table
  5055. @subsection Examples
  5056. @itemize
  5057. @item
  5058. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5059. @example
  5060. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5061. @end example
  5062. @item
  5063. Draw a white 3x3 grid with an opacity of 50%:
  5064. @example
  5065. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5066. @end example
  5067. @end itemize
  5068. @anchor{drawtext}
  5069. @section drawtext
  5070. Draw a text string or text from a specified file on top of a video, using the
  5071. libfreetype library.
  5072. To enable compilation of this filter, you need to configure FFmpeg with
  5073. @code{--enable-libfreetype}.
  5074. To enable default font fallback and the @var{font} option you need to
  5075. configure FFmpeg with @code{--enable-libfontconfig}.
  5076. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5077. @code{--enable-libfribidi}.
  5078. @subsection Syntax
  5079. It accepts the following parameters:
  5080. @table @option
  5081. @item box
  5082. Used to draw a box around text using the background color.
  5083. The value must be either 1 (enable) or 0 (disable).
  5084. The default value of @var{box} is 0.
  5085. @item boxborderw
  5086. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5087. The default value of @var{boxborderw} is 0.
  5088. @item boxcolor
  5089. The color to be used for drawing box around text. For the syntax of this
  5090. option, check the "Color" section in the ffmpeg-utils manual.
  5091. The default value of @var{boxcolor} is "white".
  5092. @item borderw
  5093. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5094. The default value of @var{borderw} is 0.
  5095. @item bordercolor
  5096. Set the color to be used for drawing border around text. For the syntax of this
  5097. option, check the "Color" section in the ffmpeg-utils manual.
  5098. The default value of @var{bordercolor} is "black".
  5099. @item expansion
  5100. Select how the @var{text} is expanded. Can be either @code{none},
  5101. @code{strftime} (deprecated) or
  5102. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5103. below for details.
  5104. @item fix_bounds
  5105. If true, check and fix text coords to avoid clipping.
  5106. @item fontcolor
  5107. The color to be used for drawing fonts. For the syntax of this option, check
  5108. the "Color" section in the ffmpeg-utils manual.
  5109. The default value of @var{fontcolor} is "black".
  5110. @item fontcolor_expr
  5111. String which is expanded the same way as @var{text} to obtain dynamic
  5112. @var{fontcolor} value. By default this option has empty value and is not
  5113. processed. When this option is set, it overrides @var{fontcolor} option.
  5114. @item font
  5115. The font family to be used for drawing text. By default Sans.
  5116. @item fontfile
  5117. The font file to be used for drawing text. The path must be included.
  5118. This parameter is mandatory if the fontconfig support is disabled.
  5119. @item draw
  5120. This option does not exist, please see the timeline system
  5121. @item alpha
  5122. Draw the text applying alpha blending. The value can
  5123. be either a number between 0.0 and 1.0
  5124. The expression accepts the same variables @var{x, y} do.
  5125. The default value is 1.
  5126. Please see fontcolor_expr
  5127. @item fontsize
  5128. The font size to be used for drawing text.
  5129. The default value of @var{fontsize} is 16.
  5130. @item text_shaping
  5131. If set to 1, attempt to shape the text (for example, reverse the order of
  5132. right-to-left text and join Arabic characters) before drawing it.
  5133. Otherwise, just draw the text exactly as given.
  5134. By default 1 (if supported).
  5135. @item ft_load_flags
  5136. The flags to be used for loading the fonts.
  5137. The flags map the corresponding flags supported by libfreetype, and are
  5138. a combination of the following values:
  5139. @table @var
  5140. @item default
  5141. @item no_scale
  5142. @item no_hinting
  5143. @item render
  5144. @item no_bitmap
  5145. @item vertical_layout
  5146. @item force_autohint
  5147. @item crop_bitmap
  5148. @item pedantic
  5149. @item ignore_global_advance_width
  5150. @item no_recurse
  5151. @item ignore_transform
  5152. @item monochrome
  5153. @item linear_design
  5154. @item no_autohint
  5155. @end table
  5156. Default value is "default".
  5157. For more information consult the documentation for the FT_LOAD_*
  5158. libfreetype flags.
  5159. @item shadowcolor
  5160. The color to be used for drawing a shadow behind the drawn text. For the
  5161. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5162. The default value of @var{shadowcolor} is "black".
  5163. @item shadowx
  5164. @item shadowy
  5165. The x and y offsets for the text shadow position with respect to the
  5166. position of the text. They can be either positive or negative
  5167. values. The default value for both is "0".
  5168. @item start_number
  5169. The starting frame number for the n/frame_num variable. The default value
  5170. is "0".
  5171. @item tabsize
  5172. The size in number of spaces to use for rendering the tab.
  5173. Default value is 4.
  5174. @item timecode
  5175. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5176. format. It can be used with or without text parameter. @var{timecode_rate}
  5177. option must be specified.
  5178. @item timecode_rate, rate, r
  5179. Set the timecode frame rate (timecode only).
  5180. @item text
  5181. The text string to be drawn. The text must be a sequence of UTF-8
  5182. encoded characters.
  5183. This parameter is mandatory if no file is specified with the parameter
  5184. @var{textfile}.
  5185. @item textfile
  5186. A text file containing text to be drawn. The text must be a sequence
  5187. of UTF-8 encoded characters.
  5188. This parameter is mandatory if no text string is specified with the
  5189. parameter @var{text}.
  5190. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5191. @item reload
  5192. If set to 1, the @var{textfile} will be reloaded before each frame.
  5193. Be sure to update it atomically, or it may be read partially, or even fail.
  5194. @item x
  5195. @item y
  5196. The expressions which specify the offsets where text will be drawn
  5197. within the video frame. They are relative to the top/left border of the
  5198. output image.
  5199. The default value of @var{x} and @var{y} is "0".
  5200. See below for the list of accepted constants and functions.
  5201. @end table
  5202. The parameters for @var{x} and @var{y} are expressions containing the
  5203. following constants and functions:
  5204. @table @option
  5205. @item dar
  5206. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5207. @item hsub
  5208. @item vsub
  5209. horizontal and vertical chroma subsample values. For example for the
  5210. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5211. @item line_h, lh
  5212. the height of each text line
  5213. @item main_h, h, H
  5214. the input height
  5215. @item main_w, w, W
  5216. the input width
  5217. @item max_glyph_a, ascent
  5218. the maximum distance from the baseline to the highest/upper grid
  5219. coordinate used to place a glyph outline point, for all the rendered
  5220. glyphs.
  5221. It is a positive value, due to the grid's orientation with the Y axis
  5222. upwards.
  5223. @item max_glyph_d, descent
  5224. the maximum distance from the baseline to the lowest grid coordinate
  5225. used to place a glyph outline point, for all the rendered glyphs.
  5226. This is a negative value, due to the grid's orientation, with the Y axis
  5227. upwards.
  5228. @item max_glyph_h
  5229. maximum glyph height, that is the maximum height for all the glyphs
  5230. contained in the rendered text, it is equivalent to @var{ascent} -
  5231. @var{descent}.
  5232. @item max_glyph_w
  5233. maximum glyph width, that is the maximum width for all the glyphs
  5234. contained in the rendered text
  5235. @item n
  5236. the number of input frame, starting from 0
  5237. @item rand(min, max)
  5238. return a random number included between @var{min} and @var{max}
  5239. @item sar
  5240. The input sample aspect ratio.
  5241. @item t
  5242. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5243. @item text_h, th
  5244. the height of the rendered text
  5245. @item text_w, tw
  5246. the width of the rendered text
  5247. @item x
  5248. @item y
  5249. the x and y offset coordinates where the text is drawn.
  5250. These parameters allow the @var{x} and @var{y} expressions to refer
  5251. each other, so you can for example specify @code{y=x/dar}.
  5252. @end table
  5253. @anchor{drawtext_expansion}
  5254. @subsection Text expansion
  5255. If @option{expansion} is set to @code{strftime},
  5256. the filter recognizes strftime() sequences in the provided text and
  5257. expands them accordingly. Check the documentation of strftime(). This
  5258. feature is deprecated.
  5259. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5260. If @option{expansion} is set to @code{normal} (which is the default),
  5261. the following expansion mechanism is used.
  5262. The backslash character @samp{\}, followed by any character, always expands to
  5263. the second character.
  5264. Sequence of the form @code{%@{...@}} are expanded. The text between the
  5265. braces is a function name, possibly followed by arguments separated by ':'.
  5266. If the arguments contain special characters or delimiters (':' or '@}'),
  5267. they should be escaped.
  5268. Note that they probably must also be escaped as the value for the
  5269. @option{text} option in the filter argument string and as the filter
  5270. argument in the filtergraph description, and possibly also for the shell,
  5271. that makes up to four levels of escaping; using a text file avoids these
  5272. problems.
  5273. The following functions are available:
  5274. @table @command
  5275. @item expr, e
  5276. The expression evaluation result.
  5277. It must take one argument specifying the expression to be evaluated,
  5278. which accepts the same constants and functions as the @var{x} and
  5279. @var{y} values. Note that not all constants should be used, for
  5280. example the text size is not known when evaluating the expression, so
  5281. the constants @var{text_w} and @var{text_h} will have an undefined
  5282. value.
  5283. @item expr_int_format, eif
  5284. Evaluate the expression's value and output as formatted integer.
  5285. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5286. The second argument specifies the output format. Allowed values are @samp{x},
  5287. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5288. @code{printf} function.
  5289. The third parameter is optional and sets the number of positions taken by the output.
  5290. It can be used to add padding with zeros from the left.
  5291. @item gmtime
  5292. The time at which the filter is running, expressed in UTC.
  5293. It can accept an argument: a strftime() format string.
  5294. @item localtime
  5295. The time at which the filter is running, expressed in the local time zone.
  5296. It can accept an argument: a strftime() format string.
  5297. @item metadata
  5298. Frame metadata. Takes one or two arguments.
  5299. The first argument is mandatory and specifies the metadata key.
  5300. The second argument is optional and specifies a default value, used when the
  5301. metadata key is not found or empty.
  5302. @item n, frame_num
  5303. The frame number, starting from 0.
  5304. @item pict_type
  5305. A 1 character description of the current picture type.
  5306. @item pts
  5307. The timestamp of the current frame.
  5308. It can take up to three arguments.
  5309. The first argument is the format of the timestamp; it defaults to @code{flt}
  5310. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5311. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5312. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5313. @code{localtime} stands for the timestamp of the frame formatted as
  5314. local time zone time.
  5315. The second argument is an offset added to the timestamp.
  5316. If the format is set to @code{localtime} or @code{gmtime},
  5317. a third argument may be supplied: a strftime() format string.
  5318. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5319. @end table
  5320. @subsection Examples
  5321. @itemize
  5322. @item
  5323. Draw "Test Text" with font FreeSerif, using the default values for the
  5324. optional parameters.
  5325. @example
  5326. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5327. @end example
  5328. @item
  5329. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5330. and y=50 (counting from the top-left corner of the screen), text is
  5331. yellow with a red box around it. Both the text and the box have an
  5332. opacity of 20%.
  5333. @example
  5334. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5335. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5336. @end example
  5337. Note that the double quotes are not necessary if spaces are not used
  5338. within the parameter list.
  5339. @item
  5340. Show the text at the center of the video frame:
  5341. @example
  5342. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5343. @end example
  5344. @item
  5345. Show the text at a random position, switching to a new position every 30 seconds:
  5346. @example
  5347. 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)"
  5348. @end example
  5349. @item
  5350. Show a text line sliding from right to left in the last row of the video
  5351. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5352. with no newlines.
  5353. @example
  5354. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5355. @end example
  5356. @item
  5357. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5358. @example
  5359. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5360. @end example
  5361. @item
  5362. Draw a single green letter "g", at the center of the input video.
  5363. The glyph baseline is placed at half screen height.
  5364. @example
  5365. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5366. @end example
  5367. @item
  5368. Show text for 1 second every 3 seconds:
  5369. @example
  5370. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5371. @end example
  5372. @item
  5373. Use fontconfig to set the font. Note that the colons need to be escaped.
  5374. @example
  5375. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5376. @end example
  5377. @item
  5378. Print the date of a real-time encoding (see strftime(3)):
  5379. @example
  5380. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5381. @end example
  5382. @item
  5383. Show text fading in and out (appearing/disappearing):
  5384. @example
  5385. #!/bin/sh
  5386. DS=1.0 # display start
  5387. DE=10.0 # display end
  5388. FID=1.5 # fade in duration
  5389. FOD=5 # fade out duration
  5390. 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 @}"
  5391. @end example
  5392. @end itemize
  5393. For more information about libfreetype, check:
  5394. @url{http://www.freetype.org/}.
  5395. For more information about fontconfig, check:
  5396. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5397. For more information about libfribidi, check:
  5398. @url{http://fribidi.org/}.
  5399. @section edgedetect
  5400. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5401. The filter accepts the following options:
  5402. @table @option
  5403. @item low
  5404. @item high
  5405. Set low and high threshold values used by the Canny thresholding
  5406. algorithm.
  5407. The high threshold selects the "strong" edge pixels, which are then
  5408. connected through 8-connectivity with the "weak" edge pixels selected
  5409. by the low threshold.
  5410. @var{low} and @var{high} threshold values must be chosen in the range
  5411. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5412. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5413. is @code{50/255}.
  5414. @item mode
  5415. Define the drawing mode.
  5416. @table @samp
  5417. @item wires
  5418. Draw white/gray wires on black background.
  5419. @item colormix
  5420. Mix the colors to create a paint/cartoon effect.
  5421. @end table
  5422. Default value is @var{wires}.
  5423. @end table
  5424. @subsection Examples
  5425. @itemize
  5426. @item
  5427. Standard edge detection with custom values for the hysteresis thresholding:
  5428. @example
  5429. edgedetect=low=0.1:high=0.4
  5430. @end example
  5431. @item
  5432. Painting effect without thresholding:
  5433. @example
  5434. edgedetect=mode=colormix:high=0
  5435. @end example
  5436. @end itemize
  5437. @section eq
  5438. Set brightness, contrast, saturation and approximate gamma adjustment.
  5439. The filter accepts the following options:
  5440. @table @option
  5441. @item contrast
  5442. Set the contrast expression. The value must be a float value in range
  5443. @code{-2.0} to @code{2.0}. The default value is "1".
  5444. @item brightness
  5445. Set the brightness expression. The value must be a float value in
  5446. range @code{-1.0} to @code{1.0}. The default value is "0".
  5447. @item saturation
  5448. Set the saturation expression. The value must be a float in
  5449. range @code{0.0} to @code{3.0}. The default value is "1".
  5450. @item gamma
  5451. Set the gamma expression. The value must be a float in range
  5452. @code{0.1} to @code{10.0}. The default value is "1".
  5453. @item gamma_r
  5454. Set the gamma expression for red. The value must be a float in
  5455. range @code{0.1} to @code{10.0}. The default value is "1".
  5456. @item gamma_g
  5457. Set the gamma expression for green. The value must be a float in range
  5458. @code{0.1} to @code{10.0}. The default value is "1".
  5459. @item gamma_b
  5460. Set the gamma expression for blue. The value must be a float in range
  5461. @code{0.1} to @code{10.0}. The default value is "1".
  5462. @item gamma_weight
  5463. Set the gamma weight expression. It can be used to reduce the effect
  5464. of a high gamma value on bright image areas, e.g. keep them from
  5465. getting overamplified and just plain white. The value must be a float
  5466. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5467. gamma correction all the way down while @code{1.0} leaves it at its
  5468. full strength. Default is "1".
  5469. @item eval
  5470. Set when the expressions for brightness, contrast, saturation and
  5471. gamma expressions are evaluated.
  5472. It accepts the following values:
  5473. @table @samp
  5474. @item init
  5475. only evaluate expressions once during the filter initialization or
  5476. when a command is processed
  5477. @item frame
  5478. evaluate expressions for each incoming frame
  5479. @end table
  5480. Default value is @samp{init}.
  5481. @end table
  5482. The expressions accept the following parameters:
  5483. @table @option
  5484. @item n
  5485. frame count of the input frame starting from 0
  5486. @item pos
  5487. byte position of the corresponding packet in the input file, NAN if
  5488. unspecified
  5489. @item r
  5490. frame rate of the input video, NAN if the input frame rate is unknown
  5491. @item t
  5492. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5493. @end table
  5494. @subsection Commands
  5495. The filter supports the following commands:
  5496. @table @option
  5497. @item contrast
  5498. Set the contrast expression.
  5499. @item brightness
  5500. Set the brightness expression.
  5501. @item saturation
  5502. Set the saturation expression.
  5503. @item gamma
  5504. Set the gamma expression.
  5505. @item gamma_r
  5506. Set the gamma_r expression.
  5507. @item gamma_g
  5508. Set gamma_g expression.
  5509. @item gamma_b
  5510. Set gamma_b expression.
  5511. @item gamma_weight
  5512. Set gamma_weight expression.
  5513. The command accepts the same syntax of the corresponding option.
  5514. If the specified expression is not valid, it is kept at its current
  5515. value.
  5516. @end table
  5517. @section erosion
  5518. Apply erosion effect to the video.
  5519. This filter replaces the pixel by the local(3x3) minimum.
  5520. It accepts the following options:
  5521. @table @option
  5522. @item threshold0
  5523. @item threshold1
  5524. @item threshold2
  5525. @item threshold3
  5526. Limit the maximum change for each plane, default is 65535.
  5527. If 0, plane will remain unchanged.
  5528. @item coordinates
  5529. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5530. pixels are used.
  5531. Flags to local 3x3 coordinates maps like this:
  5532. 1 2 3
  5533. 4 5
  5534. 6 7 8
  5535. @end table
  5536. @section extractplanes
  5537. Extract color channel components from input video stream into
  5538. separate grayscale video streams.
  5539. The filter accepts the following option:
  5540. @table @option
  5541. @item planes
  5542. Set plane(s) to extract.
  5543. Available values for planes are:
  5544. @table @samp
  5545. @item y
  5546. @item u
  5547. @item v
  5548. @item a
  5549. @item r
  5550. @item g
  5551. @item b
  5552. @end table
  5553. Choosing planes not available in the input will result in an error.
  5554. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5555. with @code{y}, @code{u}, @code{v} planes at same time.
  5556. @end table
  5557. @subsection Examples
  5558. @itemize
  5559. @item
  5560. Extract luma, u and v color channel component from input video frame
  5561. into 3 grayscale outputs:
  5562. @example
  5563. 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
  5564. @end example
  5565. @end itemize
  5566. @section elbg
  5567. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5568. For each input image, the filter will compute the optimal mapping from
  5569. the input to the output given the codebook length, that is the number
  5570. of distinct output colors.
  5571. This filter accepts the following options.
  5572. @table @option
  5573. @item codebook_length, l
  5574. Set codebook length. The value must be a positive integer, and
  5575. represents the number of distinct output colors. Default value is 256.
  5576. @item nb_steps, n
  5577. Set the maximum number of iterations to apply for computing the optimal
  5578. mapping. The higher the value the better the result and the higher the
  5579. computation time. Default value is 1.
  5580. @item seed, s
  5581. Set a random seed, must be an integer included between 0 and
  5582. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5583. will try to use a good random seed on a best effort basis.
  5584. @item pal8
  5585. Set pal8 output pixel format. This option does not work with codebook
  5586. length greater than 256.
  5587. @end table
  5588. @section fade
  5589. Apply a fade-in/out effect to the input video.
  5590. It accepts the following parameters:
  5591. @table @option
  5592. @item type, t
  5593. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5594. effect.
  5595. Default is @code{in}.
  5596. @item start_frame, s
  5597. Specify the number of the frame to start applying the fade
  5598. effect at. Default is 0.
  5599. @item nb_frames, n
  5600. The number of frames that the fade effect lasts. At the end of the
  5601. fade-in effect, the output video will have the same intensity as the input video.
  5602. At the end of the fade-out transition, the output video will be filled with the
  5603. selected @option{color}.
  5604. Default is 25.
  5605. @item alpha
  5606. If set to 1, fade only alpha channel, if one exists on the input.
  5607. Default value is 0.
  5608. @item start_time, st
  5609. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5610. effect. If both start_frame and start_time are specified, the fade will start at
  5611. whichever comes last. Default is 0.
  5612. @item duration, d
  5613. The number of seconds for which the fade effect has to last. At the end of the
  5614. fade-in effect the output video will have the same intensity as the input video,
  5615. at the end of the fade-out transition the output video will be filled with the
  5616. selected @option{color}.
  5617. If both duration and nb_frames are specified, duration is used. Default is 0
  5618. (nb_frames is used by default).
  5619. @item color, c
  5620. Specify the color of the fade. Default is "black".
  5621. @end table
  5622. @subsection Examples
  5623. @itemize
  5624. @item
  5625. Fade in the first 30 frames of video:
  5626. @example
  5627. fade=in:0:30
  5628. @end example
  5629. The command above is equivalent to:
  5630. @example
  5631. fade=t=in:s=0:n=30
  5632. @end example
  5633. @item
  5634. Fade out the last 45 frames of a 200-frame video:
  5635. @example
  5636. fade=out:155:45
  5637. fade=type=out:start_frame=155:nb_frames=45
  5638. @end example
  5639. @item
  5640. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5641. @example
  5642. fade=in:0:25, fade=out:975:25
  5643. @end example
  5644. @item
  5645. Make the first 5 frames yellow, then fade in from frame 5-24:
  5646. @example
  5647. fade=in:5:20:color=yellow
  5648. @end example
  5649. @item
  5650. Fade in alpha over first 25 frames of video:
  5651. @example
  5652. fade=in:0:25:alpha=1
  5653. @end example
  5654. @item
  5655. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5656. @example
  5657. fade=t=in:st=5.5:d=0.5
  5658. @end example
  5659. @end itemize
  5660. @section fftfilt
  5661. Apply arbitrary expressions to samples in frequency domain
  5662. @table @option
  5663. @item dc_Y
  5664. Adjust the dc value (gain) of the luma plane of the image. The filter
  5665. accepts an integer value in range @code{0} to @code{1000}. The default
  5666. value is set to @code{0}.
  5667. @item dc_U
  5668. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5669. filter accepts an integer value in range @code{0} to @code{1000}. The
  5670. default value is set to @code{0}.
  5671. @item dc_V
  5672. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5673. filter accepts an integer value in range @code{0} to @code{1000}. The
  5674. default value is set to @code{0}.
  5675. @item weight_Y
  5676. Set the frequency domain weight expression for the luma plane.
  5677. @item weight_U
  5678. Set the frequency domain weight expression for the 1st chroma plane.
  5679. @item weight_V
  5680. Set the frequency domain weight expression for the 2nd chroma plane.
  5681. The filter accepts the following variables:
  5682. @item X
  5683. @item Y
  5684. The coordinates of the current sample.
  5685. @item W
  5686. @item H
  5687. The width and height of the image.
  5688. @end table
  5689. @subsection Examples
  5690. @itemize
  5691. @item
  5692. High-pass:
  5693. @example
  5694. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5695. @end example
  5696. @item
  5697. Low-pass:
  5698. @example
  5699. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5700. @end example
  5701. @item
  5702. Sharpen:
  5703. @example
  5704. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5705. @end example
  5706. @item
  5707. Blur:
  5708. @example
  5709. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5710. @end example
  5711. @end itemize
  5712. @section field
  5713. Extract a single field from an interlaced image using stride
  5714. arithmetic to avoid wasting CPU time. The output frames are marked as
  5715. non-interlaced.
  5716. The filter accepts the following options:
  5717. @table @option
  5718. @item type
  5719. Specify whether to extract the top (if the value is @code{0} or
  5720. @code{top}) or the bottom field (if the value is @code{1} or
  5721. @code{bottom}).
  5722. @end table
  5723. @section fieldhint
  5724. Create new frames by copying the top and bottom fields from surrounding frames
  5725. supplied as numbers by the hint file.
  5726. @table @option
  5727. @item hint
  5728. Set file containing hints: absolute/relative frame numbers.
  5729. There must be one line for each frame in a clip. Each line must contain two
  5730. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5731. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5732. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5733. for @code{relative} mode. First number tells from which frame to pick up top
  5734. field and second number tells from which frame to pick up bottom field.
  5735. If optionally followed by @code{+} output frame will be marked as interlaced,
  5736. else if followed by @code{-} output frame will be marked as progressive, else
  5737. it will be marked same as input frame.
  5738. If line starts with @code{#} or @code{;} that line is skipped.
  5739. @item mode
  5740. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5741. @end table
  5742. Example of first several lines of @code{hint} file for @code{relative} mode:
  5743. @example
  5744. 0,0 - # first frame
  5745. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5746. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5747. 1,0 -
  5748. 0,0 -
  5749. 0,0 -
  5750. 1,0 -
  5751. 1,0 -
  5752. 1,0 -
  5753. 0,0 -
  5754. 0,0 -
  5755. 1,0 -
  5756. 1,0 -
  5757. 1,0 -
  5758. 0,0 -
  5759. @end example
  5760. @section fieldmatch
  5761. Field matching filter for inverse telecine. It is meant to reconstruct the
  5762. progressive frames from a telecined stream. The filter does not drop duplicated
  5763. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5764. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5765. The separation of the field matching and the decimation is notably motivated by
  5766. the possibility of inserting a de-interlacing filter fallback between the two.
  5767. If the source has mixed telecined and real interlaced content,
  5768. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5769. But these remaining combed frames will be marked as interlaced, and thus can be
  5770. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5771. In addition to the various configuration options, @code{fieldmatch} can take an
  5772. optional second stream, activated through the @option{ppsrc} option. If
  5773. enabled, the frames reconstruction will be based on the fields and frames from
  5774. this second stream. This allows the first input to be pre-processed in order to
  5775. help the various algorithms of the filter, while keeping the output lossless
  5776. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5777. or brightness/contrast adjustments can help.
  5778. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5779. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5780. which @code{fieldmatch} is based on. While the semantic and usage are very
  5781. close, some behaviour and options names can differ.
  5782. The @ref{decimate} filter currently only works for constant frame rate input.
  5783. If your input has mixed telecined (30fps) and progressive content with a lower
  5784. framerate like 24fps use the following filterchain to produce the necessary cfr
  5785. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5786. The filter accepts the following options:
  5787. @table @option
  5788. @item order
  5789. Specify the assumed field order of the input stream. Available values are:
  5790. @table @samp
  5791. @item auto
  5792. Auto detect parity (use FFmpeg's internal parity value).
  5793. @item bff
  5794. Assume bottom field first.
  5795. @item tff
  5796. Assume top field first.
  5797. @end table
  5798. Note that it is sometimes recommended not to trust the parity announced by the
  5799. stream.
  5800. Default value is @var{auto}.
  5801. @item mode
  5802. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5803. sense that it won't risk creating jerkiness due to duplicate frames when
  5804. possible, but if there are bad edits or blended fields it will end up
  5805. outputting combed frames when a good match might actually exist. On the other
  5806. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5807. but will almost always find a good frame if there is one. The other values are
  5808. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5809. jerkiness and creating duplicate frames versus finding good matches in sections
  5810. with bad edits, orphaned fields, blended fields, etc.
  5811. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5812. Available values are:
  5813. @table @samp
  5814. @item pc
  5815. 2-way matching (p/c)
  5816. @item pc_n
  5817. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5818. @item pc_u
  5819. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5820. @item pc_n_ub
  5821. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5822. still combed (p/c + n + u/b)
  5823. @item pcn
  5824. 3-way matching (p/c/n)
  5825. @item pcn_ub
  5826. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5827. detected as combed (p/c/n + u/b)
  5828. @end table
  5829. The parenthesis at the end indicate the matches that would be used for that
  5830. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5831. @var{top}).
  5832. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5833. the slowest.
  5834. Default value is @var{pc_n}.
  5835. @item ppsrc
  5836. Mark the main input stream as a pre-processed input, and enable the secondary
  5837. input stream as the clean source to pick the fields from. See the filter
  5838. introduction for more details. It is similar to the @option{clip2} feature from
  5839. VFM/TFM.
  5840. Default value is @code{0} (disabled).
  5841. @item field
  5842. Set the field to match from. It is recommended to set this to the same value as
  5843. @option{order} unless you experience matching failures with that setting. In
  5844. certain circumstances changing the field that is used to match from can have a
  5845. large impact on matching performance. Available values are:
  5846. @table @samp
  5847. @item auto
  5848. Automatic (same value as @option{order}).
  5849. @item bottom
  5850. Match from the bottom field.
  5851. @item top
  5852. Match from the top field.
  5853. @end table
  5854. Default value is @var{auto}.
  5855. @item mchroma
  5856. Set whether or not chroma is included during the match comparisons. In most
  5857. cases it is recommended to leave this enabled. You should set this to @code{0}
  5858. only if your clip has bad chroma problems such as heavy rainbowing or other
  5859. artifacts. Setting this to @code{0} could also be used to speed things up at
  5860. the cost of some accuracy.
  5861. Default value is @code{1}.
  5862. @item y0
  5863. @item y1
  5864. These define an exclusion band which excludes the lines between @option{y0} and
  5865. @option{y1} from being included in the field matching decision. An exclusion
  5866. band can be used to ignore subtitles, a logo, or other things that may
  5867. interfere with the matching. @option{y0} sets the starting scan line and
  5868. @option{y1} sets the ending line; all lines in between @option{y0} and
  5869. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5870. @option{y0} and @option{y1} to the same value will disable the feature.
  5871. @option{y0} and @option{y1} defaults to @code{0}.
  5872. @item scthresh
  5873. Set the scene change detection threshold as a percentage of maximum change on
  5874. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5875. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5876. @option{scthresh} is @code{[0.0, 100.0]}.
  5877. Default value is @code{12.0}.
  5878. @item combmatch
  5879. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5880. account the combed scores of matches when deciding what match to use as the
  5881. final match. Available values are:
  5882. @table @samp
  5883. @item none
  5884. No final matching based on combed scores.
  5885. @item sc
  5886. Combed scores are only used when a scene change is detected.
  5887. @item full
  5888. Use combed scores all the time.
  5889. @end table
  5890. Default is @var{sc}.
  5891. @item combdbg
  5892. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5893. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5894. Available values are:
  5895. @table @samp
  5896. @item none
  5897. No forced calculation.
  5898. @item pcn
  5899. Force p/c/n calculations.
  5900. @item pcnub
  5901. Force p/c/n/u/b calculations.
  5902. @end table
  5903. Default value is @var{none}.
  5904. @item cthresh
  5905. This is the area combing threshold used for combed frame detection. This
  5906. essentially controls how "strong" or "visible" combing must be to be detected.
  5907. Larger values mean combing must be more visible and smaller values mean combing
  5908. can be less visible or strong and still be detected. Valid settings are from
  5909. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5910. be detected as combed). This is basically a pixel difference value. A good
  5911. range is @code{[8, 12]}.
  5912. Default value is @code{9}.
  5913. @item chroma
  5914. Sets whether or not chroma is considered in the combed frame decision. Only
  5915. disable this if your source has chroma problems (rainbowing, etc.) that are
  5916. causing problems for the combed frame detection with chroma enabled. Actually,
  5917. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5918. where there is chroma only combing in the source.
  5919. Default value is @code{0}.
  5920. @item blockx
  5921. @item blocky
  5922. Respectively set the x-axis and y-axis size of the window used during combed
  5923. frame detection. This has to do with the size of the area in which
  5924. @option{combpel} pixels are required to be detected as combed for a frame to be
  5925. declared combed. See the @option{combpel} parameter description for more info.
  5926. Possible values are any number that is a power of 2 starting at 4 and going up
  5927. to 512.
  5928. Default value is @code{16}.
  5929. @item combpel
  5930. The number of combed pixels inside any of the @option{blocky} by
  5931. @option{blockx} size blocks on the frame for the frame to be detected as
  5932. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5933. setting controls "how much" combing there must be in any localized area (a
  5934. window defined by the @option{blockx} and @option{blocky} settings) on the
  5935. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5936. which point no frames will ever be detected as combed). This setting is known
  5937. as @option{MI} in TFM/VFM vocabulary.
  5938. Default value is @code{80}.
  5939. @end table
  5940. @anchor{p/c/n/u/b meaning}
  5941. @subsection p/c/n/u/b meaning
  5942. @subsubsection p/c/n
  5943. We assume the following telecined stream:
  5944. @example
  5945. Top fields: 1 2 2 3 4
  5946. Bottom fields: 1 2 3 4 4
  5947. @end example
  5948. The numbers correspond to the progressive frame the fields relate to. Here, the
  5949. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5950. When @code{fieldmatch} is configured to run a matching from bottom
  5951. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5952. @example
  5953. Input stream:
  5954. T 1 2 2 3 4
  5955. B 1 2 3 4 4 <-- matching reference
  5956. Matches: c c n n c
  5957. Output stream:
  5958. T 1 2 3 4 4
  5959. B 1 2 3 4 4
  5960. @end example
  5961. As a result of the field matching, we can see that some frames get duplicated.
  5962. To perform a complete inverse telecine, you need to rely on a decimation filter
  5963. after this operation. See for instance the @ref{decimate} filter.
  5964. The same operation now matching from top fields (@option{field}=@var{top})
  5965. looks like this:
  5966. @example
  5967. Input stream:
  5968. T 1 2 2 3 4 <-- matching reference
  5969. B 1 2 3 4 4
  5970. Matches: c c p p c
  5971. Output stream:
  5972. T 1 2 2 3 4
  5973. B 1 2 2 3 4
  5974. @end example
  5975. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5976. basically, they refer to the frame and field of the opposite parity:
  5977. @itemize
  5978. @item @var{p} matches the field of the opposite parity in the previous frame
  5979. @item @var{c} matches the field of the opposite parity in the current frame
  5980. @item @var{n} matches the field of the opposite parity in the next frame
  5981. @end itemize
  5982. @subsubsection u/b
  5983. The @var{u} and @var{b} matching are a bit special in the sense that they match
  5984. from the opposite parity flag. In the following examples, we assume that we are
  5985. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  5986. 'x' is placed above and below each matched fields.
  5987. With bottom matching (@option{field}=@var{bottom}):
  5988. @example
  5989. Match: c p n b u
  5990. x x x x x
  5991. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5992. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5993. x x x x x
  5994. Output frames:
  5995. 2 1 2 2 2
  5996. 2 2 2 1 3
  5997. @end example
  5998. With top matching (@option{field}=@var{top}):
  5999. @example
  6000. Match: c p n b u
  6001. x x x x x
  6002. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6003. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6004. x x x x x
  6005. Output frames:
  6006. 2 2 2 1 2
  6007. 2 1 3 2 2
  6008. @end example
  6009. @subsection Examples
  6010. Simple IVTC of a top field first telecined stream:
  6011. @example
  6012. fieldmatch=order=tff:combmatch=none, decimate
  6013. @end example
  6014. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6015. @example
  6016. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6017. @end example
  6018. @section fieldorder
  6019. Transform the field order of the input video.
  6020. It accepts the following parameters:
  6021. @table @option
  6022. @item order
  6023. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6024. for bottom field first.
  6025. @end table
  6026. The default value is @samp{tff}.
  6027. The transformation is done by shifting the picture content up or down
  6028. by one line, and filling the remaining line with appropriate picture content.
  6029. This method is consistent with most broadcast field order converters.
  6030. If the input video is not flagged as being interlaced, or it is already
  6031. flagged as being of the required output field order, then this filter does
  6032. not alter the incoming video.
  6033. It is very useful when converting to or from PAL DV material,
  6034. which is bottom field first.
  6035. For example:
  6036. @example
  6037. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6038. @end example
  6039. @section fifo, afifo
  6040. Buffer input images and send them when they are requested.
  6041. It is mainly useful when auto-inserted by the libavfilter
  6042. framework.
  6043. It does not take parameters.
  6044. @section find_rect
  6045. Find a rectangular object
  6046. It accepts the following options:
  6047. @table @option
  6048. @item object
  6049. Filepath of the object image, needs to be in gray8.
  6050. @item threshold
  6051. Detection threshold, default is 0.5.
  6052. @item mipmaps
  6053. Number of mipmaps, default is 3.
  6054. @item xmin, ymin, xmax, ymax
  6055. Specifies the rectangle in which to search.
  6056. @end table
  6057. @subsection Examples
  6058. @itemize
  6059. @item
  6060. Generate a representative palette of a given video using @command{ffmpeg}:
  6061. @example
  6062. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6063. @end example
  6064. @end itemize
  6065. @section cover_rect
  6066. Cover a rectangular object
  6067. It accepts the following options:
  6068. @table @option
  6069. @item cover
  6070. Filepath of the optional cover image, needs to be in yuv420.
  6071. @item mode
  6072. Set covering mode.
  6073. It accepts the following values:
  6074. @table @samp
  6075. @item cover
  6076. cover it by the supplied image
  6077. @item blur
  6078. cover it by interpolating the surrounding pixels
  6079. @end table
  6080. Default value is @var{blur}.
  6081. @end table
  6082. @subsection Examples
  6083. @itemize
  6084. @item
  6085. Generate a representative palette of a given video using @command{ffmpeg}:
  6086. @example
  6087. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6088. @end example
  6089. @end itemize
  6090. @anchor{format}
  6091. @section format
  6092. Convert the input video to one of the specified pixel formats.
  6093. Libavfilter will try to pick one that is suitable as input to
  6094. the next filter.
  6095. It accepts the following parameters:
  6096. @table @option
  6097. @item pix_fmts
  6098. A '|'-separated list of pixel format names, such as
  6099. "pix_fmts=yuv420p|monow|rgb24".
  6100. @end table
  6101. @subsection Examples
  6102. @itemize
  6103. @item
  6104. Convert the input video to the @var{yuv420p} format
  6105. @example
  6106. format=pix_fmts=yuv420p
  6107. @end example
  6108. Convert the input video to any of the formats in the list
  6109. @example
  6110. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6111. @end example
  6112. @end itemize
  6113. @anchor{fps}
  6114. @section fps
  6115. Convert the video to specified constant frame rate by duplicating or dropping
  6116. frames as necessary.
  6117. It accepts the following parameters:
  6118. @table @option
  6119. @item fps
  6120. The desired output frame rate. The default is @code{25}.
  6121. @item round
  6122. Rounding method.
  6123. Possible values are:
  6124. @table @option
  6125. @item zero
  6126. zero round towards 0
  6127. @item inf
  6128. round away from 0
  6129. @item down
  6130. round towards -infinity
  6131. @item up
  6132. round towards +infinity
  6133. @item near
  6134. round to nearest
  6135. @end table
  6136. The default is @code{near}.
  6137. @item start_time
  6138. Assume the first PTS should be the given value, in seconds. This allows for
  6139. padding/trimming at the start of stream. By default, no assumption is made
  6140. about the first frame's expected PTS, so no padding or trimming is done.
  6141. For example, this could be set to 0 to pad the beginning with duplicates of
  6142. the first frame if a video stream starts after the audio stream or to trim any
  6143. frames with a negative PTS.
  6144. @end table
  6145. Alternatively, the options can be specified as a flat string:
  6146. @var{fps}[:@var{round}].
  6147. See also the @ref{setpts} filter.
  6148. @subsection Examples
  6149. @itemize
  6150. @item
  6151. A typical usage in order to set the fps to 25:
  6152. @example
  6153. fps=fps=25
  6154. @end example
  6155. @item
  6156. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6157. @example
  6158. fps=fps=film:round=near
  6159. @end example
  6160. @end itemize
  6161. @section framepack
  6162. Pack two different video streams into a stereoscopic video, setting proper
  6163. metadata on supported codecs. The two views should have the same size and
  6164. framerate and processing will stop when the shorter video ends. Please note
  6165. that you may conveniently adjust view properties with the @ref{scale} and
  6166. @ref{fps} filters.
  6167. It accepts the following parameters:
  6168. @table @option
  6169. @item format
  6170. The desired packing format. Supported values are:
  6171. @table @option
  6172. @item sbs
  6173. The views are next to each other (default).
  6174. @item tab
  6175. The views are on top of each other.
  6176. @item lines
  6177. The views are packed by line.
  6178. @item columns
  6179. The views are packed by column.
  6180. @item frameseq
  6181. The views are temporally interleaved.
  6182. @end table
  6183. @end table
  6184. Some examples:
  6185. @example
  6186. # Convert left and right views into a frame-sequential video
  6187. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6188. # Convert views into a side-by-side video with the same output resolution as the input
  6189. 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
  6190. @end example
  6191. @section framerate
  6192. Change the frame rate by interpolating new video output frames from the source
  6193. frames.
  6194. This filter is not designed to function correctly with interlaced media. If
  6195. you wish to change the frame rate of interlaced media then you are required
  6196. to deinterlace before this filter and re-interlace after this filter.
  6197. A description of the accepted options follows.
  6198. @table @option
  6199. @item fps
  6200. Specify the output frames per second. This option can also be specified
  6201. as a value alone. The default is @code{50}.
  6202. @item interp_start
  6203. Specify the start of a range where the output frame will be created as a
  6204. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6205. the default is @code{15}.
  6206. @item interp_end
  6207. Specify the end of a range where the output frame will be created as a
  6208. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6209. the default is @code{240}.
  6210. @item scene
  6211. Specify the level at which a scene change is detected as a value between
  6212. 0 and 100 to indicate a new scene; a low value reflects a low
  6213. probability for the current frame to introduce a new scene, while a higher
  6214. value means the current frame is more likely to be one.
  6215. The default is @code{7}.
  6216. @item flags
  6217. Specify flags influencing the filter process.
  6218. Available value for @var{flags} is:
  6219. @table @option
  6220. @item scene_change_detect, scd
  6221. Enable scene change detection using the value of the option @var{scene}.
  6222. This flag is enabled by default.
  6223. @end table
  6224. @end table
  6225. @section framestep
  6226. Select one frame every N-th frame.
  6227. This filter accepts the following option:
  6228. @table @option
  6229. @item step
  6230. Select frame after every @code{step} frames.
  6231. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6232. @end table
  6233. @anchor{frei0r}
  6234. @section frei0r
  6235. Apply a frei0r effect to the input video.
  6236. To enable the compilation of this filter, you need to install the frei0r
  6237. header and configure FFmpeg with @code{--enable-frei0r}.
  6238. It accepts the following parameters:
  6239. @table @option
  6240. @item filter_name
  6241. The name of the frei0r effect to load. If the environment variable
  6242. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6243. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6244. Otherwise, the standard frei0r paths are searched, in this order:
  6245. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6246. @file{/usr/lib/frei0r-1/}.
  6247. @item filter_params
  6248. A '|'-separated list of parameters to pass to the frei0r effect.
  6249. @end table
  6250. A frei0r effect parameter can be a boolean (its value is either
  6251. "y" or "n"), a double, a color (specified as
  6252. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6253. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6254. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6255. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6256. The number and types of parameters depend on the loaded effect. If an
  6257. effect parameter is not specified, the default value is set.
  6258. @subsection Examples
  6259. @itemize
  6260. @item
  6261. Apply the distort0r effect, setting the first two double parameters:
  6262. @example
  6263. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6264. @end example
  6265. @item
  6266. Apply the colordistance effect, taking a color as the first parameter:
  6267. @example
  6268. frei0r=colordistance:0.2/0.3/0.4
  6269. frei0r=colordistance:violet
  6270. frei0r=colordistance:0x112233
  6271. @end example
  6272. @item
  6273. Apply the perspective effect, specifying the top left and top right image
  6274. positions:
  6275. @example
  6276. frei0r=perspective:0.2/0.2|0.8/0.2
  6277. @end example
  6278. @end itemize
  6279. For more information, see
  6280. @url{http://frei0r.dyne.org}
  6281. @section fspp
  6282. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6283. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6284. processing filter, one of them is performed once per block, not per pixel.
  6285. This allows for much higher speed.
  6286. The filter accepts the following options:
  6287. @table @option
  6288. @item quality
  6289. Set quality. This option defines the number of levels for averaging. It accepts
  6290. an integer in the range 4-5. Default value is @code{4}.
  6291. @item qp
  6292. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6293. If not set, the filter will use the QP from the video stream (if available).
  6294. @item strength
  6295. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6296. more details but also more artifacts, while higher values make the image smoother
  6297. but also blurrier. Default value is @code{0} − PSNR optimal.
  6298. @item use_bframe_qp
  6299. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6300. option may cause flicker since the B-Frames have often larger QP. Default is
  6301. @code{0} (not enabled).
  6302. @end table
  6303. @section geq
  6304. The filter accepts the following options:
  6305. @table @option
  6306. @item lum_expr, lum
  6307. Set the luminance expression.
  6308. @item cb_expr, cb
  6309. Set the chrominance blue expression.
  6310. @item cr_expr, cr
  6311. Set the chrominance red expression.
  6312. @item alpha_expr, a
  6313. Set the alpha expression.
  6314. @item red_expr, r
  6315. Set the red expression.
  6316. @item green_expr, g
  6317. Set the green expression.
  6318. @item blue_expr, b
  6319. Set the blue expression.
  6320. @end table
  6321. The colorspace is selected according to the specified options. If one
  6322. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6323. options is specified, the filter will automatically select a YCbCr
  6324. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6325. @option{blue_expr} options is specified, it will select an RGB
  6326. colorspace.
  6327. If one of the chrominance expression is not defined, it falls back on the other
  6328. one. If no alpha expression is specified it will evaluate to opaque value.
  6329. If none of chrominance expressions are specified, they will evaluate
  6330. to the luminance expression.
  6331. The expressions can use the following variables and functions:
  6332. @table @option
  6333. @item N
  6334. The sequential number of the filtered frame, starting from @code{0}.
  6335. @item X
  6336. @item Y
  6337. The coordinates of the current sample.
  6338. @item W
  6339. @item H
  6340. The width and height of the image.
  6341. @item SW
  6342. @item SH
  6343. Width and height scale depending on the currently filtered plane. It is the
  6344. ratio between the corresponding luma plane number of pixels and the current
  6345. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6346. @code{0.5,0.5} for chroma planes.
  6347. @item T
  6348. Time of the current frame, expressed in seconds.
  6349. @item p(x, y)
  6350. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6351. plane.
  6352. @item lum(x, y)
  6353. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6354. plane.
  6355. @item cb(x, y)
  6356. Return the value of the pixel at location (@var{x},@var{y}) of the
  6357. blue-difference chroma plane. Return 0 if there is no such plane.
  6358. @item cr(x, y)
  6359. Return the value of the pixel at location (@var{x},@var{y}) of the
  6360. red-difference chroma plane. Return 0 if there is no such plane.
  6361. @item r(x, y)
  6362. @item g(x, y)
  6363. @item b(x, y)
  6364. Return the value of the pixel at location (@var{x},@var{y}) of the
  6365. red/green/blue component. Return 0 if there is no such component.
  6366. @item alpha(x, y)
  6367. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6368. plane. Return 0 if there is no such plane.
  6369. @end table
  6370. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6371. automatically clipped to the closer edge.
  6372. @subsection Examples
  6373. @itemize
  6374. @item
  6375. Flip the image horizontally:
  6376. @example
  6377. geq=p(W-X\,Y)
  6378. @end example
  6379. @item
  6380. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6381. wavelength of 100 pixels:
  6382. @example
  6383. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6384. @end example
  6385. @item
  6386. Generate a fancy enigmatic moving light:
  6387. @example
  6388. 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
  6389. @end example
  6390. @item
  6391. Generate a quick emboss effect:
  6392. @example
  6393. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6394. @end example
  6395. @item
  6396. Modify RGB components depending on pixel position:
  6397. @example
  6398. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6399. @end example
  6400. @item
  6401. Create a radial gradient that is the same size as the input (also see
  6402. the @ref{vignette} filter):
  6403. @example
  6404. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6405. @end example
  6406. @end itemize
  6407. @section gradfun
  6408. Fix the banding artifacts that are sometimes introduced into nearly flat
  6409. regions by truncation to 8-bit color depth.
  6410. Interpolate the gradients that should go where the bands are, and
  6411. dither them.
  6412. It is designed for playback only. Do not use it prior to
  6413. lossy compression, because compression tends to lose the dither and
  6414. bring back the bands.
  6415. It accepts the following parameters:
  6416. @table @option
  6417. @item strength
  6418. The maximum amount by which the filter will change any one pixel. This is also
  6419. the threshold for detecting nearly flat regions. Acceptable values range from
  6420. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6421. valid range.
  6422. @item radius
  6423. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6424. gradients, but also prevents the filter from modifying the pixels near detailed
  6425. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6426. values will be clipped to the valid range.
  6427. @end table
  6428. Alternatively, the options can be specified as a flat string:
  6429. @var{strength}[:@var{radius}]
  6430. @subsection Examples
  6431. @itemize
  6432. @item
  6433. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6434. @example
  6435. gradfun=3.5:8
  6436. @end example
  6437. @item
  6438. Specify radius, omitting the strength (which will fall-back to the default
  6439. value):
  6440. @example
  6441. gradfun=radius=8
  6442. @end example
  6443. @end itemize
  6444. @anchor{haldclut}
  6445. @section haldclut
  6446. Apply a Hald CLUT to a video stream.
  6447. First input is the video stream to process, and second one is the Hald CLUT.
  6448. The Hald CLUT input can be a simple picture or a complete video stream.
  6449. The filter accepts the following options:
  6450. @table @option
  6451. @item shortest
  6452. Force termination when the shortest input terminates. Default is @code{0}.
  6453. @item repeatlast
  6454. Continue applying the last CLUT after the end of the stream. A value of
  6455. @code{0} disable the filter after the last frame of the CLUT is reached.
  6456. Default is @code{1}.
  6457. @end table
  6458. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6459. filters share the same internals).
  6460. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6461. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6462. @subsection Workflow examples
  6463. @subsubsection Hald CLUT video stream
  6464. Generate an identity Hald CLUT stream altered with various effects:
  6465. @example
  6466. 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
  6467. @end example
  6468. Note: make sure you use a lossless codec.
  6469. Then use it with @code{haldclut} to apply it on some random stream:
  6470. @example
  6471. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6472. @end example
  6473. The Hald CLUT will be applied to the 10 first seconds (duration of
  6474. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6475. to the remaining frames of the @code{mandelbrot} stream.
  6476. @subsubsection Hald CLUT with preview
  6477. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6478. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6479. biggest possible square starting at the top left of the picture. The remaining
  6480. padding pixels (bottom or right) will be ignored. This area can be used to add
  6481. a preview of the Hald CLUT.
  6482. Typically, the following generated Hald CLUT will be supported by the
  6483. @code{haldclut} filter:
  6484. @example
  6485. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6486. pad=iw+320 [padded_clut];
  6487. smptebars=s=320x256, split [a][b];
  6488. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6489. [main][b] overlay=W-320" -frames:v 1 clut.png
  6490. @end example
  6491. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6492. bars are displayed on the right-top, and below the same color bars processed by
  6493. the color changes.
  6494. Then, the effect of this Hald CLUT can be visualized with:
  6495. @example
  6496. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6497. @end example
  6498. @section hdcd
  6499. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  6500. embedded HDCD codes is expanded into a 20-bit PCM stream.
  6501. The filter supports the Peak Extend and Low-level Gain Adjustment features
  6502. of HDCD, and detects the Transient Filter flag.
  6503. @example
  6504. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  6505. @end example
  6506. When using the filter with wav, note the default encoding for wav is 16-bit,
  6507. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  6508. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  6509. @example
  6510. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  6511. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  6512. @end example
  6513. @section hflip
  6514. Flip the input video horizontally.
  6515. For example, to horizontally flip the input video with @command{ffmpeg}:
  6516. @example
  6517. ffmpeg -i in.avi -vf "hflip" out.avi
  6518. @end example
  6519. @section histeq
  6520. This filter applies a global color histogram equalization on a
  6521. per-frame basis.
  6522. It can be used to correct video that has a compressed range of pixel
  6523. intensities. The filter redistributes the pixel intensities to
  6524. equalize their distribution across the intensity range. It may be
  6525. viewed as an "automatically adjusting contrast filter". This filter is
  6526. useful only for correcting degraded or poorly captured source
  6527. video.
  6528. The filter accepts the following options:
  6529. @table @option
  6530. @item strength
  6531. Determine the amount of equalization to be applied. As the strength
  6532. is reduced, the distribution of pixel intensities more-and-more
  6533. approaches that of the input frame. The value must be a float number
  6534. in the range [0,1] and defaults to 0.200.
  6535. @item intensity
  6536. Set the maximum intensity that can generated and scale the output
  6537. values appropriately. The strength should be set as desired and then
  6538. the intensity can be limited if needed to avoid washing-out. The value
  6539. must be a float number in the range [0,1] and defaults to 0.210.
  6540. @item antibanding
  6541. Set the antibanding level. If enabled the filter will randomly vary
  6542. the luminance of output pixels by a small amount to avoid banding of
  6543. the histogram. Possible values are @code{none}, @code{weak} or
  6544. @code{strong}. It defaults to @code{none}.
  6545. @end table
  6546. @section histogram
  6547. Compute and draw a color distribution histogram for the input video.
  6548. The computed histogram is a representation of the color component
  6549. distribution in an image.
  6550. Standard histogram displays the color components distribution in an image.
  6551. Displays color graph for each color component. Shows distribution of
  6552. the Y, U, V, A or R, G, B components, depending on input format, in the
  6553. current frame. Below each graph a color component scale meter is shown.
  6554. The filter accepts the following options:
  6555. @table @option
  6556. @item level_height
  6557. Set height of level. Default value is @code{200}.
  6558. Allowed range is [50, 2048].
  6559. @item scale_height
  6560. Set height of color scale. Default value is @code{12}.
  6561. Allowed range is [0, 40].
  6562. @item display_mode
  6563. Set display mode.
  6564. It accepts the following values:
  6565. @table @samp
  6566. @item parade
  6567. Per color component graphs are placed below each other.
  6568. @item overlay
  6569. Presents information identical to that in the @code{parade}, except
  6570. that the graphs representing color components are superimposed directly
  6571. over one another.
  6572. @end table
  6573. Default is @code{parade}.
  6574. @item levels_mode
  6575. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6576. Default is @code{linear}.
  6577. @item components
  6578. Set what color components to display.
  6579. Default is @code{7}.
  6580. @end table
  6581. @subsection Examples
  6582. @itemize
  6583. @item
  6584. Calculate and draw histogram:
  6585. @example
  6586. ffplay -i input -vf histogram
  6587. @end example
  6588. @end itemize
  6589. @anchor{hqdn3d}
  6590. @section hqdn3d
  6591. This is a high precision/quality 3d denoise filter. It aims to reduce
  6592. image noise, producing smooth images and making still images really
  6593. still. It should enhance compressibility.
  6594. It accepts the following optional parameters:
  6595. @table @option
  6596. @item luma_spatial
  6597. A non-negative floating point number which specifies spatial luma strength.
  6598. It defaults to 4.0.
  6599. @item chroma_spatial
  6600. A non-negative floating point number which specifies spatial chroma strength.
  6601. It defaults to 3.0*@var{luma_spatial}/4.0.
  6602. @item luma_tmp
  6603. A floating point number which specifies luma temporal strength. It defaults to
  6604. 6.0*@var{luma_spatial}/4.0.
  6605. @item chroma_tmp
  6606. A floating point number which specifies chroma temporal strength. It defaults to
  6607. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6608. @end table
  6609. @anchor{hwupload_cuda}
  6610. @section hwupload_cuda
  6611. Upload system memory frames to a CUDA device.
  6612. It accepts the following optional parameters:
  6613. @table @option
  6614. @item device
  6615. The number of the CUDA device to use
  6616. @end table
  6617. @section hqx
  6618. Apply a high-quality magnification filter designed for pixel art. This filter
  6619. was originally created by Maxim Stepin.
  6620. It accepts the following option:
  6621. @table @option
  6622. @item n
  6623. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6624. @code{hq3x} and @code{4} for @code{hq4x}.
  6625. Default is @code{3}.
  6626. @end table
  6627. @section hstack
  6628. Stack input videos horizontally.
  6629. All streams must be of same pixel format and of same height.
  6630. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6631. to create same output.
  6632. The filter accept the following option:
  6633. @table @option
  6634. @item inputs
  6635. Set number of input streams. Default is 2.
  6636. @item shortest
  6637. If set to 1, force the output to terminate when the shortest input
  6638. terminates. Default value is 0.
  6639. @end table
  6640. @section hue
  6641. Modify the hue and/or the saturation of the input.
  6642. It accepts the following parameters:
  6643. @table @option
  6644. @item h
  6645. Specify the hue angle as a number of degrees. It accepts an expression,
  6646. and defaults to "0".
  6647. @item s
  6648. Specify the saturation in the [-10,10] range. It accepts an expression and
  6649. defaults to "1".
  6650. @item H
  6651. Specify the hue angle as a number of radians. It accepts an
  6652. expression, and defaults to "0".
  6653. @item b
  6654. Specify the brightness in the [-10,10] range. It accepts an expression and
  6655. defaults to "0".
  6656. @end table
  6657. @option{h} and @option{H} are mutually exclusive, and can't be
  6658. specified at the same time.
  6659. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6660. expressions containing the following constants:
  6661. @table @option
  6662. @item n
  6663. frame count of the input frame starting from 0
  6664. @item pts
  6665. presentation timestamp of the input frame expressed in time base units
  6666. @item r
  6667. frame rate of the input video, NAN if the input frame rate is unknown
  6668. @item t
  6669. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6670. @item tb
  6671. time base of the input video
  6672. @end table
  6673. @subsection Examples
  6674. @itemize
  6675. @item
  6676. Set the hue to 90 degrees and the saturation to 1.0:
  6677. @example
  6678. hue=h=90:s=1
  6679. @end example
  6680. @item
  6681. Same command but expressing the hue in radians:
  6682. @example
  6683. hue=H=PI/2:s=1
  6684. @end example
  6685. @item
  6686. Rotate hue and make the saturation swing between 0
  6687. and 2 over a period of 1 second:
  6688. @example
  6689. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6690. @end example
  6691. @item
  6692. Apply a 3 seconds saturation fade-in effect starting at 0:
  6693. @example
  6694. hue="s=min(t/3\,1)"
  6695. @end example
  6696. The general fade-in expression can be written as:
  6697. @example
  6698. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6699. @end example
  6700. @item
  6701. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6702. @example
  6703. hue="s=max(0\, min(1\, (8-t)/3))"
  6704. @end example
  6705. The general fade-out expression can be written as:
  6706. @example
  6707. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6708. @end example
  6709. @end itemize
  6710. @subsection Commands
  6711. This filter supports the following commands:
  6712. @table @option
  6713. @item b
  6714. @item s
  6715. @item h
  6716. @item H
  6717. Modify the hue and/or the saturation and/or brightness of the input video.
  6718. The command accepts the same syntax of the corresponding option.
  6719. If the specified expression is not valid, it is kept at its current
  6720. value.
  6721. @end table
  6722. @section idet
  6723. Detect video interlacing type.
  6724. This filter tries to detect if the input frames as interlaced, progressive,
  6725. top or bottom field first. It will also try and detect fields that are
  6726. repeated between adjacent frames (a sign of telecine).
  6727. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6728. Multiple frame detection incorporates the classification history of previous frames.
  6729. The filter will log these metadata values:
  6730. @table @option
  6731. @item single.current_frame
  6732. Detected type of current frame using single-frame detection. One of:
  6733. ``tff'' (top field first), ``bff'' (bottom field first),
  6734. ``progressive'', or ``undetermined''
  6735. @item single.tff
  6736. Cumulative number of frames detected as top field first using single-frame detection.
  6737. @item multiple.tff
  6738. Cumulative number of frames detected as top field first using multiple-frame detection.
  6739. @item single.bff
  6740. Cumulative number of frames detected as bottom field first using single-frame detection.
  6741. @item multiple.current_frame
  6742. Detected type of current frame using multiple-frame detection. One of:
  6743. ``tff'' (top field first), ``bff'' (bottom field first),
  6744. ``progressive'', or ``undetermined''
  6745. @item multiple.bff
  6746. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6747. @item single.progressive
  6748. Cumulative number of frames detected as progressive using single-frame detection.
  6749. @item multiple.progressive
  6750. Cumulative number of frames detected as progressive using multiple-frame detection.
  6751. @item single.undetermined
  6752. Cumulative number of frames that could not be classified using single-frame detection.
  6753. @item multiple.undetermined
  6754. Cumulative number of frames that could not be classified using multiple-frame detection.
  6755. @item repeated.current_frame
  6756. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6757. @item repeated.neither
  6758. Cumulative number of frames with no repeated field.
  6759. @item repeated.top
  6760. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6761. @item repeated.bottom
  6762. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6763. @end table
  6764. The filter accepts the following options:
  6765. @table @option
  6766. @item intl_thres
  6767. Set interlacing threshold.
  6768. @item prog_thres
  6769. Set progressive threshold.
  6770. @item rep_thres
  6771. Threshold for repeated field detection.
  6772. @item half_life
  6773. Number of frames after which a given frame's contribution to the
  6774. statistics is halved (i.e., it contributes only 0.5 to it's
  6775. classification). The default of 0 means that all frames seen are given
  6776. full weight of 1.0 forever.
  6777. @item analyze_interlaced_flag
  6778. When this is not 0 then idet will use the specified number of frames to determine
  6779. if the interlaced flag is accurate, it will not count undetermined frames.
  6780. If the flag is found to be accurate it will be used without any further
  6781. computations, if it is found to be inaccurate it will be cleared without any
  6782. further computations. This allows inserting the idet filter as a low computational
  6783. method to clean up the interlaced flag
  6784. @end table
  6785. @section il
  6786. Deinterleave or interleave fields.
  6787. This filter allows one to process interlaced images fields without
  6788. deinterlacing them. Deinterleaving splits the input frame into 2
  6789. fields (so called half pictures). Odd lines are moved to the top
  6790. half of the output image, even lines to the bottom half.
  6791. You can process (filter) them independently and then re-interleave them.
  6792. The filter accepts the following options:
  6793. @table @option
  6794. @item luma_mode, l
  6795. @item chroma_mode, c
  6796. @item alpha_mode, a
  6797. Available values for @var{luma_mode}, @var{chroma_mode} and
  6798. @var{alpha_mode} are:
  6799. @table @samp
  6800. @item none
  6801. Do nothing.
  6802. @item deinterleave, d
  6803. Deinterleave fields, placing one above the other.
  6804. @item interleave, i
  6805. Interleave fields. Reverse the effect of deinterleaving.
  6806. @end table
  6807. Default value is @code{none}.
  6808. @item luma_swap, ls
  6809. @item chroma_swap, cs
  6810. @item alpha_swap, as
  6811. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6812. @end table
  6813. @section inflate
  6814. Apply inflate effect to the video.
  6815. This filter replaces the pixel by the local(3x3) average by taking into account
  6816. only values higher than the pixel.
  6817. It accepts the following options:
  6818. @table @option
  6819. @item threshold0
  6820. @item threshold1
  6821. @item threshold2
  6822. @item threshold3
  6823. Limit the maximum change for each plane, default is 65535.
  6824. If 0, plane will remain unchanged.
  6825. @end table
  6826. @section interlace
  6827. Simple interlacing filter from progressive contents. This interleaves upper (or
  6828. lower) lines from odd frames with lower (or upper) lines from even frames,
  6829. halving the frame rate and preserving image height.
  6830. @example
  6831. Original Original New Frame
  6832. Frame 'j' Frame 'j+1' (tff)
  6833. ========== =========== ==================
  6834. Line 0 --------------------> Frame 'j' Line 0
  6835. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6836. Line 2 ---------------------> Frame 'j' Line 2
  6837. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6838. ... ... ...
  6839. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6840. @end example
  6841. It accepts the following optional parameters:
  6842. @table @option
  6843. @item scan
  6844. This determines whether the interlaced frame is taken from the even
  6845. (tff - default) or odd (bff) lines of the progressive frame.
  6846. @item lowpass
  6847. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6848. interlacing and reduce moire patterns.
  6849. @end table
  6850. @section kerndeint
  6851. Deinterlace input video by applying Donald Graft's adaptive kernel
  6852. deinterling. Work on interlaced parts of a video to produce
  6853. progressive frames.
  6854. The description of the accepted parameters follows.
  6855. @table @option
  6856. @item thresh
  6857. Set the threshold which affects the filter's tolerance when
  6858. determining if a pixel line must be processed. It must be an integer
  6859. in the range [0,255] and defaults to 10. A value of 0 will result in
  6860. applying the process on every pixels.
  6861. @item map
  6862. Paint pixels exceeding the threshold value to white if set to 1.
  6863. Default is 0.
  6864. @item order
  6865. Set the fields order. Swap fields if set to 1, leave fields alone if
  6866. 0. Default is 0.
  6867. @item sharp
  6868. Enable additional sharpening if set to 1. Default is 0.
  6869. @item twoway
  6870. Enable twoway sharpening if set to 1. Default is 0.
  6871. @end table
  6872. @subsection Examples
  6873. @itemize
  6874. @item
  6875. Apply default values:
  6876. @example
  6877. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6878. @end example
  6879. @item
  6880. Enable additional sharpening:
  6881. @example
  6882. kerndeint=sharp=1
  6883. @end example
  6884. @item
  6885. Paint processed pixels in white:
  6886. @example
  6887. kerndeint=map=1
  6888. @end example
  6889. @end itemize
  6890. @section lenscorrection
  6891. Correct radial lens distortion
  6892. This filter can be used to correct for radial distortion as can result from the use
  6893. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6894. one can use tools available for example as part of opencv or simply trial-and-error.
  6895. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6896. and extract the k1 and k2 coefficients from the resulting matrix.
  6897. Note that effectively the same filter is available in the open-source tools Krita and
  6898. Digikam from the KDE project.
  6899. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6900. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6901. brightness distribution, so you may want to use both filters together in certain
  6902. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6903. be applied before or after lens correction.
  6904. @subsection Options
  6905. The filter accepts the following options:
  6906. @table @option
  6907. @item cx
  6908. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6909. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6910. width.
  6911. @item cy
  6912. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6913. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6914. height.
  6915. @item k1
  6916. Coefficient of the quadratic correction term. 0.5 means no correction.
  6917. @item k2
  6918. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6919. @end table
  6920. The formula that generates the correction is:
  6921. @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)
  6922. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6923. distances from the focal point in the source and target images, respectively.
  6924. @section loop, aloop
  6925. Loop video frames or audio samples.
  6926. Those filters accepts the following options:
  6927. @table @option
  6928. @item loop
  6929. Set the number of loops.
  6930. @item size
  6931. Set maximal size in number of frames for @code{loop} filter or maximal number
  6932. of samples in case of @code{aloop} filter.
  6933. @item start
  6934. Set first frame of loop for @code{loop} filter or first sample of loop in case
  6935. of @code{aloop} filter.
  6936. @end table
  6937. @anchor{lut3d}
  6938. @section lut3d
  6939. Apply a 3D LUT to an input video.
  6940. The filter accepts the following options:
  6941. @table @option
  6942. @item file
  6943. Set the 3D LUT file name.
  6944. Currently supported formats:
  6945. @table @samp
  6946. @item 3dl
  6947. AfterEffects
  6948. @item cube
  6949. Iridas
  6950. @item dat
  6951. DaVinci
  6952. @item m3d
  6953. Pandora
  6954. @end table
  6955. @item interp
  6956. Select interpolation mode.
  6957. Available values are:
  6958. @table @samp
  6959. @item nearest
  6960. Use values from the nearest defined point.
  6961. @item trilinear
  6962. Interpolate values using the 8 points defining a cube.
  6963. @item tetrahedral
  6964. Interpolate values using a tetrahedron.
  6965. @end table
  6966. @end table
  6967. @section lut, lutrgb, lutyuv
  6968. Compute a look-up table for binding each pixel component input value
  6969. to an output value, and apply it to the input video.
  6970. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6971. to an RGB input video.
  6972. These filters accept the following parameters:
  6973. @table @option
  6974. @item c0
  6975. set first pixel component expression
  6976. @item c1
  6977. set second pixel component expression
  6978. @item c2
  6979. set third pixel component expression
  6980. @item c3
  6981. set fourth pixel component expression, corresponds to the alpha component
  6982. @item r
  6983. set red component expression
  6984. @item g
  6985. set green component expression
  6986. @item b
  6987. set blue component expression
  6988. @item a
  6989. alpha component expression
  6990. @item y
  6991. set Y/luminance component expression
  6992. @item u
  6993. set U/Cb component expression
  6994. @item v
  6995. set V/Cr component expression
  6996. @end table
  6997. Each of them specifies the expression to use for computing the lookup table for
  6998. the corresponding pixel component values.
  6999. The exact component associated to each of the @var{c*} options depends on the
  7000. format in input.
  7001. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7002. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7003. The expressions can contain the following constants and functions:
  7004. @table @option
  7005. @item w
  7006. @item h
  7007. The input width and height.
  7008. @item val
  7009. The input value for the pixel component.
  7010. @item clipval
  7011. The input value, clipped to the @var{minval}-@var{maxval} range.
  7012. @item maxval
  7013. The maximum value for the pixel component.
  7014. @item minval
  7015. The minimum value for the pixel component.
  7016. @item negval
  7017. The negated value for the pixel component value, clipped to the
  7018. @var{minval}-@var{maxval} range; it corresponds to the expression
  7019. "maxval-clipval+minval".
  7020. @item clip(val)
  7021. The computed value in @var{val}, clipped to the
  7022. @var{minval}-@var{maxval} range.
  7023. @item gammaval(gamma)
  7024. The computed gamma correction value of the pixel component value,
  7025. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7026. expression
  7027. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7028. @end table
  7029. All expressions default to "val".
  7030. @subsection Examples
  7031. @itemize
  7032. @item
  7033. Negate input video:
  7034. @example
  7035. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7036. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7037. @end example
  7038. The above is the same as:
  7039. @example
  7040. lutrgb="r=negval:g=negval:b=negval"
  7041. lutyuv="y=negval:u=negval:v=negval"
  7042. @end example
  7043. @item
  7044. Negate luminance:
  7045. @example
  7046. lutyuv=y=negval
  7047. @end example
  7048. @item
  7049. Remove chroma components, turning the video into a graytone image:
  7050. @example
  7051. lutyuv="u=128:v=128"
  7052. @end example
  7053. @item
  7054. Apply a luma burning effect:
  7055. @example
  7056. lutyuv="y=2*val"
  7057. @end example
  7058. @item
  7059. Remove green and blue components:
  7060. @example
  7061. lutrgb="g=0:b=0"
  7062. @end example
  7063. @item
  7064. Set a constant alpha channel value on input:
  7065. @example
  7066. format=rgba,lutrgb=a="maxval-minval/2"
  7067. @end example
  7068. @item
  7069. Correct luminance gamma by a factor of 0.5:
  7070. @example
  7071. lutyuv=y=gammaval(0.5)
  7072. @end example
  7073. @item
  7074. Discard least significant bits of luma:
  7075. @example
  7076. lutyuv=y='bitand(val, 128+64+32)'
  7077. @end example
  7078. @end itemize
  7079. @section maskedmerge
  7080. Merge the first input stream with the second input stream using per pixel
  7081. weights in the third input stream.
  7082. A value of 0 in the third stream pixel component means that pixel component
  7083. from first stream is returned unchanged, while maximum value (eg. 255 for
  7084. 8-bit videos) means that pixel component from second stream is returned
  7085. unchanged. Intermediate values define the amount of merging between both
  7086. input stream's pixel components.
  7087. This filter accepts the following options:
  7088. @table @option
  7089. @item planes
  7090. Set which planes will be processed as bitmap, unprocessed planes will be
  7091. copied from first stream.
  7092. By default value 0xf, all planes will be processed.
  7093. @end table
  7094. @section mcdeint
  7095. Apply motion-compensation deinterlacing.
  7096. It needs one field per frame as input and must thus be used together
  7097. with yadif=1/3 or equivalent.
  7098. This filter accepts the following options:
  7099. @table @option
  7100. @item mode
  7101. Set the deinterlacing mode.
  7102. It accepts one of the following values:
  7103. @table @samp
  7104. @item fast
  7105. @item medium
  7106. @item slow
  7107. use iterative motion estimation
  7108. @item extra_slow
  7109. like @samp{slow}, but use multiple reference frames.
  7110. @end table
  7111. Default value is @samp{fast}.
  7112. @item parity
  7113. Set the picture field parity assumed for the input video. It must be
  7114. one of the following values:
  7115. @table @samp
  7116. @item 0, tff
  7117. assume top field first
  7118. @item 1, bff
  7119. assume bottom field first
  7120. @end table
  7121. Default value is @samp{bff}.
  7122. @item qp
  7123. Set per-block quantization parameter (QP) used by the internal
  7124. encoder.
  7125. Higher values should result in a smoother motion vector field but less
  7126. optimal individual vectors. Default value is 1.
  7127. @end table
  7128. @section mergeplanes
  7129. Merge color channel components from several video streams.
  7130. The filter accepts up to 4 input streams, and merge selected input
  7131. planes to the output video.
  7132. This filter accepts the following options:
  7133. @table @option
  7134. @item mapping
  7135. Set input to output plane mapping. Default is @code{0}.
  7136. The mappings is specified as a bitmap. It should be specified as a
  7137. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7138. mapping for the first plane of the output stream. 'A' sets the number of
  7139. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7140. corresponding input to use (from 0 to 3). The rest of the mappings is
  7141. similar, 'Bb' describes the mapping for the output stream second
  7142. plane, 'Cc' describes the mapping for the output stream third plane and
  7143. 'Dd' describes the mapping for the output stream fourth plane.
  7144. @item format
  7145. Set output pixel format. Default is @code{yuva444p}.
  7146. @end table
  7147. @subsection Examples
  7148. @itemize
  7149. @item
  7150. Merge three gray video streams of same width and height into single video stream:
  7151. @example
  7152. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7153. @end example
  7154. @item
  7155. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7156. @example
  7157. [a0][a1]mergeplanes=0x00010210:yuva444p
  7158. @end example
  7159. @item
  7160. Swap Y and A plane in yuva444p stream:
  7161. @example
  7162. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7163. @end example
  7164. @item
  7165. Swap U and V plane in yuv420p stream:
  7166. @example
  7167. format=yuv420p,mergeplanes=0x000201:yuv420p
  7168. @end example
  7169. @item
  7170. Cast a rgb24 clip to yuv444p:
  7171. @example
  7172. format=rgb24,mergeplanes=0x000102:yuv444p
  7173. @end example
  7174. @end itemize
  7175. @section metadata, ametadata
  7176. Manipulate frame metadata.
  7177. This filter accepts the following options:
  7178. @table @option
  7179. @item mode
  7180. Set mode of operation of the filter.
  7181. Can be one of the following:
  7182. @table @samp
  7183. @item select
  7184. If both @code{value} and @code{key} is set, select frames
  7185. which have such metadata. If only @code{key} is set, select
  7186. every frame that has such key in metadata.
  7187. @item add
  7188. Add new metadata @code{key} and @code{value}. If key is already available
  7189. do nothing.
  7190. @item modify
  7191. Modify value of already present key.
  7192. @item delete
  7193. If @code{value} is set, delete only keys that have such value.
  7194. Otherwise, delete key.
  7195. @item print
  7196. Print key and its value if metadata was found. If @code{key} is not set print all
  7197. metadata values available in frame.
  7198. @end table
  7199. @item key
  7200. Set key used with all modes. Must be set for all modes except @code{print}.
  7201. @item value
  7202. Set metadata value which will be used. This option is mandatory for
  7203. @code{modify} and @code{add} mode.
  7204. @item function
  7205. Which function to use when comparing metadata value and @code{value}.
  7206. Can be one of following:
  7207. @table @samp
  7208. @item same_str
  7209. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  7210. @item starts_with
  7211. Values are interpreted as strings, returns true if metadata value starts with
  7212. the @code{value} option string.
  7213. @item less
  7214. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  7215. @item equal
  7216. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  7217. @item greater
  7218. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  7219. @item expr
  7220. Values are interpreted as floats, returns true if expression from option @code{expr}
  7221. evaluates to true.
  7222. @end table
  7223. @item expr
  7224. Set expression which is used when @code{function} is set to @code{expr}.
  7225. The expression is evaluated through the eval API and can contain the following
  7226. constants:
  7227. @table @option
  7228. @item VALUE1
  7229. Float representation of @code{value} from metadata key.
  7230. @item VALUE2
  7231. Float representation of @code{value} as supplied by user in @code{value} option.
  7232. @item file
  7233. If specified in @code{print} mode, output is written to the named file. Instead of
  7234. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  7235. for standard output. If @code{file} option is not set, output is written to the log
  7236. with AV_LOG_INFO loglevel.
  7237. @end table
  7238. @end table
  7239. @subsection Examples
  7240. @itemize
  7241. @item
  7242. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  7243. between 0 and 1.
  7244. @example
  7245. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  7246. @end example
  7247. @item
  7248. Print silencedetect output to file @file{metadata.txt}.
  7249. @example
  7250. silencedetect,ametadata=mode=print:file=metadata.txt
  7251. @end example
  7252. @item
  7253. Direct all metadata to a pipe with file descriptor 4.
  7254. @example
  7255. metadata=mode=print:file='pipe\:4'
  7256. @end example
  7257. @end itemize
  7258. @section mpdecimate
  7259. Drop frames that do not differ greatly from the previous frame in
  7260. order to reduce frame rate.
  7261. The main use of this filter is for very-low-bitrate encoding
  7262. (e.g. streaming over dialup modem), but it could in theory be used for
  7263. fixing movies that were inverse-telecined incorrectly.
  7264. A description of the accepted options follows.
  7265. @table @option
  7266. @item max
  7267. Set the maximum number of consecutive frames which can be dropped (if
  7268. positive), or the minimum interval between dropped frames (if
  7269. negative). If the value is 0, the frame is dropped unregarding the
  7270. number of previous sequentially dropped frames.
  7271. Default value is 0.
  7272. @item hi
  7273. @item lo
  7274. @item frac
  7275. Set the dropping threshold values.
  7276. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7277. represent actual pixel value differences, so a threshold of 64
  7278. corresponds to 1 unit of difference for each pixel, or the same spread
  7279. out differently over the block.
  7280. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7281. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7282. meaning the whole image) differ by more than a threshold of @option{lo}.
  7283. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7284. 64*5, and default value for @option{frac} is 0.33.
  7285. @end table
  7286. @section negate
  7287. Negate input video.
  7288. It accepts an integer in input; if non-zero it negates the
  7289. alpha component (if available). The default value in input is 0.
  7290. @section nnedi
  7291. Deinterlace video using neural network edge directed interpolation.
  7292. This filter accepts the following options:
  7293. @table @option
  7294. @item weights
  7295. Mandatory option, without binary file filter can not work.
  7296. Currently file can be found here:
  7297. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7298. @item deint
  7299. Set which frames to deinterlace, by default it is @code{all}.
  7300. Can be @code{all} or @code{interlaced}.
  7301. @item field
  7302. Set mode of operation.
  7303. Can be one of the following:
  7304. @table @samp
  7305. @item af
  7306. Use frame flags, both fields.
  7307. @item a
  7308. Use frame flags, single field.
  7309. @item t
  7310. Use top field only.
  7311. @item b
  7312. Use bottom field only.
  7313. @item tf
  7314. Use both fields, top first.
  7315. @item bf
  7316. Use both fields, bottom first.
  7317. @end table
  7318. @item planes
  7319. Set which planes to process, by default filter process all frames.
  7320. @item nsize
  7321. Set size of local neighborhood around each pixel, used by the predictor neural
  7322. network.
  7323. Can be one of the following:
  7324. @table @samp
  7325. @item s8x6
  7326. @item s16x6
  7327. @item s32x6
  7328. @item s48x6
  7329. @item s8x4
  7330. @item s16x4
  7331. @item s32x4
  7332. @end table
  7333. @item nns
  7334. Set the number of neurons in predicctor neural network.
  7335. Can be one of the following:
  7336. @table @samp
  7337. @item n16
  7338. @item n32
  7339. @item n64
  7340. @item n128
  7341. @item n256
  7342. @end table
  7343. @item qual
  7344. Controls the number of different neural network predictions that are blended
  7345. together to compute the final output value. Can be @code{fast}, default or
  7346. @code{slow}.
  7347. @item etype
  7348. Set which set of weights to use in the predictor.
  7349. Can be one of the following:
  7350. @table @samp
  7351. @item a
  7352. weights trained to minimize absolute error
  7353. @item s
  7354. weights trained to minimize squared error
  7355. @end table
  7356. @item pscrn
  7357. Controls whether or not the prescreener neural network is used to decide
  7358. which pixels should be processed by the predictor neural network and which
  7359. can be handled by simple cubic interpolation.
  7360. The prescreener is trained to know whether cubic interpolation will be
  7361. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7362. The computational complexity of the prescreener nn is much less than that of
  7363. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7364. using the prescreener generally results in much faster processing.
  7365. The prescreener is pretty accurate, so the difference between using it and not
  7366. using it is almost always unnoticeable.
  7367. Can be one of the following:
  7368. @table @samp
  7369. @item none
  7370. @item original
  7371. @item new
  7372. @end table
  7373. Default is @code{new}.
  7374. @item fapprox
  7375. Set various debugging flags.
  7376. @end table
  7377. @section noformat
  7378. Force libavfilter not to use any of the specified pixel formats for the
  7379. input to the next filter.
  7380. It accepts the following parameters:
  7381. @table @option
  7382. @item pix_fmts
  7383. A '|'-separated list of pixel format names, such as
  7384. apix_fmts=yuv420p|monow|rgb24".
  7385. @end table
  7386. @subsection Examples
  7387. @itemize
  7388. @item
  7389. Force libavfilter to use a format different from @var{yuv420p} for the
  7390. input to the vflip filter:
  7391. @example
  7392. noformat=pix_fmts=yuv420p,vflip
  7393. @end example
  7394. @item
  7395. Convert the input video to any of the formats not contained in the list:
  7396. @example
  7397. noformat=yuv420p|yuv444p|yuv410p
  7398. @end example
  7399. @end itemize
  7400. @section noise
  7401. Add noise on video input frame.
  7402. The filter accepts the following options:
  7403. @table @option
  7404. @item all_seed
  7405. @item c0_seed
  7406. @item c1_seed
  7407. @item c2_seed
  7408. @item c3_seed
  7409. Set noise seed for specific pixel component or all pixel components in case
  7410. of @var{all_seed}. Default value is @code{123457}.
  7411. @item all_strength, alls
  7412. @item c0_strength, c0s
  7413. @item c1_strength, c1s
  7414. @item c2_strength, c2s
  7415. @item c3_strength, c3s
  7416. Set noise strength for specific pixel component or all pixel components in case
  7417. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7418. @item all_flags, allf
  7419. @item c0_flags, c0f
  7420. @item c1_flags, c1f
  7421. @item c2_flags, c2f
  7422. @item c3_flags, c3f
  7423. Set pixel component flags or set flags for all components if @var{all_flags}.
  7424. Available values for component flags are:
  7425. @table @samp
  7426. @item a
  7427. averaged temporal noise (smoother)
  7428. @item p
  7429. mix random noise with a (semi)regular pattern
  7430. @item t
  7431. temporal noise (noise pattern changes between frames)
  7432. @item u
  7433. uniform noise (gaussian otherwise)
  7434. @end table
  7435. @end table
  7436. @subsection Examples
  7437. Add temporal and uniform noise to input video:
  7438. @example
  7439. noise=alls=20:allf=t+u
  7440. @end example
  7441. @section null
  7442. Pass the video source unchanged to the output.
  7443. @section ocr
  7444. Optical Character Recognition
  7445. This filter uses Tesseract for optical character recognition.
  7446. It accepts the following options:
  7447. @table @option
  7448. @item datapath
  7449. Set datapath to tesseract data. Default is to use whatever was
  7450. set at installation.
  7451. @item language
  7452. Set language, default is "eng".
  7453. @item whitelist
  7454. Set character whitelist.
  7455. @item blacklist
  7456. Set character blacklist.
  7457. @end table
  7458. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7459. @section ocv
  7460. Apply a video transform using libopencv.
  7461. To enable this filter, install the libopencv library and headers and
  7462. configure FFmpeg with @code{--enable-libopencv}.
  7463. It accepts the following parameters:
  7464. @table @option
  7465. @item filter_name
  7466. The name of the libopencv filter to apply.
  7467. @item filter_params
  7468. The parameters to pass to the libopencv filter. If not specified, the default
  7469. values are assumed.
  7470. @end table
  7471. Refer to the official libopencv documentation for more precise
  7472. information:
  7473. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7474. Several libopencv filters are supported; see the following subsections.
  7475. @anchor{dilate}
  7476. @subsection dilate
  7477. Dilate an image by using a specific structuring element.
  7478. It corresponds to the libopencv function @code{cvDilate}.
  7479. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7480. @var{struct_el} represents a structuring element, and has the syntax:
  7481. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7482. @var{cols} and @var{rows} represent the number of columns and rows of
  7483. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7484. point, and @var{shape} the shape for the structuring element. @var{shape}
  7485. must be "rect", "cross", "ellipse", or "custom".
  7486. If the value for @var{shape} is "custom", it must be followed by a
  7487. string of the form "=@var{filename}". The file with name
  7488. @var{filename} is assumed to represent a binary image, with each
  7489. printable character corresponding to a bright pixel. When a custom
  7490. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7491. or columns and rows of the read file are assumed instead.
  7492. The default value for @var{struct_el} is "3x3+0x0/rect".
  7493. @var{nb_iterations} specifies the number of times the transform is
  7494. applied to the image, and defaults to 1.
  7495. Some examples:
  7496. @example
  7497. # Use the default values
  7498. ocv=dilate
  7499. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7500. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7501. # Read the shape from the file diamond.shape, iterating two times.
  7502. # The file diamond.shape may contain a pattern of characters like this
  7503. # *
  7504. # ***
  7505. # *****
  7506. # ***
  7507. # *
  7508. # The specified columns and rows are ignored
  7509. # but the anchor point coordinates are not
  7510. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7511. @end example
  7512. @subsection erode
  7513. Erode an image by using a specific structuring element.
  7514. It corresponds to the libopencv function @code{cvErode}.
  7515. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7516. with the same syntax and semantics as the @ref{dilate} filter.
  7517. @subsection smooth
  7518. Smooth the input video.
  7519. The filter takes the following parameters:
  7520. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7521. @var{type} is the type of smooth filter to apply, and must be one of
  7522. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7523. or "bilateral". The default value is "gaussian".
  7524. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7525. depend on the smooth type. @var{param1} and
  7526. @var{param2} accept integer positive values or 0. @var{param3} and
  7527. @var{param4} accept floating point values.
  7528. The default value for @var{param1} is 3. The default value for the
  7529. other parameters is 0.
  7530. These parameters correspond to the parameters assigned to the
  7531. libopencv function @code{cvSmooth}.
  7532. @anchor{overlay}
  7533. @section overlay
  7534. Overlay one video on top of another.
  7535. It takes two inputs and has one output. The first input is the "main"
  7536. video on which the second input is overlaid.
  7537. It accepts the following parameters:
  7538. A description of the accepted options follows.
  7539. @table @option
  7540. @item x
  7541. @item y
  7542. Set the expression for the x and y coordinates of the overlaid video
  7543. on the main video. Default value is "0" for both expressions. In case
  7544. the expression is invalid, it is set to a huge value (meaning that the
  7545. overlay will not be displayed within the output visible area).
  7546. @item eof_action
  7547. The action to take when EOF is encountered on the secondary input; it accepts
  7548. one of the following values:
  7549. @table @option
  7550. @item repeat
  7551. Repeat the last frame (the default).
  7552. @item endall
  7553. End both streams.
  7554. @item pass
  7555. Pass the main input through.
  7556. @end table
  7557. @item eval
  7558. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7559. It accepts the following values:
  7560. @table @samp
  7561. @item init
  7562. only evaluate expressions once during the filter initialization or
  7563. when a command is processed
  7564. @item frame
  7565. evaluate expressions for each incoming frame
  7566. @end table
  7567. Default value is @samp{frame}.
  7568. @item shortest
  7569. If set to 1, force the output to terminate when the shortest input
  7570. terminates. Default value is 0.
  7571. @item format
  7572. Set the format for the output video.
  7573. It accepts the following values:
  7574. @table @samp
  7575. @item yuv420
  7576. force YUV420 output
  7577. @item yuv422
  7578. force YUV422 output
  7579. @item yuv444
  7580. force YUV444 output
  7581. @item rgb
  7582. force RGB output
  7583. @end table
  7584. Default value is @samp{yuv420}.
  7585. @item rgb @emph{(deprecated)}
  7586. If set to 1, force the filter to accept inputs in the RGB
  7587. color space. Default value is 0. This option is deprecated, use
  7588. @option{format} instead.
  7589. @item repeatlast
  7590. If set to 1, force the filter to draw the last overlay frame over the
  7591. main input until the end of the stream. A value of 0 disables this
  7592. behavior. Default value is 1.
  7593. @end table
  7594. The @option{x}, and @option{y} expressions can contain the following
  7595. parameters.
  7596. @table @option
  7597. @item main_w, W
  7598. @item main_h, H
  7599. The main input width and height.
  7600. @item overlay_w, w
  7601. @item overlay_h, h
  7602. The overlay input width and height.
  7603. @item x
  7604. @item y
  7605. The computed values for @var{x} and @var{y}. They are evaluated for
  7606. each new frame.
  7607. @item hsub
  7608. @item vsub
  7609. horizontal and vertical chroma subsample values of the output
  7610. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7611. @var{vsub} is 1.
  7612. @item n
  7613. the number of input frame, starting from 0
  7614. @item pos
  7615. the position in the file of the input frame, NAN if unknown
  7616. @item t
  7617. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7618. @end table
  7619. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7620. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7621. when @option{eval} is set to @samp{init}.
  7622. Be aware that frames are taken from each input video in timestamp
  7623. order, hence, if their initial timestamps differ, it is a good idea
  7624. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7625. have them begin in the same zero timestamp, as the example for
  7626. the @var{movie} filter does.
  7627. You can chain together more overlays but you should test the
  7628. efficiency of such approach.
  7629. @subsection Commands
  7630. This filter supports the following commands:
  7631. @table @option
  7632. @item x
  7633. @item y
  7634. Modify the x and y of the overlay input.
  7635. The command accepts the same syntax of the corresponding option.
  7636. If the specified expression is not valid, it is kept at its current
  7637. value.
  7638. @end table
  7639. @subsection Examples
  7640. @itemize
  7641. @item
  7642. Draw the overlay at 10 pixels from the bottom right corner of the main
  7643. video:
  7644. @example
  7645. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7646. @end example
  7647. Using named options the example above becomes:
  7648. @example
  7649. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7650. @end example
  7651. @item
  7652. Insert a transparent PNG logo in the bottom left corner of the input,
  7653. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7654. @example
  7655. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7656. @end example
  7657. @item
  7658. Insert 2 different transparent PNG logos (second logo on bottom
  7659. right corner) using the @command{ffmpeg} tool:
  7660. @example
  7661. 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
  7662. @end example
  7663. @item
  7664. Add a transparent color layer on top of the main video; @code{WxH}
  7665. must specify the size of the main input to the overlay filter:
  7666. @example
  7667. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7668. @end example
  7669. @item
  7670. Play an original video and a filtered version (here with the deshake
  7671. filter) side by side using the @command{ffplay} tool:
  7672. @example
  7673. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7674. @end example
  7675. The above command is the same as:
  7676. @example
  7677. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7678. @end example
  7679. @item
  7680. Make a sliding overlay appearing from the left to the right top part of the
  7681. screen starting since time 2:
  7682. @example
  7683. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7684. @end example
  7685. @item
  7686. Compose output by putting two input videos side to side:
  7687. @example
  7688. ffmpeg -i left.avi -i right.avi -filter_complex "
  7689. nullsrc=size=200x100 [background];
  7690. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7691. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7692. [background][left] overlay=shortest=1 [background+left];
  7693. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7694. "
  7695. @end example
  7696. @item
  7697. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7698. @example
  7699. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7700. -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]'
  7701. masked.avi
  7702. @end example
  7703. @item
  7704. Chain several overlays in cascade:
  7705. @example
  7706. nullsrc=s=200x200 [bg];
  7707. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7708. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7709. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7710. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7711. [in3] null, [mid2] overlay=100:100 [out0]
  7712. @end example
  7713. @end itemize
  7714. @section owdenoise
  7715. Apply Overcomplete Wavelet denoiser.
  7716. The filter accepts the following options:
  7717. @table @option
  7718. @item depth
  7719. Set depth.
  7720. Larger depth values will denoise lower frequency components more, but
  7721. slow down filtering.
  7722. Must be an int in the range 8-16, default is @code{8}.
  7723. @item luma_strength, ls
  7724. Set luma strength.
  7725. Must be a double value in the range 0-1000, default is @code{1.0}.
  7726. @item chroma_strength, cs
  7727. Set chroma strength.
  7728. Must be a double value in the range 0-1000, default is @code{1.0}.
  7729. @end table
  7730. @anchor{pad}
  7731. @section pad
  7732. Add paddings to the input image, and place the original input at the
  7733. provided @var{x}, @var{y} coordinates.
  7734. It accepts the following parameters:
  7735. @table @option
  7736. @item width, w
  7737. @item height, h
  7738. Specify an expression for the size of the output image with the
  7739. paddings added. If the value for @var{width} or @var{height} is 0, the
  7740. corresponding input size is used for the output.
  7741. The @var{width} expression can reference the value set by the
  7742. @var{height} expression, and vice versa.
  7743. The default value of @var{width} and @var{height} is 0.
  7744. @item x
  7745. @item y
  7746. Specify the offsets to place the input image at within the padded area,
  7747. with respect to the top/left border of the output image.
  7748. The @var{x} expression can reference the value set by the @var{y}
  7749. expression, and vice versa.
  7750. The default value of @var{x} and @var{y} is 0.
  7751. @item color
  7752. Specify the color of the padded area. For the syntax of this option,
  7753. check the "Color" section in the ffmpeg-utils manual.
  7754. The default value of @var{color} is "black".
  7755. @end table
  7756. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  7757. options are expressions containing the following constants:
  7758. @table @option
  7759. @item in_w
  7760. @item in_h
  7761. The input video width and height.
  7762. @item iw
  7763. @item ih
  7764. These are the same as @var{in_w} and @var{in_h}.
  7765. @item out_w
  7766. @item out_h
  7767. The output width and height (the size of the padded area), as
  7768. specified by the @var{width} and @var{height} expressions.
  7769. @item ow
  7770. @item oh
  7771. These are the same as @var{out_w} and @var{out_h}.
  7772. @item x
  7773. @item y
  7774. The x and y offsets as specified by the @var{x} and @var{y}
  7775. expressions, or NAN if not yet specified.
  7776. @item a
  7777. same as @var{iw} / @var{ih}
  7778. @item sar
  7779. input sample aspect ratio
  7780. @item dar
  7781. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7782. @item hsub
  7783. @item vsub
  7784. The horizontal and vertical chroma subsample values. For example for the
  7785. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7786. @end table
  7787. @subsection Examples
  7788. @itemize
  7789. @item
  7790. Add paddings with the color "violet" to the input video. The output video
  7791. size is 640x480, and the top-left corner of the input video is placed at
  7792. column 0, row 40
  7793. @example
  7794. pad=640:480:0:40:violet
  7795. @end example
  7796. The example above is equivalent to the following command:
  7797. @example
  7798. pad=width=640:height=480:x=0:y=40:color=violet
  7799. @end example
  7800. @item
  7801. Pad the input to get an output with dimensions increased by 3/2,
  7802. and put the input video at the center of the padded area:
  7803. @example
  7804. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  7805. @end example
  7806. @item
  7807. Pad the input to get a squared output with size equal to the maximum
  7808. value between the input width and height, and put the input video at
  7809. the center of the padded area:
  7810. @example
  7811. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  7812. @end example
  7813. @item
  7814. Pad the input to get a final w/h ratio of 16:9:
  7815. @example
  7816. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  7817. @end example
  7818. @item
  7819. In case of anamorphic video, in order to set the output display aspect
  7820. correctly, it is necessary to use @var{sar} in the expression,
  7821. according to the relation:
  7822. @example
  7823. (ih * X / ih) * sar = output_dar
  7824. X = output_dar / sar
  7825. @end example
  7826. Thus the previous example needs to be modified to:
  7827. @example
  7828. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  7829. @end example
  7830. @item
  7831. Double the output size and put the input video in the bottom-right
  7832. corner of the output padded area:
  7833. @example
  7834. pad="2*iw:2*ih:ow-iw:oh-ih"
  7835. @end example
  7836. @end itemize
  7837. @anchor{palettegen}
  7838. @section palettegen
  7839. Generate one palette for a whole video stream.
  7840. It accepts the following options:
  7841. @table @option
  7842. @item max_colors
  7843. Set the maximum number of colors to quantize in the palette.
  7844. Note: the palette will still contain 256 colors; the unused palette entries
  7845. will be black.
  7846. @item reserve_transparent
  7847. Create a palette of 255 colors maximum and reserve the last one for
  7848. transparency. Reserving the transparency color is useful for GIF optimization.
  7849. If not set, the maximum of colors in the palette will be 256. You probably want
  7850. to disable this option for a standalone image.
  7851. Set by default.
  7852. @item stats_mode
  7853. Set statistics mode.
  7854. It accepts the following values:
  7855. @table @samp
  7856. @item full
  7857. Compute full frame histograms.
  7858. @item diff
  7859. Compute histograms only for the part that differs from previous frame. This
  7860. might be relevant to give more importance to the moving part of your input if
  7861. the background is static.
  7862. @end table
  7863. Default value is @var{full}.
  7864. @end table
  7865. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  7866. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  7867. color quantization of the palette. This information is also visible at
  7868. @var{info} logging level.
  7869. @subsection Examples
  7870. @itemize
  7871. @item
  7872. Generate a representative palette of a given video using @command{ffmpeg}:
  7873. @example
  7874. ffmpeg -i input.mkv -vf palettegen palette.png
  7875. @end example
  7876. @end itemize
  7877. @section paletteuse
  7878. Use a palette to downsample an input video stream.
  7879. The filter takes two inputs: one video stream and a palette. The palette must
  7880. be a 256 pixels image.
  7881. It accepts the following options:
  7882. @table @option
  7883. @item dither
  7884. Select dithering mode. Available algorithms are:
  7885. @table @samp
  7886. @item bayer
  7887. Ordered 8x8 bayer dithering (deterministic)
  7888. @item heckbert
  7889. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  7890. Note: this dithering is sometimes considered "wrong" and is included as a
  7891. reference.
  7892. @item floyd_steinberg
  7893. Floyd and Steingberg dithering (error diffusion)
  7894. @item sierra2
  7895. Frankie Sierra dithering v2 (error diffusion)
  7896. @item sierra2_4a
  7897. Frankie Sierra dithering v2 "Lite" (error diffusion)
  7898. @end table
  7899. Default is @var{sierra2_4a}.
  7900. @item bayer_scale
  7901. When @var{bayer} dithering is selected, this option defines the scale of the
  7902. pattern (how much the crosshatch pattern is visible). A low value means more
  7903. visible pattern for less banding, and higher value means less visible pattern
  7904. at the cost of more banding.
  7905. The option must be an integer value in the range [0,5]. Default is @var{2}.
  7906. @item diff_mode
  7907. If set, define the zone to process
  7908. @table @samp
  7909. @item rectangle
  7910. Only the changing rectangle will be reprocessed. This is similar to GIF
  7911. cropping/offsetting compression mechanism. This option can be useful for speed
  7912. if only a part of the image is changing, and has use cases such as limiting the
  7913. scope of the error diffusal @option{dither} to the rectangle that bounds the
  7914. moving scene (it leads to more deterministic output if the scene doesn't change
  7915. much, and as a result less moving noise and better GIF compression).
  7916. @end table
  7917. Default is @var{none}.
  7918. @end table
  7919. @subsection Examples
  7920. @itemize
  7921. @item
  7922. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  7923. using @command{ffmpeg}:
  7924. @example
  7925. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  7926. @end example
  7927. @end itemize
  7928. @section perspective
  7929. Correct perspective of video not recorded perpendicular to the screen.
  7930. A description of the accepted parameters follows.
  7931. @table @option
  7932. @item x0
  7933. @item y0
  7934. @item x1
  7935. @item y1
  7936. @item x2
  7937. @item y2
  7938. @item x3
  7939. @item y3
  7940. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  7941. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  7942. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  7943. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  7944. then the corners of the source will be sent to the specified coordinates.
  7945. The expressions can use the following variables:
  7946. @table @option
  7947. @item W
  7948. @item H
  7949. the width and height of video frame.
  7950. @item in
  7951. Input frame count.
  7952. @item on
  7953. Output frame count.
  7954. @end table
  7955. @item interpolation
  7956. Set interpolation for perspective correction.
  7957. It accepts the following values:
  7958. @table @samp
  7959. @item linear
  7960. @item cubic
  7961. @end table
  7962. Default value is @samp{linear}.
  7963. @item sense
  7964. Set interpretation of coordinate options.
  7965. It accepts the following values:
  7966. @table @samp
  7967. @item 0, source
  7968. Send point in the source specified by the given coordinates to
  7969. the corners of the destination.
  7970. @item 1, destination
  7971. Send the corners of the source to the point in the destination specified
  7972. by the given coordinates.
  7973. Default value is @samp{source}.
  7974. @end table
  7975. @item eval
  7976. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  7977. It accepts the following values:
  7978. @table @samp
  7979. @item init
  7980. only evaluate expressions once during the filter initialization or
  7981. when a command is processed
  7982. @item frame
  7983. evaluate expressions for each incoming frame
  7984. @end table
  7985. Default value is @samp{init}.
  7986. @end table
  7987. @section phase
  7988. Delay interlaced video by one field time so that the field order changes.
  7989. The intended use is to fix PAL movies that have been captured with the
  7990. opposite field order to the film-to-video transfer.
  7991. A description of the accepted parameters follows.
  7992. @table @option
  7993. @item mode
  7994. Set phase mode.
  7995. It accepts the following values:
  7996. @table @samp
  7997. @item t
  7998. Capture field order top-first, transfer bottom-first.
  7999. Filter will delay the bottom field.
  8000. @item b
  8001. Capture field order bottom-first, transfer top-first.
  8002. Filter will delay the top field.
  8003. @item p
  8004. Capture and transfer with the same field order. This mode only exists
  8005. for the documentation of the other options to refer to, but if you
  8006. actually select it, the filter will faithfully do nothing.
  8007. @item a
  8008. Capture field order determined automatically by field flags, transfer
  8009. opposite.
  8010. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8011. basis using field flags. If no field information is available,
  8012. then this works just like @samp{u}.
  8013. @item u
  8014. Capture unknown or varying, transfer opposite.
  8015. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8016. analyzing the images and selecting the alternative that produces best
  8017. match between the fields.
  8018. @item T
  8019. Capture top-first, transfer unknown or varying.
  8020. Filter selects among @samp{t} and @samp{p} using image analysis.
  8021. @item B
  8022. Capture bottom-first, transfer unknown or varying.
  8023. Filter selects among @samp{b} and @samp{p} using image analysis.
  8024. @item A
  8025. Capture determined by field flags, transfer unknown or varying.
  8026. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8027. image analysis. If no field information is available, then this works just
  8028. like @samp{U}. This is the default mode.
  8029. @item U
  8030. Both capture and transfer unknown or varying.
  8031. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8032. @end table
  8033. @end table
  8034. @section pixdesctest
  8035. Pixel format descriptor test filter, mainly useful for internal
  8036. testing. The output video should be equal to the input video.
  8037. For example:
  8038. @example
  8039. format=monow, pixdesctest
  8040. @end example
  8041. can be used to test the monowhite pixel format descriptor definition.
  8042. @section pp
  8043. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8044. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8045. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8046. Each subfilter and some options have a short and a long name that can be used
  8047. interchangeably, i.e. dr/dering are the same.
  8048. The filters accept the following options:
  8049. @table @option
  8050. @item subfilters
  8051. Set postprocessing subfilters string.
  8052. @end table
  8053. All subfilters share common options to determine their scope:
  8054. @table @option
  8055. @item a/autoq
  8056. Honor the quality commands for this subfilter.
  8057. @item c/chrom
  8058. Do chrominance filtering, too (default).
  8059. @item y/nochrom
  8060. Do luminance filtering only (no chrominance).
  8061. @item n/noluma
  8062. Do chrominance filtering only (no luminance).
  8063. @end table
  8064. These options can be appended after the subfilter name, separated by a '|'.
  8065. Available subfilters are:
  8066. @table @option
  8067. @item hb/hdeblock[|difference[|flatness]]
  8068. Horizontal deblocking filter
  8069. @table @option
  8070. @item difference
  8071. Difference factor where higher values mean more deblocking (default: @code{32}).
  8072. @item flatness
  8073. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8074. @end table
  8075. @item vb/vdeblock[|difference[|flatness]]
  8076. Vertical deblocking filter
  8077. @table @option
  8078. @item difference
  8079. Difference factor where higher values mean more deblocking (default: @code{32}).
  8080. @item flatness
  8081. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8082. @end table
  8083. @item ha/hadeblock[|difference[|flatness]]
  8084. Accurate horizontal deblocking filter
  8085. @table @option
  8086. @item difference
  8087. Difference factor where higher values mean more deblocking (default: @code{32}).
  8088. @item flatness
  8089. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8090. @end table
  8091. @item va/vadeblock[|difference[|flatness]]
  8092. Accurate vertical deblocking filter
  8093. @table @option
  8094. @item difference
  8095. Difference factor where higher values mean more deblocking (default: @code{32}).
  8096. @item flatness
  8097. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8098. @end table
  8099. @end table
  8100. The horizontal and vertical deblocking filters share the difference and
  8101. flatness values so you cannot set different horizontal and vertical
  8102. thresholds.
  8103. @table @option
  8104. @item h1/x1hdeblock
  8105. Experimental horizontal deblocking filter
  8106. @item v1/x1vdeblock
  8107. Experimental vertical deblocking filter
  8108. @item dr/dering
  8109. Deringing filter
  8110. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8111. @table @option
  8112. @item threshold1
  8113. larger -> stronger filtering
  8114. @item threshold2
  8115. larger -> stronger filtering
  8116. @item threshold3
  8117. larger -> stronger filtering
  8118. @end table
  8119. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8120. @table @option
  8121. @item f/fullyrange
  8122. Stretch luminance to @code{0-255}.
  8123. @end table
  8124. @item lb/linblenddeint
  8125. Linear blend deinterlacing filter that deinterlaces the given block by
  8126. filtering all lines with a @code{(1 2 1)} filter.
  8127. @item li/linipoldeint
  8128. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8129. linearly interpolating every second line.
  8130. @item ci/cubicipoldeint
  8131. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8132. cubically interpolating every second line.
  8133. @item md/mediandeint
  8134. Median deinterlacing filter that deinterlaces the given block by applying a
  8135. median filter to every second line.
  8136. @item fd/ffmpegdeint
  8137. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8138. second line with a @code{(-1 4 2 4 -1)} filter.
  8139. @item l5/lowpass5
  8140. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8141. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8142. @item fq/forceQuant[|quantizer]
  8143. Overrides the quantizer table from the input with the constant quantizer you
  8144. specify.
  8145. @table @option
  8146. @item quantizer
  8147. Quantizer to use
  8148. @end table
  8149. @item de/default
  8150. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8151. @item fa/fast
  8152. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8153. @item ac
  8154. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8155. @end table
  8156. @subsection Examples
  8157. @itemize
  8158. @item
  8159. Apply horizontal and vertical deblocking, deringing and automatic
  8160. brightness/contrast:
  8161. @example
  8162. pp=hb/vb/dr/al
  8163. @end example
  8164. @item
  8165. Apply default filters without brightness/contrast correction:
  8166. @example
  8167. pp=de/-al
  8168. @end example
  8169. @item
  8170. Apply default filters and temporal denoiser:
  8171. @example
  8172. pp=default/tmpnoise|1|2|3
  8173. @end example
  8174. @item
  8175. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8176. automatically depending on available CPU time:
  8177. @example
  8178. pp=hb|y/vb|a
  8179. @end example
  8180. @end itemize
  8181. @section pp7
  8182. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8183. similar to spp = 6 with 7 point DCT, where only the center sample is
  8184. used after IDCT.
  8185. The filter accepts the following options:
  8186. @table @option
  8187. @item qp
  8188. Force a constant quantization parameter. It accepts an integer in range
  8189. 0 to 63. If not set, the filter will use the QP from the video stream
  8190. (if available).
  8191. @item mode
  8192. Set thresholding mode. Available modes are:
  8193. @table @samp
  8194. @item hard
  8195. Set hard thresholding.
  8196. @item soft
  8197. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8198. @item medium
  8199. Set medium thresholding (good results, default).
  8200. @end table
  8201. @end table
  8202. @section psnr
  8203. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8204. Ratio) between two input videos.
  8205. This filter takes in input two input videos, the first input is
  8206. considered the "main" source and is passed unchanged to the
  8207. output. The second input is used as a "reference" video for computing
  8208. the PSNR.
  8209. Both video inputs must have the same resolution and pixel format for
  8210. this filter to work correctly. Also it assumes that both inputs
  8211. have the same number of frames, which are compared one by one.
  8212. The obtained average PSNR is printed through the logging system.
  8213. The filter stores the accumulated MSE (mean squared error) of each
  8214. frame, and at the end of the processing it is averaged across all frames
  8215. equally, and the following formula is applied to obtain the PSNR:
  8216. @example
  8217. PSNR = 10*log10(MAX^2/MSE)
  8218. @end example
  8219. Where MAX is the average of the maximum values of each component of the
  8220. image.
  8221. The description of the accepted parameters follows.
  8222. @table @option
  8223. @item stats_file, f
  8224. If specified the filter will use the named file to save the PSNR of
  8225. each individual frame. When filename equals "-" the data is sent to
  8226. standard output.
  8227. @end table
  8228. The file printed if @var{stats_file} is selected, contains a sequence of
  8229. key/value pairs of the form @var{key}:@var{value} for each compared
  8230. couple of frames.
  8231. A description of each shown parameter follows:
  8232. @table @option
  8233. @item n
  8234. sequential number of the input frame, starting from 1
  8235. @item mse_avg
  8236. Mean Square Error pixel-by-pixel average difference of the compared
  8237. frames, averaged over all the image components.
  8238. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8239. Mean Square Error pixel-by-pixel average difference of the compared
  8240. frames for the component specified by the suffix.
  8241. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8242. Peak Signal to Noise ratio of the compared frames for the component
  8243. specified by the suffix.
  8244. @end table
  8245. For example:
  8246. @example
  8247. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8248. [main][ref] psnr="stats_file=stats.log" [out]
  8249. @end example
  8250. On this example the input file being processed is compared with the
  8251. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8252. is stored in @file{stats.log}.
  8253. @anchor{pullup}
  8254. @section pullup
  8255. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8256. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8257. content.
  8258. The pullup filter is designed to take advantage of future context in making
  8259. its decisions. This filter is stateless in the sense that it does not lock
  8260. onto a pattern to follow, but it instead looks forward to the following
  8261. fields in order to identify matches and rebuild progressive frames.
  8262. To produce content with an even framerate, insert the fps filter after
  8263. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8264. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8265. The filter accepts the following options:
  8266. @table @option
  8267. @item jl
  8268. @item jr
  8269. @item jt
  8270. @item jb
  8271. These options set the amount of "junk" to ignore at the left, right, top, and
  8272. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8273. while top and bottom are in units of 2 lines.
  8274. The default is 8 pixels on each side.
  8275. @item sb
  8276. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8277. filter generating an occasional mismatched frame, but it may also cause an
  8278. excessive number of frames to be dropped during high motion sequences.
  8279. Conversely, setting it to -1 will make filter match fields more easily.
  8280. This may help processing of video where there is slight blurring between
  8281. the fields, but may also cause there to be interlaced frames in the output.
  8282. Default value is @code{0}.
  8283. @item mp
  8284. Set the metric plane to use. It accepts the following values:
  8285. @table @samp
  8286. @item l
  8287. Use luma plane.
  8288. @item u
  8289. Use chroma blue plane.
  8290. @item v
  8291. Use chroma red plane.
  8292. @end table
  8293. This option may be set to use chroma plane instead of the default luma plane
  8294. for doing filter's computations. This may improve accuracy on very clean
  8295. source material, but more likely will decrease accuracy, especially if there
  8296. is chroma noise (rainbow effect) or any grayscale video.
  8297. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8298. load and make pullup usable in realtime on slow machines.
  8299. @end table
  8300. For best results (without duplicated frames in the output file) it is
  8301. necessary to change the output frame rate. For example, to inverse
  8302. telecine NTSC input:
  8303. @example
  8304. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8305. @end example
  8306. @section qp
  8307. Change video quantization parameters (QP).
  8308. The filter accepts the following option:
  8309. @table @option
  8310. @item qp
  8311. Set expression for quantization parameter.
  8312. @end table
  8313. The expression is evaluated through the eval API and can contain, among others,
  8314. the following constants:
  8315. @table @var
  8316. @item known
  8317. 1 if index is not 129, 0 otherwise.
  8318. @item qp
  8319. Sequentional index starting from -129 to 128.
  8320. @end table
  8321. @subsection Examples
  8322. @itemize
  8323. @item
  8324. Some equation like:
  8325. @example
  8326. qp=2+2*sin(PI*qp)
  8327. @end example
  8328. @end itemize
  8329. @section random
  8330. Flush video frames from internal cache of frames into a random order.
  8331. No frame is discarded.
  8332. Inspired by @ref{frei0r} nervous filter.
  8333. @table @option
  8334. @item frames
  8335. Set size in number of frames of internal cache, in range from @code{2} to
  8336. @code{512}. Default is @code{30}.
  8337. @item seed
  8338. Set seed for random number generator, must be an integer included between
  8339. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8340. less than @code{0}, the filter will try to use a good random seed on a
  8341. best effort basis.
  8342. @end table
  8343. @section readvitc
  8344. Read vertical interval timecode (VITC) information from the top lines of a
  8345. video frame.
  8346. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8347. timecode value, if a valid timecode has been detected. Further metadata key
  8348. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8349. timecode data has been found or not.
  8350. This filter accepts the following options:
  8351. @table @option
  8352. @item scan_max
  8353. Set the maximum number of lines to scan for VITC data. If the value is set to
  8354. @code{-1} the full video frame is scanned. Default is @code{45}.
  8355. @item thr_b
  8356. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8357. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8358. @item thr_w
  8359. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8360. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8361. @end table
  8362. @subsection Examples
  8363. @itemize
  8364. @item
  8365. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8366. draw @code{--:--:--:--} as a placeholder:
  8367. @example
  8368. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8369. @end example
  8370. @end itemize
  8371. @section remap
  8372. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8373. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8374. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8375. value for pixel will be used for destination pixel.
  8376. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8377. will have Xmap/Ymap video stream dimensions.
  8378. Xmap and Ymap input video streams are 16bit depth, single channel.
  8379. @section removegrain
  8380. The removegrain filter is a spatial denoiser for progressive video.
  8381. @table @option
  8382. @item m0
  8383. Set mode for the first plane.
  8384. @item m1
  8385. Set mode for the second plane.
  8386. @item m2
  8387. Set mode for the third plane.
  8388. @item m3
  8389. Set mode for the fourth plane.
  8390. @end table
  8391. Range of mode is from 0 to 24. Description of each mode follows:
  8392. @table @var
  8393. @item 0
  8394. Leave input plane unchanged. Default.
  8395. @item 1
  8396. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8397. @item 2
  8398. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8399. @item 3
  8400. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8401. @item 4
  8402. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8403. This is equivalent to a median filter.
  8404. @item 5
  8405. Line-sensitive clipping giving the minimal change.
  8406. @item 6
  8407. Line-sensitive clipping, intermediate.
  8408. @item 7
  8409. Line-sensitive clipping, intermediate.
  8410. @item 8
  8411. Line-sensitive clipping, intermediate.
  8412. @item 9
  8413. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8414. @item 10
  8415. Replaces the target pixel with the closest neighbour.
  8416. @item 11
  8417. [1 2 1] horizontal and vertical kernel blur.
  8418. @item 12
  8419. Same as mode 11.
  8420. @item 13
  8421. Bob mode, interpolates top field from the line where the neighbours
  8422. pixels are the closest.
  8423. @item 14
  8424. Bob mode, interpolates bottom field from the line where the neighbours
  8425. pixels are the closest.
  8426. @item 15
  8427. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8428. interpolation formula.
  8429. @item 16
  8430. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8431. interpolation formula.
  8432. @item 17
  8433. Clips the pixel with the minimum and maximum of respectively the maximum and
  8434. minimum of each pair of opposite neighbour pixels.
  8435. @item 18
  8436. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8437. the current pixel is minimal.
  8438. @item 19
  8439. Replaces the pixel with the average of its 8 neighbours.
  8440. @item 20
  8441. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8442. @item 21
  8443. Clips pixels using the averages of opposite neighbour.
  8444. @item 22
  8445. Same as mode 21 but simpler and faster.
  8446. @item 23
  8447. Small edge and halo removal, but reputed useless.
  8448. @item 24
  8449. Similar as 23.
  8450. @end table
  8451. @section removelogo
  8452. Suppress a TV station logo, using an image file to determine which
  8453. pixels comprise the logo. It works by filling in the pixels that
  8454. comprise the logo with neighboring pixels.
  8455. The filter accepts the following options:
  8456. @table @option
  8457. @item filename, f
  8458. Set the filter bitmap file, which can be any image format supported by
  8459. libavformat. The width and height of the image file must match those of the
  8460. video stream being processed.
  8461. @end table
  8462. Pixels in the provided bitmap image with a value of zero are not
  8463. considered part of the logo, non-zero pixels are considered part of
  8464. the logo. If you use white (255) for the logo and black (0) for the
  8465. rest, you will be safe. For making the filter bitmap, it is
  8466. recommended to take a screen capture of a black frame with the logo
  8467. visible, and then using a threshold filter followed by the erode
  8468. filter once or twice.
  8469. If needed, little splotches can be fixed manually. Remember that if
  8470. logo pixels are not covered, the filter quality will be much
  8471. reduced. Marking too many pixels as part of the logo does not hurt as
  8472. much, but it will increase the amount of blurring needed to cover over
  8473. the image and will destroy more information than necessary, and extra
  8474. pixels will slow things down on a large logo.
  8475. @section repeatfields
  8476. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8477. fields based on its value.
  8478. @section reverse, areverse
  8479. Reverse a clip.
  8480. Warning: This filter requires memory to buffer the entire clip, so trimming
  8481. is suggested.
  8482. @subsection Examples
  8483. @itemize
  8484. @item
  8485. Take the first 5 seconds of a clip, and reverse it.
  8486. @example
  8487. trim=end=5,reverse
  8488. @end example
  8489. @end itemize
  8490. @section rotate
  8491. Rotate video by an arbitrary angle expressed in radians.
  8492. The filter accepts the following options:
  8493. A description of the optional parameters follows.
  8494. @table @option
  8495. @item angle, a
  8496. Set an expression for the angle by which to rotate the input video
  8497. clockwise, expressed as a number of radians. A negative value will
  8498. result in a counter-clockwise rotation. By default it is set to "0".
  8499. This expression is evaluated for each frame.
  8500. @item out_w, ow
  8501. Set the output width expression, default value is "iw".
  8502. This expression is evaluated just once during configuration.
  8503. @item out_h, oh
  8504. Set the output height expression, default value is "ih".
  8505. This expression is evaluated just once during configuration.
  8506. @item bilinear
  8507. Enable bilinear interpolation if set to 1, a value of 0 disables
  8508. it. Default value is 1.
  8509. @item fillcolor, c
  8510. Set the color used to fill the output area not covered by the rotated
  8511. image. For the general syntax of this option, check the "Color" section in the
  8512. ffmpeg-utils manual. If the special value "none" is selected then no
  8513. background is printed (useful for example if the background is never shown).
  8514. Default value is "black".
  8515. @end table
  8516. The expressions for the angle and the output size can contain the
  8517. following constants and functions:
  8518. @table @option
  8519. @item n
  8520. sequential number of the input frame, starting from 0. It is always NAN
  8521. before the first frame is filtered.
  8522. @item t
  8523. time in seconds of the input frame, it is set to 0 when the filter is
  8524. configured. It is always NAN before the first frame is filtered.
  8525. @item hsub
  8526. @item vsub
  8527. horizontal and vertical chroma subsample values. For example for the
  8528. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8529. @item in_w, iw
  8530. @item in_h, ih
  8531. the input video width and height
  8532. @item out_w, ow
  8533. @item out_h, oh
  8534. the output width and height, that is the size of the padded area as
  8535. specified by the @var{width} and @var{height} expressions
  8536. @item rotw(a)
  8537. @item roth(a)
  8538. the minimal width/height required for completely containing the input
  8539. video rotated by @var{a} radians.
  8540. These are only available when computing the @option{out_w} and
  8541. @option{out_h} expressions.
  8542. @end table
  8543. @subsection Examples
  8544. @itemize
  8545. @item
  8546. Rotate the input by PI/6 radians clockwise:
  8547. @example
  8548. rotate=PI/6
  8549. @end example
  8550. @item
  8551. Rotate the input by PI/6 radians counter-clockwise:
  8552. @example
  8553. rotate=-PI/6
  8554. @end example
  8555. @item
  8556. Rotate the input by 45 degrees clockwise:
  8557. @example
  8558. rotate=45*PI/180
  8559. @end example
  8560. @item
  8561. Apply a constant rotation with period T, starting from an angle of PI/3:
  8562. @example
  8563. rotate=PI/3+2*PI*t/T
  8564. @end example
  8565. @item
  8566. Make the input video rotation oscillating with a period of T
  8567. seconds and an amplitude of A radians:
  8568. @example
  8569. rotate=A*sin(2*PI/T*t)
  8570. @end example
  8571. @item
  8572. Rotate the video, output size is chosen so that the whole rotating
  8573. input video is always completely contained in the output:
  8574. @example
  8575. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8576. @end example
  8577. @item
  8578. Rotate the video, reduce the output size so that no background is ever
  8579. shown:
  8580. @example
  8581. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8582. @end example
  8583. @end itemize
  8584. @subsection Commands
  8585. The filter supports the following commands:
  8586. @table @option
  8587. @item a, angle
  8588. Set the angle expression.
  8589. The command accepts the same syntax of the corresponding option.
  8590. If the specified expression is not valid, it is kept at its current
  8591. value.
  8592. @end table
  8593. @section sab
  8594. Apply Shape Adaptive Blur.
  8595. The filter accepts the following options:
  8596. @table @option
  8597. @item luma_radius, lr
  8598. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8599. value is 1.0. A greater value will result in a more blurred image, and
  8600. in slower processing.
  8601. @item luma_pre_filter_radius, lpfr
  8602. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8603. value is 1.0.
  8604. @item luma_strength, ls
  8605. Set luma maximum difference between pixels to still be considered, must
  8606. be a value in the 0.1-100.0 range, default value is 1.0.
  8607. @item chroma_radius, cr
  8608. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  8609. greater value will result in a more blurred image, and in slower
  8610. processing.
  8611. @item chroma_pre_filter_radius, cpfr
  8612. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  8613. @item chroma_strength, cs
  8614. Set chroma maximum difference between pixels to still be considered,
  8615. must be a value in the 0.1-100.0 range.
  8616. @end table
  8617. Each chroma option value, if not explicitly specified, is set to the
  8618. corresponding luma option value.
  8619. @anchor{scale}
  8620. @section scale
  8621. Scale (resize) the input video, using the libswscale library.
  8622. The scale filter forces the output display aspect ratio to be the same
  8623. of the input, by changing the output sample aspect ratio.
  8624. If the input image format is different from the format requested by
  8625. the next filter, the scale filter will convert the input to the
  8626. requested format.
  8627. @subsection Options
  8628. The filter accepts the following options, or any of the options
  8629. supported by the libswscale scaler.
  8630. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8631. the complete list of scaler options.
  8632. @table @option
  8633. @item width, w
  8634. @item height, h
  8635. Set the output video dimension expression. Default value is the input
  8636. dimension.
  8637. If the value is 0, the input width is used for the output.
  8638. If one of the values is -1, the scale filter will use a value that
  8639. maintains the aspect ratio of the input image, calculated from the
  8640. other specified dimension. If both of them are -1, the input size is
  8641. used
  8642. If one of the values is -n with n > 1, the scale filter will also use a value
  8643. that maintains the aspect ratio of the input image, calculated from the other
  8644. specified dimension. After that it will, however, make sure that the calculated
  8645. dimension is divisible by n and adjust the value if necessary.
  8646. See below for the list of accepted constants for use in the dimension
  8647. expression.
  8648. @item eval
  8649. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8650. @table @samp
  8651. @item init
  8652. Only evaluate expressions once during the filter initialization or when a command is processed.
  8653. @item frame
  8654. Evaluate expressions for each incoming frame.
  8655. @end table
  8656. Default value is @samp{init}.
  8657. @item interl
  8658. Set the interlacing mode. It accepts the following values:
  8659. @table @samp
  8660. @item 1
  8661. Force interlaced aware scaling.
  8662. @item 0
  8663. Do not apply interlaced scaling.
  8664. @item -1
  8665. Select interlaced aware scaling depending on whether the source frames
  8666. are flagged as interlaced or not.
  8667. @end table
  8668. Default value is @samp{0}.
  8669. @item flags
  8670. Set libswscale scaling flags. See
  8671. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8672. complete list of values. If not explicitly specified the filter applies
  8673. the default flags.
  8674. @item param0, param1
  8675. Set libswscale input parameters for scaling algorithms that need them. See
  8676. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8677. complete documentation. If not explicitly specified the filter applies
  8678. empty parameters.
  8679. @item size, s
  8680. Set the video size. For the syntax of this option, check the
  8681. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8682. @item in_color_matrix
  8683. @item out_color_matrix
  8684. Set in/output YCbCr color space type.
  8685. This allows the autodetected value to be overridden as well as allows forcing
  8686. a specific value used for the output and encoder.
  8687. If not specified, the color space type depends on the pixel format.
  8688. Possible values:
  8689. @table @samp
  8690. @item auto
  8691. Choose automatically.
  8692. @item bt709
  8693. Format conforming to International Telecommunication Union (ITU)
  8694. Recommendation BT.709.
  8695. @item fcc
  8696. Set color space conforming to the United States Federal Communications
  8697. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  8698. @item bt601
  8699. Set color space conforming to:
  8700. @itemize
  8701. @item
  8702. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  8703. @item
  8704. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  8705. @item
  8706. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  8707. @end itemize
  8708. @item smpte240m
  8709. Set color space conforming to SMPTE ST 240:1999.
  8710. @end table
  8711. @item in_range
  8712. @item out_range
  8713. Set in/output YCbCr sample range.
  8714. This allows the autodetected value to be overridden as well as allows forcing
  8715. a specific value used for the output and encoder. If not specified, the
  8716. range depends on the pixel format. Possible values:
  8717. @table @samp
  8718. @item auto
  8719. Choose automatically.
  8720. @item jpeg/full/pc
  8721. Set full range (0-255 in case of 8-bit luma).
  8722. @item mpeg/tv
  8723. Set "MPEG" range (16-235 in case of 8-bit luma).
  8724. @end table
  8725. @item force_original_aspect_ratio
  8726. Enable decreasing or increasing output video width or height if necessary to
  8727. keep the original aspect ratio. Possible values:
  8728. @table @samp
  8729. @item disable
  8730. Scale the video as specified and disable this feature.
  8731. @item decrease
  8732. The output video dimensions will automatically be decreased if needed.
  8733. @item increase
  8734. The output video dimensions will automatically be increased if needed.
  8735. @end table
  8736. One useful instance of this option is that when you know a specific device's
  8737. maximum allowed resolution, you can use this to limit the output video to
  8738. that, while retaining the aspect ratio. For example, device A allows
  8739. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  8740. decrease) and specifying 1280x720 to the command line makes the output
  8741. 1280x533.
  8742. Please note that this is a different thing than specifying -1 for @option{w}
  8743. or @option{h}, you still need to specify the output resolution for this option
  8744. to work.
  8745. @end table
  8746. The values of the @option{w} and @option{h} options are expressions
  8747. containing the following constants:
  8748. @table @var
  8749. @item in_w
  8750. @item in_h
  8751. The input width and height
  8752. @item iw
  8753. @item ih
  8754. These are the same as @var{in_w} and @var{in_h}.
  8755. @item out_w
  8756. @item out_h
  8757. The output (scaled) width and height
  8758. @item ow
  8759. @item oh
  8760. These are the same as @var{out_w} and @var{out_h}
  8761. @item a
  8762. The same as @var{iw} / @var{ih}
  8763. @item sar
  8764. input sample aspect ratio
  8765. @item dar
  8766. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  8767. @item hsub
  8768. @item vsub
  8769. horizontal and vertical input chroma subsample values. For example for the
  8770. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8771. @item ohsub
  8772. @item ovsub
  8773. horizontal and vertical output chroma subsample values. For example for the
  8774. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8775. @end table
  8776. @subsection Examples
  8777. @itemize
  8778. @item
  8779. Scale the input video to a size of 200x100
  8780. @example
  8781. scale=w=200:h=100
  8782. @end example
  8783. This is equivalent to:
  8784. @example
  8785. scale=200:100
  8786. @end example
  8787. or:
  8788. @example
  8789. scale=200x100
  8790. @end example
  8791. @item
  8792. Specify a size abbreviation for the output size:
  8793. @example
  8794. scale=qcif
  8795. @end example
  8796. which can also be written as:
  8797. @example
  8798. scale=size=qcif
  8799. @end example
  8800. @item
  8801. Scale the input to 2x:
  8802. @example
  8803. scale=w=2*iw:h=2*ih
  8804. @end example
  8805. @item
  8806. The above is the same as:
  8807. @example
  8808. scale=2*in_w:2*in_h
  8809. @end example
  8810. @item
  8811. Scale the input to 2x with forced interlaced scaling:
  8812. @example
  8813. scale=2*iw:2*ih:interl=1
  8814. @end example
  8815. @item
  8816. Scale the input to half size:
  8817. @example
  8818. scale=w=iw/2:h=ih/2
  8819. @end example
  8820. @item
  8821. Increase the width, and set the height to the same size:
  8822. @example
  8823. scale=3/2*iw:ow
  8824. @end example
  8825. @item
  8826. Seek Greek harmony:
  8827. @example
  8828. scale=iw:1/PHI*iw
  8829. scale=ih*PHI:ih
  8830. @end example
  8831. @item
  8832. Increase the height, and set the width to 3/2 of the height:
  8833. @example
  8834. scale=w=3/2*oh:h=3/5*ih
  8835. @end example
  8836. @item
  8837. Increase the size, making the size a multiple of the chroma
  8838. subsample values:
  8839. @example
  8840. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  8841. @end example
  8842. @item
  8843. Increase the width to a maximum of 500 pixels,
  8844. keeping the same aspect ratio as the input:
  8845. @example
  8846. scale=w='min(500\, iw*3/2):h=-1'
  8847. @end example
  8848. @end itemize
  8849. @subsection Commands
  8850. This filter supports the following commands:
  8851. @table @option
  8852. @item width, w
  8853. @item height, h
  8854. Set the output video dimension expression.
  8855. The command accepts the same syntax of the corresponding option.
  8856. If the specified expression is not valid, it is kept at its current
  8857. value.
  8858. @end table
  8859. @section scale2ref
  8860. Scale (resize) the input video, based on a reference video.
  8861. See the scale filter for available options, scale2ref supports the same but
  8862. uses the reference video instead of the main input as basis.
  8863. @subsection Examples
  8864. @itemize
  8865. @item
  8866. Scale a subtitle stream to match the main video in size before overlaying
  8867. @example
  8868. 'scale2ref[b][a];[a][b]overlay'
  8869. @end example
  8870. @end itemize
  8871. @anchor{selectivecolor}
  8872. @section selectivecolor
  8873. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  8874. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  8875. by the "purity" of the color (that is, how saturated it already is).
  8876. This filter is similar to the Adobe Photoshop Selective Color tool.
  8877. The filter accepts the following options:
  8878. @table @option
  8879. @item correction_method
  8880. Select color correction method.
  8881. Available values are:
  8882. @table @samp
  8883. @item absolute
  8884. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  8885. component value).
  8886. @item relative
  8887. Specified adjustments are relative to the original component value.
  8888. @end table
  8889. Default is @code{absolute}.
  8890. @item reds
  8891. Adjustments for red pixels (pixels where the red component is the maximum)
  8892. @item yellows
  8893. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  8894. @item greens
  8895. Adjustments for green pixels (pixels where the green component is the maximum)
  8896. @item cyans
  8897. Adjustments for cyan pixels (pixels where the red component is the minimum)
  8898. @item blues
  8899. Adjustments for blue pixels (pixels where the blue component is the maximum)
  8900. @item magentas
  8901. Adjustments for magenta pixels (pixels where the green component is the minimum)
  8902. @item whites
  8903. Adjustments for white pixels (pixels where all components are greater than 128)
  8904. @item neutrals
  8905. Adjustments for all pixels except pure black and pure white
  8906. @item blacks
  8907. Adjustments for black pixels (pixels where all components are lesser than 128)
  8908. @item psfile
  8909. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  8910. @end table
  8911. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  8912. 4 space separated floating point adjustment values in the [-1,1] range,
  8913. respectively to adjust the amount of cyan, magenta, yellow and black for the
  8914. pixels of its range.
  8915. @subsection Examples
  8916. @itemize
  8917. @item
  8918. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  8919. increase magenta by 27% in blue areas:
  8920. @example
  8921. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  8922. @end example
  8923. @item
  8924. Use a Photoshop selective color preset:
  8925. @example
  8926. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  8927. @end example
  8928. @end itemize
  8929. @section separatefields
  8930. The @code{separatefields} takes a frame-based video input and splits
  8931. each frame into its components fields, producing a new half height clip
  8932. with twice the frame rate and twice the frame count.
  8933. This filter use field-dominance information in frame to decide which
  8934. of each pair of fields to place first in the output.
  8935. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  8936. @section setdar, setsar
  8937. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  8938. output video.
  8939. This is done by changing the specified Sample (aka Pixel) Aspect
  8940. Ratio, according to the following equation:
  8941. @example
  8942. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  8943. @end example
  8944. Keep in mind that the @code{setdar} filter does not modify the pixel
  8945. dimensions of the video frame. Also, the display aspect ratio set by
  8946. this filter may be changed by later filters in the filterchain,
  8947. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  8948. applied.
  8949. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  8950. the filter output video.
  8951. Note that as a consequence of the application of this filter, the
  8952. output display aspect ratio will change according to the equation
  8953. above.
  8954. Keep in mind that the sample aspect ratio set by the @code{setsar}
  8955. filter may be changed by later filters in the filterchain, e.g. if
  8956. another "setsar" or a "setdar" filter is applied.
  8957. It accepts the following parameters:
  8958. @table @option
  8959. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  8960. Set the aspect ratio used by the filter.
  8961. The parameter can be a floating point number string, an expression, or
  8962. a string of the form @var{num}:@var{den}, where @var{num} and
  8963. @var{den} are the numerator and denominator of the aspect ratio. If
  8964. the parameter is not specified, it is assumed the value "0".
  8965. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  8966. should be escaped.
  8967. @item max
  8968. Set the maximum integer value to use for expressing numerator and
  8969. denominator when reducing the expressed aspect ratio to a rational.
  8970. Default value is @code{100}.
  8971. @end table
  8972. The parameter @var{sar} is an expression containing
  8973. the following constants:
  8974. @table @option
  8975. @item E, PI, PHI
  8976. These are approximated values for the mathematical constants e
  8977. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  8978. @item w, h
  8979. The input width and height.
  8980. @item a
  8981. These are the same as @var{w} / @var{h}.
  8982. @item sar
  8983. The input sample aspect ratio.
  8984. @item dar
  8985. The input display aspect ratio. It is the same as
  8986. (@var{w} / @var{h}) * @var{sar}.
  8987. @item hsub, vsub
  8988. Horizontal and vertical chroma subsample values. For example, for the
  8989. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8990. @end table
  8991. @subsection Examples
  8992. @itemize
  8993. @item
  8994. To change the display aspect ratio to 16:9, specify one of the following:
  8995. @example
  8996. setdar=dar=1.77777
  8997. setdar=dar=16/9
  8998. @end example
  8999. @item
  9000. To change the sample aspect ratio to 10:11, specify:
  9001. @example
  9002. setsar=sar=10/11
  9003. @end example
  9004. @item
  9005. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9006. 1000 in the aspect ratio reduction, use the command:
  9007. @example
  9008. setdar=ratio=16/9:max=1000
  9009. @end example
  9010. @end itemize
  9011. @anchor{setfield}
  9012. @section setfield
  9013. Force field for the output video frame.
  9014. The @code{setfield} filter marks the interlace type field for the
  9015. output frames. It does not change the input frame, but only sets the
  9016. corresponding property, which affects how the frame is treated by
  9017. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9018. The filter accepts the following options:
  9019. @table @option
  9020. @item mode
  9021. Available values are:
  9022. @table @samp
  9023. @item auto
  9024. Keep the same field property.
  9025. @item bff
  9026. Mark the frame as bottom-field-first.
  9027. @item tff
  9028. Mark the frame as top-field-first.
  9029. @item prog
  9030. Mark the frame as progressive.
  9031. @end table
  9032. @end table
  9033. @section showinfo
  9034. Show a line containing various information for each input video frame.
  9035. The input video is not modified.
  9036. The shown line contains a sequence of key/value pairs of the form
  9037. @var{key}:@var{value}.
  9038. The following values are shown in the output:
  9039. @table @option
  9040. @item n
  9041. The (sequential) number of the input frame, starting from 0.
  9042. @item pts
  9043. The Presentation TimeStamp of the input frame, expressed as a number of
  9044. time base units. The time base unit depends on the filter input pad.
  9045. @item pts_time
  9046. The Presentation TimeStamp of the input frame, expressed as a number of
  9047. seconds.
  9048. @item pos
  9049. The position of the frame in the input stream, or -1 if this information is
  9050. unavailable and/or meaningless (for example in case of synthetic video).
  9051. @item fmt
  9052. The pixel format name.
  9053. @item sar
  9054. The sample aspect ratio of the input frame, expressed in the form
  9055. @var{num}/@var{den}.
  9056. @item s
  9057. The size of the input frame. For the syntax of this option, check the
  9058. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9059. @item i
  9060. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9061. for bottom field first).
  9062. @item iskey
  9063. This is 1 if the frame is a key frame, 0 otherwise.
  9064. @item type
  9065. The picture type of the input frame ("I" for an I-frame, "P" for a
  9066. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9067. Also refer to the documentation of the @code{AVPictureType} enum and of
  9068. the @code{av_get_picture_type_char} function defined in
  9069. @file{libavutil/avutil.h}.
  9070. @item checksum
  9071. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9072. @item plane_checksum
  9073. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9074. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9075. @end table
  9076. @section showpalette
  9077. Displays the 256 colors palette of each frame. This filter is only relevant for
  9078. @var{pal8} pixel format frames.
  9079. It accepts the following option:
  9080. @table @option
  9081. @item s
  9082. Set the size of the box used to represent one palette color entry. Default is
  9083. @code{30} (for a @code{30x30} pixel box).
  9084. @end table
  9085. @section shuffleframes
  9086. Reorder and/or duplicate video frames.
  9087. It accepts the following parameters:
  9088. @table @option
  9089. @item mapping
  9090. Set the destination indexes of input frames.
  9091. This is space or '|' separated list of indexes that maps input frames to output
  9092. frames. Number of indexes also sets maximal value that each index may have.
  9093. @end table
  9094. The first frame has the index 0. The default is to keep the input unchanged.
  9095. Swap second and third frame of every three frames of the input:
  9096. @example
  9097. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9098. @end example
  9099. @section shuffleplanes
  9100. Reorder and/or duplicate video planes.
  9101. It accepts the following parameters:
  9102. @table @option
  9103. @item map0
  9104. The index of the input plane to be used as the first output plane.
  9105. @item map1
  9106. The index of the input plane to be used as the second output plane.
  9107. @item map2
  9108. The index of the input plane to be used as the third output plane.
  9109. @item map3
  9110. The index of the input plane to be used as the fourth output plane.
  9111. @end table
  9112. The first plane has the index 0. The default is to keep the input unchanged.
  9113. Swap the second and third planes of the input:
  9114. @example
  9115. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9116. @end example
  9117. @anchor{signalstats}
  9118. @section signalstats
  9119. Evaluate various visual metrics that assist in determining issues associated
  9120. with the digitization of analog video media.
  9121. By default the filter will log these metadata values:
  9122. @table @option
  9123. @item YMIN
  9124. Display the minimal Y value contained within the input frame. Expressed in
  9125. range of [0-255].
  9126. @item YLOW
  9127. Display the Y value at the 10% percentile within the input frame. Expressed in
  9128. range of [0-255].
  9129. @item YAVG
  9130. Display the average Y value within the input frame. Expressed in range of
  9131. [0-255].
  9132. @item YHIGH
  9133. Display the Y value at the 90% percentile within the input frame. Expressed in
  9134. range of [0-255].
  9135. @item YMAX
  9136. Display the maximum Y value contained within the input frame. Expressed in
  9137. range of [0-255].
  9138. @item UMIN
  9139. Display the minimal U value contained within the input frame. Expressed in
  9140. range of [0-255].
  9141. @item ULOW
  9142. Display the U value at the 10% percentile within the input frame. Expressed in
  9143. range of [0-255].
  9144. @item UAVG
  9145. Display the average U value within the input frame. Expressed in range of
  9146. [0-255].
  9147. @item UHIGH
  9148. Display the U value at the 90% percentile within the input frame. Expressed in
  9149. range of [0-255].
  9150. @item UMAX
  9151. Display the maximum U value contained within the input frame. Expressed in
  9152. range of [0-255].
  9153. @item VMIN
  9154. Display the minimal V value contained within the input frame. Expressed in
  9155. range of [0-255].
  9156. @item VLOW
  9157. Display the V value at the 10% percentile within the input frame. Expressed in
  9158. range of [0-255].
  9159. @item VAVG
  9160. Display the average V value within the input frame. Expressed in range of
  9161. [0-255].
  9162. @item VHIGH
  9163. Display the V value at the 90% percentile within the input frame. Expressed in
  9164. range of [0-255].
  9165. @item VMAX
  9166. Display the maximum V value contained within the input frame. Expressed in
  9167. range of [0-255].
  9168. @item SATMIN
  9169. Display the minimal saturation value contained within the input frame.
  9170. Expressed in range of [0-~181.02].
  9171. @item SATLOW
  9172. Display the saturation value at the 10% percentile within the input frame.
  9173. Expressed in range of [0-~181.02].
  9174. @item SATAVG
  9175. Display the average saturation value within the input frame. Expressed in range
  9176. of [0-~181.02].
  9177. @item SATHIGH
  9178. Display the saturation value at the 90% percentile within the input frame.
  9179. Expressed in range of [0-~181.02].
  9180. @item SATMAX
  9181. Display the maximum saturation value contained within the input frame.
  9182. Expressed in range of [0-~181.02].
  9183. @item HUEMED
  9184. Display the median value for hue within the input frame. Expressed in range of
  9185. [0-360].
  9186. @item HUEAVG
  9187. Display the average value for hue within the input frame. Expressed in range of
  9188. [0-360].
  9189. @item YDIF
  9190. Display the average of sample value difference between all values of the Y
  9191. plane in the current frame and corresponding values of the previous input frame.
  9192. Expressed in range of [0-255].
  9193. @item UDIF
  9194. Display the average of sample value difference between all values of the U
  9195. plane in the current frame and corresponding values of the previous input frame.
  9196. Expressed in range of [0-255].
  9197. @item VDIF
  9198. Display the average of sample value difference between all values of the V
  9199. plane in the current frame and corresponding values of the previous input frame.
  9200. Expressed in range of [0-255].
  9201. @end table
  9202. The filter accepts the following options:
  9203. @table @option
  9204. @item stat
  9205. @item out
  9206. @option{stat} specify an additional form of image analysis.
  9207. @option{out} output video with the specified type of pixel highlighted.
  9208. Both options accept the following values:
  9209. @table @samp
  9210. @item tout
  9211. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9212. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9213. include the results of video dropouts, head clogs, or tape tracking issues.
  9214. @item vrep
  9215. Identify @var{vertical line repetition}. Vertical line repetition includes
  9216. similar rows of pixels within a frame. In born-digital video vertical line
  9217. repetition is common, but this pattern is uncommon in video digitized from an
  9218. analog source. When it occurs in video that results from the digitization of an
  9219. analog source it can indicate concealment from a dropout compensator.
  9220. @item brng
  9221. Identify pixels that fall outside of legal broadcast range.
  9222. @end table
  9223. @item color, c
  9224. Set the highlight color for the @option{out} option. The default color is
  9225. yellow.
  9226. @end table
  9227. @subsection Examples
  9228. @itemize
  9229. @item
  9230. Output data of various video metrics:
  9231. @example
  9232. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9233. @end example
  9234. @item
  9235. Output specific data about the minimum and maximum values of the Y plane per frame:
  9236. @example
  9237. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9238. @end example
  9239. @item
  9240. Playback video while highlighting pixels that are outside of broadcast range in red.
  9241. @example
  9242. ffplay example.mov -vf signalstats="out=brng:color=red"
  9243. @end example
  9244. @item
  9245. Playback video with signalstats metadata drawn over the frame.
  9246. @example
  9247. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9248. @end example
  9249. The contents of signalstat_drawtext.txt used in the command are:
  9250. @example
  9251. time %@{pts:hms@}
  9252. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9253. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9254. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9255. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9256. @end example
  9257. @end itemize
  9258. @anchor{smartblur}
  9259. @section smartblur
  9260. Blur the input video without impacting the outlines.
  9261. It accepts the following options:
  9262. @table @option
  9263. @item luma_radius, lr
  9264. Set the luma radius. The option value must be a float number in
  9265. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9266. used to blur the image (slower if larger). Default value is 1.0.
  9267. @item luma_strength, ls
  9268. Set the luma strength. The option value must be a float number
  9269. in the range [-1.0,1.0] that configures the blurring. A value included
  9270. in [0.0,1.0] will blur the image whereas a value included in
  9271. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9272. @item luma_threshold, lt
  9273. Set the luma threshold used as a coefficient to determine
  9274. whether a pixel should be blurred or not. The option value must be an
  9275. integer in the range [-30,30]. A value of 0 will filter all the image,
  9276. a value included in [0,30] will filter flat areas and a value included
  9277. in [-30,0] will filter edges. Default value is 0.
  9278. @item chroma_radius, cr
  9279. Set the chroma radius. The option value must be a float number in
  9280. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9281. used to blur the image (slower if larger). Default value is 1.0.
  9282. @item chroma_strength, cs
  9283. Set the chroma strength. The option value must be a float number
  9284. in the range [-1.0,1.0] that configures the blurring. A value included
  9285. in [0.0,1.0] will blur the image whereas a value included in
  9286. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9287. @item chroma_threshold, ct
  9288. Set the chroma threshold used as a coefficient to determine
  9289. whether a pixel should be blurred or not. The option value must be an
  9290. integer in the range [-30,30]. A value of 0 will filter all the image,
  9291. a value included in [0,30] will filter flat areas and a value included
  9292. in [-30,0] will filter edges. Default value is 0.
  9293. @end table
  9294. If a chroma option is not explicitly set, the corresponding luma value
  9295. is set.
  9296. @section ssim
  9297. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9298. This filter takes in input two input videos, the first input is
  9299. considered the "main" source and is passed unchanged to the
  9300. output. The second input is used as a "reference" video for computing
  9301. the SSIM.
  9302. Both video inputs must have the same resolution and pixel format for
  9303. this filter to work correctly. Also it assumes that both inputs
  9304. have the same number of frames, which are compared one by one.
  9305. The filter stores the calculated SSIM of each frame.
  9306. The description of the accepted parameters follows.
  9307. @table @option
  9308. @item stats_file, f
  9309. If specified the filter will use the named file to save the SSIM of
  9310. each individual frame. When filename equals "-" the data is sent to
  9311. standard output.
  9312. @end table
  9313. The file printed if @var{stats_file} is selected, contains a sequence of
  9314. key/value pairs of the form @var{key}:@var{value} for each compared
  9315. couple of frames.
  9316. A description of each shown parameter follows:
  9317. @table @option
  9318. @item n
  9319. sequential number of the input frame, starting from 1
  9320. @item Y, U, V, R, G, B
  9321. SSIM of the compared frames for the component specified by the suffix.
  9322. @item All
  9323. SSIM of the compared frames for the whole frame.
  9324. @item dB
  9325. Same as above but in dB representation.
  9326. @end table
  9327. For example:
  9328. @example
  9329. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9330. [main][ref] ssim="stats_file=stats.log" [out]
  9331. @end example
  9332. On this example the input file being processed is compared with the
  9333. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9334. is stored in @file{stats.log}.
  9335. Another example with both psnr and ssim at same time:
  9336. @example
  9337. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9338. @end example
  9339. @section stereo3d
  9340. Convert between different stereoscopic image formats.
  9341. The filters accept the following options:
  9342. @table @option
  9343. @item in
  9344. Set stereoscopic image format of input.
  9345. Available values for input image formats are:
  9346. @table @samp
  9347. @item sbsl
  9348. side by side parallel (left eye left, right eye right)
  9349. @item sbsr
  9350. side by side crosseye (right eye left, left eye right)
  9351. @item sbs2l
  9352. side by side parallel with half width resolution
  9353. (left eye left, right eye right)
  9354. @item sbs2r
  9355. side by side crosseye with half width resolution
  9356. (right eye left, left eye right)
  9357. @item abl
  9358. above-below (left eye above, right eye below)
  9359. @item abr
  9360. above-below (right eye above, left eye below)
  9361. @item ab2l
  9362. above-below with half height resolution
  9363. (left eye above, right eye below)
  9364. @item ab2r
  9365. above-below with half height resolution
  9366. (right eye above, left eye below)
  9367. @item al
  9368. alternating frames (left eye first, right eye second)
  9369. @item ar
  9370. alternating frames (right eye first, left eye second)
  9371. @item irl
  9372. interleaved rows (left eye has top row, right eye starts on next row)
  9373. @item irr
  9374. interleaved rows (right eye has top row, left eye starts on next row)
  9375. @item icl
  9376. interleaved columns, left eye first
  9377. @item icr
  9378. interleaved columns, right eye first
  9379. Default value is @samp{sbsl}.
  9380. @end table
  9381. @item out
  9382. Set stereoscopic image format of output.
  9383. @table @samp
  9384. @item sbsl
  9385. side by side parallel (left eye left, right eye right)
  9386. @item sbsr
  9387. side by side crosseye (right eye left, left eye right)
  9388. @item sbs2l
  9389. side by side parallel with half width resolution
  9390. (left eye left, right eye right)
  9391. @item sbs2r
  9392. side by side crosseye with half width resolution
  9393. (right eye left, left eye right)
  9394. @item abl
  9395. above-below (left eye above, right eye below)
  9396. @item abr
  9397. above-below (right eye above, left eye below)
  9398. @item ab2l
  9399. above-below with half height resolution
  9400. (left eye above, right eye below)
  9401. @item ab2r
  9402. above-below with half height resolution
  9403. (right eye above, left eye below)
  9404. @item al
  9405. alternating frames (left eye first, right eye second)
  9406. @item ar
  9407. alternating frames (right eye first, left eye second)
  9408. @item irl
  9409. interleaved rows (left eye has top row, right eye starts on next row)
  9410. @item irr
  9411. interleaved rows (right eye has top row, left eye starts on next row)
  9412. @item arbg
  9413. anaglyph red/blue gray
  9414. (red filter on left eye, blue filter on right eye)
  9415. @item argg
  9416. anaglyph red/green gray
  9417. (red filter on left eye, green filter on right eye)
  9418. @item arcg
  9419. anaglyph red/cyan gray
  9420. (red filter on left eye, cyan filter on right eye)
  9421. @item arch
  9422. anaglyph red/cyan half colored
  9423. (red filter on left eye, cyan filter on right eye)
  9424. @item arcc
  9425. anaglyph red/cyan color
  9426. (red filter on left eye, cyan filter on right eye)
  9427. @item arcd
  9428. anaglyph red/cyan color optimized with the least squares projection of dubois
  9429. (red filter on left eye, cyan filter on right eye)
  9430. @item agmg
  9431. anaglyph green/magenta gray
  9432. (green filter on left eye, magenta filter on right eye)
  9433. @item agmh
  9434. anaglyph green/magenta half colored
  9435. (green filter on left eye, magenta filter on right eye)
  9436. @item agmc
  9437. anaglyph green/magenta colored
  9438. (green filter on left eye, magenta filter on right eye)
  9439. @item agmd
  9440. anaglyph green/magenta color optimized with the least squares projection of dubois
  9441. (green filter on left eye, magenta filter on right eye)
  9442. @item aybg
  9443. anaglyph yellow/blue gray
  9444. (yellow filter on left eye, blue filter on right eye)
  9445. @item aybh
  9446. anaglyph yellow/blue half colored
  9447. (yellow filter on left eye, blue filter on right eye)
  9448. @item aybc
  9449. anaglyph yellow/blue colored
  9450. (yellow filter on left eye, blue filter on right eye)
  9451. @item aybd
  9452. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9453. (yellow filter on left eye, blue filter on right eye)
  9454. @item ml
  9455. mono output (left eye only)
  9456. @item mr
  9457. mono output (right eye only)
  9458. @item chl
  9459. checkerboard, left eye first
  9460. @item chr
  9461. checkerboard, right eye first
  9462. @item icl
  9463. interleaved columns, left eye first
  9464. @item icr
  9465. interleaved columns, right eye first
  9466. @end table
  9467. Default value is @samp{arcd}.
  9468. @end table
  9469. @subsection Examples
  9470. @itemize
  9471. @item
  9472. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9473. @example
  9474. stereo3d=sbsl:aybd
  9475. @end example
  9476. @item
  9477. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9478. @example
  9479. stereo3d=abl:sbsr
  9480. @end example
  9481. @end itemize
  9482. @section streamselect, astreamselect
  9483. Select video or audio streams.
  9484. The filter accepts the following options:
  9485. @table @option
  9486. @item inputs
  9487. Set number of inputs. Default is 2.
  9488. @item map
  9489. Set input indexes to remap to outputs.
  9490. @end table
  9491. @subsection Commands
  9492. The @code{streamselect} and @code{astreamselect} filter supports the following
  9493. commands:
  9494. @table @option
  9495. @item map
  9496. Set input indexes to remap to outputs.
  9497. @end table
  9498. @subsection Examples
  9499. @itemize
  9500. @item
  9501. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9502. @example
  9503. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9504. @end example
  9505. @item
  9506. Same as above, but for audio:
  9507. @example
  9508. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9509. @end example
  9510. @end itemize
  9511. @anchor{spp}
  9512. @section spp
  9513. Apply a simple postprocessing filter that compresses and decompresses the image
  9514. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9515. and average the results.
  9516. The filter accepts the following options:
  9517. @table @option
  9518. @item quality
  9519. Set quality. This option defines the number of levels for averaging. It accepts
  9520. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9521. effect. A value of @code{6} means the higher quality. For each increment of
  9522. that value the speed drops by a factor of approximately 2. Default value is
  9523. @code{3}.
  9524. @item qp
  9525. Force a constant quantization parameter. If not set, the filter will use the QP
  9526. from the video stream (if available).
  9527. @item mode
  9528. Set thresholding mode. Available modes are:
  9529. @table @samp
  9530. @item hard
  9531. Set hard thresholding (default).
  9532. @item soft
  9533. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9534. @end table
  9535. @item use_bframe_qp
  9536. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9537. option may cause flicker since the B-Frames have often larger QP. Default is
  9538. @code{0} (not enabled).
  9539. @end table
  9540. @anchor{subtitles}
  9541. @section subtitles
  9542. Draw subtitles on top of input video using the libass library.
  9543. To enable compilation of this filter you need to configure FFmpeg with
  9544. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9545. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9546. Alpha) subtitles format.
  9547. The filter accepts the following options:
  9548. @table @option
  9549. @item filename, f
  9550. Set the filename of the subtitle file to read. It must be specified.
  9551. @item original_size
  9552. Specify the size of the original video, the video for which the ASS file
  9553. was composed. For the syntax of this option, check the
  9554. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9555. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9556. correctly scale the fonts if the aspect ratio has been changed.
  9557. @item fontsdir
  9558. Set a directory path containing fonts that can be used by the filter.
  9559. These fonts will be used in addition to whatever the font provider uses.
  9560. @item charenc
  9561. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9562. useful if not UTF-8.
  9563. @item stream_index, si
  9564. Set subtitles stream index. @code{subtitles} filter only.
  9565. @item force_style
  9566. Override default style or script info parameters of the subtitles. It accepts a
  9567. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9568. @end table
  9569. If the first key is not specified, it is assumed that the first value
  9570. specifies the @option{filename}.
  9571. For example, to render the file @file{sub.srt} on top of the input
  9572. video, use the command:
  9573. @example
  9574. subtitles=sub.srt
  9575. @end example
  9576. which is equivalent to:
  9577. @example
  9578. subtitles=filename=sub.srt
  9579. @end example
  9580. To render the default subtitles stream from file @file{video.mkv}, use:
  9581. @example
  9582. subtitles=video.mkv
  9583. @end example
  9584. To render the second subtitles stream from that file, use:
  9585. @example
  9586. subtitles=video.mkv:si=1
  9587. @end example
  9588. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9589. @code{DejaVu Serif}, use:
  9590. @example
  9591. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9592. @end example
  9593. @section super2xsai
  9594. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9595. Interpolate) pixel art scaling algorithm.
  9596. Useful for enlarging pixel art images without reducing sharpness.
  9597. @section swaprect
  9598. Swap two rectangular objects in video.
  9599. This filter accepts the following options:
  9600. @table @option
  9601. @item w
  9602. Set object width.
  9603. @item h
  9604. Set object height.
  9605. @item x1
  9606. Set 1st rect x coordinate.
  9607. @item y1
  9608. Set 1st rect y coordinate.
  9609. @item x2
  9610. Set 2nd rect x coordinate.
  9611. @item y2
  9612. Set 2nd rect y coordinate.
  9613. All expressions are evaluated once for each frame.
  9614. @end table
  9615. The all options are expressions containing the following constants:
  9616. @table @option
  9617. @item w
  9618. @item h
  9619. The input width and height.
  9620. @item a
  9621. same as @var{w} / @var{h}
  9622. @item sar
  9623. input sample aspect ratio
  9624. @item dar
  9625. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9626. @item n
  9627. The number of the input frame, starting from 0.
  9628. @item t
  9629. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9630. @item pos
  9631. the position in the file of the input frame, NAN if unknown
  9632. @end table
  9633. @section swapuv
  9634. Swap U & V plane.
  9635. @section telecine
  9636. Apply telecine process to the video.
  9637. This filter accepts the following options:
  9638. @table @option
  9639. @item first_field
  9640. @table @samp
  9641. @item top, t
  9642. top field first
  9643. @item bottom, b
  9644. bottom field first
  9645. The default value is @code{top}.
  9646. @end table
  9647. @item pattern
  9648. A string of numbers representing the pulldown pattern you wish to apply.
  9649. The default value is @code{23}.
  9650. @end table
  9651. @example
  9652. Some typical patterns:
  9653. NTSC output (30i):
  9654. 27.5p: 32222
  9655. 24p: 23 (classic)
  9656. 24p: 2332 (preferred)
  9657. 20p: 33
  9658. 18p: 334
  9659. 16p: 3444
  9660. PAL output (25i):
  9661. 27.5p: 12222
  9662. 24p: 222222222223 ("Euro pulldown")
  9663. 16.67p: 33
  9664. 16p: 33333334
  9665. @end example
  9666. @section thumbnail
  9667. Select the most representative frame in a given sequence of consecutive frames.
  9668. The filter accepts the following options:
  9669. @table @option
  9670. @item n
  9671. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  9672. will pick one of them, and then handle the next batch of @var{n} frames until
  9673. the end. Default is @code{100}.
  9674. @end table
  9675. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  9676. value will result in a higher memory usage, so a high value is not recommended.
  9677. @subsection Examples
  9678. @itemize
  9679. @item
  9680. Extract one picture each 50 frames:
  9681. @example
  9682. thumbnail=50
  9683. @end example
  9684. @item
  9685. Complete example of a thumbnail creation with @command{ffmpeg}:
  9686. @example
  9687. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  9688. @end example
  9689. @end itemize
  9690. @section tile
  9691. Tile several successive frames together.
  9692. The filter accepts the following options:
  9693. @table @option
  9694. @item layout
  9695. Set the grid size (i.e. the number of lines and columns). For the syntax of
  9696. this option, check the
  9697. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9698. @item nb_frames
  9699. Set the maximum number of frames to render in the given area. It must be less
  9700. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  9701. the area will be used.
  9702. @item margin
  9703. Set the outer border margin in pixels.
  9704. @item padding
  9705. Set the inner border thickness (i.e. the number of pixels between frames). For
  9706. more advanced padding options (such as having different values for the edges),
  9707. refer to the pad video filter.
  9708. @item color
  9709. Specify the color of the unused area. For the syntax of this option, check the
  9710. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  9711. is "black".
  9712. @end table
  9713. @subsection Examples
  9714. @itemize
  9715. @item
  9716. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  9717. @example
  9718. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  9719. @end example
  9720. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  9721. duplicating each output frame to accommodate the originally detected frame
  9722. rate.
  9723. @item
  9724. Display @code{5} pictures in an area of @code{3x2} frames,
  9725. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  9726. mixed flat and named options:
  9727. @example
  9728. tile=3x2:nb_frames=5:padding=7:margin=2
  9729. @end example
  9730. @end itemize
  9731. @section tinterlace
  9732. Perform various types of temporal field interlacing.
  9733. Frames are counted starting from 1, so the first input frame is
  9734. considered odd.
  9735. The filter accepts the following options:
  9736. @table @option
  9737. @item mode
  9738. Specify the mode of the interlacing. This option can also be specified
  9739. as a value alone. See below for a list of values for this option.
  9740. Available values are:
  9741. @table @samp
  9742. @item merge, 0
  9743. Move odd frames into the upper field, even into the lower field,
  9744. generating a double height frame at half frame rate.
  9745. @example
  9746. ------> time
  9747. Input:
  9748. Frame 1 Frame 2 Frame 3 Frame 4
  9749. 11111 22222 33333 44444
  9750. 11111 22222 33333 44444
  9751. 11111 22222 33333 44444
  9752. 11111 22222 33333 44444
  9753. Output:
  9754. 11111 33333
  9755. 22222 44444
  9756. 11111 33333
  9757. 22222 44444
  9758. 11111 33333
  9759. 22222 44444
  9760. 11111 33333
  9761. 22222 44444
  9762. @end example
  9763. @item drop_even, 1
  9764. Only output odd frames, even frames are dropped, generating a frame with
  9765. unchanged height at half frame rate.
  9766. @example
  9767. ------> time
  9768. Input:
  9769. Frame 1 Frame 2 Frame 3 Frame 4
  9770. 11111 22222 33333 44444
  9771. 11111 22222 33333 44444
  9772. 11111 22222 33333 44444
  9773. 11111 22222 33333 44444
  9774. Output:
  9775. 11111 33333
  9776. 11111 33333
  9777. 11111 33333
  9778. 11111 33333
  9779. @end example
  9780. @item drop_odd, 2
  9781. Only output even frames, odd frames are dropped, generating a frame with
  9782. unchanged height at half frame rate.
  9783. @example
  9784. ------> time
  9785. Input:
  9786. Frame 1 Frame 2 Frame 3 Frame 4
  9787. 11111 22222 33333 44444
  9788. 11111 22222 33333 44444
  9789. 11111 22222 33333 44444
  9790. 11111 22222 33333 44444
  9791. Output:
  9792. 22222 44444
  9793. 22222 44444
  9794. 22222 44444
  9795. 22222 44444
  9796. @end example
  9797. @item pad, 3
  9798. Expand each frame to full height, but pad alternate lines with black,
  9799. generating a frame with double height at the same input frame rate.
  9800. @example
  9801. ------> time
  9802. Input:
  9803. Frame 1 Frame 2 Frame 3 Frame 4
  9804. 11111 22222 33333 44444
  9805. 11111 22222 33333 44444
  9806. 11111 22222 33333 44444
  9807. 11111 22222 33333 44444
  9808. Output:
  9809. 11111 ..... 33333 .....
  9810. ..... 22222 ..... 44444
  9811. 11111 ..... 33333 .....
  9812. ..... 22222 ..... 44444
  9813. 11111 ..... 33333 .....
  9814. ..... 22222 ..... 44444
  9815. 11111 ..... 33333 .....
  9816. ..... 22222 ..... 44444
  9817. @end example
  9818. @item interleave_top, 4
  9819. Interleave the upper field from odd frames with the lower field from
  9820. even frames, generating a frame with unchanged height at half frame rate.
  9821. @example
  9822. ------> time
  9823. Input:
  9824. Frame 1 Frame 2 Frame 3 Frame 4
  9825. 11111<- 22222 33333<- 44444
  9826. 11111 22222<- 33333 44444<-
  9827. 11111<- 22222 33333<- 44444
  9828. 11111 22222<- 33333 44444<-
  9829. Output:
  9830. 11111 33333
  9831. 22222 44444
  9832. 11111 33333
  9833. 22222 44444
  9834. @end example
  9835. @item interleave_bottom, 5
  9836. Interleave the lower field from odd frames with the upper field from
  9837. even frames, generating a frame with unchanged height at half frame rate.
  9838. @example
  9839. ------> time
  9840. Input:
  9841. Frame 1 Frame 2 Frame 3 Frame 4
  9842. 11111 22222<- 33333 44444<-
  9843. 11111<- 22222 33333<- 44444
  9844. 11111 22222<- 33333 44444<-
  9845. 11111<- 22222 33333<- 44444
  9846. Output:
  9847. 22222 44444
  9848. 11111 33333
  9849. 22222 44444
  9850. 11111 33333
  9851. @end example
  9852. @item interlacex2, 6
  9853. Double frame rate with unchanged height. Frames are inserted each
  9854. containing the second temporal field from the previous input frame and
  9855. the first temporal field from the next input frame. This mode relies on
  9856. the top_field_first flag. Useful for interlaced video displays with no
  9857. field synchronisation.
  9858. @example
  9859. ------> time
  9860. Input:
  9861. Frame 1 Frame 2 Frame 3 Frame 4
  9862. 11111 22222 33333 44444
  9863. 11111 22222 33333 44444
  9864. 11111 22222 33333 44444
  9865. 11111 22222 33333 44444
  9866. Output:
  9867. 11111 22222 22222 33333 33333 44444 44444
  9868. 11111 11111 22222 22222 33333 33333 44444
  9869. 11111 22222 22222 33333 33333 44444 44444
  9870. 11111 11111 22222 22222 33333 33333 44444
  9871. @end example
  9872. @item mergex2, 7
  9873. Move odd frames into the upper field, even into the lower field,
  9874. generating a double height frame at same frame rate.
  9875. @example
  9876. ------> time
  9877. Input:
  9878. Frame 1 Frame 2 Frame 3 Frame 4
  9879. 11111 22222 33333 44444
  9880. 11111 22222 33333 44444
  9881. 11111 22222 33333 44444
  9882. 11111 22222 33333 44444
  9883. Output:
  9884. 11111 33333 33333 55555
  9885. 22222 22222 44444 44444
  9886. 11111 33333 33333 55555
  9887. 22222 22222 44444 44444
  9888. 11111 33333 33333 55555
  9889. 22222 22222 44444 44444
  9890. 11111 33333 33333 55555
  9891. 22222 22222 44444 44444
  9892. @end example
  9893. @end table
  9894. Numeric values are deprecated but are accepted for backward
  9895. compatibility reasons.
  9896. Default mode is @code{merge}.
  9897. @item flags
  9898. Specify flags influencing the filter process.
  9899. Available value for @var{flags} is:
  9900. @table @option
  9901. @item low_pass_filter, vlfp
  9902. Enable vertical low-pass filtering in the filter.
  9903. Vertical low-pass filtering is required when creating an interlaced
  9904. destination from a progressive source which contains high-frequency
  9905. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  9906. patterning.
  9907. Vertical low-pass filtering can only be enabled for @option{mode}
  9908. @var{interleave_top} and @var{interleave_bottom}.
  9909. @end table
  9910. @end table
  9911. @section transpose
  9912. Transpose rows with columns in the input video and optionally flip it.
  9913. It accepts the following parameters:
  9914. @table @option
  9915. @item dir
  9916. Specify the transposition direction.
  9917. Can assume the following values:
  9918. @table @samp
  9919. @item 0, 4, cclock_flip
  9920. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  9921. @example
  9922. L.R L.l
  9923. . . -> . .
  9924. l.r R.r
  9925. @end example
  9926. @item 1, 5, clock
  9927. Rotate by 90 degrees clockwise, that is:
  9928. @example
  9929. L.R l.L
  9930. . . -> . .
  9931. l.r r.R
  9932. @end example
  9933. @item 2, 6, cclock
  9934. Rotate by 90 degrees counterclockwise, that is:
  9935. @example
  9936. L.R R.r
  9937. . . -> . .
  9938. l.r L.l
  9939. @end example
  9940. @item 3, 7, clock_flip
  9941. Rotate by 90 degrees clockwise and vertically flip, that is:
  9942. @example
  9943. L.R r.R
  9944. . . -> . .
  9945. l.r l.L
  9946. @end example
  9947. @end table
  9948. For values between 4-7, the transposition is only done if the input
  9949. video geometry is portrait and not landscape. These values are
  9950. deprecated, the @code{passthrough} option should be used instead.
  9951. Numerical values are deprecated, and should be dropped in favor of
  9952. symbolic constants.
  9953. @item passthrough
  9954. Do not apply the transposition if the input geometry matches the one
  9955. specified by the specified value. It accepts the following values:
  9956. @table @samp
  9957. @item none
  9958. Always apply transposition.
  9959. @item portrait
  9960. Preserve portrait geometry (when @var{height} >= @var{width}).
  9961. @item landscape
  9962. Preserve landscape geometry (when @var{width} >= @var{height}).
  9963. @end table
  9964. Default value is @code{none}.
  9965. @end table
  9966. For example to rotate by 90 degrees clockwise and preserve portrait
  9967. layout:
  9968. @example
  9969. transpose=dir=1:passthrough=portrait
  9970. @end example
  9971. The command above can also be specified as:
  9972. @example
  9973. transpose=1:portrait
  9974. @end example
  9975. @section trim
  9976. Trim the input so that the output contains one continuous subpart of the input.
  9977. It accepts the following parameters:
  9978. @table @option
  9979. @item start
  9980. Specify the time of the start of the kept section, i.e. the frame with the
  9981. timestamp @var{start} will be the first frame in the output.
  9982. @item end
  9983. Specify the time of the first frame that will be dropped, i.e. the frame
  9984. immediately preceding the one with the timestamp @var{end} will be the last
  9985. frame in the output.
  9986. @item start_pts
  9987. This is the same as @var{start}, except this option sets the start timestamp
  9988. in timebase units instead of seconds.
  9989. @item end_pts
  9990. This is the same as @var{end}, except this option sets the end timestamp
  9991. in timebase units instead of seconds.
  9992. @item duration
  9993. The maximum duration of the output in seconds.
  9994. @item start_frame
  9995. The number of the first frame that should be passed to the output.
  9996. @item end_frame
  9997. The number of the first frame that should be dropped.
  9998. @end table
  9999. @option{start}, @option{end}, and @option{duration} are expressed as time
  10000. duration specifications; see
  10001. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10002. for the accepted syntax.
  10003. Note that the first two sets of the start/end options and the @option{duration}
  10004. option look at the frame timestamp, while the _frame variants simply count the
  10005. frames that pass through the filter. Also note that this filter does not modify
  10006. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10007. setpts filter after the trim filter.
  10008. If multiple start or end options are set, this filter tries to be greedy and
  10009. keep all the frames that match at least one of the specified constraints. To keep
  10010. only the part that matches all the constraints at once, chain multiple trim
  10011. filters.
  10012. The defaults are such that all the input is kept. So it is possible to set e.g.
  10013. just the end values to keep everything before the specified time.
  10014. Examples:
  10015. @itemize
  10016. @item
  10017. Drop everything except the second minute of input:
  10018. @example
  10019. ffmpeg -i INPUT -vf trim=60:120
  10020. @end example
  10021. @item
  10022. Keep only the first second:
  10023. @example
  10024. ffmpeg -i INPUT -vf trim=duration=1
  10025. @end example
  10026. @end itemize
  10027. @anchor{unsharp}
  10028. @section unsharp
  10029. Sharpen or blur the input video.
  10030. It accepts the following parameters:
  10031. @table @option
  10032. @item luma_msize_x, lx
  10033. Set the luma matrix horizontal size. It must be an odd integer between
  10034. 3 and 63. The default value is 5.
  10035. @item luma_msize_y, ly
  10036. Set the luma matrix vertical size. It must be an odd integer between 3
  10037. and 63. The default value is 5.
  10038. @item luma_amount, la
  10039. Set the luma effect strength. It must be a floating point number, reasonable
  10040. values lay between -1.5 and 1.5.
  10041. Negative values will blur the input video, while positive values will
  10042. sharpen it, a value of zero will disable the effect.
  10043. Default value is 1.0.
  10044. @item chroma_msize_x, cx
  10045. Set the chroma matrix horizontal size. It must be an odd integer
  10046. between 3 and 63. The default value is 5.
  10047. @item chroma_msize_y, cy
  10048. Set the chroma matrix vertical size. It must be an odd integer
  10049. between 3 and 63. The default value is 5.
  10050. @item chroma_amount, ca
  10051. Set the chroma effect strength. It must be a floating point number, reasonable
  10052. values lay between -1.5 and 1.5.
  10053. Negative values will blur the input video, while positive values will
  10054. sharpen it, a value of zero will disable the effect.
  10055. Default value is 0.0.
  10056. @item opencl
  10057. If set to 1, specify using OpenCL capabilities, only available if
  10058. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10059. @end table
  10060. All parameters are optional and default to the equivalent of the
  10061. string '5:5:1.0:5:5:0.0'.
  10062. @subsection Examples
  10063. @itemize
  10064. @item
  10065. Apply strong luma sharpen effect:
  10066. @example
  10067. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10068. @end example
  10069. @item
  10070. Apply a strong blur of both luma and chroma parameters:
  10071. @example
  10072. unsharp=7:7:-2:7:7:-2
  10073. @end example
  10074. @end itemize
  10075. @section uspp
  10076. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10077. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10078. shifts and average the results.
  10079. The way this differs from the behavior of spp is that uspp actually encodes &
  10080. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10081. DCT similar to MJPEG.
  10082. The filter accepts the following options:
  10083. @table @option
  10084. @item quality
  10085. Set quality. This option defines the number of levels for averaging. It accepts
  10086. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10087. effect. A value of @code{8} means the higher quality. For each increment of
  10088. that value the speed drops by a factor of approximately 2. Default value is
  10089. @code{3}.
  10090. @item qp
  10091. Force a constant quantization parameter. If not set, the filter will use the QP
  10092. from the video stream (if available).
  10093. @end table
  10094. @section vectorscope
  10095. Display 2 color component values in the two dimensional graph (which is called
  10096. a vectorscope).
  10097. This filter accepts the following options:
  10098. @table @option
  10099. @item mode, m
  10100. Set vectorscope mode.
  10101. It accepts the following values:
  10102. @table @samp
  10103. @item gray
  10104. Gray values are displayed on graph, higher brightness means more pixels have
  10105. same component color value on location in graph. This is the default mode.
  10106. @item color
  10107. Gray values are displayed on graph. Surrounding pixels values which are not
  10108. present in video frame are drawn in gradient of 2 color components which are
  10109. set by option @code{x} and @code{y}. The 3rd color component is static.
  10110. @item color2
  10111. Actual color components values present in video frame are displayed on graph.
  10112. @item color3
  10113. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10114. on graph increases value of another color component, which is luminance by
  10115. default values of @code{x} and @code{y}.
  10116. @item color4
  10117. Actual colors present in video frame are displayed on graph. If two different
  10118. colors map to same position on graph then color with higher value of component
  10119. not present in graph is picked.
  10120. @item color5
  10121. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10122. component picked from radial gradient.
  10123. @end table
  10124. @item x
  10125. Set which color component will be represented on X-axis. Default is @code{1}.
  10126. @item y
  10127. Set which color component will be represented on Y-axis. Default is @code{2}.
  10128. @item intensity, i
  10129. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10130. of color component which represents frequency of (X, Y) location in graph.
  10131. @item envelope, e
  10132. @table @samp
  10133. @item none
  10134. No envelope, this is default.
  10135. @item instant
  10136. Instant envelope, even darkest single pixel will be clearly highlighted.
  10137. @item peak
  10138. Hold maximum and minimum values presented in graph over time. This way you
  10139. can still spot out of range values without constantly looking at vectorscope.
  10140. @item peak+instant
  10141. Peak and instant envelope combined together.
  10142. @end table
  10143. @item graticule, g
  10144. Set what kind of graticule to draw.
  10145. @table @samp
  10146. @item none
  10147. @item green
  10148. @item color
  10149. @end table
  10150. @item opacity, o
  10151. Set graticule opacity.
  10152. @item flags, f
  10153. Set graticule flags.
  10154. @table @samp
  10155. @item white
  10156. Draw graticule for white point.
  10157. @item black
  10158. Draw graticule for black point.
  10159. @item name
  10160. Draw color points short names.
  10161. @end table
  10162. @item bgopacity, b
  10163. Set background opacity.
  10164. @item lthreshold, l
  10165. Set low threshold for color component not represented on X or Y axis.
  10166. Values lower than this value will be ignored. Default is 0.
  10167. Note this value is multiplied with actual max possible value one pixel component
  10168. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10169. is 0.1 * 255 = 25.
  10170. @item hthreshold, h
  10171. Set high threshold for color component not represented on X or Y axis.
  10172. Values higher than this value will be ignored. Default is 1.
  10173. Note this value is multiplied with actual max possible value one pixel component
  10174. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10175. is 0.9 * 255 = 230.
  10176. @item colorspace, c
  10177. Set what kind of colorspace to use when drawing graticule.
  10178. @table @samp
  10179. @item auto
  10180. @item 601
  10181. @item 709
  10182. @end table
  10183. Default is auto.
  10184. @end table
  10185. @anchor{vidstabdetect}
  10186. @section vidstabdetect
  10187. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10188. @ref{vidstabtransform} for pass 2.
  10189. This filter generates a file with relative translation and rotation
  10190. transform information about subsequent frames, which is then used by
  10191. the @ref{vidstabtransform} filter.
  10192. To enable compilation of this filter you need to configure FFmpeg with
  10193. @code{--enable-libvidstab}.
  10194. This filter accepts the following options:
  10195. @table @option
  10196. @item result
  10197. Set the path to the file used to write the transforms information.
  10198. Default value is @file{transforms.trf}.
  10199. @item shakiness
  10200. Set how shaky the video is and how quick the camera is. It accepts an
  10201. integer in the range 1-10, a value of 1 means little shakiness, a
  10202. value of 10 means strong shakiness. Default value is 5.
  10203. @item accuracy
  10204. Set the accuracy of the detection process. It must be a value in the
  10205. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10206. accuracy. Default value is 15.
  10207. @item stepsize
  10208. Set stepsize of the search process. The region around minimum is
  10209. scanned with 1 pixel resolution. Default value is 6.
  10210. @item mincontrast
  10211. Set minimum contrast. Below this value a local measurement field is
  10212. discarded. Must be a floating point value in the range 0-1. Default
  10213. value is 0.3.
  10214. @item tripod
  10215. Set reference frame number for tripod mode.
  10216. If enabled, the motion of the frames is compared to a reference frame
  10217. in the filtered stream, identified by the specified number. The idea
  10218. is to compensate all movements in a more-or-less static scene and keep
  10219. the camera view absolutely still.
  10220. If set to 0, it is disabled. The frames are counted starting from 1.
  10221. @item show
  10222. Show fields and transforms in the resulting frames. It accepts an
  10223. integer in the range 0-2. Default value is 0, which disables any
  10224. visualization.
  10225. @end table
  10226. @subsection Examples
  10227. @itemize
  10228. @item
  10229. Use default values:
  10230. @example
  10231. vidstabdetect
  10232. @end example
  10233. @item
  10234. Analyze strongly shaky movie and put the results in file
  10235. @file{mytransforms.trf}:
  10236. @example
  10237. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10238. @end example
  10239. @item
  10240. Visualize the result of internal transformations in the resulting
  10241. video:
  10242. @example
  10243. vidstabdetect=show=1
  10244. @end example
  10245. @item
  10246. Analyze a video with medium shakiness using @command{ffmpeg}:
  10247. @example
  10248. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10249. @end example
  10250. @end itemize
  10251. @anchor{vidstabtransform}
  10252. @section vidstabtransform
  10253. Video stabilization/deshaking: pass 2 of 2,
  10254. see @ref{vidstabdetect} for pass 1.
  10255. Read a file with transform information for each frame and
  10256. apply/compensate them. Together with the @ref{vidstabdetect}
  10257. filter this can be used to deshake videos. See also
  10258. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10259. the @ref{unsharp} filter, see below.
  10260. To enable compilation of this filter you need to configure FFmpeg with
  10261. @code{--enable-libvidstab}.
  10262. @subsection Options
  10263. @table @option
  10264. @item input
  10265. Set path to the file used to read the transforms. Default value is
  10266. @file{transforms.trf}.
  10267. @item smoothing
  10268. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10269. camera movements. Default value is 10.
  10270. For example a number of 10 means that 21 frames are used (10 in the
  10271. past and 10 in the future) to smoothen the motion in the video. A
  10272. larger value leads to a smoother video, but limits the acceleration of
  10273. the camera (pan/tilt movements). 0 is a special case where a static
  10274. camera is simulated.
  10275. @item optalgo
  10276. Set the camera path optimization algorithm.
  10277. Accepted values are:
  10278. @table @samp
  10279. @item gauss
  10280. gaussian kernel low-pass filter on camera motion (default)
  10281. @item avg
  10282. averaging on transformations
  10283. @end table
  10284. @item maxshift
  10285. Set maximal number of pixels to translate frames. Default value is -1,
  10286. meaning no limit.
  10287. @item maxangle
  10288. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10289. value is -1, meaning no limit.
  10290. @item crop
  10291. Specify how to deal with borders that may be visible due to movement
  10292. compensation.
  10293. Available values are:
  10294. @table @samp
  10295. @item keep
  10296. keep image information from previous frame (default)
  10297. @item black
  10298. fill the border black
  10299. @end table
  10300. @item invert
  10301. Invert transforms if set to 1. Default value is 0.
  10302. @item relative
  10303. Consider transforms as relative to previous frame if set to 1,
  10304. absolute if set to 0. Default value is 0.
  10305. @item zoom
  10306. Set percentage to zoom. A positive value will result in a zoom-in
  10307. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10308. zoom).
  10309. @item optzoom
  10310. Set optimal zooming to avoid borders.
  10311. Accepted values are:
  10312. @table @samp
  10313. @item 0
  10314. disabled
  10315. @item 1
  10316. optimal static zoom value is determined (only very strong movements
  10317. will lead to visible borders) (default)
  10318. @item 2
  10319. optimal adaptive zoom value is determined (no borders will be
  10320. visible), see @option{zoomspeed}
  10321. @end table
  10322. Note that the value given at zoom is added to the one calculated here.
  10323. @item zoomspeed
  10324. Set percent to zoom maximally each frame (enabled when
  10325. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10326. 0.25.
  10327. @item interpol
  10328. Specify type of interpolation.
  10329. Available values are:
  10330. @table @samp
  10331. @item no
  10332. no interpolation
  10333. @item linear
  10334. linear only horizontal
  10335. @item bilinear
  10336. linear in both directions (default)
  10337. @item bicubic
  10338. cubic in both directions (slow)
  10339. @end table
  10340. @item tripod
  10341. Enable virtual tripod mode if set to 1, which is equivalent to
  10342. @code{relative=0:smoothing=0}. Default value is 0.
  10343. Use also @code{tripod} option of @ref{vidstabdetect}.
  10344. @item debug
  10345. Increase log verbosity if set to 1. Also the detected global motions
  10346. are written to the temporary file @file{global_motions.trf}. Default
  10347. value is 0.
  10348. @end table
  10349. @subsection Examples
  10350. @itemize
  10351. @item
  10352. Use @command{ffmpeg} for a typical stabilization with default values:
  10353. @example
  10354. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10355. @end example
  10356. Note the use of the @ref{unsharp} filter which is always recommended.
  10357. @item
  10358. Zoom in a bit more and load transform data from a given file:
  10359. @example
  10360. vidstabtransform=zoom=5:input="mytransforms.trf"
  10361. @end example
  10362. @item
  10363. Smoothen the video even more:
  10364. @example
  10365. vidstabtransform=smoothing=30
  10366. @end example
  10367. @end itemize
  10368. @section vflip
  10369. Flip the input video vertically.
  10370. For example, to vertically flip a video with @command{ffmpeg}:
  10371. @example
  10372. ffmpeg -i in.avi -vf "vflip" out.avi
  10373. @end example
  10374. @anchor{vignette}
  10375. @section vignette
  10376. Make or reverse a natural vignetting effect.
  10377. The filter accepts the following options:
  10378. @table @option
  10379. @item angle, a
  10380. Set lens angle expression as a number of radians.
  10381. The value is clipped in the @code{[0,PI/2]} range.
  10382. Default value: @code{"PI/5"}
  10383. @item x0
  10384. @item y0
  10385. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10386. by default.
  10387. @item mode
  10388. Set forward/backward mode.
  10389. Available modes are:
  10390. @table @samp
  10391. @item forward
  10392. The larger the distance from the central point, the darker the image becomes.
  10393. @item backward
  10394. The larger the distance from the central point, the brighter the image becomes.
  10395. This can be used to reverse a vignette effect, though there is no automatic
  10396. detection to extract the lens @option{angle} and other settings (yet). It can
  10397. also be used to create a burning effect.
  10398. @end table
  10399. Default value is @samp{forward}.
  10400. @item eval
  10401. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10402. It accepts the following values:
  10403. @table @samp
  10404. @item init
  10405. Evaluate expressions only once during the filter initialization.
  10406. @item frame
  10407. Evaluate expressions for each incoming frame. This is way slower than the
  10408. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10409. allows advanced dynamic expressions.
  10410. @end table
  10411. Default value is @samp{init}.
  10412. @item dither
  10413. Set dithering to reduce the circular banding effects. Default is @code{1}
  10414. (enabled).
  10415. @item aspect
  10416. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10417. Setting this value to the SAR of the input will make a rectangular vignetting
  10418. following the dimensions of the video.
  10419. Default is @code{1/1}.
  10420. @end table
  10421. @subsection Expressions
  10422. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10423. following parameters.
  10424. @table @option
  10425. @item w
  10426. @item h
  10427. input width and height
  10428. @item n
  10429. the number of input frame, starting from 0
  10430. @item pts
  10431. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10432. @var{TB} units, NAN if undefined
  10433. @item r
  10434. frame rate of the input video, NAN if the input frame rate is unknown
  10435. @item t
  10436. the PTS (Presentation TimeStamp) of the filtered video frame,
  10437. expressed in seconds, NAN if undefined
  10438. @item tb
  10439. time base of the input video
  10440. @end table
  10441. @subsection Examples
  10442. @itemize
  10443. @item
  10444. Apply simple strong vignetting effect:
  10445. @example
  10446. vignette=PI/4
  10447. @end example
  10448. @item
  10449. Make a flickering vignetting:
  10450. @example
  10451. vignette='PI/4+random(1)*PI/50':eval=frame
  10452. @end example
  10453. @end itemize
  10454. @section vstack
  10455. Stack input videos vertically.
  10456. All streams must be of same pixel format and of same width.
  10457. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10458. to create same output.
  10459. The filter accept the following option:
  10460. @table @option
  10461. @item inputs
  10462. Set number of input streams. Default is 2.
  10463. @item shortest
  10464. If set to 1, force the output to terminate when the shortest input
  10465. terminates. Default value is 0.
  10466. @end table
  10467. @section w3fdif
  10468. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  10469. Deinterlacing Filter").
  10470. Based on the process described by Martin Weston for BBC R&D, and
  10471. implemented based on the de-interlace algorithm written by Jim
  10472. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  10473. uses filter coefficients calculated by BBC R&D.
  10474. There are two sets of filter coefficients, so called "simple":
  10475. and "complex". Which set of filter coefficients is used can
  10476. be set by passing an optional parameter:
  10477. @table @option
  10478. @item filter
  10479. Set the interlacing filter coefficients. Accepts one of the following values:
  10480. @table @samp
  10481. @item simple
  10482. Simple filter coefficient set.
  10483. @item complex
  10484. More-complex filter coefficient set.
  10485. @end table
  10486. Default value is @samp{complex}.
  10487. @item deint
  10488. Specify which frames to deinterlace. Accept one of the following values:
  10489. @table @samp
  10490. @item all
  10491. Deinterlace all frames,
  10492. @item interlaced
  10493. Only deinterlace frames marked as interlaced.
  10494. @end table
  10495. Default value is @samp{all}.
  10496. @end table
  10497. @section waveform
  10498. Video waveform monitor.
  10499. The waveform monitor plots color component intensity. By default luminance
  10500. only. Each column of the waveform corresponds to a column of pixels in the
  10501. source video.
  10502. It accepts the following options:
  10503. @table @option
  10504. @item mode, m
  10505. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10506. In row mode, the graph on the left side represents color component value 0 and
  10507. the right side represents value = 255. In column mode, the top side represents
  10508. color component value = 0 and bottom side represents value = 255.
  10509. @item intensity, i
  10510. Set intensity. Smaller values are useful to find out how many values of the same
  10511. luminance are distributed across input rows/columns.
  10512. Default value is @code{0.04}. Allowed range is [0, 1].
  10513. @item mirror, r
  10514. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10515. In mirrored mode, higher values will be represented on the left
  10516. side for @code{row} mode and at the top for @code{column} mode. Default is
  10517. @code{1} (mirrored).
  10518. @item display, d
  10519. Set display mode.
  10520. It accepts the following values:
  10521. @table @samp
  10522. @item overlay
  10523. Presents information identical to that in the @code{parade}, except
  10524. that the graphs representing color components are superimposed directly
  10525. over one another.
  10526. This display mode makes it easier to spot relative differences or similarities
  10527. in overlapping areas of the color components that are supposed to be identical,
  10528. such as neutral whites, grays, or blacks.
  10529. @item stack
  10530. Display separate graph for the color components side by side in
  10531. @code{row} mode or one below the other in @code{column} mode.
  10532. @item parade
  10533. Display separate graph for the color components side by side in
  10534. @code{column} mode or one below the other in @code{row} mode.
  10535. Using this display mode makes it easy to spot color casts in the highlights
  10536. and shadows of an image, by comparing the contours of the top and the bottom
  10537. graphs of each waveform. Since whites, grays, and blacks are characterized
  10538. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10539. should display three waveforms of roughly equal width/height. If not, the
  10540. correction is easy to perform by making level adjustments the three waveforms.
  10541. @end table
  10542. Default is @code{stack}.
  10543. @item components, c
  10544. Set which color components to display. Default is 1, which means only luminance
  10545. or red color component if input is in RGB colorspace. If is set for example to
  10546. 7 it will display all 3 (if) available color components.
  10547. @item envelope, e
  10548. @table @samp
  10549. @item none
  10550. No envelope, this is default.
  10551. @item instant
  10552. Instant envelope, minimum and maximum values presented in graph will be easily
  10553. visible even with small @code{step} value.
  10554. @item peak
  10555. Hold minimum and maximum values presented in graph across time. This way you
  10556. can still spot out of range values without constantly looking at waveforms.
  10557. @item peak+instant
  10558. Peak and instant envelope combined together.
  10559. @end table
  10560. @item filter, f
  10561. @table @samp
  10562. @item lowpass
  10563. No filtering, this is default.
  10564. @item flat
  10565. Luma and chroma combined together.
  10566. @item aflat
  10567. Similar as above, but shows difference between blue and red chroma.
  10568. @item chroma
  10569. Displays only chroma.
  10570. @item color
  10571. Displays actual color value on waveform.
  10572. @item acolor
  10573. Similar as above, but with luma showing frequency of chroma values.
  10574. @end table
  10575. @item graticule, g
  10576. Set which graticule to display.
  10577. @table @samp
  10578. @item none
  10579. Do not display graticule.
  10580. @item green
  10581. Display green graticule showing legal broadcast ranges.
  10582. @end table
  10583. @item opacity, o
  10584. Set graticule opacity.
  10585. @item flags, fl
  10586. Set graticule flags.
  10587. @table @samp
  10588. @item numbers
  10589. Draw numbers above lines. By default enabled.
  10590. @item dots
  10591. Draw dots instead of lines.
  10592. @end table
  10593. @item scale, s
  10594. Set scale used for displaying graticule.
  10595. @table @samp
  10596. @item digital
  10597. @item millivolts
  10598. @item ire
  10599. @end table
  10600. Default is digital.
  10601. @end table
  10602. @section xbr
  10603. Apply the xBR high-quality magnification filter which is designed for pixel
  10604. art. It follows a set of edge-detection rules, see
  10605. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  10606. It accepts the following option:
  10607. @table @option
  10608. @item n
  10609. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  10610. @code{3xBR} and @code{4} for @code{4xBR}.
  10611. Default is @code{3}.
  10612. @end table
  10613. @anchor{yadif}
  10614. @section yadif
  10615. Deinterlace the input video ("yadif" means "yet another deinterlacing
  10616. filter").
  10617. It accepts the following parameters:
  10618. @table @option
  10619. @item mode
  10620. The interlacing mode to adopt. It accepts one of the following values:
  10621. @table @option
  10622. @item 0, send_frame
  10623. Output one frame for each frame.
  10624. @item 1, send_field
  10625. Output one frame for each field.
  10626. @item 2, send_frame_nospatial
  10627. Like @code{send_frame}, but it skips the spatial interlacing check.
  10628. @item 3, send_field_nospatial
  10629. Like @code{send_field}, but it skips the spatial interlacing check.
  10630. @end table
  10631. The default value is @code{send_frame}.
  10632. @item parity
  10633. The picture field parity assumed for the input interlaced video. It accepts one
  10634. of the following values:
  10635. @table @option
  10636. @item 0, tff
  10637. Assume the top field is first.
  10638. @item 1, bff
  10639. Assume the bottom field is first.
  10640. @item -1, auto
  10641. Enable automatic detection of field parity.
  10642. @end table
  10643. The default value is @code{auto}.
  10644. If the interlacing is unknown or the decoder does not export this information,
  10645. top field first will be assumed.
  10646. @item deint
  10647. Specify which frames to deinterlace. Accept one of the following
  10648. values:
  10649. @table @option
  10650. @item 0, all
  10651. Deinterlace all frames.
  10652. @item 1, interlaced
  10653. Only deinterlace frames marked as interlaced.
  10654. @end table
  10655. The default value is @code{all}.
  10656. @end table
  10657. @section zoompan
  10658. Apply Zoom & Pan effect.
  10659. This filter accepts the following options:
  10660. @table @option
  10661. @item zoom, z
  10662. Set the zoom expression. Default is 1.
  10663. @item x
  10664. @item y
  10665. Set the x and y expression. Default is 0.
  10666. @item d
  10667. Set the duration expression in number of frames.
  10668. This sets for how many number of frames effect will last for
  10669. single input image.
  10670. @item s
  10671. Set the output image size, default is 'hd720'.
  10672. @item fps
  10673. Set the output frame rate, default is '25'.
  10674. @end table
  10675. Each expression can contain the following constants:
  10676. @table @option
  10677. @item in_w, iw
  10678. Input width.
  10679. @item in_h, ih
  10680. Input height.
  10681. @item out_w, ow
  10682. Output width.
  10683. @item out_h, oh
  10684. Output height.
  10685. @item in
  10686. Input frame count.
  10687. @item on
  10688. Output frame count.
  10689. @item x
  10690. @item y
  10691. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  10692. for current input frame.
  10693. @item px
  10694. @item py
  10695. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  10696. not yet such frame (first input frame).
  10697. @item zoom
  10698. Last calculated zoom from 'z' expression for current input frame.
  10699. @item pzoom
  10700. Last calculated zoom of last output frame of previous input frame.
  10701. @item duration
  10702. Number of output frames for current input frame. Calculated from 'd' expression
  10703. for each input frame.
  10704. @item pduration
  10705. number of output frames created for previous input frame
  10706. @item a
  10707. Rational number: input width / input height
  10708. @item sar
  10709. sample aspect ratio
  10710. @item dar
  10711. display aspect ratio
  10712. @end table
  10713. @subsection Examples
  10714. @itemize
  10715. @item
  10716. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  10717. @example
  10718. 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
  10719. @end example
  10720. @item
  10721. Zoom-in up to 1.5 and pan always at center of picture:
  10722. @example
  10723. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10724. @end example
  10725. @end itemize
  10726. @section zscale
  10727. Scale (resize) the input video, using the z.lib library:
  10728. https://github.com/sekrit-twc/zimg.
  10729. The zscale filter forces the output display aspect ratio to be the same
  10730. as the input, by changing the output sample aspect ratio.
  10731. If the input image format is different from the format requested by
  10732. the next filter, the zscale filter will convert the input to the
  10733. requested format.
  10734. @subsection Options
  10735. The filter accepts the following options.
  10736. @table @option
  10737. @item width, w
  10738. @item height, h
  10739. Set the output video dimension expression. Default value is the input
  10740. dimension.
  10741. If the @var{width} or @var{w} is 0, the input width is used for the output.
  10742. If the @var{height} or @var{h} is 0, the input height is used for the output.
  10743. If one of the values is -1, the zscale filter will use a value that
  10744. maintains the aspect ratio of the input image, calculated from the
  10745. other specified dimension. If both of them are -1, the input size is
  10746. used
  10747. If one of the values is -n with n > 1, the zscale filter will also use a value
  10748. that maintains the aspect ratio of the input image, calculated from the other
  10749. specified dimension. After that it will, however, make sure that the calculated
  10750. dimension is divisible by n and adjust the value if necessary.
  10751. See below for the list of accepted constants for use in the dimension
  10752. expression.
  10753. @item size, s
  10754. Set the video size. For the syntax of this option, check the
  10755. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10756. @item dither, d
  10757. Set the dither type.
  10758. Possible values are:
  10759. @table @var
  10760. @item none
  10761. @item ordered
  10762. @item random
  10763. @item error_diffusion
  10764. @end table
  10765. Default is none.
  10766. @item filter, f
  10767. Set the resize filter type.
  10768. Possible values are:
  10769. @table @var
  10770. @item point
  10771. @item bilinear
  10772. @item bicubic
  10773. @item spline16
  10774. @item spline36
  10775. @item lanczos
  10776. @end table
  10777. Default is bilinear.
  10778. @item range, r
  10779. Set the color range.
  10780. Possible values are:
  10781. @table @var
  10782. @item input
  10783. @item limited
  10784. @item full
  10785. @end table
  10786. Default is same as input.
  10787. @item primaries, p
  10788. Set the color primaries.
  10789. Possible values are:
  10790. @table @var
  10791. @item input
  10792. @item 709
  10793. @item unspecified
  10794. @item 170m
  10795. @item 240m
  10796. @item 2020
  10797. @end table
  10798. Default is same as input.
  10799. @item transfer, t
  10800. Set the transfer characteristics.
  10801. Possible values are:
  10802. @table @var
  10803. @item input
  10804. @item 709
  10805. @item unspecified
  10806. @item 601
  10807. @item linear
  10808. @item 2020_10
  10809. @item 2020_12
  10810. @end table
  10811. Default is same as input.
  10812. @item matrix, m
  10813. Set the colorspace matrix.
  10814. Possible value are:
  10815. @table @var
  10816. @item input
  10817. @item 709
  10818. @item unspecified
  10819. @item 470bg
  10820. @item 170m
  10821. @item 2020_ncl
  10822. @item 2020_cl
  10823. @end table
  10824. Default is same as input.
  10825. @item rangein, rin
  10826. Set the input color range.
  10827. Possible values are:
  10828. @table @var
  10829. @item input
  10830. @item limited
  10831. @item full
  10832. @end table
  10833. Default is same as input.
  10834. @item primariesin, pin
  10835. Set the input color primaries.
  10836. Possible values are:
  10837. @table @var
  10838. @item input
  10839. @item 709
  10840. @item unspecified
  10841. @item 170m
  10842. @item 240m
  10843. @item 2020
  10844. @end table
  10845. Default is same as input.
  10846. @item transferin, tin
  10847. Set the input transfer characteristics.
  10848. Possible values are:
  10849. @table @var
  10850. @item input
  10851. @item 709
  10852. @item unspecified
  10853. @item 601
  10854. @item linear
  10855. @item 2020_10
  10856. @item 2020_12
  10857. @end table
  10858. Default is same as input.
  10859. @item matrixin, min
  10860. Set the input colorspace matrix.
  10861. Possible value are:
  10862. @table @var
  10863. @item input
  10864. @item 709
  10865. @item unspecified
  10866. @item 470bg
  10867. @item 170m
  10868. @item 2020_ncl
  10869. @item 2020_cl
  10870. @end table
  10871. @end table
  10872. The values of the @option{w} and @option{h} options are expressions
  10873. containing the following constants:
  10874. @table @var
  10875. @item in_w
  10876. @item in_h
  10877. The input width and height
  10878. @item iw
  10879. @item ih
  10880. These are the same as @var{in_w} and @var{in_h}.
  10881. @item out_w
  10882. @item out_h
  10883. The output (scaled) width and height
  10884. @item ow
  10885. @item oh
  10886. These are the same as @var{out_w} and @var{out_h}
  10887. @item a
  10888. The same as @var{iw} / @var{ih}
  10889. @item sar
  10890. input sample aspect ratio
  10891. @item dar
  10892. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10893. @item hsub
  10894. @item vsub
  10895. horizontal and vertical input chroma subsample values. For example for the
  10896. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10897. @item ohsub
  10898. @item ovsub
  10899. horizontal and vertical output chroma subsample values. For example for the
  10900. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10901. @end table
  10902. @table @option
  10903. @end table
  10904. @c man end VIDEO FILTERS
  10905. @chapter Video Sources
  10906. @c man begin VIDEO SOURCES
  10907. Below is a description of the currently available video sources.
  10908. @section buffer
  10909. Buffer video frames, and make them available to the filter chain.
  10910. This source is mainly intended for a programmatic use, in particular
  10911. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  10912. It accepts the following parameters:
  10913. @table @option
  10914. @item video_size
  10915. Specify the size (width and height) of the buffered video frames. For the
  10916. syntax of this option, check the
  10917. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10918. @item width
  10919. The input video width.
  10920. @item height
  10921. The input video height.
  10922. @item pix_fmt
  10923. A string representing the pixel format of the buffered video frames.
  10924. It may be a number corresponding to a pixel format, or a pixel format
  10925. name.
  10926. @item time_base
  10927. Specify the timebase assumed by the timestamps of the buffered frames.
  10928. @item frame_rate
  10929. Specify the frame rate expected for the video stream.
  10930. @item pixel_aspect, sar
  10931. The sample (pixel) aspect ratio of the input video.
  10932. @item sws_param
  10933. Specify the optional parameters to be used for the scale filter which
  10934. is automatically inserted when an input change is detected in the
  10935. input size or format.
  10936. @item hw_frames_ctx
  10937. When using a hardware pixel format, this should be a reference to an
  10938. AVHWFramesContext describing input frames.
  10939. @end table
  10940. For example:
  10941. @example
  10942. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  10943. @end example
  10944. will instruct the source to accept video frames with size 320x240 and
  10945. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  10946. square pixels (1:1 sample aspect ratio).
  10947. Since the pixel format with name "yuv410p" corresponds to the number 6
  10948. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  10949. this example corresponds to:
  10950. @example
  10951. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  10952. @end example
  10953. Alternatively, the options can be specified as a flat string, but this
  10954. syntax is deprecated:
  10955. @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}]
  10956. @section cellauto
  10957. Create a pattern generated by an elementary cellular automaton.
  10958. The initial state of the cellular automaton can be defined through the
  10959. @option{filename}, and @option{pattern} options. If such options are
  10960. not specified an initial state is created randomly.
  10961. At each new frame a new row in the video is filled with the result of
  10962. the cellular automaton next generation. The behavior when the whole
  10963. frame is filled is defined by the @option{scroll} option.
  10964. This source accepts the following options:
  10965. @table @option
  10966. @item filename, f
  10967. Read the initial cellular automaton state, i.e. the starting row, from
  10968. the specified file.
  10969. In the file, each non-whitespace character is considered an alive
  10970. cell, a newline will terminate the row, and further characters in the
  10971. file will be ignored.
  10972. @item pattern, p
  10973. Read the initial cellular automaton state, i.e. the starting row, from
  10974. the specified string.
  10975. Each non-whitespace character in the string is considered an alive
  10976. cell, a newline will terminate the row, and further characters in the
  10977. string will be ignored.
  10978. @item rate, r
  10979. Set the video rate, that is the number of frames generated per second.
  10980. Default is 25.
  10981. @item random_fill_ratio, ratio
  10982. Set the random fill ratio for the initial cellular automaton row. It
  10983. is a floating point number value ranging from 0 to 1, defaults to
  10984. 1/PHI.
  10985. This option is ignored when a file or a pattern is specified.
  10986. @item random_seed, seed
  10987. Set the seed for filling randomly the initial row, must be an integer
  10988. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10989. set to -1, the filter will try to use a good random seed on a best
  10990. effort basis.
  10991. @item rule
  10992. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  10993. Default value is 110.
  10994. @item size, s
  10995. Set the size of the output video. For the syntax of this option, check the
  10996. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10997. If @option{filename} or @option{pattern} is specified, the size is set
  10998. by default to the width of the specified initial state row, and the
  10999. height is set to @var{width} * PHI.
  11000. If @option{size} is set, it must contain the width of the specified
  11001. pattern string, and the specified pattern will be centered in the
  11002. larger row.
  11003. If a filename or a pattern string is not specified, the size value
  11004. defaults to "320x518" (used for a randomly generated initial state).
  11005. @item scroll
  11006. If set to 1, scroll the output upward when all the rows in the output
  11007. have been already filled. If set to 0, the new generated row will be
  11008. written over the top row just after the bottom row is filled.
  11009. Defaults to 1.
  11010. @item start_full, full
  11011. If set to 1, completely fill the output with generated rows before
  11012. outputting the first frame.
  11013. This is the default behavior, for disabling set the value to 0.
  11014. @item stitch
  11015. If set to 1, stitch the left and right row edges together.
  11016. This is the default behavior, for disabling set the value to 0.
  11017. @end table
  11018. @subsection Examples
  11019. @itemize
  11020. @item
  11021. Read the initial state from @file{pattern}, and specify an output of
  11022. size 200x400.
  11023. @example
  11024. cellauto=f=pattern:s=200x400
  11025. @end example
  11026. @item
  11027. Generate a random initial row with a width of 200 cells, with a fill
  11028. ratio of 2/3:
  11029. @example
  11030. cellauto=ratio=2/3:s=200x200
  11031. @end example
  11032. @item
  11033. Create a pattern generated by rule 18 starting by a single alive cell
  11034. centered on an initial row with width 100:
  11035. @example
  11036. cellauto=p=@@:s=100x400:full=0:rule=18
  11037. @end example
  11038. @item
  11039. Specify a more elaborated initial pattern:
  11040. @example
  11041. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11042. @end example
  11043. @end itemize
  11044. @anchor{coreimagesrc}
  11045. @section coreimagesrc
  11046. Video source generated on GPU using Apple's CoreImage API on OSX.
  11047. This video source is a specialized version of the @ref{coreimage} video filter.
  11048. Use a core image generator at the beginning of the applied filterchain to
  11049. generate the content.
  11050. The coreimagesrc video source accepts the following options:
  11051. @table @option
  11052. @item list_generators
  11053. List all available generators along with all their respective options as well as
  11054. possible minimum and maximum values along with the default values.
  11055. @example
  11056. list_generators=true
  11057. @end example
  11058. @item size, s
  11059. Specify the size of the sourced video. For the syntax of this option, check the
  11060. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11061. The default value is @code{320x240}.
  11062. @item rate, r
  11063. Specify the frame rate of the sourced video, as the number of frames
  11064. generated per second. It has to be a string in the format
  11065. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11066. number or a valid video frame rate abbreviation. The default value is
  11067. "25".
  11068. @item sar
  11069. Set the sample aspect ratio of the sourced video.
  11070. @item duration, d
  11071. Set the duration of the sourced video. See
  11072. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11073. for the accepted syntax.
  11074. If not specified, or the expressed duration is negative, the video is
  11075. supposed to be generated forever.
  11076. @end table
  11077. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11078. A complete filterchain can be used for further processing of the
  11079. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11080. and examples for details.
  11081. @subsection Examples
  11082. @itemize
  11083. @item
  11084. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11085. given as complete and escaped command-line for Apple's standard bash shell:
  11086. @example
  11087. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11088. @end example
  11089. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11090. need for a nullsrc video source.
  11091. @end itemize
  11092. @section mandelbrot
  11093. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11094. point specified with @var{start_x} and @var{start_y}.
  11095. This source accepts the following options:
  11096. @table @option
  11097. @item end_pts
  11098. Set the terminal pts value. Default value is 400.
  11099. @item end_scale
  11100. Set the terminal scale value.
  11101. Must be a floating point value. Default value is 0.3.
  11102. @item inner
  11103. Set the inner coloring mode, that is the algorithm used to draw the
  11104. Mandelbrot fractal internal region.
  11105. It shall assume one of the following values:
  11106. @table @option
  11107. @item black
  11108. Set black mode.
  11109. @item convergence
  11110. Show time until convergence.
  11111. @item mincol
  11112. Set color based on point closest to the origin of the iterations.
  11113. @item period
  11114. Set period mode.
  11115. @end table
  11116. Default value is @var{mincol}.
  11117. @item bailout
  11118. Set the bailout value. Default value is 10.0.
  11119. @item maxiter
  11120. Set the maximum of iterations performed by the rendering
  11121. algorithm. Default value is 7189.
  11122. @item outer
  11123. Set outer coloring mode.
  11124. It shall assume one of following values:
  11125. @table @option
  11126. @item iteration_count
  11127. Set iteration cound mode.
  11128. @item normalized_iteration_count
  11129. set normalized iteration count mode.
  11130. @end table
  11131. Default value is @var{normalized_iteration_count}.
  11132. @item rate, r
  11133. Set frame rate, expressed as number of frames per second. Default
  11134. value is "25".
  11135. @item size, s
  11136. Set frame size. For the syntax of this option, check the "Video
  11137. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11138. @item start_scale
  11139. Set the initial scale value. Default value is 3.0.
  11140. @item start_x
  11141. Set the initial x position. Must be a floating point value between
  11142. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11143. @item start_y
  11144. Set the initial y position. Must be a floating point value between
  11145. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11146. @end table
  11147. @section mptestsrc
  11148. Generate various test patterns, as generated by the MPlayer test filter.
  11149. The size of the generated video is fixed, and is 256x256.
  11150. This source is useful in particular for testing encoding features.
  11151. This source accepts the following options:
  11152. @table @option
  11153. @item rate, r
  11154. Specify the frame rate of the sourced video, as the number of frames
  11155. generated per second. It has to be a string in the format
  11156. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11157. number or a valid video frame rate abbreviation. The default value is
  11158. "25".
  11159. @item duration, d
  11160. Set the duration of the sourced video. See
  11161. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11162. for the accepted syntax.
  11163. If not specified, or the expressed duration is negative, the video is
  11164. supposed to be generated forever.
  11165. @item test, t
  11166. Set the number or the name of the test to perform. Supported tests are:
  11167. @table @option
  11168. @item dc_luma
  11169. @item dc_chroma
  11170. @item freq_luma
  11171. @item freq_chroma
  11172. @item amp_luma
  11173. @item amp_chroma
  11174. @item cbp
  11175. @item mv
  11176. @item ring1
  11177. @item ring2
  11178. @item all
  11179. @end table
  11180. Default value is "all", which will cycle through the list of all tests.
  11181. @end table
  11182. Some examples:
  11183. @example
  11184. mptestsrc=t=dc_luma
  11185. @end example
  11186. will generate a "dc_luma" test pattern.
  11187. @section frei0r_src
  11188. Provide a frei0r source.
  11189. To enable compilation of this filter you need to install the frei0r
  11190. header and configure FFmpeg with @code{--enable-frei0r}.
  11191. This source accepts the following parameters:
  11192. @table @option
  11193. @item size
  11194. The size of the video to generate. For the syntax of this option, check the
  11195. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11196. @item framerate
  11197. The framerate of the generated video. It may be a string of the form
  11198. @var{num}/@var{den} or a frame rate abbreviation.
  11199. @item filter_name
  11200. The name to the frei0r source to load. For more information regarding frei0r and
  11201. how to set the parameters, read the @ref{frei0r} section in the video filters
  11202. documentation.
  11203. @item filter_params
  11204. A '|'-separated list of parameters to pass to the frei0r source.
  11205. @end table
  11206. For example, to generate a frei0r partik0l source with size 200x200
  11207. and frame rate 10 which is overlaid on the overlay filter main input:
  11208. @example
  11209. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11210. @end example
  11211. @section life
  11212. Generate a life pattern.
  11213. This source is based on a generalization of John Conway's life game.
  11214. The sourced input represents a life grid, each pixel represents a cell
  11215. which can be in one of two possible states, alive or dead. Every cell
  11216. interacts with its eight neighbours, which are the cells that are
  11217. horizontally, vertically, or diagonally adjacent.
  11218. At each interaction the grid evolves according to the adopted rule,
  11219. which specifies the number of neighbor alive cells which will make a
  11220. cell stay alive or born. The @option{rule} option allows one to specify
  11221. the rule to adopt.
  11222. This source accepts the following options:
  11223. @table @option
  11224. @item filename, f
  11225. Set the file from which to read the initial grid state. In the file,
  11226. each non-whitespace character is considered an alive cell, and newline
  11227. is used to delimit the end of each row.
  11228. If this option is not specified, the initial grid is generated
  11229. randomly.
  11230. @item rate, r
  11231. Set the video rate, that is the number of frames generated per second.
  11232. Default is 25.
  11233. @item random_fill_ratio, ratio
  11234. Set the random fill ratio for the initial random grid. It is a
  11235. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11236. It is ignored when a file is specified.
  11237. @item random_seed, seed
  11238. Set the seed for filling the initial random grid, must be an integer
  11239. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11240. set to -1, the filter will try to use a good random seed on a best
  11241. effort basis.
  11242. @item rule
  11243. Set the life rule.
  11244. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11245. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11246. @var{NS} specifies the number of alive neighbor cells which make a
  11247. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11248. which make a dead cell to become alive (i.e. to "born").
  11249. "s" and "b" can be used in place of "S" and "B", respectively.
  11250. Alternatively a rule can be specified by an 18-bits integer. The 9
  11251. high order bits are used to encode the next cell state if it is alive
  11252. for each number of neighbor alive cells, the low order bits specify
  11253. the rule for "borning" new cells. Higher order bits encode for an
  11254. higher number of neighbor cells.
  11255. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11256. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11257. Default value is "S23/B3", which is the original Conway's game of life
  11258. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11259. cells, and will born a new cell if there are three alive cells around
  11260. a dead cell.
  11261. @item size, s
  11262. Set the size of the output video. For the syntax of this option, check the
  11263. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11264. If @option{filename} is specified, the size is set by default to the
  11265. same size of the input file. If @option{size} is set, it must contain
  11266. the size specified in the input file, and the initial grid defined in
  11267. that file is centered in the larger resulting area.
  11268. If a filename is not specified, the size value defaults to "320x240"
  11269. (used for a randomly generated initial grid).
  11270. @item stitch
  11271. If set to 1, stitch the left and right grid edges together, and the
  11272. top and bottom edges also. Defaults to 1.
  11273. @item mold
  11274. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11275. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11276. value from 0 to 255.
  11277. @item life_color
  11278. Set the color of living (or new born) cells.
  11279. @item death_color
  11280. Set the color of dead cells. If @option{mold} is set, this is the first color
  11281. used to represent a dead cell.
  11282. @item mold_color
  11283. Set mold color, for definitely dead and moldy cells.
  11284. For the syntax of these 3 color options, check the "Color" section in the
  11285. ffmpeg-utils manual.
  11286. @end table
  11287. @subsection Examples
  11288. @itemize
  11289. @item
  11290. Read a grid from @file{pattern}, and center it on a grid of size
  11291. 300x300 pixels:
  11292. @example
  11293. life=f=pattern:s=300x300
  11294. @end example
  11295. @item
  11296. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11297. @example
  11298. life=ratio=2/3:s=200x200
  11299. @end example
  11300. @item
  11301. Specify a custom rule for evolving a randomly generated grid:
  11302. @example
  11303. life=rule=S14/B34
  11304. @end example
  11305. @item
  11306. Full example with slow death effect (mold) using @command{ffplay}:
  11307. @example
  11308. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11309. @end example
  11310. @end itemize
  11311. @anchor{allrgb}
  11312. @anchor{allyuv}
  11313. @anchor{color}
  11314. @anchor{haldclutsrc}
  11315. @anchor{nullsrc}
  11316. @anchor{rgbtestsrc}
  11317. @anchor{smptebars}
  11318. @anchor{smptehdbars}
  11319. @anchor{testsrc}
  11320. @anchor{testsrc2}
  11321. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2
  11322. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11323. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11324. The @code{color} source provides an uniformly colored input.
  11325. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11326. @ref{haldclut} filter.
  11327. The @code{nullsrc} source returns unprocessed video frames. It is
  11328. mainly useful to be employed in analysis / debugging tools, or as the
  11329. source for filters which ignore the input data.
  11330. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11331. detecting RGB vs BGR issues. You should see a red, green and blue
  11332. stripe from top to bottom.
  11333. The @code{smptebars} source generates a color bars pattern, based on
  11334. the SMPTE Engineering Guideline EG 1-1990.
  11335. The @code{smptehdbars} source generates a color bars pattern, based on
  11336. the SMPTE RP 219-2002.
  11337. The @code{testsrc} source generates a test video pattern, showing a
  11338. color pattern, a scrolling gradient and a timestamp. This is mainly
  11339. intended for testing purposes.
  11340. The @code{testsrc2} source is similar to testsrc, but supports more
  11341. pixel formats instead of just @code{rgb24}. This allows using it as an
  11342. input for other tests without requiring a format conversion.
  11343. The sources accept the following parameters:
  11344. @table @option
  11345. @item color, c
  11346. Specify the color of the source, only available in the @code{color}
  11347. source. For the syntax of this option, check the "Color" section in the
  11348. ffmpeg-utils manual.
  11349. @item level
  11350. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11351. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11352. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11353. coded on a @code{1/(N*N)} scale.
  11354. @item size, s
  11355. Specify the size of the sourced video. For the syntax of this option, check the
  11356. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11357. The default value is @code{320x240}.
  11358. This option is not available with the @code{haldclutsrc} filter.
  11359. @item rate, r
  11360. Specify the frame rate of the sourced video, as the number of frames
  11361. generated per second. It has to be a string in the format
  11362. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11363. number or a valid video frame rate abbreviation. The default value is
  11364. "25".
  11365. @item sar
  11366. Set the sample aspect ratio of the sourced video.
  11367. @item duration, d
  11368. Set the duration of the sourced video. See
  11369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11370. for the accepted syntax.
  11371. If not specified, or the expressed duration is negative, the video is
  11372. supposed to be generated forever.
  11373. @item decimals, n
  11374. Set the number of decimals to show in the timestamp, only available in the
  11375. @code{testsrc} source.
  11376. The displayed timestamp value will correspond to the original
  11377. timestamp value multiplied by the power of 10 of the specified
  11378. value. Default value is 0.
  11379. @end table
  11380. For example the following:
  11381. @example
  11382. testsrc=duration=5.3:size=qcif:rate=10
  11383. @end example
  11384. will generate a video with a duration of 5.3 seconds, with size
  11385. 176x144 and a frame rate of 10 frames per second.
  11386. The following graph description will generate a red source
  11387. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11388. frames per second.
  11389. @example
  11390. color=c=red@@0.2:s=qcif:r=10
  11391. @end example
  11392. If the input content is to be ignored, @code{nullsrc} can be used. The
  11393. following command generates noise in the luminance plane by employing
  11394. the @code{geq} filter:
  11395. @example
  11396. nullsrc=s=256x256, geq=random(1)*255:128:128
  11397. @end example
  11398. @subsection Commands
  11399. The @code{color} source supports the following commands:
  11400. @table @option
  11401. @item c, color
  11402. Set the color of the created image. Accepts the same syntax of the
  11403. corresponding @option{color} option.
  11404. @end table
  11405. @c man end VIDEO SOURCES
  11406. @chapter Video Sinks
  11407. @c man begin VIDEO SINKS
  11408. Below is a description of the currently available video sinks.
  11409. @section buffersink
  11410. Buffer video frames, and make them available to the end of the filter
  11411. graph.
  11412. This sink is mainly intended for programmatic use, in particular
  11413. through the interface defined in @file{libavfilter/buffersink.h}
  11414. or the options system.
  11415. It accepts a pointer to an AVBufferSinkContext structure, which
  11416. defines the incoming buffers' formats, to be passed as the opaque
  11417. parameter to @code{avfilter_init_filter} for initialization.
  11418. @section nullsink
  11419. Null video sink: do absolutely nothing with the input video. It is
  11420. mainly useful as a template and for use in analysis / debugging
  11421. tools.
  11422. @c man end VIDEO SINKS
  11423. @chapter Multimedia Filters
  11424. @c man begin MULTIMEDIA FILTERS
  11425. Below is a description of the currently available multimedia filters.
  11426. @section ahistogram
  11427. Convert input audio to a video output, displaying the volume histogram.
  11428. The filter accepts the following options:
  11429. @table @option
  11430. @item dmode
  11431. Specify how histogram is calculated.
  11432. It accepts the following values:
  11433. @table @samp
  11434. @item single
  11435. Use single histogram for all channels.
  11436. @item separate
  11437. Use separate histogram for each channel.
  11438. @end table
  11439. Default is @code{single}.
  11440. @item rate, r
  11441. Set frame rate, expressed as number of frames per second. Default
  11442. value is "25".
  11443. @item size, s
  11444. Specify the video size for the output. For the syntax of this option, check the
  11445. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11446. Default value is @code{hd720}.
  11447. @item scale
  11448. Set display scale.
  11449. It accepts the following values:
  11450. @table @samp
  11451. @item log
  11452. logarithmic
  11453. @item sqrt
  11454. square root
  11455. @item cbrt
  11456. cubic root
  11457. @item lin
  11458. linear
  11459. @item rlog
  11460. reverse logarithmic
  11461. @end table
  11462. Default is @code{log}.
  11463. @item ascale
  11464. Set amplitude scale.
  11465. It accepts the following values:
  11466. @table @samp
  11467. @item log
  11468. logarithmic
  11469. @item lin
  11470. linear
  11471. @end table
  11472. Default is @code{log}.
  11473. @item acount
  11474. Set how much frames to accumulate in histogram.
  11475. Defauls is 1. Setting this to -1 accumulates all frames.
  11476. @item rheight
  11477. Set histogram ratio of window height.
  11478. @item slide
  11479. Set sonogram sliding.
  11480. It accepts the following values:
  11481. @table @samp
  11482. @item replace
  11483. replace old rows with new ones.
  11484. @item scroll
  11485. scroll from top to bottom.
  11486. @end table
  11487. Default is @code{replace}.
  11488. @end table
  11489. @section aphasemeter
  11490. Convert input audio to a video output, displaying the audio phase.
  11491. The filter accepts the following options:
  11492. @table @option
  11493. @item rate, r
  11494. Set the output frame rate. Default value is @code{25}.
  11495. @item size, s
  11496. Set the video size for the output. For the syntax of this option, check the
  11497. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11498. Default value is @code{800x400}.
  11499. @item rc
  11500. @item gc
  11501. @item bc
  11502. Specify the red, green, blue contrast. Default values are @code{2},
  11503. @code{7} and @code{1}.
  11504. Allowed range is @code{[0, 255]}.
  11505. @item mpc
  11506. Set color which will be used for drawing median phase. If color is
  11507. @code{none} which is default, no median phase value will be drawn.
  11508. @end table
  11509. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  11510. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  11511. The @code{-1} means left and right channels are completely out of phase and
  11512. @code{1} means channels are in phase.
  11513. @section avectorscope
  11514. Convert input audio to a video output, representing the audio vector
  11515. scope.
  11516. The filter is used to measure the difference between channels of stereo
  11517. audio stream. A monoaural signal, consisting of identical left and right
  11518. signal, results in straight vertical line. Any stereo separation is visible
  11519. as a deviation from this line, creating a Lissajous figure.
  11520. If the straight (or deviation from it) but horizontal line appears this
  11521. indicates that the left and right channels are out of phase.
  11522. The filter accepts the following options:
  11523. @table @option
  11524. @item mode, m
  11525. Set the vectorscope mode.
  11526. Available values are:
  11527. @table @samp
  11528. @item lissajous
  11529. Lissajous rotated by 45 degrees.
  11530. @item lissajous_xy
  11531. Same as above but not rotated.
  11532. @item polar
  11533. Shape resembling half of circle.
  11534. @end table
  11535. Default value is @samp{lissajous}.
  11536. @item size, s
  11537. Set the video size for the output. For the syntax of this option, check the
  11538. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11539. Default value is @code{400x400}.
  11540. @item rate, r
  11541. Set the output frame rate. Default value is @code{25}.
  11542. @item rc
  11543. @item gc
  11544. @item bc
  11545. @item ac
  11546. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  11547. @code{160}, @code{80} and @code{255}.
  11548. Allowed range is @code{[0, 255]}.
  11549. @item rf
  11550. @item gf
  11551. @item bf
  11552. @item af
  11553. Specify the red, green, blue and alpha fade. Default values are @code{15},
  11554. @code{10}, @code{5} and @code{5}.
  11555. Allowed range is @code{[0, 255]}.
  11556. @item zoom
  11557. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  11558. @item draw
  11559. Set the vectorscope drawing mode.
  11560. Available values are:
  11561. @table @samp
  11562. @item dot
  11563. Draw dot for each sample.
  11564. @item line
  11565. Draw line between previous and current sample.
  11566. @end table
  11567. Default value is @samp{dot}.
  11568. @end table
  11569. @subsection Examples
  11570. @itemize
  11571. @item
  11572. Complete example using @command{ffplay}:
  11573. @example
  11574. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11575. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  11576. @end example
  11577. @end itemize
  11578. @section bench, abench
  11579. Benchmark part of a filtergraph.
  11580. The filter accepts the following options:
  11581. @table @option
  11582. @item action
  11583. Start or stop a timer.
  11584. Available values are:
  11585. @table @samp
  11586. @item start
  11587. Get the current time, set it as frame metadata (using the key
  11588. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  11589. @item stop
  11590. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  11591. the input frame metadata to get the time difference. Time difference, average,
  11592. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  11593. @code{min}) are then printed. The timestamps are expressed in seconds.
  11594. @end table
  11595. @end table
  11596. @subsection Examples
  11597. @itemize
  11598. @item
  11599. Benchmark @ref{selectivecolor} filter:
  11600. @example
  11601. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  11602. @end example
  11603. @end itemize
  11604. @section concat
  11605. Concatenate audio and video streams, joining them together one after the
  11606. other.
  11607. The filter works on segments of synchronized video and audio streams. All
  11608. segments must have the same number of streams of each type, and that will
  11609. also be the number of streams at output.
  11610. The filter accepts the following options:
  11611. @table @option
  11612. @item n
  11613. Set the number of segments. Default is 2.
  11614. @item v
  11615. Set the number of output video streams, that is also the number of video
  11616. streams in each segment. Default is 1.
  11617. @item a
  11618. Set the number of output audio streams, that is also the number of audio
  11619. streams in each segment. Default is 0.
  11620. @item unsafe
  11621. Activate unsafe mode: do not fail if segments have a different format.
  11622. @end table
  11623. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  11624. @var{a} audio outputs.
  11625. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  11626. segment, in the same order as the outputs, then the inputs for the second
  11627. segment, etc.
  11628. Related streams do not always have exactly the same duration, for various
  11629. reasons including codec frame size or sloppy authoring. For that reason,
  11630. related synchronized streams (e.g. a video and its audio track) should be
  11631. concatenated at once. The concat filter will use the duration of the longest
  11632. stream in each segment (except the last one), and if necessary pad shorter
  11633. audio streams with silence.
  11634. For this filter to work correctly, all segments must start at timestamp 0.
  11635. All corresponding streams must have the same parameters in all segments; the
  11636. filtering system will automatically select a common pixel format for video
  11637. streams, and a common sample format, sample rate and channel layout for
  11638. audio streams, but other settings, such as resolution, must be converted
  11639. explicitly by the user.
  11640. Different frame rates are acceptable but will result in variable frame rate
  11641. at output; be sure to configure the output file to handle it.
  11642. @subsection Examples
  11643. @itemize
  11644. @item
  11645. Concatenate an opening, an episode and an ending, all in bilingual version
  11646. (video in stream 0, audio in streams 1 and 2):
  11647. @example
  11648. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  11649. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  11650. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  11651. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  11652. @end example
  11653. @item
  11654. Concatenate two parts, handling audio and video separately, using the
  11655. (a)movie sources, and adjusting the resolution:
  11656. @example
  11657. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  11658. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  11659. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  11660. @end example
  11661. Note that a desync will happen at the stitch if the audio and video streams
  11662. do not have exactly the same duration in the first file.
  11663. @end itemize
  11664. @anchor{ebur128}
  11665. @section ebur128
  11666. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  11667. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  11668. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  11669. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  11670. The filter also has a video output (see the @var{video} option) with a real
  11671. time graph to observe the loudness evolution. The graphic contains the logged
  11672. message mentioned above, so it is not printed anymore when this option is set,
  11673. unless the verbose logging is set. The main graphing area contains the
  11674. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  11675. the momentary loudness (400 milliseconds).
  11676. More information about the Loudness Recommendation EBU R128 on
  11677. @url{http://tech.ebu.ch/loudness}.
  11678. The filter accepts the following options:
  11679. @table @option
  11680. @item video
  11681. Activate the video output. The audio stream is passed unchanged whether this
  11682. option is set or no. The video stream will be the first output stream if
  11683. activated. Default is @code{0}.
  11684. @item size
  11685. Set the video size. This option is for video only. For the syntax of this
  11686. option, check the
  11687. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11688. Default and minimum resolution is @code{640x480}.
  11689. @item meter
  11690. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  11691. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  11692. other integer value between this range is allowed.
  11693. @item metadata
  11694. Set metadata injection. If set to @code{1}, the audio input will be segmented
  11695. into 100ms output frames, each of them containing various loudness information
  11696. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  11697. Default is @code{0}.
  11698. @item framelog
  11699. Force the frame logging level.
  11700. Available values are:
  11701. @table @samp
  11702. @item info
  11703. information logging level
  11704. @item verbose
  11705. verbose logging level
  11706. @end table
  11707. By default, the logging level is set to @var{info}. If the @option{video} or
  11708. the @option{metadata} options are set, it switches to @var{verbose}.
  11709. @item peak
  11710. Set peak mode(s).
  11711. Available modes can be cumulated (the option is a @code{flag} type). Possible
  11712. values are:
  11713. @table @samp
  11714. @item none
  11715. Disable any peak mode (default).
  11716. @item sample
  11717. Enable sample-peak mode.
  11718. Simple peak mode looking for the higher sample value. It logs a message
  11719. for sample-peak (identified by @code{SPK}).
  11720. @item true
  11721. Enable true-peak mode.
  11722. If enabled, the peak lookup is done on an over-sampled version of the input
  11723. stream for better peak accuracy. It logs a message for true-peak.
  11724. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  11725. This mode requires a build with @code{libswresample}.
  11726. @end table
  11727. @item dualmono
  11728. Treat mono input files as "dual mono". If a mono file is intended for playback
  11729. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  11730. If set to @code{true}, this option will compensate for this effect.
  11731. Multi-channel input files are not affected by this option.
  11732. @item panlaw
  11733. Set a specific pan law to be used for the measurement of dual mono files.
  11734. This parameter is optional, and has a default value of -3.01dB.
  11735. @end table
  11736. @subsection Examples
  11737. @itemize
  11738. @item
  11739. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  11740. @example
  11741. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  11742. @end example
  11743. @item
  11744. Run an analysis with @command{ffmpeg}:
  11745. @example
  11746. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  11747. @end example
  11748. @end itemize
  11749. @section interleave, ainterleave
  11750. Temporally interleave frames from several inputs.
  11751. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  11752. These filters read frames from several inputs and send the oldest
  11753. queued frame to the output.
  11754. Input streams must have a well defined, monotonically increasing frame
  11755. timestamp values.
  11756. In order to submit one frame to output, these filters need to enqueue
  11757. at least one frame for each input, so they cannot work in case one
  11758. input is not yet terminated and will not receive incoming frames.
  11759. For example consider the case when one input is a @code{select} filter
  11760. which always drop input frames. The @code{interleave} filter will keep
  11761. reading from that input, but it will never be able to send new frames
  11762. to output until the input will send an end-of-stream signal.
  11763. Also, depending on inputs synchronization, the filters will drop
  11764. frames in case one input receives more frames than the other ones, and
  11765. the queue is already filled.
  11766. These filters accept the following options:
  11767. @table @option
  11768. @item nb_inputs, n
  11769. Set the number of different inputs, it is 2 by default.
  11770. @end table
  11771. @subsection Examples
  11772. @itemize
  11773. @item
  11774. Interleave frames belonging to different streams using @command{ffmpeg}:
  11775. @example
  11776. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  11777. @end example
  11778. @item
  11779. Add flickering blur effect:
  11780. @example
  11781. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  11782. @end example
  11783. @end itemize
  11784. @section perms, aperms
  11785. Set read/write permissions for the output frames.
  11786. These filters are mainly aimed at developers to test direct path in the
  11787. following filter in the filtergraph.
  11788. The filters accept the following options:
  11789. @table @option
  11790. @item mode
  11791. Select the permissions mode.
  11792. It accepts the following values:
  11793. @table @samp
  11794. @item none
  11795. Do nothing. This is the default.
  11796. @item ro
  11797. Set all the output frames read-only.
  11798. @item rw
  11799. Set all the output frames directly writable.
  11800. @item toggle
  11801. Make the frame read-only if writable, and writable if read-only.
  11802. @item random
  11803. Set each output frame read-only or writable randomly.
  11804. @end table
  11805. @item seed
  11806. Set the seed for the @var{random} mode, must be an integer included between
  11807. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11808. @code{-1}, the filter will try to use a good random seed on a best effort
  11809. basis.
  11810. @end table
  11811. Note: in case of auto-inserted filter between the permission filter and the
  11812. following one, the permission might not be received as expected in that
  11813. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  11814. perms/aperms filter can avoid this problem.
  11815. @section realtime, arealtime
  11816. Slow down filtering to match real time approximatively.
  11817. These filters will pause the filtering for a variable amount of time to
  11818. match the output rate with the input timestamps.
  11819. They are similar to the @option{re} option to @code{ffmpeg}.
  11820. They accept the following options:
  11821. @table @option
  11822. @item limit
  11823. Time limit for the pauses. Any pause longer than that will be considered
  11824. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  11825. @end table
  11826. @section select, aselect
  11827. Select frames to pass in output.
  11828. This filter accepts the following options:
  11829. @table @option
  11830. @item expr, e
  11831. Set expression, which is evaluated for each input frame.
  11832. If the expression is evaluated to zero, the frame is discarded.
  11833. If the evaluation result is negative or NaN, the frame is sent to the
  11834. first output; otherwise it is sent to the output with index
  11835. @code{ceil(val)-1}, assuming that the input index starts from 0.
  11836. For example a value of @code{1.2} corresponds to the output with index
  11837. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  11838. @item outputs, n
  11839. Set the number of outputs. The output to which to send the selected
  11840. frame is based on the result of the evaluation. Default value is 1.
  11841. @end table
  11842. The expression can contain the following constants:
  11843. @table @option
  11844. @item n
  11845. The (sequential) number of the filtered frame, starting from 0.
  11846. @item selected_n
  11847. The (sequential) number of the selected frame, starting from 0.
  11848. @item prev_selected_n
  11849. The sequential number of the last selected frame. It's NAN if undefined.
  11850. @item TB
  11851. The timebase of the input timestamps.
  11852. @item pts
  11853. The PTS (Presentation TimeStamp) of the filtered video frame,
  11854. expressed in @var{TB} units. It's NAN if undefined.
  11855. @item t
  11856. The PTS of the filtered video frame,
  11857. expressed in seconds. It's NAN if undefined.
  11858. @item prev_pts
  11859. The PTS of the previously filtered video frame. It's NAN if undefined.
  11860. @item prev_selected_pts
  11861. The PTS of the last previously filtered video frame. It's NAN if undefined.
  11862. @item prev_selected_t
  11863. The PTS of the last previously selected video frame. It's NAN if undefined.
  11864. @item start_pts
  11865. The PTS of the first video frame in the video. It's NAN if undefined.
  11866. @item start_t
  11867. The time of the first video frame in the video. It's NAN if undefined.
  11868. @item pict_type @emph{(video only)}
  11869. The type of the filtered frame. It can assume one of the following
  11870. values:
  11871. @table @option
  11872. @item I
  11873. @item P
  11874. @item B
  11875. @item S
  11876. @item SI
  11877. @item SP
  11878. @item BI
  11879. @end table
  11880. @item interlace_type @emph{(video only)}
  11881. The frame interlace type. It can assume one of the following values:
  11882. @table @option
  11883. @item PROGRESSIVE
  11884. The frame is progressive (not interlaced).
  11885. @item TOPFIRST
  11886. The frame is top-field-first.
  11887. @item BOTTOMFIRST
  11888. The frame is bottom-field-first.
  11889. @end table
  11890. @item consumed_sample_n @emph{(audio only)}
  11891. the number of selected samples before the current frame
  11892. @item samples_n @emph{(audio only)}
  11893. the number of samples in the current frame
  11894. @item sample_rate @emph{(audio only)}
  11895. the input sample rate
  11896. @item key
  11897. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  11898. @item pos
  11899. the position in the file of the filtered frame, -1 if the information
  11900. is not available (e.g. for synthetic video)
  11901. @item scene @emph{(video only)}
  11902. value between 0 and 1 to indicate a new scene; a low value reflects a low
  11903. probability for the current frame to introduce a new scene, while a higher
  11904. value means the current frame is more likely to be one (see the example below)
  11905. @item concatdec_select
  11906. The concat demuxer can select only part of a concat input file by setting an
  11907. inpoint and an outpoint, but the output packets may not be entirely contained
  11908. in the selected interval. By using this variable, it is possible to skip frames
  11909. generated by the concat demuxer which are not exactly contained in the selected
  11910. interval.
  11911. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  11912. and the @var{lavf.concat.duration} packet metadata values which are also
  11913. present in the decoded frames.
  11914. The @var{concatdec_select} variable is -1 if the frame pts is at least
  11915. start_time and either the duration metadata is missing or the frame pts is less
  11916. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  11917. missing.
  11918. That basically means that an input frame is selected if its pts is within the
  11919. interval set by the concat demuxer.
  11920. @end table
  11921. The default value of the select expression is "1".
  11922. @subsection Examples
  11923. @itemize
  11924. @item
  11925. Select all frames in input:
  11926. @example
  11927. select
  11928. @end example
  11929. The example above is the same as:
  11930. @example
  11931. select=1
  11932. @end example
  11933. @item
  11934. Skip all frames:
  11935. @example
  11936. select=0
  11937. @end example
  11938. @item
  11939. Select only I-frames:
  11940. @example
  11941. select='eq(pict_type\,I)'
  11942. @end example
  11943. @item
  11944. Select one frame every 100:
  11945. @example
  11946. select='not(mod(n\,100))'
  11947. @end example
  11948. @item
  11949. Select only frames contained in the 10-20 time interval:
  11950. @example
  11951. select=between(t\,10\,20)
  11952. @end example
  11953. @item
  11954. Select only I-frames contained in the 10-20 time interval:
  11955. @example
  11956. select=between(t\,10\,20)*eq(pict_type\,I)
  11957. @end example
  11958. @item
  11959. Select frames with a minimum distance of 10 seconds:
  11960. @example
  11961. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  11962. @end example
  11963. @item
  11964. Use aselect to select only audio frames with samples number > 100:
  11965. @example
  11966. aselect='gt(samples_n\,100)'
  11967. @end example
  11968. @item
  11969. Create a mosaic of the first scenes:
  11970. @example
  11971. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  11972. @end example
  11973. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  11974. choice.
  11975. @item
  11976. Send even and odd frames to separate outputs, and compose them:
  11977. @example
  11978. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  11979. @end example
  11980. @item
  11981. Select useful frames from an ffconcat file which is using inpoints and
  11982. outpoints but where the source files are not intra frame only.
  11983. @example
  11984. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  11985. @end example
  11986. @end itemize
  11987. @section sendcmd, asendcmd
  11988. Send commands to filters in the filtergraph.
  11989. These filters read commands to be sent to other filters in the
  11990. filtergraph.
  11991. @code{sendcmd} must be inserted between two video filters,
  11992. @code{asendcmd} must be inserted between two audio filters, but apart
  11993. from that they act the same way.
  11994. The specification of commands can be provided in the filter arguments
  11995. with the @var{commands} option, or in a file specified by the
  11996. @var{filename} option.
  11997. These filters accept the following options:
  11998. @table @option
  11999. @item commands, c
  12000. Set the commands to be read and sent to the other filters.
  12001. @item filename, f
  12002. Set the filename of the commands to be read and sent to the other
  12003. filters.
  12004. @end table
  12005. @subsection Commands syntax
  12006. A commands description consists of a sequence of interval
  12007. specifications, comprising a list of commands to be executed when a
  12008. particular event related to that interval occurs. The occurring event
  12009. is typically the current frame time entering or leaving a given time
  12010. interval.
  12011. An interval is specified by the following syntax:
  12012. @example
  12013. @var{START}[-@var{END}] @var{COMMANDS};
  12014. @end example
  12015. The time interval is specified by the @var{START} and @var{END} times.
  12016. @var{END} is optional and defaults to the maximum time.
  12017. The current frame time is considered within the specified interval if
  12018. it is included in the interval [@var{START}, @var{END}), that is when
  12019. the time is greater or equal to @var{START} and is lesser than
  12020. @var{END}.
  12021. @var{COMMANDS} consists of a sequence of one or more command
  12022. specifications, separated by ",", relating to that interval. The
  12023. syntax of a command specification is given by:
  12024. @example
  12025. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  12026. @end example
  12027. @var{FLAGS} is optional and specifies the type of events relating to
  12028. the time interval which enable sending the specified command, and must
  12029. be a non-null sequence of identifier flags separated by "+" or "|" and
  12030. enclosed between "[" and "]".
  12031. The following flags are recognized:
  12032. @table @option
  12033. @item enter
  12034. The command is sent when the current frame timestamp enters the
  12035. specified interval. In other words, the command is sent when the
  12036. previous frame timestamp was not in the given interval, and the
  12037. current is.
  12038. @item leave
  12039. The command is sent when the current frame timestamp leaves the
  12040. specified interval. In other words, the command is sent when the
  12041. previous frame timestamp was in the given interval, and the
  12042. current is not.
  12043. @end table
  12044. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  12045. assumed.
  12046. @var{TARGET} specifies the target of the command, usually the name of
  12047. the filter class or a specific filter instance name.
  12048. @var{COMMAND} specifies the name of the command for the target filter.
  12049. @var{ARG} is optional and specifies the optional list of argument for
  12050. the given @var{COMMAND}.
  12051. Between one interval specification and another, whitespaces, or
  12052. sequences of characters starting with @code{#} until the end of line,
  12053. are ignored and can be used to annotate comments.
  12054. A simplified BNF description of the commands specification syntax
  12055. follows:
  12056. @example
  12057. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12058. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12059. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12060. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12061. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12062. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12063. @end example
  12064. @subsection Examples
  12065. @itemize
  12066. @item
  12067. Specify audio tempo change at second 4:
  12068. @example
  12069. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12070. @end example
  12071. @item
  12072. Specify a list of drawtext and hue commands in a file.
  12073. @example
  12074. # show text in the interval 5-10
  12075. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12076. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12077. # desaturate the image in the interval 15-20
  12078. 15.0-20.0 [enter] hue s 0,
  12079. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12080. [leave] hue s 1,
  12081. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12082. # apply an exponential saturation fade-out effect, starting from time 25
  12083. 25 [enter] hue s exp(25-t)
  12084. @end example
  12085. A filtergraph allowing to read and process the above command list
  12086. stored in a file @file{test.cmd}, can be specified with:
  12087. @example
  12088. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12089. @end example
  12090. @end itemize
  12091. @anchor{setpts}
  12092. @section setpts, asetpts
  12093. Change the PTS (presentation timestamp) of the input frames.
  12094. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12095. This filter accepts the following options:
  12096. @table @option
  12097. @item expr
  12098. The expression which is evaluated for each frame to construct its timestamp.
  12099. @end table
  12100. The expression is evaluated through the eval API and can contain the following
  12101. constants:
  12102. @table @option
  12103. @item FRAME_RATE
  12104. frame rate, only defined for constant frame-rate video
  12105. @item PTS
  12106. The presentation timestamp in input
  12107. @item N
  12108. The count of the input frame for video or the number of consumed samples,
  12109. not including the current frame for audio, starting from 0.
  12110. @item NB_CONSUMED_SAMPLES
  12111. The number of consumed samples, not including the current frame (only
  12112. audio)
  12113. @item NB_SAMPLES, S
  12114. The number of samples in the current frame (only audio)
  12115. @item SAMPLE_RATE, SR
  12116. The audio sample rate.
  12117. @item STARTPTS
  12118. The PTS of the first frame.
  12119. @item STARTT
  12120. the time in seconds of the first frame
  12121. @item INTERLACED
  12122. State whether the current frame is interlaced.
  12123. @item T
  12124. the time in seconds of the current frame
  12125. @item POS
  12126. original position in the file of the frame, or undefined if undefined
  12127. for the current frame
  12128. @item PREV_INPTS
  12129. The previous input PTS.
  12130. @item PREV_INT
  12131. previous input time in seconds
  12132. @item PREV_OUTPTS
  12133. The previous output PTS.
  12134. @item PREV_OUTT
  12135. previous output time in seconds
  12136. @item RTCTIME
  12137. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12138. instead.
  12139. @item RTCSTART
  12140. The wallclock (RTC) time at the start of the movie in microseconds.
  12141. @item TB
  12142. The timebase of the input timestamps.
  12143. @end table
  12144. @subsection Examples
  12145. @itemize
  12146. @item
  12147. Start counting PTS from zero
  12148. @example
  12149. setpts=PTS-STARTPTS
  12150. @end example
  12151. @item
  12152. Apply fast motion effect:
  12153. @example
  12154. setpts=0.5*PTS
  12155. @end example
  12156. @item
  12157. Apply slow motion effect:
  12158. @example
  12159. setpts=2.0*PTS
  12160. @end example
  12161. @item
  12162. Set fixed rate of 25 frames per second:
  12163. @example
  12164. setpts=N/(25*TB)
  12165. @end example
  12166. @item
  12167. Set fixed rate 25 fps with some jitter:
  12168. @example
  12169. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12170. @end example
  12171. @item
  12172. Apply an offset of 10 seconds to the input PTS:
  12173. @example
  12174. setpts=PTS+10/TB
  12175. @end example
  12176. @item
  12177. Generate timestamps from a "live source" and rebase onto the current timebase:
  12178. @example
  12179. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12180. @end example
  12181. @item
  12182. Generate timestamps by counting samples:
  12183. @example
  12184. asetpts=N/SR/TB
  12185. @end example
  12186. @end itemize
  12187. @section settb, asettb
  12188. Set the timebase to use for the output frames timestamps.
  12189. It is mainly useful for testing timebase configuration.
  12190. It accepts the following parameters:
  12191. @table @option
  12192. @item expr, tb
  12193. The expression which is evaluated into the output timebase.
  12194. @end table
  12195. The value for @option{tb} is an arithmetic expression representing a
  12196. rational. The expression can contain the constants "AVTB" (the default
  12197. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12198. audio only). Default value is "intb".
  12199. @subsection Examples
  12200. @itemize
  12201. @item
  12202. Set the timebase to 1/25:
  12203. @example
  12204. settb=expr=1/25
  12205. @end example
  12206. @item
  12207. Set the timebase to 1/10:
  12208. @example
  12209. settb=expr=0.1
  12210. @end example
  12211. @item
  12212. Set the timebase to 1001/1000:
  12213. @example
  12214. settb=1+0.001
  12215. @end example
  12216. @item
  12217. Set the timebase to 2*intb:
  12218. @example
  12219. settb=2*intb
  12220. @end example
  12221. @item
  12222. Set the default timebase value:
  12223. @example
  12224. settb=AVTB
  12225. @end example
  12226. @end itemize
  12227. @section showcqt
  12228. Convert input audio to a video output representing frequency spectrum
  12229. logarithmically using Brown-Puckette constant Q transform algorithm with
  12230. direct frequency domain coefficient calculation (but the transform itself
  12231. is not really constant Q, instead the Q factor is actually variable/clamped),
  12232. with musical tone scale, from E0 to D#10.
  12233. The filter accepts the following options:
  12234. @table @option
  12235. @item size, s
  12236. Specify the video size for the output. It must be even. For the syntax of this option,
  12237. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12238. Default value is @code{1920x1080}.
  12239. @item fps, rate, r
  12240. Set the output frame rate. Default value is @code{25}.
  12241. @item bar_h
  12242. Set the bargraph height. It must be even. Default value is @code{-1} which
  12243. computes the bargraph height automatically.
  12244. @item axis_h
  12245. Set the axis height. It must be even. Default value is @code{-1} which computes
  12246. the axis height automatically.
  12247. @item sono_h
  12248. Set the sonogram height. It must be even. Default value is @code{-1} which
  12249. computes the sonogram height automatically.
  12250. @item fullhd
  12251. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  12252. instead. Default value is @code{1}.
  12253. @item sono_v, volume
  12254. Specify the sonogram volume expression. It can contain variables:
  12255. @table @option
  12256. @item bar_v
  12257. the @var{bar_v} evaluated expression
  12258. @item frequency, freq, f
  12259. the frequency where it is evaluated
  12260. @item timeclamp, tc
  12261. the value of @var{timeclamp} option
  12262. @end table
  12263. and functions:
  12264. @table @option
  12265. @item a_weighting(f)
  12266. A-weighting of equal loudness
  12267. @item b_weighting(f)
  12268. B-weighting of equal loudness
  12269. @item c_weighting(f)
  12270. C-weighting of equal loudness.
  12271. @end table
  12272. Default value is @code{16}.
  12273. @item bar_v, volume2
  12274. Specify the bargraph volume expression. It can contain variables:
  12275. @table @option
  12276. @item sono_v
  12277. the @var{sono_v} evaluated expression
  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 a_weighting(f)
  12286. A-weighting of equal loudness
  12287. @item b_weighting(f)
  12288. B-weighting of equal loudness
  12289. @item c_weighting(f)
  12290. C-weighting of equal loudness.
  12291. @end table
  12292. Default value is @code{sono_v}.
  12293. @item sono_g, gamma
  12294. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  12295. higher gamma makes the spectrum having more range. Default value is @code{3}.
  12296. Acceptable range is @code{[1, 7]}.
  12297. @item bar_g, gamma2
  12298. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  12299. @code{[1, 7]}.
  12300. @item timeclamp, tc
  12301. Specify the transform timeclamp. At low frequency, there is trade-off between
  12302. accuracy in time domain and frequency domain. If timeclamp is lower,
  12303. event in time domain is represented more accurately (such as fast bass drum),
  12304. otherwise event in frequency domain is represented more accurately
  12305. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  12306. @item basefreq
  12307. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  12308. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  12309. @item endfreq
  12310. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  12311. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  12312. @item coeffclamp
  12313. This option is deprecated and ignored.
  12314. @item tlength
  12315. Specify the transform length in time domain. Use this option to control accuracy
  12316. trade-off between time domain and frequency domain at every frequency sample.
  12317. It can contain variables:
  12318. @table @option
  12319. @item frequency, freq, f
  12320. the frequency where it is evaluated
  12321. @item timeclamp, tc
  12322. the value of @var{timeclamp} option.
  12323. @end table
  12324. Default value is @code{384*tc/(384+tc*f)}.
  12325. @item count
  12326. Specify the transform count for every video frame. Default value is @code{6}.
  12327. Acceptable range is @code{[1, 30]}.
  12328. @item fcount
  12329. Specify the transform count for every single pixel. Default value is @code{0},
  12330. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  12331. @item fontfile
  12332. Specify font file for use with freetype to draw the axis. If not specified,
  12333. use embedded font. Note that drawing with font file or embedded font is not
  12334. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  12335. option instead.
  12336. @item fontcolor
  12337. Specify font color expression. This is arithmetic expression that should return
  12338. integer value 0xRRGGBB. It can contain variables:
  12339. @table @option
  12340. @item frequency, freq, f
  12341. the frequency where it is evaluated
  12342. @item timeclamp, tc
  12343. the value of @var{timeclamp} option
  12344. @end table
  12345. and functions:
  12346. @table @option
  12347. @item midi(f)
  12348. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  12349. @item r(x), g(x), b(x)
  12350. red, green, and blue value of intensity x.
  12351. @end table
  12352. Default value is @code{st(0, (midi(f)-59.5)/12);
  12353. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  12354. r(1-ld(1)) + b(ld(1))}.
  12355. @item axisfile
  12356. Specify image file to draw the axis. This option override @var{fontfile} and
  12357. @var{fontcolor} option.
  12358. @item axis, text
  12359. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  12360. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  12361. Default value is @code{1}.
  12362. @end table
  12363. @subsection Examples
  12364. @itemize
  12365. @item
  12366. Playing audio while showing the spectrum:
  12367. @example
  12368. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  12369. @end example
  12370. @item
  12371. Same as above, but with frame rate 30 fps:
  12372. @example
  12373. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  12374. @end example
  12375. @item
  12376. Playing at 1280x720:
  12377. @example
  12378. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  12379. @end example
  12380. @item
  12381. Disable sonogram display:
  12382. @example
  12383. sono_h=0
  12384. @end example
  12385. @item
  12386. A1 and its harmonics: A1, A2, (near)E3, A3:
  12387. @example
  12388. 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),
  12389. asplit[a][out1]; [a] showcqt [out0]'
  12390. @end example
  12391. @item
  12392. Same as above, but with more accuracy in frequency domain:
  12393. @example
  12394. 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),
  12395. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  12396. @end example
  12397. @item
  12398. Custom volume:
  12399. @example
  12400. bar_v=10:sono_v=bar_v*a_weighting(f)
  12401. @end example
  12402. @item
  12403. Custom gamma, now spectrum is linear to the amplitude.
  12404. @example
  12405. bar_g=2:sono_g=2
  12406. @end example
  12407. @item
  12408. Custom tlength equation:
  12409. @example
  12410. 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)))'
  12411. @end example
  12412. @item
  12413. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  12414. @example
  12415. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  12416. @end example
  12417. @item
  12418. Custom frequency range with custom axis using image file:
  12419. @example
  12420. axisfile=myaxis.png:basefreq=40:endfreq=10000
  12421. @end example
  12422. @end itemize
  12423. @section showfreqs
  12424. Convert input audio to video output representing the audio power spectrum.
  12425. Audio amplitude is on Y-axis while frequency is on X-axis.
  12426. The filter accepts the following options:
  12427. @table @option
  12428. @item size, s
  12429. Specify size of video. For the syntax of this option, check the
  12430. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12431. Default is @code{1024x512}.
  12432. @item mode
  12433. Set display mode.
  12434. This set how each frequency bin will be represented.
  12435. It accepts the following values:
  12436. @table @samp
  12437. @item line
  12438. @item bar
  12439. @item dot
  12440. @end table
  12441. Default is @code{bar}.
  12442. @item ascale
  12443. Set amplitude scale.
  12444. It accepts the following values:
  12445. @table @samp
  12446. @item lin
  12447. Linear scale.
  12448. @item sqrt
  12449. Square root scale.
  12450. @item cbrt
  12451. Cubic root scale.
  12452. @item log
  12453. Logarithmic scale.
  12454. @end table
  12455. Default is @code{log}.
  12456. @item fscale
  12457. Set frequency scale.
  12458. It accepts the following values:
  12459. @table @samp
  12460. @item lin
  12461. Linear scale.
  12462. @item log
  12463. Logarithmic scale.
  12464. @item rlog
  12465. Reverse logarithmic scale.
  12466. @end table
  12467. Default is @code{lin}.
  12468. @item win_size
  12469. Set window size.
  12470. It accepts the following values:
  12471. @table @samp
  12472. @item w16
  12473. @item w32
  12474. @item w64
  12475. @item w128
  12476. @item w256
  12477. @item w512
  12478. @item w1024
  12479. @item w2048
  12480. @item w4096
  12481. @item w8192
  12482. @item w16384
  12483. @item w32768
  12484. @item w65536
  12485. @end table
  12486. Default is @code{w2048}
  12487. @item win_func
  12488. Set windowing function.
  12489. It accepts the following values:
  12490. @table @samp
  12491. @item rect
  12492. @item bartlett
  12493. @item hanning
  12494. @item hamming
  12495. @item blackman
  12496. @item welch
  12497. @item flattop
  12498. @item bharris
  12499. @item bnuttall
  12500. @item bhann
  12501. @item sine
  12502. @item nuttall
  12503. @item lanczos
  12504. @item gauss
  12505. @item tukey
  12506. @end table
  12507. Default is @code{hanning}.
  12508. @item overlap
  12509. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12510. which means optimal overlap for selected window function will be picked.
  12511. @item averaging
  12512. Set time averaging. Setting this to 0 will display current maximal peaks.
  12513. Default is @code{1}, which means time averaging is disabled.
  12514. @item colors
  12515. Specify list of colors separated by space or by '|' which will be used to
  12516. draw channel frequencies. Unrecognized or missing colors will be replaced
  12517. by white color.
  12518. @item cmode
  12519. Set channel display mode.
  12520. It accepts the following values:
  12521. @table @samp
  12522. @item combined
  12523. @item separate
  12524. @end table
  12525. Default is @code{combined}.
  12526. @end table
  12527. @anchor{showspectrum}
  12528. @section showspectrum
  12529. Convert input audio to a video output, representing the audio frequency
  12530. spectrum.
  12531. The filter accepts the following options:
  12532. @table @option
  12533. @item size, s
  12534. Specify the video size for the output. For the syntax of this option, check the
  12535. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12536. Default value is @code{640x512}.
  12537. @item slide
  12538. Specify how the spectrum should slide along the window.
  12539. It accepts the following values:
  12540. @table @samp
  12541. @item replace
  12542. the samples start again on the left when they reach the right
  12543. @item scroll
  12544. the samples scroll from right to left
  12545. @item rscroll
  12546. the samples scroll from left to right
  12547. @item fullframe
  12548. frames are only produced when the samples reach the right
  12549. @end table
  12550. Default value is @code{replace}.
  12551. @item mode
  12552. Specify display mode.
  12553. It accepts the following values:
  12554. @table @samp
  12555. @item combined
  12556. all channels are displayed in the same row
  12557. @item separate
  12558. all channels are displayed in separate rows
  12559. @end table
  12560. Default value is @samp{combined}.
  12561. @item color
  12562. Specify display color mode.
  12563. It accepts the following values:
  12564. @table @samp
  12565. @item channel
  12566. each channel is displayed in a separate color
  12567. @item intensity
  12568. each channel is displayed using the same color scheme
  12569. @item rainbow
  12570. each channel is displayed using the rainbow color scheme
  12571. @item moreland
  12572. each channel is displayed using the moreland color scheme
  12573. @item nebulae
  12574. each channel is displayed using the nebulae color scheme
  12575. @item fire
  12576. each channel is displayed using the fire color scheme
  12577. @item fiery
  12578. each channel is displayed using the fiery color scheme
  12579. @item fruit
  12580. each channel is displayed using the fruit color scheme
  12581. @item cool
  12582. each channel is displayed using the cool color scheme
  12583. @end table
  12584. Default value is @samp{channel}.
  12585. @item scale
  12586. Specify scale used for calculating intensity color values.
  12587. It accepts the following values:
  12588. @table @samp
  12589. @item lin
  12590. linear
  12591. @item sqrt
  12592. square root, default
  12593. @item cbrt
  12594. cubic root
  12595. @item 4thrt
  12596. 4th root
  12597. @item 5thrt
  12598. 5th root
  12599. @item log
  12600. logarithmic
  12601. @end table
  12602. Default value is @samp{sqrt}.
  12603. @item saturation
  12604. Set saturation modifier for displayed colors. Negative values provide
  12605. alternative color scheme. @code{0} is no saturation at all.
  12606. Saturation must be in [-10.0, 10.0] range.
  12607. Default value is @code{1}.
  12608. @item win_func
  12609. Set window function.
  12610. It accepts the following values:
  12611. @table @samp
  12612. @item rect
  12613. @item bartlett
  12614. @item hann
  12615. @item hanning
  12616. @item hamming
  12617. @item blackman
  12618. @item welch
  12619. @item flattop
  12620. @item bharris
  12621. @item bnuttall
  12622. @item bhann
  12623. @item sine
  12624. @item nuttall
  12625. @item lanczos
  12626. @item gauss
  12627. @item tukey
  12628. @end table
  12629. Default value is @code{hann}.
  12630. @item orientation
  12631. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12632. @code{horizontal}. Default is @code{vertical}.
  12633. @item overlap
  12634. Set ratio of overlap window. Default value is @code{0}.
  12635. When value is @code{1} overlap is set to recommended size for specific
  12636. window function currently used.
  12637. @item gain
  12638. Set scale gain for calculating intensity color values.
  12639. Default value is @code{1}.
  12640. @item data
  12641. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  12642. @end table
  12643. The usage is very similar to the showwaves filter; see the examples in that
  12644. section.
  12645. @subsection Examples
  12646. @itemize
  12647. @item
  12648. Large window with logarithmic color scaling:
  12649. @example
  12650. showspectrum=s=1280x480:scale=log
  12651. @end example
  12652. @item
  12653. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  12654. @example
  12655. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12656. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  12657. @end example
  12658. @end itemize
  12659. @section showspectrumpic
  12660. Convert input audio to a single video frame, representing the audio frequency
  12661. spectrum.
  12662. The filter accepts the following options:
  12663. @table @option
  12664. @item size, s
  12665. Specify the video size for the output. For the syntax of this option, check the
  12666. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12667. Default value is @code{4096x2048}.
  12668. @item mode
  12669. Specify display mode.
  12670. It accepts the following values:
  12671. @table @samp
  12672. @item combined
  12673. all channels are displayed in the same row
  12674. @item separate
  12675. all channels are displayed in separate rows
  12676. @end table
  12677. Default value is @samp{combined}.
  12678. @item color
  12679. Specify display color mode.
  12680. It accepts the following values:
  12681. @table @samp
  12682. @item channel
  12683. each channel is displayed in a separate color
  12684. @item intensity
  12685. each channel is displayed using the same color scheme
  12686. @item rainbow
  12687. each channel is displayed using the rainbow color scheme
  12688. @item moreland
  12689. each channel is displayed using the moreland color scheme
  12690. @item nebulae
  12691. each channel is displayed using the nebulae color scheme
  12692. @item fire
  12693. each channel is displayed using the fire color scheme
  12694. @item fiery
  12695. each channel is displayed using the fiery color scheme
  12696. @item fruit
  12697. each channel is displayed using the fruit color scheme
  12698. @item cool
  12699. each channel is displayed using the cool color scheme
  12700. @end table
  12701. Default value is @samp{intensity}.
  12702. @item scale
  12703. Specify scale used for calculating intensity color values.
  12704. It accepts the following values:
  12705. @table @samp
  12706. @item lin
  12707. linear
  12708. @item sqrt
  12709. square root, default
  12710. @item cbrt
  12711. cubic root
  12712. @item 4thrt
  12713. 4th root
  12714. @item 5thrt
  12715. 5th root
  12716. @item log
  12717. logarithmic
  12718. @end table
  12719. Default value is @samp{log}.
  12720. @item saturation
  12721. Set saturation modifier for displayed colors. Negative values provide
  12722. alternative color scheme. @code{0} is no saturation at all.
  12723. Saturation must be in [-10.0, 10.0] range.
  12724. Default value is @code{1}.
  12725. @item win_func
  12726. Set window function.
  12727. It accepts the following values:
  12728. @table @samp
  12729. @item rect
  12730. @item bartlett
  12731. @item hann
  12732. @item hanning
  12733. @item hamming
  12734. @item blackman
  12735. @item welch
  12736. @item flattop
  12737. @item bharris
  12738. @item bnuttall
  12739. @item bhann
  12740. @item sine
  12741. @item nuttall
  12742. @item lanczos
  12743. @item gauss
  12744. @item tukey
  12745. @end table
  12746. Default value is @code{hann}.
  12747. @item orientation
  12748. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12749. @code{horizontal}. Default is @code{vertical}.
  12750. @item gain
  12751. Set scale gain for calculating intensity color values.
  12752. Default value is @code{1}.
  12753. @item legend
  12754. Draw time and frequency axes and legends. Default is enabled.
  12755. @end table
  12756. @subsection Examples
  12757. @itemize
  12758. @item
  12759. Extract an audio spectrogram of a whole audio track
  12760. in a 1024x1024 picture using @command{ffmpeg}:
  12761. @example
  12762. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  12763. @end example
  12764. @end itemize
  12765. @section showvolume
  12766. Convert input audio volume to a video output.
  12767. The filter accepts the following options:
  12768. @table @option
  12769. @item rate, r
  12770. Set video rate.
  12771. @item b
  12772. Set border width, allowed range is [0, 5]. Default is 1.
  12773. @item w
  12774. Set channel width, allowed range is [80, 8192]. Default is 400.
  12775. @item h
  12776. Set channel height, allowed range is [1, 900]. Default is 20.
  12777. @item f
  12778. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  12779. @item c
  12780. Set volume color expression.
  12781. The expression can use the following variables:
  12782. @table @option
  12783. @item VOLUME
  12784. Current max volume of channel in dB.
  12785. @item CHANNEL
  12786. Current channel number, starting from 0.
  12787. @end table
  12788. @item t
  12789. If set, displays channel names. Default is enabled.
  12790. @item v
  12791. If set, displays volume values. Default is enabled.
  12792. @item o
  12793. Set orientation, can be @code{horizontal} or @code{vertical},
  12794. default is @code{horizontal}.
  12795. @item s
  12796. Set step size, allowed range s [0, 5]. Default is 0, which means
  12797. step is disabled.
  12798. @end table
  12799. @section showwaves
  12800. Convert input audio to a video output, representing the samples waves.
  12801. The filter accepts the following options:
  12802. @table @option
  12803. @item size, s
  12804. Specify the video size for the output. For the syntax of this option, check the
  12805. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12806. Default value is @code{600x240}.
  12807. @item mode
  12808. Set display mode.
  12809. Available values are:
  12810. @table @samp
  12811. @item point
  12812. Draw a point for each sample.
  12813. @item line
  12814. Draw a vertical line for each sample.
  12815. @item p2p
  12816. Draw a point for each sample and a line between them.
  12817. @item cline
  12818. Draw a centered vertical line for each sample.
  12819. @end table
  12820. Default value is @code{point}.
  12821. @item n
  12822. Set the number of samples which are printed on the same column. A
  12823. larger value will decrease the frame rate. Must be a positive
  12824. integer. This option can be set only if the value for @var{rate}
  12825. is not explicitly specified.
  12826. @item rate, r
  12827. Set the (approximate) output frame rate. This is done by setting the
  12828. option @var{n}. Default value is "25".
  12829. @item split_channels
  12830. Set if channels should be drawn separately or overlap. Default value is 0.
  12831. @item colors
  12832. Set colors separated by '|' which are going to be used for drawing of each channel.
  12833. @item scale
  12834. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12835. Default is linear.
  12836. @end table
  12837. @subsection Examples
  12838. @itemize
  12839. @item
  12840. Output the input file audio and the corresponding video representation
  12841. at the same time:
  12842. @example
  12843. amovie=a.mp3,asplit[out0],showwaves[out1]
  12844. @end example
  12845. @item
  12846. Create a synthetic signal and show it with showwaves, forcing a
  12847. frame rate of 30 frames per second:
  12848. @example
  12849. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  12850. @end example
  12851. @end itemize
  12852. @section showwavespic
  12853. Convert input audio to a single video frame, representing the samples waves.
  12854. The filter accepts the following options:
  12855. @table @option
  12856. @item size, s
  12857. Specify the video size for the output. For the syntax of this option, check the
  12858. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12859. Default value is @code{600x240}.
  12860. @item split_channels
  12861. Set if channels should be drawn separately or overlap. Default value is 0.
  12862. @item colors
  12863. Set colors separated by '|' which are going to be used for drawing of each channel.
  12864. @item scale
  12865. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12866. Default is linear.
  12867. @end table
  12868. @subsection Examples
  12869. @itemize
  12870. @item
  12871. Extract a channel split representation of the wave form of a whole audio track
  12872. in a 1024x800 picture using @command{ffmpeg}:
  12873. @example
  12874. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  12875. @end example
  12876. @end itemize
  12877. @section spectrumsynth
  12878. Sythesize audio from 2 input video spectrums, first input stream represents
  12879. magnitude across time and second represents phase across time.
  12880. The filter will transform from frequency domain as displayed in videos back
  12881. to time domain as presented in audio output.
  12882. This filter is primarly created for reversing processed @ref{showspectrum}
  12883. filter outputs, but can synthesize sound from other spectrograms too.
  12884. But in such case results are going to be poor if the phase data is not
  12885. available, because in such cases phase data need to be recreated, usually
  12886. its just recreated from random noise.
  12887. For best results use gray only output (@code{channel} color mode in
  12888. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  12889. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  12890. @code{data} option. Inputs videos should generally use @code{fullframe}
  12891. slide mode as that saves resources needed for decoding video.
  12892. The filter accepts the following options:
  12893. @table @option
  12894. @item sample_rate
  12895. Specify sample rate of output audio, the sample rate of audio from which
  12896. spectrum was generated may differ.
  12897. @item channels
  12898. Set number of channels represented in input video spectrums.
  12899. @item scale
  12900. Set scale which was used when generating magnitude input spectrum.
  12901. Can be @code{lin} or @code{log}. Default is @code{log}.
  12902. @item slide
  12903. Set slide which was used when generating inputs spectrums.
  12904. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  12905. Default is @code{fullframe}.
  12906. @item win_func
  12907. Set window function used for resynthesis.
  12908. @item overlap
  12909. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12910. which means optimal overlap for selected window function will be picked.
  12911. @item orientation
  12912. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  12913. Default is @code{vertical}.
  12914. @end table
  12915. @subsection Examples
  12916. @itemize
  12917. @item
  12918. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  12919. then resynthesize videos back to audio with spectrumsynth:
  12920. @example
  12921. 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
  12922. 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
  12923. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  12924. @end example
  12925. @end itemize
  12926. @section split, asplit
  12927. Split input into several identical outputs.
  12928. @code{asplit} works with audio input, @code{split} with video.
  12929. The filter accepts a single parameter which specifies the number of outputs. If
  12930. unspecified, it defaults to 2.
  12931. @subsection Examples
  12932. @itemize
  12933. @item
  12934. Create two separate outputs from the same input:
  12935. @example
  12936. [in] split [out0][out1]
  12937. @end example
  12938. @item
  12939. To create 3 or more outputs, you need to specify the number of
  12940. outputs, like in:
  12941. @example
  12942. [in] asplit=3 [out0][out1][out2]
  12943. @end example
  12944. @item
  12945. Create two separate outputs from the same input, one cropped and
  12946. one padded:
  12947. @example
  12948. [in] split [splitout1][splitout2];
  12949. [splitout1] crop=100:100:0:0 [cropout];
  12950. [splitout2] pad=200:200:100:100 [padout];
  12951. @end example
  12952. @item
  12953. Create 5 copies of the input audio with @command{ffmpeg}:
  12954. @example
  12955. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  12956. @end example
  12957. @end itemize
  12958. @section zmq, azmq
  12959. Receive commands sent through a libzmq client, and forward them to
  12960. filters in the filtergraph.
  12961. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  12962. must be inserted between two video filters, @code{azmq} between two
  12963. audio filters.
  12964. To enable these filters you need to install the libzmq library and
  12965. headers and configure FFmpeg with @code{--enable-libzmq}.
  12966. For more information about libzmq see:
  12967. @url{http://www.zeromq.org/}
  12968. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  12969. receives messages sent through a network interface defined by the
  12970. @option{bind_address} option.
  12971. The received message must be in the form:
  12972. @example
  12973. @var{TARGET} @var{COMMAND} [@var{ARG}]
  12974. @end example
  12975. @var{TARGET} specifies the target of the command, usually the name of
  12976. the filter class or a specific filter instance name.
  12977. @var{COMMAND} specifies the name of the command for the target filter.
  12978. @var{ARG} is optional and specifies the optional argument list for the
  12979. given @var{COMMAND}.
  12980. Upon reception, the message is processed and the corresponding command
  12981. is injected into the filtergraph. Depending on the result, the filter
  12982. will send a reply to the client, adopting the format:
  12983. @example
  12984. @var{ERROR_CODE} @var{ERROR_REASON}
  12985. @var{MESSAGE}
  12986. @end example
  12987. @var{MESSAGE} is optional.
  12988. @subsection Examples
  12989. Look at @file{tools/zmqsend} for an example of a zmq client which can
  12990. be used to send commands processed by these filters.
  12991. Consider the following filtergraph generated by @command{ffplay}
  12992. @example
  12993. ffplay -dumpgraph 1 -f lavfi "
  12994. color=s=100x100:c=red [l];
  12995. color=s=100x100:c=blue [r];
  12996. nullsrc=s=200x100, zmq [bg];
  12997. [bg][l] overlay [bg+l];
  12998. [bg+l][r] overlay=x=100 "
  12999. @end example
  13000. To change the color of the left side of the video, the following
  13001. command can be used:
  13002. @example
  13003. echo Parsed_color_0 c yellow | tools/zmqsend
  13004. @end example
  13005. To change the right side:
  13006. @example
  13007. echo Parsed_color_1 c pink | tools/zmqsend
  13008. @end example
  13009. @c man end MULTIMEDIA FILTERS
  13010. @chapter Multimedia Sources
  13011. @c man begin MULTIMEDIA SOURCES
  13012. Below is a description of the currently available multimedia sources.
  13013. @section amovie
  13014. This is the same as @ref{movie} source, except it selects an audio
  13015. stream by default.
  13016. @anchor{movie}
  13017. @section movie
  13018. Read audio and/or video stream(s) from a movie container.
  13019. It accepts the following parameters:
  13020. @table @option
  13021. @item filename
  13022. The name of the resource to read (not necessarily a file; it can also be a
  13023. device or a stream accessed through some protocol).
  13024. @item format_name, f
  13025. Specifies the format assumed for the movie to read, and can be either
  13026. the name of a container or an input device. If not specified, the
  13027. format is guessed from @var{movie_name} or by probing.
  13028. @item seek_point, sp
  13029. Specifies the seek point in seconds. The frames will be output
  13030. starting from this seek point. The parameter is evaluated with
  13031. @code{av_strtod}, so the numerical value may be suffixed by an IS
  13032. postfix. The default value is "0".
  13033. @item streams, s
  13034. Specifies the streams to read. Several streams can be specified,
  13035. separated by "+". The source will then have as many outputs, in the
  13036. same order. The syntax is explained in the ``Stream specifiers''
  13037. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  13038. respectively the default (best suited) video and audio stream. Default
  13039. is "dv", or "da" if the filter is called as "amovie".
  13040. @item stream_index, si
  13041. Specifies the index of the video stream to read. If the value is -1,
  13042. the most suitable video stream will be automatically selected. The default
  13043. value is "-1". Deprecated. If the filter is called "amovie", it will select
  13044. audio instead of video.
  13045. @item loop
  13046. Specifies how many times to read the stream in sequence.
  13047. If the value is less than 1, the stream will be read again and again.
  13048. Default value is "1".
  13049. Note that when the movie is looped the source timestamps are not
  13050. changed, so it will generate non monotonically increasing timestamps.
  13051. @item discontinuity
  13052. Specifies the time difference between frames above which the point is
  13053. considered a timestamp discontinuity which is removed by adjusting the later
  13054. timestamps.
  13055. @end table
  13056. It allows overlaying a second video on top of the main input of
  13057. a filtergraph, as shown in this graph:
  13058. @example
  13059. input -----------> deltapts0 --> overlay --> output
  13060. ^
  13061. |
  13062. movie --> scale--> deltapts1 -------+
  13063. @end example
  13064. @subsection Examples
  13065. @itemize
  13066. @item
  13067. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13068. on top of the input labelled "in":
  13069. @example
  13070. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13071. [in] setpts=PTS-STARTPTS [main];
  13072. [main][over] overlay=16:16 [out]
  13073. @end example
  13074. @item
  13075. Read from a video4linux2 device, and overlay it on top of the input
  13076. labelled "in":
  13077. @example
  13078. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13079. [in] setpts=PTS-STARTPTS [main];
  13080. [main][over] overlay=16:16 [out]
  13081. @end example
  13082. @item
  13083. Read the first video stream and the audio stream with id 0x81 from
  13084. dvd.vob; the video is connected to the pad named "video" and the audio is
  13085. connected to the pad named "audio":
  13086. @example
  13087. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13088. @end example
  13089. @end itemize
  13090. @subsection Commands
  13091. Both movie and amovie support the following commands:
  13092. @table @option
  13093. @item seek
  13094. Perform seek using "av_seek_frame".
  13095. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13096. @itemize
  13097. @item
  13098. @var{stream_index}: If stream_index is -1, a default
  13099. stream is selected, and @var{timestamp} is automatically converted
  13100. from AV_TIME_BASE units to the stream specific time_base.
  13101. @item
  13102. @var{timestamp}: Timestamp in AVStream.time_base units
  13103. or, if no stream is specified, in AV_TIME_BASE units.
  13104. @item
  13105. @var{flags}: Flags which select direction and seeking mode.
  13106. @end itemize
  13107. @item get_duration
  13108. Get movie duration in AV_TIME_BASE units.
  13109. @end table
  13110. @c man end MULTIMEDIA SOURCES