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.

17084 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. @item picture
  4985. Draw single picture.
  4986. @end table
  4987. Default is @code{frame}.
  4988. @item size
  4989. Set size of graph video. For the syntax of this option, check the
  4990. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  4991. The default value is @code{900x256}.
  4992. The foreground color expressions can use the following variables:
  4993. @table @option
  4994. @item MIN
  4995. Minimal value of metadata value.
  4996. @item MAX
  4997. Maximal value of metadata value.
  4998. @item VAL
  4999. Current metadata key value.
  5000. @end table
  5001. The color is defined as 0xAABBGGRR.
  5002. @end table
  5003. Example using metadata from @ref{signalstats} filter:
  5004. @example
  5005. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  5006. @end example
  5007. Example using metadata from @ref{ebur128} filter:
  5008. @example
  5009. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  5010. @end example
  5011. @section drawgrid
  5012. Draw a grid on the input image.
  5013. It accepts the following parameters:
  5014. @table @option
  5015. @item x
  5016. @item y
  5017. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5018. @item width, w
  5019. @item height, h
  5020. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5021. input width and height, respectively, minus @code{thickness}, so image gets
  5022. framed. Default to 0.
  5023. @item color, c
  5024. Specify the color of the grid. For the general syntax of this option,
  5025. check the "Color" section in the ffmpeg-utils manual. If the special
  5026. value @code{invert} is used, the grid color is the same as the
  5027. video with inverted luma.
  5028. @item thickness, t
  5029. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5030. See below for the list of accepted constants.
  5031. @end table
  5032. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5033. following constants:
  5034. @table @option
  5035. @item dar
  5036. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5037. @item hsub
  5038. @item vsub
  5039. horizontal and vertical chroma subsample values. For example for the
  5040. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5041. @item in_h, ih
  5042. @item in_w, iw
  5043. The input grid cell width and height.
  5044. @item sar
  5045. The input sample aspect ratio.
  5046. @item x
  5047. @item y
  5048. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5049. @item w
  5050. @item h
  5051. The width and height of the drawn cell.
  5052. @item t
  5053. The thickness of the drawn cell.
  5054. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5055. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5056. @end table
  5057. @subsection Examples
  5058. @itemize
  5059. @item
  5060. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5061. @example
  5062. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5063. @end example
  5064. @item
  5065. Draw a white 3x3 grid with an opacity of 50%:
  5066. @example
  5067. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5068. @end example
  5069. @end itemize
  5070. @anchor{drawtext}
  5071. @section drawtext
  5072. Draw a text string or text from a specified file on top of a video, using the
  5073. libfreetype library.
  5074. To enable compilation of this filter, you need to configure FFmpeg with
  5075. @code{--enable-libfreetype}.
  5076. To enable default font fallback and the @var{font} option you need to
  5077. configure FFmpeg with @code{--enable-libfontconfig}.
  5078. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5079. @code{--enable-libfribidi}.
  5080. @subsection Syntax
  5081. It accepts the following parameters:
  5082. @table @option
  5083. @item box
  5084. Used to draw a box around text using the background color.
  5085. The value must be either 1 (enable) or 0 (disable).
  5086. The default value of @var{box} is 0.
  5087. @item boxborderw
  5088. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5089. The default value of @var{boxborderw} is 0.
  5090. @item boxcolor
  5091. The color to be used for drawing box around text. For the syntax of this
  5092. option, check the "Color" section in the ffmpeg-utils manual.
  5093. The default value of @var{boxcolor} is "white".
  5094. @item borderw
  5095. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5096. The default value of @var{borderw} is 0.
  5097. @item bordercolor
  5098. Set the color to be used for drawing border around text. For the syntax of this
  5099. option, check the "Color" section in the ffmpeg-utils manual.
  5100. The default value of @var{bordercolor} is "black".
  5101. @item expansion
  5102. Select how the @var{text} is expanded. Can be either @code{none},
  5103. @code{strftime} (deprecated) or
  5104. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5105. below for details.
  5106. @item fix_bounds
  5107. If true, check and fix text coords to avoid clipping.
  5108. @item fontcolor
  5109. The color to be used for drawing fonts. For the syntax of this option, check
  5110. the "Color" section in the ffmpeg-utils manual.
  5111. The default value of @var{fontcolor} is "black".
  5112. @item fontcolor_expr
  5113. String which is expanded the same way as @var{text} to obtain dynamic
  5114. @var{fontcolor} value. By default this option has empty value and is not
  5115. processed. When this option is set, it overrides @var{fontcolor} option.
  5116. @item font
  5117. The font family to be used for drawing text. By default Sans.
  5118. @item fontfile
  5119. The font file to be used for drawing text. The path must be included.
  5120. This parameter is mandatory if the fontconfig support is disabled.
  5121. @item draw
  5122. This option does not exist, please see the timeline system
  5123. @item alpha
  5124. Draw the text applying alpha blending. The value can
  5125. be either a number between 0.0 and 1.0
  5126. The expression accepts the same variables @var{x, y} do.
  5127. The default value is 1.
  5128. Please see fontcolor_expr
  5129. @item fontsize
  5130. The font size to be used for drawing text.
  5131. The default value of @var{fontsize} is 16.
  5132. @item text_shaping
  5133. If set to 1, attempt to shape the text (for example, reverse the order of
  5134. right-to-left text and join Arabic characters) before drawing it.
  5135. Otherwise, just draw the text exactly as given.
  5136. By default 1 (if supported).
  5137. @item ft_load_flags
  5138. The flags to be used for loading the fonts.
  5139. The flags map the corresponding flags supported by libfreetype, and are
  5140. a combination of the following values:
  5141. @table @var
  5142. @item default
  5143. @item no_scale
  5144. @item no_hinting
  5145. @item render
  5146. @item no_bitmap
  5147. @item vertical_layout
  5148. @item force_autohint
  5149. @item crop_bitmap
  5150. @item pedantic
  5151. @item ignore_global_advance_width
  5152. @item no_recurse
  5153. @item ignore_transform
  5154. @item monochrome
  5155. @item linear_design
  5156. @item no_autohint
  5157. @end table
  5158. Default value is "default".
  5159. For more information consult the documentation for the FT_LOAD_*
  5160. libfreetype flags.
  5161. @item shadowcolor
  5162. The color to be used for drawing a shadow behind the drawn text. For the
  5163. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5164. The default value of @var{shadowcolor} is "black".
  5165. @item shadowx
  5166. @item shadowy
  5167. The x and y offsets for the text shadow position with respect to the
  5168. position of the text. They can be either positive or negative
  5169. values. The default value for both is "0".
  5170. @item start_number
  5171. The starting frame number for the n/frame_num variable. The default value
  5172. is "0".
  5173. @item tabsize
  5174. The size in number of spaces to use for rendering the tab.
  5175. Default value is 4.
  5176. @item timecode
  5177. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5178. format. It can be used with or without text parameter. @var{timecode_rate}
  5179. option must be specified.
  5180. @item timecode_rate, rate, r
  5181. Set the timecode frame rate (timecode only).
  5182. @item text
  5183. The text string to be drawn. The text must be a sequence of UTF-8
  5184. encoded characters.
  5185. This parameter is mandatory if no file is specified with the parameter
  5186. @var{textfile}.
  5187. @item textfile
  5188. A text file containing text to be drawn. The text must be a sequence
  5189. of UTF-8 encoded characters.
  5190. This parameter is mandatory if no text string is specified with the
  5191. parameter @var{text}.
  5192. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5193. @item reload
  5194. If set to 1, the @var{textfile} will be reloaded before each frame.
  5195. Be sure to update it atomically, or it may be read partially, or even fail.
  5196. @item x
  5197. @item y
  5198. The expressions which specify the offsets where text will be drawn
  5199. within the video frame. They are relative to the top/left border of the
  5200. output image.
  5201. The default value of @var{x} and @var{y} is "0".
  5202. See below for the list of accepted constants and functions.
  5203. @end table
  5204. The parameters for @var{x} and @var{y} are expressions containing the
  5205. following constants and functions:
  5206. @table @option
  5207. @item dar
  5208. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5209. @item hsub
  5210. @item vsub
  5211. horizontal and vertical chroma subsample values. For example for the
  5212. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5213. @item line_h, lh
  5214. the height of each text line
  5215. @item main_h, h, H
  5216. the input height
  5217. @item main_w, w, W
  5218. the input width
  5219. @item max_glyph_a, ascent
  5220. the maximum distance from the baseline to the highest/upper grid
  5221. coordinate used to place a glyph outline point, for all the rendered
  5222. glyphs.
  5223. It is a positive value, due to the grid's orientation with the Y axis
  5224. upwards.
  5225. @item max_glyph_d, descent
  5226. the maximum distance from the baseline to the lowest grid coordinate
  5227. used to place a glyph outline point, for all the rendered glyphs.
  5228. This is a negative value, due to the grid's orientation, with the Y axis
  5229. upwards.
  5230. @item max_glyph_h
  5231. maximum glyph height, that is the maximum height for all the glyphs
  5232. contained in the rendered text, it is equivalent to @var{ascent} -
  5233. @var{descent}.
  5234. @item max_glyph_w
  5235. maximum glyph width, that is the maximum width for all the glyphs
  5236. contained in the rendered text
  5237. @item n
  5238. the number of input frame, starting from 0
  5239. @item rand(min, max)
  5240. return a random number included between @var{min} and @var{max}
  5241. @item sar
  5242. The input sample aspect ratio.
  5243. @item t
  5244. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5245. @item text_h, th
  5246. the height of the rendered text
  5247. @item text_w, tw
  5248. the width of the rendered text
  5249. @item x
  5250. @item y
  5251. the x and y offset coordinates where the text is drawn.
  5252. These parameters allow the @var{x} and @var{y} expressions to refer
  5253. each other, so you can for example specify @code{y=x/dar}.
  5254. @end table
  5255. @anchor{drawtext_expansion}
  5256. @subsection Text expansion
  5257. If @option{expansion} is set to @code{strftime},
  5258. the filter recognizes strftime() sequences in the provided text and
  5259. expands them accordingly. Check the documentation of strftime(). This
  5260. feature is deprecated.
  5261. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5262. If @option{expansion} is set to @code{normal} (which is the default),
  5263. the following expansion mechanism is used.
  5264. The backslash character @samp{\}, followed by any character, always expands to
  5265. the second character.
  5266. Sequence of the form @code{%@{...@}} are expanded. The text between the
  5267. braces is a function name, possibly followed by arguments separated by ':'.
  5268. If the arguments contain special characters or delimiters (':' or '@}'),
  5269. they should be escaped.
  5270. Note that they probably must also be escaped as the value for the
  5271. @option{text} option in the filter argument string and as the filter
  5272. argument in the filtergraph description, and possibly also for the shell,
  5273. that makes up to four levels of escaping; using a text file avoids these
  5274. problems.
  5275. The following functions are available:
  5276. @table @command
  5277. @item expr, e
  5278. The expression evaluation result.
  5279. It must take one argument specifying the expression to be evaluated,
  5280. which accepts the same constants and functions as the @var{x} and
  5281. @var{y} values. Note that not all constants should be used, for
  5282. example the text size is not known when evaluating the expression, so
  5283. the constants @var{text_w} and @var{text_h} will have an undefined
  5284. value.
  5285. @item expr_int_format, eif
  5286. Evaluate the expression's value and output as formatted integer.
  5287. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5288. The second argument specifies the output format. Allowed values are @samp{x},
  5289. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5290. @code{printf} function.
  5291. The third parameter is optional and sets the number of positions taken by the output.
  5292. It can be used to add padding with zeros from the left.
  5293. @item gmtime
  5294. The time at which the filter is running, expressed in UTC.
  5295. It can accept an argument: a strftime() format string.
  5296. @item localtime
  5297. The time at which the filter is running, expressed in the local time zone.
  5298. It can accept an argument: a strftime() format string.
  5299. @item metadata
  5300. Frame metadata. Takes one or two arguments.
  5301. The first argument is mandatory and specifies the metadata key.
  5302. The second argument is optional and specifies a default value, used when the
  5303. metadata key is not found or empty.
  5304. @item n, frame_num
  5305. The frame number, starting from 0.
  5306. @item pict_type
  5307. A 1 character description of the current picture type.
  5308. @item pts
  5309. The timestamp of the current frame.
  5310. It can take up to three arguments.
  5311. The first argument is the format of the timestamp; it defaults to @code{flt}
  5312. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5313. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5314. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5315. @code{localtime} stands for the timestamp of the frame formatted as
  5316. local time zone time.
  5317. The second argument is an offset added to the timestamp.
  5318. If the format is set to @code{localtime} or @code{gmtime},
  5319. a third argument may be supplied: a strftime() format string.
  5320. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5321. @end table
  5322. @subsection Examples
  5323. @itemize
  5324. @item
  5325. Draw "Test Text" with font FreeSerif, using the default values for the
  5326. optional parameters.
  5327. @example
  5328. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5329. @end example
  5330. @item
  5331. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5332. and y=50 (counting from the top-left corner of the screen), text is
  5333. yellow with a red box around it. Both the text and the box have an
  5334. opacity of 20%.
  5335. @example
  5336. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5337. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5338. @end example
  5339. Note that the double quotes are not necessary if spaces are not used
  5340. within the parameter list.
  5341. @item
  5342. Show the text at the center of the video frame:
  5343. @example
  5344. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5345. @end example
  5346. @item
  5347. Show the text at a random position, switching to a new position every 30 seconds:
  5348. @example
  5349. 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)"
  5350. @end example
  5351. @item
  5352. Show a text line sliding from right to left in the last row of the video
  5353. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5354. with no newlines.
  5355. @example
  5356. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5357. @end example
  5358. @item
  5359. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5360. @example
  5361. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5362. @end example
  5363. @item
  5364. Draw a single green letter "g", at the center of the input video.
  5365. The glyph baseline is placed at half screen height.
  5366. @example
  5367. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5368. @end example
  5369. @item
  5370. Show text for 1 second every 3 seconds:
  5371. @example
  5372. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5373. @end example
  5374. @item
  5375. Use fontconfig to set the font. Note that the colons need to be escaped.
  5376. @example
  5377. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5378. @end example
  5379. @item
  5380. Print the date of a real-time encoding (see strftime(3)):
  5381. @example
  5382. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5383. @end example
  5384. @item
  5385. Show text fading in and out (appearing/disappearing):
  5386. @example
  5387. #!/bin/sh
  5388. DS=1.0 # display start
  5389. DE=10.0 # display end
  5390. FID=1.5 # fade in duration
  5391. FOD=5 # fade out duration
  5392. 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 @}"
  5393. @end example
  5394. @end itemize
  5395. For more information about libfreetype, check:
  5396. @url{http://www.freetype.org/}.
  5397. For more information about fontconfig, check:
  5398. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5399. For more information about libfribidi, check:
  5400. @url{http://fribidi.org/}.
  5401. @section edgedetect
  5402. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5403. The filter accepts the following options:
  5404. @table @option
  5405. @item low
  5406. @item high
  5407. Set low and high threshold values used by the Canny thresholding
  5408. algorithm.
  5409. The high threshold selects the "strong" edge pixels, which are then
  5410. connected through 8-connectivity with the "weak" edge pixels selected
  5411. by the low threshold.
  5412. @var{low} and @var{high} threshold values must be chosen in the range
  5413. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5414. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5415. is @code{50/255}.
  5416. @item mode
  5417. Define the drawing mode.
  5418. @table @samp
  5419. @item wires
  5420. Draw white/gray wires on black background.
  5421. @item colormix
  5422. Mix the colors to create a paint/cartoon effect.
  5423. @end table
  5424. Default value is @var{wires}.
  5425. @end table
  5426. @subsection Examples
  5427. @itemize
  5428. @item
  5429. Standard edge detection with custom values for the hysteresis thresholding:
  5430. @example
  5431. edgedetect=low=0.1:high=0.4
  5432. @end example
  5433. @item
  5434. Painting effect without thresholding:
  5435. @example
  5436. edgedetect=mode=colormix:high=0
  5437. @end example
  5438. @end itemize
  5439. @section eq
  5440. Set brightness, contrast, saturation and approximate gamma adjustment.
  5441. The filter accepts the following options:
  5442. @table @option
  5443. @item contrast
  5444. Set the contrast expression. The value must be a float value in range
  5445. @code{-2.0} to @code{2.0}. The default value is "1".
  5446. @item brightness
  5447. Set the brightness expression. The value must be a float value in
  5448. range @code{-1.0} to @code{1.0}. The default value is "0".
  5449. @item saturation
  5450. Set the saturation expression. The value must be a float in
  5451. range @code{0.0} to @code{3.0}. The default value is "1".
  5452. @item gamma
  5453. Set the gamma expression. The value must be a float in range
  5454. @code{0.1} to @code{10.0}. The default value is "1".
  5455. @item gamma_r
  5456. Set the gamma expression for red. The value must be a float in
  5457. range @code{0.1} to @code{10.0}. The default value is "1".
  5458. @item gamma_g
  5459. Set the gamma expression for green. The value must be a float in range
  5460. @code{0.1} to @code{10.0}. The default value is "1".
  5461. @item gamma_b
  5462. Set the gamma expression for blue. The value must be a float in range
  5463. @code{0.1} to @code{10.0}. The default value is "1".
  5464. @item gamma_weight
  5465. Set the gamma weight expression. It can be used to reduce the effect
  5466. of a high gamma value on bright image areas, e.g. keep them from
  5467. getting overamplified and just plain white. The value must be a float
  5468. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5469. gamma correction all the way down while @code{1.0} leaves it at its
  5470. full strength. Default is "1".
  5471. @item eval
  5472. Set when the expressions for brightness, contrast, saturation and
  5473. gamma expressions are evaluated.
  5474. It accepts the following values:
  5475. @table @samp
  5476. @item init
  5477. only evaluate expressions once during the filter initialization or
  5478. when a command is processed
  5479. @item frame
  5480. evaluate expressions for each incoming frame
  5481. @end table
  5482. Default value is @samp{init}.
  5483. @end table
  5484. The expressions accept the following parameters:
  5485. @table @option
  5486. @item n
  5487. frame count of the input frame starting from 0
  5488. @item pos
  5489. byte position of the corresponding packet in the input file, NAN if
  5490. unspecified
  5491. @item r
  5492. frame rate of the input video, NAN if the input frame rate is unknown
  5493. @item t
  5494. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5495. @end table
  5496. @subsection Commands
  5497. The filter supports the following commands:
  5498. @table @option
  5499. @item contrast
  5500. Set the contrast expression.
  5501. @item brightness
  5502. Set the brightness expression.
  5503. @item saturation
  5504. Set the saturation expression.
  5505. @item gamma
  5506. Set the gamma expression.
  5507. @item gamma_r
  5508. Set the gamma_r expression.
  5509. @item gamma_g
  5510. Set gamma_g expression.
  5511. @item gamma_b
  5512. Set gamma_b expression.
  5513. @item gamma_weight
  5514. Set gamma_weight expression.
  5515. The command accepts the same syntax of the corresponding option.
  5516. If the specified expression is not valid, it is kept at its current
  5517. value.
  5518. @end table
  5519. @section erosion
  5520. Apply erosion effect to the video.
  5521. This filter replaces the pixel by the local(3x3) minimum.
  5522. It accepts the following options:
  5523. @table @option
  5524. @item threshold0
  5525. @item threshold1
  5526. @item threshold2
  5527. @item threshold3
  5528. Limit the maximum change for each plane, default is 65535.
  5529. If 0, plane will remain unchanged.
  5530. @item coordinates
  5531. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5532. pixels are used.
  5533. Flags to local 3x3 coordinates maps like this:
  5534. 1 2 3
  5535. 4 5
  5536. 6 7 8
  5537. @end table
  5538. @section extractplanes
  5539. Extract color channel components from input video stream into
  5540. separate grayscale video streams.
  5541. The filter accepts the following option:
  5542. @table @option
  5543. @item planes
  5544. Set plane(s) to extract.
  5545. Available values for planes are:
  5546. @table @samp
  5547. @item y
  5548. @item u
  5549. @item v
  5550. @item a
  5551. @item r
  5552. @item g
  5553. @item b
  5554. @end table
  5555. Choosing planes not available in the input will result in an error.
  5556. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5557. with @code{y}, @code{u}, @code{v} planes at same time.
  5558. @end table
  5559. @subsection Examples
  5560. @itemize
  5561. @item
  5562. Extract luma, u and v color channel component from input video frame
  5563. into 3 grayscale outputs:
  5564. @example
  5565. 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
  5566. @end example
  5567. @end itemize
  5568. @section elbg
  5569. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5570. For each input image, the filter will compute the optimal mapping from
  5571. the input to the output given the codebook length, that is the number
  5572. of distinct output colors.
  5573. This filter accepts the following options.
  5574. @table @option
  5575. @item codebook_length, l
  5576. Set codebook length. The value must be a positive integer, and
  5577. represents the number of distinct output colors. Default value is 256.
  5578. @item nb_steps, n
  5579. Set the maximum number of iterations to apply for computing the optimal
  5580. mapping. The higher the value the better the result and the higher the
  5581. computation time. Default value is 1.
  5582. @item seed, s
  5583. Set a random seed, must be an integer included between 0 and
  5584. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5585. will try to use a good random seed on a best effort basis.
  5586. @item pal8
  5587. Set pal8 output pixel format. This option does not work with codebook
  5588. length greater than 256.
  5589. @end table
  5590. @section fade
  5591. Apply a fade-in/out effect to the input video.
  5592. It accepts the following parameters:
  5593. @table @option
  5594. @item type, t
  5595. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5596. effect.
  5597. Default is @code{in}.
  5598. @item start_frame, s
  5599. Specify the number of the frame to start applying the fade
  5600. effect at. Default is 0.
  5601. @item nb_frames, n
  5602. The number of frames that the fade effect lasts. At the end of the
  5603. fade-in effect, the output video will have the same intensity as the input video.
  5604. At the end of the fade-out transition, the output video will be filled with the
  5605. selected @option{color}.
  5606. Default is 25.
  5607. @item alpha
  5608. If set to 1, fade only alpha channel, if one exists on the input.
  5609. Default value is 0.
  5610. @item start_time, st
  5611. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5612. effect. If both start_frame and start_time are specified, the fade will start at
  5613. whichever comes last. Default is 0.
  5614. @item duration, d
  5615. The number of seconds for which the fade effect has to last. At the end of the
  5616. fade-in effect the output video will have the same intensity as the input video,
  5617. at the end of the fade-out transition the output video will be filled with the
  5618. selected @option{color}.
  5619. If both duration and nb_frames are specified, duration is used. Default is 0
  5620. (nb_frames is used by default).
  5621. @item color, c
  5622. Specify the color of the fade. Default is "black".
  5623. @end table
  5624. @subsection Examples
  5625. @itemize
  5626. @item
  5627. Fade in the first 30 frames of video:
  5628. @example
  5629. fade=in:0:30
  5630. @end example
  5631. The command above is equivalent to:
  5632. @example
  5633. fade=t=in:s=0:n=30
  5634. @end example
  5635. @item
  5636. Fade out the last 45 frames of a 200-frame video:
  5637. @example
  5638. fade=out:155:45
  5639. fade=type=out:start_frame=155:nb_frames=45
  5640. @end example
  5641. @item
  5642. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5643. @example
  5644. fade=in:0:25, fade=out:975:25
  5645. @end example
  5646. @item
  5647. Make the first 5 frames yellow, then fade in from frame 5-24:
  5648. @example
  5649. fade=in:5:20:color=yellow
  5650. @end example
  5651. @item
  5652. Fade in alpha over first 25 frames of video:
  5653. @example
  5654. fade=in:0:25:alpha=1
  5655. @end example
  5656. @item
  5657. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5658. @example
  5659. fade=t=in:st=5.5:d=0.5
  5660. @end example
  5661. @end itemize
  5662. @section fftfilt
  5663. Apply arbitrary expressions to samples in frequency domain
  5664. @table @option
  5665. @item dc_Y
  5666. Adjust the dc value (gain) of the luma plane of the image. The filter
  5667. accepts an integer value in range @code{0} to @code{1000}. The default
  5668. value is set to @code{0}.
  5669. @item dc_U
  5670. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5671. filter accepts an integer value in range @code{0} to @code{1000}. The
  5672. default value is set to @code{0}.
  5673. @item dc_V
  5674. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5675. filter accepts an integer value in range @code{0} to @code{1000}. The
  5676. default value is set to @code{0}.
  5677. @item weight_Y
  5678. Set the frequency domain weight expression for the luma plane.
  5679. @item weight_U
  5680. Set the frequency domain weight expression for the 1st chroma plane.
  5681. @item weight_V
  5682. Set the frequency domain weight expression for the 2nd chroma plane.
  5683. The filter accepts the following variables:
  5684. @item X
  5685. @item Y
  5686. The coordinates of the current sample.
  5687. @item W
  5688. @item H
  5689. The width and height of the image.
  5690. @end table
  5691. @subsection Examples
  5692. @itemize
  5693. @item
  5694. High-pass:
  5695. @example
  5696. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5697. @end example
  5698. @item
  5699. Low-pass:
  5700. @example
  5701. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5702. @end example
  5703. @item
  5704. Sharpen:
  5705. @example
  5706. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5707. @end example
  5708. @item
  5709. Blur:
  5710. @example
  5711. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5712. @end example
  5713. @end itemize
  5714. @section field
  5715. Extract a single field from an interlaced image using stride
  5716. arithmetic to avoid wasting CPU time. The output frames are marked as
  5717. non-interlaced.
  5718. The filter accepts the following options:
  5719. @table @option
  5720. @item type
  5721. Specify whether to extract the top (if the value is @code{0} or
  5722. @code{top}) or the bottom field (if the value is @code{1} or
  5723. @code{bottom}).
  5724. @end table
  5725. @section fieldhint
  5726. Create new frames by copying the top and bottom fields from surrounding frames
  5727. supplied as numbers by the hint file.
  5728. @table @option
  5729. @item hint
  5730. Set file containing hints: absolute/relative frame numbers.
  5731. There must be one line for each frame in a clip. Each line must contain two
  5732. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5733. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5734. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5735. for @code{relative} mode. First number tells from which frame to pick up top
  5736. field and second number tells from which frame to pick up bottom field.
  5737. If optionally followed by @code{+} output frame will be marked as interlaced,
  5738. else if followed by @code{-} output frame will be marked as progressive, else
  5739. it will be marked same as input frame.
  5740. If line starts with @code{#} or @code{;} that line is skipped.
  5741. @item mode
  5742. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5743. @end table
  5744. Example of first several lines of @code{hint} file for @code{relative} mode:
  5745. @example
  5746. 0,0 - # first frame
  5747. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5748. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5749. 1,0 -
  5750. 0,0 -
  5751. 0,0 -
  5752. 1,0 -
  5753. 1,0 -
  5754. 1,0 -
  5755. 0,0 -
  5756. 0,0 -
  5757. 1,0 -
  5758. 1,0 -
  5759. 1,0 -
  5760. 0,0 -
  5761. @end example
  5762. @section fieldmatch
  5763. Field matching filter for inverse telecine. It is meant to reconstruct the
  5764. progressive frames from a telecined stream. The filter does not drop duplicated
  5765. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5766. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5767. The separation of the field matching and the decimation is notably motivated by
  5768. the possibility of inserting a de-interlacing filter fallback between the two.
  5769. If the source has mixed telecined and real interlaced content,
  5770. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5771. But these remaining combed frames will be marked as interlaced, and thus can be
  5772. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5773. In addition to the various configuration options, @code{fieldmatch} can take an
  5774. optional second stream, activated through the @option{ppsrc} option. If
  5775. enabled, the frames reconstruction will be based on the fields and frames from
  5776. this second stream. This allows the first input to be pre-processed in order to
  5777. help the various algorithms of the filter, while keeping the output lossless
  5778. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5779. or brightness/contrast adjustments can help.
  5780. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5781. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5782. which @code{fieldmatch} is based on. While the semantic and usage are very
  5783. close, some behaviour and options names can differ.
  5784. The @ref{decimate} filter currently only works for constant frame rate input.
  5785. If your input has mixed telecined (30fps) and progressive content with a lower
  5786. framerate like 24fps use the following filterchain to produce the necessary cfr
  5787. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5788. The filter accepts the following options:
  5789. @table @option
  5790. @item order
  5791. Specify the assumed field order of the input stream. Available values are:
  5792. @table @samp
  5793. @item auto
  5794. Auto detect parity (use FFmpeg's internal parity value).
  5795. @item bff
  5796. Assume bottom field first.
  5797. @item tff
  5798. Assume top field first.
  5799. @end table
  5800. Note that it is sometimes recommended not to trust the parity announced by the
  5801. stream.
  5802. Default value is @var{auto}.
  5803. @item mode
  5804. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5805. sense that it won't risk creating jerkiness due to duplicate frames when
  5806. possible, but if there are bad edits or blended fields it will end up
  5807. outputting combed frames when a good match might actually exist. On the other
  5808. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5809. but will almost always find a good frame if there is one. The other values are
  5810. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5811. jerkiness and creating duplicate frames versus finding good matches in sections
  5812. with bad edits, orphaned fields, blended fields, etc.
  5813. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5814. Available values are:
  5815. @table @samp
  5816. @item pc
  5817. 2-way matching (p/c)
  5818. @item pc_n
  5819. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5820. @item pc_u
  5821. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5822. @item pc_n_ub
  5823. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5824. still combed (p/c + n + u/b)
  5825. @item pcn
  5826. 3-way matching (p/c/n)
  5827. @item pcn_ub
  5828. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5829. detected as combed (p/c/n + u/b)
  5830. @end table
  5831. The parenthesis at the end indicate the matches that would be used for that
  5832. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5833. @var{top}).
  5834. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5835. the slowest.
  5836. Default value is @var{pc_n}.
  5837. @item ppsrc
  5838. Mark the main input stream as a pre-processed input, and enable the secondary
  5839. input stream as the clean source to pick the fields from. See the filter
  5840. introduction for more details. It is similar to the @option{clip2} feature from
  5841. VFM/TFM.
  5842. Default value is @code{0} (disabled).
  5843. @item field
  5844. Set the field to match from. It is recommended to set this to the same value as
  5845. @option{order} unless you experience matching failures with that setting. In
  5846. certain circumstances changing the field that is used to match from can have a
  5847. large impact on matching performance. Available values are:
  5848. @table @samp
  5849. @item auto
  5850. Automatic (same value as @option{order}).
  5851. @item bottom
  5852. Match from the bottom field.
  5853. @item top
  5854. Match from the top field.
  5855. @end table
  5856. Default value is @var{auto}.
  5857. @item mchroma
  5858. Set whether or not chroma is included during the match comparisons. In most
  5859. cases it is recommended to leave this enabled. You should set this to @code{0}
  5860. only if your clip has bad chroma problems such as heavy rainbowing or other
  5861. artifacts. Setting this to @code{0} could also be used to speed things up at
  5862. the cost of some accuracy.
  5863. Default value is @code{1}.
  5864. @item y0
  5865. @item y1
  5866. These define an exclusion band which excludes the lines between @option{y0} and
  5867. @option{y1} from being included in the field matching decision. An exclusion
  5868. band can be used to ignore subtitles, a logo, or other things that may
  5869. interfere with the matching. @option{y0} sets the starting scan line and
  5870. @option{y1} sets the ending line; all lines in between @option{y0} and
  5871. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5872. @option{y0} and @option{y1} to the same value will disable the feature.
  5873. @option{y0} and @option{y1} defaults to @code{0}.
  5874. @item scthresh
  5875. Set the scene change detection threshold as a percentage of maximum change on
  5876. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5877. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5878. @option{scthresh} is @code{[0.0, 100.0]}.
  5879. Default value is @code{12.0}.
  5880. @item combmatch
  5881. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5882. account the combed scores of matches when deciding what match to use as the
  5883. final match. Available values are:
  5884. @table @samp
  5885. @item none
  5886. No final matching based on combed scores.
  5887. @item sc
  5888. Combed scores are only used when a scene change is detected.
  5889. @item full
  5890. Use combed scores all the time.
  5891. @end table
  5892. Default is @var{sc}.
  5893. @item combdbg
  5894. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5895. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5896. Available values are:
  5897. @table @samp
  5898. @item none
  5899. No forced calculation.
  5900. @item pcn
  5901. Force p/c/n calculations.
  5902. @item pcnub
  5903. Force p/c/n/u/b calculations.
  5904. @end table
  5905. Default value is @var{none}.
  5906. @item cthresh
  5907. This is the area combing threshold used for combed frame detection. This
  5908. essentially controls how "strong" or "visible" combing must be to be detected.
  5909. Larger values mean combing must be more visible and smaller values mean combing
  5910. can be less visible or strong and still be detected. Valid settings are from
  5911. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5912. be detected as combed). This is basically a pixel difference value. A good
  5913. range is @code{[8, 12]}.
  5914. Default value is @code{9}.
  5915. @item chroma
  5916. Sets whether or not chroma is considered in the combed frame decision. Only
  5917. disable this if your source has chroma problems (rainbowing, etc.) that are
  5918. causing problems for the combed frame detection with chroma enabled. Actually,
  5919. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5920. where there is chroma only combing in the source.
  5921. Default value is @code{0}.
  5922. @item blockx
  5923. @item blocky
  5924. Respectively set the x-axis and y-axis size of the window used during combed
  5925. frame detection. This has to do with the size of the area in which
  5926. @option{combpel} pixels are required to be detected as combed for a frame to be
  5927. declared combed. See the @option{combpel} parameter description for more info.
  5928. Possible values are any number that is a power of 2 starting at 4 and going up
  5929. to 512.
  5930. Default value is @code{16}.
  5931. @item combpel
  5932. The number of combed pixels inside any of the @option{blocky} by
  5933. @option{blockx} size blocks on the frame for the frame to be detected as
  5934. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5935. setting controls "how much" combing there must be in any localized area (a
  5936. window defined by the @option{blockx} and @option{blocky} settings) on the
  5937. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5938. which point no frames will ever be detected as combed). This setting is known
  5939. as @option{MI} in TFM/VFM vocabulary.
  5940. Default value is @code{80}.
  5941. @end table
  5942. @anchor{p/c/n/u/b meaning}
  5943. @subsection p/c/n/u/b meaning
  5944. @subsubsection p/c/n
  5945. We assume the following telecined stream:
  5946. @example
  5947. Top fields: 1 2 2 3 4
  5948. Bottom fields: 1 2 3 4 4
  5949. @end example
  5950. The numbers correspond to the progressive frame the fields relate to. Here, the
  5951. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5952. When @code{fieldmatch} is configured to run a matching from bottom
  5953. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5954. @example
  5955. Input stream:
  5956. T 1 2 2 3 4
  5957. B 1 2 3 4 4 <-- matching reference
  5958. Matches: c c n n c
  5959. Output stream:
  5960. T 1 2 3 4 4
  5961. B 1 2 3 4 4
  5962. @end example
  5963. As a result of the field matching, we can see that some frames get duplicated.
  5964. To perform a complete inverse telecine, you need to rely on a decimation filter
  5965. after this operation. See for instance the @ref{decimate} filter.
  5966. The same operation now matching from top fields (@option{field}=@var{top})
  5967. looks like this:
  5968. @example
  5969. Input stream:
  5970. T 1 2 2 3 4 <-- matching reference
  5971. B 1 2 3 4 4
  5972. Matches: c c p p c
  5973. Output stream:
  5974. T 1 2 2 3 4
  5975. B 1 2 2 3 4
  5976. @end example
  5977. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5978. basically, they refer to the frame and field of the opposite parity:
  5979. @itemize
  5980. @item @var{p} matches the field of the opposite parity in the previous frame
  5981. @item @var{c} matches the field of the opposite parity in the current frame
  5982. @item @var{n} matches the field of the opposite parity in the next frame
  5983. @end itemize
  5984. @subsubsection u/b
  5985. The @var{u} and @var{b} matching are a bit special in the sense that they match
  5986. from the opposite parity flag. In the following examples, we assume that we are
  5987. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  5988. 'x' is placed above and below each matched fields.
  5989. With bottom matching (@option{field}=@var{bottom}):
  5990. @example
  5991. Match: c p n b u
  5992. x x x x x
  5993. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5994. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5995. x x x x x
  5996. Output frames:
  5997. 2 1 2 2 2
  5998. 2 2 2 1 3
  5999. @end example
  6000. With top matching (@option{field}=@var{top}):
  6001. @example
  6002. Match: c p n b u
  6003. x x x x x
  6004. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6005. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6006. x x x x x
  6007. Output frames:
  6008. 2 2 2 1 2
  6009. 2 1 3 2 2
  6010. @end example
  6011. @subsection Examples
  6012. Simple IVTC of a top field first telecined stream:
  6013. @example
  6014. fieldmatch=order=tff:combmatch=none, decimate
  6015. @end example
  6016. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6017. @example
  6018. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6019. @end example
  6020. @section fieldorder
  6021. Transform the field order of the input video.
  6022. It accepts the following parameters:
  6023. @table @option
  6024. @item order
  6025. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6026. for bottom field first.
  6027. @end table
  6028. The default value is @samp{tff}.
  6029. The transformation is done by shifting the picture content up or down
  6030. by one line, and filling the remaining line with appropriate picture content.
  6031. This method is consistent with most broadcast field order converters.
  6032. If the input video is not flagged as being interlaced, or it is already
  6033. flagged as being of the required output field order, then this filter does
  6034. not alter the incoming video.
  6035. It is very useful when converting to or from PAL DV material,
  6036. which is bottom field first.
  6037. For example:
  6038. @example
  6039. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6040. @end example
  6041. @section fifo, afifo
  6042. Buffer input images and send them when they are requested.
  6043. It is mainly useful when auto-inserted by the libavfilter
  6044. framework.
  6045. It does not take parameters.
  6046. @section find_rect
  6047. Find a rectangular object
  6048. It accepts the following options:
  6049. @table @option
  6050. @item object
  6051. Filepath of the object image, needs to be in gray8.
  6052. @item threshold
  6053. Detection threshold, default is 0.5.
  6054. @item mipmaps
  6055. Number of mipmaps, default is 3.
  6056. @item xmin, ymin, xmax, ymax
  6057. Specifies the rectangle in which to search.
  6058. @end table
  6059. @subsection Examples
  6060. @itemize
  6061. @item
  6062. Generate a representative palette of a given video using @command{ffmpeg}:
  6063. @example
  6064. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6065. @end example
  6066. @end itemize
  6067. @section cover_rect
  6068. Cover a rectangular object
  6069. It accepts the following options:
  6070. @table @option
  6071. @item cover
  6072. Filepath of the optional cover image, needs to be in yuv420.
  6073. @item mode
  6074. Set covering mode.
  6075. It accepts the following values:
  6076. @table @samp
  6077. @item cover
  6078. cover it by the supplied image
  6079. @item blur
  6080. cover it by interpolating the surrounding pixels
  6081. @end table
  6082. Default value is @var{blur}.
  6083. @end table
  6084. @subsection Examples
  6085. @itemize
  6086. @item
  6087. Generate a representative palette of a given video using @command{ffmpeg}:
  6088. @example
  6089. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6090. @end example
  6091. @end itemize
  6092. @anchor{format}
  6093. @section format
  6094. Convert the input video to one of the specified pixel formats.
  6095. Libavfilter will try to pick one that is suitable as input to
  6096. the next filter.
  6097. It accepts the following parameters:
  6098. @table @option
  6099. @item pix_fmts
  6100. A '|'-separated list of pixel format names, such as
  6101. "pix_fmts=yuv420p|monow|rgb24".
  6102. @end table
  6103. @subsection Examples
  6104. @itemize
  6105. @item
  6106. Convert the input video to the @var{yuv420p} format
  6107. @example
  6108. format=pix_fmts=yuv420p
  6109. @end example
  6110. Convert the input video to any of the formats in the list
  6111. @example
  6112. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6113. @end example
  6114. @end itemize
  6115. @anchor{fps}
  6116. @section fps
  6117. Convert the video to specified constant frame rate by duplicating or dropping
  6118. frames as necessary.
  6119. It accepts the following parameters:
  6120. @table @option
  6121. @item fps
  6122. The desired output frame rate. The default is @code{25}.
  6123. @item round
  6124. Rounding method.
  6125. Possible values are:
  6126. @table @option
  6127. @item zero
  6128. zero round towards 0
  6129. @item inf
  6130. round away from 0
  6131. @item down
  6132. round towards -infinity
  6133. @item up
  6134. round towards +infinity
  6135. @item near
  6136. round to nearest
  6137. @end table
  6138. The default is @code{near}.
  6139. @item start_time
  6140. Assume the first PTS should be the given value, in seconds. This allows for
  6141. padding/trimming at the start of stream. By default, no assumption is made
  6142. about the first frame's expected PTS, so no padding or trimming is done.
  6143. For example, this could be set to 0 to pad the beginning with duplicates of
  6144. the first frame if a video stream starts after the audio stream or to trim any
  6145. frames with a negative PTS.
  6146. @end table
  6147. Alternatively, the options can be specified as a flat string:
  6148. @var{fps}[:@var{round}].
  6149. See also the @ref{setpts} filter.
  6150. @subsection Examples
  6151. @itemize
  6152. @item
  6153. A typical usage in order to set the fps to 25:
  6154. @example
  6155. fps=fps=25
  6156. @end example
  6157. @item
  6158. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6159. @example
  6160. fps=fps=film:round=near
  6161. @end example
  6162. @end itemize
  6163. @section framepack
  6164. Pack two different video streams into a stereoscopic video, setting proper
  6165. metadata on supported codecs. The two views should have the same size and
  6166. framerate and processing will stop when the shorter video ends. Please note
  6167. that you may conveniently adjust view properties with the @ref{scale} and
  6168. @ref{fps} filters.
  6169. It accepts the following parameters:
  6170. @table @option
  6171. @item format
  6172. The desired packing format. Supported values are:
  6173. @table @option
  6174. @item sbs
  6175. The views are next to each other (default).
  6176. @item tab
  6177. The views are on top of each other.
  6178. @item lines
  6179. The views are packed by line.
  6180. @item columns
  6181. The views are packed by column.
  6182. @item frameseq
  6183. The views are temporally interleaved.
  6184. @end table
  6185. @end table
  6186. Some examples:
  6187. @example
  6188. # Convert left and right views into a frame-sequential video
  6189. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6190. # Convert views into a side-by-side video with the same output resolution as the input
  6191. 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
  6192. @end example
  6193. @section framerate
  6194. Change the frame rate by interpolating new video output frames from the source
  6195. frames.
  6196. This filter is not designed to function correctly with interlaced media. If
  6197. you wish to change the frame rate of interlaced media then you are required
  6198. to deinterlace before this filter and re-interlace after this filter.
  6199. A description of the accepted options follows.
  6200. @table @option
  6201. @item fps
  6202. Specify the output frames per second. This option can also be specified
  6203. as a value alone. The default is @code{50}.
  6204. @item interp_start
  6205. Specify the start of a range where the output frame will be created as a
  6206. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6207. the default is @code{15}.
  6208. @item interp_end
  6209. Specify the end of a range where the output frame will be created as a
  6210. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6211. the default is @code{240}.
  6212. @item scene
  6213. Specify the level at which a scene change is detected as a value between
  6214. 0 and 100 to indicate a new scene; a low value reflects a low
  6215. probability for the current frame to introduce a new scene, while a higher
  6216. value means the current frame is more likely to be one.
  6217. The default is @code{7}.
  6218. @item flags
  6219. Specify flags influencing the filter process.
  6220. Available value for @var{flags} is:
  6221. @table @option
  6222. @item scene_change_detect, scd
  6223. Enable scene change detection using the value of the option @var{scene}.
  6224. This flag is enabled by default.
  6225. @end table
  6226. @end table
  6227. @section framestep
  6228. Select one frame every N-th frame.
  6229. This filter accepts the following option:
  6230. @table @option
  6231. @item step
  6232. Select frame after every @code{step} frames.
  6233. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6234. @end table
  6235. @anchor{frei0r}
  6236. @section frei0r
  6237. Apply a frei0r effect to the input video.
  6238. To enable the compilation of this filter, you need to install the frei0r
  6239. header and configure FFmpeg with @code{--enable-frei0r}.
  6240. It accepts the following parameters:
  6241. @table @option
  6242. @item filter_name
  6243. The name of the frei0r effect to load. If the environment variable
  6244. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6245. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6246. Otherwise, the standard frei0r paths are searched, in this order:
  6247. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6248. @file{/usr/lib/frei0r-1/}.
  6249. @item filter_params
  6250. A '|'-separated list of parameters to pass to the frei0r effect.
  6251. @end table
  6252. A frei0r effect parameter can be a boolean (its value is either
  6253. "y" or "n"), a double, a color (specified as
  6254. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6255. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6256. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6257. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6258. The number and types of parameters depend on the loaded effect. If an
  6259. effect parameter is not specified, the default value is set.
  6260. @subsection Examples
  6261. @itemize
  6262. @item
  6263. Apply the distort0r effect, setting the first two double parameters:
  6264. @example
  6265. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6266. @end example
  6267. @item
  6268. Apply the colordistance effect, taking a color as the first parameter:
  6269. @example
  6270. frei0r=colordistance:0.2/0.3/0.4
  6271. frei0r=colordistance:violet
  6272. frei0r=colordistance:0x112233
  6273. @end example
  6274. @item
  6275. Apply the perspective effect, specifying the top left and top right image
  6276. positions:
  6277. @example
  6278. frei0r=perspective:0.2/0.2|0.8/0.2
  6279. @end example
  6280. @end itemize
  6281. For more information, see
  6282. @url{http://frei0r.dyne.org}
  6283. @section fspp
  6284. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6285. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6286. processing filter, one of them is performed once per block, not per pixel.
  6287. This allows for much higher speed.
  6288. The filter accepts the following options:
  6289. @table @option
  6290. @item quality
  6291. Set quality. This option defines the number of levels for averaging. It accepts
  6292. an integer in the range 4-5. Default value is @code{4}.
  6293. @item qp
  6294. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6295. If not set, the filter will use the QP from the video stream (if available).
  6296. @item strength
  6297. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6298. more details but also more artifacts, while higher values make the image smoother
  6299. but also blurrier. Default value is @code{0} − PSNR optimal.
  6300. @item use_bframe_qp
  6301. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6302. option may cause flicker since the B-Frames have often larger QP. Default is
  6303. @code{0} (not enabled).
  6304. @end table
  6305. @section geq
  6306. The filter accepts the following options:
  6307. @table @option
  6308. @item lum_expr, lum
  6309. Set the luminance expression.
  6310. @item cb_expr, cb
  6311. Set the chrominance blue expression.
  6312. @item cr_expr, cr
  6313. Set the chrominance red expression.
  6314. @item alpha_expr, a
  6315. Set the alpha expression.
  6316. @item red_expr, r
  6317. Set the red expression.
  6318. @item green_expr, g
  6319. Set the green expression.
  6320. @item blue_expr, b
  6321. Set the blue expression.
  6322. @end table
  6323. The colorspace is selected according to the specified options. If one
  6324. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6325. options is specified, the filter will automatically select a YCbCr
  6326. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6327. @option{blue_expr} options is specified, it will select an RGB
  6328. colorspace.
  6329. If one of the chrominance expression is not defined, it falls back on the other
  6330. one. If no alpha expression is specified it will evaluate to opaque value.
  6331. If none of chrominance expressions are specified, they will evaluate
  6332. to the luminance expression.
  6333. The expressions can use the following variables and functions:
  6334. @table @option
  6335. @item N
  6336. The sequential number of the filtered frame, starting from @code{0}.
  6337. @item X
  6338. @item Y
  6339. The coordinates of the current sample.
  6340. @item W
  6341. @item H
  6342. The width and height of the image.
  6343. @item SW
  6344. @item SH
  6345. Width and height scale depending on the currently filtered plane. It is the
  6346. ratio between the corresponding luma plane number of pixels and the current
  6347. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6348. @code{0.5,0.5} for chroma planes.
  6349. @item T
  6350. Time of the current frame, expressed in seconds.
  6351. @item p(x, y)
  6352. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6353. plane.
  6354. @item lum(x, y)
  6355. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6356. plane.
  6357. @item cb(x, y)
  6358. Return the value of the pixel at location (@var{x},@var{y}) of the
  6359. blue-difference chroma plane. Return 0 if there is no such plane.
  6360. @item cr(x, y)
  6361. Return the value of the pixel at location (@var{x},@var{y}) of the
  6362. red-difference chroma plane. Return 0 if there is no such plane.
  6363. @item r(x, y)
  6364. @item g(x, y)
  6365. @item b(x, y)
  6366. Return the value of the pixel at location (@var{x},@var{y}) of the
  6367. red/green/blue component. Return 0 if there is no such component.
  6368. @item alpha(x, y)
  6369. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6370. plane. Return 0 if there is no such plane.
  6371. @end table
  6372. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6373. automatically clipped to the closer edge.
  6374. @subsection Examples
  6375. @itemize
  6376. @item
  6377. Flip the image horizontally:
  6378. @example
  6379. geq=p(W-X\,Y)
  6380. @end example
  6381. @item
  6382. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6383. wavelength of 100 pixels:
  6384. @example
  6385. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6386. @end example
  6387. @item
  6388. Generate a fancy enigmatic moving light:
  6389. @example
  6390. 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
  6391. @end example
  6392. @item
  6393. Generate a quick emboss effect:
  6394. @example
  6395. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6396. @end example
  6397. @item
  6398. Modify RGB components depending on pixel position:
  6399. @example
  6400. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6401. @end example
  6402. @item
  6403. Create a radial gradient that is the same size as the input (also see
  6404. the @ref{vignette} filter):
  6405. @example
  6406. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6407. @end example
  6408. @end itemize
  6409. @section gradfun
  6410. Fix the banding artifacts that are sometimes introduced into nearly flat
  6411. regions by truncation to 8-bit color depth.
  6412. Interpolate the gradients that should go where the bands are, and
  6413. dither them.
  6414. It is designed for playback only. Do not use it prior to
  6415. lossy compression, because compression tends to lose the dither and
  6416. bring back the bands.
  6417. It accepts the following parameters:
  6418. @table @option
  6419. @item strength
  6420. The maximum amount by which the filter will change any one pixel. This is also
  6421. the threshold for detecting nearly flat regions. Acceptable values range from
  6422. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6423. valid range.
  6424. @item radius
  6425. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6426. gradients, but also prevents the filter from modifying the pixels near detailed
  6427. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6428. values will be clipped to the valid range.
  6429. @end table
  6430. Alternatively, the options can be specified as a flat string:
  6431. @var{strength}[:@var{radius}]
  6432. @subsection Examples
  6433. @itemize
  6434. @item
  6435. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6436. @example
  6437. gradfun=3.5:8
  6438. @end example
  6439. @item
  6440. Specify radius, omitting the strength (which will fall-back to the default
  6441. value):
  6442. @example
  6443. gradfun=radius=8
  6444. @end example
  6445. @end itemize
  6446. @anchor{haldclut}
  6447. @section haldclut
  6448. Apply a Hald CLUT to a video stream.
  6449. First input is the video stream to process, and second one is the Hald CLUT.
  6450. The Hald CLUT input can be a simple picture or a complete video stream.
  6451. The filter accepts the following options:
  6452. @table @option
  6453. @item shortest
  6454. Force termination when the shortest input terminates. Default is @code{0}.
  6455. @item repeatlast
  6456. Continue applying the last CLUT after the end of the stream. A value of
  6457. @code{0} disable the filter after the last frame of the CLUT is reached.
  6458. Default is @code{1}.
  6459. @end table
  6460. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6461. filters share the same internals).
  6462. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6463. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6464. @subsection Workflow examples
  6465. @subsubsection Hald CLUT video stream
  6466. Generate an identity Hald CLUT stream altered with various effects:
  6467. @example
  6468. 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
  6469. @end example
  6470. Note: make sure you use a lossless codec.
  6471. Then use it with @code{haldclut} to apply it on some random stream:
  6472. @example
  6473. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6474. @end example
  6475. The Hald CLUT will be applied to the 10 first seconds (duration of
  6476. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6477. to the remaining frames of the @code{mandelbrot} stream.
  6478. @subsubsection Hald CLUT with preview
  6479. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6480. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6481. biggest possible square starting at the top left of the picture. The remaining
  6482. padding pixels (bottom or right) will be ignored. This area can be used to add
  6483. a preview of the Hald CLUT.
  6484. Typically, the following generated Hald CLUT will be supported by the
  6485. @code{haldclut} filter:
  6486. @example
  6487. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6488. pad=iw+320 [padded_clut];
  6489. smptebars=s=320x256, split [a][b];
  6490. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6491. [main][b] overlay=W-320" -frames:v 1 clut.png
  6492. @end example
  6493. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6494. bars are displayed on the right-top, and below the same color bars processed by
  6495. the color changes.
  6496. Then, the effect of this Hald CLUT can be visualized with:
  6497. @example
  6498. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6499. @end example
  6500. @section hdcd
  6501. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  6502. embedded HDCD codes is expanded into a 20-bit PCM stream.
  6503. The filter supports the Peak Extend and Low-level Gain Adjustment features
  6504. of HDCD, and detects the Transient Filter flag.
  6505. @example
  6506. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  6507. @end example
  6508. When using the filter with wav, note the default encoding for wav is 16-bit,
  6509. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  6510. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  6511. @example
  6512. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  6513. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  6514. @end example
  6515. @section hflip
  6516. Flip the input video horizontally.
  6517. For example, to horizontally flip the input video with @command{ffmpeg}:
  6518. @example
  6519. ffmpeg -i in.avi -vf "hflip" out.avi
  6520. @end example
  6521. @section histeq
  6522. This filter applies a global color histogram equalization on a
  6523. per-frame basis.
  6524. It can be used to correct video that has a compressed range of pixel
  6525. intensities. The filter redistributes the pixel intensities to
  6526. equalize their distribution across the intensity range. It may be
  6527. viewed as an "automatically adjusting contrast filter". This filter is
  6528. useful only for correcting degraded or poorly captured source
  6529. video.
  6530. The filter accepts the following options:
  6531. @table @option
  6532. @item strength
  6533. Determine the amount of equalization to be applied. As the strength
  6534. is reduced, the distribution of pixel intensities more-and-more
  6535. approaches that of the input frame. The value must be a float number
  6536. in the range [0,1] and defaults to 0.200.
  6537. @item intensity
  6538. Set the maximum intensity that can generated and scale the output
  6539. values appropriately. The strength should be set as desired and then
  6540. the intensity can be limited if needed to avoid washing-out. The value
  6541. must be a float number in the range [0,1] and defaults to 0.210.
  6542. @item antibanding
  6543. Set the antibanding level. If enabled the filter will randomly vary
  6544. the luminance of output pixels by a small amount to avoid banding of
  6545. the histogram. Possible values are @code{none}, @code{weak} or
  6546. @code{strong}. It defaults to @code{none}.
  6547. @end table
  6548. @section histogram
  6549. Compute and draw a color distribution histogram for the input video.
  6550. The computed histogram is a representation of the color component
  6551. distribution in an image.
  6552. Standard histogram displays the color components distribution in an image.
  6553. Displays color graph for each color component. Shows distribution of
  6554. the Y, U, V, A or R, G, B components, depending on input format, in the
  6555. current frame. Below each graph a color component scale meter is shown.
  6556. The filter accepts the following options:
  6557. @table @option
  6558. @item level_height
  6559. Set height of level. Default value is @code{200}.
  6560. Allowed range is [50, 2048].
  6561. @item scale_height
  6562. Set height of color scale. Default value is @code{12}.
  6563. Allowed range is [0, 40].
  6564. @item display_mode
  6565. Set display mode.
  6566. It accepts the following values:
  6567. @table @samp
  6568. @item parade
  6569. Per color component graphs are placed below each other.
  6570. @item overlay
  6571. Presents information identical to that in the @code{parade}, except
  6572. that the graphs representing color components are superimposed directly
  6573. over one another.
  6574. @end table
  6575. Default is @code{parade}.
  6576. @item levels_mode
  6577. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6578. Default is @code{linear}.
  6579. @item components
  6580. Set what color components to display.
  6581. Default is @code{7}.
  6582. @end table
  6583. @subsection Examples
  6584. @itemize
  6585. @item
  6586. Calculate and draw histogram:
  6587. @example
  6588. ffplay -i input -vf histogram
  6589. @end example
  6590. @end itemize
  6591. @anchor{hqdn3d}
  6592. @section hqdn3d
  6593. This is a high precision/quality 3d denoise filter. It aims to reduce
  6594. image noise, producing smooth images and making still images really
  6595. still. It should enhance compressibility.
  6596. It accepts the following optional parameters:
  6597. @table @option
  6598. @item luma_spatial
  6599. A non-negative floating point number which specifies spatial luma strength.
  6600. It defaults to 4.0.
  6601. @item chroma_spatial
  6602. A non-negative floating point number which specifies spatial chroma strength.
  6603. It defaults to 3.0*@var{luma_spatial}/4.0.
  6604. @item luma_tmp
  6605. A floating point number which specifies luma temporal strength. It defaults to
  6606. 6.0*@var{luma_spatial}/4.0.
  6607. @item chroma_tmp
  6608. A floating point number which specifies chroma temporal strength. It defaults to
  6609. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6610. @end table
  6611. @anchor{hwupload_cuda}
  6612. @section hwupload_cuda
  6613. Upload system memory frames to a CUDA device.
  6614. It accepts the following optional parameters:
  6615. @table @option
  6616. @item device
  6617. The number of the CUDA device to use
  6618. @end table
  6619. @section hqx
  6620. Apply a high-quality magnification filter designed for pixel art. This filter
  6621. was originally created by Maxim Stepin.
  6622. It accepts the following option:
  6623. @table @option
  6624. @item n
  6625. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6626. @code{hq3x} and @code{4} for @code{hq4x}.
  6627. Default is @code{3}.
  6628. @end table
  6629. @section hstack
  6630. Stack input videos horizontally.
  6631. All streams must be of same pixel format and of same height.
  6632. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6633. to create same output.
  6634. The filter accept the following option:
  6635. @table @option
  6636. @item inputs
  6637. Set number of input streams. Default is 2.
  6638. @item shortest
  6639. If set to 1, force the output to terminate when the shortest input
  6640. terminates. Default value is 0.
  6641. @end table
  6642. @section hue
  6643. Modify the hue and/or the saturation of the input.
  6644. It accepts the following parameters:
  6645. @table @option
  6646. @item h
  6647. Specify the hue angle as a number of degrees. It accepts an expression,
  6648. and defaults to "0".
  6649. @item s
  6650. Specify the saturation in the [-10,10] range. It accepts an expression and
  6651. defaults to "1".
  6652. @item H
  6653. Specify the hue angle as a number of radians. It accepts an
  6654. expression, and defaults to "0".
  6655. @item b
  6656. Specify the brightness in the [-10,10] range. It accepts an expression and
  6657. defaults to "0".
  6658. @end table
  6659. @option{h} and @option{H} are mutually exclusive, and can't be
  6660. specified at the same time.
  6661. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6662. expressions containing the following constants:
  6663. @table @option
  6664. @item n
  6665. frame count of the input frame starting from 0
  6666. @item pts
  6667. presentation timestamp of the input frame expressed in time base units
  6668. @item r
  6669. frame rate of the input video, NAN if the input frame rate is unknown
  6670. @item t
  6671. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6672. @item tb
  6673. time base of the input video
  6674. @end table
  6675. @subsection Examples
  6676. @itemize
  6677. @item
  6678. Set the hue to 90 degrees and the saturation to 1.0:
  6679. @example
  6680. hue=h=90:s=1
  6681. @end example
  6682. @item
  6683. Same command but expressing the hue in radians:
  6684. @example
  6685. hue=H=PI/2:s=1
  6686. @end example
  6687. @item
  6688. Rotate hue and make the saturation swing between 0
  6689. and 2 over a period of 1 second:
  6690. @example
  6691. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6692. @end example
  6693. @item
  6694. Apply a 3 seconds saturation fade-in effect starting at 0:
  6695. @example
  6696. hue="s=min(t/3\,1)"
  6697. @end example
  6698. The general fade-in expression can be written as:
  6699. @example
  6700. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6701. @end example
  6702. @item
  6703. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6704. @example
  6705. hue="s=max(0\, min(1\, (8-t)/3))"
  6706. @end example
  6707. The general fade-out expression can be written as:
  6708. @example
  6709. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6710. @end example
  6711. @end itemize
  6712. @subsection Commands
  6713. This filter supports the following commands:
  6714. @table @option
  6715. @item b
  6716. @item s
  6717. @item h
  6718. @item H
  6719. Modify the hue and/or the saturation and/or brightness of the input video.
  6720. The command accepts the same syntax of the corresponding option.
  6721. If the specified expression is not valid, it is kept at its current
  6722. value.
  6723. @end table
  6724. @section idet
  6725. Detect video interlacing type.
  6726. This filter tries to detect if the input frames as interlaced, progressive,
  6727. top or bottom field first. It will also try and detect fields that are
  6728. repeated between adjacent frames (a sign of telecine).
  6729. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6730. Multiple frame detection incorporates the classification history of previous frames.
  6731. The filter will log these metadata values:
  6732. @table @option
  6733. @item single.current_frame
  6734. Detected type of current frame using single-frame detection. One of:
  6735. ``tff'' (top field first), ``bff'' (bottom field first),
  6736. ``progressive'', or ``undetermined''
  6737. @item single.tff
  6738. Cumulative number of frames detected as top field first using single-frame detection.
  6739. @item multiple.tff
  6740. Cumulative number of frames detected as top field first using multiple-frame detection.
  6741. @item single.bff
  6742. Cumulative number of frames detected as bottom field first using single-frame detection.
  6743. @item multiple.current_frame
  6744. Detected type of current frame using multiple-frame detection. One of:
  6745. ``tff'' (top field first), ``bff'' (bottom field first),
  6746. ``progressive'', or ``undetermined''
  6747. @item multiple.bff
  6748. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6749. @item single.progressive
  6750. Cumulative number of frames detected as progressive using single-frame detection.
  6751. @item multiple.progressive
  6752. Cumulative number of frames detected as progressive using multiple-frame detection.
  6753. @item single.undetermined
  6754. Cumulative number of frames that could not be classified using single-frame detection.
  6755. @item multiple.undetermined
  6756. Cumulative number of frames that could not be classified using multiple-frame detection.
  6757. @item repeated.current_frame
  6758. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6759. @item repeated.neither
  6760. Cumulative number of frames with no repeated field.
  6761. @item repeated.top
  6762. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6763. @item repeated.bottom
  6764. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6765. @end table
  6766. The filter accepts the following options:
  6767. @table @option
  6768. @item intl_thres
  6769. Set interlacing threshold.
  6770. @item prog_thres
  6771. Set progressive threshold.
  6772. @item rep_thres
  6773. Threshold for repeated field detection.
  6774. @item half_life
  6775. Number of frames after which a given frame's contribution to the
  6776. statistics is halved (i.e., it contributes only 0.5 to it's
  6777. classification). The default of 0 means that all frames seen are given
  6778. full weight of 1.0 forever.
  6779. @item analyze_interlaced_flag
  6780. When this is not 0 then idet will use the specified number of frames to determine
  6781. if the interlaced flag is accurate, it will not count undetermined frames.
  6782. If the flag is found to be accurate it will be used without any further
  6783. computations, if it is found to be inaccurate it will be cleared without any
  6784. further computations. This allows inserting the idet filter as a low computational
  6785. method to clean up the interlaced flag
  6786. @end table
  6787. @section il
  6788. Deinterleave or interleave fields.
  6789. This filter allows one to process interlaced images fields without
  6790. deinterlacing them. Deinterleaving splits the input frame into 2
  6791. fields (so called half pictures). Odd lines are moved to the top
  6792. half of the output image, even lines to the bottom half.
  6793. You can process (filter) them independently and then re-interleave them.
  6794. The filter accepts the following options:
  6795. @table @option
  6796. @item luma_mode, l
  6797. @item chroma_mode, c
  6798. @item alpha_mode, a
  6799. Available values for @var{luma_mode}, @var{chroma_mode} and
  6800. @var{alpha_mode} are:
  6801. @table @samp
  6802. @item none
  6803. Do nothing.
  6804. @item deinterleave, d
  6805. Deinterleave fields, placing one above the other.
  6806. @item interleave, i
  6807. Interleave fields. Reverse the effect of deinterleaving.
  6808. @end table
  6809. Default value is @code{none}.
  6810. @item luma_swap, ls
  6811. @item chroma_swap, cs
  6812. @item alpha_swap, as
  6813. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6814. @end table
  6815. @section inflate
  6816. Apply inflate effect to the video.
  6817. This filter replaces the pixel by the local(3x3) average by taking into account
  6818. only values higher than the pixel.
  6819. It accepts the following options:
  6820. @table @option
  6821. @item threshold0
  6822. @item threshold1
  6823. @item threshold2
  6824. @item threshold3
  6825. Limit the maximum change for each plane, default is 65535.
  6826. If 0, plane will remain unchanged.
  6827. @end table
  6828. @section interlace
  6829. Simple interlacing filter from progressive contents. This interleaves upper (or
  6830. lower) lines from odd frames with lower (or upper) lines from even frames,
  6831. halving the frame rate and preserving image height.
  6832. @example
  6833. Original Original New Frame
  6834. Frame 'j' Frame 'j+1' (tff)
  6835. ========== =========== ==================
  6836. Line 0 --------------------> Frame 'j' Line 0
  6837. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6838. Line 2 ---------------------> Frame 'j' Line 2
  6839. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6840. ... ... ...
  6841. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6842. @end example
  6843. It accepts the following optional parameters:
  6844. @table @option
  6845. @item scan
  6846. This determines whether the interlaced frame is taken from the even
  6847. (tff - default) or odd (bff) lines of the progressive frame.
  6848. @item lowpass
  6849. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6850. interlacing and reduce moire patterns.
  6851. @end table
  6852. @section kerndeint
  6853. Deinterlace input video by applying Donald Graft's adaptive kernel
  6854. deinterling. Work on interlaced parts of a video to produce
  6855. progressive frames.
  6856. The description of the accepted parameters follows.
  6857. @table @option
  6858. @item thresh
  6859. Set the threshold which affects the filter's tolerance when
  6860. determining if a pixel line must be processed. It must be an integer
  6861. in the range [0,255] and defaults to 10. A value of 0 will result in
  6862. applying the process on every pixels.
  6863. @item map
  6864. Paint pixels exceeding the threshold value to white if set to 1.
  6865. Default is 0.
  6866. @item order
  6867. Set the fields order. Swap fields if set to 1, leave fields alone if
  6868. 0. Default is 0.
  6869. @item sharp
  6870. Enable additional sharpening if set to 1. Default is 0.
  6871. @item twoway
  6872. Enable twoway sharpening if set to 1. Default is 0.
  6873. @end table
  6874. @subsection Examples
  6875. @itemize
  6876. @item
  6877. Apply default values:
  6878. @example
  6879. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6880. @end example
  6881. @item
  6882. Enable additional sharpening:
  6883. @example
  6884. kerndeint=sharp=1
  6885. @end example
  6886. @item
  6887. Paint processed pixels in white:
  6888. @example
  6889. kerndeint=map=1
  6890. @end example
  6891. @end itemize
  6892. @section lenscorrection
  6893. Correct radial lens distortion
  6894. This filter can be used to correct for radial distortion as can result from the use
  6895. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6896. one can use tools available for example as part of opencv or simply trial-and-error.
  6897. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6898. and extract the k1 and k2 coefficients from the resulting matrix.
  6899. Note that effectively the same filter is available in the open-source tools Krita and
  6900. Digikam from the KDE project.
  6901. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6902. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6903. brightness distribution, so you may want to use both filters together in certain
  6904. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6905. be applied before or after lens correction.
  6906. @subsection Options
  6907. The filter accepts the following options:
  6908. @table @option
  6909. @item cx
  6910. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6911. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6912. width.
  6913. @item cy
  6914. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6915. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6916. height.
  6917. @item k1
  6918. Coefficient of the quadratic correction term. 0.5 means no correction.
  6919. @item k2
  6920. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6921. @end table
  6922. The formula that generates the correction is:
  6923. @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)
  6924. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6925. distances from the focal point in the source and target images, respectively.
  6926. @section loop, aloop
  6927. Loop video frames or audio samples.
  6928. Those filters accepts the following options:
  6929. @table @option
  6930. @item loop
  6931. Set the number of loops.
  6932. @item size
  6933. Set maximal size in number of frames for @code{loop} filter or maximal number
  6934. of samples in case of @code{aloop} filter.
  6935. @item start
  6936. Set first frame of loop for @code{loop} filter or first sample of loop in case
  6937. of @code{aloop} filter.
  6938. @end table
  6939. @anchor{lut3d}
  6940. @section lut3d
  6941. Apply a 3D LUT to an input video.
  6942. The filter accepts the following options:
  6943. @table @option
  6944. @item file
  6945. Set the 3D LUT file name.
  6946. Currently supported formats:
  6947. @table @samp
  6948. @item 3dl
  6949. AfterEffects
  6950. @item cube
  6951. Iridas
  6952. @item dat
  6953. DaVinci
  6954. @item m3d
  6955. Pandora
  6956. @end table
  6957. @item interp
  6958. Select interpolation mode.
  6959. Available values are:
  6960. @table @samp
  6961. @item nearest
  6962. Use values from the nearest defined point.
  6963. @item trilinear
  6964. Interpolate values using the 8 points defining a cube.
  6965. @item tetrahedral
  6966. Interpolate values using a tetrahedron.
  6967. @end table
  6968. @end table
  6969. @section lut, lutrgb, lutyuv
  6970. Compute a look-up table for binding each pixel component input value
  6971. to an output value, and apply it to the input video.
  6972. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6973. to an RGB input video.
  6974. These filters accept the following parameters:
  6975. @table @option
  6976. @item c0
  6977. set first pixel component expression
  6978. @item c1
  6979. set second pixel component expression
  6980. @item c2
  6981. set third pixel component expression
  6982. @item c3
  6983. set fourth pixel component expression, corresponds to the alpha component
  6984. @item r
  6985. set red component expression
  6986. @item g
  6987. set green component expression
  6988. @item b
  6989. set blue component expression
  6990. @item a
  6991. alpha component expression
  6992. @item y
  6993. set Y/luminance component expression
  6994. @item u
  6995. set U/Cb component expression
  6996. @item v
  6997. set V/Cr component expression
  6998. @end table
  6999. Each of them specifies the expression to use for computing the lookup table for
  7000. the corresponding pixel component values.
  7001. The exact component associated to each of the @var{c*} options depends on the
  7002. format in input.
  7003. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7004. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7005. The expressions can contain the following constants and functions:
  7006. @table @option
  7007. @item w
  7008. @item h
  7009. The input width and height.
  7010. @item val
  7011. The input value for the pixel component.
  7012. @item clipval
  7013. The input value, clipped to the @var{minval}-@var{maxval} range.
  7014. @item maxval
  7015. The maximum value for the pixel component.
  7016. @item minval
  7017. The minimum value for the pixel component.
  7018. @item negval
  7019. The negated value for the pixel component value, clipped to the
  7020. @var{minval}-@var{maxval} range; it corresponds to the expression
  7021. "maxval-clipval+minval".
  7022. @item clip(val)
  7023. The computed value in @var{val}, clipped to the
  7024. @var{minval}-@var{maxval} range.
  7025. @item gammaval(gamma)
  7026. The computed gamma correction value of the pixel component value,
  7027. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7028. expression
  7029. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7030. @end table
  7031. All expressions default to "val".
  7032. @subsection Examples
  7033. @itemize
  7034. @item
  7035. Negate input video:
  7036. @example
  7037. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7038. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7039. @end example
  7040. The above is the same as:
  7041. @example
  7042. lutrgb="r=negval:g=negval:b=negval"
  7043. lutyuv="y=negval:u=negval:v=negval"
  7044. @end example
  7045. @item
  7046. Negate luminance:
  7047. @example
  7048. lutyuv=y=negval
  7049. @end example
  7050. @item
  7051. Remove chroma components, turning the video into a graytone image:
  7052. @example
  7053. lutyuv="u=128:v=128"
  7054. @end example
  7055. @item
  7056. Apply a luma burning effect:
  7057. @example
  7058. lutyuv="y=2*val"
  7059. @end example
  7060. @item
  7061. Remove green and blue components:
  7062. @example
  7063. lutrgb="g=0:b=0"
  7064. @end example
  7065. @item
  7066. Set a constant alpha channel value on input:
  7067. @example
  7068. format=rgba,lutrgb=a="maxval-minval/2"
  7069. @end example
  7070. @item
  7071. Correct luminance gamma by a factor of 0.5:
  7072. @example
  7073. lutyuv=y=gammaval(0.5)
  7074. @end example
  7075. @item
  7076. Discard least significant bits of luma:
  7077. @example
  7078. lutyuv=y='bitand(val, 128+64+32)'
  7079. @end example
  7080. @end itemize
  7081. @section maskedmerge
  7082. Merge the first input stream with the second input stream using per pixel
  7083. weights in the third input stream.
  7084. A value of 0 in the third stream pixel component means that pixel component
  7085. from first stream is returned unchanged, while maximum value (eg. 255 for
  7086. 8-bit videos) means that pixel component from second stream is returned
  7087. unchanged. Intermediate values define the amount of merging between both
  7088. input stream's pixel components.
  7089. This filter accepts the following options:
  7090. @table @option
  7091. @item planes
  7092. Set which planes will be processed as bitmap, unprocessed planes will be
  7093. copied from first stream.
  7094. By default value 0xf, all planes will be processed.
  7095. @end table
  7096. @section mcdeint
  7097. Apply motion-compensation deinterlacing.
  7098. It needs one field per frame as input and must thus be used together
  7099. with yadif=1/3 or equivalent.
  7100. This filter accepts the following options:
  7101. @table @option
  7102. @item mode
  7103. Set the deinterlacing mode.
  7104. It accepts one of the following values:
  7105. @table @samp
  7106. @item fast
  7107. @item medium
  7108. @item slow
  7109. use iterative motion estimation
  7110. @item extra_slow
  7111. like @samp{slow}, but use multiple reference frames.
  7112. @end table
  7113. Default value is @samp{fast}.
  7114. @item parity
  7115. Set the picture field parity assumed for the input video. It must be
  7116. one of the following values:
  7117. @table @samp
  7118. @item 0, tff
  7119. assume top field first
  7120. @item 1, bff
  7121. assume bottom field first
  7122. @end table
  7123. Default value is @samp{bff}.
  7124. @item qp
  7125. Set per-block quantization parameter (QP) used by the internal
  7126. encoder.
  7127. Higher values should result in a smoother motion vector field but less
  7128. optimal individual vectors. Default value is 1.
  7129. @end table
  7130. @section mergeplanes
  7131. Merge color channel components from several video streams.
  7132. The filter accepts up to 4 input streams, and merge selected input
  7133. planes to the output video.
  7134. This filter accepts the following options:
  7135. @table @option
  7136. @item mapping
  7137. Set input to output plane mapping. Default is @code{0}.
  7138. The mappings is specified as a bitmap. It should be specified as a
  7139. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7140. mapping for the first plane of the output stream. 'A' sets the number of
  7141. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7142. corresponding input to use (from 0 to 3). The rest of the mappings is
  7143. similar, 'Bb' describes the mapping for the output stream second
  7144. plane, 'Cc' describes the mapping for the output stream third plane and
  7145. 'Dd' describes the mapping for the output stream fourth plane.
  7146. @item format
  7147. Set output pixel format. Default is @code{yuva444p}.
  7148. @end table
  7149. @subsection Examples
  7150. @itemize
  7151. @item
  7152. Merge three gray video streams of same width and height into single video stream:
  7153. @example
  7154. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7155. @end example
  7156. @item
  7157. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7158. @example
  7159. [a0][a1]mergeplanes=0x00010210:yuva444p
  7160. @end example
  7161. @item
  7162. Swap Y and A plane in yuva444p stream:
  7163. @example
  7164. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7165. @end example
  7166. @item
  7167. Swap U and V plane in yuv420p stream:
  7168. @example
  7169. format=yuv420p,mergeplanes=0x000201:yuv420p
  7170. @end example
  7171. @item
  7172. Cast a rgb24 clip to yuv444p:
  7173. @example
  7174. format=rgb24,mergeplanes=0x000102:yuv444p
  7175. @end example
  7176. @end itemize
  7177. @section metadata, ametadata
  7178. Manipulate frame metadata.
  7179. This filter accepts the following options:
  7180. @table @option
  7181. @item mode
  7182. Set mode of operation of the filter.
  7183. Can be one of the following:
  7184. @table @samp
  7185. @item select
  7186. If both @code{value} and @code{key} is set, select frames
  7187. which have such metadata. If only @code{key} is set, select
  7188. every frame that has such key in metadata.
  7189. @item add
  7190. Add new metadata @code{key} and @code{value}. If key is already available
  7191. do nothing.
  7192. @item modify
  7193. Modify value of already present key.
  7194. @item delete
  7195. If @code{value} is set, delete only keys that have such value.
  7196. Otherwise, delete key.
  7197. @item print
  7198. Print key and its value if metadata was found. If @code{key} is not set print all
  7199. metadata values available in frame.
  7200. @end table
  7201. @item key
  7202. Set key used with all modes. Must be set for all modes except @code{print}.
  7203. @item value
  7204. Set metadata value which will be used. This option is mandatory for
  7205. @code{modify} and @code{add} mode.
  7206. @item function
  7207. Which function to use when comparing metadata value and @code{value}.
  7208. Can be one of following:
  7209. @table @samp
  7210. @item same_str
  7211. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  7212. @item starts_with
  7213. Values are interpreted as strings, returns true if metadata value starts with
  7214. the @code{value} option string.
  7215. @item less
  7216. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  7217. @item equal
  7218. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  7219. @item greater
  7220. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  7221. @item expr
  7222. Values are interpreted as floats, returns true if expression from option @code{expr}
  7223. evaluates to true.
  7224. @end table
  7225. @item expr
  7226. Set expression which is used when @code{function} is set to @code{expr}.
  7227. The expression is evaluated through the eval API and can contain the following
  7228. constants:
  7229. @table @option
  7230. @item VALUE1
  7231. Float representation of @code{value} from metadata key.
  7232. @item VALUE2
  7233. Float representation of @code{value} as supplied by user in @code{value} option.
  7234. @item file
  7235. If specified in @code{print} mode, output is written to the named file. Instead of
  7236. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  7237. for standard output. If @code{file} option is not set, output is written to the log
  7238. with AV_LOG_INFO loglevel.
  7239. @end table
  7240. @end table
  7241. @subsection Examples
  7242. @itemize
  7243. @item
  7244. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  7245. between 0 and 1.
  7246. @example
  7247. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  7248. @end example
  7249. @item
  7250. Print silencedetect output to file @file{metadata.txt}.
  7251. @example
  7252. silencedetect,ametadata=mode=print:file=metadata.txt
  7253. @end example
  7254. @item
  7255. Direct all metadata to a pipe with file descriptor 4.
  7256. @example
  7257. metadata=mode=print:file='pipe\:4'
  7258. @end example
  7259. @end itemize
  7260. @section mpdecimate
  7261. Drop frames that do not differ greatly from the previous frame in
  7262. order to reduce frame rate.
  7263. The main use of this filter is for very-low-bitrate encoding
  7264. (e.g. streaming over dialup modem), but it could in theory be used for
  7265. fixing movies that were inverse-telecined incorrectly.
  7266. A description of the accepted options follows.
  7267. @table @option
  7268. @item max
  7269. Set the maximum number of consecutive frames which can be dropped (if
  7270. positive), or the minimum interval between dropped frames (if
  7271. negative). If the value is 0, the frame is dropped unregarding the
  7272. number of previous sequentially dropped frames.
  7273. Default value is 0.
  7274. @item hi
  7275. @item lo
  7276. @item frac
  7277. Set the dropping threshold values.
  7278. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7279. represent actual pixel value differences, so a threshold of 64
  7280. corresponds to 1 unit of difference for each pixel, or the same spread
  7281. out differently over the block.
  7282. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7283. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7284. meaning the whole image) differ by more than a threshold of @option{lo}.
  7285. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7286. 64*5, and default value for @option{frac} is 0.33.
  7287. @end table
  7288. @section negate
  7289. Negate input video.
  7290. It accepts an integer in input; if non-zero it negates the
  7291. alpha component (if available). The default value in input is 0.
  7292. @section nnedi
  7293. Deinterlace video using neural network edge directed interpolation.
  7294. This filter accepts the following options:
  7295. @table @option
  7296. @item weights
  7297. Mandatory option, without binary file filter can not work.
  7298. Currently file can be found here:
  7299. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7300. @item deint
  7301. Set which frames to deinterlace, by default it is @code{all}.
  7302. Can be @code{all} or @code{interlaced}.
  7303. @item field
  7304. Set mode of operation.
  7305. Can be one of the following:
  7306. @table @samp
  7307. @item af
  7308. Use frame flags, both fields.
  7309. @item a
  7310. Use frame flags, single field.
  7311. @item t
  7312. Use top field only.
  7313. @item b
  7314. Use bottom field only.
  7315. @item tf
  7316. Use both fields, top first.
  7317. @item bf
  7318. Use both fields, bottom first.
  7319. @end table
  7320. @item planes
  7321. Set which planes to process, by default filter process all frames.
  7322. @item nsize
  7323. Set size of local neighborhood around each pixel, used by the predictor neural
  7324. network.
  7325. Can be one of the following:
  7326. @table @samp
  7327. @item s8x6
  7328. @item s16x6
  7329. @item s32x6
  7330. @item s48x6
  7331. @item s8x4
  7332. @item s16x4
  7333. @item s32x4
  7334. @end table
  7335. @item nns
  7336. Set the number of neurons in predicctor neural network.
  7337. Can be one of the following:
  7338. @table @samp
  7339. @item n16
  7340. @item n32
  7341. @item n64
  7342. @item n128
  7343. @item n256
  7344. @end table
  7345. @item qual
  7346. Controls the number of different neural network predictions that are blended
  7347. together to compute the final output value. Can be @code{fast}, default or
  7348. @code{slow}.
  7349. @item etype
  7350. Set which set of weights to use in the predictor.
  7351. Can be one of the following:
  7352. @table @samp
  7353. @item a
  7354. weights trained to minimize absolute error
  7355. @item s
  7356. weights trained to minimize squared error
  7357. @end table
  7358. @item pscrn
  7359. Controls whether or not the prescreener neural network is used to decide
  7360. which pixels should be processed by the predictor neural network and which
  7361. can be handled by simple cubic interpolation.
  7362. The prescreener is trained to know whether cubic interpolation will be
  7363. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7364. The computational complexity of the prescreener nn is much less than that of
  7365. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7366. using the prescreener generally results in much faster processing.
  7367. The prescreener is pretty accurate, so the difference between using it and not
  7368. using it is almost always unnoticeable.
  7369. Can be one of the following:
  7370. @table @samp
  7371. @item none
  7372. @item original
  7373. @item new
  7374. @end table
  7375. Default is @code{new}.
  7376. @item fapprox
  7377. Set various debugging flags.
  7378. @end table
  7379. @section noformat
  7380. Force libavfilter not to use any of the specified pixel formats for the
  7381. input to the next filter.
  7382. It accepts the following parameters:
  7383. @table @option
  7384. @item pix_fmts
  7385. A '|'-separated list of pixel format names, such as
  7386. apix_fmts=yuv420p|monow|rgb24".
  7387. @end table
  7388. @subsection Examples
  7389. @itemize
  7390. @item
  7391. Force libavfilter to use a format different from @var{yuv420p} for the
  7392. input to the vflip filter:
  7393. @example
  7394. noformat=pix_fmts=yuv420p,vflip
  7395. @end example
  7396. @item
  7397. Convert the input video to any of the formats not contained in the list:
  7398. @example
  7399. noformat=yuv420p|yuv444p|yuv410p
  7400. @end example
  7401. @end itemize
  7402. @section noise
  7403. Add noise on video input frame.
  7404. The filter accepts the following options:
  7405. @table @option
  7406. @item all_seed
  7407. @item c0_seed
  7408. @item c1_seed
  7409. @item c2_seed
  7410. @item c3_seed
  7411. Set noise seed for specific pixel component or all pixel components in case
  7412. of @var{all_seed}. Default value is @code{123457}.
  7413. @item all_strength, alls
  7414. @item c0_strength, c0s
  7415. @item c1_strength, c1s
  7416. @item c2_strength, c2s
  7417. @item c3_strength, c3s
  7418. Set noise strength for specific pixel component or all pixel components in case
  7419. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7420. @item all_flags, allf
  7421. @item c0_flags, c0f
  7422. @item c1_flags, c1f
  7423. @item c2_flags, c2f
  7424. @item c3_flags, c3f
  7425. Set pixel component flags or set flags for all components if @var{all_flags}.
  7426. Available values for component flags are:
  7427. @table @samp
  7428. @item a
  7429. averaged temporal noise (smoother)
  7430. @item p
  7431. mix random noise with a (semi)regular pattern
  7432. @item t
  7433. temporal noise (noise pattern changes between frames)
  7434. @item u
  7435. uniform noise (gaussian otherwise)
  7436. @end table
  7437. @end table
  7438. @subsection Examples
  7439. Add temporal and uniform noise to input video:
  7440. @example
  7441. noise=alls=20:allf=t+u
  7442. @end example
  7443. @section null
  7444. Pass the video source unchanged to the output.
  7445. @section ocr
  7446. Optical Character Recognition
  7447. This filter uses Tesseract for optical character recognition.
  7448. It accepts the following options:
  7449. @table @option
  7450. @item datapath
  7451. Set datapath to tesseract data. Default is to use whatever was
  7452. set at installation.
  7453. @item language
  7454. Set language, default is "eng".
  7455. @item whitelist
  7456. Set character whitelist.
  7457. @item blacklist
  7458. Set character blacklist.
  7459. @end table
  7460. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7461. @section ocv
  7462. Apply a video transform using libopencv.
  7463. To enable this filter, install the libopencv library and headers and
  7464. configure FFmpeg with @code{--enable-libopencv}.
  7465. It accepts the following parameters:
  7466. @table @option
  7467. @item filter_name
  7468. The name of the libopencv filter to apply.
  7469. @item filter_params
  7470. The parameters to pass to the libopencv filter. If not specified, the default
  7471. values are assumed.
  7472. @end table
  7473. Refer to the official libopencv documentation for more precise
  7474. information:
  7475. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7476. Several libopencv filters are supported; see the following subsections.
  7477. @anchor{dilate}
  7478. @subsection dilate
  7479. Dilate an image by using a specific structuring element.
  7480. It corresponds to the libopencv function @code{cvDilate}.
  7481. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7482. @var{struct_el} represents a structuring element, and has the syntax:
  7483. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7484. @var{cols} and @var{rows} represent the number of columns and rows of
  7485. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7486. point, and @var{shape} the shape for the structuring element. @var{shape}
  7487. must be "rect", "cross", "ellipse", or "custom".
  7488. If the value for @var{shape} is "custom", it must be followed by a
  7489. string of the form "=@var{filename}". The file with name
  7490. @var{filename} is assumed to represent a binary image, with each
  7491. printable character corresponding to a bright pixel. When a custom
  7492. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7493. or columns and rows of the read file are assumed instead.
  7494. The default value for @var{struct_el} is "3x3+0x0/rect".
  7495. @var{nb_iterations} specifies the number of times the transform is
  7496. applied to the image, and defaults to 1.
  7497. Some examples:
  7498. @example
  7499. # Use the default values
  7500. ocv=dilate
  7501. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7502. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7503. # Read the shape from the file diamond.shape, iterating two times.
  7504. # The file diamond.shape may contain a pattern of characters like this
  7505. # *
  7506. # ***
  7507. # *****
  7508. # ***
  7509. # *
  7510. # The specified columns and rows are ignored
  7511. # but the anchor point coordinates are not
  7512. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7513. @end example
  7514. @subsection erode
  7515. Erode an image by using a specific structuring element.
  7516. It corresponds to the libopencv function @code{cvErode}.
  7517. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7518. with the same syntax and semantics as the @ref{dilate} filter.
  7519. @subsection smooth
  7520. Smooth the input video.
  7521. The filter takes the following parameters:
  7522. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7523. @var{type} is the type of smooth filter to apply, and must be one of
  7524. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7525. or "bilateral". The default value is "gaussian".
  7526. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7527. depend on the smooth type. @var{param1} and
  7528. @var{param2} accept integer positive values or 0. @var{param3} and
  7529. @var{param4} accept floating point values.
  7530. The default value for @var{param1} is 3. The default value for the
  7531. other parameters is 0.
  7532. These parameters correspond to the parameters assigned to the
  7533. libopencv function @code{cvSmooth}.
  7534. @anchor{overlay}
  7535. @section overlay
  7536. Overlay one video on top of another.
  7537. It takes two inputs and has one output. The first input is the "main"
  7538. video on which the second input is overlaid.
  7539. It accepts the following parameters:
  7540. A description of the accepted options follows.
  7541. @table @option
  7542. @item x
  7543. @item y
  7544. Set the expression for the x and y coordinates of the overlaid video
  7545. on the main video. Default value is "0" for both expressions. In case
  7546. the expression is invalid, it is set to a huge value (meaning that the
  7547. overlay will not be displayed within the output visible area).
  7548. @item eof_action
  7549. The action to take when EOF is encountered on the secondary input; it accepts
  7550. one of the following values:
  7551. @table @option
  7552. @item repeat
  7553. Repeat the last frame (the default).
  7554. @item endall
  7555. End both streams.
  7556. @item pass
  7557. Pass the main input through.
  7558. @end table
  7559. @item eval
  7560. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7561. It accepts the following values:
  7562. @table @samp
  7563. @item init
  7564. only evaluate expressions once during the filter initialization or
  7565. when a command is processed
  7566. @item frame
  7567. evaluate expressions for each incoming frame
  7568. @end table
  7569. Default value is @samp{frame}.
  7570. @item shortest
  7571. If set to 1, force the output to terminate when the shortest input
  7572. terminates. Default value is 0.
  7573. @item format
  7574. Set the format for the output video.
  7575. It accepts the following values:
  7576. @table @samp
  7577. @item yuv420
  7578. force YUV420 output
  7579. @item yuv422
  7580. force YUV422 output
  7581. @item yuv444
  7582. force YUV444 output
  7583. @item rgb
  7584. force RGB output
  7585. @end table
  7586. Default value is @samp{yuv420}.
  7587. @item rgb @emph{(deprecated)}
  7588. If set to 1, force the filter to accept inputs in the RGB
  7589. color space. Default value is 0. This option is deprecated, use
  7590. @option{format} instead.
  7591. @item repeatlast
  7592. If set to 1, force the filter to draw the last overlay frame over the
  7593. main input until the end of the stream. A value of 0 disables this
  7594. behavior. Default value is 1.
  7595. @end table
  7596. The @option{x}, and @option{y} expressions can contain the following
  7597. parameters.
  7598. @table @option
  7599. @item main_w, W
  7600. @item main_h, H
  7601. The main input width and height.
  7602. @item overlay_w, w
  7603. @item overlay_h, h
  7604. The overlay input width and height.
  7605. @item x
  7606. @item y
  7607. The computed values for @var{x} and @var{y}. They are evaluated for
  7608. each new frame.
  7609. @item hsub
  7610. @item vsub
  7611. horizontal and vertical chroma subsample values of the output
  7612. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7613. @var{vsub} is 1.
  7614. @item n
  7615. the number of input frame, starting from 0
  7616. @item pos
  7617. the position in the file of the input frame, NAN if unknown
  7618. @item t
  7619. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7620. @end table
  7621. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7622. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7623. when @option{eval} is set to @samp{init}.
  7624. Be aware that frames are taken from each input video in timestamp
  7625. order, hence, if their initial timestamps differ, it is a good idea
  7626. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7627. have them begin in the same zero timestamp, as the example for
  7628. the @var{movie} filter does.
  7629. You can chain together more overlays but you should test the
  7630. efficiency of such approach.
  7631. @subsection Commands
  7632. This filter supports the following commands:
  7633. @table @option
  7634. @item x
  7635. @item y
  7636. Modify the x and y of the overlay input.
  7637. The command accepts the same syntax of the corresponding option.
  7638. If the specified expression is not valid, it is kept at its current
  7639. value.
  7640. @end table
  7641. @subsection Examples
  7642. @itemize
  7643. @item
  7644. Draw the overlay at 10 pixels from the bottom right corner of the main
  7645. video:
  7646. @example
  7647. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7648. @end example
  7649. Using named options the example above becomes:
  7650. @example
  7651. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7652. @end example
  7653. @item
  7654. Insert a transparent PNG logo in the bottom left corner of the input,
  7655. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7656. @example
  7657. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7658. @end example
  7659. @item
  7660. Insert 2 different transparent PNG logos (second logo on bottom
  7661. right corner) using the @command{ffmpeg} tool:
  7662. @example
  7663. 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
  7664. @end example
  7665. @item
  7666. Add a transparent color layer on top of the main video; @code{WxH}
  7667. must specify the size of the main input to the overlay filter:
  7668. @example
  7669. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7670. @end example
  7671. @item
  7672. Play an original video and a filtered version (here with the deshake
  7673. filter) side by side using the @command{ffplay} tool:
  7674. @example
  7675. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7676. @end example
  7677. The above command is the same as:
  7678. @example
  7679. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7680. @end example
  7681. @item
  7682. Make a sliding overlay appearing from the left to the right top part of the
  7683. screen starting since time 2:
  7684. @example
  7685. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7686. @end example
  7687. @item
  7688. Compose output by putting two input videos side to side:
  7689. @example
  7690. ffmpeg -i left.avi -i right.avi -filter_complex "
  7691. nullsrc=size=200x100 [background];
  7692. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7693. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7694. [background][left] overlay=shortest=1 [background+left];
  7695. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7696. "
  7697. @end example
  7698. @item
  7699. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7700. @example
  7701. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7702. -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]'
  7703. masked.avi
  7704. @end example
  7705. @item
  7706. Chain several overlays in cascade:
  7707. @example
  7708. nullsrc=s=200x200 [bg];
  7709. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7710. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7711. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7712. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7713. [in3] null, [mid2] overlay=100:100 [out0]
  7714. @end example
  7715. @end itemize
  7716. @section owdenoise
  7717. Apply Overcomplete Wavelet denoiser.
  7718. The filter accepts the following options:
  7719. @table @option
  7720. @item depth
  7721. Set depth.
  7722. Larger depth values will denoise lower frequency components more, but
  7723. slow down filtering.
  7724. Must be an int in the range 8-16, default is @code{8}.
  7725. @item luma_strength, ls
  7726. Set luma strength.
  7727. Must be a double value in the range 0-1000, default is @code{1.0}.
  7728. @item chroma_strength, cs
  7729. Set chroma strength.
  7730. Must be a double value in the range 0-1000, default is @code{1.0}.
  7731. @end table
  7732. @anchor{pad}
  7733. @section pad
  7734. Add paddings to the input image, and place the original input at the
  7735. provided @var{x}, @var{y} coordinates.
  7736. It accepts the following parameters:
  7737. @table @option
  7738. @item width, w
  7739. @item height, h
  7740. Specify an expression for the size of the output image with the
  7741. paddings added. If the value for @var{width} or @var{height} is 0, the
  7742. corresponding input size is used for the output.
  7743. The @var{width} expression can reference the value set by the
  7744. @var{height} expression, and vice versa.
  7745. The default value of @var{width} and @var{height} is 0.
  7746. @item x
  7747. @item y
  7748. Specify the offsets to place the input image at within the padded area,
  7749. with respect to the top/left border of the output image.
  7750. The @var{x} expression can reference the value set by the @var{y}
  7751. expression, and vice versa.
  7752. The default value of @var{x} and @var{y} is 0.
  7753. @item color
  7754. Specify the color of the padded area. For the syntax of this option,
  7755. check the "Color" section in the ffmpeg-utils manual.
  7756. The default value of @var{color} is "black".
  7757. @end table
  7758. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  7759. options are expressions containing the following constants:
  7760. @table @option
  7761. @item in_w
  7762. @item in_h
  7763. The input video width and height.
  7764. @item iw
  7765. @item ih
  7766. These are the same as @var{in_w} and @var{in_h}.
  7767. @item out_w
  7768. @item out_h
  7769. The output width and height (the size of the padded area), as
  7770. specified by the @var{width} and @var{height} expressions.
  7771. @item ow
  7772. @item oh
  7773. These are the same as @var{out_w} and @var{out_h}.
  7774. @item x
  7775. @item y
  7776. The x and y offsets as specified by the @var{x} and @var{y}
  7777. expressions, or NAN if not yet specified.
  7778. @item a
  7779. same as @var{iw} / @var{ih}
  7780. @item sar
  7781. input sample aspect ratio
  7782. @item dar
  7783. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7784. @item hsub
  7785. @item vsub
  7786. The horizontal and vertical chroma subsample values. For example for the
  7787. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7788. @end table
  7789. @subsection Examples
  7790. @itemize
  7791. @item
  7792. Add paddings with the color "violet" to the input video. The output video
  7793. size is 640x480, and the top-left corner of the input video is placed at
  7794. column 0, row 40
  7795. @example
  7796. pad=640:480:0:40:violet
  7797. @end example
  7798. The example above is equivalent to the following command:
  7799. @example
  7800. pad=width=640:height=480:x=0:y=40:color=violet
  7801. @end example
  7802. @item
  7803. Pad the input to get an output with dimensions increased by 3/2,
  7804. and put the input video at the center of the padded area:
  7805. @example
  7806. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  7807. @end example
  7808. @item
  7809. Pad the input to get a squared output with size equal to the maximum
  7810. value between the input width and height, and put the input video at
  7811. the center of the padded area:
  7812. @example
  7813. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  7814. @end example
  7815. @item
  7816. Pad the input to get a final w/h ratio of 16:9:
  7817. @example
  7818. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  7819. @end example
  7820. @item
  7821. In case of anamorphic video, in order to set the output display aspect
  7822. correctly, it is necessary to use @var{sar} in the expression,
  7823. according to the relation:
  7824. @example
  7825. (ih * X / ih) * sar = output_dar
  7826. X = output_dar / sar
  7827. @end example
  7828. Thus the previous example needs to be modified to:
  7829. @example
  7830. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  7831. @end example
  7832. @item
  7833. Double the output size and put the input video in the bottom-right
  7834. corner of the output padded area:
  7835. @example
  7836. pad="2*iw:2*ih:ow-iw:oh-ih"
  7837. @end example
  7838. @end itemize
  7839. @anchor{palettegen}
  7840. @section palettegen
  7841. Generate one palette for a whole video stream.
  7842. It accepts the following options:
  7843. @table @option
  7844. @item max_colors
  7845. Set the maximum number of colors to quantize in the palette.
  7846. Note: the palette will still contain 256 colors; the unused palette entries
  7847. will be black.
  7848. @item reserve_transparent
  7849. Create a palette of 255 colors maximum and reserve the last one for
  7850. transparency. Reserving the transparency color is useful for GIF optimization.
  7851. If not set, the maximum of colors in the palette will be 256. You probably want
  7852. to disable this option for a standalone image.
  7853. Set by default.
  7854. @item stats_mode
  7855. Set statistics mode.
  7856. It accepts the following values:
  7857. @table @samp
  7858. @item full
  7859. Compute full frame histograms.
  7860. @item diff
  7861. Compute histograms only for the part that differs from previous frame. This
  7862. might be relevant to give more importance to the moving part of your input if
  7863. the background is static.
  7864. @end table
  7865. Default value is @var{full}.
  7866. @end table
  7867. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  7868. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  7869. color quantization of the palette. This information is also visible at
  7870. @var{info} logging level.
  7871. @subsection Examples
  7872. @itemize
  7873. @item
  7874. Generate a representative palette of a given video using @command{ffmpeg}:
  7875. @example
  7876. ffmpeg -i input.mkv -vf palettegen palette.png
  7877. @end example
  7878. @end itemize
  7879. @section paletteuse
  7880. Use a palette to downsample an input video stream.
  7881. The filter takes two inputs: one video stream and a palette. The palette must
  7882. be a 256 pixels image.
  7883. It accepts the following options:
  7884. @table @option
  7885. @item dither
  7886. Select dithering mode. Available algorithms are:
  7887. @table @samp
  7888. @item bayer
  7889. Ordered 8x8 bayer dithering (deterministic)
  7890. @item heckbert
  7891. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  7892. Note: this dithering is sometimes considered "wrong" and is included as a
  7893. reference.
  7894. @item floyd_steinberg
  7895. Floyd and Steingberg dithering (error diffusion)
  7896. @item sierra2
  7897. Frankie Sierra dithering v2 (error diffusion)
  7898. @item sierra2_4a
  7899. Frankie Sierra dithering v2 "Lite" (error diffusion)
  7900. @end table
  7901. Default is @var{sierra2_4a}.
  7902. @item bayer_scale
  7903. When @var{bayer} dithering is selected, this option defines the scale of the
  7904. pattern (how much the crosshatch pattern is visible). A low value means more
  7905. visible pattern for less banding, and higher value means less visible pattern
  7906. at the cost of more banding.
  7907. The option must be an integer value in the range [0,5]. Default is @var{2}.
  7908. @item diff_mode
  7909. If set, define the zone to process
  7910. @table @samp
  7911. @item rectangle
  7912. Only the changing rectangle will be reprocessed. This is similar to GIF
  7913. cropping/offsetting compression mechanism. This option can be useful for speed
  7914. if only a part of the image is changing, and has use cases such as limiting the
  7915. scope of the error diffusal @option{dither} to the rectangle that bounds the
  7916. moving scene (it leads to more deterministic output if the scene doesn't change
  7917. much, and as a result less moving noise and better GIF compression).
  7918. @end table
  7919. Default is @var{none}.
  7920. @end table
  7921. @subsection Examples
  7922. @itemize
  7923. @item
  7924. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  7925. using @command{ffmpeg}:
  7926. @example
  7927. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  7928. @end example
  7929. @end itemize
  7930. @section perspective
  7931. Correct perspective of video not recorded perpendicular to the screen.
  7932. A description of the accepted parameters follows.
  7933. @table @option
  7934. @item x0
  7935. @item y0
  7936. @item x1
  7937. @item y1
  7938. @item x2
  7939. @item y2
  7940. @item x3
  7941. @item y3
  7942. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  7943. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  7944. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  7945. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  7946. then the corners of the source will be sent to the specified coordinates.
  7947. The expressions can use the following variables:
  7948. @table @option
  7949. @item W
  7950. @item H
  7951. the width and height of video frame.
  7952. @item in
  7953. Input frame count.
  7954. @item on
  7955. Output frame count.
  7956. @end table
  7957. @item interpolation
  7958. Set interpolation for perspective correction.
  7959. It accepts the following values:
  7960. @table @samp
  7961. @item linear
  7962. @item cubic
  7963. @end table
  7964. Default value is @samp{linear}.
  7965. @item sense
  7966. Set interpretation of coordinate options.
  7967. It accepts the following values:
  7968. @table @samp
  7969. @item 0, source
  7970. Send point in the source specified by the given coordinates to
  7971. the corners of the destination.
  7972. @item 1, destination
  7973. Send the corners of the source to the point in the destination specified
  7974. by the given coordinates.
  7975. Default value is @samp{source}.
  7976. @end table
  7977. @item eval
  7978. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  7979. It accepts the following values:
  7980. @table @samp
  7981. @item init
  7982. only evaluate expressions once during the filter initialization or
  7983. when a command is processed
  7984. @item frame
  7985. evaluate expressions for each incoming frame
  7986. @end table
  7987. Default value is @samp{init}.
  7988. @end table
  7989. @section phase
  7990. Delay interlaced video by one field time so that the field order changes.
  7991. The intended use is to fix PAL movies that have been captured with the
  7992. opposite field order to the film-to-video transfer.
  7993. A description of the accepted parameters follows.
  7994. @table @option
  7995. @item mode
  7996. Set phase mode.
  7997. It accepts the following values:
  7998. @table @samp
  7999. @item t
  8000. Capture field order top-first, transfer bottom-first.
  8001. Filter will delay the bottom field.
  8002. @item b
  8003. Capture field order bottom-first, transfer top-first.
  8004. Filter will delay the top field.
  8005. @item p
  8006. Capture and transfer with the same field order. This mode only exists
  8007. for the documentation of the other options to refer to, but if you
  8008. actually select it, the filter will faithfully do nothing.
  8009. @item a
  8010. Capture field order determined automatically by field flags, transfer
  8011. opposite.
  8012. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8013. basis using field flags. If no field information is available,
  8014. then this works just like @samp{u}.
  8015. @item u
  8016. Capture unknown or varying, transfer opposite.
  8017. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8018. analyzing the images and selecting the alternative that produces best
  8019. match between the fields.
  8020. @item T
  8021. Capture top-first, transfer unknown or varying.
  8022. Filter selects among @samp{t} and @samp{p} using image analysis.
  8023. @item B
  8024. Capture bottom-first, transfer unknown or varying.
  8025. Filter selects among @samp{b} and @samp{p} using image analysis.
  8026. @item A
  8027. Capture determined by field flags, transfer unknown or varying.
  8028. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8029. image analysis. If no field information is available, then this works just
  8030. like @samp{U}. This is the default mode.
  8031. @item U
  8032. Both capture and transfer unknown or varying.
  8033. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8034. @end table
  8035. @end table
  8036. @section pixdesctest
  8037. Pixel format descriptor test filter, mainly useful for internal
  8038. testing. The output video should be equal to the input video.
  8039. For example:
  8040. @example
  8041. format=monow, pixdesctest
  8042. @end example
  8043. can be used to test the monowhite pixel format descriptor definition.
  8044. @section pp
  8045. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8046. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8047. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8048. Each subfilter and some options have a short and a long name that can be used
  8049. interchangeably, i.e. dr/dering are the same.
  8050. The filters accept the following options:
  8051. @table @option
  8052. @item subfilters
  8053. Set postprocessing subfilters string.
  8054. @end table
  8055. All subfilters share common options to determine their scope:
  8056. @table @option
  8057. @item a/autoq
  8058. Honor the quality commands for this subfilter.
  8059. @item c/chrom
  8060. Do chrominance filtering, too (default).
  8061. @item y/nochrom
  8062. Do luminance filtering only (no chrominance).
  8063. @item n/noluma
  8064. Do chrominance filtering only (no luminance).
  8065. @end table
  8066. These options can be appended after the subfilter name, separated by a '|'.
  8067. Available subfilters are:
  8068. @table @option
  8069. @item hb/hdeblock[|difference[|flatness]]
  8070. Horizontal deblocking filter
  8071. @table @option
  8072. @item difference
  8073. Difference factor where higher values mean more deblocking (default: @code{32}).
  8074. @item flatness
  8075. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8076. @end table
  8077. @item vb/vdeblock[|difference[|flatness]]
  8078. Vertical deblocking filter
  8079. @table @option
  8080. @item difference
  8081. Difference factor where higher values mean more deblocking (default: @code{32}).
  8082. @item flatness
  8083. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8084. @end table
  8085. @item ha/hadeblock[|difference[|flatness]]
  8086. Accurate horizontal deblocking filter
  8087. @table @option
  8088. @item difference
  8089. Difference factor where higher values mean more deblocking (default: @code{32}).
  8090. @item flatness
  8091. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8092. @end table
  8093. @item va/vadeblock[|difference[|flatness]]
  8094. Accurate vertical deblocking filter
  8095. @table @option
  8096. @item difference
  8097. Difference factor where higher values mean more deblocking (default: @code{32}).
  8098. @item flatness
  8099. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8100. @end table
  8101. @end table
  8102. The horizontal and vertical deblocking filters share the difference and
  8103. flatness values so you cannot set different horizontal and vertical
  8104. thresholds.
  8105. @table @option
  8106. @item h1/x1hdeblock
  8107. Experimental horizontal deblocking filter
  8108. @item v1/x1vdeblock
  8109. Experimental vertical deblocking filter
  8110. @item dr/dering
  8111. Deringing filter
  8112. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8113. @table @option
  8114. @item threshold1
  8115. larger -> stronger filtering
  8116. @item threshold2
  8117. larger -> stronger filtering
  8118. @item threshold3
  8119. larger -> stronger filtering
  8120. @end table
  8121. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8122. @table @option
  8123. @item f/fullyrange
  8124. Stretch luminance to @code{0-255}.
  8125. @end table
  8126. @item lb/linblenddeint
  8127. Linear blend deinterlacing filter that deinterlaces the given block by
  8128. filtering all lines with a @code{(1 2 1)} filter.
  8129. @item li/linipoldeint
  8130. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8131. linearly interpolating every second line.
  8132. @item ci/cubicipoldeint
  8133. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8134. cubically interpolating every second line.
  8135. @item md/mediandeint
  8136. Median deinterlacing filter that deinterlaces the given block by applying a
  8137. median filter to every second line.
  8138. @item fd/ffmpegdeint
  8139. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8140. second line with a @code{(-1 4 2 4 -1)} filter.
  8141. @item l5/lowpass5
  8142. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8143. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8144. @item fq/forceQuant[|quantizer]
  8145. Overrides the quantizer table from the input with the constant quantizer you
  8146. specify.
  8147. @table @option
  8148. @item quantizer
  8149. Quantizer to use
  8150. @end table
  8151. @item de/default
  8152. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8153. @item fa/fast
  8154. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8155. @item ac
  8156. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8157. @end table
  8158. @subsection Examples
  8159. @itemize
  8160. @item
  8161. Apply horizontal and vertical deblocking, deringing and automatic
  8162. brightness/contrast:
  8163. @example
  8164. pp=hb/vb/dr/al
  8165. @end example
  8166. @item
  8167. Apply default filters without brightness/contrast correction:
  8168. @example
  8169. pp=de/-al
  8170. @end example
  8171. @item
  8172. Apply default filters and temporal denoiser:
  8173. @example
  8174. pp=default/tmpnoise|1|2|3
  8175. @end example
  8176. @item
  8177. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8178. automatically depending on available CPU time:
  8179. @example
  8180. pp=hb|y/vb|a
  8181. @end example
  8182. @end itemize
  8183. @section pp7
  8184. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8185. similar to spp = 6 with 7 point DCT, where only the center sample is
  8186. used after IDCT.
  8187. The filter accepts the following options:
  8188. @table @option
  8189. @item qp
  8190. Force a constant quantization parameter. It accepts an integer in range
  8191. 0 to 63. If not set, the filter will use the QP from the video stream
  8192. (if available).
  8193. @item mode
  8194. Set thresholding mode. Available modes are:
  8195. @table @samp
  8196. @item hard
  8197. Set hard thresholding.
  8198. @item soft
  8199. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8200. @item medium
  8201. Set medium thresholding (good results, default).
  8202. @end table
  8203. @end table
  8204. @section psnr
  8205. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8206. Ratio) between two input videos.
  8207. This filter takes in input two input videos, the first input is
  8208. considered the "main" source and is passed unchanged to the
  8209. output. The second input is used as a "reference" video for computing
  8210. the PSNR.
  8211. Both video inputs must have the same resolution and pixel format for
  8212. this filter to work correctly. Also it assumes that both inputs
  8213. have the same number of frames, which are compared one by one.
  8214. The obtained average PSNR is printed through the logging system.
  8215. The filter stores the accumulated MSE (mean squared error) of each
  8216. frame, and at the end of the processing it is averaged across all frames
  8217. equally, and the following formula is applied to obtain the PSNR:
  8218. @example
  8219. PSNR = 10*log10(MAX^2/MSE)
  8220. @end example
  8221. Where MAX is the average of the maximum values of each component of the
  8222. image.
  8223. The description of the accepted parameters follows.
  8224. @table @option
  8225. @item stats_file, f
  8226. If specified the filter will use the named file to save the PSNR of
  8227. each individual frame. When filename equals "-" the data is sent to
  8228. standard output.
  8229. @end table
  8230. The file printed if @var{stats_file} is selected, contains a sequence of
  8231. key/value pairs of the form @var{key}:@var{value} for each compared
  8232. couple of frames.
  8233. A description of each shown parameter follows:
  8234. @table @option
  8235. @item n
  8236. sequential number of the input frame, starting from 1
  8237. @item mse_avg
  8238. Mean Square Error pixel-by-pixel average difference of the compared
  8239. frames, averaged over all the image components.
  8240. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8241. Mean Square Error pixel-by-pixel average difference of the compared
  8242. frames for the component specified by the suffix.
  8243. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8244. Peak Signal to Noise ratio of the compared frames for the component
  8245. specified by the suffix.
  8246. @end table
  8247. For example:
  8248. @example
  8249. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8250. [main][ref] psnr="stats_file=stats.log" [out]
  8251. @end example
  8252. On this example the input file being processed is compared with the
  8253. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8254. is stored in @file{stats.log}.
  8255. @anchor{pullup}
  8256. @section pullup
  8257. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8258. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8259. content.
  8260. The pullup filter is designed to take advantage of future context in making
  8261. its decisions. This filter is stateless in the sense that it does not lock
  8262. onto a pattern to follow, but it instead looks forward to the following
  8263. fields in order to identify matches and rebuild progressive frames.
  8264. To produce content with an even framerate, insert the fps filter after
  8265. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8266. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8267. The filter accepts the following options:
  8268. @table @option
  8269. @item jl
  8270. @item jr
  8271. @item jt
  8272. @item jb
  8273. These options set the amount of "junk" to ignore at the left, right, top, and
  8274. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8275. while top and bottom are in units of 2 lines.
  8276. The default is 8 pixels on each side.
  8277. @item sb
  8278. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8279. filter generating an occasional mismatched frame, but it may also cause an
  8280. excessive number of frames to be dropped during high motion sequences.
  8281. Conversely, setting it to -1 will make filter match fields more easily.
  8282. This may help processing of video where there is slight blurring between
  8283. the fields, but may also cause there to be interlaced frames in the output.
  8284. Default value is @code{0}.
  8285. @item mp
  8286. Set the metric plane to use. It accepts the following values:
  8287. @table @samp
  8288. @item l
  8289. Use luma plane.
  8290. @item u
  8291. Use chroma blue plane.
  8292. @item v
  8293. Use chroma red plane.
  8294. @end table
  8295. This option may be set to use chroma plane instead of the default luma plane
  8296. for doing filter's computations. This may improve accuracy on very clean
  8297. source material, but more likely will decrease accuracy, especially if there
  8298. is chroma noise (rainbow effect) or any grayscale video.
  8299. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8300. load and make pullup usable in realtime on slow machines.
  8301. @end table
  8302. For best results (without duplicated frames in the output file) it is
  8303. necessary to change the output frame rate. For example, to inverse
  8304. telecine NTSC input:
  8305. @example
  8306. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8307. @end example
  8308. @section qp
  8309. Change video quantization parameters (QP).
  8310. The filter accepts the following option:
  8311. @table @option
  8312. @item qp
  8313. Set expression for quantization parameter.
  8314. @end table
  8315. The expression is evaluated through the eval API and can contain, among others,
  8316. the following constants:
  8317. @table @var
  8318. @item known
  8319. 1 if index is not 129, 0 otherwise.
  8320. @item qp
  8321. Sequentional index starting from -129 to 128.
  8322. @end table
  8323. @subsection Examples
  8324. @itemize
  8325. @item
  8326. Some equation like:
  8327. @example
  8328. qp=2+2*sin(PI*qp)
  8329. @end example
  8330. @end itemize
  8331. @section random
  8332. Flush video frames from internal cache of frames into a random order.
  8333. No frame is discarded.
  8334. Inspired by @ref{frei0r} nervous filter.
  8335. @table @option
  8336. @item frames
  8337. Set size in number of frames of internal cache, in range from @code{2} to
  8338. @code{512}. Default is @code{30}.
  8339. @item seed
  8340. Set seed for random number generator, must be an integer included between
  8341. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8342. less than @code{0}, the filter will try to use a good random seed on a
  8343. best effort basis.
  8344. @end table
  8345. @section readvitc
  8346. Read vertical interval timecode (VITC) information from the top lines of a
  8347. video frame.
  8348. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8349. timecode value, if a valid timecode has been detected. Further metadata key
  8350. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8351. timecode data has been found or not.
  8352. This filter accepts the following options:
  8353. @table @option
  8354. @item scan_max
  8355. Set the maximum number of lines to scan for VITC data. If the value is set to
  8356. @code{-1} the full video frame is scanned. Default is @code{45}.
  8357. @item thr_b
  8358. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8359. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8360. @item thr_w
  8361. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8362. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8363. @end table
  8364. @subsection Examples
  8365. @itemize
  8366. @item
  8367. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8368. draw @code{--:--:--:--} as a placeholder:
  8369. @example
  8370. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8371. @end example
  8372. @end itemize
  8373. @section remap
  8374. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8375. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8376. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8377. value for pixel will be used for destination pixel.
  8378. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8379. will have Xmap/Ymap video stream dimensions.
  8380. Xmap and Ymap input video streams are 16bit depth, single channel.
  8381. @section removegrain
  8382. The removegrain filter is a spatial denoiser for progressive video.
  8383. @table @option
  8384. @item m0
  8385. Set mode for the first plane.
  8386. @item m1
  8387. Set mode for the second plane.
  8388. @item m2
  8389. Set mode for the third plane.
  8390. @item m3
  8391. Set mode for the fourth plane.
  8392. @end table
  8393. Range of mode is from 0 to 24. Description of each mode follows:
  8394. @table @var
  8395. @item 0
  8396. Leave input plane unchanged. Default.
  8397. @item 1
  8398. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8399. @item 2
  8400. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8401. @item 3
  8402. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8403. @item 4
  8404. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8405. This is equivalent to a median filter.
  8406. @item 5
  8407. Line-sensitive clipping giving the minimal change.
  8408. @item 6
  8409. Line-sensitive clipping, intermediate.
  8410. @item 7
  8411. Line-sensitive clipping, intermediate.
  8412. @item 8
  8413. Line-sensitive clipping, intermediate.
  8414. @item 9
  8415. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8416. @item 10
  8417. Replaces the target pixel with the closest neighbour.
  8418. @item 11
  8419. [1 2 1] horizontal and vertical kernel blur.
  8420. @item 12
  8421. Same as mode 11.
  8422. @item 13
  8423. Bob mode, interpolates top field from the line where the neighbours
  8424. pixels are the closest.
  8425. @item 14
  8426. Bob mode, interpolates bottom field from the line where the neighbours
  8427. pixels are the closest.
  8428. @item 15
  8429. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8430. interpolation formula.
  8431. @item 16
  8432. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8433. interpolation formula.
  8434. @item 17
  8435. Clips the pixel with the minimum and maximum of respectively the maximum and
  8436. minimum of each pair of opposite neighbour pixels.
  8437. @item 18
  8438. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8439. the current pixel is minimal.
  8440. @item 19
  8441. Replaces the pixel with the average of its 8 neighbours.
  8442. @item 20
  8443. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8444. @item 21
  8445. Clips pixels using the averages of opposite neighbour.
  8446. @item 22
  8447. Same as mode 21 but simpler and faster.
  8448. @item 23
  8449. Small edge and halo removal, but reputed useless.
  8450. @item 24
  8451. Similar as 23.
  8452. @end table
  8453. @section removelogo
  8454. Suppress a TV station logo, using an image file to determine which
  8455. pixels comprise the logo. It works by filling in the pixels that
  8456. comprise the logo with neighboring pixels.
  8457. The filter accepts the following options:
  8458. @table @option
  8459. @item filename, f
  8460. Set the filter bitmap file, which can be any image format supported by
  8461. libavformat. The width and height of the image file must match those of the
  8462. video stream being processed.
  8463. @end table
  8464. Pixels in the provided bitmap image with a value of zero are not
  8465. considered part of the logo, non-zero pixels are considered part of
  8466. the logo. If you use white (255) for the logo and black (0) for the
  8467. rest, you will be safe. For making the filter bitmap, it is
  8468. recommended to take a screen capture of a black frame with the logo
  8469. visible, and then using a threshold filter followed by the erode
  8470. filter once or twice.
  8471. If needed, little splotches can be fixed manually. Remember that if
  8472. logo pixels are not covered, the filter quality will be much
  8473. reduced. Marking too many pixels as part of the logo does not hurt as
  8474. much, but it will increase the amount of blurring needed to cover over
  8475. the image and will destroy more information than necessary, and extra
  8476. pixels will slow things down on a large logo.
  8477. @section repeatfields
  8478. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8479. fields based on its value.
  8480. @section reverse, areverse
  8481. Reverse a clip.
  8482. Warning: This filter requires memory to buffer the entire clip, so trimming
  8483. is suggested.
  8484. @subsection Examples
  8485. @itemize
  8486. @item
  8487. Take the first 5 seconds of a clip, and reverse it.
  8488. @example
  8489. trim=end=5,reverse
  8490. @end example
  8491. @end itemize
  8492. @section rotate
  8493. Rotate video by an arbitrary angle expressed in radians.
  8494. The filter accepts the following options:
  8495. A description of the optional parameters follows.
  8496. @table @option
  8497. @item angle, a
  8498. Set an expression for the angle by which to rotate the input video
  8499. clockwise, expressed as a number of radians. A negative value will
  8500. result in a counter-clockwise rotation. By default it is set to "0".
  8501. This expression is evaluated for each frame.
  8502. @item out_w, ow
  8503. Set the output width expression, default value is "iw".
  8504. This expression is evaluated just once during configuration.
  8505. @item out_h, oh
  8506. Set the output height expression, default value is "ih".
  8507. This expression is evaluated just once during configuration.
  8508. @item bilinear
  8509. Enable bilinear interpolation if set to 1, a value of 0 disables
  8510. it. Default value is 1.
  8511. @item fillcolor, c
  8512. Set the color used to fill the output area not covered by the rotated
  8513. image. For the general syntax of this option, check the "Color" section in the
  8514. ffmpeg-utils manual. If the special value "none" is selected then no
  8515. background is printed (useful for example if the background is never shown).
  8516. Default value is "black".
  8517. @end table
  8518. The expressions for the angle and the output size can contain the
  8519. following constants and functions:
  8520. @table @option
  8521. @item n
  8522. sequential number of the input frame, starting from 0. It is always NAN
  8523. before the first frame is filtered.
  8524. @item t
  8525. time in seconds of the input frame, it is set to 0 when the filter is
  8526. configured. It is always NAN before the first frame is filtered.
  8527. @item hsub
  8528. @item vsub
  8529. horizontal and vertical chroma subsample values. For example for the
  8530. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8531. @item in_w, iw
  8532. @item in_h, ih
  8533. the input video width and height
  8534. @item out_w, ow
  8535. @item out_h, oh
  8536. the output width and height, that is the size of the padded area as
  8537. specified by the @var{width} and @var{height} expressions
  8538. @item rotw(a)
  8539. @item roth(a)
  8540. the minimal width/height required for completely containing the input
  8541. video rotated by @var{a} radians.
  8542. These are only available when computing the @option{out_w} and
  8543. @option{out_h} expressions.
  8544. @end table
  8545. @subsection Examples
  8546. @itemize
  8547. @item
  8548. Rotate the input by PI/6 radians clockwise:
  8549. @example
  8550. rotate=PI/6
  8551. @end example
  8552. @item
  8553. Rotate the input by PI/6 radians counter-clockwise:
  8554. @example
  8555. rotate=-PI/6
  8556. @end example
  8557. @item
  8558. Rotate the input by 45 degrees clockwise:
  8559. @example
  8560. rotate=45*PI/180
  8561. @end example
  8562. @item
  8563. Apply a constant rotation with period T, starting from an angle of PI/3:
  8564. @example
  8565. rotate=PI/3+2*PI*t/T
  8566. @end example
  8567. @item
  8568. Make the input video rotation oscillating with a period of T
  8569. seconds and an amplitude of A radians:
  8570. @example
  8571. rotate=A*sin(2*PI/T*t)
  8572. @end example
  8573. @item
  8574. Rotate the video, output size is chosen so that the whole rotating
  8575. input video is always completely contained in the output:
  8576. @example
  8577. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8578. @end example
  8579. @item
  8580. Rotate the video, reduce the output size so that no background is ever
  8581. shown:
  8582. @example
  8583. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8584. @end example
  8585. @end itemize
  8586. @subsection Commands
  8587. The filter supports the following commands:
  8588. @table @option
  8589. @item a, angle
  8590. Set the angle expression.
  8591. The command accepts the same syntax of the corresponding option.
  8592. If the specified expression is not valid, it is kept at its current
  8593. value.
  8594. @end table
  8595. @section sab
  8596. Apply Shape Adaptive Blur.
  8597. The filter accepts the following options:
  8598. @table @option
  8599. @item luma_radius, lr
  8600. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8601. value is 1.0. A greater value will result in a more blurred image, and
  8602. in slower processing.
  8603. @item luma_pre_filter_radius, lpfr
  8604. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8605. value is 1.0.
  8606. @item luma_strength, ls
  8607. Set luma maximum difference between pixels to still be considered, must
  8608. be a value in the 0.1-100.0 range, default value is 1.0.
  8609. @item chroma_radius, cr
  8610. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  8611. greater value will result in a more blurred image, and in slower
  8612. processing.
  8613. @item chroma_pre_filter_radius, cpfr
  8614. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  8615. @item chroma_strength, cs
  8616. Set chroma maximum difference between pixels to still be considered,
  8617. must be a value in the 0.1-100.0 range.
  8618. @end table
  8619. Each chroma option value, if not explicitly specified, is set to the
  8620. corresponding luma option value.
  8621. @anchor{scale}
  8622. @section scale
  8623. Scale (resize) the input video, using the libswscale library.
  8624. The scale filter forces the output display aspect ratio to be the same
  8625. of the input, by changing the output sample aspect ratio.
  8626. If the input image format is different from the format requested by
  8627. the next filter, the scale filter will convert the input to the
  8628. requested format.
  8629. @subsection Options
  8630. The filter accepts the following options, or any of the options
  8631. supported by the libswscale scaler.
  8632. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8633. the complete list of scaler options.
  8634. @table @option
  8635. @item width, w
  8636. @item height, h
  8637. Set the output video dimension expression. Default value is the input
  8638. dimension.
  8639. If the value is 0, the input width is used for the output.
  8640. If one of the values is -1, the scale filter will use a value that
  8641. maintains the aspect ratio of the input image, calculated from the
  8642. other specified dimension. If both of them are -1, the input size is
  8643. used
  8644. If one of the values is -n with n > 1, the scale filter will also use a value
  8645. that maintains the aspect ratio of the input image, calculated from the other
  8646. specified dimension. After that it will, however, make sure that the calculated
  8647. dimension is divisible by n and adjust the value if necessary.
  8648. See below for the list of accepted constants for use in the dimension
  8649. expression.
  8650. @item eval
  8651. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8652. @table @samp
  8653. @item init
  8654. Only evaluate expressions once during the filter initialization or when a command is processed.
  8655. @item frame
  8656. Evaluate expressions for each incoming frame.
  8657. @end table
  8658. Default value is @samp{init}.
  8659. @item interl
  8660. Set the interlacing mode. It accepts the following values:
  8661. @table @samp
  8662. @item 1
  8663. Force interlaced aware scaling.
  8664. @item 0
  8665. Do not apply interlaced scaling.
  8666. @item -1
  8667. Select interlaced aware scaling depending on whether the source frames
  8668. are flagged as interlaced or not.
  8669. @end table
  8670. Default value is @samp{0}.
  8671. @item flags
  8672. Set libswscale scaling flags. See
  8673. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8674. complete list of values. If not explicitly specified the filter applies
  8675. the default flags.
  8676. @item param0, param1
  8677. Set libswscale input parameters for scaling algorithms that need them. See
  8678. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8679. complete documentation. If not explicitly specified the filter applies
  8680. empty parameters.
  8681. @item size, s
  8682. Set the video size. For the syntax of this option, check the
  8683. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8684. @item in_color_matrix
  8685. @item out_color_matrix
  8686. Set in/output YCbCr color space type.
  8687. This allows the autodetected value to be overridden as well as allows forcing
  8688. a specific value used for the output and encoder.
  8689. If not specified, the color space type depends on the pixel format.
  8690. Possible values:
  8691. @table @samp
  8692. @item auto
  8693. Choose automatically.
  8694. @item bt709
  8695. Format conforming to International Telecommunication Union (ITU)
  8696. Recommendation BT.709.
  8697. @item fcc
  8698. Set color space conforming to the United States Federal Communications
  8699. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  8700. @item bt601
  8701. Set color space conforming to:
  8702. @itemize
  8703. @item
  8704. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  8705. @item
  8706. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  8707. @item
  8708. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  8709. @end itemize
  8710. @item smpte240m
  8711. Set color space conforming to SMPTE ST 240:1999.
  8712. @end table
  8713. @item in_range
  8714. @item out_range
  8715. Set in/output YCbCr sample range.
  8716. This allows the autodetected value to be overridden as well as allows forcing
  8717. a specific value used for the output and encoder. If not specified, the
  8718. range depends on the pixel format. Possible values:
  8719. @table @samp
  8720. @item auto
  8721. Choose automatically.
  8722. @item jpeg/full/pc
  8723. Set full range (0-255 in case of 8-bit luma).
  8724. @item mpeg/tv
  8725. Set "MPEG" range (16-235 in case of 8-bit luma).
  8726. @end table
  8727. @item force_original_aspect_ratio
  8728. Enable decreasing or increasing output video width or height if necessary to
  8729. keep the original aspect ratio. Possible values:
  8730. @table @samp
  8731. @item disable
  8732. Scale the video as specified and disable this feature.
  8733. @item decrease
  8734. The output video dimensions will automatically be decreased if needed.
  8735. @item increase
  8736. The output video dimensions will automatically be increased if needed.
  8737. @end table
  8738. One useful instance of this option is that when you know a specific device's
  8739. maximum allowed resolution, you can use this to limit the output video to
  8740. that, while retaining the aspect ratio. For example, device A allows
  8741. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  8742. decrease) and specifying 1280x720 to the command line makes the output
  8743. 1280x533.
  8744. Please note that this is a different thing than specifying -1 for @option{w}
  8745. or @option{h}, you still need to specify the output resolution for this option
  8746. to work.
  8747. @end table
  8748. The values of the @option{w} and @option{h} options are expressions
  8749. containing the following constants:
  8750. @table @var
  8751. @item in_w
  8752. @item in_h
  8753. The input width and height
  8754. @item iw
  8755. @item ih
  8756. These are the same as @var{in_w} and @var{in_h}.
  8757. @item out_w
  8758. @item out_h
  8759. The output (scaled) width and height
  8760. @item ow
  8761. @item oh
  8762. These are the same as @var{out_w} and @var{out_h}
  8763. @item a
  8764. The same as @var{iw} / @var{ih}
  8765. @item sar
  8766. input sample aspect ratio
  8767. @item dar
  8768. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  8769. @item hsub
  8770. @item vsub
  8771. horizontal and vertical input chroma subsample values. For example for the
  8772. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8773. @item ohsub
  8774. @item ovsub
  8775. horizontal and vertical output chroma subsample values. For example for the
  8776. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8777. @end table
  8778. @subsection Examples
  8779. @itemize
  8780. @item
  8781. Scale the input video to a size of 200x100
  8782. @example
  8783. scale=w=200:h=100
  8784. @end example
  8785. This is equivalent to:
  8786. @example
  8787. scale=200:100
  8788. @end example
  8789. or:
  8790. @example
  8791. scale=200x100
  8792. @end example
  8793. @item
  8794. Specify a size abbreviation for the output size:
  8795. @example
  8796. scale=qcif
  8797. @end example
  8798. which can also be written as:
  8799. @example
  8800. scale=size=qcif
  8801. @end example
  8802. @item
  8803. Scale the input to 2x:
  8804. @example
  8805. scale=w=2*iw:h=2*ih
  8806. @end example
  8807. @item
  8808. The above is the same as:
  8809. @example
  8810. scale=2*in_w:2*in_h
  8811. @end example
  8812. @item
  8813. Scale the input to 2x with forced interlaced scaling:
  8814. @example
  8815. scale=2*iw:2*ih:interl=1
  8816. @end example
  8817. @item
  8818. Scale the input to half size:
  8819. @example
  8820. scale=w=iw/2:h=ih/2
  8821. @end example
  8822. @item
  8823. Increase the width, and set the height to the same size:
  8824. @example
  8825. scale=3/2*iw:ow
  8826. @end example
  8827. @item
  8828. Seek Greek harmony:
  8829. @example
  8830. scale=iw:1/PHI*iw
  8831. scale=ih*PHI:ih
  8832. @end example
  8833. @item
  8834. Increase the height, and set the width to 3/2 of the height:
  8835. @example
  8836. scale=w=3/2*oh:h=3/5*ih
  8837. @end example
  8838. @item
  8839. Increase the size, making the size a multiple of the chroma
  8840. subsample values:
  8841. @example
  8842. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  8843. @end example
  8844. @item
  8845. Increase the width to a maximum of 500 pixels,
  8846. keeping the same aspect ratio as the input:
  8847. @example
  8848. scale=w='min(500\, iw*3/2):h=-1'
  8849. @end example
  8850. @end itemize
  8851. @subsection Commands
  8852. This filter supports the following commands:
  8853. @table @option
  8854. @item width, w
  8855. @item height, h
  8856. Set the output video dimension expression.
  8857. The command accepts the same syntax of the corresponding option.
  8858. If the specified expression is not valid, it is kept at its current
  8859. value.
  8860. @end table
  8861. @section scale2ref
  8862. Scale (resize) the input video, based on a reference video.
  8863. See the scale filter for available options, scale2ref supports the same but
  8864. uses the reference video instead of the main input as basis.
  8865. @subsection Examples
  8866. @itemize
  8867. @item
  8868. Scale a subtitle stream to match the main video in size before overlaying
  8869. @example
  8870. 'scale2ref[b][a];[a][b]overlay'
  8871. @end example
  8872. @end itemize
  8873. @anchor{selectivecolor}
  8874. @section selectivecolor
  8875. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  8876. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  8877. by the "purity" of the color (that is, how saturated it already is).
  8878. This filter is similar to the Adobe Photoshop Selective Color tool.
  8879. The filter accepts the following options:
  8880. @table @option
  8881. @item correction_method
  8882. Select color correction method.
  8883. Available values are:
  8884. @table @samp
  8885. @item absolute
  8886. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  8887. component value).
  8888. @item relative
  8889. Specified adjustments are relative to the original component value.
  8890. @end table
  8891. Default is @code{absolute}.
  8892. @item reds
  8893. Adjustments for red pixels (pixels where the red component is the maximum)
  8894. @item yellows
  8895. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  8896. @item greens
  8897. Adjustments for green pixels (pixels where the green component is the maximum)
  8898. @item cyans
  8899. Adjustments for cyan pixels (pixels where the red component is the minimum)
  8900. @item blues
  8901. Adjustments for blue pixels (pixels where the blue component is the maximum)
  8902. @item magentas
  8903. Adjustments for magenta pixels (pixels where the green component is the minimum)
  8904. @item whites
  8905. Adjustments for white pixels (pixels where all components are greater than 128)
  8906. @item neutrals
  8907. Adjustments for all pixels except pure black and pure white
  8908. @item blacks
  8909. Adjustments for black pixels (pixels where all components are lesser than 128)
  8910. @item psfile
  8911. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  8912. @end table
  8913. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  8914. 4 space separated floating point adjustment values in the [-1,1] range,
  8915. respectively to adjust the amount of cyan, magenta, yellow and black for the
  8916. pixels of its range.
  8917. @subsection Examples
  8918. @itemize
  8919. @item
  8920. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  8921. increase magenta by 27% in blue areas:
  8922. @example
  8923. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  8924. @end example
  8925. @item
  8926. Use a Photoshop selective color preset:
  8927. @example
  8928. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  8929. @end example
  8930. @end itemize
  8931. @section separatefields
  8932. The @code{separatefields} takes a frame-based video input and splits
  8933. each frame into its components fields, producing a new half height clip
  8934. with twice the frame rate and twice the frame count.
  8935. This filter use field-dominance information in frame to decide which
  8936. of each pair of fields to place first in the output.
  8937. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  8938. @section setdar, setsar
  8939. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  8940. output video.
  8941. This is done by changing the specified Sample (aka Pixel) Aspect
  8942. Ratio, according to the following equation:
  8943. @example
  8944. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  8945. @end example
  8946. Keep in mind that the @code{setdar} filter does not modify the pixel
  8947. dimensions of the video frame. Also, the display aspect ratio set by
  8948. this filter may be changed by later filters in the filterchain,
  8949. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  8950. applied.
  8951. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  8952. the filter output video.
  8953. Note that as a consequence of the application of this filter, the
  8954. output display aspect ratio will change according to the equation
  8955. above.
  8956. Keep in mind that the sample aspect ratio set by the @code{setsar}
  8957. filter may be changed by later filters in the filterchain, e.g. if
  8958. another "setsar" or a "setdar" filter is applied.
  8959. It accepts the following parameters:
  8960. @table @option
  8961. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  8962. Set the aspect ratio used by the filter.
  8963. The parameter can be a floating point number string, an expression, or
  8964. a string of the form @var{num}:@var{den}, where @var{num} and
  8965. @var{den} are the numerator and denominator of the aspect ratio. If
  8966. the parameter is not specified, it is assumed the value "0".
  8967. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  8968. should be escaped.
  8969. @item max
  8970. Set the maximum integer value to use for expressing numerator and
  8971. denominator when reducing the expressed aspect ratio to a rational.
  8972. Default value is @code{100}.
  8973. @end table
  8974. The parameter @var{sar} is an expression containing
  8975. the following constants:
  8976. @table @option
  8977. @item E, PI, PHI
  8978. These are approximated values for the mathematical constants e
  8979. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  8980. @item w, h
  8981. The input width and height.
  8982. @item a
  8983. These are the same as @var{w} / @var{h}.
  8984. @item sar
  8985. The input sample aspect ratio.
  8986. @item dar
  8987. The input display aspect ratio. It is the same as
  8988. (@var{w} / @var{h}) * @var{sar}.
  8989. @item hsub, vsub
  8990. Horizontal and vertical chroma subsample values. For example, for the
  8991. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8992. @end table
  8993. @subsection Examples
  8994. @itemize
  8995. @item
  8996. To change the display aspect ratio to 16:9, specify one of the following:
  8997. @example
  8998. setdar=dar=1.77777
  8999. setdar=dar=16/9
  9000. @end example
  9001. @item
  9002. To change the sample aspect ratio to 10:11, specify:
  9003. @example
  9004. setsar=sar=10/11
  9005. @end example
  9006. @item
  9007. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9008. 1000 in the aspect ratio reduction, use the command:
  9009. @example
  9010. setdar=ratio=16/9:max=1000
  9011. @end example
  9012. @end itemize
  9013. @anchor{setfield}
  9014. @section setfield
  9015. Force field for the output video frame.
  9016. The @code{setfield} filter marks the interlace type field for the
  9017. output frames. It does not change the input frame, but only sets the
  9018. corresponding property, which affects how the frame is treated by
  9019. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9020. The filter accepts the following options:
  9021. @table @option
  9022. @item mode
  9023. Available values are:
  9024. @table @samp
  9025. @item auto
  9026. Keep the same field property.
  9027. @item bff
  9028. Mark the frame as bottom-field-first.
  9029. @item tff
  9030. Mark the frame as top-field-first.
  9031. @item prog
  9032. Mark the frame as progressive.
  9033. @end table
  9034. @end table
  9035. @section showinfo
  9036. Show a line containing various information for each input video frame.
  9037. The input video is not modified.
  9038. The shown line contains a sequence of key/value pairs of the form
  9039. @var{key}:@var{value}.
  9040. The following values are shown in the output:
  9041. @table @option
  9042. @item n
  9043. The (sequential) number of the input frame, starting from 0.
  9044. @item pts
  9045. The Presentation TimeStamp of the input frame, expressed as a number of
  9046. time base units. The time base unit depends on the filter input pad.
  9047. @item pts_time
  9048. The Presentation TimeStamp of the input frame, expressed as a number of
  9049. seconds.
  9050. @item pos
  9051. The position of the frame in the input stream, or -1 if this information is
  9052. unavailable and/or meaningless (for example in case of synthetic video).
  9053. @item fmt
  9054. The pixel format name.
  9055. @item sar
  9056. The sample aspect ratio of the input frame, expressed in the form
  9057. @var{num}/@var{den}.
  9058. @item s
  9059. The size of the input frame. For the syntax of this option, check the
  9060. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9061. @item i
  9062. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9063. for bottom field first).
  9064. @item iskey
  9065. This is 1 if the frame is a key frame, 0 otherwise.
  9066. @item type
  9067. The picture type of the input frame ("I" for an I-frame, "P" for a
  9068. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9069. Also refer to the documentation of the @code{AVPictureType} enum and of
  9070. the @code{av_get_picture_type_char} function defined in
  9071. @file{libavutil/avutil.h}.
  9072. @item checksum
  9073. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9074. @item plane_checksum
  9075. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9076. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9077. @end table
  9078. @section showpalette
  9079. Displays the 256 colors palette of each frame. This filter is only relevant for
  9080. @var{pal8} pixel format frames.
  9081. It accepts the following option:
  9082. @table @option
  9083. @item s
  9084. Set the size of the box used to represent one palette color entry. Default is
  9085. @code{30} (for a @code{30x30} pixel box).
  9086. @end table
  9087. @section shuffleframes
  9088. Reorder and/or duplicate video frames.
  9089. It accepts the following parameters:
  9090. @table @option
  9091. @item mapping
  9092. Set the destination indexes of input frames.
  9093. This is space or '|' separated list of indexes that maps input frames to output
  9094. frames. Number of indexes also sets maximal value that each index may have.
  9095. @end table
  9096. The first frame has the index 0. The default is to keep the input unchanged.
  9097. Swap second and third frame of every three frames of the input:
  9098. @example
  9099. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9100. @end example
  9101. @section shuffleplanes
  9102. Reorder and/or duplicate video planes.
  9103. It accepts the following parameters:
  9104. @table @option
  9105. @item map0
  9106. The index of the input plane to be used as the first output plane.
  9107. @item map1
  9108. The index of the input plane to be used as the second output plane.
  9109. @item map2
  9110. The index of the input plane to be used as the third output plane.
  9111. @item map3
  9112. The index of the input plane to be used as the fourth output plane.
  9113. @end table
  9114. The first plane has the index 0. The default is to keep the input unchanged.
  9115. Swap the second and third planes of the input:
  9116. @example
  9117. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9118. @end example
  9119. @anchor{signalstats}
  9120. @section signalstats
  9121. Evaluate various visual metrics that assist in determining issues associated
  9122. with the digitization of analog video media.
  9123. By default the filter will log these metadata values:
  9124. @table @option
  9125. @item YMIN
  9126. Display the minimal Y value contained within the input frame. Expressed in
  9127. range of [0-255].
  9128. @item YLOW
  9129. Display the Y value at the 10% percentile within the input frame. Expressed in
  9130. range of [0-255].
  9131. @item YAVG
  9132. Display the average Y value within the input frame. Expressed in range of
  9133. [0-255].
  9134. @item YHIGH
  9135. Display the Y value at the 90% percentile within the input frame. Expressed in
  9136. range of [0-255].
  9137. @item YMAX
  9138. Display the maximum Y value contained within the input frame. Expressed in
  9139. range of [0-255].
  9140. @item UMIN
  9141. Display the minimal U value contained within the input frame. Expressed in
  9142. range of [0-255].
  9143. @item ULOW
  9144. Display the U value at the 10% percentile within the input frame. Expressed in
  9145. range of [0-255].
  9146. @item UAVG
  9147. Display the average U value within the input frame. Expressed in range of
  9148. [0-255].
  9149. @item UHIGH
  9150. Display the U value at the 90% percentile within the input frame. Expressed in
  9151. range of [0-255].
  9152. @item UMAX
  9153. Display the maximum U value contained within the input frame. Expressed in
  9154. range of [0-255].
  9155. @item VMIN
  9156. Display the minimal V value contained within the input frame. Expressed in
  9157. range of [0-255].
  9158. @item VLOW
  9159. Display the V value at the 10% percentile within the input frame. Expressed in
  9160. range of [0-255].
  9161. @item VAVG
  9162. Display the average V value within the input frame. Expressed in range of
  9163. [0-255].
  9164. @item VHIGH
  9165. Display the V value at the 90% percentile within the input frame. Expressed in
  9166. range of [0-255].
  9167. @item VMAX
  9168. Display the maximum V value contained within the input frame. Expressed in
  9169. range of [0-255].
  9170. @item SATMIN
  9171. Display the minimal saturation value contained within the input frame.
  9172. Expressed in range of [0-~181.02].
  9173. @item SATLOW
  9174. Display the saturation value at the 10% percentile within the input frame.
  9175. Expressed in range of [0-~181.02].
  9176. @item SATAVG
  9177. Display the average saturation value within the input frame. Expressed in range
  9178. of [0-~181.02].
  9179. @item SATHIGH
  9180. Display the saturation value at the 90% percentile within the input frame.
  9181. Expressed in range of [0-~181.02].
  9182. @item SATMAX
  9183. Display the maximum saturation value contained within the input frame.
  9184. Expressed in range of [0-~181.02].
  9185. @item HUEMED
  9186. Display the median value for hue within the input frame. Expressed in range of
  9187. [0-360].
  9188. @item HUEAVG
  9189. Display the average value for hue within the input frame. Expressed in range of
  9190. [0-360].
  9191. @item YDIF
  9192. Display the average of sample value difference between all values of the Y
  9193. plane in the current frame and corresponding values of the previous input frame.
  9194. Expressed in range of [0-255].
  9195. @item UDIF
  9196. Display the average of sample value difference between all values of the U
  9197. plane in the current frame and corresponding values of the previous input frame.
  9198. Expressed in range of [0-255].
  9199. @item VDIF
  9200. Display the average of sample value difference between all values of the V
  9201. plane in the current frame and corresponding values of the previous input frame.
  9202. Expressed in range of [0-255].
  9203. @end table
  9204. The filter accepts the following options:
  9205. @table @option
  9206. @item stat
  9207. @item out
  9208. @option{stat} specify an additional form of image analysis.
  9209. @option{out} output video with the specified type of pixel highlighted.
  9210. Both options accept the following values:
  9211. @table @samp
  9212. @item tout
  9213. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9214. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9215. include the results of video dropouts, head clogs, or tape tracking issues.
  9216. @item vrep
  9217. Identify @var{vertical line repetition}. Vertical line repetition includes
  9218. similar rows of pixels within a frame. In born-digital video vertical line
  9219. repetition is common, but this pattern is uncommon in video digitized from an
  9220. analog source. When it occurs in video that results from the digitization of an
  9221. analog source it can indicate concealment from a dropout compensator.
  9222. @item brng
  9223. Identify pixels that fall outside of legal broadcast range.
  9224. @end table
  9225. @item color, c
  9226. Set the highlight color for the @option{out} option. The default color is
  9227. yellow.
  9228. @end table
  9229. @subsection Examples
  9230. @itemize
  9231. @item
  9232. Output data of various video metrics:
  9233. @example
  9234. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9235. @end example
  9236. @item
  9237. Output specific data about the minimum and maximum values of the Y plane per frame:
  9238. @example
  9239. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9240. @end example
  9241. @item
  9242. Playback video while highlighting pixels that are outside of broadcast range in red.
  9243. @example
  9244. ffplay example.mov -vf signalstats="out=brng:color=red"
  9245. @end example
  9246. @item
  9247. Playback video with signalstats metadata drawn over the frame.
  9248. @example
  9249. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9250. @end example
  9251. The contents of signalstat_drawtext.txt used in the command are:
  9252. @example
  9253. time %@{pts:hms@}
  9254. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9255. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9256. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9257. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9258. @end example
  9259. @end itemize
  9260. @anchor{smartblur}
  9261. @section smartblur
  9262. Blur the input video without impacting the outlines.
  9263. It accepts the following options:
  9264. @table @option
  9265. @item luma_radius, lr
  9266. Set the luma radius. The option value must be a float number in
  9267. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9268. used to blur the image (slower if larger). Default value is 1.0.
  9269. @item luma_strength, ls
  9270. Set the luma strength. The option value must be a float number
  9271. in the range [-1.0,1.0] that configures the blurring. A value included
  9272. in [0.0,1.0] will blur the image whereas a value included in
  9273. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9274. @item luma_threshold, lt
  9275. Set the luma threshold used as a coefficient to determine
  9276. whether a pixel should be blurred or not. The option value must be an
  9277. integer in the range [-30,30]. A value of 0 will filter all the image,
  9278. a value included in [0,30] will filter flat areas and a value included
  9279. in [-30,0] will filter edges. Default value is 0.
  9280. @item chroma_radius, cr
  9281. Set the chroma radius. The option value must be a float number in
  9282. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9283. used to blur the image (slower if larger). Default value is 1.0.
  9284. @item chroma_strength, cs
  9285. Set the chroma strength. The option value must be a float number
  9286. in the range [-1.0,1.0] that configures the blurring. A value included
  9287. in [0.0,1.0] will blur the image whereas a value included in
  9288. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9289. @item chroma_threshold, ct
  9290. Set the chroma threshold used as a coefficient to determine
  9291. whether a pixel should be blurred or not. The option value must be an
  9292. integer in the range [-30,30]. A value of 0 will filter all the image,
  9293. a value included in [0,30] will filter flat areas and a value included
  9294. in [-30,0] will filter edges. Default value is 0.
  9295. @end table
  9296. If a chroma option is not explicitly set, the corresponding luma value
  9297. is set.
  9298. @section ssim
  9299. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9300. This filter takes in input two input videos, the first input is
  9301. considered the "main" source and is passed unchanged to the
  9302. output. The second input is used as a "reference" video for computing
  9303. the SSIM.
  9304. Both video inputs must have the same resolution and pixel format for
  9305. this filter to work correctly. Also it assumes that both inputs
  9306. have the same number of frames, which are compared one by one.
  9307. The filter stores the calculated SSIM of each frame.
  9308. The description of the accepted parameters follows.
  9309. @table @option
  9310. @item stats_file, f
  9311. If specified the filter will use the named file to save the SSIM of
  9312. each individual frame. When filename equals "-" the data is sent to
  9313. standard output.
  9314. @end table
  9315. The file printed if @var{stats_file} is selected, contains a sequence of
  9316. key/value pairs of the form @var{key}:@var{value} for each compared
  9317. couple of frames.
  9318. A description of each shown parameter follows:
  9319. @table @option
  9320. @item n
  9321. sequential number of the input frame, starting from 1
  9322. @item Y, U, V, R, G, B
  9323. SSIM of the compared frames for the component specified by the suffix.
  9324. @item All
  9325. SSIM of the compared frames for the whole frame.
  9326. @item dB
  9327. Same as above but in dB representation.
  9328. @end table
  9329. For example:
  9330. @example
  9331. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9332. [main][ref] ssim="stats_file=stats.log" [out]
  9333. @end example
  9334. On this example the input file being processed is compared with the
  9335. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9336. is stored in @file{stats.log}.
  9337. Another example with both psnr and ssim at same time:
  9338. @example
  9339. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9340. @end example
  9341. @section stereo3d
  9342. Convert between different stereoscopic image formats.
  9343. The filters accept the following options:
  9344. @table @option
  9345. @item in
  9346. Set stereoscopic image format of input.
  9347. Available values for input image formats are:
  9348. @table @samp
  9349. @item sbsl
  9350. side by side parallel (left eye left, right eye right)
  9351. @item sbsr
  9352. side by side crosseye (right eye left, left eye right)
  9353. @item sbs2l
  9354. side by side parallel with half width resolution
  9355. (left eye left, right eye right)
  9356. @item sbs2r
  9357. side by side crosseye with half width resolution
  9358. (right eye left, left eye right)
  9359. @item abl
  9360. above-below (left eye above, right eye below)
  9361. @item abr
  9362. above-below (right eye above, left eye below)
  9363. @item ab2l
  9364. above-below with half height resolution
  9365. (left eye above, right eye below)
  9366. @item ab2r
  9367. above-below with half height resolution
  9368. (right eye above, left eye below)
  9369. @item al
  9370. alternating frames (left eye first, right eye second)
  9371. @item ar
  9372. alternating frames (right eye first, left eye second)
  9373. @item irl
  9374. interleaved rows (left eye has top row, right eye starts on next row)
  9375. @item irr
  9376. interleaved rows (right eye has top row, left eye starts on next row)
  9377. @item icl
  9378. interleaved columns, left eye first
  9379. @item icr
  9380. interleaved columns, right eye first
  9381. Default value is @samp{sbsl}.
  9382. @end table
  9383. @item out
  9384. Set stereoscopic image format of output.
  9385. @table @samp
  9386. @item sbsl
  9387. side by side parallel (left eye left, right eye right)
  9388. @item sbsr
  9389. side by side crosseye (right eye left, left eye right)
  9390. @item sbs2l
  9391. side by side parallel with half width resolution
  9392. (left eye left, right eye right)
  9393. @item sbs2r
  9394. side by side crosseye with half width resolution
  9395. (right eye left, left eye right)
  9396. @item abl
  9397. above-below (left eye above, right eye below)
  9398. @item abr
  9399. above-below (right eye above, left eye below)
  9400. @item ab2l
  9401. above-below with half height resolution
  9402. (left eye above, right eye below)
  9403. @item ab2r
  9404. above-below with half height resolution
  9405. (right eye above, left eye below)
  9406. @item al
  9407. alternating frames (left eye first, right eye second)
  9408. @item ar
  9409. alternating frames (right eye first, left eye second)
  9410. @item irl
  9411. interleaved rows (left eye has top row, right eye starts on next row)
  9412. @item irr
  9413. interleaved rows (right eye has top row, left eye starts on next row)
  9414. @item arbg
  9415. anaglyph red/blue gray
  9416. (red filter on left eye, blue filter on right eye)
  9417. @item argg
  9418. anaglyph red/green gray
  9419. (red filter on left eye, green filter on right eye)
  9420. @item arcg
  9421. anaglyph red/cyan gray
  9422. (red filter on left eye, cyan filter on right eye)
  9423. @item arch
  9424. anaglyph red/cyan half colored
  9425. (red filter on left eye, cyan filter on right eye)
  9426. @item arcc
  9427. anaglyph red/cyan color
  9428. (red filter on left eye, cyan filter on right eye)
  9429. @item arcd
  9430. anaglyph red/cyan color optimized with the least squares projection of dubois
  9431. (red filter on left eye, cyan filter on right eye)
  9432. @item agmg
  9433. anaglyph green/magenta gray
  9434. (green filter on left eye, magenta filter on right eye)
  9435. @item agmh
  9436. anaglyph green/magenta half colored
  9437. (green filter on left eye, magenta filter on right eye)
  9438. @item agmc
  9439. anaglyph green/magenta colored
  9440. (green filter on left eye, magenta filter on right eye)
  9441. @item agmd
  9442. anaglyph green/magenta color optimized with the least squares projection of dubois
  9443. (green filter on left eye, magenta filter on right eye)
  9444. @item aybg
  9445. anaglyph yellow/blue gray
  9446. (yellow filter on left eye, blue filter on right eye)
  9447. @item aybh
  9448. anaglyph yellow/blue half colored
  9449. (yellow filter on left eye, blue filter on right eye)
  9450. @item aybc
  9451. anaglyph yellow/blue colored
  9452. (yellow filter on left eye, blue filter on right eye)
  9453. @item aybd
  9454. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9455. (yellow filter on left eye, blue filter on right eye)
  9456. @item ml
  9457. mono output (left eye only)
  9458. @item mr
  9459. mono output (right eye only)
  9460. @item chl
  9461. checkerboard, left eye first
  9462. @item chr
  9463. checkerboard, right eye first
  9464. @item icl
  9465. interleaved columns, left eye first
  9466. @item icr
  9467. interleaved columns, right eye first
  9468. @item hdmi
  9469. HDMI frame pack
  9470. @end table
  9471. Default value is @samp{arcd}.
  9472. @end table
  9473. @subsection Examples
  9474. @itemize
  9475. @item
  9476. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9477. @example
  9478. stereo3d=sbsl:aybd
  9479. @end example
  9480. @item
  9481. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9482. @example
  9483. stereo3d=abl:sbsr
  9484. @end example
  9485. @end itemize
  9486. @section streamselect, astreamselect
  9487. Select video or audio streams.
  9488. The filter accepts the following options:
  9489. @table @option
  9490. @item inputs
  9491. Set number of inputs. Default is 2.
  9492. @item map
  9493. Set input indexes to remap to outputs.
  9494. @end table
  9495. @subsection Commands
  9496. The @code{streamselect} and @code{astreamselect} filter supports the following
  9497. commands:
  9498. @table @option
  9499. @item map
  9500. Set input indexes to remap to outputs.
  9501. @end table
  9502. @subsection Examples
  9503. @itemize
  9504. @item
  9505. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9506. @example
  9507. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9508. @end example
  9509. @item
  9510. Same as above, but for audio:
  9511. @example
  9512. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9513. @end example
  9514. @end itemize
  9515. @anchor{spp}
  9516. @section spp
  9517. Apply a simple postprocessing filter that compresses and decompresses the image
  9518. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9519. and average the results.
  9520. The filter accepts the following options:
  9521. @table @option
  9522. @item quality
  9523. Set quality. This option defines the number of levels for averaging. It accepts
  9524. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9525. effect. A value of @code{6} means the higher quality. For each increment of
  9526. that value the speed drops by a factor of approximately 2. Default value is
  9527. @code{3}.
  9528. @item qp
  9529. Force a constant quantization parameter. If not set, the filter will use the QP
  9530. from the video stream (if available).
  9531. @item mode
  9532. Set thresholding mode. Available modes are:
  9533. @table @samp
  9534. @item hard
  9535. Set hard thresholding (default).
  9536. @item soft
  9537. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9538. @end table
  9539. @item use_bframe_qp
  9540. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9541. option may cause flicker since the B-Frames have often larger QP. Default is
  9542. @code{0} (not enabled).
  9543. @end table
  9544. @anchor{subtitles}
  9545. @section subtitles
  9546. Draw subtitles on top of input video using the libass library.
  9547. To enable compilation of this filter you need to configure FFmpeg with
  9548. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9549. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9550. Alpha) subtitles format.
  9551. The filter accepts the following options:
  9552. @table @option
  9553. @item filename, f
  9554. Set the filename of the subtitle file to read. It must be specified.
  9555. @item original_size
  9556. Specify the size of the original video, the video for which the ASS file
  9557. was composed. For the syntax of this option, check the
  9558. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9559. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9560. correctly scale the fonts if the aspect ratio has been changed.
  9561. @item fontsdir
  9562. Set a directory path containing fonts that can be used by the filter.
  9563. These fonts will be used in addition to whatever the font provider uses.
  9564. @item charenc
  9565. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9566. useful if not UTF-8.
  9567. @item stream_index, si
  9568. Set subtitles stream index. @code{subtitles} filter only.
  9569. @item force_style
  9570. Override default style or script info parameters of the subtitles. It accepts a
  9571. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9572. @end table
  9573. If the first key is not specified, it is assumed that the first value
  9574. specifies the @option{filename}.
  9575. For example, to render the file @file{sub.srt} on top of the input
  9576. video, use the command:
  9577. @example
  9578. subtitles=sub.srt
  9579. @end example
  9580. which is equivalent to:
  9581. @example
  9582. subtitles=filename=sub.srt
  9583. @end example
  9584. To render the default subtitles stream from file @file{video.mkv}, use:
  9585. @example
  9586. subtitles=video.mkv
  9587. @end example
  9588. To render the second subtitles stream from that file, use:
  9589. @example
  9590. subtitles=video.mkv:si=1
  9591. @end example
  9592. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9593. @code{DejaVu Serif}, use:
  9594. @example
  9595. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9596. @end example
  9597. @section super2xsai
  9598. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9599. Interpolate) pixel art scaling algorithm.
  9600. Useful for enlarging pixel art images without reducing sharpness.
  9601. @section swaprect
  9602. Swap two rectangular objects in video.
  9603. This filter accepts the following options:
  9604. @table @option
  9605. @item w
  9606. Set object width.
  9607. @item h
  9608. Set object height.
  9609. @item x1
  9610. Set 1st rect x coordinate.
  9611. @item y1
  9612. Set 1st rect y coordinate.
  9613. @item x2
  9614. Set 2nd rect x coordinate.
  9615. @item y2
  9616. Set 2nd rect y coordinate.
  9617. All expressions are evaluated once for each frame.
  9618. @end table
  9619. The all options are expressions containing the following constants:
  9620. @table @option
  9621. @item w
  9622. @item h
  9623. The input width and height.
  9624. @item a
  9625. same as @var{w} / @var{h}
  9626. @item sar
  9627. input sample aspect ratio
  9628. @item dar
  9629. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9630. @item n
  9631. The number of the input frame, starting from 0.
  9632. @item t
  9633. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9634. @item pos
  9635. the position in the file of the input frame, NAN if unknown
  9636. @end table
  9637. @section swapuv
  9638. Swap U & V plane.
  9639. @section telecine
  9640. Apply telecine process to the video.
  9641. This filter accepts the following options:
  9642. @table @option
  9643. @item first_field
  9644. @table @samp
  9645. @item top, t
  9646. top field first
  9647. @item bottom, b
  9648. bottom field first
  9649. The default value is @code{top}.
  9650. @end table
  9651. @item pattern
  9652. A string of numbers representing the pulldown pattern you wish to apply.
  9653. The default value is @code{23}.
  9654. @end table
  9655. @example
  9656. Some typical patterns:
  9657. NTSC output (30i):
  9658. 27.5p: 32222
  9659. 24p: 23 (classic)
  9660. 24p: 2332 (preferred)
  9661. 20p: 33
  9662. 18p: 334
  9663. 16p: 3444
  9664. PAL output (25i):
  9665. 27.5p: 12222
  9666. 24p: 222222222223 ("Euro pulldown")
  9667. 16.67p: 33
  9668. 16p: 33333334
  9669. @end example
  9670. @section thumbnail
  9671. Select the most representative frame in a given sequence of consecutive frames.
  9672. The filter accepts the following options:
  9673. @table @option
  9674. @item n
  9675. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  9676. will pick one of them, and then handle the next batch of @var{n} frames until
  9677. the end. Default is @code{100}.
  9678. @end table
  9679. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  9680. value will result in a higher memory usage, so a high value is not recommended.
  9681. @subsection Examples
  9682. @itemize
  9683. @item
  9684. Extract one picture each 50 frames:
  9685. @example
  9686. thumbnail=50
  9687. @end example
  9688. @item
  9689. Complete example of a thumbnail creation with @command{ffmpeg}:
  9690. @example
  9691. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  9692. @end example
  9693. @end itemize
  9694. @section tile
  9695. Tile several successive frames together.
  9696. The filter accepts the following options:
  9697. @table @option
  9698. @item layout
  9699. Set the grid size (i.e. the number of lines and columns). For the syntax of
  9700. this option, check the
  9701. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9702. @item nb_frames
  9703. Set the maximum number of frames to render in the given area. It must be less
  9704. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  9705. the area will be used.
  9706. @item margin
  9707. Set the outer border margin in pixels.
  9708. @item padding
  9709. Set the inner border thickness (i.e. the number of pixels between frames). For
  9710. more advanced padding options (such as having different values for the edges),
  9711. refer to the pad video filter.
  9712. @item color
  9713. Specify the color of the unused area. For the syntax of this option, check the
  9714. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  9715. is "black".
  9716. @end table
  9717. @subsection Examples
  9718. @itemize
  9719. @item
  9720. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  9721. @example
  9722. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  9723. @end example
  9724. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  9725. duplicating each output frame to accommodate the originally detected frame
  9726. rate.
  9727. @item
  9728. Display @code{5} pictures in an area of @code{3x2} frames,
  9729. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  9730. mixed flat and named options:
  9731. @example
  9732. tile=3x2:nb_frames=5:padding=7:margin=2
  9733. @end example
  9734. @end itemize
  9735. @section tinterlace
  9736. Perform various types of temporal field interlacing.
  9737. Frames are counted starting from 1, so the first input frame is
  9738. considered odd.
  9739. The filter accepts the following options:
  9740. @table @option
  9741. @item mode
  9742. Specify the mode of the interlacing. This option can also be specified
  9743. as a value alone. See below for a list of values for this option.
  9744. Available values are:
  9745. @table @samp
  9746. @item merge, 0
  9747. Move odd frames into the upper field, even into the lower field,
  9748. generating a double height frame at half frame rate.
  9749. @example
  9750. ------> time
  9751. Input:
  9752. Frame 1 Frame 2 Frame 3 Frame 4
  9753. 11111 22222 33333 44444
  9754. 11111 22222 33333 44444
  9755. 11111 22222 33333 44444
  9756. 11111 22222 33333 44444
  9757. Output:
  9758. 11111 33333
  9759. 22222 44444
  9760. 11111 33333
  9761. 22222 44444
  9762. 11111 33333
  9763. 22222 44444
  9764. 11111 33333
  9765. 22222 44444
  9766. @end example
  9767. @item drop_even, 1
  9768. Only output odd frames, even frames are dropped, generating a frame with
  9769. unchanged height at half frame rate.
  9770. @example
  9771. ------> time
  9772. Input:
  9773. Frame 1 Frame 2 Frame 3 Frame 4
  9774. 11111 22222 33333 44444
  9775. 11111 22222 33333 44444
  9776. 11111 22222 33333 44444
  9777. 11111 22222 33333 44444
  9778. Output:
  9779. 11111 33333
  9780. 11111 33333
  9781. 11111 33333
  9782. 11111 33333
  9783. @end example
  9784. @item drop_odd, 2
  9785. Only output even frames, odd frames are dropped, generating a frame with
  9786. unchanged height at half frame rate.
  9787. @example
  9788. ------> time
  9789. Input:
  9790. Frame 1 Frame 2 Frame 3 Frame 4
  9791. 11111 22222 33333 44444
  9792. 11111 22222 33333 44444
  9793. 11111 22222 33333 44444
  9794. 11111 22222 33333 44444
  9795. Output:
  9796. 22222 44444
  9797. 22222 44444
  9798. 22222 44444
  9799. 22222 44444
  9800. @end example
  9801. @item pad, 3
  9802. Expand each frame to full height, but pad alternate lines with black,
  9803. generating a frame with double height at the same input frame rate.
  9804. @example
  9805. ------> time
  9806. Input:
  9807. Frame 1 Frame 2 Frame 3 Frame 4
  9808. 11111 22222 33333 44444
  9809. 11111 22222 33333 44444
  9810. 11111 22222 33333 44444
  9811. 11111 22222 33333 44444
  9812. Output:
  9813. 11111 ..... 33333 .....
  9814. ..... 22222 ..... 44444
  9815. 11111 ..... 33333 .....
  9816. ..... 22222 ..... 44444
  9817. 11111 ..... 33333 .....
  9818. ..... 22222 ..... 44444
  9819. 11111 ..... 33333 .....
  9820. ..... 22222 ..... 44444
  9821. @end example
  9822. @item interleave_top, 4
  9823. Interleave the upper field from odd frames with the lower field from
  9824. even frames, generating a frame with unchanged height at half frame rate.
  9825. @example
  9826. ------> time
  9827. Input:
  9828. Frame 1 Frame 2 Frame 3 Frame 4
  9829. 11111<- 22222 33333<- 44444
  9830. 11111 22222<- 33333 44444<-
  9831. 11111<- 22222 33333<- 44444
  9832. 11111 22222<- 33333 44444<-
  9833. Output:
  9834. 11111 33333
  9835. 22222 44444
  9836. 11111 33333
  9837. 22222 44444
  9838. @end example
  9839. @item interleave_bottom, 5
  9840. Interleave the lower field from odd frames with the upper field from
  9841. even frames, generating a frame with unchanged height at half frame rate.
  9842. @example
  9843. ------> time
  9844. Input:
  9845. Frame 1 Frame 2 Frame 3 Frame 4
  9846. 11111 22222<- 33333 44444<-
  9847. 11111<- 22222 33333<- 44444
  9848. 11111 22222<- 33333 44444<-
  9849. 11111<- 22222 33333<- 44444
  9850. Output:
  9851. 22222 44444
  9852. 11111 33333
  9853. 22222 44444
  9854. 11111 33333
  9855. @end example
  9856. @item interlacex2, 6
  9857. Double frame rate with unchanged height. Frames are inserted each
  9858. containing the second temporal field from the previous input frame and
  9859. the first temporal field from the next input frame. This mode relies on
  9860. the top_field_first flag. Useful for interlaced video displays with no
  9861. field synchronisation.
  9862. @example
  9863. ------> time
  9864. Input:
  9865. Frame 1 Frame 2 Frame 3 Frame 4
  9866. 11111 22222 33333 44444
  9867. 11111 22222 33333 44444
  9868. 11111 22222 33333 44444
  9869. 11111 22222 33333 44444
  9870. Output:
  9871. 11111 22222 22222 33333 33333 44444 44444
  9872. 11111 11111 22222 22222 33333 33333 44444
  9873. 11111 22222 22222 33333 33333 44444 44444
  9874. 11111 11111 22222 22222 33333 33333 44444
  9875. @end example
  9876. @item mergex2, 7
  9877. Move odd frames into the upper field, even into the lower field,
  9878. generating a double height frame at same frame rate.
  9879. @example
  9880. ------> time
  9881. Input:
  9882. Frame 1 Frame 2 Frame 3 Frame 4
  9883. 11111 22222 33333 44444
  9884. 11111 22222 33333 44444
  9885. 11111 22222 33333 44444
  9886. 11111 22222 33333 44444
  9887. Output:
  9888. 11111 33333 33333 55555
  9889. 22222 22222 44444 44444
  9890. 11111 33333 33333 55555
  9891. 22222 22222 44444 44444
  9892. 11111 33333 33333 55555
  9893. 22222 22222 44444 44444
  9894. 11111 33333 33333 55555
  9895. 22222 22222 44444 44444
  9896. @end example
  9897. @end table
  9898. Numeric values are deprecated but are accepted for backward
  9899. compatibility reasons.
  9900. Default mode is @code{merge}.
  9901. @item flags
  9902. Specify flags influencing the filter process.
  9903. Available value for @var{flags} is:
  9904. @table @option
  9905. @item low_pass_filter, vlfp
  9906. Enable vertical low-pass filtering in the filter.
  9907. Vertical low-pass filtering is required when creating an interlaced
  9908. destination from a progressive source which contains high-frequency
  9909. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  9910. patterning.
  9911. Vertical low-pass filtering can only be enabled for @option{mode}
  9912. @var{interleave_top} and @var{interleave_bottom}.
  9913. @end table
  9914. @end table
  9915. @section transpose
  9916. Transpose rows with columns in the input video and optionally flip it.
  9917. It accepts the following parameters:
  9918. @table @option
  9919. @item dir
  9920. Specify the transposition direction.
  9921. Can assume the following values:
  9922. @table @samp
  9923. @item 0, 4, cclock_flip
  9924. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  9925. @example
  9926. L.R L.l
  9927. . . -> . .
  9928. l.r R.r
  9929. @end example
  9930. @item 1, 5, clock
  9931. Rotate by 90 degrees clockwise, that is:
  9932. @example
  9933. L.R l.L
  9934. . . -> . .
  9935. l.r r.R
  9936. @end example
  9937. @item 2, 6, cclock
  9938. Rotate by 90 degrees counterclockwise, that is:
  9939. @example
  9940. L.R R.r
  9941. . . -> . .
  9942. l.r L.l
  9943. @end example
  9944. @item 3, 7, clock_flip
  9945. Rotate by 90 degrees clockwise and vertically flip, that is:
  9946. @example
  9947. L.R r.R
  9948. . . -> . .
  9949. l.r l.L
  9950. @end example
  9951. @end table
  9952. For values between 4-7, the transposition is only done if the input
  9953. video geometry is portrait and not landscape. These values are
  9954. deprecated, the @code{passthrough} option should be used instead.
  9955. Numerical values are deprecated, and should be dropped in favor of
  9956. symbolic constants.
  9957. @item passthrough
  9958. Do not apply the transposition if the input geometry matches the one
  9959. specified by the specified value. It accepts the following values:
  9960. @table @samp
  9961. @item none
  9962. Always apply transposition.
  9963. @item portrait
  9964. Preserve portrait geometry (when @var{height} >= @var{width}).
  9965. @item landscape
  9966. Preserve landscape geometry (when @var{width} >= @var{height}).
  9967. @end table
  9968. Default value is @code{none}.
  9969. @end table
  9970. For example to rotate by 90 degrees clockwise and preserve portrait
  9971. layout:
  9972. @example
  9973. transpose=dir=1:passthrough=portrait
  9974. @end example
  9975. The command above can also be specified as:
  9976. @example
  9977. transpose=1:portrait
  9978. @end example
  9979. @section trim
  9980. Trim the input so that the output contains one continuous subpart of the input.
  9981. It accepts the following parameters:
  9982. @table @option
  9983. @item start
  9984. Specify the time of the start of the kept section, i.e. the frame with the
  9985. timestamp @var{start} will be the first frame in the output.
  9986. @item end
  9987. Specify the time of the first frame that will be dropped, i.e. the frame
  9988. immediately preceding the one with the timestamp @var{end} will be the last
  9989. frame in the output.
  9990. @item start_pts
  9991. This is the same as @var{start}, except this option sets the start timestamp
  9992. in timebase units instead of seconds.
  9993. @item end_pts
  9994. This is the same as @var{end}, except this option sets the end timestamp
  9995. in timebase units instead of seconds.
  9996. @item duration
  9997. The maximum duration of the output in seconds.
  9998. @item start_frame
  9999. The number of the first frame that should be passed to the output.
  10000. @item end_frame
  10001. The number of the first frame that should be dropped.
  10002. @end table
  10003. @option{start}, @option{end}, and @option{duration} are expressed as time
  10004. duration specifications; see
  10005. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10006. for the accepted syntax.
  10007. Note that the first two sets of the start/end options and the @option{duration}
  10008. option look at the frame timestamp, while the _frame variants simply count the
  10009. frames that pass through the filter. Also note that this filter does not modify
  10010. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10011. setpts filter after the trim filter.
  10012. If multiple start or end options are set, this filter tries to be greedy and
  10013. keep all the frames that match at least one of the specified constraints. To keep
  10014. only the part that matches all the constraints at once, chain multiple trim
  10015. filters.
  10016. The defaults are such that all the input is kept. So it is possible to set e.g.
  10017. just the end values to keep everything before the specified time.
  10018. Examples:
  10019. @itemize
  10020. @item
  10021. Drop everything except the second minute of input:
  10022. @example
  10023. ffmpeg -i INPUT -vf trim=60:120
  10024. @end example
  10025. @item
  10026. Keep only the first second:
  10027. @example
  10028. ffmpeg -i INPUT -vf trim=duration=1
  10029. @end example
  10030. @end itemize
  10031. @anchor{unsharp}
  10032. @section unsharp
  10033. Sharpen or blur the input video.
  10034. It accepts the following parameters:
  10035. @table @option
  10036. @item luma_msize_x, lx
  10037. Set the luma matrix horizontal size. It must be an odd integer between
  10038. 3 and 63. The default value is 5.
  10039. @item luma_msize_y, ly
  10040. Set the luma matrix vertical size. It must be an odd integer between 3
  10041. and 63. The default value is 5.
  10042. @item luma_amount, la
  10043. Set the luma effect strength. It must be a floating point number, reasonable
  10044. values lay between -1.5 and 1.5.
  10045. Negative values will blur the input video, while positive values will
  10046. sharpen it, a value of zero will disable the effect.
  10047. Default value is 1.0.
  10048. @item chroma_msize_x, cx
  10049. Set the chroma matrix horizontal size. It must be an odd integer
  10050. between 3 and 63. The default value is 5.
  10051. @item chroma_msize_y, cy
  10052. Set the chroma matrix vertical size. It must be an odd integer
  10053. between 3 and 63. The default value is 5.
  10054. @item chroma_amount, ca
  10055. Set the chroma effect strength. It must be a floating point number, reasonable
  10056. values lay between -1.5 and 1.5.
  10057. Negative values will blur the input video, while positive values will
  10058. sharpen it, a value of zero will disable the effect.
  10059. Default value is 0.0.
  10060. @item opencl
  10061. If set to 1, specify using OpenCL capabilities, only available if
  10062. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10063. @end table
  10064. All parameters are optional and default to the equivalent of the
  10065. string '5:5:1.0:5:5:0.0'.
  10066. @subsection Examples
  10067. @itemize
  10068. @item
  10069. Apply strong luma sharpen effect:
  10070. @example
  10071. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10072. @end example
  10073. @item
  10074. Apply a strong blur of both luma and chroma parameters:
  10075. @example
  10076. unsharp=7:7:-2:7:7:-2
  10077. @end example
  10078. @end itemize
  10079. @section uspp
  10080. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10081. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10082. shifts and average the results.
  10083. The way this differs from the behavior of spp is that uspp actually encodes &
  10084. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10085. DCT similar to MJPEG.
  10086. The filter accepts the following options:
  10087. @table @option
  10088. @item quality
  10089. Set quality. This option defines the number of levels for averaging. It accepts
  10090. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10091. effect. A value of @code{8} means the higher quality. For each increment of
  10092. that value the speed drops by a factor of approximately 2. Default value is
  10093. @code{3}.
  10094. @item qp
  10095. Force a constant quantization parameter. If not set, the filter will use the QP
  10096. from the video stream (if available).
  10097. @end table
  10098. @section vectorscope
  10099. Display 2 color component values in the two dimensional graph (which is called
  10100. a vectorscope).
  10101. This filter accepts the following options:
  10102. @table @option
  10103. @item mode, m
  10104. Set vectorscope mode.
  10105. It accepts the following values:
  10106. @table @samp
  10107. @item gray
  10108. Gray values are displayed on graph, higher brightness means more pixels have
  10109. same component color value on location in graph. This is the default mode.
  10110. @item color
  10111. Gray values are displayed on graph. Surrounding pixels values which are not
  10112. present in video frame are drawn in gradient of 2 color components which are
  10113. set by option @code{x} and @code{y}. The 3rd color component is static.
  10114. @item color2
  10115. Actual color components values present in video frame are displayed on graph.
  10116. @item color3
  10117. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10118. on graph increases value of another color component, which is luminance by
  10119. default values of @code{x} and @code{y}.
  10120. @item color4
  10121. Actual colors present in video frame are displayed on graph. If two different
  10122. colors map to same position on graph then color with higher value of component
  10123. not present in graph is picked.
  10124. @item color5
  10125. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10126. component picked from radial gradient.
  10127. @end table
  10128. @item x
  10129. Set which color component will be represented on X-axis. Default is @code{1}.
  10130. @item y
  10131. Set which color component will be represented on Y-axis. Default is @code{2}.
  10132. @item intensity, i
  10133. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10134. of color component which represents frequency of (X, Y) location in graph.
  10135. @item envelope, e
  10136. @table @samp
  10137. @item none
  10138. No envelope, this is default.
  10139. @item instant
  10140. Instant envelope, even darkest single pixel will be clearly highlighted.
  10141. @item peak
  10142. Hold maximum and minimum values presented in graph over time. This way you
  10143. can still spot out of range values without constantly looking at vectorscope.
  10144. @item peak+instant
  10145. Peak and instant envelope combined together.
  10146. @end table
  10147. @item graticule, g
  10148. Set what kind of graticule to draw.
  10149. @table @samp
  10150. @item none
  10151. @item green
  10152. @item color
  10153. @end table
  10154. @item opacity, o
  10155. Set graticule opacity.
  10156. @item flags, f
  10157. Set graticule flags.
  10158. @table @samp
  10159. @item white
  10160. Draw graticule for white point.
  10161. @item black
  10162. Draw graticule for black point.
  10163. @item name
  10164. Draw color points short names.
  10165. @end table
  10166. @item bgopacity, b
  10167. Set background opacity.
  10168. @item lthreshold, l
  10169. Set low threshold for color component not represented on X or Y axis.
  10170. Values lower than this value will be ignored. Default is 0.
  10171. Note this value is multiplied with actual max possible value one pixel component
  10172. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10173. is 0.1 * 255 = 25.
  10174. @item hthreshold, h
  10175. Set high threshold for color component not represented on X or Y axis.
  10176. Values higher than this value will be ignored. Default is 1.
  10177. Note this value is multiplied with actual max possible value one pixel component
  10178. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10179. is 0.9 * 255 = 230.
  10180. @item colorspace, c
  10181. Set what kind of colorspace to use when drawing graticule.
  10182. @table @samp
  10183. @item auto
  10184. @item 601
  10185. @item 709
  10186. @end table
  10187. Default is auto.
  10188. @end table
  10189. @anchor{vidstabdetect}
  10190. @section vidstabdetect
  10191. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10192. @ref{vidstabtransform} for pass 2.
  10193. This filter generates a file with relative translation and rotation
  10194. transform information about subsequent frames, which is then used by
  10195. the @ref{vidstabtransform} filter.
  10196. To enable compilation of this filter you need to configure FFmpeg with
  10197. @code{--enable-libvidstab}.
  10198. This filter accepts the following options:
  10199. @table @option
  10200. @item result
  10201. Set the path to the file used to write the transforms information.
  10202. Default value is @file{transforms.trf}.
  10203. @item shakiness
  10204. Set how shaky the video is and how quick the camera is. It accepts an
  10205. integer in the range 1-10, a value of 1 means little shakiness, a
  10206. value of 10 means strong shakiness. Default value is 5.
  10207. @item accuracy
  10208. Set the accuracy of the detection process. It must be a value in the
  10209. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10210. accuracy. Default value is 15.
  10211. @item stepsize
  10212. Set stepsize of the search process. The region around minimum is
  10213. scanned with 1 pixel resolution. Default value is 6.
  10214. @item mincontrast
  10215. Set minimum contrast. Below this value a local measurement field is
  10216. discarded. Must be a floating point value in the range 0-1. Default
  10217. value is 0.3.
  10218. @item tripod
  10219. Set reference frame number for tripod mode.
  10220. If enabled, the motion of the frames is compared to a reference frame
  10221. in the filtered stream, identified by the specified number. The idea
  10222. is to compensate all movements in a more-or-less static scene and keep
  10223. the camera view absolutely still.
  10224. If set to 0, it is disabled. The frames are counted starting from 1.
  10225. @item show
  10226. Show fields and transforms in the resulting frames. It accepts an
  10227. integer in the range 0-2. Default value is 0, which disables any
  10228. visualization.
  10229. @end table
  10230. @subsection Examples
  10231. @itemize
  10232. @item
  10233. Use default values:
  10234. @example
  10235. vidstabdetect
  10236. @end example
  10237. @item
  10238. Analyze strongly shaky movie and put the results in file
  10239. @file{mytransforms.trf}:
  10240. @example
  10241. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10242. @end example
  10243. @item
  10244. Visualize the result of internal transformations in the resulting
  10245. video:
  10246. @example
  10247. vidstabdetect=show=1
  10248. @end example
  10249. @item
  10250. Analyze a video with medium shakiness using @command{ffmpeg}:
  10251. @example
  10252. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10253. @end example
  10254. @end itemize
  10255. @anchor{vidstabtransform}
  10256. @section vidstabtransform
  10257. Video stabilization/deshaking: pass 2 of 2,
  10258. see @ref{vidstabdetect} for pass 1.
  10259. Read a file with transform information for each frame and
  10260. apply/compensate them. Together with the @ref{vidstabdetect}
  10261. filter this can be used to deshake videos. See also
  10262. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10263. the @ref{unsharp} filter, see below.
  10264. To enable compilation of this filter you need to configure FFmpeg with
  10265. @code{--enable-libvidstab}.
  10266. @subsection Options
  10267. @table @option
  10268. @item input
  10269. Set path to the file used to read the transforms. Default value is
  10270. @file{transforms.trf}.
  10271. @item smoothing
  10272. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10273. camera movements. Default value is 10.
  10274. For example a number of 10 means that 21 frames are used (10 in the
  10275. past and 10 in the future) to smoothen the motion in the video. A
  10276. larger value leads to a smoother video, but limits the acceleration of
  10277. the camera (pan/tilt movements). 0 is a special case where a static
  10278. camera is simulated.
  10279. @item optalgo
  10280. Set the camera path optimization algorithm.
  10281. Accepted values are:
  10282. @table @samp
  10283. @item gauss
  10284. gaussian kernel low-pass filter on camera motion (default)
  10285. @item avg
  10286. averaging on transformations
  10287. @end table
  10288. @item maxshift
  10289. Set maximal number of pixels to translate frames. Default value is -1,
  10290. meaning no limit.
  10291. @item maxangle
  10292. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10293. value is -1, meaning no limit.
  10294. @item crop
  10295. Specify how to deal with borders that may be visible due to movement
  10296. compensation.
  10297. Available values are:
  10298. @table @samp
  10299. @item keep
  10300. keep image information from previous frame (default)
  10301. @item black
  10302. fill the border black
  10303. @end table
  10304. @item invert
  10305. Invert transforms if set to 1. Default value is 0.
  10306. @item relative
  10307. Consider transforms as relative to previous frame if set to 1,
  10308. absolute if set to 0. Default value is 0.
  10309. @item zoom
  10310. Set percentage to zoom. A positive value will result in a zoom-in
  10311. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10312. zoom).
  10313. @item optzoom
  10314. Set optimal zooming to avoid borders.
  10315. Accepted values are:
  10316. @table @samp
  10317. @item 0
  10318. disabled
  10319. @item 1
  10320. optimal static zoom value is determined (only very strong movements
  10321. will lead to visible borders) (default)
  10322. @item 2
  10323. optimal adaptive zoom value is determined (no borders will be
  10324. visible), see @option{zoomspeed}
  10325. @end table
  10326. Note that the value given at zoom is added to the one calculated here.
  10327. @item zoomspeed
  10328. Set percent to zoom maximally each frame (enabled when
  10329. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10330. 0.25.
  10331. @item interpol
  10332. Specify type of interpolation.
  10333. Available values are:
  10334. @table @samp
  10335. @item no
  10336. no interpolation
  10337. @item linear
  10338. linear only horizontal
  10339. @item bilinear
  10340. linear in both directions (default)
  10341. @item bicubic
  10342. cubic in both directions (slow)
  10343. @end table
  10344. @item tripod
  10345. Enable virtual tripod mode if set to 1, which is equivalent to
  10346. @code{relative=0:smoothing=0}. Default value is 0.
  10347. Use also @code{tripod} option of @ref{vidstabdetect}.
  10348. @item debug
  10349. Increase log verbosity if set to 1. Also the detected global motions
  10350. are written to the temporary file @file{global_motions.trf}. Default
  10351. value is 0.
  10352. @end table
  10353. @subsection Examples
  10354. @itemize
  10355. @item
  10356. Use @command{ffmpeg} for a typical stabilization with default values:
  10357. @example
  10358. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10359. @end example
  10360. Note the use of the @ref{unsharp} filter which is always recommended.
  10361. @item
  10362. Zoom in a bit more and load transform data from a given file:
  10363. @example
  10364. vidstabtransform=zoom=5:input="mytransforms.trf"
  10365. @end example
  10366. @item
  10367. Smoothen the video even more:
  10368. @example
  10369. vidstabtransform=smoothing=30
  10370. @end example
  10371. @end itemize
  10372. @section vflip
  10373. Flip the input video vertically.
  10374. For example, to vertically flip a video with @command{ffmpeg}:
  10375. @example
  10376. ffmpeg -i in.avi -vf "vflip" out.avi
  10377. @end example
  10378. @anchor{vignette}
  10379. @section vignette
  10380. Make or reverse a natural vignetting effect.
  10381. The filter accepts the following options:
  10382. @table @option
  10383. @item angle, a
  10384. Set lens angle expression as a number of radians.
  10385. The value is clipped in the @code{[0,PI/2]} range.
  10386. Default value: @code{"PI/5"}
  10387. @item x0
  10388. @item y0
  10389. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10390. by default.
  10391. @item mode
  10392. Set forward/backward mode.
  10393. Available modes are:
  10394. @table @samp
  10395. @item forward
  10396. The larger the distance from the central point, the darker the image becomes.
  10397. @item backward
  10398. The larger the distance from the central point, the brighter the image becomes.
  10399. This can be used to reverse a vignette effect, though there is no automatic
  10400. detection to extract the lens @option{angle} and other settings (yet). It can
  10401. also be used to create a burning effect.
  10402. @end table
  10403. Default value is @samp{forward}.
  10404. @item eval
  10405. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10406. It accepts the following values:
  10407. @table @samp
  10408. @item init
  10409. Evaluate expressions only once during the filter initialization.
  10410. @item frame
  10411. Evaluate expressions for each incoming frame. This is way slower than the
  10412. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10413. allows advanced dynamic expressions.
  10414. @end table
  10415. Default value is @samp{init}.
  10416. @item dither
  10417. Set dithering to reduce the circular banding effects. Default is @code{1}
  10418. (enabled).
  10419. @item aspect
  10420. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10421. Setting this value to the SAR of the input will make a rectangular vignetting
  10422. following the dimensions of the video.
  10423. Default is @code{1/1}.
  10424. @end table
  10425. @subsection Expressions
  10426. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10427. following parameters.
  10428. @table @option
  10429. @item w
  10430. @item h
  10431. input width and height
  10432. @item n
  10433. the number of input frame, starting from 0
  10434. @item pts
  10435. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10436. @var{TB} units, NAN if undefined
  10437. @item r
  10438. frame rate of the input video, NAN if the input frame rate is unknown
  10439. @item t
  10440. the PTS (Presentation TimeStamp) of the filtered video frame,
  10441. expressed in seconds, NAN if undefined
  10442. @item tb
  10443. time base of the input video
  10444. @end table
  10445. @subsection Examples
  10446. @itemize
  10447. @item
  10448. Apply simple strong vignetting effect:
  10449. @example
  10450. vignette=PI/4
  10451. @end example
  10452. @item
  10453. Make a flickering vignetting:
  10454. @example
  10455. vignette='PI/4+random(1)*PI/50':eval=frame
  10456. @end example
  10457. @end itemize
  10458. @section vstack
  10459. Stack input videos vertically.
  10460. All streams must be of same pixel format and of same width.
  10461. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10462. to create same output.
  10463. The filter accept the following option:
  10464. @table @option
  10465. @item inputs
  10466. Set number of input streams. Default is 2.
  10467. @item shortest
  10468. If set to 1, force the output to terminate when the shortest input
  10469. terminates. Default value is 0.
  10470. @end table
  10471. @section w3fdif
  10472. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  10473. Deinterlacing Filter").
  10474. Based on the process described by Martin Weston for BBC R&D, and
  10475. implemented based on the de-interlace algorithm written by Jim
  10476. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  10477. uses filter coefficients calculated by BBC R&D.
  10478. There are two sets of filter coefficients, so called "simple":
  10479. and "complex". Which set of filter coefficients is used can
  10480. be set by passing an optional parameter:
  10481. @table @option
  10482. @item filter
  10483. Set the interlacing filter coefficients. Accepts one of the following values:
  10484. @table @samp
  10485. @item simple
  10486. Simple filter coefficient set.
  10487. @item complex
  10488. More-complex filter coefficient set.
  10489. @end table
  10490. Default value is @samp{complex}.
  10491. @item deint
  10492. Specify which frames to deinterlace. Accept one of the following values:
  10493. @table @samp
  10494. @item all
  10495. Deinterlace all frames,
  10496. @item interlaced
  10497. Only deinterlace frames marked as interlaced.
  10498. @end table
  10499. Default value is @samp{all}.
  10500. @end table
  10501. @section waveform
  10502. Video waveform monitor.
  10503. The waveform monitor plots color component intensity. By default luminance
  10504. only. Each column of the waveform corresponds to a column of pixels in the
  10505. source video.
  10506. It accepts the following options:
  10507. @table @option
  10508. @item mode, m
  10509. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10510. In row mode, the graph on the left side represents color component value 0 and
  10511. the right side represents value = 255. In column mode, the top side represents
  10512. color component value = 0 and bottom side represents value = 255.
  10513. @item intensity, i
  10514. Set intensity. Smaller values are useful to find out how many values of the same
  10515. luminance are distributed across input rows/columns.
  10516. Default value is @code{0.04}. Allowed range is [0, 1].
  10517. @item mirror, r
  10518. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10519. In mirrored mode, higher values will be represented on the left
  10520. side for @code{row} mode and at the top for @code{column} mode. Default is
  10521. @code{1} (mirrored).
  10522. @item display, d
  10523. Set display mode.
  10524. It accepts the following values:
  10525. @table @samp
  10526. @item overlay
  10527. Presents information identical to that in the @code{parade}, except
  10528. that the graphs representing color components are superimposed directly
  10529. over one another.
  10530. This display mode makes it easier to spot relative differences or similarities
  10531. in overlapping areas of the color components that are supposed to be identical,
  10532. such as neutral whites, grays, or blacks.
  10533. @item stack
  10534. Display separate graph for the color components side by side in
  10535. @code{row} mode or one below the other in @code{column} mode.
  10536. @item parade
  10537. Display separate graph for the color components side by side in
  10538. @code{column} mode or one below the other in @code{row} mode.
  10539. Using this display mode makes it easy to spot color casts in the highlights
  10540. and shadows of an image, by comparing the contours of the top and the bottom
  10541. graphs of each waveform. Since whites, grays, and blacks are characterized
  10542. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10543. should display three waveforms of roughly equal width/height. If not, the
  10544. correction is easy to perform by making level adjustments the three waveforms.
  10545. @end table
  10546. Default is @code{stack}.
  10547. @item components, c
  10548. Set which color components to display. Default is 1, which means only luminance
  10549. or red color component if input is in RGB colorspace. If is set for example to
  10550. 7 it will display all 3 (if) available color components.
  10551. @item envelope, e
  10552. @table @samp
  10553. @item none
  10554. No envelope, this is default.
  10555. @item instant
  10556. Instant envelope, minimum and maximum values presented in graph will be easily
  10557. visible even with small @code{step} value.
  10558. @item peak
  10559. Hold minimum and maximum values presented in graph across time. This way you
  10560. can still spot out of range values without constantly looking at waveforms.
  10561. @item peak+instant
  10562. Peak and instant envelope combined together.
  10563. @end table
  10564. @item filter, f
  10565. @table @samp
  10566. @item lowpass
  10567. No filtering, this is default.
  10568. @item flat
  10569. Luma and chroma combined together.
  10570. @item aflat
  10571. Similar as above, but shows difference between blue and red chroma.
  10572. @item chroma
  10573. Displays only chroma.
  10574. @item color
  10575. Displays actual color value on waveform.
  10576. @item acolor
  10577. Similar as above, but with luma showing frequency of chroma values.
  10578. @end table
  10579. @item graticule, g
  10580. Set which graticule to display.
  10581. @table @samp
  10582. @item none
  10583. Do not display graticule.
  10584. @item green
  10585. Display green graticule showing legal broadcast ranges.
  10586. @end table
  10587. @item opacity, o
  10588. Set graticule opacity.
  10589. @item flags, fl
  10590. Set graticule flags.
  10591. @table @samp
  10592. @item numbers
  10593. Draw numbers above lines. By default enabled.
  10594. @item dots
  10595. Draw dots instead of lines.
  10596. @end table
  10597. @item scale, s
  10598. Set scale used for displaying graticule.
  10599. @table @samp
  10600. @item digital
  10601. @item millivolts
  10602. @item ire
  10603. @end table
  10604. Default is digital.
  10605. @end table
  10606. @section xbr
  10607. Apply the xBR high-quality magnification filter which is designed for pixel
  10608. art. It follows a set of edge-detection rules, see
  10609. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  10610. It accepts the following option:
  10611. @table @option
  10612. @item n
  10613. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  10614. @code{3xBR} and @code{4} for @code{4xBR}.
  10615. Default is @code{3}.
  10616. @end table
  10617. @anchor{yadif}
  10618. @section yadif
  10619. Deinterlace the input video ("yadif" means "yet another deinterlacing
  10620. filter").
  10621. It accepts the following parameters:
  10622. @table @option
  10623. @item mode
  10624. The interlacing mode to adopt. It accepts one of the following values:
  10625. @table @option
  10626. @item 0, send_frame
  10627. Output one frame for each frame.
  10628. @item 1, send_field
  10629. Output one frame for each field.
  10630. @item 2, send_frame_nospatial
  10631. Like @code{send_frame}, but it skips the spatial interlacing check.
  10632. @item 3, send_field_nospatial
  10633. Like @code{send_field}, but it skips the spatial interlacing check.
  10634. @end table
  10635. The default value is @code{send_frame}.
  10636. @item parity
  10637. The picture field parity assumed for the input interlaced video. It accepts one
  10638. of the following values:
  10639. @table @option
  10640. @item 0, tff
  10641. Assume the top field is first.
  10642. @item 1, bff
  10643. Assume the bottom field is first.
  10644. @item -1, auto
  10645. Enable automatic detection of field parity.
  10646. @end table
  10647. The default value is @code{auto}.
  10648. If the interlacing is unknown or the decoder does not export this information,
  10649. top field first will be assumed.
  10650. @item deint
  10651. Specify which frames to deinterlace. Accept one of the following
  10652. values:
  10653. @table @option
  10654. @item 0, all
  10655. Deinterlace all frames.
  10656. @item 1, interlaced
  10657. Only deinterlace frames marked as interlaced.
  10658. @end table
  10659. The default value is @code{all}.
  10660. @end table
  10661. @section zoompan
  10662. Apply Zoom & Pan effect.
  10663. This filter accepts the following options:
  10664. @table @option
  10665. @item zoom, z
  10666. Set the zoom expression. Default is 1.
  10667. @item x
  10668. @item y
  10669. Set the x and y expression. Default is 0.
  10670. @item d
  10671. Set the duration expression in number of frames.
  10672. This sets for how many number of frames effect will last for
  10673. single input image.
  10674. @item s
  10675. Set the output image size, default is 'hd720'.
  10676. @item fps
  10677. Set the output frame rate, default is '25'.
  10678. @end table
  10679. Each expression can contain the following constants:
  10680. @table @option
  10681. @item in_w, iw
  10682. Input width.
  10683. @item in_h, ih
  10684. Input height.
  10685. @item out_w, ow
  10686. Output width.
  10687. @item out_h, oh
  10688. Output height.
  10689. @item in
  10690. Input frame count.
  10691. @item on
  10692. Output frame count.
  10693. @item x
  10694. @item y
  10695. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  10696. for current input frame.
  10697. @item px
  10698. @item py
  10699. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  10700. not yet such frame (first input frame).
  10701. @item zoom
  10702. Last calculated zoom from 'z' expression for current input frame.
  10703. @item pzoom
  10704. Last calculated zoom of last output frame of previous input frame.
  10705. @item duration
  10706. Number of output frames for current input frame. Calculated from 'd' expression
  10707. for each input frame.
  10708. @item pduration
  10709. number of output frames created for previous input frame
  10710. @item a
  10711. Rational number: input width / input height
  10712. @item sar
  10713. sample aspect ratio
  10714. @item dar
  10715. display aspect ratio
  10716. @end table
  10717. @subsection Examples
  10718. @itemize
  10719. @item
  10720. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  10721. @example
  10722. 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
  10723. @end example
  10724. @item
  10725. Zoom-in up to 1.5 and pan always at center of picture:
  10726. @example
  10727. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10728. @end example
  10729. @end itemize
  10730. @section zscale
  10731. Scale (resize) the input video, using the z.lib library:
  10732. https://github.com/sekrit-twc/zimg.
  10733. The zscale filter forces the output display aspect ratio to be the same
  10734. as the input, by changing the output sample aspect ratio.
  10735. If the input image format is different from the format requested by
  10736. the next filter, the zscale filter will convert the input to the
  10737. requested format.
  10738. @subsection Options
  10739. The filter accepts the following options.
  10740. @table @option
  10741. @item width, w
  10742. @item height, h
  10743. Set the output video dimension expression. Default value is the input
  10744. dimension.
  10745. If the @var{width} or @var{w} is 0, the input width is used for the output.
  10746. If the @var{height} or @var{h} is 0, the input height is used for the output.
  10747. If one of the values is -1, the zscale filter will use a value that
  10748. maintains the aspect ratio of the input image, calculated from the
  10749. other specified dimension. If both of them are -1, the input size is
  10750. used
  10751. If one of the values is -n with n > 1, the zscale filter will also use a value
  10752. that maintains the aspect ratio of the input image, calculated from the other
  10753. specified dimension. After that it will, however, make sure that the calculated
  10754. dimension is divisible by n and adjust the value if necessary.
  10755. See below for the list of accepted constants for use in the dimension
  10756. expression.
  10757. @item size, s
  10758. Set the video size. For the syntax of this option, check the
  10759. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10760. @item dither, d
  10761. Set the dither type.
  10762. Possible values are:
  10763. @table @var
  10764. @item none
  10765. @item ordered
  10766. @item random
  10767. @item error_diffusion
  10768. @end table
  10769. Default is none.
  10770. @item filter, f
  10771. Set the resize filter type.
  10772. Possible values are:
  10773. @table @var
  10774. @item point
  10775. @item bilinear
  10776. @item bicubic
  10777. @item spline16
  10778. @item spline36
  10779. @item lanczos
  10780. @end table
  10781. Default is bilinear.
  10782. @item range, r
  10783. Set the color range.
  10784. Possible values are:
  10785. @table @var
  10786. @item input
  10787. @item limited
  10788. @item full
  10789. @end table
  10790. Default is same as input.
  10791. @item primaries, p
  10792. Set the color primaries.
  10793. Possible values are:
  10794. @table @var
  10795. @item input
  10796. @item 709
  10797. @item unspecified
  10798. @item 170m
  10799. @item 240m
  10800. @item 2020
  10801. @end table
  10802. Default is same as input.
  10803. @item transfer, t
  10804. Set the transfer characteristics.
  10805. Possible values are:
  10806. @table @var
  10807. @item input
  10808. @item 709
  10809. @item unspecified
  10810. @item 601
  10811. @item linear
  10812. @item 2020_10
  10813. @item 2020_12
  10814. @end table
  10815. Default is same as input.
  10816. @item matrix, m
  10817. Set the colorspace matrix.
  10818. Possible value are:
  10819. @table @var
  10820. @item input
  10821. @item 709
  10822. @item unspecified
  10823. @item 470bg
  10824. @item 170m
  10825. @item 2020_ncl
  10826. @item 2020_cl
  10827. @end table
  10828. Default is same as input.
  10829. @item rangein, rin
  10830. Set the input color range.
  10831. Possible values are:
  10832. @table @var
  10833. @item input
  10834. @item limited
  10835. @item full
  10836. @end table
  10837. Default is same as input.
  10838. @item primariesin, pin
  10839. Set the input color primaries.
  10840. Possible values are:
  10841. @table @var
  10842. @item input
  10843. @item 709
  10844. @item unspecified
  10845. @item 170m
  10846. @item 240m
  10847. @item 2020
  10848. @end table
  10849. Default is same as input.
  10850. @item transferin, tin
  10851. Set the input transfer characteristics.
  10852. Possible values are:
  10853. @table @var
  10854. @item input
  10855. @item 709
  10856. @item unspecified
  10857. @item 601
  10858. @item linear
  10859. @item 2020_10
  10860. @item 2020_12
  10861. @end table
  10862. Default is same as input.
  10863. @item matrixin, min
  10864. Set the input colorspace matrix.
  10865. Possible value are:
  10866. @table @var
  10867. @item input
  10868. @item 709
  10869. @item unspecified
  10870. @item 470bg
  10871. @item 170m
  10872. @item 2020_ncl
  10873. @item 2020_cl
  10874. @end table
  10875. @end table
  10876. The values of the @option{w} and @option{h} options are expressions
  10877. containing the following constants:
  10878. @table @var
  10879. @item in_w
  10880. @item in_h
  10881. The input width and height
  10882. @item iw
  10883. @item ih
  10884. These are the same as @var{in_w} and @var{in_h}.
  10885. @item out_w
  10886. @item out_h
  10887. The output (scaled) width and height
  10888. @item ow
  10889. @item oh
  10890. These are the same as @var{out_w} and @var{out_h}
  10891. @item a
  10892. The same as @var{iw} / @var{ih}
  10893. @item sar
  10894. input sample aspect ratio
  10895. @item dar
  10896. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10897. @item hsub
  10898. @item vsub
  10899. horizontal and vertical input chroma subsample values. For example for the
  10900. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10901. @item ohsub
  10902. @item ovsub
  10903. horizontal and vertical output chroma subsample values. For example for the
  10904. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10905. @end table
  10906. @table @option
  10907. @end table
  10908. @c man end VIDEO FILTERS
  10909. @chapter Video Sources
  10910. @c man begin VIDEO SOURCES
  10911. Below is a description of the currently available video sources.
  10912. @section buffer
  10913. Buffer video frames, and make them available to the filter chain.
  10914. This source is mainly intended for a programmatic use, in particular
  10915. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  10916. It accepts the following parameters:
  10917. @table @option
  10918. @item video_size
  10919. Specify the size (width and height) of the buffered video frames. For the
  10920. syntax of this option, check the
  10921. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10922. @item width
  10923. The input video width.
  10924. @item height
  10925. The input video height.
  10926. @item pix_fmt
  10927. A string representing the pixel format of the buffered video frames.
  10928. It may be a number corresponding to a pixel format, or a pixel format
  10929. name.
  10930. @item time_base
  10931. Specify the timebase assumed by the timestamps of the buffered frames.
  10932. @item frame_rate
  10933. Specify the frame rate expected for the video stream.
  10934. @item pixel_aspect, sar
  10935. The sample (pixel) aspect ratio of the input video.
  10936. @item sws_param
  10937. Specify the optional parameters to be used for the scale filter which
  10938. is automatically inserted when an input change is detected in the
  10939. input size or format.
  10940. @item hw_frames_ctx
  10941. When using a hardware pixel format, this should be a reference to an
  10942. AVHWFramesContext describing input frames.
  10943. @end table
  10944. For example:
  10945. @example
  10946. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  10947. @end example
  10948. will instruct the source to accept video frames with size 320x240 and
  10949. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  10950. square pixels (1:1 sample aspect ratio).
  10951. Since the pixel format with name "yuv410p" corresponds to the number 6
  10952. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  10953. this example corresponds to:
  10954. @example
  10955. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  10956. @end example
  10957. Alternatively, the options can be specified as a flat string, but this
  10958. syntax is deprecated:
  10959. @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}]
  10960. @section cellauto
  10961. Create a pattern generated by an elementary cellular automaton.
  10962. The initial state of the cellular automaton can be defined through the
  10963. @option{filename}, and @option{pattern} options. If such options are
  10964. not specified an initial state is created randomly.
  10965. At each new frame a new row in the video is filled with the result of
  10966. the cellular automaton next generation. The behavior when the whole
  10967. frame is filled is defined by the @option{scroll} option.
  10968. This source accepts the following options:
  10969. @table @option
  10970. @item filename, f
  10971. Read the initial cellular automaton state, i.e. the starting row, from
  10972. the specified file.
  10973. In the file, each non-whitespace character is considered an alive
  10974. cell, a newline will terminate the row, and further characters in the
  10975. file will be ignored.
  10976. @item pattern, p
  10977. Read the initial cellular automaton state, i.e. the starting row, from
  10978. the specified string.
  10979. Each non-whitespace character in the string is considered an alive
  10980. cell, a newline will terminate the row, and further characters in the
  10981. string will be ignored.
  10982. @item rate, r
  10983. Set the video rate, that is the number of frames generated per second.
  10984. Default is 25.
  10985. @item random_fill_ratio, ratio
  10986. Set the random fill ratio for the initial cellular automaton row. It
  10987. is a floating point number value ranging from 0 to 1, defaults to
  10988. 1/PHI.
  10989. This option is ignored when a file or a pattern is specified.
  10990. @item random_seed, seed
  10991. Set the seed for filling randomly the initial row, must be an integer
  10992. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10993. set to -1, the filter will try to use a good random seed on a best
  10994. effort basis.
  10995. @item rule
  10996. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  10997. Default value is 110.
  10998. @item size, s
  10999. Set the size of the output video. For the syntax of this option, check the
  11000. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11001. If @option{filename} or @option{pattern} is specified, the size is set
  11002. by default to the width of the specified initial state row, and the
  11003. height is set to @var{width} * PHI.
  11004. If @option{size} is set, it must contain the width of the specified
  11005. pattern string, and the specified pattern will be centered in the
  11006. larger row.
  11007. If a filename or a pattern string is not specified, the size value
  11008. defaults to "320x518" (used for a randomly generated initial state).
  11009. @item scroll
  11010. If set to 1, scroll the output upward when all the rows in the output
  11011. have been already filled. If set to 0, the new generated row will be
  11012. written over the top row just after the bottom row is filled.
  11013. Defaults to 1.
  11014. @item start_full, full
  11015. If set to 1, completely fill the output with generated rows before
  11016. outputting the first frame.
  11017. This is the default behavior, for disabling set the value to 0.
  11018. @item stitch
  11019. If set to 1, stitch the left and right row edges together.
  11020. This is the default behavior, for disabling set the value to 0.
  11021. @end table
  11022. @subsection Examples
  11023. @itemize
  11024. @item
  11025. Read the initial state from @file{pattern}, and specify an output of
  11026. size 200x400.
  11027. @example
  11028. cellauto=f=pattern:s=200x400
  11029. @end example
  11030. @item
  11031. Generate a random initial row with a width of 200 cells, with a fill
  11032. ratio of 2/3:
  11033. @example
  11034. cellauto=ratio=2/3:s=200x200
  11035. @end example
  11036. @item
  11037. Create a pattern generated by rule 18 starting by a single alive cell
  11038. centered on an initial row with width 100:
  11039. @example
  11040. cellauto=p=@@:s=100x400:full=0:rule=18
  11041. @end example
  11042. @item
  11043. Specify a more elaborated initial pattern:
  11044. @example
  11045. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11046. @end example
  11047. @end itemize
  11048. @anchor{coreimagesrc}
  11049. @section coreimagesrc
  11050. Video source generated on GPU using Apple's CoreImage API on OSX.
  11051. This video source is a specialized version of the @ref{coreimage} video filter.
  11052. Use a core image generator at the beginning of the applied filterchain to
  11053. generate the content.
  11054. The coreimagesrc video source accepts the following options:
  11055. @table @option
  11056. @item list_generators
  11057. List all available generators along with all their respective options as well as
  11058. possible minimum and maximum values along with the default values.
  11059. @example
  11060. list_generators=true
  11061. @end example
  11062. @item size, s
  11063. Specify the size of the sourced video. For the syntax of this option, check the
  11064. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11065. The default value is @code{320x240}.
  11066. @item rate, r
  11067. Specify the frame rate of the sourced video, as the number of frames
  11068. generated per second. It has to be a string in the format
  11069. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11070. number or a valid video frame rate abbreviation. The default value is
  11071. "25".
  11072. @item sar
  11073. Set the sample aspect ratio of the sourced video.
  11074. @item duration, d
  11075. Set the duration of the sourced video. See
  11076. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11077. for the accepted syntax.
  11078. If not specified, or the expressed duration is negative, the video is
  11079. supposed to be generated forever.
  11080. @end table
  11081. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11082. A complete filterchain can be used for further processing of the
  11083. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11084. and examples for details.
  11085. @subsection Examples
  11086. @itemize
  11087. @item
  11088. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11089. given as complete and escaped command-line for Apple's standard bash shell:
  11090. @example
  11091. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11092. @end example
  11093. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11094. need for a nullsrc video source.
  11095. @end itemize
  11096. @section mandelbrot
  11097. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11098. point specified with @var{start_x} and @var{start_y}.
  11099. This source accepts the following options:
  11100. @table @option
  11101. @item end_pts
  11102. Set the terminal pts value. Default value is 400.
  11103. @item end_scale
  11104. Set the terminal scale value.
  11105. Must be a floating point value. Default value is 0.3.
  11106. @item inner
  11107. Set the inner coloring mode, that is the algorithm used to draw the
  11108. Mandelbrot fractal internal region.
  11109. It shall assume one of the following values:
  11110. @table @option
  11111. @item black
  11112. Set black mode.
  11113. @item convergence
  11114. Show time until convergence.
  11115. @item mincol
  11116. Set color based on point closest to the origin of the iterations.
  11117. @item period
  11118. Set period mode.
  11119. @end table
  11120. Default value is @var{mincol}.
  11121. @item bailout
  11122. Set the bailout value. Default value is 10.0.
  11123. @item maxiter
  11124. Set the maximum of iterations performed by the rendering
  11125. algorithm. Default value is 7189.
  11126. @item outer
  11127. Set outer coloring mode.
  11128. It shall assume one of following values:
  11129. @table @option
  11130. @item iteration_count
  11131. Set iteration cound mode.
  11132. @item normalized_iteration_count
  11133. set normalized iteration count mode.
  11134. @end table
  11135. Default value is @var{normalized_iteration_count}.
  11136. @item rate, r
  11137. Set frame rate, expressed as number of frames per second. Default
  11138. value is "25".
  11139. @item size, s
  11140. Set frame size. For the syntax of this option, check the "Video
  11141. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11142. @item start_scale
  11143. Set the initial scale value. Default value is 3.0.
  11144. @item start_x
  11145. Set the initial x position. Must be a floating point value between
  11146. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11147. @item start_y
  11148. Set the initial y position. Must be a floating point value between
  11149. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11150. @end table
  11151. @section mptestsrc
  11152. Generate various test patterns, as generated by the MPlayer test filter.
  11153. The size of the generated video is fixed, and is 256x256.
  11154. This source is useful in particular for testing encoding features.
  11155. This source accepts the following options:
  11156. @table @option
  11157. @item rate, r
  11158. Specify the frame rate of the sourced video, as the number of frames
  11159. generated per second. It has to be a string in the format
  11160. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11161. number or a valid video frame rate abbreviation. The default value is
  11162. "25".
  11163. @item duration, d
  11164. Set the duration of the sourced video. See
  11165. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11166. for the accepted syntax.
  11167. If not specified, or the expressed duration is negative, the video is
  11168. supposed to be generated forever.
  11169. @item test, t
  11170. Set the number or the name of the test to perform. Supported tests are:
  11171. @table @option
  11172. @item dc_luma
  11173. @item dc_chroma
  11174. @item freq_luma
  11175. @item freq_chroma
  11176. @item amp_luma
  11177. @item amp_chroma
  11178. @item cbp
  11179. @item mv
  11180. @item ring1
  11181. @item ring2
  11182. @item all
  11183. @end table
  11184. Default value is "all", which will cycle through the list of all tests.
  11185. @end table
  11186. Some examples:
  11187. @example
  11188. mptestsrc=t=dc_luma
  11189. @end example
  11190. will generate a "dc_luma" test pattern.
  11191. @section frei0r_src
  11192. Provide a frei0r source.
  11193. To enable compilation of this filter you need to install the frei0r
  11194. header and configure FFmpeg with @code{--enable-frei0r}.
  11195. This source accepts the following parameters:
  11196. @table @option
  11197. @item size
  11198. The size of the video to generate. For the syntax of this option, check the
  11199. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11200. @item framerate
  11201. The framerate of the generated video. It may be a string of the form
  11202. @var{num}/@var{den} or a frame rate abbreviation.
  11203. @item filter_name
  11204. The name to the frei0r source to load. For more information regarding frei0r and
  11205. how to set the parameters, read the @ref{frei0r} section in the video filters
  11206. documentation.
  11207. @item filter_params
  11208. A '|'-separated list of parameters to pass to the frei0r source.
  11209. @end table
  11210. For example, to generate a frei0r partik0l source with size 200x200
  11211. and frame rate 10 which is overlaid on the overlay filter main input:
  11212. @example
  11213. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11214. @end example
  11215. @section life
  11216. Generate a life pattern.
  11217. This source is based on a generalization of John Conway's life game.
  11218. The sourced input represents a life grid, each pixel represents a cell
  11219. which can be in one of two possible states, alive or dead. Every cell
  11220. interacts with its eight neighbours, which are the cells that are
  11221. horizontally, vertically, or diagonally adjacent.
  11222. At each interaction the grid evolves according to the adopted rule,
  11223. which specifies the number of neighbor alive cells which will make a
  11224. cell stay alive or born. The @option{rule} option allows one to specify
  11225. the rule to adopt.
  11226. This source accepts the following options:
  11227. @table @option
  11228. @item filename, f
  11229. Set the file from which to read the initial grid state. In the file,
  11230. each non-whitespace character is considered an alive cell, and newline
  11231. is used to delimit the end of each row.
  11232. If this option is not specified, the initial grid is generated
  11233. randomly.
  11234. @item rate, r
  11235. Set the video rate, that is the number of frames generated per second.
  11236. Default is 25.
  11237. @item random_fill_ratio, ratio
  11238. Set the random fill ratio for the initial random grid. It is a
  11239. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11240. It is ignored when a file is specified.
  11241. @item random_seed, seed
  11242. Set the seed for filling the initial random grid, must be an integer
  11243. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11244. set to -1, the filter will try to use a good random seed on a best
  11245. effort basis.
  11246. @item rule
  11247. Set the life rule.
  11248. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11249. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11250. @var{NS} specifies the number of alive neighbor cells which make a
  11251. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11252. which make a dead cell to become alive (i.e. to "born").
  11253. "s" and "b" can be used in place of "S" and "B", respectively.
  11254. Alternatively a rule can be specified by an 18-bits integer. The 9
  11255. high order bits are used to encode the next cell state if it is alive
  11256. for each number of neighbor alive cells, the low order bits specify
  11257. the rule for "borning" new cells. Higher order bits encode for an
  11258. higher number of neighbor cells.
  11259. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11260. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11261. Default value is "S23/B3", which is the original Conway's game of life
  11262. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11263. cells, and will born a new cell if there are three alive cells around
  11264. a dead cell.
  11265. @item size, s
  11266. Set the size of the output video. For the syntax of this option, check the
  11267. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11268. If @option{filename} is specified, the size is set by default to the
  11269. same size of the input file. If @option{size} is set, it must contain
  11270. the size specified in the input file, and the initial grid defined in
  11271. that file is centered in the larger resulting area.
  11272. If a filename is not specified, the size value defaults to "320x240"
  11273. (used for a randomly generated initial grid).
  11274. @item stitch
  11275. If set to 1, stitch the left and right grid edges together, and the
  11276. top and bottom edges also. Defaults to 1.
  11277. @item mold
  11278. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11279. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11280. value from 0 to 255.
  11281. @item life_color
  11282. Set the color of living (or new born) cells.
  11283. @item death_color
  11284. Set the color of dead cells. If @option{mold} is set, this is the first color
  11285. used to represent a dead cell.
  11286. @item mold_color
  11287. Set mold color, for definitely dead and moldy cells.
  11288. For the syntax of these 3 color options, check the "Color" section in the
  11289. ffmpeg-utils manual.
  11290. @end table
  11291. @subsection Examples
  11292. @itemize
  11293. @item
  11294. Read a grid from @file{pattern}, and center it on a grid of size
  11295. 300x300 pixels:
  11296. @example
  11297. life=f=pattern:s=300x300
  11298. @end example
  11299. @item
  11300. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11301. @example
  11302. life=ratio=2/3:s=200x200
  11303. @end example
  11304. @item
  11305. Specify a custom rule for evolving a randomly generated grid:
  11306. @example
  11307. life=rule=S14/B34
  11308. @end example
  11309. @item
  11310. Full example with slow death effect (mold) using @command{ffplay}:
  11311. @example
  11312. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11313. @end example
  11314. @end itemize
  11315. @anchor{allrgb}
  11316. @anchor{allyuv}
  11317. @anchor{color}
  11318. @anchor{haldclutsrc}
  11319. @anchor{nullsrc}
  11320. @anchor{rgbtestsrc}
  11321. @anchor{smptebars}
  11322. @anchor{smptehdbars}
  11323. @anchor{testsrc}
  11324. @anchor{testsrc2}
  11325. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2
  11326. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11327. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11328. The @code{color} source provides an uniformly colored input.
  11329. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11330. @ref{haldclut} filter.
  11331. The @code{nullsrc} source returns unprocessed video frames. It is
  11332. mainly useful to be employed in analysis / debugging tools, or as the
  11333. source for filters which ignore the input data.
  11334. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11335. detecting RGB vs BGR issues. You should see a red, green and blue
  11336. stripe from top to bottom.
  11337. The @code{smptebars} source generates a color bars pattern, based on
  11338. the SMPTE Engineering Guideline EG 1-1990.
  11339. The @code{smptehdbars} source generates a color bars pattern, based on
  11340. the SMPTE RP 219-2002.
  11341. The @code{testsrc} source generates a test video pattern, showing a
  11342. color pattern, a scrolling gradient and a timestamp. This is mainly
  11343. intended for testing purposes.
  11344. The @code{testsrc2} source is similar to testsrc, but supports more
  11345. pixel formats instead of just @code{rgb24}. This allows using it as an
  11346. input for other tests without requiring a format conversion.
  11347. The sources accept the following parameters:
  11348. @table @option
  11349. @item color, c
  11350. Specify the color of the source, only available in the @code{color}
  11351. source. For the syntax of this option, check the "Color" section in the
  11352. ffmpeg-utils manual.
  11353. @item level
  11354. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11355. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11356. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11357. coded on a @code{1/(N*N)} scale.
  11358. @item size, s
  11359. Specify the size of the sourced video. For the syntax of this option, check the
  11360. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11361. The default value is @code{320x240}.
  11362. This option is not available with the @code{haldclutsrc} filter.
  11363. @item rate, r
  11364. Specify the frame rate of the sourced video, as the number of frames
  11365. generated per second. It has to be a string in the format
  11366. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11367. number or a valid video frame rate abbreviation. The default value is
  11368. "25".
  11369. @item sar
  11370. Set the sample aspect ratio of the sourced video.
  11371. @item duration, d
  11372. Set the duration of the sourced video. See
  11373. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11374. for the accepted syntax.
  11375. If not specified, or the expressed duration is negative, the video is
  11376. supposed to be generated forever.
  11377. @item decimals, n
  11378. Set the number of decimals to show in the timestamp, only available in the
  11379. @code{testsrc} source.
  11380. The displayed timestamp value will correspond to the original
  11381. timestamp value multiplied by the power of 10 of the specified
  11382. value. Default value is 0.
  11383. @end table
  11384. For example the following:
  11385. @example
  11386. testsrc=duration=5.3:size=qcif:rate=10
  11387. @end example
  11388. will generate a video with a duration of 5.3 seconds, with size
  11389. 176x144 and a frame rate of 10 frames per second.
  11390. The following graph description will generate a red source
  11391. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11392. frames per second.
  11393. @example
  11394. color=c=red@@0.2:s=qcif:r=10
  11395. @end example
  11396. If the input content is to be ignored, @code{nullsrc} can be used. The
  11397. following command generates noise in the luminance plane by employing
  11398. the @code{geq} filter:
  11399. @example
  11400. nullsrc=s=256x256, geq=random(1)*255:128:128
  11401. @end example
  11402. @subsection Commands
  11403. The @code{color} source supports the following commands:
  11404. @table @option
  11405. @item c, color
  11406. Set the color of the created image. Accepts the same syntax of the
  11407. corresponding @option{color} option.
  11408. @end table
  11409. @c man end VIDEO SOURCES
  11410. @chapter Video Sinks
  11411. @c man begin VIDEO SINKS
  11412. Below is a description of the currently available video sinks.
  11413. @section buffersink
  11414. Buffer video frames, and make them available to the end of the filter
  11415. graph.
  11416. This sink is mainly intended for programmatic use, in particular
  11417. through the interface defined in @file{libavfilter/buffersink.h}
  11418. or the options system.
  11419. It accepts a pointer to an AVBufferSinkContext structure, which
  11420. defines the incoming buffers' formats, to be passed as the opaque
  11421. parameter to @code{avfilter_init_filter} for initialization.
  11422. @section nullsink
  11423. Null video sink: do absolutely nothing with the input video. It is
  11424. mainly useful as a template and for use in analysis / debugging
  11425. tools.
  11426. @c man end VIDEO SINKS
  11427. @chapter Multimedia Filters
  11428. @c man begin MULTIMEDIA FILTERS
  11429. Below is a description of the currently available multimedia filters.
  11430. @section ahistogram
  11431. Convert input audio to a video output, displaying the volume histogram.
  11432. The filter accepts the following options:
  11433. @table @option
  11434. @item dmode
  11435. Specify how histogram is calculated.
  11436. It accepts the following values:
  11437. @table @samp
  11438. @item single
  11439. Use single histogram for all channels.
  11440. @item separate
  11441. Use separate histogram for each channel.
  11442. @end table
  11443. Default is @code{single}.
  11444. @item rate, r
  11445. Set frame rate, expressed as number of frames per second. Default
  11446. value is "25".
  11447. @item size, s
  11448. Specify the video size for the output. For the syntax of this option, check the
  11449. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11450. Default value is @code{hd720}.
  11451. @item scale
  11452. Set display scale.
  11453. It accepts the following values:
  11454. @table @samp
  11455. @item log
  11456. logarithmic
  11457. @item sqrt
  11458. square root
  11459. @item cbrt
  11460. cubic root
  11461. @item lin
  11462. linear
  11463. @item rlog
  11464. reverse logarithmic
  11465. @end table
  11466. Default is @code{log}.
  11467. @item ascale
  11468. Set amplitude scale.
  11469. It accepts the following values:
  11470. @table @samp
  11471. @item log
  11472. logarithmic
  11473. @item lin
  11474. linear
  11475. @end table
  11476. Default is @code{log}.
  11477. @item acount
  11478. Set how much frames to accumulate in histogram.
  11479. Defauls is 1. Setting this to -1 accumulates all frames.
  11480. @item rheight
  11481. Set histogram ratio of window height.
  11482. @item slide
  11483. Set sonogram sliding.
  11484. It accepts the following values:
  11485. @table @samp
  11486. @item replace
  11487. replace old rows with new ones.
  11488. @item scroll
  11489. scroll from top to bottom.
  11490. @end table
  11491. Default is @code{replace}.
  11492. @end table
  11493. @section aphasemeter
  11494. Convert input audio to a video output, displaying the audio phase.
  11495. The filter accepts the following options:
  11496. @table @option
  11497. @item rate, r
  11498. Set the output frame rate. Default value is @code{25}.
  11499. @item size, s
  11500. Set the video size for the output. For the syntax of this option, check the
  11501. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11502. Default value is @code{800x400}.
  11503. @item rc
  11504. @item gc
  11505. @item bc
  11506. Specify the red, green, blue contrast. Default values are @code{2},
  11507. @code{7} and @code{1}.
  11508. Allowed range is @code{[0, 255]}.
  11509. @item mpc
  11510. Set color which will be used for drawing median phase. If color is
  11511. @code{none} which is default, no median phase value will be drawn.
  11512. @end table
  11513. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  11514. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  11515. The @code{-1} means left and right channels are completely out of phase and
  11516. @code{1} means channels are in phase.
  11517. @section avectorscope
  11518. Convert input audio to a video output, representing the audio vector
  11519. scope.
  11520. The filter is used to measure the difference between channels of stereo
  11521. audio stream. A monoaural signal, consisting of identical left and right
  11522. signal, results in straight vertical line. Any stereo separation is visible
  11523. as a deviation from this line, creating a Lissajous figure.
  11524. If the straight (or deviation from it) but horizontal line appears this
  11525. indicates that the left and right channels are out of phase.
  11526. The filter accepts the following options:
  11527. @table @option
  11528. @item mode, m
  11529. Set the vectorscope mode.
  11530. Available values are:
  11531. @table @samp
  11532. @item lissajous
  11533. Lissajous rotated by 45 degrees.
  11534. @item lissajous_xy
  11535. Same as above but not rotated.
  11536. @item polar
  11537. Shape resembling half of circle.
  11538. @end table
  11539. Default value is @samp{lissajous}.
  11540. @item size, s
  11541. Set the video size for the output. For the syntax of this option, check the
  11542. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11543. Default value is @code{400x400}.
  11544. @item rate, r
  11545. Set the output frame rate. Default value is @code{25}.
  11546. @item rc
  11547. @item gc
  11548. @item bc
  11549. @item ac
  11550. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  11551. @code{160}, @code{80} and @code{255}.
  11552. Allowed range is @code{[0, 255]}.
  11553. @item rf
  11554. @item gf
  11555. @item bf
  11556. @item af
  11557. Specify the red, green, blue and alpha fade. Default values are @code{15},
  11558. @code{10}, @code{5} and @code{5}.
  11559. Allowed range is @code{[0, 255]}.
  11560. @item zoom
  11561. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  11562. @item draw
  11563. Set the vectorscope drawing mode.
  11564. Available values are:
  11565. @table @samp
  11566. @item dot
  11567. Draw dot for each sample.
  11568. @item line
  11569. Draw line between previous and current sample.
  11570. @end table
  11571. Default value is @samp{dot}.
  11572. @end table
  11573. @subsection Examples
  11574. @itemize
  11575. @item
  11576. Complete example using @command{ffplay}:
  11577. @example
  11578. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11579. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  11580. @end example
  11581. @end itemize
  11582. @section bench, abench
  11583. Benchmark part of a filtergraph.
  11584. The filter accepts the following options:
  11585. @table @option
  11586. @item action
  11587. Start or stop a timer.
  11588. Available values are:
  11589. @table @samp
  11590. @item start
  11591. Get the current time, set it as frame metadata (using the key
  11592. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  11593. @item stop
  11594. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  11595. the input frame metadata to get the time difference. Time difference, average,
  11596. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  11597. @code{min}) are then printed. The timestamps are expressed in seconds.
  11598. @end table
  11599. @end table
  11600. @subsection Examples
  11601. @itemize
  11602. @item
  11603. Benchmark @ref{selectivecolor} filter:
  11604. @example
  11605. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  11606. @end example
  11607. @end itemize
  11608. @section concat
  11609. Concatenate audio and video streams, joining them together one after the
  11610. other.
  11611. The filter works on segments of synchronized video and audio streams. All
  11612. segments must have the same number of streams of each type, and that will
  11613. also be the number of streams at output.
  11614. The filter accepts the following options:
  11615. @table @option
  11616. @item n
  11617. Set the number of segments. Default is 2.
  11618. @item v
  11619. Set the number of output video streams, that is also the number of video
  11620. streams in each segment. Default is 1.
  11621. @item a
  11622. Set the number of output audio streams, that is also the number of audio
  11623. streams in each segment. Default is 0.
  11624. @item unsafe
  11625. Activate unsafe mode: do not fail if segments have a different format.
  11626. @end table
  11627. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  11628. @var{a} audio outputs.
  11629. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  11630. segment, in the same order as the outputs, then the inputs for the second
  11631. segment, etc.
  11632. Related streams do not always have exactly the same duration, for various
  11633. reasons including codec frame size or sloppy authoring. For that reason,
  11634. related synchronized streams (e.g. a video and its audio track) should be
  11635. concatenated at once. The concat filter will use the duration of the longest
  11636. stream in each segment (except the last one), and if necessary pad shorter
  11637. audio streams with silence.
  11638. For this filter to work correctly, all segments must start at timestamp 0.
  11639. All corresponding streams must have the same parameters in all segments; the
  11640. filtering system will automatically select a common pixel format for video
  11641. streams, and a common sample format, sample rate and channel layout for
  11642. audio streams, but other settings, such as resolution, must be converted
  11643. explicitly by the user.
  11644. Different frame rates are acceptable but will result in variable frame rate
  11645. at output; be sure to configure the output file to handle it.
  11646. @subsection Examples
  11647. @itemize
  11648. @item
  11649. Concatenate an opening, an episode and an ending, all in bilingual version
  11650. (video in stream 0, audio in streams 1 and 2):
  11651. @example
  11652. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  11653. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  11654. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  11655. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  11656. @end example
  11657. @item
  11658. Concatenate two parts, handling audio and video separately, using the
  11659. (a)movie sources, and adjusting the resolution:
  11660. @example
  11661. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  11662. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  11663. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  11664. @end example
  11665. Note that a desync will happen at the stitch if the audio and video streams
  11666. do not have exactly the same duration in the first file.
  11667. @end itemize
  11668. @anchor{ebur128}
  11669. @section ebur128
  11670. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  11671. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  11672. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  11673. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  11674. The filter also has a video output (see the @var{video} option) with a real
  11675. time graph to observe the loudness evolution. The graphic contains the logged
  11676. message mentioned above, so it is not printed anymore when this option is set,
  11677. unless the verbose logging is set. The main graphing area contains the
  11678. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  11679. the momentary loudness (400 milliseconds).
  11680. More information about the Loudness Recommendation EBU R128 on
  11681. @url{http://tech.ebu.ch/loudness}.
  11682. The filter accepts the following options:
  11683. @table @option
  11684. @item video
  11685. Activate the video output. The audio stream is passed unchanged whether this
  11686. option is set or no. The video stream will be the first output stream if
  11687. activated. Default is @code{0}.
  11688. @item size
  11689. Set the video size. This option is for video only. For the syntax of this
  11690. option, check the
  11691. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11692. Default and minimum resolution is @code{640x480}.
  11693. @item meter
  11694. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  11695. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  11696. other integer value between this range is allowed.
  11697. @item metadata
  11698. Set metadata injection. If set to @code{1}, the audio input will be segmented
  11699. into 100ms output frames, each of them containing various loudness information
  11700. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  11701. Default is @code{0}.
  11702. @item framelog
  11703. Force the frame logging level.
  11704. Available values are:
  11705. @table @samp
  11706. @item info
  11707. information logging level
  11708. @item verbose
  11709. verbose logging level
  11710. @end table
  11711. By default, the logging level is set to @var{info}. If the @option{video} or
  11712. the @option{metadata} options are set, it switches to @var{verbose}.
  11713. @item peak
  11714. Set peak mode(s).
  11715. Available modes can be cumulated (the option is a @code{flag} type). Possible
  11716. values are:
  11717. @table @samp
  11718. @item none
  11719. Disable any peak mode (default).
  11720. @item sample
  11721. Enable sample-peak mode.
  11722. Simple peak mode looking for the higher sample value. It logs a message
  11723. for sample-peak (identified by @code{SPK}).
  11724. @item true
  11725. Enable true-peak mode.
  11726. If enabled, the peak lookup is done on an over-sampled version of the input
  11727. stream for better peak accuracy. It logs a message for true-peak.
  11728. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  11729. This mode requires a build with @code{libswresample}.
  11730. @end table
  11731. @item dualmono
  11732. Treat mono input files as "dual mono". If a mono file is intended for playback
  11733. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  11734. If set to @code{true}, this option will compensate for this effect.
  11735. Multi-channel input files are not affected by this option.
  11736. @item panlaw
  11737. Set a specific pan law to be used for the measurement of dual mono files.
  11738. This parameter is optional, and has a default value of -3.01dB.
  11739. @end table
  11740. @subsection Examples
  11741. @itemize
  11742. @item
  11743. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  11744. @example
  11745. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  11746. @end example
  11747. @item
  11748. Run an analysis with @command{ffmpeg}:
  11749. @example
  11750. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  11751. @end example
  11752. @end itemize
  11753. @section interleave, ainterleave
  11754. Temporally interleave frames from several inputs.
  11755. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  11756. These filters read frames from several inputs and send the oldest
  11757. queued frame to the output.
  11758. Input streams must have a well defined, monotonically increasing frame
  11759. timestamp values.
  11760. In order to submit one frame to output, these filters need to enqueue
  11761. at least one frame for each input, so they cannot work in case one
  11762. input is not yet terminated and will not receive incoming frames.
  11763. For example consider the case when one input is a @code{select} filter
  11764. which always drop input frames. The @code{interleave} filter will keep
  11765. reading from that input, but it will never be able to send new frames
  11766. to output until the input will send an end-of-stream signal.
  11767. Also, depending on inputs synchronization, the filters will drop
  11768. frames in case one input receives more frames than the other ones, and
  11769. the queue is already filled.
  11770. These filters accept the following options:
  11771. @table @option
  11772. @item nb_inputs, n
  11773. Set the number of different inputs, it is 2 by default.
  11774. @end table
  11775. @subsection Examples
  11776. @itemize
  11777. @item
  11778. Interleave frames belonging to different streams using @command{ffmpeg}:
  11779. @example
  11780. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  11781. @end example
  11782. @item
  11783. Add flickering blur effect:
  11784. @example
  11785. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  11786. @end example
  11787. @end itemize
  11788. @section perms, aperms
  11789. Set read/write permissions for the output frames.
  11790. These filters are mainly aimed at developers to test direct path in the
  11791. following filter in the filtergraph.
  11792. The filters accept the following options:
  11793. @table @option
  11794. @item mode
  11795. Select the permissions mode.
  11796. It accepts the following values:
  11797. @table @samp
  11798. @item none
  11799. Do nothing. This is the default.
  11800. @item ro
  11801. Set all the output frames read-only.
  11802. @item rw
  11803. Set all the output frames directly writable.
  11804. @item toggle
  11805. Make the frame read-only if writable, and writable if read-only.
  11806. @item random
  11807. Set each output frame read-only or writable randomly.
  11808. @end table
  11809. @item seed
  11810. Set the seed for the @var{random} mode, must be an integer included between
  11811. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11812. @code{-1}, the filter will try to use a good random seed on a best effort
  11813. basis.
  11814. @end table
  11815. Note: in case of auto-inserted filter between the permission filter and the
  11816. following one, the permission might not be received as expected in that
  11817. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  11818. perms/aperms filter can avoid this problem.
  11819. @section realtime, arealtime
  11820. Slow down filtering to match real time approximatively.
  11821. These filters will pause the filtering for a variable amount of time to
  11822. match the output rate with the input timestamps.
  11823. They are similar to the @option{re} option to @code{ffmpeg}.
  11824. They accept the following options:
  11825. @table @option
  11826. @item limit
  11827. Time limit for the pauses. Any pause longer than that will be considered
  11828. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  11829. @end table
  11830. @section select, aselect
  11831. Select frames to pass in output.
  11832. This filter accepts the following options:
  11833. @table @option
  11834. @item expr, e
  11835. Set expression, which is evaluated for each input frame.
  11836. If the expression is evaluated to zero, the frame is discarded.
  11837. If the evaluation result is negative or NaN, the frame is sent to the
  11838. first output; otherwise it is sent to the output with index
  11839. @code{ceil(val)-1}, assuming that the input index starts from 0.
  11840. For example a value of @code{1.2} corresponds to the output with index
  11841. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  11842. @item outputs, n
  11843. Set the number of outputs. The output to which to send the selected
  11844. frame is based on the result of the evaluation. Default value is 1.
  11845. @end table
  11846. The expression can contain the following constants:
  11847. @table @option
  11848. @item n
  11849. The (sequential) number of the filtered frame, starting from 0.
  11850. @item selected_n
  11851. The (sequential) number of the selected frame, starting from 0.
  11852. @item prev_selected_n
  11853. The sequential number of the last selected frame. It's NAN if undefined.
  11854. @item TB
  11855. The timebase of the input timestamps.
  11856. @item pts
  11857. The PTS (Presentation TimeStamp) of the filtered video frame,
  11858. expressed in @var{TB} units. It's NAN if undefined.
  11859. @item t
  11860. The PTS of the filtered video frame,
  11861. expressed in seconds. It's NAN if undefined.
  11862. @item prev_pts
  11863. The PTS of the previously filtered video frame. It's NAN if undefined.
  11864. @item prev_selected_pts
  11865. The PTS of the last previously filtered video frame. It's NAN if undefined.
  11866. @item prev_selected_t
  11867. The PTS of the last previously selected video frame. It's NAN if undefined.
  11868. @item start_pts
  11869. The PTS of the first video frame in the video. It's NAN if undefined.
  11870. @item start_t
  11871. The time of the first video frame in the video. It's NAN if undefined.
  11872. @item pict_type @emph{(video only)}
  11873. The type of the filtered frame. It can assume one of the following
  11874. values:
  11875. @table @option
  11876. @item I
  11877. @item P
  11878. @item B
  11879. @item S
  11880. @item SI
  11881. @item SP
  11882. @item BI
  11883. @end table
  11884. @item interlace_type @emph{(video only)}
  11885. The frame interlace type. It can assume one of the following values:
  11886. @table @option
  11887. @item PROGRESSIVE
  11888. The frame is progressive (not interlaced).
  11889. @item TOPFIRST
  11890. The frame is top-field-first.
  11891. @item BOTTOMFIRST
  11892. The frame is bottom-field-first.
  11893. @end table
  11894. @item consumed_sample_n @emph{(audio only)}
  11895. the number of selected samples before the current frame
  11896. @item samples_n @emph{(audio only)}
  11897. the number of samples in the current frame
  11898. @item sample_rate @emph{(audio only)}
  11899. the input sample rate
  11900. @item key
  11901. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  11902. @item pos
  11903. the position in the file of the filtered frame, -1 if the information
  11904. is not available (e.g. for synthetic video)
  11905. @item scene @emph{(video only)}
  11906. value between 0 and 1 to indicate a new scene; a low value reflects a low
  11907. probability for the current frame to introduce a new scene, while a higher
  11908. value means the current frame is more likely to be one (see the example below)
  11909. @item concatdec_select
  11910. The concat demuxer can select only part of a concat input file by setting an
  11911. inpoint and an outpoint, but the output packets may not be entirely contained
  11912. in the selected interval. By using this variable, it is possible to skip frames
  11913. generated by the concat demuxer which are not exactly contained in the selected
  11914. interval.
  11915. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  11916. and the @var{lavf.concat.duration} packet metadata values which are also
  11917. present in the decoded frames.
  11918. The @var{concatdec_select} variable is -1 if the frame pts is at least
  11919. start_time and either the duration metadata is missing or the frame pts is less
  11920. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  11921. missing.
  11922. That basically means that an input frame is selected if its pts is within the
  11923. interval set by the concat demuxer.
  11924. @end table
  11925. The default value of the select expression is "1".
  11926. @subsection Examples
  11927. @itemize
  11928. @item
  11929. Select all frames in input:
  11930. @example
  11931. select
  11932. @end example
  11933. The example above is the same as:
  11934. @example
  11935. select=1
  11936. @end example
  11937. @item
  11938. Skip all frames:
  11939. @example
  11940. select=0
  11941. @end example
  11942. @item
  11943. Select only I-frames:
  11944. @example
  11945. select='eq(pict_type\,I)'
  11946. @end example
  11947. @item
  11948. Select one frame every 100:
  11949. @example
  11950. select='not(mod(n\,100))'
  11951. @end example
  11952. @item
  11953. Select only frames contained in the 10-20 time interval:
  11954. @example
  11955. select=between(t\,10\,20)
  11956. @end example
  11957. @item
  11958. Select only I-frames contained in the 10-20 time interval:
  11959. @example
  11960. select=between(t\,10\,20)*eq(pict_type\,I)
  11961. @end example
  11962. @item
  11963. Select frames with a minimum distance of 10 seconds:
  11964. @example
  11965. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  11966. @end example
  11967. @item
  11968. Use aselect to select only audio frames with samples number > 100:
  11969. @example
  11970. aselect='gt(samples_n\,100)'
  11971. @end example
  11972. @item
  11973. Create a mosaic of the first scenes:
  11974. @example
  11975. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  11976. @end example
  11977. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  11978. choice.
  11979. @item
  11980. Send even and odd frames to separate outputs, and compose them:
  11981. @example
  11982. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  11983. @end example
  11984. @item
  11985. Select useful frames from an ffconcat file which is using inpoints and
  11986. outpoints but where the source files are not intra frame only.
  11987. @example
  11988. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  11989. @end example
  11990. @end itemize
  11991. @section sendcmd, asendcmd
  11992. Send commands to filters in the filtergraph.
  11993. These filters read commands to be sent to other filters in the
  11994. filtergraph.
  11995. @code{sendcmd} must be inserted between two video filters,
  11996. @code{asendcmd} must be inserted between two audio filters, but apart
  11997. from that they act the same way.
  11998. The specification of commands can be provided in the filter arguments
  11999. with the @var{commands} option, or in a file specified by the
  12000. @var{filename} option.
  12001. These filters accept the following options:
  12002. @table @option
  12003. @item commands, c
  12004. Set the commands to be read and sent to the other filters.
  12005. @item filename, f
  12006. Set the filename of the commands to be read and sent to the other
  12007. filters.
  12008. @end table
  12009. @subsection Commands syntax
  12010. A commands description consists of a sequence of interval
  12011. specifications, comprising a list of commands to be executed when a
  12012. particular event related to that interval occurs. The occurring event
  12013. is typically the current frame time entering or leaving a given time
  12014. interval.
  12015. An interval is specified by the following syntax:
  12016. @example
  12017. @var{START}[-@var{END}] @var{COMMANDS};
  12018. @end example
  12019. The time interval is specified by the @var{START} and @var{END} times.
  12020. @var{END} is optional and defaults to the maximum time.
  12021. The current frame time is considered within the specified interval if
  12022. it is included in the interval [@var{START}, @var{END}), that is when
  12023. the time is greater or equal to @var{START} and is lesser than
  12024. @var{END}.
  12025. @var{COMMANDS} consists of a sequence of one or more command
  12026. specifications, separated by ",", relating to that interval. The
  12027. syntax of a command specification is given by:
  12028. @example
  12029. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  12030. @end example
  12031. @var{FLAGS} is optional and specifies the type of events relating to
  12032. the time interval which enable sending the specified command, and must
  12033. be a non-null sequence of identifier flags separated by "+" or "|" and
  12034. enclosed between "[" and "]".
  12035. The following flags are recognized:
  12036. @table @option
  12037. @item enter
  12038. The command is sent when the current frame timestamp enters the
  12039. specified interval. In other words, the command is sent when the
  12040. previous frame timestamp was not in the given interval, and the
  12041. current is.
  12042. @item leave
  12043. The command is sent when the current frame timestamp leaves the
  12044. specified interval. In other words, the command is sent when the
  12045. previous frame timestamp was in the given interval, and the
  12046. current is not.
  12047. @end table
  12048. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  12049. assumed.
  12050. @var{TARGET} specifies the target of the command, usually the name of
  12051. the filter class or a specific filter instance name.
  12052. @var{COMMAND} specifies the name of the command for the target filter.
  12053. @var{ARG} is optional and specifies the optional list of argument for
  12054. the given @var{COMMAND}.
  12055. Between one interval specification and another, whitespaces, or
  12056. sequences of characters starting with @code{#} until the end of line,
  12057. are ignored and can be used to annotate comments.
  12058. A simplified BNF description of the commands specification syntax
  12059. follows:
  12060. @example
  12061. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12062. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12063. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12064. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12065. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12066. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12067. @end example
  12068. @subsection Examples
  12069. @itemize
  12070. @item
  12071. Specify audio tempo change at second 4:
  12072. @example
  12073. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12074. @end example
  12075. @item
  12076. Specify a list of drawtext and hue commands in a file.
  12077. @example
  12078. # show text in the interval 5-10
  12079. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12080. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12081. # desaturate the image in the interval 15-20
  12082. 15.0-20.0 [enter] hue s 0,
  12083. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12084. [leave] hue s 1,
  12085. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12086. # apply an exponential saturation fade-out effect, starting from time 25
  12087. 25 [enter] hue s exp(25-t)
  12088. @end example
  12089. A filtergraph allowing to read and process the above command list
  12090. stored in a file @file{test.cmd}, can be specified with:
  12091. @example
  12092. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12093. @end example
  12094. @end itemize
  12095. @anchor{setpts}
  12096. @section setpts, asetpts
  12097. Change the PTS (presentation timestamp) of the input frames.
  12098. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12099. This filter accepts the following options:
  12100. @table @option
  12101. @item expr
  12102. The expression which is evaluated for each frame to construct its timestamp.
  12103. @end table
  12104. The expression is evaluated through the eval API and can contain the following
  12105. constants:
  12106. @table @option
  12107. @item FRAME_RATE
  12108. frame rate, only defined for constant frame-rate video
  12109. @item PTS
  12110. The presentation timestamp in input
  12111. @item N
  12112. The count of the input frame for video or the number of consumed samples,
  12113. not including the current frame for audio, starting from 0.
  12114. @item NB_CONSUMED_SAMPLES
  12115. The number of consumed samples, not including the current frame (only
  12116. audio)
  12117. @item NB_SAMPLES, S
  12118. The number of samples in the current frame (only audio)
  12119. @item SAMPLE_RATE, SR
  12120. The audio sample rate.
  12121. @item STARTPTS
  12122. The PTS of the first frame.
  12123. @item STARTT
  12124. the time in seconds of the first frame
  12125. @item INTERLACED
  12126. State whether the current frame is interlaced.
  12127. @item T
  12128. the time in seconds of the current frame
  12129. @item POS
  12130. original position in the file of the frame, or undefined if undefined
  12131. for the current frame
  12132. @item PREV_INPTS
  12133. The previous input PTS.
  12134. @item PREV_INT
  12135. previous input time in seconds
  12136. @item PREV_OUTPTS
  12137. The previous output PTS.
  12138. @item PREV_OUTT
  12139. previous output time in seconds
  12140. @item RTCTIME
  12141. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12142. instead.
  12143. @item RTCSTART
  12144. The wallclock (RTC) time at the start of the movie in microseconds.
  12145. @item TB
  12146. The timebase of the input timestamps.
  12147. @end table
  12148. @subsection Examples
  12149. @itemize
  12150. @item
  12151. Start counting PTS from zero
  12152. @example
  12153. setpts=PTS-STARTPTS
  12154. @end example
  12155. @item
  12156. Apply fast motion effect:
  12157. @example
  12158. setpts=0.5*PTS
  12159. @end example
  12160. @item
  12161. Apply slow motion effect:
  12162. @example
  12163. setpts=2.0*PTS
  12164. @end example
  12165. @item
  12166. Set fixed rate of 25 frames per second:
  12167. @example
  12168. setpts=N/(25*TB)
  12169. @end example
  12170. @item
  12171. Set fixed rate 25 fps with some jitter:
  12172. @example
  12173. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12174. @end example
  12175. @item
  12176. Apply an offset of 10 seconds to the input PTS:
  12177. @example
  12178. setpts=PTS+10/TB
  12179. @end example
  12180. @item
  12181. Generate timestamps from a "live source" and rebase onto the current timebase:
  12182. @example
  12183. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12184. @end example
  12185. @item
  12186. Generate timestamps by counting samples:
  12187. @example
  12188. asetpts=N/SR/TB
  12189. @end example
  12190. @end itemize
  12191. @section settb, asettb
  12192. Set the timebase to use for the output frames timestamps.
  12193. It is mainly useful for testing timebase configuration.
  12194. It accepts the following parameters:
  12195. @table @option
  12196. @item expr, tb
  12197. The expression which is evaluated into the output timebase.
  12198. @end table
  12199. The value for @option{tb} is an arithmetic expression representing a
  12200. rational. The expression can contain the constants "AVTB" (the default
  12201. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12202. audio only). Default value is "intb".
  12203. @subsection Examples
  12204. @itemize
  12205. @item
  12206. Set the timebase to 1/25:
  12207. @example
  12208. settb=expr=1/25
  12209. @end example
  12210. @item
  12211. Set the timebase to 1/10:
  12212. @example
  12213. settb=expr=0.1
  12214. @end example
  12215. @item
  12216. Set the timebase to 1001/1000:
  12217. @example
  12218. settb=1+0.001
  12219. @end example
  12220. @item
  12221. Set the timebase to 2*intb:
  12222. @example
  12223. settb=2*intb
  12224. @end example
  12225. @item
  12226. Set the default timebase value:
  12227. @example
  12228. settb=AVTB
  12229. @end example
  12230. @end itemize
  12231. @section showcqt
  12232. Convert input audio to a video output representing frequency spectrum
  12233. logarithmically using Brown-Puckette constant Q transform algorithm with
  12234. direct frequency domain coefficient calculation (but the transform itself
  12235. is not really constant Q, instead the Q factor is actually variable/clamped),
  12236. with musical tone scale, from E0 to D#10.
  12237. The filter accepts the following options:
  12238. @table @option
  12239. @item size, s
  12240. Specify the video size for the output. It must be even. For the syntax of this option,
  12241. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12242. Default value is @code{1920x1080}.
  12243. @item fps, rate, r
  12244. Set the output frame rate. Default value is @code{25}.
  12245. @item bar_h
  12246. Set the bargraph height. It must be even. Default value is @code{-1} which
  12247. computes the bargraph height automatically.
  12248. @item axis_h
  12249. Set the axis height. It must be even. Default value is @code{-1} which computes
  12250. the axis height automatically.
  12251. @item sono_h
  12252. Set the sonogram height. It must be even. Default value is @code{-1} which
  12253. computes the sonogram height automatically.
  12254. @item fullhd
  12255. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  12256. instead. Default value is @code{1}.
  12257. @item sono_v, volume
  12258. Specify the sonogram volume expression. It can contain variables:
  12259. @table @option
  12260. @item bar_v
  12261. the @var{bar_v} evaluated expression
  12262. @item frequency, freq, f
  12263. the frequency where it is evaluated
  12264. @item timeclamp, tc
  12265. the value of @var{timeclamp} option
  12266. @end table
  12267. and functions:
  12268. @table @option
  12269. @item a_weighting(f)
  12270. A-weighting of equal loudness
  12271. @item b_weighting(f)
  12272. B-weighting of equal loudness
  12273. @item c_weighting(f)
  12274. C-weighting of equal loudness.
  12275. @end table
  12276. Default value is @code{16}.
  12277. @item bar_v, volume2
  12278. Specify the bargraph volume expression. It can contain variables:
  12279. @table @option
  12280. @item sono_v
  12281. the @var{sono_v} evaluated expression
  12282. @item frequency, freq, f
  12283. the frequency where it is evaluated
  12284. @item timeclamp, tc
  12285. the value of @var{timeclamp} option
  12286. @end table
  12287. and functions:
  12288. @table @option
  12289. @item a_weighting(f)
  12290. A-weighting of equal loudness
  12291. @item b_weighting(f)
  12292. B-weighting of equal loudness
  12293. @item c_weighting(f)
  12294. C-weighting of equal loudness.
  12295. @end table
  12296. Default value is @code{sono_v}.
  12297. @item sono_g, gamma
  12298. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  12299. higher gamma makes the spectrum having more range. Default value is @code{3}.
  12300. Acceptable range is @code{[1, 7]}.
  12301. @item bar_g, gamma2
  12302. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  12303. @code{[1, 7]}.
  12304. @item timeclamp, tc
  12305. Specify the transform timeclamp. At low frequency, there is trade-off between
  12306. accuracy in time domain and frequency domain. If timeclamp is lower,
  12307. event in time domain is represented more accurately (such as fast bass drum),
  12308. otherwise event in frequency domain is represented more accurately
  12309. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  12310. @item basefreq
  12311. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  12312. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  12313. @item endfreq
  12314. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  12315. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  12316. @item coeffclamp
  12317. This option is deprecated and ignored.
  12318. @item tlength
  12319. Specify the transform length in time domain. Use this option to control accuracy
  12320. trade-off between time domain and frequency domain at every frequency sample.
  12321. It can contain variables:
  12322. @table @option
  12323. @item frequency, freq, f
  12324. the frequency where it is evaluated
  12325. @item timeclamp, tc
  12326. the value of @var{timeclamp} option.
  12327. @end table
  12328. Default value is @code{384*tc/(384+tc*f)}.
  12329. @item count
  12330. Specify the transform count for every video frame. Default value is @code{6}.
  12331. Acceptable range is @code{[1, 30]}.
  12332. @item fcount
  12333. Specify the transform count for every single pixel. Default value is @code{0},
  12334. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  12335. @item fontfile
  12336. Specify font file for use with freetype to draw the axis. If not specified,
  12337. use embedded font. Note that drawing with font file or embedded font is not
  12338. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  12339. option instead.
  12340. @item fontcolor
  12341. Specify font color expression. This is arithmetic expression that should return
  12342. integer value 0xRRGGBB. It can contain variables:
  12343. @table @option
  12344. @item frequency, freq, f
  12345. the frequency where it is evaluated
  12346. @item timeclamp, tc
  12347. the value of @var{timeclamp} option
  12348. @end table
  12349. and functions:
  12350. @table @option
  12351. @item midi(f)
  12352. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  12353. @item r(x), g(x), b(x)
  12354. red, green, and blue value of intensity x.
  12355. @end table
  12356. Default value is @code{st(0, (midi(f)-59.5)/12);
  12357. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  12358. r(1-ld(1)) + b(ld(1))}.
  12359. @item axisfile
  12360. Specify image file to draw the axis. This option override @var{fontfile} and
  12361. @var{fontcolor} option.
  12362. @item axis, text
  12363. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  12364. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  12365. Default value is @code{1}.
  12366. @end table
  12367. @subsection Examples
  12368. @itemize
  12369. @item
  12370. Playing audio while showing the spectrum:
  12371. @example
  12372. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  12373. @end example
  12374. @item
  12375. Same as above, but with frame rate 30 fps:
  12376. @example
  12377. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  12378. @end example
  12379. @item
  12380. Playing at 1280x720:
  12381. @example
  12382. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  12383. @end example
  12384. @item
  12385. Disable sonogram display:
  12386. @example
  12387. sono_h=0
  12388. @end example
  12389. @item
  12390. A1 and its harmonics: A1, A2, (near)E3, A3:
  12391. @example
  12392. 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),
  12393. asplit[a][out1]; [a] showcqt [out0]'
  12394. @end example
  12395. @item
  12396. Same as above, but with more accuracy in frequency domain:
  12397. @example
  12398. 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),
  12399. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  12400. @end example
  12401. @item
  12402. Custom volume:
  12403. @example
  12404. bar_v=10:sono_v=bar_v*a_weighting(f)
  12405. @end example
  12406. @item
  12407. Custom gamma, now spectrum is linear to the amplitude.
  12408. @example
  12409. bar_g=2:sono_g=2
  12410. @end example
  12411. @item
  12412. Custom tlength equation:
  12413. @example
  12414. 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)))'
  12415. @end example
  12416. @item
  12417. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  12418. @example
  12419. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  12420. @end example
  12421. @item
  12422. Custom frequency range with custom axis using image file:
  12423. @example
  12424. axisfile=myaxis.png:basefreq=40:endfreq=10000
  12425. @end example
  12426. @end itemize
  12427. @section showfreqs
  12428. Convert input audio to video output representing the audio power spectrum.
  12429. Audio amplitude is on Y-axis while frequency is on X-axis.
  12430. The filter accepts the following options:
  12431. @table @option
  12432. @item size, s
  12433. Specify size of video. For the syntax of this option, check the
  12434. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12435. Default is @code{1024x512}.
  12436. @item mode
  12437. Set display mode.
  12438. This set how each frequency bin will be represented.
  12439. It accepts the following values:
  12440. @table @samp
  12441. @item line
  12442. @item bar
  12443. @item dot
  12444. @end table
  12445. Default is @code{bar}.
  12446. @item ascale
  12447. Set amplitude scale.
  12448. It accepts the following values:
  12449. @table @samp
  12450. @item lin
  12451. Linear scale.
  12452. @item sqrt
  12453. Square root scale.
  12454. @item cbrt
  12455. Cubic root scale.
  12456. @item log
  12457. Logarithmic scale.
  12458. @end table
  12459. Default is @code{log}.
  12460. @item fscale
  12461. Set frequency scale.
  12462. It accepts the following values:
  12463. @table @samp
  12464. @item lin
  12465. Linear scale.
  12466. @item log
  12467. Logarithmic scale.
  12468. @item rlog
  12469. Reverse logarithmic scale.
  12470. @end table
  12471. Default is @code{lin}.
  12472. @item win_size
  12473. Set window size.
  12474. It accepts the following values:
  12475. @table @samp
  12476. @item w16
  12477. @item w32
  12478. @item w64
  12479. @item w128
  12480. @item w256
  12481. @item w512
  12482. @item w1024
  12483. @item w2048
  12484. @item w4096
  12485. @item w8192
  12486. @item w16384
  12487. @item w32768
  12488. @item w65536
  12489. @end table
  12490. Default is @code{w2048}
  12491. @item win_func
  12492. Set windowing function.
  12493. It accepts the following values:
  12494. @table @samp
  12495. @item rect
  12496. @item bartlett
  12497. @item hanning
  12498. @item hamming
  12499. @item blackman
  12500. @item welch
  12501. @item flattop
  12502. @item bharris
  12503. @item bnuttall
  12504. @item bhann
  12505. @item sine
  12506. @item nuttall
  12507. @item lanczos
  12508. @item gauss
  12509. @item tukey
  12510. @end table
  12511. Default is @code{hanning}.
  12512. @item overlap
  12513. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12514. which means optimal overlap for selected window function will be picked.
  12515. @item averaging
  12516. Set time averaging. Setting this to 0 will display current maximal peaks.
  12517. Default is @code{1}, which means time averaging is disabled.
  12518. @item colors
  12519. Specify list of colors separated by space or by '|' which will be used to
  12520. draw channel frequencies. Unrecognized or missing colors will be replaced
  12521. by white color.
  12522. @item cmode
  12523. Set channel display mode.
  12524. It accepts the following values:
  12525. @table @samp
  12526. @item combined
  12527. @item separate
  12528. @end table
  12529. Default is @code{combined}.
  12530. @end table
  12531. @anchor{showspectrum}
  12532. @section showspectrum
  12533. Convert input audio to a video output, representing the audio frequency
  12534. spectrum.
  12535. The filter accepts the following options:
  12536. @table @option
  12537. @item size, s
  12538. Specify the video size for the output. For the syntax of this option, check the
  12539. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12540. Default value is @code{640x512}.
  12541. @item slide
  12542. Specify how the spectrum should slide along the window.
  12543. It accepts the following values:
  12544. @table @samp
  12545. @item replace
  12546. the samples start again on the left when they reach the right
  12547. @item scroll
  12548. the samples scroll from right to left
  12549. @item rscroll
  12550. the samples scroll from left to right
  12551. @item fullframe
  12552. frames are only produced when the samples reach the right
  12553. @end table
  12554. Default value is @code{replace}.
  12555. @item mode
  12556. Specify display mode.
  12557. It accepts the following values:
  12558. @table @samp
  12559. @item combined
  12560. all channels are displayed in the same row
  12561. @item separate
  12562. all channels are displayed in separate rows
  12563. @end table
  12564. Default value is @samp{combined}.
  12565. @item color
  12566. Specify display color mode.
  12567. It accepts the following values:
  12568. @table @samp
  12569. @item channel
  12570. each channel is displayed in a separate color
  12571. @item intensity
  12572. each channel is displayed using the same color scheme
  12573. @item rainbow
  12574. each channel is displayed using the rainbow color scheme
  12575. @item moreland
  12576. each channel is displayed using the moreland color scheme
  12577. @item nebulae
  12578. each channel is displayed using the nebulae color scheme
  12579. @item fire
  12580. each channel is displayed using the fire color scheme
  12581. @item fiery
  12582. each channel is displayed using the fiery color scheme
  12583. @item fruit
  12584. each channel is displayed using the fruit color scheme
  12585. @item cool
  12586. each channel is displayed using the cool color scheme
  12587. @end table
  12588. Default value is @samp{channel}.
  12589. @item scale
  12590. Specify scale used for calculating intensity color values.
  12591. It accepts the following values:
  12592. @table @samp
  12593. @item lin
  12594. linear
  12595. @item sqrt
  12596. square root, default
  12597. @item cbrt
  12598. cubic root
  12599. @item 4thrt
  12600. 4th root
  12601. @item 5thrt
  12602. 5th root
  12603. @item log
  12604. logarithmic
  12605. @end table
  12606. Default value is @samp{sqrt}.
  12607. @item saturation
  12608. Set saturation modifier for displayed colors. Negative values provide
  12609. alternative color scheme. @code{0} is no saturation at all.
  12610. Saturation must be in [-10.0, 10.0] range.
  12611. Default value is @code{1}.
  12612. @item win_func
  12613. Set window function.
  12614. It accepts the following values:
  12615. @table @samp
  12616. @item rect
  12617. @item bartlett
  12618. @item hann
  12619. @item hanning
  12620. @item hamming
  12621. @item blackman
  12622. @item welch
  12623. @item flattop
  12624. @item bharris
  12625. @item bnuttall
  12626. @item bhann
  12627. @item sine
  12628. @item nuttall
  12629. @item lanczos
  12630. @item gauss
  12631. @item tukey
  12632. @end table
  12633. Default value is @code{hann}.
  12634. @item orientation
  12635. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12636. @code{horizontal}. Default is @code{vertical}.
  12637. @item overlap
  12638. Set ratio of overlap window. Default value is @code{0}.
  12639. When value is @code{1} overlap is set to recommended size for specific
  12640. window function currently used.
  12641. @item gain
  12642. Set scale gain for calculating intensity color values.
  12643. Default value is @code{1}.
  12644. @item data
  12645. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  12646. @end table
  12647. The usage is very similar to the showwaves filter; see the examples in that
  12648. section.
  12649. @subsection Examples
  12650. @itemize
  12651. @item
  12652. Large window with logarithmic color scaling:
  12653. @example
  12654. showspectrum=s=1280x480:scale=log
  12655. @end example
  12656. @item
  12657. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  12658. @example
  12659. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12660. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  12661. @end example
  12662. @end itemize
  12663. @section showspectrumpic
  12664. Convert input audio to a single video frame, representing the audio frequency
  12665. spectrum.
  12666. The filter accepts the following options:
  12667. @table @option
  12668. @item size, s
  12669. Specify the video size for the output. For the syntax of this option, check the
  12670. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12671. Default value is @code{4096x2048}.
  12672. @item mode
  12673. Specify display mode.
  12674. It accepts the following values:
  12675. @table @samp
  12676. @item combined
  12677. all channels are displayed in the same row
  12678. @item separate
  12679. all channels are displayed in separate rows
  12680. @end table
  12681. Default value is @samp{combined}.
  12682. @item color
  12683. Specify display color mode.
  12684. It accepts the following values:
  12685. @table @samp
  12686. @item channel
  12687. each channel is displayed in a separate color
  12688. @item intensity
  12689. each channel is displayed using the same color scheme
  12690. @item rainbow
  12691. each channel is displayed using the rainbow color scheme
  12692. @item moreland
  12693. each channel is displayed using the moreland color scheme
  12694. @item nebulae
  12695. each channel is displayed using the nebulae color scheme
  12696. @item fire
  12697. each channel is displayed using the fire color scheme
  12698. @item fiery
  12699. each channel is displayed using the fiery color scheme
  12700. @item fruit
  12701. each channel is displayed using the fruit color scheme
  12702. @item cool
  12703. each channel is displayed using the cool color scheme
  12704. @end table
  12705. Default value is @samp{intensity}.
  12706. @item scale
  12707. Specify scale used for calculating intensity color values.
  12708. It accepts the following values:
  12709. @table @samp
  12710. @item lin
  12711. linear
  12712. @item sqrt
  12713. square root, default
  12714. @item cbrt
  12715. cubic root
  12716. @item 4thrt
  12717. 4th root
  12718. @item 5thrt
  12719. 5th root
  12720. @item log
  12721. logarithmic
  12722. @end table
  12723. Default value is @samp{log}.
  12724. @item saturation
  12725. Set saturation modifier for displayed colors. Negative values provide
  12726. alternative color scheme. @code{0} is no saturation at all.
  12727. Saturation must be in [-10.0, 10.0] range.
  12728. Default value is @code{1}.
  12729. @item win_func
  12730. Set window function.
  12731. It accepts the following values:
  12732. @table @samp
  12733. @item rect
  12734. @item bartlett
  12735. @item hann
  12736. @item hanning
  12737. @item hamming
  12738. @item blackman
  12739. @item welch
  12740. @item flattop
  12741. @item bharris
  12742. @item bnuttall
  12743. @item bhann
  12744. @item sine
  12745. @item nuttall
  12746. @item lanczos
  12747. @item gauss
  12748. @item tukey
  12749. @end table
  12750. Default value is @code{hann}.
  12751. @item orientation
  12752. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12753. @code{horizontal}. Default is @code{vertical}.
  12754. @item gain
  12755. Set scale gain for calculating intensity color values.
  12756. Default value is @code{1}.
  12757. @item legend
  12758. Draw time and frequency axes and legends. Default is enabled.
  12759. @end table
  12760. @subsection Examples
  12761. @itemize
  12762. @item
  12763. Extract an audio spectrogram of a whole audio track
  12764. in a 1024x1024 picture using @command{ffmpeg}:
  12765. @example
  12766. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  12767. @end example
  12768. @end itemize
  12769. @section showvolume
  12770. Convert input audio volume to a video output.
  12771. The filter accepts the following options:
  12772. @table @option
  12773. @item rate, r
  12774. Set video rate.
  12775. @item b
  12776. Set border width, allowed range is [0, 5]. Default is 1.
  12777. @item w
  12778. Set channel width, allowed range is [80, 8192]. Default is 400.
  12779. @item h
  12780. Set channel height, allowed range is [1, 900]. Default is 20.
  12781. @item f
  12782. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  12783. @item c
  12784. Set volume color expression.
  12785. The expression can use the following variables:
  12786. @table @option
  12787. @item VOLUME
  12788. Current max volume of channel in dB.
  12789. @item CHANNEL
  12790. Current channel number, starting from 0.
  12791. @end table
  12792. @item t
  12793. If set, displays channel names. Default is enabled.
  12794. @item v
  12795. If set, displays volume values. Default is enabled.
  12796. @item o
  12797. Set orientation, can be @code{horizontal} or @code{vertical},
  12798. default is @code{horizontal}.
  12799. @item s
  12800. Set step size, allowed range s [0, 5]. Default is 0, which means
  12801. step is disabled.
  12802. @end table
  12803. @section showwaves
  12804. Convert input audio to a video output, representing the samples waves.
  12805. The filter accepts the following options:
  12806. @table @option
  12807. @item size, s
  12808. Specify the video size for the output. For the syntax of this option, check the
  12809. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12810. Default value is @code{600x240}.
  12811. @item mode
  12812. Set display mode.
  12813. Available values are:
  12814. @table @samp
  12815. @item point
  12816. Draw a point for each sample.
  12817. @item line
  12818. Draw a vertical line for each sample.
  12819. @item p2p
  12820. Draw a point for each sample and a line between them.
  12821. @item cline
  12822. Draw a centered vertical line for each sample.
  12823. @end table
  12824. Default value is @code{point}.
  12825. @item n
  12826. Set the number of samples which are printed on the same column. A
  12827. larger value will decrease the frame rate. Must be a positive
  12828. integer. This option can be set only if the value for @var{rate}
  12829. is not explicitly specified.
  12830. @item rate, r
  12831. Set the (approximate) output frame rate. This is done by setting the
  12832. option @var{n}. Default value is "25".
  12833. @item split_channels
  12834. Set if channels should be drawn separately or overlap. Default value is 0.
  12835. @item colors
  12836. Set colors separated by '|' which are going to be used for drawing of each channel.
  12837. @item scale
  12838. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12839. Default is linear.
  12840. @end table
  12841. @subsection Examples
  12842. @itemize
  12843. @item
  12844. Output the input file audio and the corresponding video representation
  12845. at the same time:
  12846. @example
  12847. amovie=a.mp3,asplit[out0],showwaves[out1]
  12848. @end example
  12849. @item
  12850. Create a synthetic signal and show it with showwaves, forcing a
  12851. frame rate of 30 frames per second:
  12852. @example
  12853. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  12854. @end example
  12855. @end itemize
  12856. @section showwavespic
  12857. Convert input audio to a single video frame, representing the samples waves.
  12858. The filter accepts the following options:
  12859. @table @option
  12860. @item size, s
  12861. Specify the video size for the output. For the syntax of this option, check the
  12862. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12863. Default value is @code{600x240}.
  12864. @item split_channels
  12865. Set if channels should be drawn separately or overlap. Default value is 0.
  12866. @item colors
  12867. Set colors separated by '|' which are going to be used for drawing of each channel.
  12868. @item scale
  12869. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12870. Default is linear.
  12871. @end table
  12872. @subsection Examples
  12873. @itemize
  12874. @item
  12875. Extract a channel split representation of the wave form of a whole audio track
  12876. in a 1024x800 picture using @command{ffmpeg}:
  12877. @example
  12878. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  12879. @end example
  12880. @end itemize
  12881. @section spectrumsynth
  12882. Sythesize audio from 2 input video spectrums, first input stream represents
  12883. magnitude across time and second represents phase across time.
  12884. The filter will transform from frequency domain as displayed in videos back
  12885. to time domain as presented in audio output.
  12886. This filter is primarly created for reversing processed @ref{showspectrum}
  12887. filter outputs, but can synthesize sound from other spectrograms too.
  12888. But in such case results are going to be poor if the phase data is not
  12889. available, because in such cases phase data need to be recreated, usually
  12890. its just recreated from random noise.
  12891. For best results use gray only output (@code{channel} color mode in
  12892. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  12893. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  12894. @code{data} option. Inputs videos should generally use @code{fullframe}
  12895. slide mode as that saves resources needed for decoding video.
  12896. The filter accepts the following options:
  12897. @table @option
  12898. @item sample_rate
  12899. Specify sample rate of output audio, the sample rate of audio from which
  12900. spectrum was generated may differ.
  12901. @item channels
  12902. Set number of channels represented in input video spectrums.
  12903. @item scale
  12904. Set scale which was used when generating magnitude input spectrum.
  12905. Can be @code{lin} or @code{log}. Default is @code{log}.
  12906. @item slide
  12907. Set slide which was used when generating inputs spectrums.
  12908. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  12909. Default is @code{fullframe}.
  12910. @item win_func
  12911. Set window function used for resynthesis.
  12912. @item overlap
  12913. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12914. which means optimal overlap for selected window function will be picked.
  12915. @item orientation
  12916. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  12917. Default is @code{vertical}.
  12918. @end table
  12919. @subsection Examples
  12920. @itemize
  12921. @item
  12922. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  12923. then resynthesize videos back to audio with spectrumsynth:
  12924. @example
  12925. 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
  12926. 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
  12927. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  12928. @end example
  12929. @end itemize
  12930. @section split, asplit
  12931. Split input into several identical outputs.
  12932. @code{asplit} works with audio input, @code{split} with video.
  12933. The filter accepts a single parameter which specifies the number of outputs. If
  12934. unspecified, it defaults to 2.
  12935. @subsection Examples
  12936. @itemize
  12937. @item
  12938. Create two separate outputs from the same input:
  12939. @example
  12940. [in] split [out0][out1]
  12941. @end example
  12942. @item
  12943. To create 3 or more outputs, you need to specify the number of
  12944. outputs, like in:
  12945. @example
  12946. [in] asplit=3 [out0][out1][out2]
  12947. @end example
  12948. @item
  12949. Create two separate outputs from the same input, one cropped and
  12950. one padded:
  12951. @example
  12952. [in] split [splitout1][splitout2];
  12953. [splitout1] crop=100:100:0:0 [cropout];
  12954. [splitout2] pad=200:200:100:100 [padout];
  12955. @end example
  12956. @item
  12957. Create 5 copies of the input audio with @command{ffmpeg}:
  12958. @example
  12959. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  12960. @end example
  12961. @end itemize
  12962. @section zmq, azmq
  12963. Receive commands sent through a libzmq client, and forward them to
  12964. filters in the filtergraph.
  12965. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  12966. must be inserted between two video filters, @code{azmq} between two
  12967. audio filters.
  12968. To enable these filters you need to install the libzmq library and
  12969. headers and configure FFmpeg with @code{--enable-libzmq}.
  12970. For more information about libzmq see:
  12971. @url{http://www.zeromq.org/}
  12972. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  12973. receives messages sent through a network interface defined by the
  12974. @option{bind_address} option.
  12975. The received message must be in the form:
  12976. @example
  12977. @var{TARGET} @var{COMMAND} [@var{ARG}]
  12978. @end example
  12979. @var{TARGET} specifies the target of the command, usually the name of
  12980. the filter class or a specific filter instance name.
  12981. @var{COMMAND} specifies the name of the command for the target filter.
  12982. @var{ARG} is optional and specifies the optional argument list for the
  12983. given @var{COMMAND}.
  12984. Upon reception, the message is processed and the corresponding command
  12985. is injected into the filtergraph. Depending on the result, the filter
  12986. will send a reply to the client, adopting the format:
  12987. @example
  12988. @var{ERROR_CODE} @var{ERROR_REASON}
  12989. @var{MESSAGE}
  12990. @end example
  12991. @var{MESSAGE} is optional.
  12992. @subsection Examples
  12993. Look at @file{tools/zmqsend} for an example of a zmq client which can
  12994. be used to send commands processed by these filters.
  12995. Consider the following filtergraph generated by @command{ffplay}
  12996. @example
  12997. ffplay -dumpgraph 1 -f lavfi "
  12998. color=s=100x100:c=red [l];
  12999. color=s=100x100:c=blue [r];
  13000. nullsrc=s=200x100, zmq [bg];
  13001. [bg][l] overlay [bg+l];
  13002. [bg+l][r] overlay=x=100 "
  13003. @end example
  13004. To change the color of the left side of the video, the following
  13005. command can be used:
  13006. @example
  13007. echo Parsed_color_0 c yellow | tools/zmqsend
  13008. @end example
  13009. To change the right side:
  13010. @example
  13011. echo Parsed_color_1 c pink | tools/zmqsend
  13012. @end example
  13013. @c man end MULTIMEDIA FILTERS
  13014. @chapter Multimedia Sources
  13015. @c man begin MULTIMEDIA SOURCES
  13016. Below is a description of the currently available multimedia sources.
  13017. @section amovie
  13018. This is the same as @ref{movie} source, except it selects an audio
  13019. stream by default.
  13020. @anchor{movie}
  13021. @section movie
  13022. Read audio and/or video stream(s) from a movie container.
  13023. It accepts the following parameters:
  13024. @table @option
  13025. @item filename
  13026. The name of the resource to read (not necessarily a file; it can also be a
  13027. device or a stream accessed through some protocol).
  13028. @item format_name, f
  13029. Specifies the format assumed for the movie to read, and can be either
  13030. the name of a container or an input device. If not specified, the
  13031. format is guessed from @var{movie_name} or by probing.
  13032. @item seek_point, sp
  13033. Specifies the seek point in seconds. The frames will be output
  13034. starting from this seek point. The parameter is evaluated with
  13035. @code{av_strtod}, so the numerical value may be suffixed by an IS
  13036. postfix. The default value is "0".
  13037. @item streams, s
  13038. Specifies the streams to read. Several streams can be specified,
  13039. separated by "+". The source will then have as many outputs, in the
  13040. same order. The syntax is explained in the ``Stream specifiers''
  13041. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  13042. respectively the default (best suited) video and audio stream. Default
  13043. is "dv", or "da" if the filter is called as "amovie".
  13044. @item stream_index, si
  13045. Specifies the index of the video stream to read. If the value is -1,
  13046. the most suitable video stream will be automatically selected. The default
  13047. value is "-1". Deprecated. If the filter is called "amovie", it will select
  13048. audio instead of video.
  13049. @item loop
  13050. Specifies how many times to read the stream in sequence.
  13051. If the value is less than 1, the stream will be read again and again.
  13052. Default value is "1".
  13053. Note that when the movie is looped the source timestamps are not
  13054. changed, so it will generate non monotonically increasing timestamps.
  13055. @item discontinuity
  13056. Specifies the time difference between frames above which the point is
  13057. considered a timestamp discontinuity which is removed by adjusting the later
  13058. timestamps.
  13059. @end table
  13060. It allows overlaying a second video on top of the main input of
  13061. a filtergraph, as shown in this graph:
  13062. @example
  13063. input -----------> deltapts0 --> overlay --> output
  13064. ^
  13065. |
  13066. movie --> scale--> deltapts1 -------+
  13067. @end example
  13068. @subsection Examples
  13069. @itemize
  13070. @item
  13071. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13072. on top of the input labelled "in":
  13073. @example
  13074. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13075. [in] setpts=PTS-STARTPTS [main];
  13076. [main][over] overlay=16:16 [out]
  13077. @end example
  13078. @item
  13079. Read from a video4linux2 device, and overlay it on top of the input
  13080. labelled "in":
  13081. @example
  13082. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13083. [in] setpts=PTS-STARTPTS [main];
  13084. [main][over] overlay=16:16 [out]
  13085. @end example
  13086. @item
  13087. Read the first video stream and the audio stream with id 0x81 from
  13088. dvd.vob; the video is connected to the pad named "video" and the audio is
  13089. connected to the pad named "audio":
  13090. @example
  13091. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13092. @end example
  13093. @end itemize
  13094. @subsection Commands
  13095. Both movie and amovie support the following commands:
  13096. @table @option
  13097. @item seek
  13098. Perform seek using "av_seek_frame".
  13099. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13100. @itemize
  13101. @item
  13102. @var{stream_index}: If stream_index is -1, a default
  13103. stream is selected, and @var{timestamp} is automatically converted
  13104. from AV_TIME_BASE units to the stream specific time_base.
  13105. @item
  13106. @var{timestamp}: Timestamp in AVStream.time_base units
  13107. or, if no stream is specified, in AV_TIME_BASE units.
  13108. @item
  13109. @var{flags}: Flags which select direction and seeking mode.
  13110. @end itemize
  13111. @item get_duration
  13112. Get movie duration in AV_TIME_BASE units.
  13113. @end table
  13114. @c man end MULTIMEDIA SOURCES